Model Context Protocol (MCP)
How AI assistants connect to tools and data
The Model Context Protocol (MCP) is an open standard that lets an AI app (the host) plug into external tools and data through MCP servers. The host discovers what tools a server offers, the model decides when to use them, and the host makes the calls. Here is one remote MCP connection from handshake to tool call.
Intermediate · 5 steps
| Message format | JSON-RPC 2.0 |
|---|---|
| Transports | stdio (local), Streamable HTTP (remote) |
| Server offers | Tools, resources, prompts |
| Remote auth | OAuth 2.1 + PKCE |
| Key risk | LLM06:2025 Excessive Agency |
| Rule | Tokens are bound to one server |
Step by step
Initialize Agreeing on version and capabilities
Alice adds the ticketing MCP server to her assistant. The host connects and sends
initializewith the protocol version it speaks and what it supports. The server answers with its own capabilities, here that it offers tools, and the host confirms it is ready.Authorize OAuth for remote servers
The server answers the first real request with 401 and points to its authorization server. The host runs a standard OAuth flow with PKCE in Alice's browser and gets an access token meant only for this MCP server.
Discover tools What can this server do?
The host calls
tools/list. Each tool comes with a name, a description written for the model, and a JSON schema for its inputs. The host passes these descriptions to the model, which is why they must be trusted text.Call a tool The model asks, the host decides
Alice asks: "Any open tickets about the VPN?" The model replies with a request to use
search_tickets. The host shows Alice what will be called, then sendstools/call. The server calls the ticketing API with its own credentials and returns the result, which goes back to the model to write the answer.Write actions need consent Keep a human in the loop
When the model wants to
create_ticket, the host pauses and asks Alice to approve the exact title and text. If the server tried to use Alice's token against some other API, that API would reject it, because the token's audience is only this MCP server.
Security notes
- Only connect MCP servers from sources you trust, and pin their versions
- Ask the user to approve tool calls, showing the full arguments
- Give each server the smallest scopes and file-system roots it needs
- Never pass the user's token through to other APIs; each server gets its own audience-bound token
- Log every tool call with its arguments and result
More in AI & LLM Security.
Packets
| No. | Time | Source | Destination | Protocol | Info | Size |
|---|