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:
Paul Carleton 2026-01-05 14:16:21 +00:00 • committed by GitHub
commit be51f872e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,7 @@ export interface ClientExecutionResult {
async function executeClient(
command: string,
scenarioName: string,
serverUrl: string,
timeout: number = 30000,
context?: Record<string, unknown>
@ -26,8 +27,13 @@ async function executeClient(
let stderr = '';
let timedOut = false;
// Build environment with optional context
// Build environment with scenario name and optional context.
// We use separate env vars rather than putting scenario in context because:
// 1. Scenario is always set, context is only set when there's scenario-specific data
// 2. Simpler to read a string vs parsing JSON just to get the scenario name
// 3. Semantic separation: scenario identifies "which test", context provides "test data"
const env = { ...process.env };
env.MCP_CONFORMANCE_SCENARIO = scenarioName;
if (context) {
env.MCP_CONFORMANCE_CONTEXT = JSON.stringify(context);
}
@ -105,6 +111,7 @@ export async function runConformanceTest(
try {
const clientOutput = await executeClient(
clientCommand,
scenarioName,
urls.serverUrl,
timeout,
urls.context