Model Context Protocol
MCP is a standard way to plug tools and data into any compatible agent, so you write the integration once.
Words on this page (7)
- MCP
- : Model Context Protocol: a standard for plugging tools and data into AI apps.
- tool
- : A function the model can ask your program to run, described by a name, description and argument schema.
- agent
- : A model run in a loop that chooses its own tools and steps until the task is done.
- prompt
- : The input text you give a model, including instructions, examples and data.
- stdio
- : Standard input and output: how a local program talks to the program that started it, used by local MCP servers.
- token
- : A piece of text the model reads and writes, usually a word or part of a word. About 4 characters of English on average.
- logarithm
- : The power you raise a base to in order to get a number. log base 2 of 8 is 3 because 2 to the power 3 is 8.
What it is
An server exposes , resources and over a defined protocol. An MCP client, built into an app such as an IDE or coding , connects to servers and makes their tools available to the model. Servers run locally over or remotely over HTTP. Existing servers cover things like GitHub, databases, browsers and file systems.
What to watch
Every connected server adds tool descriptions to context, so a dozen servers can eat the window before work starts. Connect only what the task needs. Servers also run with real permissions, so a server you did not write is code you are trusting. Read what it can do, scope its access, and be careful when it mixes private data with untrusted content. A different approach is to let the agent call tools through code it writes, which keeps unused tool definitions out of context.
A worked example: connecting one server
You add a "filesystem" server to your coding agent, pointing at one folder. The agent now lists a tool such as read_file and can use it when you ask "summarize the notes in this folder". You added no code. You added a connection. Later you add a calendar server the same way.
Be selective
Every server's tool descriptions are loaded into the model's context. Ten servers can use thousands of before you ask a question, and they confuse tool choice. Add the ones you need today.
How a connection works
- The host app starts a local server or connects to a remote one.
- Client and server exchange a handshake saying which features each supports.
- The client asks for the list of tools, resources and prompts.
- The tool descriptions are added to the model's context.
- When the model asks for a tool, the client forwards the call. The server runs it and returns the result.
MCP is plumbing. It makes connecting easy, but it does not make the model better at choosing tools. Results still depend on how clear the descriptions are.
What the context cost looks like
Invented numbers for illustration: 8 servers with 6 tools each is 48 tool descriptions. At about 150 tokens each, that is 7,200 tokens spent before you type a word. In a 100,000 token window, that is 7.2 percent. It also gives the model 48 choices, and more choices raise the chance of a wrong pick.
A second example: when MCP is not needed
Your own app has two tools and nobody else will use them. Plain functions in the same codebase are simpler. MCP pays off when many apps share an integration, or when you want a third-party server that someone else maintains.
What goes wrong
The tools never appear. The server failed to start because of a wrong path or a missing runtime. Run the server command by hand in a terminal and read its error.
A local server using stdio breaks silently if it prints debugging text to standard output, because that channel carries the protocol. to standard error instead.
Two servers expose tools with similar names and the model confuses them. Disable one and test again.
Try it yourself
Connect one reference filesystem server to a folder holding three small text files. Ask the agent to summarize them, then ask about a file outside that folder. Expect the first to work and the second to fail or be refused. That boundary is the scope you set.
Common mistake
Installing servers from strangers without reading what they can do. A server can read files or act with your accounts.
Before USB, every device had its own plug. Before MCP, every AI app needed custom code for every tool. With MCP, someone writes a GitHub connector once, and any compatible app, from a coding agent to a chat client, can use it. It is a standard plug for AI tools.
Check yourself
Why not connect every MCP server you can find?
Not quite. Context budget and trust both argue for connecting only what the task needs.
What does MCP standardize?
Not quite. It is the protocol between a client app and tool servers.
You install a small server from a stranger and give it access to your files. What is the risk?
Not quite. A server runs with real access, so a malicious one can misuse it.
You got 0 of 3 right.
Go deeper
- Docs
MCP project · Specification, concepts and quickstarts.
- CourseHugging Face MCP CourseCourse
Hugging Face · Build both client and server from scratch.
- Repo
MCP project · Official servers and SDK links.
- Repo
punkpeye · Large community index of servers by category.
- ArticleCode execution with MCPArticle
Anthropic · Cutting context cost by calling tools through code.
Spotted a mistake or something unclear? Report it on GitHub.