Labsco
naotaka3 logo

MCP Proxy Hub

โ˜… 5

from naotaka3

Aggregates multiple MCP resource servers into a single interface using a JSON configuration file.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

MCP Proxy Hub

An MCP proxy server that aggregates and serves multiple MCP resource servers through a single interface. This server acts as a central hub that can:

  • Connect to and manage multiple MCP resource servers
  • Expose their combined capabilities through a unified interface
  • Handle routing of requests to appropriate backend servers
  • Aggregate responses from multiple sources

Features

Resource Management

  • Discover and connect to multiple MCP resource servers
  • Aggregate resources from all connected servers
  • Maintain consistent URI schemes across servers
  • Handle resource routing and resolution

Tool Aggregation

  • Expose tools from all connected servers with server name prefixes
  • Apply tool filtering based on configuration (exposedTools/hiddenTools)
  • Support tool name remapping via configuration
  • Route tool calls to appropriate backend servers

Custom Tool Support

  • Define compound tools that combine functionality from multiple servers

  • Execute subtools using server and tool name specifications

  • Provide detailed documentation through tool descriptions

  • Specify execution with a standardized format:

    {
      "server": "server_name",
      "tool": "tool_name",
      "args": {
        // Tool-specific arguments
      }
    }

Environment Variable Support

  • Automatically expand environment variables in tool arguments
  • Automatically replace sensitive values with variable references in responses
  • Configure which variables should be expanded/unexpanded via configuration
  • Support for both global (all servers) and server-specific environment variables
  • Server-specific variables take precedence over global variables with the same name
  • Each variable can be independently configured for expansion and unexpansion
  • Environment variables are only expanded when using the ${VARIABLE_NAME} syntax (e.g., ${API_KEY}). The $VARIABLE_NAME syntax is not supported.
  • Secure handling of sensitive information like API keys

Prompt Handling

  • Aggregate prompts from all connected servers
  • Route prompt requests to appropriate backends
  • Handle multi-server prompt responses

Environment Variables

  • MCP_PROXY_CONFIG_PATH: Path to the configuration file
  • MCP_PROXY_LOG_DIRECTORY_PATH: Path to the log directory
  • MCP_PROXY_LOG_LEVEL: Log level ("debug" or "info")
  • MCP_PROXY_AUTH_TOKEN: Bearer token for authenticating incoming requests to the proxy server
  • MCP_PROXY_PATH: URL path for Streamable HTTP endpoint (default: "/mcp")
  • KEEP_SERVER_OPEN: Whether to keep the server open after client disconnection in SSE mode (set to "1" to enable)
  • PORT: Port for the SSE/Streamable HTTP server (default: 3006)
  • HOST: Host to bind for the HTTP server (default: "0.0.0.0")

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

For development with continuous run:

# Stdio
npm run dev
# SSE
npm run dev:sse
# Streamable HTTP
npm run dev:http

CLI

The CLI provides two modes of operation for interacting with the MCP Proxy Hub.

Direct Execution Mode

You can execute commands directly from your terminal. This is useful for scripting and automation.

  • List available tools:

    mcp-proxy-hub-cli list
  • Call a tool:

    mcp-proxy-hub-cli call <toolName> [args...]
    • toolName: The name of the tool to call.
    • args: Arguments for the tool in key=value format.
    • --output-dir <dir> or -o <dir>: Save the output to a directory.

    Example:

    mcp-proxy-hub-cli call my_tool param1=value1 -o output

Interactive Mode

If you run the CLI without any arguments, it will start in interactive mode. This provides a shell-like interface for running commands.

mcp-proxy-hub-cli

Once in interactive mode, you can use the following commands:

  • list: List available tools.
  • call <toolName> [args...]: Call a tool with arguments.
  • exit: Exit the interactive session.