Custom headers for MCP
Any header you send with the MCP request that starts with X- is captured as metadata on the tool call. The headers show up in the Tool Call Logs as a filterable column, so you can group calls by whatever dimension matters to you - chat session, workflow run, environment, customer ID.
Why bother
Three patterns most teams find useful.
Per-session filtering. Set X-Chat-Id: <session_id> from your agent runtime. Now you can filter the logs to one user’s conversation and see exactly what tools fired across the whole turn.
Tracing into your APM. If your existing tracing system uses a request ID, send it as X-Request-Id. Cross-reference between Agent Handler logs and your APM by ID instead of by timestamp.
Environment isolation. X-Environment: production vs X-Environment: staging - useful when one Agent Handler org serves both, and you want to filter logs by where the call came from.
Adding headers
Send them on the MCP request - exactly the same way you send Authorization. The Python MCP SDK example:
Headers attach to every tool call sent within the session. To change them per call, open a new session.
The same works in TypeScript or any HTTP client - just include the headers on the underlying request.
Filtering in the dashboard
Open Logs → Tool calls. The filter bar has a Custom headers option that lets you filter by header name and value.
Multiple header filters compose - “all calls with X-Chat-Id = abc123 AND X-Environment = production.”
Reserved headers
A few headers are special and won’t show up as filterable custom metadata:
Authorization- your Access Key.Content-Type,Accept- standard HTTP.Mcp-Session-Id- used by MCP for session correlation; logged separately.
Anything else with an X- prefix is yours.
Limits
If you exceed the limits, the request still goes through - Agent Handler just truncates or drops the offending headers and logs a warning in the API Request Log.
Next
Filter by your custom headers in the Tool Call Logs.