Install
Two lines, and it is measuring
The package runs inside your own server. It is not a proxy — your URL does not change, your OAuth does not break, and if MCPulse is down your server keeps serving.
-
01
Add the package
No runtime dependencies at all, so it will not drag anything into your tree.
$ npm install @mcpulse/sdk $ pnpm add @mcpulse/sdk $ yarn add @mcpulse/sdk $ bun add @mcpulse/sdk -
02
Put the key in your environment
An ingest key is a secret — anyone holding it can write data into this MCP. Keep it out of the repository and out of your client bundle. You are shown the full key once, at creation, because only a hash of it is stored.
MCPULSE_KEY=mp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
03
Wrap your server
One import, one call, after your tools are registered.
watchreturns the same server, so nothing downstream changes.import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { watch } from "@mcpulse/sdk"; const server = new McpServer({ name: "my-server", version: "1.0.0" }); // … your registerTool calls … watch(server, { key: process.env.MCPULSE_KEY });Serving over HTTP instead? Those servers build a new
McpServerper request, so there is no long-lived instance to wrap — put it inside the factory, beside the tool registration. Callingwatchonce per request is expected and cheap: the session and its buffer are shared for the life of the process, which is what keeps your calls grouped into one session rather than one per request.function createServer() { const server = new McpServer({ name: "my-server", version: "1.0.0" }); // … your registerTool calls … return watch(server, { key: process.env.MCPULSE_KEY }); } -
04
Restart and check back
On start the SDK sends one payload listing your tools and their schema sizes — that is what fills the tools table, so a server that has booted but never been called still shows what it costs per session. Tool calls follow as they happen, batched every 30 calls or 5 seconds.
Nothing arriving? Set
debug: trueto log every batch to stderr, and confirm the key has not been revoked.
Options
Two, and there will not be more than there need to be. Every option is another way for something to go wrong inside a process we do not control.
| Option | Type | Default | |
|---|---|---|---|
| key | string | — | Required. Without one the SDK does nothing. |
| debug | boolean | false | Log every batch to stderr — never stdout, which is the transport. |
Requires Node 20.12 or newer and @modelcontextprotocol/sdk as a peer
— whatever version your server already uses. The package is on
npm.