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.
Access logs when the proxy fronts a Tyk-managed REST API
When an MCP proxy is generated directly from a Tyk-managed REST API rather than fronting a remote MCP server, a singletools/call request produces two separate access log entries, provided access logging is enabled for both APIs.
The first entry is for the MCP proxy request itself, and carries the MCP fields described above. The second is for Tyk’s internal call into the paired source REST API, dispatched through the gateway’s standard request handling. That second entry has no MCP fields at all: its api_type reflects the source API’s own type (oas for a Tyk OAS API), and it is otherwise indistinguishable from a request made directly against that API.
trace_id: Tyk dispatches the internal call to the source API within the same trace as the originating MCP request, so the two entries are spans of one trace rather than unrelated hits. Without tracing enabled, there is no shared identifier between the two entries, so correlate them by timestamp. The proxy’s own latency_total includes the time spent on the source API call, so it is always the larger of the two figures.
This dual-record pattern isn’t unique to access logs. The Dashboard’s MCP analytics charts, and the Tyk Pump analytics pipeline underneath them, follow the same rule: only the MCP proxy’s own record is recorded as MCP traffic, so the source API’s analytics include this internal traffic indistinguishably alongside any direct hits it receives. See Tyk Pump for how analytics records are processed and stored.
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: