Skip to main content
Errors surface at two layers.

HTTP layer (before any tool runs)

Both 401s carry a WWW-Authenticate: Bearer resource_metadata="…" header pointing at the server’s OAuth Protected Resource Metadata. OAuth-capable clients (e.g. the claude.ai web connector) use this to start the sign-in flow automatically; API-key clients can ignore it.

Tool layer

Failed tool calls return an MCP tool error whose text content is JSON:
Tool-layer errors are returned as results (with isError: true), not protocol failures — most MCP clients hand the JSON straight to the model, so instructing your agent on these codes is usually all the error handling you need.