Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-local-router

MCP.Pizza Chef: kaichen

The mcp-local-router is a Model Context Protocol (MCP) server that acts as a local aggregation proxy, connecting multiple upstream MCP servers and consolidating their functionalities into a single interface for downstream clients. It supports configuration via JSON files, multiple upstream servers, stdio transport, and environment variable injection, enabling streamlined management and interaction with diverse MCP servers in a unified manner.

Use This MCP server To

Aggregate multiple MCP servers into a single interface Route requests from clients to appropriate MCP servers Manage MCP server configurations via JSON files Enable stdio transport for MCP communication Inject environment variables into MCP server processes

README

MCP Local Router

This project is an MCP (Model Context Protocol) local router that serves as an aggregation proxy for MCP servers. It can connect to multiple upstream MCP servers and aggregate their functionalities into a single interface for downstream clients.

Features

  • Supports specifying a configuration file via command line arguments
  • Supports configuring multiple upstream MCP servers
  • Supports stdio transport
  • Supports injecting environment variables into stdio transport

Usage

Running

It must be run with a configuration file:

cargo run -- --config mcp-config.json --transport sse

Configuration File Format

The configuration file is in JSON format; an example is shown below:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Desktop"
      ],
      "env": {
        "LINEAR_ACCESS_TOKEN": "your_personal_access_token"
      }
    },
    "everything": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-everything"
      ],
      "env": {}
    }
  }
}

Description:

  • mcpServers: a mapping of multiple server configurations
    • Each key is the server's name (used for logging)
    • Each value is an object containing the following fields:
      • command: the command to execute
      • args: an array of command arguments
      • env: a mapping of environment variables to inject

Build and Installation

# Build the project
cargo build --release

# Run
cargo run --release -- --config mcp-config.json --transport stdio

Dependencies

  • Rust 2021 Edition
  • tokio async runtime
  • MCP-related libraries: rmcp

mcp-local-router FAQ

How do I configure the mcp-local-router?
You configure it using a JSON configuration file specifying upstream MCP servers, commands, arguments, and environment variables.
Can mcp-local-router handle multiple MCP servers simultaneously?
Yes, it supports connecting to and aggregating multiple upstream MCP servers.
What transport protocols does mcp-local-router support?
It supports stdio transport and server-sent events (SSE) for communication.
How do I run the mcp-local-router?
Run it via command line with cargo, specifying the config file and transport, e.g., 'cargo run -- --config mcp-config.json --transport sse'.
Can environment variables be injected into MCP servers via mcp-local-router?
Yes, environment variables can be injected into the stdio transport to customize server behavior.
Is mcp-local-router limited to any specific MCP servers?
No, it is designed to proxy and aggregate any MCP servers configured upstream.
What are the benefits of using mcp-local-router?
It simplifies managing multiple MCP servers by providing a unified interface and routing layer, improving scalability and modularity.