# MCP explained, on one page

Checked against the MCP specification, revision 2026-07-28.

## What it is

The Model Context Protocol (MCP) is a protocol, built on JSON-RPC, that lets
an AI application reach tools and data on servers through one standard
interface. A server exposes its capabilities once, and any application that
speaks MCP can use them.

## Host, client, server

| Role   | What it is                        | What it does                                          |
| ------ | --------------------------------- | ----------------------------------------------------- |
| Host   | The AI application you use        | Creates clients, enforces consent, talks to the model |
| Client | A connector inside the host       | Talks to exactly one server                           |
| Server | A local process or remote service | Exposes tools, resources and prompts                  |

One host runs many clients, and each client has a 1:1 relationship with one
server. By design, a server should not be able to read the whole conversation
or see into other servers. The full history stays with the host.

## What a server exposes

| Primitive | Who decides when it is used | What it is                                  |
| --------- | --------------------------- | ------------------------------------------- |
| Tools     | The model                   | Functions the model can call, with a schema |
| Resources | The application             | Data for context, each identified by a URI  |
| Prompts   | The user                    | Message templates, often shown as commands  |

## Two standard transports

| Transport       | How it works                                                                               | Pick it when                                      |
| --------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| stdio           | The client launches the server as a subprocess; messages travel on stdin and stdout        | The server runs on the same machine as the client |
| Streamable HTTP | The server is an independent process with one endpoint; every message is its own HTTP POST | The server is remote, or shared by many clients   |

- stdio: the server must write nothing to stdout except MCP messages. Log to
  stderr.
- Streamable HTTP: the server must validate the `Origin` header and should
  authenticate every connection. A reply is one JSON object or an event stream
  scoped to that request.
- The messages mean the same thing on both. Only the delivery differs.
- The older HTTP+SSE transport is deprecated. Do not build on it.

## The life of one tool call

1. The host creates a client for each configured server.
2. The client may call `server/discover` to learn the server's supported
   versions and capabilities.
3. The client sends `tools/list`. The server returns each tool's `name`,
   `description` and `inputSchema`.
4. The model reads those definitions and selects a tool and its arguments.
5. The host should let a human see the call and deny it.
6. The client sends `tools/call` with the tool name and the arguments.
7. The server validates the input, does the work and returns a result:
   `content` for the model, and `isError: true` if the tool failed.
8. The client passes the result to the model, which continues.

The protocol is stateless in this revision. There is no `initialize`
handshake and no session: every request carries its own protocol version and
client capabilities in `_meta`. A server that needs more input answers with an
`input_required` result, and the client retries the same call with the input.

## Two kinds of errors

- **Tool execution error**: a result with `isError: true` and a message. The
  model can read it and retry with better arguments.
- **Protocol error**: a JSON-RPC error, for example an unknown tool. The model
  is less likely to recover from it.

## Before you connect a server

- [ ] I know who wrote it, and I have read what it does.
- [ ] It gets the least access the job needs: one folder, one database role.
- [ ] I start read-only and add write tools only when a task needs them.
- [ ] Secrets come from environment variables, never from a committed file.
- [ ] A human can see and deny tool calls, at least for sensitive operations.
- [ ] I treat tool output as untrusted input. A server that fetches external
      content can carry instructions written by someone else.
- [ ] I treat tool descriptions and annotations as untrusted unless I trust
      the server.
- [ ] A remote server uses HTTPS and authentication.

## Glossary

- **JSON-RPC**: the message format MCP uses, encoded as UTF-8.
- **Capability**: a feature a client or server declares, such as `tools`.
- **`server/discover`**: the request that returns a server's versions,
  capabilities and identity.
- **`inputSchema`**: the JSON Schema that defines a tool's parameters.
- **`_meta`**: the field on every request that carries the protocol version
  and client capabilities.
- **MCP endpoint**: the single URL a Streamable HTTP server accepts POST on.
- **`subscriptions/listen`**: the request a client opens to receive change
  notifications, such as a changed tool list.
- **Handle**: an id a tool returns so later calls can refer to stored state,
  because the protocol has no session.
