4 Exposing agents with MCP
This chapter covers
- The Model Context Protocol (MCP)
- Building a documentation crew
- Setting up a custom MCP server
- Integrating MCP with Cursor
4.1 Introduction to MCP
So far, we have used function calling as the mechanism that lets a model request a specific operation in a structured way. When the model decides to call a function, the host application receives a well-formed payload, runs the function, and then feeds the result back into the model. This is a powerful primitive, but it is also tightly coupled to the API surface of a specific model provider and to the conventions of the client that is doing the orchestration.
This is where the Model Context Protocol comes in. MCP is an open standard that defines how an AI client can discover and call external capabilities in a consistent way. The project is part of the Agentic AI Foundation (AAIF), which operates as a directed fund under the Linux Foundation, and has support from major players like Google, Microsoft, OpenAI, and Anthropic.