npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@raindrop-ai/mcp

v0.5.2

Published

Raindrop observability for MCP servers

Readme

@raindrop-ai/mcp

Raindrop observability for MCP servers. Every tool call your server handles becomes a tool span on an mcp_activity event in Raindrop, so you can see what agents do with your tools without owning the agent.

Works with McpServer from @modelcontextprotocol/sdk (v1) and @modelcontextprotocol/server (v2).

Install

npm install @raindrop-ai/mcp

Quick Start

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 });

// Wrap before registering tools.
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) }] })
);

That is the whole integration. Each call ships one tool span (ai.toolCall.name, ai.toolCall.args, ai.toolCall.result, or the error) on the caller's event.

Zero-code setup

Without touching the server's code, load the hook and set the write key in the environment:

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

It wraps the McpServer and low-level Server prototypes of @modelcontextprotocol/sdk and @modelcontextprotocol/server, so every server the process constructs ships. Environment:

| Variable | Effect | | ------------------------------- | ------------------------------------------------------------- | | RAINDROP_WRITE_KEY | Required; without it nothing ships. | | RAINDROP_PROJECT_ID | Project to ship to. | | RAINDROP_ENDPOINT | Alternative ingest endpoint. | | RAINDROP_DEBUG=1 | Log what ships. | | RAINDROP_MCP_CAPTURE_CONTENT=false | Names, counts and errors only: no arguments, results or intent. | | RAINDROP_MCP_DISABLED=1 | Hook does nothing, for a start command you cannot edit. |

The hook replaces wrap(): use one or the other, not both on the same server. Everything else keeps its default. wrap() also accepts a low-level Server; its calls are traced from the protocol frames (no turn or intent injection, since there is no registerTool to hook).

What is traced

Every request that does work on the server, as 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 the handshake (initialize, server/discover), ping, the */list listings and subscriptions/listen; those never ship, not 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: tool_error (result marked isError), handler_throw, rpc_<code>, cancelled or closed_before_response. An instrumented client that puts W3C traceparent in params._meta has it recorded as mcp.traceparent.

Turns and sessions

MCP has no turn boundary the server can see. Raindrop groups a session's tool calls into turns when it ingests them, by how close together they arrive, so nothing is added to your tools or results for that. Clients that send a turn id in _meta["io.modelcontextprotocol/aiInvocation"].turnId land on one event, with the id recorded as mcp.turn_id.

Set turnTracking: true to have the model carry the turn id itself: every tool then advertises an optional _turn_id argument and every result ends with a _turn_id: <16 hex chars> text block, and a model that copies it on the next call of the same prompt puts that call on the same mcp_activity event.

Calls are grouped into a conversation by _meta["openai/session"] when the client sends one (ChatGPT), else by the transport session (Mcp-Session-Id), else by the caller's UTC day.

Intent and client

Set intent: true to have every tool advertise an optional _intent argument, 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: line after the MCP session started marker; the event output is the MCP session ended marker, and what each call did is on its span. It is off by default, so tool schemas are left as you wrote them. It is free text the model wrote, so the key-based secret redaction does not apply to it; list _intent in redactArguments to keep the field 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.

Options

| Option | Default | Description | | ------------------ | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | writeKey | – | Raindrop write key. Without one, nothing ships and a warning is logged. | | endpoint | https://api.raindrop.ai/v1/ | Ingest endpoint. | | projectId | mcp | Raindrop project slug. Must contain mcp as its own word (mcp, acme-mcp) to get the MCP views; otherwise a warning is printed at startup.| | eventName | mcp_activity | Event name. | | turnTracking | false | Advertise and echo _turn_id so the model groups a prompt's calls into one event. | | intent | false | Advertise _intent so the model states the user's goal. | | userId | OAuth subject → hashed bearer token → session:<id> → anonymous | Fixed id or sync/async (call) => string \| undefined. Returning undefined skips the call. | | convoId | transport session, else the caller's UTC day | Fixed id or sync/async (call) => string \| undefined. | | properties | – | Extra event properties, or sync/async (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. | | captureContent | true | false records names, counts and errors only: arguments, results and intent become [omitted]. Or a sync/async (call) => boolean to decide per call, e.g. per tool or per caller. | | awaitDelivery | true | Wait (at most 5s) for delivery before returning each tool result. Needed on serverless, where the process freezes after the response. Set false on long-running servers to keep tool latency unchanged. | | maxTextFieldChars| 1,000,000 | Per-field character cap for captured arguments and results. | | debug | false | Log shipping details. | | appGit | auto-detect | Application Git identity; false disables. | | redactPii | false | Redact PII (emails, phone numbers, card numbers, addresses, secrets) from event input/output before it leaves the process. | | redactPiiFields | – | More wire field paths to redact when redactPii is on, e.g. { event: ["properties.customer.email"] }; add properties["error.message"] to also redact error messages. | | flushTimeoutMs | 10000 | Deadline for flush() / shutdown(). Both resolve to a result (delivered, dropped, queued, ...) and never reject. |

call passed to the resolvers is { toolName, args, sessionId, extra }, where extra is the SDK's per-request object (v1 RequestHandlerExtra, v2 ServerContext).

Event 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.

Your properties win

Properties you pass (as defaults, per call, or through events.setProperties / events.patch / events.finish) are merged into the event. If one of your keys has the same name as a key the integration sets itself, such as ai.usage.*, ai.provider, error.type / error.message, or the integration's own prefixed keys, your value is kept, whatever order the updates are sent in. With debug on, the integration logs each key you override.

Known limitations

  • wrap() intercepts registerTool, so tools registered before wrapping are not instrumented.
  • _turn_id and _intent are added by extending the tool's schema. A tool that declares either name itself keeps it: the field is neither advertised by this package nor stripped from the arguments for that tool. A warning is logged at registration, since that tool then has no intent (or no turn grouping). 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 than the one this package resolves) is registered unchanged and its calls each open their own event.