Supported MCP SDKs
We recommend the official
mcp gem for a new server. AgentCat.track finds the server shape by itself.
Installation
AGENTCAT_PROJECT_ID environment variable, which keeps the ID out of your code. The SDK does not read it by itself, so the snippets pass it to AgentCat.track.
Adding AgentCat to your server
AgentCat.track adds AgentCat to an MCP::Server, after your code creates the server and its tools, and returns the same server:
MCP::Server for each request, the track call goes inside that factory, as the first tab shows.
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 gets one AgentCat::ToolCall, with the arguments, the HTTP headers (lower-case names), and the client name.
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:server_context: as tool_call.server_context. AgentCat sends its auth_info: entry with each event when your app put a hash there, but not the AccessToken that token_verifier: stores (details). A stdio server has no HTTP headers, so the hook can read the key that your server already uses, for example from ENV. Each hook has 1 second by default (hook_timeout: raises it to 5), so we recommend a cache for a lookup that calls a database or an API. If the hook fails or runs out of time, the event still goes out without identity.
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, through theget_more_toolstool. - Sessions (
enable_tracing): AgentCat records each tool call and 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
In a test environment,AgentCat.track does nothing. With debug mode on, the SDK writes setup lines to ~/agentcat.log, never to stdout.
- Turn on debug mode before the
trackcall, and remove the line when you finish:
- Start your real server with
AGENTCAT_PROJECT_IDset, 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
AgentCat setup started | project ...in the log, then open Sessions. The new session shows the user fromidentify.
$stderr.
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.
- Keep raw tokens, API keys, and passwords out of
user_id,user_name,user_data, andauth_info:, 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
ENV["AGENTCAT_PROJECT_ID"], so that it stays out of committed code. - Call
AgentCat.trackonce per server instance, and inside the factory when one builds an instance for each request, because an untracked instance sends no events. - Run
gem search '^agentcat$' --remotebefore you pin a version, because a version from memory can be old. - Test through the real server start, because a test run or a separate script can skip the
trackcall.
Next steps
Ruby reference
Options, delivery, logging, testing, 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, Sentry, or PostHog