Get the plugin
WP MCP/Blog/Post

By · Published

MCP protocol explained: lifecycle, messages, transports

explainermcp

MCP protocol explained: lifecycle, messages and transports

The MCP protocol is what lets one AI app work with many systems without custom glue for each. If you want the plain-language picture first, read what an MCP server is. This article is the next layer down: what actually travels between a client and a server, in what order, and how that changed in the newest revision.

You do not need this to use a WordPress MCP server. It helps when a connection fails and you need to read a log, when you build a client, or when you want to judge a claim such as “supports the latest spec”. The details below come from the official specification at modelcontextprotocol.io, checked against the 2025-11-25 and 2026-07-28 revisions.

The MCP protocol in one paragraph

MCP is a set of JSON-RPC 2.0 messages with two roles. A client lives inside an AI app and a server exposes capabilities. The client asks the server what it offers, then calls what it needs. A server can offer three kinds of things: tools (actions the model can call), resources (data the app can read) and prompts (reusable templates). Tools get their own article in MCP tools explained, and the other two are covered in MCP resources and prompts.

Everything else in the protocol is plumbing around those calls: how to agree on a version, how to declare what each side supports, how to carry messages, and how to close.

Messages: three shapes of JSON-RPC

MCP messages are JSON-RPC, encoded as UTF-8. There are three shapes.

  • A request has an id, a method and optional params. It expects an answer.
  • A response has the same id and either a result or an error.
  • A notification has a method and no id. Nobody answers it.

Here is a request and its response for listing tools. The method names are fixed by the specification, and the tool shown is a WordPress example.

{ "jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {} }
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "wpmcp-get-post",
        "description": "Read a post's full content, status, terms, meta, and featured image",
        "inputSchema": {
          "type": "object",
          "properties": { "post_id": { "type": "integer" } },
          "required": ["post_id"]
        }
      }
    ]
  }
}

That list is trimmed to one entry for the article. A real WordPress site returns many. Tool names follow the specification’s naming guidance, which allows letters, digits, underscore, hyphen and dot, so WP MCP’s wpmcp/get-post ability is advertised as wpmcp-get-post.

The method families you will see most are:

Method Direction Purpose
initialize, notifications/initialized client to server Open a session (2025-11-25 and earlier)
server/discover client to server Ask for versions, capabilities and identity (2026-07-28)
tools/list, tools/call client to server Find and run tools
resources/list, resources/read client to server Find and read data
prompts/list, prompts/get client to server Find and fetch templates
notifications/tools/list_changed server to client The tool list changed

The lifecycle on 2025-11-25: initialize, operate, shut down

In the 2025-11-25 revision a connection has three phases: initialization, operation and shutdown.

Initialization

The client must open with an initialize request. It carries the protocol version the client supports, its capabilities and a description of itself.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-11-25",
    "capabilities": { "roots": { "listChanged": true } },
    "clientInfo": { "name": "ExampleClient", "version": "1.0.0" }
  }
}

The server answers with the version it will use, its own capabilities and its identity. It may also include free-text instructions for the model. The capabilities object is how a server announces that it has tools, resources or prompts, and whether it sends listChanged notifications.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-11-25",
    "capabilities": { "tools": { "listChanged": true }, "resources": {}, "prompts": {} },
    "serverInfo": { "name": "ExampleServer", "version": "1.0.0" },
    "instructions": "Optional guidance for the model"
  }
}

Then the client sends a notifications/initialized notification to say it is ready. Until the server has answered initialize, the client should not send anything except pings.

Version negotiation

If the server supports the version the client asked for, it replies with the same one. If not, it replies with another version it does support, normally its latest. A client that cannot work with that version should disconnect. Over HTTP the client then sends an MCP-Protocol-Version header on every later request.

Operation and shutdown

During operation both sides use only the capabilities that were negotiated. There is no shutdown message. The transport signals it: on stdio the client closes the input stream and waits for the process to exit, and on HTTP closing the connection is enough.

The lifecycle on 2026-07-28: no handshake

The 2026-07-28 revision removes the handshake. The specification states it directly: there is no negotiation handshake, and every request carries the protocol version it uses. Version, client identity and client capabilities travel in each request’s _meta field.

{
  "jsonrpc": "2.0",
  "id": "discover-1",
  "method": "server/discover",
  "params": {
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientInfo": { "name": "ExampleClient", "version": "1.0.0" },
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

The server answers a server/discover request with the versions it supports, its capabilities, its identity and optional instructions. Servers must implement this method. Clients may call it first, but are not required to. A client can send any request directly, and if the server does not speak that version it returns an UnsupportedProtocolVersionError (code -32022) that lists the versions it does support. The client picks one and retries.

Two things follow from this design:

  • No session to lose. A load balancer can send each request to a different machine, because nothing about the connection lives in one process’s memory.
  • No guessing the client. The server sees the client’s version and capabilities on every request, not just once at the start.

A server may support both eras. A request carrying the modern _meta is served statelessly. An initialize request selects the older behaviour. The specification calls this a dual-era implementation, and its compatibility matrix says a legacy client fails against a server that is modern only.

WP MCP is dual-era. Its README states that both transports speak 2026-07-28 and 2025-11-25, and that server/discover lists both revisions and returns the same handshake instructions initialize does.

Transports: how the messages travel

The protocol defines two standard transports. The messages are identical on both. For a longer comparison with WordPress examples, see remote MCP servers.

stdio

The client launches the server as a subprocess. The server reads JSON-RPC from standard input and writes to standard output. Messages are delimited by newlines and must not contain embedded newlines. The server may write logs to standard error, and it must not write anything to standard output that is not a valid MCP message. That last rule is the cause of many “invalid JSON” errors when a script prints a stray line.

WP MCP’s stdio bridge is wp mcp-stdio serve --user=<login>. The --user option is required, because WP-CLI has to know which WordPress user the agent acts as.

Streamable HTTP

The server exposes one endpoint. Each client message is a new HTTP POST, and the client must send an Accept header listing both application/json and text/event-stream. The server answers a request with either a single JSON object or an SSE stream scoped to that request. A notification gets 202 Accepted with no body.

For WP MCP the endpoint is:

https://your-site.com/wp-json/mcp/wpmcp-server

The two revisions differ here too. On 2025-11-25 a server can issue an MCP-Session-Id header at initialization, the client repeats it on later requests, and a client can open a GET stream for server-initiated messages. On 2026-07-28 the specification states that the GET stream endpoint and protocol-level sessions are removed. Requests carry MCP-Protocol-Version and Mcp-Method headers, and Mcp-Name for tools/call, resources/read and prompts/get. The server must reject a request whose headers disagree with its body.

The older HTTP plus SSE transport from 2024-11-05 is deprecated, and new work should use Streamable HTTP.

Security rules that live in the protocol

The transport rules carry a few security requirements worth knowing:

  • Streamable HTTP servers must validate the Origin header and answer an invalid one with HTTP 403, to block DNS rebinding.
  • A server that runs locally should bind to 127.0.0.1, not all interfaces.
  • Servers should authenticate every connection.

Authentication itself is layered on top of the transport and is covered in MCP authentication methods and the MCP OAuth explainer. For WP MCP, an application password goes in a Basic header, and OAuth 2.1 with dynamic client registration is off until the site owner sets WPMCP_OAUTH_ENABLED or the wpmcp_oauth_enabled filter. The MCP security guide covers what to lock down.

Reading the protocol on a live server

You can watch all of this without an AI app. Point a plain HTTP client at the endpoint with an application password and send a tools/list request, or use MCP Inspector, which shows each message as it goes. The MCP Inspector guide walks through it against a WordPress site, and the MCP tutorial builds up from a first connection.

A sequence to try on a test site:

  1. Send server/discover (or initialize, depending on the revision you want to see) and read the capabilities.
  2. Send tools/list and count the tools. A WordPress site with WP MCP can expose up to 407, which is 274 in the free plugin and 133 in Pro. The exact number depends on which optional plugins are active, and list-tool-catalog shows what a site has.
  3. Send one tools/call for a read tool, such as wpmcp-list-posts.
  4. Send a malformed call, for instance an unknown tool name, and compare the protocol error with a tool error.

If a client reports zero tools while the endpoint answers correctly, the fault is usually in the client’s handling of the list, and the transport is fine. Reading the raw messages tells you which side is at fault.

What to take from this

  • MCP is JSON-RPC with a small, fixed set of methods. It is not a new kind of network service.
  • Older revisions open with initialize, and the 2026-07-28 revision drops the handshake in favour of per-request metadata and server/discover.
  • stdio runs locally as a subprocess, and Streamable HTTP is how a website is reached.
  • Errors come in two layers, protocol errors and tool errors, and models only see the second kind as something to correct.

To see the protocol on a real site, install WP MCP and read the WordPress MCP server page for what it exposes. Pro adds deep page builder editing and more, and its plans are on the pricing page.

Common questions

What is the MCP protocol?

The MCP protocol (Model Context Protocol) is an open specification for how an AI app talks to an outside system. It defines JSON-RPC messages for discovering and calling tools, reading resources and fetching prompts, plus the rules for connecting, negotiating versions and closing. Any client and server that follow it can work together.

Does MCP use JSON-RPC?

Yes. Every MCP message is a JSON-RPC 2.0 message encoded as UTF-8: a request with an id and a method, a response with a result or an error, or a notification with a method and no id. The transports only decide how those messages are carried.

What is the difference between the 2025-11-25 and 2026-07-28 revisions?

On 2025-11-25 a connection starts with an initialize request, an answer, and a notifications/initialized message, and over HTTP the server may issue a session ID. On 2026-07-28 there is no handshake: every request carries its protocol version and client details in _meta, and server/discover is available to learn what a server supports. A server can serve both.

Which transports does MCP define?

Two standard ones: stdio, where the client launches the server as a subprocess and exchanges newline-delimited messages on standard input and output, and Streamable HTTP, where each message is an HTTP POST to a single endpoint. Custom transports are allowed if they keep the message format.

How does the MCP protocol handle errors?

Two ways. Protocol errors are ordinary JSON-RPC errors, for example for an unknown tool or a malformed request. Errors inside a tool's own work come back as a normal result with isError set to true, so the model can read the message and try again.

Which MCP revisions does WP MCP support?

WP MCP serves 2025-11-25 and 2026-07-28 on both its HTTP endpoint and its stdio bridge. A 2025-11-25 client runs the usual initialize session. A 2026-07-28 client calls the sessionless server/discover and tags each request with the revision. The server answers whichever the client sends.