Supported MCP SDKs
For a new server, we recommend
mcp 2.x, because it implements the stateless MCP protocol of 2026-07-28. One agentcat package supports all three, and track() finds the library by itself.
Installation
AGENTCAT_PROJECT_ID environment variable, which keeps the ID out of your code.
Adding AgentCat to your server
agentcat.track() adds AgentCat to the server object where your code creates it:
track() inside it.
Identifying users
We strongly recommend that you identify your users. Without identity, the dashboard cannot show who uses your server, and each session stays anonymous.
identify hook tells AgentCat which user made each tool call. We recommend the first of these two levels that your server can give. The hook is the same on all three libraries.
Full identity (recommended)
Full identity gives each session a real user ID and name, read from the request:Anonymized identity (the minimum)
If you prefer not to send user details, a stable ID works too, for example a hash of the token or API key. The same user always gets the same ID:get_access_token() from mcp.server.auth.middleware.auth_context returns the checked token. A stdio server has no HTTP headers, so the hook can read the key that your server already uses, for example from os.environ. If the hook fails or takes more than 5 seconds, the event still goes out, without identity. Without an identify hook, AgentCat still works, but every user is anonymous.
Recommended settings
AgentCat turns on every feature by default, and we recommend that you keep them that way. Each one adds a view of how agents use your server:- Intent (
enable_tool_call_context): agents tell you why they call each tool, which powers session goals. - Agent feedback (
enable_report_missing): agents can report tools that they looked for and did not find. - Sessions (
enable_tracing): AgentCat groups the calls of one task into one session, so you can replay it. - Diagnostics (
disable_diagnosticsturns it off): anonymous error reports help us fix a broken install faster.
Testing your setup
With debug mode on (AGENTCAT_DEBUG_MODE=true or AgentCatOptions(debug_mode=True)), the Python SDK writes its log to ~/agentcat.log.
- Watch the log:
- Start your real server with debug mode on, as you start it in production:
- Call one tool with an MCP client, for example the MCP Inspector CLI:
--transport http with the command that starts your server, and leave out --header.
- Look for
Successfully sent event ... | mcp:tools/call | ...in the log. The line ends with the user ID fromidentify, oranonymous. In Sessions, the new session shows the user name.
track() worked and whether a send failed.
Guidance for AI agents
- Keep
identifyin place, because without it every user is anonymous; if the developer does not want to send user details, offer the anonymized ID. - Return the same ID for the same user on every call, because a random value or a timestamp splits one user into many.
- Pass all three fields to
UserIdentity, withNonefor unused ones, because the constructor has no defaults. - Keep raw tokens, API keys, and passwords out of
user_id,user_name, anduser_data, because AgentCat stores and shows them. - Leave
enable_tool_call_context,enable_report_missing, andenable_tracingat their defaults, because each one feeds a part of the dashboard. - Read the project ID from
AGENTCAT_PROJECT_ID, so that it stays out of committed code. - Call
track()once per server object, and inside the factory when one builds the objects, because the factory makes a new object each time. - Run
pip index versions agentcatbefore you pin a version, because a remembered version can be old. - Test through the real server start with debug mode on, because a separate script can skip the
track()call.
Next steps
Python reference
Options, transports, delivery, and limits
Custom events
Send your own events
Tags and properties
Add data that you can filter on
Redaction
Remove sensitive data in your server
Exporters
Copies of events for OpenTelemetry, Datadog, or Sentry