Prerequisites
Access logging must be enabled in your Tyk Gateway configuration. Setaccess_logs.enabled to true in tyk.conf:
MCP fields
The following fields are added to access log records for MCP requests. Each field is only included when it has a non-empty value; fields are omitted from the record entirely when not applicable, keeping log volume low on lifecycle calls such asinitialize and ping.
The
mcp_error_code field reflects errors that occur within the gateway: authentication failures, rate limit rejections, and upstream errors. It does not capture error codes from within the upstream MCP server’s JSON-RPC response body.
Configuring which fields to include
By default, when access logging is enabled, all available fields are included in each log record. To restrict the fields logged, set atemplate array in access_logs:
template is configured, only the listed fields appear in each log record. Fields in the template that have no value for a given request are omitted.
Example log records
A successfultools/call request produces a record similar to the following:
mcp_error_code set and no primitive fields (the primitive was never reached):
initialize lifecycle call produces a record with mcp_method set but no primitive fields: