Support remote MCP servers over SSE/HTTP and harden the MCP client runtime#125
Merged
Merged
Conversation
Stop retrying remote MCP tool calls, move registry discovery off the session event loop, and make MCP transport overrides reset incompatible fields instead of poisoning the merged config.\n\nRequire explicit HTTP transport types for URL-based servers, add regression coverage for the merge and session startup paths, and align the operator docs with the current transport support.\n\nCo-Authored-By: Claude Code <noreply@anthropic.com>\nAI-Model: gpt-5.4\nAI-Contributed/Feature: 197/197\nAI-Contributed/UT: 300/300 Co-Authored-By: github-copilot <noreply@ai-tool.com> AI-Contributed/Feature: 197/197 AI-Contributed/UT: 300/300
Add the pending SSE and streamable HTTP MCP integration fixtures and tests, mark the integration suites explicitly, and clean up the existing stdio integration notes.\n\nThe HTTP-based fixtures now bind an OS-assigned port and write the real port back to the test helper, so readiness checks no longer rely on race-prone port guessing.\n\nCo-Authored-By: Claude Code <noreply@anthropic.com>\nAI-Model: gpt-5.4\nAI-Contributed/Feature: 0/0\nAI-Contributed/UT: 602/602 Co-Authored-By: github-copilot <noreply@ai-tool.com> AI-Contributed/Feature: 0/0 AI-Contributed/UT: 602/602
There was a problem hiding this comment.
Pull request overview
This PR extends the agent’s MCP client from stdio-only subprocess servers to also support remote MCP servers over SSE and streamable HTTP, and hardens startup/config behavior to avoid unsafe retries and event-loop blocking during registry construction.
Changes:
- Add SSE and streamable HTTP MCP transports (client adapter + schema validation) and document the new config fields.
- Harden MCP runtime: remove retry-on-timeout for remote tool calls and build the MCP/tool registry off the async session loop.
- Add integration + regression tests covering SSE/HTTP MCP discovery/calls, enabledTools filtering, unreachable-server behavior, and registry-build responsiveness.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new MCP transport fields and updated transport support notes. |
| agent/SKILL.md | Updates MCP server configuration docs for stdio vs HTTP transports. |
| agent/src/tools/mcp.py | Adds SSE/streamable HTTP transports and removes timeout retries for remote tool calls. |
| agent/src/config/schema.py | Validates transport-specific MCP server config; requires explicit type for URL-based servers. |
| agent/src/config/loader.py | Makes override merging transport-aware and safely falls back on invalid merged configs. |
| agent/src/session/service.py | Moves registry construction into the executor to keep the async loop responsive. |
| agent/tests/test_agent_config.py | Expands schema + override-merge tests for new transport behaviors. |
| agent/tests/test_mcp_client_adapter.py | Adds adapter unit tests for transport selection + updated retry behavior. |
| agent/tests/test_session_service_mcp.py | Regression test ensuring registry build doesn’t block the event loop. |
| agent/tests/mcp_http_test_helpers.py | Adds shared subprocess/port/ready-check helpers for HTTP MCP integration tests. |
| agent/tests/test_mcp_sse_integration.py | Full-stack SSE MCP integration tests with a real FastMCP server subprocess. |
| agent/tests/test_mcp_streamable_http_integration.py | Full-stack streamable HTTP MCP integration tests with a real FastMCP server subprocess. |
| agent/tests/test_mcp_stdio_integration.py | Marks stdio MCP integration tests as integration. |
| agent/tests/fixtures/fake_mcp_sse_server.py | Minimal FastMCP SSE server fixture for integration tests. |
| agent/tests/fixtures/fake_mcp_streamable_http_server.py | Minimal FastMCP streamable HTTP server fixture for integration tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Align MCP transport resolution with schema validation, update the README field matrix, and normalize new MCP HTTP test helper messages to English. Co-Authored-By: Claude Code <noreply@anthropic.com> AI-Model: GPT-5.4 Co-Authored-By: github-copilot <noreply@ai-tool.com> AI-Contributed/Feature: 27/27 AI-Contributed/UT: 39/39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends the built-in agent's MCP client support from stdio-only to remote SSE and streamable HTTP servers.
It also hardens the runtime path by removing retry-on-timeout for remote tool calls, moving MCP registry construction off the async session loop, and making transport-switching config overrides safe.
Why
Before this change, the built-in agent could load external MCP tools only through local stdio subprocesses. Remote HTTP-based MCP servers were not actually supported.
Supporting remote transports also required fixing a few correctness issues around retries, async startup, and config merging.
Testing
Checklist