Skip to content

feat(mcp): make bundled servers stateless-first - #3642

Open
Morgan Carr (morgan-coded) wants to merge 1 commit into
microsoft:mainfrom
morgan-coded:feat/mcp-stateless-first-servers
Open

feat(mcp): make bundled servers stateless-first#3642
Morgan Carr (morgan-coded) wants to merge 1 commit into
microsoft:mainfrom
morgan-coded:feat/mcp-stateless-first-servers

Conversation

@morgan-coded

Copy link
Copy Markdown

RFC #2597 is the scope authority for making the Claude Code, OpenCode, and Antigravity MCP servers stateless-first while preserving the legacy lifecycle.

This adds server/discover with the same capabilities, serverInfo, and full tool declaration as initialize plus tools/list, while initialize and notifications/initialized stay unchanged as compatibility paths.

The RFC answers my July scoping question: _meta is per-request across list/read/call, so these tool-only servers validate client info and capabilities on list/call, reject invalid stateless calls, and preserve valid caller context in the result.

One boundary worth naming: ADR 0027 identifies a stateless peer by the MCP-Protocol-Version: 2026-07-28 transport header, and stdio has no equivalent, so these servers treat absent _meta as legacy and reject only _meta that is present and malformed — which is what this issue asks for, accepting stateless requests that carry _meta. Rejecting absent _meta would need a server-level stateless-only mode; say the word if you want that as a follow-up.

Each package keeps its own test idiom and its native gates pass: npm run check and npm test are green at 22, 30, and 27 tests for Claude Code, OpenCode, and Antigravity.

No protocol session state or identifier is added.

Closes #3131

Signed-off-by: morgan-coded <256248948+morgan-coded@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 03:37
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Welcome to the Agent Governance Toolkit! Thanks for your first pull request.
Please ensure tests pass, code follows style (ruff check), and you have signed the CLA.
See our Contributing Guide.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🔴 Contributor Check: HIGH

Check Result
Profile HIGH
Credential LOW
Overall HIGH

Automated check by AGT Contributor Check.

@github-actions github-actions Bot added the needs-review:HIGH Contributor reputation check flagged HIGH risk label Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

TL;DR: 0 blockers, 0 warnings. No issues found. Clean change.

Changes:

  • Add stateless-first server/discover to the bundled MCP servers (Claude Code, OpenCode, Antigravity) while keeping initialize / notifications/initialized as compatibility paths.
  • Validate per-request _meta for stateless tools/list and tools/call, rejecting malformed _meta while treating absent _meta as legacy.
  • Extend each package’s MCP server test suite to cover discovery parity, stateless _meta validation, and legacy compatibility.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
agent-governance-opencode/server/agt-mcp.mjs Implements server/discover, adds _meta validation for tool methods, and echoes validated _meta in tool call results.
agent-governance-opencode/test/mcp-server.test.mjs Adds parity + stateless _meta behavior tests and a helper for isolated server state.
agent-governance-claude-code/server/agt-mcp.mjs Implements server/discover, adds _meta validation for tool methods, and echoes validated _meta in tool call results.
agent-governance-claude-code/test/mcp-server.test.mjs Adds parity + stateless _meta behavior tests while keeping legacy lifecycle coverage.
agent-governance-antigravity-cli/assets/extensions/agt-global-policy/mcp/server.mjs Implements server/discover, adds _meta validation for tool methods, and echoes validated _meta in tool call results (stdio server).
agent-governance-antigravity-cli/test/mcp-server.test.mjs Adds parity + stateless _meta behavior tests for the stdio server, preserving legacy compatibility checks.

@morgan-coded

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:HIGH Contributor reputation check flagged HIGH risk size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: make bundled servers stateless-first

2 participants