Skip to Content

MCP Observability

MCP Observability

Track every call to your MCP server as a Raindrop event, grouped into the client session that made it.

@raindrop-ai/mcp (TypeScript) and raindrop-mcp (Python) instrument any Model Context Protocol server. Each call becomes a tool span on an mcp_activity event (calls made close together in a session are grouped into one turn), and the calls of one client session share a conversation, so you can see what agents actually do with your server and catch failing tools. Both packages cover the whole protocol: tool calls, prompts, resources, and the failures no handler sees (unknown tools, cancelled requests, JSON-RPC errors).

Installation

npm install @raindrop-ai/mcp

Supported servers

LanguagePackageServers
TypeScript@raindrop-ai/mcpMcpServer and the low-level Server from @modelcontextprotocol/sdk (v1) and @modelcontextprotocol/server (v2)
Pythonraindrop-mcpFastMCP from the official mcp package (1.x), MCPServer from mcp 2.x, the standalone fastmcp package (2.x, 3.x+), and the low-level mcp.server.Server

Both packages produce the same events and spans, so one dashboard covers servers written in either language.

Quick start

Zero code

Load the hook when you start the server and set the write key in the environment. Nothing in the server changes:

RAINDROP_WRITE_KEY=... node --import @raindrop-ai/mcp/hook server.js

The hook instruments every server the process constructs (McpServer and the low-level Server in TypeScript; FastMCP, MCPServer, standalone fastmcp and the low-level Server in Python), including servers you install from npm or PyPI. It is configured by environment only:

VariableEffect
RAINDROP_WRITE_KEYRequired; without it nothing ships.
RAINDROP_PROJECT_IDProject to ship to. Defaults to mcp.
RAINDROP_MCP_CAPTURE_CONTENT=falseNames, counts and errors only: no arguments, results or intent.
RAINDROP_MCP_DISABLED=1Hook does nothing, for a start command you cannot edit.
RAINDROP_DEBUG=1Log what ships (Python: RAINDROP_MCP_DEBUG=1).

Use the hook or wrap() below, not both on the same server.

In code

Wrap the server before registering tools, then register tools as usual.

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { createRaindropMcp } from "@raindrop-ai/mcp";
import { z } from "zod";

const raindrop = createRaindropMcp({ writeKey: process.env.RAINDROP_WRITE_KEY });

const server = raindrop.wrap(new McpServer({ name: "my-server", version: "1.0.0" }));

server.registerTool(
  "search",
  { description: "Search the docs", inputSchema: { query: z.string() } },
  async ({ query }) => ({ content: [{ type: "text", text: await search(query) }] })
);

Nothing else changes: tool handlers receive the same arguments and return the same results. Errors inside a handler are recorded on the tool span and returned to the client as a normal MCP error result.

Send MCP server events to their own project with mcp as its own word in the ID, such as mcp or acme-mcp (not mcpserver). That is what gives the project its MCP Home and dashboards. Both packages send to mcp when you set no project, and log a warning at startup when the project you set is not an MCP one.

Wrapping a server you don't construct

For third-party servers that build their own server object, wrap the class once before the server loads:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { createRaindropMcp } from "@raindrop-ai/mcp";

createRaindropMcp({ writeKey: process.env.RAINDROP_WRITE_KEY }).wrap(McpServer.prototype);

await import("some-mcp-server/dist/index.js");

In Python, wrap(instance) also instruments tools the server already registered.

In TypeScript, wrap() also accepts the low-level Server. Its calls are traced from the protocol frames, so they carry no _turn_id or _intent (there is no registerTool to hook) and each call is its own event.

What is traced

Every request that does work on the server becomes one call on the caller's session: tools/call (through the handler, so turns and intent apply), prompts/get, resources/read, and anything else except lifecycle frames: the handshake (initialize, server/discover), ping, the */list listings and subscriptions/listen never ship, even when they fail. Failures a handler never sees are calls too: an unknown tool, a JSON-RPC error response, a request the client cancelled, and a connection that closed before the response went out.

Each call carries mcp.method and, when it failed, error.type / mcp.error_type:

error.typeMeaning
tool_errorThe handler returned a result marked isError.
handler_throwThe handler threw.
rpc_<code>A JSON-RPC error response, e.g. rpc_-32602 for an unknown tool.
cancelledThe client cancelled the request before it finished.
closed_before_responseThe connection closed before the response went out.

An instrumented client that puts a W3C traceparent in params._meta has it recorded as mcp.traceparent.

Sessions and turns

MCP has no end-of-turn signal, so the unit Raindrop groups by is the client session: every call made over one connection shares a conversation (convo_id). It is the first of _meta["openai/session"] (ChatGPT), the transport's Mcp-Session-Id, or the caller's UTC day, scoped to the caller.

Within a session, Raindrop groups tool calls into turns when it ingests them, by how close together they arrive. Nothing is added to your tools or results for that. If a client sends _meta["io.modelcontextprotocol/aiInvocation"].turnId, calls that share it land on one event and the id is recorded as mcp.turn_id.

Issue detection only looks at turns: events with two or more calls, or one that carries an _intent. A single call with no stated intent is recorded, counted on dashboards and listed under its session, but it is not a candidate for an issue: one tool call with no stated intent is too little context to judge.

To have the model carry the turn id itself, set turnTracking: true (Python: turn_tracking=True). Every tool then gets an optional _turn_id parameter and each result ends with the id; a model that copies it into its next call lands that prompt's calls on one mcp_activity event. The parameter is stripped before your handler runs.

const raindrop = createRaindropMcp({
  writeKey: process.env.RAINDROP_WRITE_KEY,
  turnTracking: true,
});

Intent and client

Set intent: true (Python: intent=True) to have every tool advertise an optional _intent parameter, described to the model as one sentence on what the user is trying to accomplish, for the server developer's analytics. It is stripped before your handler runs, recorded as the mcp.intent property, and appended to the event input under a Session intent: header:

Session intent:
the user wants to remember that Alice likes tea and works remotely

1. create_entities {"entities":[{"name":"Alice","entityType":"person"}]}
   -> [{"name":"Alice","entityType":"person","observations":["likes tea"]}]

The event's input is MCP session started, with the intent under a Session intent: line when the model wrote one, and its output is MCP session ended. Each call, with its arguments and result, is on the event's spans and in tool_calls; the event view and detection read the calls from there.

It is off by default, so tool schemas are left as you wrote them. The intent is free text written by the model, so key-based secret redaction does not apply to it; list _intent in redactArguments (redact_arguments) to keep the parameter advertised but out of telemetry.

The MCP client that made the call (clientInfo, e.g. claude-code 2.1.0, Cursor, codex-mcp-client) is recorded as mcp.client_name / mcp.client_version on every span and event. It comes from the per-request _meta of 2026-era clients, or from the initialize handshake on older ones.

A tool that already declares _turn_id or _intent keeps its own parameter: nothing is added or stripped for that tool, and a warning is logged at registration saying what is lost and how to fix it (rename the parameter, or disable the feature).

Configuration

const raindrop = createRaindropMcp({
  writeKey: process.env.RAINDROP_WRITE_KEY,
  projectId: "mcp",
  userId: ({ extra }) => extra.authInfo?.clientId,
  redactArguments: ["api_token"],
  redactResults: ["get_credentials"],
  properties: ({ toolName }) => ({ "mcp.tool_group": toolName.split("_")[0] }),
});

The Python options are the same names in snake_case (api_key for writeKey), plus client to ship through an existing raindrop.Raindrop instance.

OptionDefaultDescription
writeKey–Raindrop write key. Without one, nothing ships and a warning is logged.
projectIdmcpRaindrop project slug. Use one with mcp as its own word to get the MCP views.
eventNamemcp_activityEvent name.
turnTrackingfalseAdvertise and echo _turn_id so the model groups a prompt's calls.
intentfalseAdvertise _intent so the model states the user's goal.
userIdOAuth subject → hashed bearer token → session:<id> → anonymousFixed id or (call) => string | undefined. Returning undefined skips the call.
convoIdopenai/session, else transport session, else the caller's UTC dayFixed id or (call) => string | undefined.
properties–Extra event properties, or (call) => Record<string, unknown>.
redactArguments[]Argument names never captured. Keys that look like secrets (password, authorization, apiKey, …) are always redacted.
redactResults[]Tools, prompts, resource URIs or methods (resources/read) whose results are never captured, e.g. ones that return credentials.
captureContenttruefalse records names, counts and errors only: arguments, results and intent become [omitted]. Also takes a sync or async (call) => boolean that decides per call (per tool, per caller). Python: capture_content, same forms.
awaitDeliverytrueWait (at most 5s) for delivery before returning each tool result. Needed on serverless; set false on long-running servers to keep latency unchanged.
maxTextFieldChars1,000,000Per-field character cap for captured arguments and results.
endpointhttps://api.raindrop.ai/v1/Ingest endpoint.
appGitauto-detectApplication Git identity; false disables.
debugfalseLog shipping details.

call passed to the resolvers is { toolName, args, sessionId, extra }, where extra is the SDK's per-request object (v1 RequestHandlerExtra, v2 ServerContext). In Python it is an McpCallContext with tool_name, args, session_id, context (the SDK's per-request Context), client and intent.

What gets captured

  • One mcp_activity event per turn, with properties mcp.turn_id, mcp.tool, mcp.method, mcp.is_error, mcp.error_type when it failed, mcp.traceparent when the client sent one, mcp.client_name / mcp.client_version when the client identified itself, mcp.intent when the model filled _intent, mcp.session_id when the transport has one, plus anything from properties.
  • One tool span per call with the tool name, arguments and result (after redaction), and the error message when the handler fails. The Python package files mcp.* on spans under traceloop.association.properties. like the other Python integrations.

Call raindrop.shutdown() on process exit to drain pending deliveries (both languages).

Known limitations

  • TypeScript: wrap() intercepts registerTool, so tools registered before wrapping are not instrumented.
  • TypeScript: _turn_id and _intent are added by extending the tool's schema. Zod object schemas, raw Zod shapes and Standard Schemas are supported; a schema that cannot be extended (a Zod union, or a raw shape from a different Zod major) is registered unchanged and its calls each open their own event.
  • Python: calls no tool handler saw (prompts, resources, JSON-RPC errors) are recorded after the reply is sent and identified by the request's headers, not the OAuth subject. On standalone fastmcp 2.x a tool that raises cannot echo the turn id (its ToolResult has no error form), so the model's next call starts a new event; 3.x+ and the official SDK echo on errors.
  • A harness that opens a new connection per call produces one session per call; pass convoId to group them yourself.

Looking for Raindrop's own MCP server for your coding agent? See MCP.

On this page