typescript-sdk/test/conformance
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-01 14:47:45 +00:00
..
scripts v2: Move conformance into workspace (#1470) 2026-02-03 19:56:49 +02:00
src fix(examples): return 404 for unknown session IDs, 400 for missing (#1770) 2026-03-30 21:00:11 +00:00
eslint.config.mjs v2: Move conformance into workspace (#1470) 2026-02-03 19:56:49 +02:00
expected-failures.yaml test(conformance): pin conformance 0.2.0-alpha.1 and baseline the draft-spec suites (#2227) 2026-06-01 14:47:45 +00:00
package.json test(conformance): pin conformance 0.2.0-alpha.1 and baseline the draft-spec suites (#2227) 2026-06-01 14:47:45 +00:00
README.md test(conformance): pin conformance 0.2.0-alpha.1 and baseline the draft-spec suites (#2227) 2026-06-01 14:47:45 +00:00
tsconfig.json v2: limit public exports (#1680) 2026-03-25 20:25:01 +00:00
vitest.config.js v2: Move conformance into workspace (#1470) 2026-02-03 19:56:49 +02:00

Conformance Tests

This directory contains conformance test implementations for the TypeScript MCP SDK.

@modelcontextprotocol/conformance is pinned to an exact version (no ^ range) in package.json. New conformance releases are adopted by deliberately bumping the pin and updating expected-failures.yaml for any new scenarios/checks in the same change.

Client Conformance Tests

Tests the SDK's client implementation against a conformance test server.

# Run all client tests
pnpm run test:conformance:client:all

# Run specific suite
pnpm run test:conformance:client -- --suite auth

# Run single scenario
pnpm run test:conformance:client -- --scenario auth/basic-cimd

Server Conformance Tests

Tests the SDK's server implementation by running a conformance server.

# Run all active server tests
pnpm run test:conformance:server

# Run all server tests (including pending)
pnpm run test:conformance:server:all

Local Development

Running Tests Against Local Conformance Repo

Link the local conformance package:

cd ~/code/mcp/typescript-sdk
pnpm link ~/code/mcp/conformance

Then run tests as above.

Debugging Server Tests

Start the server manually:

pnpm run test:conformance:server:run

In another terminal, run specific tests:

npx @modelcontextprotocol/conformance server \
  --url http://localhost:3000/mcp \
  --scenario server-initialize

Files

  • src/everythingClient.ts - Client that handles all client conformance scenarios
  • src/everythingServer.ts - Server that implements all server conformance features
  • src/authTestServer.ts - Server with OAuth authentication for auth conformance tests
  • src/helpers/ - Shared utilities for conformance tests
  • scripts/ - Conformance test runner scripts

Auth Test Server

The authTestServer.ts is designed for testing server-side OAuth implementation. It requires an authorization server URL and validates tokens via introspection.

# Start with a fake auth server
MCP_CONFORMANCE_AUTH_SERVER_URL=http://localhost:3000 \
  npx tsx src/authTestServer.ts

The server:

  • Requires Bearer token authentication on all MCP endpoints
  • Validates tokens via the AS's introspection endpoint (RFC 7662)
  • Serves Protected Resource Metadata at /.well-known/oauth-protected-resource