Supported MCP SDKs
For a new server, we recommend
ModelContextProtocol.AspNetCore 2.x with stateless HTTP, because 2.x implements the stateless MCP protocol of 2026-07-28. One AgentCat package supports both lines. We tested these steps on .NET 8 and 10, not on .NET Framework.
Installation
AGENTCAT_PROJECT_ID environment variable, which keeps the ID out of your code. The SDK reads it when you pass no project ID, so the snippets pass none.
Adding AgentCat to your server
For a server thatAddMcpServer() builds, WithAgentCat() goes anywhere in the builder chain. With McpServer.Create, AgentCatSdk.Track() goes on the server options before McpServer.Create:
WithAgentCat() tracks each one by itself, so it needs no extra code.
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.
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:call.Headers holds the HTTP request headers, with lower-case names, and is empty on stdio. With ASP.NET Core authentication, the checked user is in call.User. If the hook throws or takes more than 30 seconds, 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 (
EnableToolCallContext): agents tell you why they call each tool, which powers session goals. - Agent feedback (
EnableReportMissing): agents can report tools that they looked for and did not find, through theget_more_toolstool. - Sessions (
EnableTracing): AgentCat records each tool call and groups the calls of one task into one session, so you can replay it. - Diagnostics (
DisableDiagnosticsturns it off): the SDK sends us its own log lines, without payloads, so we can fix a broken install faster.
Testing your setup
The C# SDK always writes its log to~/agentcat.log, so it needs no debug option. The log shows the setup and each event that AgentCat sends.
- Watch the log:
- 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
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 fromIdentify.
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
UserId,UserName, andUserData, because AgentCat stores and shows them. - Leave
EnableToolCallContext,EnableReportMissing, andEnableTracingat their defaults, because each one feeds a part of the dashboard. - Pass no project ID, so that the SDK reads
AGENTCAT_PROJECT_IDand the ID stays out of committed code. - Call
AgentCatSdk.Track()beforeMcpServer.Create, because the server reads its options only when it is created. - Run
dotnet package search AgentCat --exact-matchbefore you pin a version, because a version from memory can be old. - Test through the real server start, because AgentCat stays off in test runs and a separate script can skip
WithAgentCat().
Next steps
C# reference
Options, transports, shutdown, 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