Sub topic 1
Why MCP exists: from custom integrations to one protocol
Prerequisites
This chapter assumes you can read basic Python or TypeScript and are comfortable with JSON. You should know roughly how an LLM application calls tools: the model emits a structured request, the application runs it, and the result goes back to the model. You should also know the basics of client-server communication and HTTP. You do not need to have used MCP before.
The problem: every pairing needs its own glue
An AI application is only as useful as the data and actions it can reach. A chat assistant that cannot read your files, query your database, or open a ticket is limited to what it learned in training. So application authors connect their models to outside systems.
Before a shared protocol existed, each connection was a custom integration. The author of an AI application wrote code for one specific service. That code covered:
- How to authenticate to the service.
- How to describe the service's operations to the model, usually as a JSON Schema for each function.
- How to translate the model's tool call into the service's API call.
- How to translate the result back into text the model can use.
- How to handle errors, timeouts, and updates to the service's API.
This work is repeated for every pair of application and service. If there are M AI applications and N services, the total number of integrations is M × N.
Three applications and three services need nine integrations. Ten applications and fifty services need five hundred. Each integration is maintained separately, drifts as either side changes, and is usable only by the application it was written for.
The idea: one protocol in the middle
The Model Context Protocol (MCP) is an open protocol that standardizes how AI applications connect to external tools and data. The design follows an older pattern. The Language Server Protocol (LSP) did the same for code editors. Before LSP, every editor needed its own support for every programming language. With LSP, a language ships one language server, and any editor that speaks LSP can use it.
MCP applies this to AI. A service author writes one MCP server. An application author adds MCP support once. After that, any application can use any server. The count drops from M × N integrations to M + N implementations.
The same example now needs six implementations instead of nine. Ten applications and fifty services need sixty instead of five hundred. The saving grows as the ecosystem grows.
The "P" node in the diagram is not a running piece of software. It stands for the shared specification. In practice each application talks directly to each server, but both sides follow the same rules.
What MCP standardizes
MCP does not replace the model's own tool calling. A model provider's API still defines how a model asks for a function to be run. MCP sits one layer outward. It defines how the application discovers what is available and how it talks to the thing that does the work.
The protocol fixes these things:
| Concern | What MCP specifies |
|---|---|
| Message format | JSON-RPC 2.0 requests, responses, and notifications |
| Session start | An initialization handshake that negotiates protocol version and capabilities |
| Transport | stdio for local processes and Streamable HTTP for remote servers |
| Server features | Tools, resources, and prompts, each with list and use operations |
| Client features | Sampling, roots, and elicitation, which a server can request from the client |
| Utilities | Notifications, progress reporting, cancellation, and logging |
Later chapters cover each row. For now, the point is that these details are defined once, in a public specification, rather than reinvented per integration.
A concrete comparison
Consider an application that needs to let a model read from a ticket system.
With a custom integration, the developer writes a function wrapping the ticket API. They write a JSON Schema describing it and register it with their model call. If they later switch to a different application framework, they port the wrapper. If a second team wants the same capability in a different tool, they write it again.
With MCP, the ticket system's owner (or anyone) publishes a server. The application connects to it and asks what it offers. The request is a standard JSON-RPC message:
{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}The server replies with a list of tool definitions. Each includes a name, a description, and an input schema. The application passes these definitions to the model. When the model chooses a tool, the application forwards the call to the server using tools/call. The application contains no ticket-specific code. Connecting to a different server, for a calendar or a database, uses the same path.
Discovery at runtime is the second major difference. A custom integration is fixed at build time. An MCP client learns what a server offers when it connects, and a server can announce later that its list has changed.
The three roles
MCP names three roles. Later chapters examine them closely, so this is only an orientation.
- The host is the AI application the user interacts with, such as a desktop assistant or an IDE.
- A client is a component inside the host. Each client holds one connection to one server.
- A server is a program that exposes capabilities, such as tools, resources, and prompts.
The distinction between host and client matters. A host can run many clients at once, each connected to a different server. The host coordinates them and decides what the model sees.
What servers expose
A server can offer three kinds of capability. They differ in who decides when each is used.
| Primitive | Controlled by | Purpose |
|---|---|---|
| Tools | The model | Actions the model can choose to invoke |
| Resources | The application | Data the application reads and adds as context |
| Prompts | The user | Reusable templates the user picks explicitly |
Putting the control point in the design is deliberate. A tool that deletes a record should not run just because it exists. The host can ask the user to approve it. A resource is read by application logic rather than by the model's choice. A prompt appears in a menu and runs only when the user selects it.
Trade-offs and limits
MCP is useful, but it is not free of cost or risk.
- Extra moving parts. A direct function call inside your own process is simpler than a separate server process with a session lifecycle. If you build one application with two fixed tools, MCP may be more machinery than you need.
- Context cost. Every tool definition a server exposes is text the model must read. Connecting many servers with many tools consumes context window space and can make tool selection less accurate.
- Trust. A server is code that runs with real permissions, and its tool descriptions are text that influences the model. A malicious or compromised server can try to mislead the model. The security chapter covers consent, scoping, and how to treat untrusted servers.
- Uneven support. Hosts differ in which features they implement. Many support tools well, while fewer support sampling or elicitation. Check what your host supports.
- The protocol evolves. Versions are identified by date, for example
2025-06-18. The initialization handshake exists partly so both sides can agree on a version they share.
Decision criteria
MCP fits well when several of these hold:
- More than one application should use the same capability.
- The capability is owned by a different team or vendor than the application.
- You want users to add or swap capabilities without changing application code.
- You need discovery at runtime rather than a fixed list at build time.
A plain in-process function is likely enough when you control one application, the tools are few and stable, and no one else needs them.
Summary of the model
MCP turns an M × N integration problem into an M + N one by putting a standard protocol between AI applications and the systems they use. Hosts contain clients, clients connect one-to-one with servers, and messages follow JSON-RPC 2.0. Servers offer tools, resources, and prompts. Clients can offer sampling, roots, and elicitation back. The next chapter takes the three roles one at a time.
Exercise
A team has 4 AI applications and 12 internal services. How many custom integrations would they need without a shared protocol, and how many implementations with MCP? Name one reason they might still skip MCP.
Show answer
Without a shared protocol they need 4 × 12 = 48 integrations. With MCP they need 4 + 12 = 16 implementations (4 client-side, 12 server-side). They might skip MCP if only one application uses a couple of stable tools, because an in-process function avoids the cost of separate server processes and session handling.
Exercise
Tools, resources, and prompts are each controlled by a different party. Which party controls each, and why does this matter for a tool that deletes data?
Show answer
Tools are controlled by the model, resources by the application, and prompts by the user. Because the model chooses when to invoke a tool, a destructive tool needs a consent step. The host can ask the user to approve the call before it is sent to the server.
Exercise
Why is the central "MCP" node in the second diagram not a running service?
Show answer
It represents the shared specification. Each application connects directly to each server, and both sides follow the same protocol rules, so no intermediary process is required.