conformance/src/sdk-runner/known-sdks.ts
Paul Carleton 2a705a811e
feat(sdk-runner): expand KNOWN_SDKS to all tier 1 SDKs (#417)
* feat(sdk-runner): expand KNOWN_SDKS to all tier 1 SDKs

- go-sdk: point at the relocated conformance/ fixtures (the old
  examples/server/conformance path is gone on main), add the
  everything-client fixture that now exists upstream, and wire
  conformance/baseline.yml as the expected-failures baseline.
- python-sdk: new entry for main, which targets the 2026-07-28
  revision (same uv workspace layout as the v1.x entry).
- csharp-sdk: new entry driving the ConformanceClient /
  ConformanceServer fixtures via the .NET 10 SDK. The client takes the
  scenario as argv[0], so the command bridges MCP_CONFORMANCE_SCENARIO
  into argv; the server exposes the SEP-2575 stateless lifecycle at
  /stateless.

* docs: match the sdk override example's lead-in to its content

The example now shows field overrides on a built-in entry rather than a
one-off ref, so the introducing sentence shouldn't promise a ref
override.
2026-07-27 14:54:45 +01:00

134 lines
6 KiB
TypeScript

import type { SdkConfig } from './config';
/**
* Built-in conformance configs for official SDKs, keyed by repo name.
*
* These live here (not in the SDK repos) so adding an SDK to the matrix
* doesn't require a coordinated cross-repo PR. Any field can be overridden
* per-invocation via the CLI flags (--build-cmd / --client-cmd / etc.).
*/
export const KNOWN_SDKS: Record<string, SdkConfig> = {
// v2 — the monorepo on `main` (pnpm). Default ref is `main`.
'typescript-sdk': {
build: 'pnpm install && pnpm run build:all',
client: {
command: 'npx tsx test/conformance/src/everythingClient.ts'
},
server: {
command: 'npx tsx test/conformance/src/everythingServer.ts',
url: 'http://localhost:3000/mcp'
},
expectedFailures: 'test/conformance/expected-failures.yaml'
},
// v1.x — the published npm line. Same fixtures as v2; differs only in the
// build (npm, not pnpm) and the baseline filename. Clones the typescript-sdk
// repo, defaulting to the `v1.x` branch. Targets the latest dated spec, so
// draft-only scenarios and checks are excluded by default.
'typescript-sdk-v1': {
repo: 'typescript-sdk',
defaultRef: 'v1.x',
specVersion: '2025-11-25',
build: 'npm ci && npm run build',
client: {
command: 'npx tsx test/conformance/src/everythingClient.ts'
},
server: {
command: 'npx tsx test/conformance/src/everythingServer.ts',
url: 'http://localhost:3000/mcp'
},
expectedFailures: 'test/conformance/conformance-baseline.yml'
},
// Fixtures live under conformance/ (everything-client + everything-server,
// mirroring scripts/{client,server}-conformance.sh). The server's -stateless
// flag defaults to true; -stateless=false pins the stateful transport, which
// the dated-spec (`active` suite) scenarios need — for a 2026-07-28 /
// SEP-2575 run, override with --server-cmd './.conformance-server -http=localhost:3000'
// to get the stateless lifecycle.
'go-sdk': {
build:
'go build -o ./.conformance-server ./conformance/everything-server && go build -o ./.conformance-client ./conformance/everything-client',
client: {
command: './.conformance-client'
},
server: {
command: './.conformance-server -http=localhost:3000 -stateless=false',
url: 'http://localhost:3000'
},
expectedFailures: 'conformance/baseline.yml'
},
// main — targets the 2026-07-28 revision. Same uv workspace layout as v1.x
// (client fixture in .github/actions/conformance/, mcp-everything-server
// workspace package). Two baselines exist upstream: expected-failures.yml
// covers runs at the latest dated spec (the default here), and
// expected-failures.2026-07-28.yml covers --spec-version 2026-07-28 runs —
// pass the latter via --expected-failures when targeting the new revision.
'python-sdk': {
build: 'uv sync --frozen --all-extras --all-packages',
client: {
command: 'uv run --frozen python .github/actions/conformance/client.py'
},
server: {
command: 'uv run --frozen mcp-everything-server --port 3000',
url: 'http://localhost:3000/mcp'
},
expectedFailures: '.github/actions/conformance/expected-failures.yml'
},
// v1.x — the stable, published line of the python-sdk, analogous to
// typescript-sdk-v1. Clones the python-sdk repo, defaulting to the `v1.x`
// branch, and targets the latest
// dated spec so draft-only scenarios/checks are excluded by default. uv
// workspace: the `mcp` (client) and `mcp-everything-server` (server) packages
// are both members, so one `uv sync --all-packages` covers both modes.
// Fixtures live in the python-sdk repo (.github/actions/conformance/ and
// examples/servers/everything-server). `--port 3000` matches the url and the
// 3000 convention used above; the server's own default is 3001.
'python-sdk-v1': {
repo: 'python-sdk',
defaultRef: 'v1.x',
specVersion: '2025-11-25',
build: 'uv sync --frozen --all-extras --all-packages',
client: {
command: 'uv run --frozen python .github/actions/conformance/client.py'
},
server: {
command: 'uv run --frozen mcp-everything-server --port 3000',
url: 'http://localhost:3000/mcp'
},
expectedFailures: '.github/actions/conformance/expected-failures.yml'
},
// Fixtures live in tests/ModelContextProtocol.ConformanceClient and
// tests/ModelContextProtocol.ConformanceServer (requires the .NET 10 SDK,
// per global.json); build output goes to the repo-level artifacts/ tree
// (UseArtifactsOutput), not per-project bin/. The client binary takes the scenario as its first
// argument rather than reading MCP_CONFORMANCE_SCENARIO, so the command
// bridges the env var into argv ($1 is the server URL the harness appends).
// The server serves the stateful lifecycle at / and the SEP-2575 stateless
// lifecycle at /stateless from the same port — for a 2026-07-28 run,
// override with --server-url http://localhost:3000/stateless.
'csharp-sdk': {
build:
'dotnet build tests/ModelContextProtocol.ConformanceClient -c Release -f net10.0 && dotnet build tests/ModelContextProtocol.ConformanceServer -c Release -f net10.0',
client: {
command: `bash -c 'exec dotnet artifacts/bin/ModelContextProtocol.ConformanceClient/Release/net10.0/ModelContextProtocol.ConformanceClient.dll "$MCP_CONFORMANCE_SCENARIO" "$1"' conformance-client`
},
server: {
command:
'dotnet artifacts/bin/ModelContextProtocol.ConformanceServer/Release/net10.0/ModelContextProtocol.ConformanceServer.dll --urls http://localhost:3000',
url: 'http://localhost:3000'
}
}
};
/**
* Look up a built-in config by SDK name. Accepts bare names (typescript-sdk),
* owner/repo (modelcontextprotocol/typescript-sdk), or a checkout path
* basename — only the final path segment is used as the key.
*/
export function lookupBuiltinConfig(name: string): SdkConfig | null {
const key = name.split('/').pop() ?? name;
return KNOWN_SDKS[key] ?? null;
}
export function knownSdkNames(): string[] {
return Object.keys(KNOWN_SDKS);
}