Refactor client testing to use 'everything' client with scenario routing (#54)
* Refactor client testing to pass scenario name and server URL The CLI now passes both scenario name and server URL as arguments to the client command (instead of just the server URL). This enables a single "everything" client that can handle all scenarios based on the scenario name it receives. Changes: - Update executeClient() to pass scenarioName as first argument to client - Add everything-client.ts that routes to appropriate behavior based on scenario name - Update README with new usage examples and documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Use env var for scenario name instead of positional arg Pass scenario name via MCP_CONFORMANCE_SCENARIO env var instead of as a positional argument. This is non-breaking for existing clients that just accept <server-url>. The env var approach is consistent with how context (including private keys for JWT auth) is already passed via MCP_CONFORMANCE_CONTEXT. * Add comment explaining env var design decision --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Olivier Chafik <ochafik@anthropic.com>
This commit is contained in:
parent
053e9bd9e0
commit
be51f872e1
1 changed files with 240 additions and 5 deletions
14
README.md
14
README.md
|
|
@ -9,7 +9,11 @@ A framework for testing MCP (Model Context Protocol) client and server implement
|
|||
### Testing Clients
|
||||
|
||||
```bash
|
||||
npx @modelcontextprotocol/conformance client --command "tsx examples/clients/typescript/test1.ts" --scenario initialize
|
||||
# Using the everything-client (recommended)
|
||||
npx @modelcontextprotocol/conformance client --command "tsx examples/clients/typescript/everything-client.ts" --scenario initialize
|
||||
|
||||
# Run an entire suite of tests
|
||||
npx @modelcontextprotocol/conformance client --command "tsx examples/clients/typescript/everything-client.ts" --suite auth
|
||||
```
|
||||
|
||||
### Testing Servers
|
||||
|
|
@ -59,10 +63,11 @@ npx @modelcontextprotocol/conformance client --command "<client-command>" --scen
|
|||
|
||||
- `--command` - The command to run your MCP client (can include flags)
|
||||
- `--scenario` - The test scenario to run (e.g., "initialize")
|
||||
- `--suite` - Run a suite of tests in parallel (e.g., "auth")
|
||||
- `--timeout` - Timeout in milliseconds (default: 30000)
|
||||
- `--verbose` - Show verbose output
|
||||
|
||||
The framework appends the server URL as the final argument to your command.
|
||||
The framework appends `<server-url>` as an argument to your command and sets the `MCP_CONFORMANCE_SCENARIO` environment variable to the scenario name. For scenarios that require additional context (e.g., client credentials), the `MCP_CONFORMANCE_CONTEXT` environment variable contains a JSON object with scenario-specific data.
|
||||
|
||||
### Server Testing
|
||||
|
||||
|
|
@ -89,8 +94,9 @@ npx @modelcontextprotocol/conformance server --url <url> [--scenario <scenario>]
|
|||
|
||||
## Example Clients
|
||||
|
||||
- `examples/clients/typescript/test1.ts` - Valid MCP client (passes all checks)
|
||||
- `examples/clients/typescript/test-broken.ts` - Invalid client missing required fields (fails checks)
|
||||
- `examples/clients/typescript/everything-client.ts` - Single client that handles all scenarios based on scenario name (recommended)
|
||||
- `examples/clients/typescript/test1.ts` - Simple MCP client (for reference)
|
||||
- `examples/clients/typescript/auth-test.ts` - Well-behaved OAuth client (for reference)
|
||||
|
||||
## Available Scenarios
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue