MCP Troubleshooting, Versions and Message Reference
Find the failing layer first. Then use the tables to look up codes, methods and version differences.
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.
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.
Diagnose in this order
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
| Symptom | Likely cause | Fix |
|---|---|---|
| Server not found | The host does not use your shell's path | Give absolute paths to the program and script |
| Works in a terminal, fails in the host | Different directory, environment or interpreter | Set variables in the host configuration; name the interpreter |
| Parse errors or sudden disconnect | Something printed to standard output | Send all logs to standard error |
| Missing module | Dependencies installed elsewhere | Use the environment's own interpreter |
| Changes have no effect | The old process is still running | Restart the host or server |
| Windows command fails to launch | Quoting, or a script that needs a command shell | Check path escaping in JSON; call the real executable |
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".
HTTP status codes
| Status | Usual meaning | Check |
|---|---|---|
| 400 | Header mismatch, unsupported version, missing capability or malformed request | Read the JSON-RPC error code in the body |
| 401 | No token, or an invalid one | WWW-Authenticate, expiry, audience |
| 403 | Missing scope, or a refused Origin | Required scope; allowed origins |
| 404 | Unknown method, or wrong address | With -32601 it is the method; otherwise the path |
| 405 | GET or DELETE to a server that supports only the new revision | An older client |
| 202 | A notification was accepted | Nothing; this is success |
| 502, 504 | Gateway could not get a response in time | Instance health, timeouts, buffering |
JSON-RPC and MCP error codes
| Code | Meaning | Typical fix |
|---|---|---|
-32700 | Parse error | Send valid JSON; check stdio framing |
-32600 | Invalid request | Check the message shape and endpoint behavior |
-32601 | Method not found | Check spelling, revision and declared capability |
-32602 | Invalid parameters; also a missing resource, or expired request state in this SDK | Compare with the schema; restart the exchange |
-32603 | Internal error | Read server logs with the request id |
-32020 | Header mismatch | Send required headers matching the body |
-32021 | Missing required client capability | Declare it in request metadata |
-32022 | Unsupported protocol version | Retry 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
| Symptom | Look at |
|---|---|
| Client never opens a sign-in page | Whether the 401 includes the resource metadata address, and the address is reachable |
| Sign-in works, calls still 401 | The token's audience compared with the server's canonical address, including trailing slashes |
| Registration refused | Which registration methods the authorization server supports |
| Response rejected by the client | Issuer value mismatch between metadata and response |
| Repeated consent loop | Scopes requested compared with scopes required |
| Fails only behind a proxy | Public host name used in metadata and settings |
Tool problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Tool missing from the list | Not registered, filtered by permission, cached list, or an invalid header annotation | List with the probe; check cache lifetime and client warnings |
| Model never calls it | Vague description or a similar tool | Rewrite and evaluate |
| Wrong argument types | Loose schema | Add types, enumerations and examples |
| Result ignored or misread | Too long or unclear | Shorten and structure it |
| Confirmation fails at random | Instances do not share the request-state key | See MCP Deployment and Production Readiness |
| Action happens twice | Retry after a broken stream | Operation 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
| Pattern | Suspect | Evidence to collect |
|---|---|---|
| Fails after some minutes of quiet | An idle timeout closing a stream | Duration before the drop; proxy settings |
| Fails for a share of requests | One unhealthy or differently configured instance | Instance id beside each failure |
| Fails just after a release | Cached definitions or mixed versions | Release time, cache lifetime, client version |
| Fails around token expiry | Refresh not handled, or clocks out of step | Expiry times and server clock |
| Fails under load only | Rate limits, connection pools or downstream timeouts | Queue 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
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.
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.
Revision history
| Revision | Notable for |
|---|---|
2024-11-05 | First public revision, with HTTP and SSE |
2025-03-26 | Streamable HTTP replaces HTTP and SSE |
2025-06-18 | Protocol version header on HTTP, among other changes |
2025-11-25 | Experimental tasks and authorization improvements |
2026-07-28 | Stateless 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
| Method | Direction | Purpose |
|---|---|---|
server/discover | Client request | Versions, capabilities, identity |
tools/list, tools/call | Client request | Discover and run tools |
resources/list, resources/templates/list, resources/read | Client request | Discover and read data |
prompts/list, prompts/get | Client request | Discover and fill prompts |
completion/complete | Client request | Argument suggestions |
subscriptions/listen | Client request | Stream of chosen change notices |
tasks/get, tasks/update, tasks/cancel | Client request | Tasks extension |
notifications/progress, notifications/message | Server notice | Progress and logs for a request |
notifications/…/list_changed, notifications/resources/updated | Server notice | Changes, on a subscription |
notifications/cancelled | Client notice, stdio | Cancel a request |
Names you may meet in older code
| Old | Now |
|---|---|
initialize, notifications/initialized | Removed; metadata on each request |
Mcp-Session-Id | Removed; use explicit handles |
ping | Removed |
resources/subscribe | subscriptions/listen |
logging/setLevel | Per-request log level |
tasks/result, tasks/list | Removed from the redesigned extension |
sampling/createMessage, roots/list | Deprecated 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
| Compare | Look for |
|---|---|
| Specification revision | One speaks an older revision with a different connection sequence |
| Transport | stdio on one side, HTTP on the other, with different configuration |
| Supported features | A client that cannot ask the person for input, or does not use an extension |
| Credentials | Different accounts, scopes or token audiences |
| Environment | Different paths, variables, proxies or certificates |
| Limits | Shorter 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
| Mistake | Better practice |
|---|---|
| Changing the prompt to fix a connection error | Prove the lower layers first |
| Ignoring the error body | The code usually names the cause |
| Upgrading client and server together while debugging | Change one side at a time |
| Pasting real tokens into reports | Redact; 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
Model Context Protocol
Return to the MCP section.
Fix Tool Calling and Invalid JSON Errors
Debug failures on the model side.
Lab: MCP Server and A2A Agent
Practice on a small server.