Mcp pool http proxy for subprocess sdks
Skill kjuhwa/skills-hub/skills/mcp-integration/mcp-pool-http-proxy-for-subprocess-sdks
Expose a pool of MCP sources (Linear, GitHub, Notion, ...) to Codex/Copilot SDK subprocesses through a single Streamable-HTTP MCP endpoint, instead of having each subprocess open independent connections.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill mcp-pool-http-proxy-for-subprocess-sdksAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.4 KB, 689 tokens by cl100k_base, as published. Nobody here has run it
MCP pool HTTP proxy for subprocess SDKs
When to use
- Host process already manages MCP connections to many sources (Linear, GitHub, Notion, ...).
- You spawn LLM SDK subprocesses (Codex, Copilot) that themselves consume MCP tools.
- You do NOT want each subprocess re-establishing stateful stdio/SSE connections to every source.
- Want stateless HTTP so multiple subprocesses can share the pool with no session tracking.
How it works
- In the host (e.g. Electron main), keep an
McpClientPoolofPoolClientinstances — one per source, each holding the real@modelcontextprotocol/sdkclient. - Stand up a local HTTP server on
127.0.0.1:0(random port). - Wrap it with
StreamableHTTPServerTransport({ sessionIdGenerator: undefined })— stateless mode, no session affinity. - Connect an
@modelcontextprotocol/sdk/serverServerto the transport; registerListToolsRequestSchema(fan-out to the pool, namespaced tool names) andCallToolRequestSchema(dispatch back). - Route every incoming request at
/mcptotransport.handleRequest(req, res)regardless of HTTP method. - Return the URL
http://127.0.0.1:<port>/mcpto each spawned SDK subprocess as its MCP endpoint. - Subprocess uses
StreamableHTTPClientTransport(new URL(url))to talk to the pool.
Example
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
this.transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
this.mcpServer = new Server({ name: 'pool', version: '1.0.0' }, { capabilities: { tools: {} } });
this.mcpServer.setRequestHandler(ListToolsRequestSchema, async () => {
const tools = [];
for (const [slug, client] of this.pool.entries()) {
const list = await client.listTools();
tools.push(...list.map(t => ({ ...t, name: `mcp__${slug}__${t.name}` })));
}
return { tools };
});
this.mcpServer.setRequestHandler(CallToolRequestSchema, async (req) => {
const [, slug, tool] = req.params.name.split('__');
return this.pool.get(slug).callTool(tool, req.params.arguments);
});
await this.mcpServer.connect(this.transport);
http.createServer((req, res) => this.transport.handleRequest(req, res)).listen(0, '127.0.0.1');
Gotchas
- Stateless mode means DO NOT use
session/notificationsor resource subscriptions - they all need a session ID. - Bind to
127.0.0.1only - the SDK subprocess shares your localhost so no need to open a port publicly. - Namespace tool names aggressively (
mcp__<source>__<tool>) so collisions between sources don't silently shadow each other. transport.handleRequestcovers POST, GET, DELETE - route them all to it; don't try to branch on method.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.