Repository navigation
Restrict advertised MCP protocol versions to avoid sessionless discovery on stateful HTTP frontends - #13221
Conversation
Co-authored-by: lpcox <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The version filter can re-advertise a stateless protocol after a future SDK version is added.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Restricts MCP discovery negotiation to legacy stateful protocol versions so clients fall back to initialize.
Changes:
- Narrows advertised SDK protocol versions.
- Adds unified and routed discovery regressions.
- Documents client compatibility behavior.
File summaries
| File | Description |
|---|---|
README.md |
Documents protocol fallback behavior. |
internal/server/http_server.go |
Configures supported protocol versions. |
internal/server/http_server_test.go |
Tests discovery rejection in both modes. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Modify supportedProtocolVersions to return only legacy protocol versions, ensuring compliance with stateful-handshake requirements. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: lpcox <[email protected]>
Fixed in 8f5e1a5 (or the latest commit) — the |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked in this run. However:
No reaction, star, issue, comment, branch, file, or PR was created or leaked.
|
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE Notes:
|
### Packages impacted by this PR No published SDK packages. This changes the 12 agentic workflow sources under `.github/workflows/` and their corresponding lock files. ### Issues associated with this PR Related to #40013, which tracks **removing the temporary pins later**. This implementation PR must not close that tracker. Diagnosis: [triage run 35194879095](https://github.com/Azure/azure-sdk-for-js/actions/runs/35194879095) reported success despite emitting no issue updates. ### Describe the problem that is addressed by this PR The workflows bundle MCP gateway `v0.4.18`, but their unpinned Copilot installer selected CLI `1.0.83` through the live compatibility matrix. Native discovery of both `github` and `safeoutputs` failed with an unsupported-protocol error. The triage agent exited 0, and the collector treated the absent output as a successful empty collection. This PR: - Explicitly pins Copilot CLI `1.0.80` across all 12 workflows, including both agent and detection installations. The separately configured detection engines in `mgmt-guidance` and `mgmt-review` receive explicit pins while retaining their custom models. - Adds a deterministic triage postcondition after output collection that fails on a missing, malformed, or empty output artifact. Diagnostic artifacts remain available when it fails. - Clarifies that intentional early exits emit `noop` unless an action has already been emitted, while infrastructure/tool failures must not masquerade as successful no-ops. - Updates the generated lock files without changing deployed permissions, gateway/container pins, models, or failure-report expiry. `mgmt-review`'s source strict setting is aligned with its already-strict deployed lock. The CLI pin is temporary. The triage output postcondition is a permanent safeguard and should remain when the pins are removed. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? The durable upstream fix shipped in MCP gateway `v0.4.24` via github/gh-aw-mcpg#13221, but the currently released gh-aw builds do not yet bundle it. Pinning the verified compatible CLI restores native MCP operation without relaxing strict mode, expanding permissions, or bypassing gateway protections. #40013 records the release-readiness and removal procedure. ### Are there test cases added in this PR? _(If not, why?)_ No repository test files were added; this is workflow/runtime configuration rather than SDK package code. Validation included: - Compiling all 12 workflows with gh-aw `v0.88.7` and final no-emit validation. Existing trigger/concurrency warnings remain unchanged. - 52 ad-hoc local assertions covering all 24 installer pins, preserved workflow behavior/security, postcondition ordering, the original failed run's empty artifact, valid action/type-only/explicit-noop outcomes, and malformed/missing output. - An isolated staged GitHub Actions trial of the final triage workflow. The new postcondition ran successfully, and native tools emitted three accepted outputs: issue type `Task`, label `needs-triage`, and an analysis comment. No production issue was modified. - `git diff --check`. ### Provide a list of related PRs _(if any)_ - github/gh-aw-mcpg#13221 — upstream MCP protocol-negotiation fix. ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ N/A — this is not an SDK release request. Workflow locks were regenerated with `gh aw compile`; unrelated generated failure-report expiry drift was excluded to preserve the deployed seven-day settings. ### Checklists - [x] Added impacted package name to the issue description — N/A; workflow tooling only. - [ ] Does this PR need any fixes in the SDK Generator? _(If so, create an Issue in the [typespec-azure](https://github.com/Azure/typespec-azure) repository and link it here)_ — No SDK generator changes are needed. - [x] Added a changelog (if necessary) — N/A; no published SDK package changes. Co-authored-by: Copilot App <[email protected]>
Native clients (e.g. Copilot CLI) probe the SDK's newest MCP protocol version via the stateless
server/discoverRPC (SEP-2575) before falling back to the legacyinitializehandshake. Since this gateway's HTTP handlers (/mcp,/mcp/{serverID}) are stateful and keyed offMcp-Session-Id, discovery would succeed but leave the client on a sessionless path, causing subsequent calls liketools/listto fail with-32022even with valid authentication.Server construction
newSDKServer(shared by routed and unified modes) now setsServerOptions.SupportedProtocolVersions, narrowing to the SDK's legacy versions and omitting the newest, stateless-capable one.supportedProtocolVersions()helper derives this list fromsdk.SupportedProtocolVersions()(newest-first) by dropping index 0, so it stays in sync with future SDK version additions.With this narrowed list, a
server/discoverprobe advertising the newest version is now rejected withCodeUnsupportedProtocolVersion(-32022) and asupportedlist containing only legacy versions — causing compliant clients to fall back toinitialize, which the stateful handlers support correctly.Tests
server/discoverrequest (with_meta,MCP-Protocol-Version, andMcp-Methodheaders) and assert the rejection and itssupportedversion list.supportedProtocolVersions().Docs