The Model Context Protocol and Connecting AI to Tools
How the Model Context Protocol lets AI apps use outside tools and data, what hosts, clients and servers do, and how to connect them safely.
Key takeaways
- MCP standardizes how an AI application discovers and uses outside tools and data.
- A host app runs one or more clients, and each client talks to a server that wraps a particular system.
- Servers can offer tools that act, resources that supply data and prompts that serve as templates.
- The model only requests actions; the application and server decide what actually runs.
- Installing a server means trusting its code and its descriptions, so vet it like any other software.
The Model Context Protocol, usually shortened to MCP, is an open protocol for connecting AI applications to tools and data. Someone writes a server for a system, such as a file store, a database or a ticket tracker, and any application that speaks the protocol can use it. You get one kind of plug in place of a custom integration for every pairing.
Anthropic introduced MCP as an open standard in 2024, and other vendors and projects have since adopted it. The specification continues to change, so treat the official documentation as the authority on current details.
The problem it solves
A language model by itself can't read your calendar or query your inventory. Developers have long added that ability with custom code: describe a function to the model, run it when asked, return the result. That works, but each app had to build its own connector to each service. Ten apps and ten services could mean a hundred separate integrations.
A shared protocol changes the arithmetic. A service gets one MCP server, an app gets one MCP client implementation, and they interoperate. The idea resembles how a common standard lets any browser load any website, or how a USB port accepts many kinds of devices.
MCP doesn't make a model smarter or a service safer. It defines the conversation between the pieces.
Hosts, clients and servers
The protocol uses three roles:
- Host: the application you use, such as a desktop assistant or a code editor. It manages the model, the user interface and permissions.
- Client: a component inside the host that keeps a connection to one server.
- Server: a program that exposes a system's capabilities. It might wrap a folder on your disk or a company's online service.
Note that "server" here describes a role. An MCP server can be a small process running on your own laptop.
What a server can offer
Three main kinds of capability appear in the specification:
| Capability | What it is | Typical example |
|---|---|---|
| Tools | Actions the model can request, each with a name, description and input schema | create_ticket, search_orders |
| Resources | Data the application can read and place in context | A file, a table schema, a document |
| Prompts | Reusable templates a user can pick | "Summarize this week's changes" |
Tools are the part that gets the most attention because they can change things. A tool's input schema is written in JSON Schema, which tells the model what arguments are expected and lets software validate them. If you want to inspect such JSON by hand, the JSON formatter makes it readable.
The protocol also includes features that flow the other way, letting a server ask the client for certain things. Support varies between applications, so check what your host implements.
What a tool call looks like
MCP messages use JSON-RPC 2.0, a simple format in which a request names a method and carries parameters, and a response returns a result or an error with a matching ID. A simplified request to run a tool looks like this:
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "search_orders",
"arguments": { "customer_email": "[email protected]", "limit": 5 }
}
} Client and server also have to agree on a protocol version and the features each supports. Earlier revisions of the specification did this with an opening initialize handshake. The 2026-07-28 revision removed it: each request now states the protocol version and the client's capabilities, and a client can call server/discover to learn what a server supports. Software built on older revisions may still use the handshake. Either way, the client asks for the list of tools before the model can choose one.
Two details matter here. The model never talks to the server directly. And the tool result becomes text the model reads, with all the influence that implies.
Local and remote servers
A server can reach the client in two main ways.
Local servers run as a process on your computer and communicate over standard input and output. They can reach local files and programs, and they run with whatever access your user account gives them unless something restricts them.
Remote servers are reached over HTTP across a network. They suit hosted services and teams. They need authentication, and the specification describes an authorization approach based on OAuth. The ideas behind keys, tokens and OAuth apply: grant narrow scopes, and revoke what you no longer use.
Configuration differs from one host to another. Many ask you to add an entry naming a command to run or a URL to connect to. Follow your application's own instructions.
How it differs from an ordinary API
An API is written for programmers who read documentation and then write code against it. An MCP server often sits in front of an API and presents it in a way an AI application can discover at run time: here are the actions, here's what each does in plain language, here are the inputs.
That makes tool descriptions part of the working system. A vague description leads the model to pick the wrong tool or fill arguments badly. If you build a server, a few habits help:
- offer a small number of clearly distinct tools;
- name arguments plainly and mark which are required;
- return concise results, because large outputs crowd the context window;
- return useful error messages the model can act on;
- separate read-only tools from ones that modify data.
A worked example
Picture a small team that wants an assistant to answer "which orders are stuck?" They could write a server that exposes two tools: list_delayed_orders, which takes a number of days, and get_order, which takes an order ID. Both are read-only and use a database account that can only read the relevant views.
A user asks the question in the host application. The model sees the two tool descriptions, chooses list_delayed_orders with an argument of three days, and the host asks the user to approve if it's configured to. The server validates that the argument is a sensible number, runs a fixed query and returns a short list. The model may then call get_order for one entry and explain what it finds.
Notice what the design leaves out. There's no tool that accepts arbitrary database commands, so a confused or manipulated model can't delete a table. The server checks inputs itself and doesn't assume the model followed the schema. And results are trimmed to the columns needed, which keeps customer details the question didn't require out of the conversation.
If the team later wants the assistant to issue refunds, that should be a separate tool with its own approval, limits and logging, not a quiet extension of the read tools.
The security picture
Connecting tools to a model widens what can go wrong.
- Untrusted server code. A local server is a program you're running. A malicious one needs no clever AI trick to read your files.
- Misleading descriptions. The model reads tool descriptions as guidance, so a hostile server can hide instructions in them. Descriptions can also change after you approved the server.
- Injection through results. A tool that returns email or web content may carry text that tries to redirect the agent. See prompt injection.
- Combined access. One server reads private data, another can send messages. Together they create a route for leaks that neither has alone.
- Over-broad credentials. A database server using an administrator account turns a small error into a large one.
The protocol's guidance expects hosts to keep people in control, with consent for data access and tool use. How well that works depends on the particular app.
Connecting a server sensibly
- Prefer servers published by the service's own maker, or open code you or someone you trust has reviewed.
- Pin a version where you can, and look at changes before updating.
- Give the server its own limited credential: read-only when reading is all you need.
- Restrict file servers to a specific folder.
- Keep approval prompts on for anything that writes, sends, deletes or spends.
- Read the arguments in an approval prompt, not only the tool's name.
- Disconnect servers you aren't using.
- Keep logs of tool calls if your host provides them.
Broader scoping advice appears in permissions and guardrails for AI agents.
When something doesn't work
Most early problems are ordinary software problems.
| Symptom | Likely cause | What to check |
|---|---|---|
| Server doesn't appear | Wrong command, path or configuration syntax | The host's logs and the configuration file |
| Connects, but no tools listed | Server failed during startup or lacks that capability | Run the server alone and read its error output |
| Authorization fails | Expired token, missing scope, wrong account | Reconnect and review granted permissions |
| Model picks the wrong tool | Overlapping or vague descriptions | Disable unused tools; improve wording |
| Answers get worse with many servers | Too many tool descriptions crowding context | Connect only what the task needs |
With local servers that use standard input and output, stray text printed to standard output can corrupt the message stream, so developers should send diagnostic messages to standard error.
Do you need it?
If you only ask questions and paste text, you don't. MCP pays off when you want an assistant to work with systems you use repeatedly, or when you build software that should plug into several AI applications. For a single fixed integration inside your own product, calling an API directly may be simpler.
Either way, the question to settle first is the same: what should this assistant be able to read and change? The protocol can carry any answer, including a careless one.