Skip to content

feat: add remote MCP server support#66

Open
vu1n wants to merge 1 commit intodeathbyknowledge:mainfrom
vu1n:feat/remote-mcp-servers
Open

feat: add remote MCP server support#66
vu1n wants to merge 1 commit intodeathbyknowledge:mainfrom
vu1n:feat/remote-mcp-servers

Conversation

@vu1n
Copy link
Copy Markdown

@vu1n vu1n commented Apr 9, 2026

Summary

Adds remote MCP server support to the Gateway, addressing #45. The Gateway can now connect to HTTP-based MCP servers via @modelcontextprotocol/sdk and expose their tools alongside native and node tools in a unified {sourceId}__{toolName} catalog.

  • MCP tools use the same naming convention as node tools — the LLM sees one flat list
  • Config-driven: config.set mcp.servers.context7.url "https://mcp.context7.com/mcp"
  • Spec-compliant protocol lifecycle (initialize, version negotiation, capabilities)
  • Connection caching with 2-min TTL, evict-on-failure (no automatic retry — side-effecting tools must not be replayed)
  • Tool list cache with 5-min TTL, refreshed via Gateway alarm system, cleared on refresh failure
  • Server ID validation (rejects reserved gsv prefix and IDs containing __)
  • Bearer tokens masked in getSafeConfig(); AI agent's ConfigGet uses masked reads, RPC preserves raw for UI
  • Bounded timeouts on connect + listTools + callTool
  • Zero overhead when no servers configured

Tested end-to-end against live context7 MCP server (integration test included).

Test plan

  • npx tsc --noEmit — clean
  • npm test — 218 tests passing (8 new)
  • Integration test against live context7: tool discovery + resolution + execution
  • Gateway e2e: config.set → cache warm → tools.list includes MCP tools
  • Verify with a second MCP server (e.g., aeon-stratum)

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

@vu1n vu1n force-pushed the feat/remote-mcp-servers branch 2 times, most recently from 7d25054 to bbcd0bb Compare April 9, 2026 10:56
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
@vu1n vu1n force-pushed the feat/remote-mcp-servers branch from bbcd0bb to d5a68ab Compare April 9, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant