MCP Troubleshooting, Versions and Message Reference

Find the failing layer first. Then use the tables to look up codes, methods and version differences.

BeginnerIntermediateExpert · 11 min read · Last updated:

In short

Work from the bottom up: can the process start or the address be reached, do both sides speak a common protocol version, is the request authorized, is the server listing what you expect, and only then, is the model choosing and calling correctly. Most hours are lost by debugging prompts when the problem is a path, a header or a version.

What you will learn: a diagnosis order, symptoms and fixes for both transports, a probe script, status and error codes, revision history and a method reference.
Prerequisites: Build an MCP Server and Client and MCP Messages, Transports and Advanced Features.

Versions used

Checked against the 2026-07-28 specification in November 2026. Output comes from Python package mcp 2.3.0; other libraries may word errors differently.

Beginner Find the layer

Diagnose in this order

1. Start or reachprocess, address, certificate
2. Versioncommon revision
3. Authorizetoken and scope
4. Discovertools and schemas
5. Usechoice and arguments
Do not move right until the step on the left is proven.

A probe script

This short client connects, reports the negotiated version, lists tools and flags weak definitions. Run it with an HTTP address as the argument. Without one it checks the example server and then an address where nothing is listening.

"""Probe an MCP server and report the first thing that is wrong."""
import asyncio
import sys

from mcp import Client


async def diagnose(target):
    try:
        async with Client(target, read_timeout_seconds=10) as client:
            print("connected, protocol", client.protocol_version)
            tools = (await client.list_tools()).tools
            print(f"tools listed: {len(tools)}")
            for tool in tools:
                problems = []
                if len(tool.description or "") < 20:
                    problems.append("description too short")
                if not tool.input_schema.get("properties"):
                    problems.append("takes no arguments (check intended)")
                print(f"  {tool.name}: {', '.join(problems) or 'ok'}")
    except BaseException as error:
        while isinstance(error, BaseExceptionGroup):
            error = error.exceptions[0]
        print("failed:", type(error).__name__)


if __name__ == "__main__":
    if len(sys.argv) > 1:
        asyncio.run(diagnose(sys.argv[1]))
    else:
        from orders import mcp
        print("== in-process server")
        asyncio.run(diagnose(mcp))
        print("== address with nothing listening")
        asyncio.run(diagnose("http://127.0.0.1:9/mcp"))

Output:

== in-process server
connected, protocol 2026-07-28
tools listed: 2
  list_orders: takes no arguments (check intended)
  cancel_order: ok
== address with nothing listening
failed: ConnectError

"Takes no arguments" is a prompt to check, not an error: listing orders needs none. The official MCP Inspector offers an interactive view of the same information and lets you call tools by hand.

stdio problems

SymptomLikely causeFix
Server not foundThe host does not use your shell's pathGive absolute paths to the program and script
Works in a terminal, fails in the hostDifferent directory, environment or interpreterSet variables in the host configuration; name the interpreter
Parse errors or sudden disconnectSomething printed to standard outputSend all logs to standard error
Missing moduleDependencies installed elsewhereUse the environment's own interpreter
Changes have no effectThe old process is still runningRestart the host or server
Windows command fails to launchQuoting, or a script that needs a command shellCheck path escaping in JSON; call the real executable
Escaping in configuration files

In JSON, each backslash in a Windows path must be doubled, or you can use forward slashes. A single backslash often produces a confusing "file not found".

Intermediate HTTP, authorization and tools

HTTP status codes

StatusUsual meaningCheck
400Header mismatch, unsupported version, missing capability or malformed requestRead the JSON-RPC error code in the body
401No token, or an invalid oneWWW-Authenticate, expiry, audience
403Missing scope, or a refused OriginRequired scope; allowed origins
404Unknown method, or wrong addressWith -32601 it is the method; otherwise the path
405GET or DELETE to a server that supports only the new revisionAn older client
202A notification was acceptedNothing; this is success
502, 504Gateway could not get a response in timeInstance health, timeouts, buffering

JSON-RPC and MCP error codes

CodeMeaningTypical fix
-32700Parse errorSend valid JSON; check stdio framing
-32600Invalid requestCheck the message shape and endpoint behavior
-32601Method not foundCheck spelling, revision and declared capability
-32602Invalid parameters; also a missing resource, or expired request state in this SDKCompare with the schema; restart the exchange
-32603Internal errorRead server logs with the request id
-32020Header mismatchSend required headers matching the body
-32021Missing required client capabilityDeclare it in request metadata
-32022Unsupported protocol versionRetry with a version the error lists

Broken requests and what came back

Output from the probe in MCP Messages, Transports and Advanced Features:

resultType: input_required
asks for:   elicitation/create
has state:  True
resultType: complete
text:       Canceled A-100

valid call                HTTP 200
wrong Mcp-Name            HTTP 400  -32020
missing Mcp-Method        HTTP 400  -32020
unknown protocol version  HTTP 400  -32022
unknown method            HTTP 404  -32601
unknown tool              HTTP 200  result with isError: true
foreign Origin            HTTP 403
GET on the endpoint       HTTP 400  -32600

Authorization problems

SymptomLook at
Client never opens a sign-in pageWhether the 401 includes the resource metadata address, and the address is reachable
Sign-in works, calls still 401The token's audience compared with the server's canonical address, including trailing slashes
Registration refusedWhich registration methods the authorization server supports
Response rejected by the clientIssuer value mismatch between metadata and response
Repeated consent loopScopes requested compared with scopes required
Fails only behind a proxyPublic host name used in metadata and settings

Tool problems

SymptomLikely causeFix
Tool missing from the listNot registered, filtered by permission, cached list, or an invalid header annotationList with the probe; check cache lifetime and client warnings
Model never calls itVague description or a similar toolRewrite and evaluate
Wrong argument typesLoose schemaAdd types, enumerations and examples
Result ignored or misreadToo long or unclearShorten and structure it
Confirmation fails at randomInstances do not share the request-state keySee MCP Deployment and Production Readiness
Action happens twiceRetry after a broken streamOperation keys

Testing by hand

When a client library hides the detail, send one request yourself. This command shape works against a server on the current revision; replace the address and add an Authorization header for protected servers.

curl -i http://127.0.0.1:8000/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "server/discover",
       "params": {"_meta": {
         "io.modelcontextprotocol/protocolVersion": "2026-07-28",
         "io.modelcontextprotocol/clientCapabilities": {}}}}'

The command was not run as written here; the same request shape is exercised by the Python probe. A reply listing supported versions proves reachability, headers and version in one step. On Windows PowerShell, quoting differs, so put the body in a file and pass it with -d "@body.json".

Intermittent failures

PatternSuspectEvidence to collect
Fails after some minutes of quietAn idle timeout closing a streamDuration before the drop; proxy settings
Fails for a share of requestsOne unhealthy or differently configured instanceInstance id beside each failure
Fails just after a releaseCached definitions or mixed versionsRelease time, cache lifetime, client version
Fails around token expiryRefresh not handled, or clocks out of stepExpiry times and server clock
Fails under load onlyRate limits, connection pools or downstream timeoutsQueue depth and latency by dependency

Add a correlation identifier to every request and print it in errors. One identifier that appears in the host, gateway, server and downstream logs turns an afternoon of guessing into a short search.

Two worked diagnoses

Illustrative case: tools vanish in the desktop host

A server works from a terminal but the host shows no tools. Step 1 shows the host cannot start it. The host log reports a missing module. The configuration names a bare python, which resolves to a different interpreter from the one in the terminal. Using the full path to the environment's interpreter fixes it. No prompt or protocol change was needed.

Illustrative case: every call returns 400 behind a new proxy

Direct calls succeed, calls through the proxy fail with -32020. Comparing headers at both ends shows the proxy drops names it does not recognize, including Mcp-Method. Allowing the MCP headers through fixes it, and a synthetic check through the proxy is added so the next proxy change is caught early.

Both follow the same habit: compare a request that works with one that fails and change a single thing between them.

Expert Versions and message reference

Revision history

RevisionNotable for
2024-11-05First public revision, with HTTP and SSE
2025-03-26Streamable HTTP replaces HTTP and SSE
2025-06-18Protocol version header on HTTP, among other changes
2025-11-25Experimental tasks and authorization improvements
2026-07-28Stateless core, input-required results, extensions, deprecations

A client that supports old and new revisions may try the modern request first. On a 400 response it should read the body: a recognized modern error means the server is modern and the request needs correcting; otherwise it can fall back to the older initialization handshake.

Method reference, 2026-07-28

MethodDirectionPurpose
server/discoverClient requestVersions, capabilities, identity
tools/list, tools/callClient requestDiscover and run tools
resources/list, resources/templates/list, resources/readClient requestDiscover and read data
prompts/list, prompts/getClient requestDiscover and fill prompts
completion/completeClient requestArgument suggestions
subscriptions/listenClient requestStream of chosen change notices
tasks/get, tasks/update, tasks/cancelClient requestTasks extension
notifications/progress, notifications/messageServer noticeProgress and logs for a request
notifications/…/list_changed, notifications/resources/updatedServer noticeChanges, on a subscription
notifications/cancelledClient notice, stdioCancel a request

Names you may meet in older code

OldNow
initialize, notifications/initializedRemoved; metadata on each request
Mcp-Session-IdRemoved; use explicit handles
pingRemoved
resources/subscribesubscriptions/listen
logging/setLevelPer-request log level
tasks/result, tasks/listRemoved from the redesigned extension
sampling/createMessage, roots/listDeprecated features, now carried as input requests

Writing a useful bug report

  • Client, server and SDK versions, and the negotiated protocol version
  • Transport, and any proxy or gateway in between
  • The smallest request that fails, with tokens and personal data removed
  • Status code, error code and the server log line for the same request
  • Whether the probe script and the Inspector reproduce it
  • What changed most recently

When one client works and another does not

CompareLook for
Specification revisionOne speaks an older revision with a different connection sequence
Transportstdio on one side, HTTP on the other, with different configuration
Supported featuresA client that cannot ask the person for input, or does not use an extension
CredentialsDifferent accounts, scopes or token audiences
EnvironmentDifferent paths, variables, proxies or certificates
LimitsShorter timeouts or smaller accepted results

Capture the same call from both clients, with secrets removed, and compare them line by line. The first difference is usually the explanation.

When to look beyond the protocol

If listing tools and calling one directly both succeed, the connection is sound. A wrong choice of tool, odd arguments or a poor final answer come from descriptions, context or the model. Move to MCP Tool Design and MCP vs APIs for tool shape and Debugging Agents, RAG and Handoffs for the wider trace, and keep the failing request as a test case.

Common mistakes

MistakeBetter practice
Changing the prompt to fix a connection errorProve the lower layers first
Ignoring the error bodyThe code usually names the cause
Upgrading client and server together while debuggingChange one side at a time
Pasting real tokens into reportsRedact; rotate anything exposed

Checklist

  • The process starts or the address answers
  • The negotiated version is the one you expect
  • Authorization succeeds with the right audience and scope
  • The tool list and schemas match the release
  • A hand-made call works before a model is involved
  • The fix has a regression test

Frequently asked questions

Why does my old client fail against a new server?

It may rely on the initialization handshake or session header. Check whether the server also implements the older revision, and upgrade the client if not.

Where should a stdio server write logs?

To standard error or a file. Standard output carries protocol messages only.

Why is a new tool not visible?

The client may hold a cached list, the server may filter by permission, or the old process may still be running. Check each in turn.

Is an isError result a protocol failure?

No. The call was processed and the tool reports a problem. Handle it in the conversation or the calling code.

References and further reading

Next steps