Error Response Format
Tyk returns errors as standard JSON-RPC 2.0 error responses. Theid matches the request’s id, and data.http_code repeats the HTTP status. For example, a stateful client that exceeds its rate limit receives:
2026-07-28 carries code -33004 instead. The rest of the response is unchanged.
Errors that the upstream MCP server returns are passed to the client unchanged. The codes on this page are the ones Tyk itself generates.
Gateway Errors
Tyk returns gateway errors when a request fails authentication, policy, traffic, or upstream checks. The code depends on the protocol version the request uses, which Tyk detects as described in MCP Protocol Versions:
The two ranges don’t follow the same order. For example, quota exceeded is
-32005 for stateful requests but -33003 for 2026-07-28 requests, and rate limit exceeded is -32003 and -33004. Match each code explicitly rather than calculating one from the other.
The 2026-07-28 revision retires -32002, which earlier revisions used for “resource not found”, and forbids servers on that revision from returning it. Tyk uses the -33000 range for all gateway errors on 2026-07-28 requests, so none of its codes overlap with codes the specification defines.
Request Validation Errors
Tyk checks the protocol declarations and mirrored headers of each request before authentication runs. These codes are the same for every protocol version and always return400 Bad Request:
For the rules behind these checks, see Requests Using 2026-07-28.
Standard JSON-RPC Errors
Tyk also returns the standard error codes defined by the JSON-RPC 2.0 specification:Responses Without a JSON-RPC Error
Some rejections happen at the HTTP layer and don’t include a JSON-RPC error body:- Origin validation: a request from an untrusted browser origin receives a plain-text
403 Forbiddenbefore Tyk reads the request body. See Origin Validation. - Unsupported HTTP method: a
GETorDELETErequest that uses2026-07-28, or that doesn’t belong to an existing session on a REST API to MCP proxy, receives405 Method Not Allowedwith anAllow: POSTheader. - Invalid discovery response: when the upstream returns a malformed
server/discoverresponse, Tyk returns502 Bad Gatewayto the client.
Error Codes in Logs and Metrics
Tyk records the JSON-RPC error code of a failed request in themcp_error_code field of access logs and in the mcp_error_code attribute of MCP metrics. If you serve clients on more than one protocol version, include both ranges in log filters and alert rules. For example, an alert on rate limiting should match both -32003 and -33004.