11# MCP Conformance Test Framework
22
3- A framework for testing MCP (Model Context Protocol) client implementations against the specification.
3+ A framework for testing MCP (Model Context Protocol) client and server implementations against the specification.
44
55> [ !WARNING] This repository is a work in progress and is unstable. Join the conversation in the #conformance-testing-wg in the MCP Contributors discord.
66
@@ -9,56 +9,110 @@ A framework for testing MCP (Model Context Protocol) client implementations agai
99### Testing Clients
1010
1111``` bash
12- npm install
13- npm run start -- --command " tsx examples/clients/typescript/test1.ts" --scenario initialize
12+ npx @modelcontextprotocol/conformance client --command " tsx examples/clients/typescript/test1.ts" --scenario initialize
1413```
1514
1615### Testing Servers
1716
1817``` bash
19- npm run test:server -- --server-url http://localhost:3000/mcp --all
18+ # Run all server scenarios (default)
19+ npx @modelcontextprotocol/conformance server --url http://localhost:3000/mcp
20+
21+ # Run a single scenario
22+ npx @modelcontextprotocol/conformance server --url http://localhost:3000/mcp --scenario server-initialize
23+ ```
24+
25+ ### List Available Scenarios
26+
27+ ``` bash
28+ npx @modelcontextprotocol/conformance list
2029```
2130
2231## Overview
2332
24- The conformance test framework validates MCP client implementations by:
33+ The conformance test framework validates MCP implementations by:
34+
35+ ** For Clients:**
2536
26371 . Starting a test server for the specified scenario
27382 . Running the client implementation with the test server URL
28393 . Capturing MCP protocol interactions
29404 . Running conformance checks against the specification
30415 . Generating detailed test results
3142
43+ ** For Servers:**
44+
45+ 1 . Connecting to the running server as an MCP client
46+ 2 . Sending test requests and capturing responses
47+ 3 . Running conformance checks against server behavior
48+ 4 . Generating detailed test results
49+
3250## Usage
3351
52+ ### Client Testing
53+
3454``` bash
35- npm run start -- -- command " <client-command>" --scenario < scenario-name>
55+ npx @modelcontextprotocol/conformance client --command " <client-command>" --scenario < scenario-name> [options]
3656```
3757
58+ ** Options:**
59+
3860- ` --command ` - The command to run your MCP client (can include flags)
3961- ` --scenario ` - The test scenario to run (e.g., "initialize")
62+ - ` --timeout ` - Timeout in milliseconds (default: 30000)
63+ - ` --verbose ` - Show verbose output
4064
4165The framework appends the server URL as the final argument to your command.
4266
67+ ### Server Testing
68+
69+ ``` bash
70+ npx @modelcontextprotocol/conformance server --url < url> [--scenario < scenario> ]
71+ ```
72+
73+ ** Options:**
74+
75+ - ` --url ` - URL of the server to test
76+ - ` --scenario <scenario> ` - Test scenario to run (e.g., "server-initialize". Runs all available scenarios by default
77+
4378## Test Results
4479
45- Results are saved to ` results/<scenario>-<timestamp>/ ` :
80+ ** Client Testing ** - Results are saved to ` results/<scenario>-<timestamp>/ ` :
4681
4782- ` checks.json ` - Array of conformance check results with pass/fail status
4883- ` stdout.txt ` - Client stdout output
4984- ` stderr.txt ` - Client stderr output
5085
86+ ** Server Testing** - Results are saved to ` results/server-<scenario>-<timestamp>/ ` :
87+
88+ - ` checks.json ` - Array of conformance check results with pass/fail status
89+
5190## Example Clients
5291
5392- ` examples/clients/typescript/test1.ts ` - Valid MCP client (passes all checks)
5493- ` examples/clients/typescript/test-broken.ts ` - Invalid client missing required fields (fails checks)
5594
5695## Available Scenarios
5796
97+ ### Client Scenarios
98+
5899- ** initialize** - Tests MCP client initialization handshake
59100 - Validates protocol version
60101 - Validates clientInfo (name and version)
61102 - Validates server response handling
103+ - ** tools-call** - Tests tool invocation
104+ - ** auth/basic-dcr** - Tests OAuth Dynamic Client Registration flow
105+ - ** auth/basic-metadata-var1** - Tests OAuth with authorization metadata
106+
107+ ### Server Scenarios
108+
109+ Run ` npx @modelcontextprotocol/conformance list --server ` to see all available server scenarios, including:
110+
111+ - ** server-initialize** - Tests server initialization and capabilities
112+ - ** tools-list** - Tests tool listing endpoint
113+ - ** tools-call-\* ** - Various tool invocation scenarios
114+ - ** resources-\* ** - Resource management scenarios
115+ - ** prompts-\* ** - Prompt management scenarios
62116
63117## Architecture
64118
@@ -67,8 +121,13 @@ See `src/runner/DESIGN.md` for detailed architecture documentation.
67121### Key Components
68122
69123- ** Runner** (` src/runner/ ` ) - Orchestrates test execution and result generation
70- - ** Scenarios** (` src/scenarios/ ` ) - Test scenarios with custom server implementations
71- - ** Checks** (` src/checks.ts ` ) - Conformance validation functions
124+ - ` client.ts ` - Client testing implementation
125+ - ` server.ts ` - Server testing implementation
126+ - ` utils.ts ` - Shared utilities
127+ - ` index.ts ` - Public API exports
128+ - ** CLI** (` src/index.ts ` ) - Command-line interface using Commander.js
129+ - ** Scenarios** (` src/scenarios/ ` ) - Test scenarios with expected behaviors
130+ - ** Checks** (` src/checks/ ` ) - Conformance validation functions
72131- ** Types** (` src/types.ts ` ) - Shared type definitions
73132
74133## Adding New Scenarios
0 commit comments