Skip to content
MCP fundamentals· Guide 1 of 6Beginner8 min readUpdated

What is the Model Context Protocol (MCP)? ​

The Model Context ProtocolModel Context Protocol (MCP): An open protocol that lets AI applications discover and use tools, data and prompt templates from separate servers through one standard set of JSON-RPC messages. (MCP) is an open standard for connecting AI applications to tools and data. A program called an MCP serverMCP server: A program that offers tools, resources or prompts to AI applications over the Model Context Protocol, locally over stdio or remotely over HTTP. offers tools, resources and prompts; an AI application connects to it as an MCP clientMCP client: The part of an AI application that holds one connection to one MCP server: it negotiates the protocol version and capabilities, then sends that server's requests and receives its replies., lists what it offers and calls it with JSON-RPC messages. Write a server once, and MCP-capable apps and agents can use it.

The problem it solves ​

Before a shared protocol, every pairing of an AI app and a tool needed its own glue code. Ten apps and twenty tools could mean up to two hundred small integrations, each with its own way of describing arguments, returning errors and handling credentials.

MCP turns that into one contract on each side. A tool author writes one MCP server. An app author writes one MCP client. Any client can then talk to any server, because both speak the same messages: "what do you offer?", "run this tool with these arguments", "here is the result".

That is the whole idea. MCP does not make models smarter. It makes tools portable.

Hosts, clients and servers ​

The specification names three roles:

  • The host is the AI application the person uses: a chat app, an IDE, or an agent runtime like L2M. It holds the conversation, talks to the model, and decides which servers to connect to and what the model may call.
  • A client lives inside the host. The host creates one client per server, and each client keeps exactly one connection, so a host with three servers runs three clients.
  • A server is a program that offers capabilities. It can run as a local process on the same machine, or as a remote service over HTTP.
An MCP host with three clients, each connected to one serverThe host application contains three MCP clients. Client 1 connects to a files server over stdio on the same machine. Client 2 connects to a database server over stdio. Client 3 connects to a remote server over Streamable HTTP.Host (the AI app)holds the chat, calls the modelMCP client 1MCP client 2MCP client 3stdiostdioStreamable HTTPFiles serverlocal processDatabase serverlocal processTicketing serverremote service
One host, one client per server. Servers are not meant to see each other or the whole conversation: the host decides what each one receives.

The split matters for security. The specification's design principles say servers should not be able to read the whole conversation or "see into" other servers. The host sits in the middle and keeps those boundaries. MCP hosts, clients and servers goes further: local and remote servers, and where each credential lives.

What a server offers: tools, resources, prompts ​

A server can offer three kinds of things. The specification separates them by who is in control:

PrimitiveWho controls itWhat it isExample
ToolsThe modelFunctions the model can ask to runCreate a ticket, query a table, write a file
ResourcesThe applicationData the app reads and attaches as contextA file's contents, a database schema
PromptsThe userTemplates the person picksA "summarise this incident" command

Tools get the most attention, because they are how an agent acts. An MCP toolMCP tool: A named action an MCP server offers, described by a JSON Schema for its input, that a model can ask to call and a client runs with a tools/call request. has a name, a description and a JSON Schema for its input. It can also declare an output schema, and hints about its behaviour, such as whether it only reads. The specification tells clients to treat those hints as untrusted unless the server is trusted.

MCP tools, resources and prompts explains when a server should use each one, what output schemas add, and how tool errors differ from protocol errors.

In the other direction, a client can offer features to the server. In the 2025-11-25 revision these are sampling (the server asks the client's model for a completion), elicitation (the server asks the person a question) and roots (the client tells the server which folders it may work in).

A tool call, step by step ​

Here is what happens when an agent answers "What is the weather in New York?" with a weather server attached.

The messages of one MCP tool callThe MCP client sends tools/list to the server and gets the tool list. It sends the messages and tool definitions to the model. The model asks for get_weather with a location. The client sends tools/call to the server and gets a result. The client gives the result to the model, which writes the final answer.ModelHost + clientthe agent runtimeMCP server1. tools/listtools: get_weather, …2. messages + tool listtool call: get_weather3. tools/callresult (content)4. tool resultfinal answer
The model never talks to the server. It only names a tool; the client makes the call.
  1. Discover. The client sends tools/list. The server answers with each tool's name, description and input schema.

  2. Offer. The host sends the conversation and the tool definitions to the model, in whatever format that model's API uses for tool callingTool calling: A model's structured request to run one named tool with JSON arguments, instead of answering in text. The application runs the tool and returns the result..

  3. Call. The model replies with a tool call instead of text: a tool name and arguments. The client turns that into a tools/call request:

    json
    {
      "jsonrpc": "2.0",
      "id": 2,
      "method": "tools/call",
      "params": { "name": "get_weather", "arguments": { "location": "New York" } }
    }

    The server runs the tool and returns content:

    json
    {
      "jsonrpc": "2.0",
      "id": 2,
      "result": {
        "content": [{ "type": "text", "text": "Current weather in New York:\nTemperature: 72°F\nConditions: Partly cloudy" }],
        "isError": false
      }
    }
  4. Answer. The host adds the result to the conversation and calls the model again. The model now writes its answer, or asks for another tool.

Steps 2 to 4 repeat until the model stops asking for tools. That repetition is the agent loop, covered in What is an AI agent?.

Two kinds of errors. A tool that fails returns a normal result with isError: true and a message, such as "date must be in the future". The specification says clients should pass these to the model so it can correct itself and retry. Problems with the request itself, such as an unknown tool name, come back as JSON-RPC errors instead.

Transports in one minute ​

MCP messages are JSON-RPC 2.0. A transport carries them. The specification defines two:

  • stdio. The client starts the server as a child process and exchanges messages over its standard input and output. Good for local servers: nothing listens on the network.
  • Streamable HTTP. The client sends each message as an HTTP POST to one endpoint. The server replies with JSON, or with a stream of server-sent events, for example to send progress before the result. This is the transport for remote servers.

An older HTTP-with-SSE transport from 2024 is deprecated. If a server's docs mention a separate SSE endpoint, that is the old style.

What MCP does not do ​

MCP is a wire protocol. It leaves several things to the host:

  • Authorization is optional. The specification defines an OAuth 2.1 flow for HTTP servers, but a server may skip it. Local stdio servers take credentials from their environment instead. See MCP authorization.
  • No policy. Nothing in the protocol says which user may call which tool, or with which arguments. The tools page says there SHOULD always be a human in the loop with the ability to deny tool invocations, and leaves the how to the application.
  • No audit or budget. The specification suggests that clients log tool usage and time out slow calls, but it defines no log format, retention or spending cap.
  • No trust in tool descriptions. A tool's description goes straight into the model's context. A malicious or careless server can put instructions there. Pick servers you trust, and pin their versions.

These gaps are where hosts and gateways differ most.

Versions and how the spec changes ​

MCP versions are dates in the form YYYY-MM-DD: the last date a backwards-incompatible change was made. A client and a server must use a version they both support.

  • 2025-11-25 is the previous revision. A connection starts with an initialize handshake that agrees the version and capabilities, and an HTTP server can keep a session with an Mcp-Session-Id header.
  • 2026-07-28 is the current revision. It makes MCP stateless: the initialize handshake and protocol sessions are gone, and every request carries its own protocol version and client capabilities. A new server/discover request lets a client ask what a server supports up front. Server-to-client requests, such as asking the person a question, are replaced by a pattern where the server answers "input required" and the client retries the request with the answer. The revision also deprecates Roots, Sampling, Logging and OAuth dynamic client registration, and adopts a lifecycle policy that normally keeps a deprecated feature in the specification for at least twelve months.

Old and new revisions can work together: the 2026-07-28 specification describes how a client or server detects a handshake-era counterpart and falls back.

MCP in L2M ​

L2M plays both roles:

  • As a host and client. An Agent Orchestrator node calls MCP tools through MCP Tool nodes attached to its tool port. Servers run over Streamable HTTP or stdio, and an in-process mock server ships for trying things without setup. The MCP server registry keeps one entry per server, with health probes and the history of its tool schemas.
  • As a server. The MCP gateway serves workflows and registered tools to other MCP clients, such as an IDE agent, through toolsetsToolset: A named, curated group of tools, drawn from several MCP servers and workflows, served at one MCP endpoint so each client sees only the tools it needs. with a token per client.

On protocol versions: by default the gateway speaks 2025-11-25, 2025-06-18 and 2025-03-26, and when L2M connects to a server it asks for 2025-06-18. Wider 2026-07-28 support is opt-in: with MCP_GATEWAY_MODERN_PROTOCOL=on the gateway also serves 2026-07-28 clients without sessions, and MCP_CLIENT_PROTOCOL_DEFAULT (or a server's own protocolMode) lets L2M talk to 2026-07-28 servers first. Even by default, L2M switches to 2026-07-28 for a server that speaks nothing older. MCP transports explains what changes on the wire.

The gaps listed above are covered by optional L2M features: tool policy to allow, deny or require approval per tool, approvals before write tools, and tool-call telemetry. A simple workflow needs none of them.

Try it in L2M ​

The live demo has a support agent with two MCP tools on a small HTTP server: a knowledge-base lookup and a calculator. Its recorded run shows the full exchange: one lookup_kb call, then a calculator call that fails because the model passed words instead of digits (the server answers with isError: true; the trace shows its error message), then a retry with 49*12*12 that works. The run was recorded with a scripted stand-in model, so the demo needs no key.

To build one yourself with no API key, use the zero-key MCP agent recipe or the five-minute tutorial. Both use the built-in echo model, which never asks for a tool, so a local run stops after one model call. Attach a real chat model to watch tools get called.

Further reading ​

Last updated:

This website (not the L2M product) uses Google Analytics, only after you accept cookies. Cookie settings