open-index/open-npm huggingface dataset:
npm package: @mcpanalytics/server-sdk
Description: Analytics instrumentation for MCP servers used in ChatGPT apps.
Latest version: 0.0.1-alpha.1

# `@mcpeek/server-sdk`

Analytics instrumentation for MCP servers used in ChatGPT apps.

## Supported integrations

- `withMcpServerAnalytics(...)` for `StreamableHTTPServerTransport`
- `withWebStandardMcpServerAnalytics(...)` for `WebStandardStreamableHTTPServerTransport`
- `withConnectedMcpServerAnalytics(...)` to instrument supported transports during `server.connect(...)`

## Example

```ts
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-call`
- `sent-tool-response`
- `tool-error`
- `listed-tools`
- `listed-resources`
- `read-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:

```bash
pnpm --filter @mcpeek/server-sdk test
pnpm --filter @mcpeek/server-sdk test:coverage
```

The manual release checklist lives at [./test/manual/chatgpt-developer-mode-checklist.md](./test/manual/chatgpt-developer-mode-checklist.md).