agentsclimarketplace

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

Install
npx -y skills add kjuhwa/skills-hub --skill mcp-pool-http-proxy-for-subprocess-sdks

Assembled 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

  1. In the host (e.g. Electron main), keep an McpClientPool of PoolClient instances — one per source, each holding the real @modelcontextprotocol/sdk client.
  2. Stand up a local HTTP server on 127.0.0.1:0 (random port).
  3. Wrap it with StreamableHTTPServerTransport({ sessionIdGenerator: undefined }) — stateless mode, no session affinity.
  4. Connect an @modelcontextprotocol/sdk/server Server to the transport; register ListToolsRequestSchema (fan-out to the pool, namespaced tool names) and CallToolRequestSchema (dispatch back).
  5. Route every incoming request at /mcp to transport.handleRequest(req, res) regardless of HTTP method.
  6. Return the URL http://127.0.0.1:<port>/mcp to each spawned SDK subprocess as its MCP endpoint.
  7. 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/notifications or resource subscriptions - they all need a session ID.
  • Bind to 127.0.0.1 only - 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.handleRequest covers 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.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.