MCP ExplorerExplorer

Mcp Local Router

@kaichenon 10 months ago
12 MIT
FreeCommunity
AI Systems
An MCP (Model Context Protocol) local router that serves as an aggregation proxy for MCP servers.

Overview

What is Mcp Local Router

mcp-local-router is an aggregation proxy for MCP servers that connects multiple upstream servers and consolidates their functionalities into a single interface for downstream clients.

Use cases

Use cases include aggregating functionalities from different MCP servers for a unified client interface, simplifying the management of multiple server configurations, and facilitating the development of applications that rely on various MCP services.

How to use

To use mcp-local-router, run it with a configuration file using the command: cargo run -- --config mcp-config.json. The configuration file should be in JSON format and specify the upstream MCP servers.

Key features

Key features include support for specifying a configuration file via command line, configuring multiple upstream MCP servers, stdio transport support, and the ability to inject environment variables into stdio transport.

Where to use

mcp-local-router can be used in environments where multiple MCP servers need to be aggregated for easier access and management, such as in microservices architectures or complex application ecosystems.

Content

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

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers