MCP ExplorerExplorer

Mcp Server Proxy

@amirilovicon 10 months ago
1 MIT
FreeCommunity
AI Systems
A proxy server for connecting multiple MCP servers with unified access.

Overview

What is Mcp Server Proxy

mcp-server-proxy is a proxy server that connects to multiple MCP servers, providing a unified interface for accessing various tools across these servers.

Use cases

Use cases for mcp-server-proxy include managing multiple server connections in a development environment, facilitating tool access in CI/CD pipelines, and providing a centralized interface for tool management across different MCP servers.

How to use

To use mcp-server-proxy, install it via npm with ‘npm install’. You can start the server with command-line options to specify profiles and modes, such as ‘node dist/server.js --profile developer’ for a specific configuration.

Key features

Key features include the ability to connect to multiple MCP servers simultaneously, support for multiple configuration profiles, tool name prefixing with server names, operation in either stdio or SSE mode, and profile-based configuration management.

Where to use

mcp-server-proxy can be used in environments where multiple MCP servers need to be accessed efficiently, such as in development, testing, or production setups that require integration of various tools.

Content

MCP Server Proxy

A proxy server that connects to multiple MCP servers and provides a unified interface for tool access.

Features

  • Connect to multiple MCP servers simultaneously
  • Support for multiple configuration profiles
  • Tool name prefixing with server names
  • Run in either stdio or SSE mode
  • Profile-based configuration management

Configuration

Create configuration files for each profile in the format config.<profile>.json. For example:

Installation

npm install

Usage

Command Line Options

The server can be started with various command-line options:

# Start with default settings
node dist/server.js

# Start with a specific profile
node dist/server.js --profile developer
# or
node dist/server.js -p developer

# Start in SSE mode
node dist/server.js --mode sse
# or
node dist/server.js -m sse

# Start in SSE mode with custom port and host
node dist/server.js --mode sse --port 8080 --host 0.0.0.0

# Combine options
node dist/server.js --profile developer --mode sse --port 8080

Available options:

  • -p, --profile <name>: Specify which profile to use (defaults to “default”)
  • -m, --mode <mode>: Choose between “stdio” or “sse” mode (defaults to “stdio”)
  • --port <number>: Set the port for SSE mode (defaults to 3000)
  • --host <host>: Set the host for SSE mode (defaults to “localhost”)

Get help:

node dist/server.js --help

Tool Naming Convention

Tools are prefixed with their server name. For example:

  • A tool named read_file from the filesystem server becomes filesystem_read_file
  • A tool named get_pods from the kubernetes server becomes kubernetes_get_pods

SSE Mode Endpoints

When running in SSE mode, the server exposes the following endpoints:

  • GET /sse: Establishes an SSE connection
  • POST /messages: Handles tool requests (requires sessionId query parameter)

Example SSE client usage:

const eventSource = new EventSource("http://localhost:3000/sse");
eventSource.onmessage = (event) => {
  console.log("Received:", event.data);
};

Error Handling

The server provides detailed error messages including:

  • Profile loading errors
  • Server connection failures
  • Tool not found errors
  • Server disconnection errors

All errors include the current profile name for better context.

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev:stdio:developer
# or
npm run dev:sse:developer
# Run with mpc inspector
npm run inspect

License

MIT

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers