Skip to content

[P15] interop: matrix against the Go and Python SDKs - #356

Merged
jeanmatthieu merged 4 commits into
rel/1.0.0from
conformance/p15-interop
Nov 25, 2026
Merged

jeanmatthieu merged 4 commits into
rel/1.0.0from
conformance/p15-interop

Conversation

@jeanmatthieu

@jeanmatthieu jeanmatthieu commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor
Part P15 of P0–P35, merged into rel/1.0.0 in order (previous: P14 (#357) · next: P16 (#355))
Branch conformance/p15-interop
Base conformance/oauth-dpop-validation (stacked: GitHub retargets this PR to rel/1.0.0 when the previous part merges)
Commits 8864ff6 interop: matrix against the Go and Python SDKs
1abeca1 interop: review fixes
1d64122 interop: second-pass review fixes
b92b22d interop: third-pass review fixes
Size 24 files, +4280 / -17

Summary

Adds an interop matrix that runs real clients and servers of the Swift, Go
and Python MCP SDKs against each other, in both protocol eras, over
Streamable HTTP and stdio. The matrix found two bugs in HTTPClientTransport,
a connection-limit deadlock and requests that waited forever after their
response stream ended. Both predate this work; their fix is in P1 (#370), with the
2026-07-28 rule in P4 (#367) and the documentation in P10 (#362). In the recorded run,
the Swift SDK passes every cell in which it is the client or the server. The
Python side is pinned by commit and installed from a lock with hashes; a cell
whose client crashed or reported nothing counts as a failure.

Motivation

The conformance harness checks the SDK against a mock peer. It does not show
whether the SDK works with other implementations, in particular with
concurrent traffic, cancellation, notifications, stream resumption, era
negotiation and server restarts. The Go and Python SDKs are the reference
implementations that Swift clients and servers will meet.

Changes

Matrix

Path What
scripts/run-interop.sh Builds the fixtures, installs the pinned SDKs, starts the servers, runs every cell, writes .build/interop/report.md; --update-results copies it to interop/RESULTS.md
interop/swift-client/ mcp-interop-client (new executable target MCPInteropClient): the check battery on the Swift SDK
interop/go-client/ the same battery on the Go SDK; go.mod pins github.com/modelcontextprotocol/go-sdk v1.8.0 and builds its conformance server and examples as tool dependencies
interop/python-client/ the same battery on the Python SDK; requirements.in pins mcp==2.3.0 and the everything-server at the v2.3.0 commit, requirements.txt is its lock with hashes, examples.sha256 checks the example servers
interop/report.py turns the JSON lines of a run into the Markdown report
interop/README.md, interop/RESULTS.md checks, findings, the recorded report

The SDK versions are pinned in files, so the matrix needs no local checkouts
of the other SDKs: Go modules come from the module proxy, the Python SDK is
installed into .build/interop/py-venv.

The three drivers take the same flags and print the same JSON lines. Check
profiles:

Profile Checks
everything (report: basic) every tool, resource and prompt of the conformance fixture, sampling, elicitation, logging, progress, multi round-trip requests
advanced 16 concurrent calls with separate progress tokens, 8 concurrent calls that need input, cancel then continue, list-changed notifications, resource subscription and update, stream resumption, Mcp-Param-* headers (ASCII and non-ASCII), streaming elicitation
connect era negotiation, and a pin to 2026-07-28 against a server without it
session the server restarts between two calls
tool one tool call against each SDK's example server

Swift fixture

  • conformance/everything-server: --stdio mode; the resource template is
    test://template/{id}/data and the watched resource
    test://watched-resource, the names that the harness and the other SDKs
    use.

Docs

  • docs/src/testing.src.md: an Interop section. CONTRIBUTING.md: how to run
    the matrix. README.src.md: the interop/ directory in the layout.
  • docs/src/protocol.src.md, docs/src/troubleshooting.src.md: what the
    matrix showed about the other SDKs (the Go server keeps no events; the Go and
    Python clients do not re-initialize an expired session either).
  • CLAUDE.md: an Interop section.

Review fixes

Python pins (interop/python-client/, scripts/run-interop.sh)

  • The everything-server was installed from the v2.3.0 tag, which can move, and the other
    dependencies were resolved at install time. requirements.in (new) pins mcp==2.3.0 and the
    server to commit 2118f14f8a19bc158d8a1cf90af58d85d187f849. requirements.txt is now the
    lock with hashes generated from it (uv pip compile --generate-hashes; the command is in
    requirements.in), installed with uv pip sync --require-hashes; the git dependency is
    installed with --no-deps. The venv is rebuilt when either file changes.
  • The example servers were downloaded from the tag on every run and not checked. They now come
    from the same commit, are checked against examples.sha256 (new) before every run, and are
    downloaded only when missing or changed; a mismatch after the download stops the run. Needs
    sha256sum or shasum.

Cell status (scripts/run-interop.sh, interop/report.py)

  • The client's exit status was discarded, so a crashed or timed-out client with partial output
    passed. Each cell writes its exit status to <cell>.exit. The report adds a failed run
    check to a cell without a meta line, without checks, or whose client exited with an error
    without reporting a failed check.
  • limit exited 0 when the client could not be started; it now fails with a message.

Servers (scripts/run-interop.sh)

  • A server left by an earlier run on the same port answered in place of the new one. The script
    stops when one of the ports (3101, 3111, 3201, 3202, 3211, 3301, 3311, 8000) is in use, and
    wait_for checks that the process it started is alive when the URL answers.
  • Reaped PIDs stayed in the cleanup list, so cleanup could signal a reused PID, and the session
    cells' clients were not tracked. track and reap keep the list to live processes; the
    session cells' clients are stopped on exit.

Report (interop/report.py, interop/RESULTS.md)

  • Peer-supplied text (check names, details, negotiated version) went into the Markdown tables
    with only | escaped. escape collapses whitespace, escapes &, <, > as entities and
    Markdown characters with a backslash; check names are no longer code spans. Missing keys in a
    check line no longer raise. RESULTS.md regenerated: same rows and counts.

Docs

  • interop/README.md: requirements, the fixed ports, when a cell fails, the pin files and how
    to update them, UV_SYSTEM_CERTS=1 behind a TLS-intercepting proxy. CLAUDE.md: the pin
    files.

Diagram

The matrix:

flowchart LR
    subgraph Clients
        SC[Swift driver]
        GC[Go driver]
        PC[Python driver]
    end
    subgraph Servers
        SS["Swift everything-server (HTTP, stdio)"]
        GS["Go everything-server (stateful, stateless, stdio)"]
        PS["Python everything-server (HTTP)"]
        EX["Example servers (hello, quickstart)"]
    end
    SC --> SS & GS & PS & EX
    GC --> SS & GS & PS & EX
    PC --> SS & GS & PS & EX
    Servers --> R["report.py: RESULTS.md"]
Loading

API changes

None in the MCP library. New executable target MCPInteropClient
(mcp-interop-client), not a product dependency of MCP.

Behavior changes

None in the MCP library.

Results

interop/RESULTS.md: Swift SDK at the last change to Sources/ (the top of
P13 (#358)), Go v1.8.0, Python v2.3.0. 105 client-server cells (45 basic,
30 advanced, 15 connect, 15 session), 1569 checks, and four example clients.

Failures Cells Cause
tool-sampling, tool-elicitation each client, Go stateless HTTP server at 2025-11-25 the Go stateless handler cannot send server-to-client requests (by design)
mrtr-list-roots, mrtr-multiple-inputs Go client, Python server, 2026-07-28 Go client bug: InputRequestMap.UnmarshalJSON requires params
reconnection each client, Go stateful server the Go conformance server keeps no events; each client fails with a clear error

No failure involves the Swift SDK. Without the P1 (#370) transport fix,
concurrent-input deadlocked and reconnection waited forever against servers
without an event store.

Reports for the other SDKs' maintainers are prepared separately.

Conformance

Unchanged: tier score 100% for client and server at 2025-11-25 and
2026-07-28. Default baseline: 25 server entries (tasks extension), 0 client.

Tests

No library test changes; 860 swift-testing tests pass, plus XCTest.

Review notes

  • The RESULTS.md header names the Swift SDK by the last commit that changed
    Sources/, so the record stays valid while this branch and the next are
    amended.
  • Each SDK supports exactly one 2026-07-28 version, so the -32022 retry path
    (propose, get rejected, retry with a version from supported) cannot be
    reached in the matrix; unit tests cover it.
  • Only the Go server updates test://watched-resource, so resource-updated
    runs against Go servers only.
  • Session cells restart servers with SIGKILL: the Python server's graceful
    shutdown waits for idle keep-alive connections.
  • The matrix needs network access on the first run (Go module proxy, PyPI,
    GitHub raw for the Python example servers). It is not wired into CI here;
    P17 ([P17] ci: one job list for GitHub Actions and Linux at the desk #354) adds it, gated by run-interop.sh --check.
  • Linux: the matrix is verified on macOS only. SSE is not available on Linux,
    where the transport reads whole response bodies.

Verification

Every branch of the stack builds and passes swift test; on this branch, 853 swift-testing
tests plus XCTest. DocC builds with --warnings-as-errors. All conformance legs pass at their
baselines; the tier score is 100% for client and server at 2025-11-25 and 2026-07-28.
scripts/run-interop.sh --check (added in P17 (#354)) passes at the top of the stack.

swift test
scripts/run-interop.sh                      # .build/interop/report.md
scripts/run-conformance.sh --requirements 2025-11-25 --mode client --bin-path $(swift build --show-bin-path)
scripts/run-conformance.sh --requirements 2026-07-28 --mode client --bin-path $(swift build --show-bin-path)
scripts/run-conformance.sh --requirements 2026-07-28 --mode server --bin-path $(swift build --show-bin-path)
swift scripts/weave.swift --check

AI usage disclosure: the changes, the tests, the commit messages and this description were written with Claude Opus 5.5 and reviewed by the authors.

Adds an interop matrix that runs real clients and servers of the Swift,
Go and Python MCP SDKs against each other, in both protocol eras, over
Streamable HTTP and stdio. The matrix found two bugs in
`HTTPClientTransport`, a connection-limit deadlock and requests that
waited forever after their response stream ended. Both predate this work
and are fixed earlier in the series. In the recorded run, the Swift SDK
passes every cell in which it is the client or the server. The Python
side is pinned by commit and installed from a lock with hashes; a cell
whose client crashed or reported nothing counts as a failure.
- run-interop.sh: limit() forks and runs the command in its own process
  group; on expiry it sends TERM, then KILL, to the group and to every
  descendant, so a Go client (the Go runtime ignores SIGALRM) is stopped
  and a stdio client's server (Foundation's Process gives it a group of
  its own) does not survive. Exit status stays 142 on expiry and
  128+signal otherwise; signals to the limit reach the command.
- Python driver: an exception after connect but before the profile's
  checks finish is reported as a failed "battery" check with exit status
  1, instead of being printed as shutdown noise with exit status 0.
- report.py: an example client with a non-zero exit status is listed in
  the Failures table, so the report no longer says "No failures.".
- The conformance server's build backend (hatchling and its
  dependencies) is pinned with hashes in the Python lock, and the git
  requirement is installed without build isolation or the index.
- Go driver: concurrent-calls also fails on progress for unknown
  interop-c tokens, as the Swift driver does; the Python driver cannot
  observe such tokens, which a comment now says.
- The unsupported-version expectation of the connect profile passes only
  on -32022 or an error that says the protocol version is unsupported or
  not supported, in all three drivers. A substring match on "unsupported"
  also passed on, for example, HTTP 415 Unsupported Media Type.
- session-expired passes only when the call recovers or fails with an
  error saying the session was not found, expired or terminated; any other
  error fails the check. The recorded outcomes of every SDK still pass.
- cleanup also sends TERM to the children of each tracked process. A
  session cell's tracked PID is its subshell; its child, the limit, stops
  the client's process group and tree, so an aborted run no longer leaves
  the client running until the 300 s limit.
- The connect cells that negotiate against the Swift, Python and Go
  stateless servers expect 2026-07-28 (--expect-era stateless). Without an
  expectation, a fallback to the handshake against a server that serves
  2026-07-28 still passed.
- unknown-tool passes on an isError result or -32602 only, and
  unknown-resource on -32602 or -32002 only, in all three drivers. Any
  MCPError passed before, including -32000 and -32001, and the -32603 the
  HTTP transport synthesizes for HTTP 5xx and dropped streams, so a crashed
  server passed. The codes are the spec's (tools, resources error
  handling, 2025-11-25 and 2026-07-28); every SDK's server returns -32602
  or an isError result in the recorded run.
- The Python discover check sends server/discover with send_discover. In a
  pinned 2026-07-28 mode, discover() returns the locally synthesized result
  without a request. The Python and Swift checks also require a non-empty
  supportedVersions.

@canarik canarik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jeanmatthieu

@jeanmatthieu
jeanmatthieu merged commit b5c20be into rel/1.0.0 Nov 25, 2026
@jeanmatthieu
jeanmatthieu deleted the conformance/p15-interop branch November 25, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants