Skip to content

External MCPs: manage connections via MCP SDK from a servers JSON list (support stdio/SSE/streamable-HTTP, not SSE-only) #231

Description

@PrielHaz

Problem

The current external-MCP support (the skillberry-plugin-mcp-importer plugin) is too limited:

  1. SSE transport only. plugin.py connects exclusively via mcp.client.sse.sse_client. It rejects anything that is not an http(s) SSE endpoint, so stdio and streamable-HTTP MCP servers cannot be imported at all.
  2. Requires the external server to stay running. Imported tools are stored as packaging_format: "mcp" with packaging_params: {mcp_url, mcp_tool_name} and a one-shot import that just lists tools. Every later tool call reconnects to that live SSE URL, so the imported tools only work while the upstream server is up. There is no managed/owned connection — the store is fully dependent on an external process being alive and reachable.

In short: a single import-time list_tools() over SSE, no connection ownership, no support for the other MCP transports.

What we want

Manage external MCPs the way I implemented it back in #4 (#4), using the MCP SDK directly:

  • Read an MCP servers JSON list (Claude-Desktop {"mcpServers": {...}} shape and friends) and, at startup, spin up the connections to each configured MCP server.
  • Use the MCP SDK to own one long-lived ClientSession per server across all transportsstdio, sse, and streamable-HTTP — instead of SSE-only.
  • The store manages the connections itself (lifecycle: start at boot, reconcile list_tools() into store primitives, keep the session pooled, shut down cleanly). For stdio servers the store launches and supervises the child process, so we don't need a separate external server running that we then point at — we just call the tool and the pooled session handles it.
  • Tool calls on external-MCP primitives go through the pooled session (fast path, no per-call cold connect).

This is essentially porting the ExternalMCPManager approach from #4 forward (it's too old to merge as-is), but the key requirement is: manage MCPs with the MCP SDK from a JSON list at startup, own the connections, and support every MCP transport — not just SSE, and not only while an external server happens to be running.

Acceptance criteria

  • External MCP servers are configured via a JSON list (mcpServers shape supported).
  • Connections are established at service startup and owned/pooled by the store via the MCP SDK.
  • stdio, sse, and streamable-HTTP transports all work.
  • Imported tools are callable through the managed session without requiring a separately-launched external server (store supervises stdio children).
  • Clean startup/shutdown and reconnection handling.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions