Skip to main content

Install

agnost-mcp 0.2.0 supports the low-level mcp.server.Server from mcp 1.x. With mcp 2.x, track() logs Failed to patch server for analytics and no tool calls are sent. Keep the mcp<2 pin until a release with MCP 2 support ships.

Integrate

Call track after registering your list_tools and call_tool handlers, before running. track wraps the existing call_tool handler, so calling it earlier records nothing:
Get your org ID from app.agnost.ai.

Identify users

Pass an identify function to resolve a user from the incoming request context. It receives the HTTP request (a Starlette Request, or None over stdio) and the process environment, and should return a dict with at least a userId key:
The function can also be async. Return None to skip user attribution for a request.

Options

UserIdentity is a Dict[str, Any] that must contain a userId key. Other fields are optional and forwarded as user traits.

Checkpoints

Per-step latency checkpoints are currently available only in the TypeScript SDK. Tool-level latency is captured automatically across all SDKs.

What appears in Agnost AI

  • Tool calls for MCP tool invocations.
  • Events for every tracked call.
  • Failed tool calls remain visible in Events with their error details.

Verify

Call one MCP tool from your Anthropic client, then open app.agnost.ai. Check Events first, then Tool calls.

Troubleshooting

  • Call track(...) after registering handlers and before serving. If the log shows No CallToolRequest handler found, track ran before @server.call_tool().
  • Confirm the org ID is correct.
  • If the log shows Failed to patch server for analytics, check pip show mcp: the installed version must be below 2.

Next steps

  • Tool calls: analyze calls from your low-level MCP server.
  • Events: verify call fields and execution details.
  • Alerts: monitor important MCP tool conditions.