Documentation
¶
Overview ¶
Package mcpmux implements a meta-MCP proxy that manages multiple child MCP servers behind a single unified MCP interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrefixTool ¶
PrefixTool returns the namespaced tool name "{server}__{tool}".
func SplitTool ¶
SplitTool splits a namespaced tool name on the first "__" separator. Returns the server name, the original tool name, and true if the name contained the separator. Returns ("", name, false) otherwise.
func ValidateServerName ¶
ValidateServerName checks that a server name is valid for use as a namespace prefix. It must be non-empty and must not contain the namespace separator.
Types ¶
type Child ¶
type Child struct {
Config ChildConfig
StartTime time.Time
// contains filtered or unexported fields
}
Child manages a single child MCP server process.
func NewChild ¶
func NewChild(cfg ChildConfig, logger *slog.Logger, onCrash func()) *Child
NewChild creates a new Child from the given config.
func (*Child) Session ¶
func (c *Child) Session() *mcp.ClientSession
Session returns the MCP client session for making tool calls.
func (*Child) Start ¶
Start spawns the child process, performs the MCP handshake, and discovers tools. It starts a background goroutine to monitor the child for crashes. Each Child instance may only be started once (StatusNew → StatusStarting).
type ChildConfig ¶
type ChildConfig struct {
Name string `json:"name"`
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
Cwd string `json:"cwd,omitempty"`
}
ChildConfig holds the spawn configuration for a child MCP server.
type ChildStatus ¶
type ChildStatus int
ChildStatus represents the lifecycle state of a child server.
const ( StatusNew ChildStatus = iota // created, not yet started StatusStarting // Start in progress StatusRunning // healthy and connected StatusStopped // intentionally shut down StatusCrashed // exited unexpectedly )
func (ChildStatus) String ¶
func (s ChildStatus) String() string
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is the core MCP proxy that manages child servers and exposes their tools through a single unified MCP server.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
mcpmux
command
mcpmux is a meta-MCP proxy that manages multiple child MCP servers.
|
mcpmux is a meta-MCP proxy that manages multiple child MCP servers. |
|
test
|
|
|
crashserver
command
crashserver is an MCP server that exposes a "crash" tool which calls os.Exit(1).
|
crashserver is an MCP server that exposes a "crash" tool which calls os.Exit(1). |
|
echoserver
command
echoserver is a minimal MCP server for testing.
|
echoserver is a minimal MCP server for testing. |
|
echoserver_v2
command
echoserver_v2 extends echoserver with an additional "reverse" tool.
|
echoserver_v2 extends echoserver with an additional "reverse" tool. |