Skip to content

Commit 7f1515c

Browse files
authored
tsdown + cli with commander (#17)
* feat: tsdown * fix: formatting * automate version updates in cli * fix: docs * scenarios * fix: commander deps
1 parent 18f48e5 commit 7f1515c

File tree

16 files changed

+1600
-539
lines changed

16 files changed

+1600
-539
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
results/
3-
lefthook-local.yml
3+
lefthook-local.yml
4+
dist

README.md

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

2637
1. Starting a test server for the specified scenario
2738
2. Running the client implementation with the test server URL
2839
3. Capturing MCP protocol interactions
2940
4. Running conformance checks against the specification
3041
5. 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

4165
The 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

SERVER_REQUIREMENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,8 @@ MCP Conformance Test Server running on http://localhost:3000
10221022

10231023
```bash
10241024
# Single test
1025-
npm run test:server -- --server-url http://localhost:3000/mcp --scenario server-initialize
1025+
npm run start -- server --url http://localhost:3000/mcp --scenario server-initialize
10261026

10271027
# All tests
1028-
npm run test:server -- --server-url http://localhost:3000/mcp --all
1028+
npm run start -- server --url http://localhost:3000/mcp
10291029
```

examples/servers/typescript/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ This server implements the MCP Server Conformance Requirements specified in `../
147147
To run conformance tests against this server:
148148

149149
```bash
150-
cd ../../../
151-
npm run test:server -- --server-url http://localhost:3000/mcp --all
150+
npx @modelcontextprotocol/conformance server --url http://localhost:3000/mcp
152151
```
153152

154153
## Implementation Notes

0 commit comments

Comments
 (0)