feat: add remote MCP server support#66
Open
vu1n wants to merge 1 commit intodeathbyknowledge:mainfrom
Open
Conversation
5 tasks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a14263e4d0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
7d25054 to
bbcd0bb
Compare
Gateway can now connect to remote MCP servers via @modelcontextprotocol/sdk
and expose their tools alongside native and node tools. Tools use the same
{sourceId}__{toolName} naming convention — the LLM sees a flat catalog.
Routing:
- toolRequest() resolves sourceId against MCP config before nodes
- Connection caching with 2-min TTL, evict-on-failure
- Spec-compliant protocol lifecycle (initialize, version negotiation)
Config:
- McpConfig with per-server url, token, cacheTtlMs, timeoutMs
- Cache refreshed via Gateway alarm, invalidated on config.set
- Server ID validation (no reserved prefixes, no __ in IDs)
- Timeouts on connect + listTools + callTool
Security:
- Bearer tokens masked in getSafeConfig()
- HTTPS enforced (localhost exception for dev)
- AI agent ConfigGet uses masked reads; RPC preserves raw for UI
bbcd0bb to
d5a68ab
Compare
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
Adds remote MCP server support to the Gateway, addressing #45. The Gateway can now connect to HTTP-based MCP servers via
@modelcontextprotocol/sdkand expose their tools alongside native and node tools in a unified{sourceId}__{toolName}catalog.config.set mcp.servers.context7.url "https://mcp.context7.com/mcp"gsvprefix and IDs containing__)Tested end-to-end against live context7 MCP server (integration test included).
Test plan
npx tsc --noEmit— cleannpm test— 218 tests passing (8 new)