diff --git a/pkgs/mcpx/docs/spec/conformance-matrix.md b/pkgs/mcpx/docs/spec/conformance-matrix.md index 976a74aa8e..9ae44aab94 100644 --- a/pkgs/mcpx/docs/spec/conformance-matrix.md +++ b/pkgs/mcpx/docs/spec/conformance-matrix.md @@ -2,7 +2,7 @@ Generated by `internal/conformance` (`MCPX_UPDATE_MATRIX=1 go test ./internal/conformance -run TestMatrix`); do not edit. -Generated from inputs `70ec5ae69355b628` (sha256 of docs/spec/requirements.md, internal/conformance/overrides/*.json, internal/conformance/coverage*.go, internal/conformance/authsplit.json). `TestMatrix` regenerates this file and fails when it differs, so it describes the tree it is committed in. +Generated from inputs `e9412930e5a01e78` (sha256 of docs/spec/requirements.md, internal/conformance/overrides/*.json, internal/conformance/coverage*.go, internal/conformance/authsplit.json). `TestMatrix` regenerates this file and fails when it differs, so it describes the tree it is committed in. Every normative requirement of every revision (catalogue: `docs/spec/requirements.md`), for mcpx as a server and as a client. A requirement is *tested* when a named test verifies it in that revision, *n/a* when it does not bind mcpx in that role, and a *gap* when it binds mcpx and mcpx does not meet it yet, with the issue that tracks it. Run exactly the covering tests with `go run ./internal/conformance/cmd/covering`. @@ -25,7 +25,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | 2025-03-26 | server | MUST | 44 | 43 | 1 | 0 | 37 | | 2025-03-26 | server | MUST NOT | 7 | 7 | 0 | 0 | 8 | | 2025-03-26 | server | SHOULD | 45 | 44 | 1 | 0 | 58 | -| 2025-03-26 | server | SHOULD NOT | 4 | 3 | 1 | 0 | 1 | +| 2025-03-26 | server | SHOULD NOT | 4 | 4 | 0 | 0 | 1 | | 2025-03-26 | server | MAY | 16 | 16 | 0 | 0 | 21 | | 2025-03-26 | server | other | 11 | 11 | 0 | 0 | 1 | | 2025-03-26 | client | MUST | 35 | 33 | 2 | 0 | 46 | @@ -37,7 +37,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | 2025-06-18 | server | MUST | 53 | 52 | 1 | 0 | 48 | | 2025-06-18 | server | MUST NOT | 10 | 10 | 0 | 0 | 8 | | 2025-06-18 | server | SHOULD | 48 | 47 | 1 | 0 | 67 | -| 2025-06-18 | server | SHOULD NOT | 4 | 3 | 1 | 0 | 1 | +| 2025-06-18 | server | SHOULD NOT | 4 | 4 | 0 | 0 | 1 | | 2025-06-18 | server | MAY | 15 | 15 | 0 | 0 | 20 | | 2025-06-18 | server | other | 15 | 15 | 0 | 0 | 3 | | 2025-06-18 | client | MUST | 42 | 39 | 3 | 0 | 59 | @@ -49,7 +49,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | 2025-11-25 | server | MUST | 103 | 100 | 3 | 0 | 77 | | 2025-11-25 | server | MUST NOT | 22 | 22 | 0 | 0 | 13 | | 2025-11-25 | server | SHOULD | 73 | 70 | 3 | 0 | 86 | -| 2025-11-25 | server | SHOULD NOT | 11 | 10 | 1 | 0 | 3 | +| 2025-11-25 | server | SHOULD NOT | 11 | 11 | 0 | 0 | 3 | | 2025-11-25 | server | MAY | 25 | 25 | 0 | 0 | 30 | | 2025-11-25 | server | other | 19 | 19 | 0 | 0 | 2 | | 2025-11-25 | client | MUST | 65 | 62 | 3 | 0 | 115 | @@ -61,7 +61,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | 2026-07-28 | server | MUST | 114 | 112 | 2 | 0 | 110 | | 2026-07-28 | server | MUST NOT | 44 | 44 | 0 | 0 | 20 | | 2026-07-28 | server | SHOULD | 69 | 66 | 3 | 0 | 91 | -| 2026-07-28 | server | SHOULD NOT | 11 | 10 | 1 | 0 | 9 | +| 2026-07-28 | server | SHOULD NOT | 11 | 11 | 0 | 0 | 9 | | 2026-07-28 | server | MAY | 29 | 29 | 0 | 0 | 32 | | 2026-07-28 | server | other | 23 | 23 | 0 | 0 | 4 | | 2026-07-28 | client | MUST | 73 | 70 | 3 | 0 | 151 | @@ -403,7 +403,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [streamable-http-auth-discovery-version-header](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#server-metadata-discovery-headers) | SHOULD | client | n/a: addresses the other side | n/a: no OAuth | | [authz-optional](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | OPTIONAL | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | | [authz-http-should-conform](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | -| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | **gap** #1950: the merged #1975 bearer work (PR #2711) gates the HTTP surface only; the `env` auth type retrieves credentials from the environment for stdio children (mcpauth) but no test traces that retrieval into a stdio child end to end, so the server-side stdio row is not yet bound -- repointed from closed #1975 to live #1950 (task 14860) | **gap** not implemented: #1950 | +| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | tested: `pool.TestStdioChildReceivesEnvCredential@all` | **gap** not implemented: #1950 | | [authz-alt-transport-best-practice](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | MUST | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-implement-oauth21](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#overview) | MUST | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | | [authz-dcr-should](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#dynamic-client-registration) | SHOULD | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | @@ -792,7 +792,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [authorization-custom-auth-may](https://modelcontextprotocol.io/specification/2026-07-28/basic/index#auth) | MAY | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-optional](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | OPTIONAL | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | | [authz-http-should-conform](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | -| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | **gap** #1950: the merged #1975 bearer work (PR #2711) gates the HTTP surface only; the `env` auth type retrieves credentials from the environment for stdio children (mcpauth) but no test traces that retrieval into a stdio child end to end, so the server-side stdio row is not yet bound -- repointed from closed #1975 to live #1950 (task 14860) | **gap** not implemented: #1950 | +| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | tested: `pool.TestStdioChildReceivesEnvCredential@all` | **gap** not implemented: #1950 | | [authz-alt-transport-best-practice](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | MUST | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-as-implements-oauth21](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#overview) | MUST | auth-server | n/a: addresses the other side | n/a: addresses the other side | | [authz-dcr-should](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#dynamic-client-registration) | SHOULD | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | @@ -1226,7 +1226,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [authorization-custom-auth-may](https://modelcontextprotocol.io/specification/2026-07-28/basic/index#auth) | MAY | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-optional](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | OPTIONAL | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | | [authz-http-should-conform](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | -| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | **gap** #1950: the merged #1975 bearer work (PR #2711) gates the HTTP surface only; the `env` auth type retrieves credentials from the environment for stdio children (mcpauth) but no test traces that retrieval into a stdio child end to end, so the server-side stdio row is not yet bound -- repointed from closed #1975 to live #1950 (task 14860) | **gap** not implemented: #1950 | +| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | tested: `pool.TestStdioChildReceivesEnvCredential@all` | **gap** not implemented: #1950 | | [authz-alt-transport-best-practice](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | MUST | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-as-implements-oauth21](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#overview) | MUST | auth-server | n/a: addresses the other side | n/a: addresses the other side | | [authz-dcr-may-deprecated](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration#dynamic-client-registration) | MAY | client, auth-server | n/a: addresses the other side | n/a: optional feature mcpx does not implement | @@ -1842,7 +1842,7 @@ Every normative requirement of every revision (catalogue: `docs/spec/requirement | [authorization-custom-auth-may](https://modelcontextprotocol.io/specification/2026-07-28/basic/index#auth) | MAY | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-optional](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | OPTIONAL | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | | [authz-http-should-conform](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD | both | n/a: optional feature mcpx does not implement | n/a: optional feature mcpx does not implement | -| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | **gap** #1950: the merged #1975 bearer work (PR #2711) gates the HTTP surface only; the `env` auth type retrieves credentials from the environment for stdio children (mcpauth) but no test traces that retrieval into a stdio child end to end, so the server-side stdio row is not yet bound -- repointed from closed #1975 to live #1950 (task 14860) | **gap** not implemented: #1950 | +| [authz-stdio-use-environment](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | SHOULD NOT | both | tested: `pool.TestStdioChildReceivesEnvCredential@all` | **gap** not implemented: #1950 | | [authz-alt-transport-best-practice](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#protocol-requirements) | MUST | both | n/a: catalogue marks it n/a | n/a: catalogue marks it n/a | | [authz-as-implements-oauth21](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#overview) | MUST | auth-server | n/a: addresses the other side | n/a: addresses the other side | | [authz-dcr-may-deprecated](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration#dynamic-client-registration) | MAY | client, auth-server | n/a: addresses the other side | n/a: optional feature mcpx does not implement | diff --git a/pkgs/mcpx/internal/conformance/coverage_authz.go b/pkgs/mcpx/internal/conformance/coverage_authz.go index 7a98927aa9..a51ca428b0 100644 --- a/pkgs/mcpx/internal/conformance/coverage_authz.go +++ b/pkgs/mcpx/internal/conformance/coverage_authz.go @@ -1,10 +1,10 @@ package conformance -// Authorization rows judged against the merged #1975 bearer work +// Authorization rows judged against the merged #1975 bearer // (PR #2711) for #1950's remainder (task 14860). The overrides in // overrides/authorization.json re-judge these server sides to -// "applies" so the bindings and the recorded gap below -- not the -// catalogue's blanket pointer at closed #1975 -- decide the cells. +// "applies" so the bindings below -- not the catalogue's blanket +// pointer at closed #1975 -- decide the cells. func init() { register( // The token the client presented to the daemon is never @@ -12,21 +12,18 @@ func init() { // key instead. S("authz-no-token-passthrough", "daemon.TestProxyKeepsUpstreamKeyWhenBearerSet@all"), - // The daemon accepts only its own configured bearer token, + // The daemon accepts only its own configured bearer , // on the /mcp surface as on every route; anything else is a // 401 before the MCP handler runs. S("authz-accept-only-own-tokens", "daemon.TestMCPRejectsUnauthenticatedWhenBearerSet@all"), - ) - registerGaps( - // Judged NOT satisfied by the bearer work: PR #2711 gates - // the HTTP surface and does not touch the stdio credential - // path. mcpauth's `env` auth type retrieves credentials - // from the environment for stdio children, but no test - // traces that retrieval into a stdio child's environment - // end to end, so the server side stays a gap -- repointed - // from closed #1975 to live #1950 with this reason. - Gap{ID: "authz-stdio-use-environment", Side: Server, Issue: "#1950", - Why: "the merged #1975 bearer work (PR #2711) gates the HTTP surface only; the `env` auth type retrieves credentials from the environment for stdio children (mcpauth) but no test traces that retrieval into a stdio child end to end, so the server-side stdio row is not yet bound -- repointed from closed #1975 to live #1950 (task 14860)"}, + // A stdio server does not run the OAuth flow: its + // credential is retrieved from the daemon's environment by + // the `env` auth type (mcpauth) and carried into the + // spawned child. The pool test traces that retrieval end + // to end -- the child itself reports the value it + // received, under a name set nowhere but the auth block. + S("authz-stdio-use-environment", + "pool.TestStdioChildReceivesEnvCredential@all"), ) } diff --git a/pkgs/mcpx/internal/conformance/overrides/authorization.json b/pkgs/mcpx/internal/conformance/overrides/authorization.json index 3392eeb666..f13e6b7f91 100644 --- a/pkgs/mcpx/internal/conformance/overrides/authorization.json +++ b/pkgs/mcpx/internal/conformance/overrides/authorization.json @@ -9,6 +9,6 @@ }, "authz-stdio-use-environment": { "server": "applies", - "why": "#1950 remainder (task 14860): re-judged so the recorded gap in coverage_authz.go (pointing at live #1950, with the reason) renders instead of the blanket pointer at closed #1975. The client side is untouched and keeps the #1950 blanket gap per the recorded deferral." + "why": "#1950 remainder: re-judged so the binding in coverage_authz.go renders instead of the blanket pointer at closed #1975. Bound by pool.TestStdioChildReceivesEnvCredential: the `env` auth type retrieves the credential from the daemon's environment and the spawned stdio child reports it back end to end. The client side is untouched and keeps the #1950 blanket gap per the recorded deferral." } } diff --git a/pkgs/mcpx/internal/pool/auth_test.go b/pkgs/mcpx/internal/pool/auth_test.go index ff2b34a46c..97e1253967 100644 --- a/pkgs/mcpx/internal/pool/auth_test.go +++ b/pkgs/mcpx/internal/pool/auth_test.go @@ -10,6 +10,7 @@ import ( "github.com/developing-today/code/pkgs/mcpx/internal/config" "github.com/developing-today/code/pkgs/mcpx/internal/mcpauth" "github.com/developing-today/code/pkgs/mcpx/internal/pool" + "github.com/developing-today/code/pkgs/mcpx/internal/testsupport" ) // #240: a server's `auth` block was parsed and never applied, so a configured @@ -84,3 +85,53 @@ func TestAuthReachesTheUpstream(t *testing.T) { } }) } + +// #1950: for a stdio server the authorization specification says to +// retrieve credentials from the environment rather than follow the +// OAuth flow ("Implementations using an STDIO transport SHOULD NOT +// follow this specification, and instead retrieve credentials from +// the environment"). This traces that path end to end: the credential +// exists only in the daemon's environment, the server's `env` auth +// block retrieves it, and the spawned child itself reports what it +// received. The reported name is set nowhere but the auth block, so +// ordinary environment inheritance cannot produce it. +func TestStdioChildReceivesEnvCredential(t *testing.T) { + bin := testsupport.FakeMCPBinary(t) + + t.Run("a ${VAR} reference is expanded from the daemon's environment", func(t *testing.T) { + t.Setenv("MCPX_TEST_STDIO_SOURCE", "retrieved-credential") + r := resolvedWith(t, &config.Server{ + Command: bin, + // The fake server answers `echo` with the value of the + // named variable in its own environment. + Env: map[string]string{"MCPX_REPORT_ENV": "MCPX_CHILD_CREDENTIAL"}, + Auth: &mcpauth.Auth{Type: "env", Env: map[string]string{ + "MCPX_CHILD_CREDENTIAL": "${MCPX_TEST_STDIO_SOURCE}", + }}, + }) + p := pool.New(r) + t.Cleanup(p.Close) + raw, err := p.Call(ctx20(t), config.ResolvedScope{Key: "global"}, "echo", map[string]any{"message": "x"}) + if err != nil { + t.Fatalf("call: %v", err) + } + if got := textOf(t, raw); got != "retrieved-credential" { + t.Fatalf("child reports %q, want %q (the credential held in the daemon's environment)", got, "retrieved-credential") + } + }) + + t.Run("an unset variable fails before the child spawns", func(t *testing.T) { + r := resolvedWith(t, &config.Server{ + Command: bin, + Auth: &mcpauth.Auth{Type: "env", Env: map[string]string{ + "MCPX_CHILD_CREDENTIAL": "${MCPX_TEST_STDIO_UNSET}", + }}, + }) + p := pool.New(r) + t.Cleanup(p.Close) + _, err := p.Call(ctx20(t), config.ResolvedScope{Key: "global"}, "echo", map[string]any{"message": "x"}) + if err == nil || !strings.Contains(err.Error(), "MCPX_TEST_STDIO_UNSET") { + t.Fatalf("err = %v, want it to name MCPX_TEST_STDIO_UNSET", err) + } + }) +}