What is MCP (Model Context Protocol) and how does it work? A guide with diagrams

Marcos Marcolin • November 27, 2026 • 9 min read

AI Open Source

MCP (Model Context Protocol) is an open protocol that standardizes how AI applications connect to external tools and data. Instead of every assistant (Claude Code, Cursor, ChatGPT) building its own integration with GitHub, a database or Jira, the tool implements an MCP server once and any compatible application can use it.

A comparison that usually helps: MCP is to AI agents what USB is to peripherals. You don't need a different cable for every computer.

In this post I explain how MCP works in practice, with diagrams, example messages and how to use it in Claude Code.

Not a developer? Read up to the section Why it matters for your product. From there on, the post goes into implementation details.

Table of contents

The problem MCP solves

A language model, on its own, only knows what was in its training data and what you paste into the conversation. To be useful in a developer's day to day, it needs to look things up (issues, tables, logs, docs) and do things (open a PR, run a query, create a ticket).

Before MCP, every AI application solved this its own way. With 3 applications and 4 tools, that's 12 different integrations, each with its own format, its own auth and its own bugs.

With a shared protocol, the math changes: each application implements the client side once, each tool implements the server side once, and everyone can talk to each other.

Without MCP, 3 apps and 4 tools need 12 integrations. With MCP, 7 implementations all speak the same protocol

It's the same reasoning behind LSP (Language Server Protocol), which standardized how editors talk to languages. MCP actually takes inspiration from it.

The protocol was created by Anthropic in November 2024 and, in December 2025, donated to the Agentic AI Foundation, under the Linux Foundation. So today it isn't "one company's protocol", it's an open standard with neutral governance.

Host, client and server

MCP has three roles, and understanding each one clears up 90% of the confusion:

MCP architecture: the host contains the model and several MCP clients, each connected to a server, which in turn reaches a data source

Notice an important detail: the model never talks to the server directly. The host does, through its clients. The model only "asks" to use a tool, and the host decides whether to run it, ask for your approval, or block it.

Under the hood, messages follow the JSON-RPC 2.0 format. Nothing magical: JSON objects with method, params and id.

Why it matters for your product

If you work in product or management, MCP changes a few things in practice:

What an MCP server offers

A server can expose three kinds of things, called primitives:

Primitive What it is Who decides to use it Example
Tools Functions that do something The model list_issues, run_query, create_ticket
Resources Read-only data identified by a URI The application or the user A file, a table schema, a log
Prompts Ready-made prompt templates The user "Review this PR", "Explain this query"

In practice, tools are by far the most used. When someone says "I installed the GitHub MCP", they almost always mean a server that exposes tools.

Each tool comes with a name, a text description and a JSON Schema for its parameters. The model reads that description to decide when and how to call the tool. That's why a well-written description matters as much as the code.

A tool call, step by step

Let's see what happens when you ask Claude Code how many open issues a repository has, with a GitHub MCP server configured:

Flow of an MCP tool call: the user asks, the host lists the server's tools, the LLM picks one, the server calls the GitHub API and the result travels back to the user

  1. You ask the question in natural language.
  2. The host asks the server which tools exist (tools/list).
  3. The server answers with the list of tools and their schemas.
  4. The model reads the descriptions, picks the list_issues tool and builds the arguments.
  5. The host sends tools/call to the server.
  6. The server calls the real GitHub API.
  7. The API responds.
  8. The server returns the result to the host.
  9. The model uses that result to write the answer.

The messages exchanged in steps 5 and 8 look roughly like this (simplified):

{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "list_issues",
    "arguments": { "repo": "acme/shop", "state": "open" }
  }
}
{
  "jsonrpc": "2.0",
  "id": 7,
  "result": {
    "content": [
      { "type": "text", "text": "12 open issues: #41 Fix RSS, #39 ..." }
    ]
  }
}

The part I find most interesting: the server knows nothing about AI. It receives JSON, runs a function and returns JSON. The "intelligence" lives in the model, which decides what to call. For backend developers, writing an MCP server is very similar to writing an API endpoint.

The latest revision of the spec, 2026-07-28, made the protocol stateless: the initialize handshake and the sessions on the HTTP transport are gone, and every request now carries the client's version and capabilities. That makes servers running behind a load balancer much simpler. The details are in the official changelog.

stdio or HTTP?

The spec defines two transports, that is, two ways for messages to travel between client and server:

MCP transports: with stdio, the host starts the server as a local process and talks over stdin and stdout. With Streamable HTTP, the server runs remotely and receives POST requests

The old "HTTP+SSE" transport is deprecated. If you find tutorials talking about it, they're probably out of date.

In part 3 of this series I show an MCP server over HTTP in PHP, with token authentication.

Using MCP in Claude Code

In Claude Code, adding a server is one command.

A remote server (HTTP):

claude mcp add --transport http github https://api.githubcopilot.com/mcp/

A local server (stdio), passing the command that starts the process after --:

claude mcp add my-server -- /path/to/my-server

To check what's configured:

claude mcp list

And inside a session, the /mcp command shows the status of each server and lets you authenticate the ones that use OAuth.

A useful tip for teams: with --scope project, the config goes into a .mcp.json file at the root of the repository. That way everyone who clones the project gets the same servers, versioned alongside the code.

MCP vs API, CLI and agents

A lot of confusion comes from mixing MCP up with things it isn't:

Security tips

An MCP server is code running with your credentials. Treat it like any other dependency:

FAQ

Is MCP only for Claude? No. It was created by Anthropic, but today it's an open standard maintained by the Agentic AI Foundation, under the Linux Foundation. Cursor, VS Code, ChatGPT and many other applications support MCP.

What's the difference between MCP and function calling? Function calling is the model's ability to ask for a function to run. MCP is the protocol that standardizes where those functions come from and how they're called. A host uses function calling under the hood so the model can pick the tools that came from MCP servers.

Is MCP secure? The protocol is as secure as the servers you install and the permissions you give them. See the security section.

What's the current version of the spec? Revision 2026-07-28, which made the protocol stateless. The full spec is at modelcontextprotocol.io.

Conclusion

At the end of the day, MCP is a simple, well-executed idea: a shared contract, over JSON-RPC, so any AI application can use any tool. It isn't magic, but it solves a real integration problem, the same way LSP did for editors.

For backend developers, the good part is that writing an MCP server is a lot like what we already do every day: receive a request, validate parameters, run some business logic and return a result.

In the next post we'll get our hands dirty and build an MCP server from scratch. Then, in the third part, we put that server online over HTTP, with authentication and a tool that writes data.

See you next time, and cheers!

Share: