@mcpanalytics/server-sdk
v0.0.1-alpha.1
Published
Analytics instrumentation for MCP servers used in ChatGPT apps.
Downloads
15
Readme
@mcpeek/server-sdk
Analytics instrumentation for MCP servers used in ChatGPT apps.
Supported integrations
withMcpServerAnalytics(...)forStreamableHTTPServerTransportwithWebStandardMcpServerAnalytics(...)forWebStandardStreamableHTTPServerTransportwithConnectedMcpServerAnalytics(...)to instrument supported transports duringserver.connect(...)
Example
import {
withConnectedMcpServerAnalytics,
withMcpServerAnalytics,
withWebStandardMcpServerAnalytics,
} from "@mcpeek/server-sdk";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
const config = {
endpoint: process.env.MCPEEK_INGEST_ENDPOINT!,
apiKey: process.env.MCPEEK_INGEST_KEY!,
organizationId: process.env.MCPEEK_ORG_ID!,
environment: "production" as const,
};
// Node / Express / Fastify
const nodeTransport = withMcpServerAnalytics(
new StreamableHTTPServerTransport(),
config,
);
// Hono / Workers / Deno / Bun
const webTransport = withWebStandardMcpServerAnalytics(
new WebStandardStreamableHTTPServerTransport(),
config,
);
// Or wrap the server once and instrument supported transports during connect()
const analyticsServer = withConnectedMcpServerAnalytics(server, config);The server SDK emits:
received-tool-callsent-tool-responsetool-errorlisted-toolslisted-resourcesread-resource
Test framework
The package test framework covers four layers:
- package-unit tests for wrappers, exporter behavior, and analytics helpers
- MCP protocol-parity tests against wrapped and unwrapped transports
- downstream ingest contract tests against the real ingest route and processor contracts
- manual ChatGPT developer-mode smoke checks using
test/openai-apps/html-app
Run the automated suite with:
pnpm --filter @mcpeek/server-sdk test
pnpm --filter @mcpeek/server-sdk test:coverageThe manual release checklist lives at ./test/manual/chatgpt-developer-mode-checklist.md.
