MCP Proxy Server

by ptbsare

231 downloads
Not rated
GitHub

Description

# MCP Proxy Server [简体中文](README_ZH.md) ## ✨ Key Features Highlight * **🌐 Web UI Management:** Easily manage all connected MCP servers through an intuitive web interface (optional, requires enabling). * **🔧 Granular Tool Control:** Enable or disable individual tools, and…

About

# MCP Proxy Server [简体中文](README_ZH.md) ## ✨ Key Features Highlight * **🌐 Web UI Management:** Easily manage all connected MCP servers through an intuitive web interface (optional, requires enabling). * **🔧 Granular Tool Control:** Enable or disable individual tools, and override display names/descriptions via the Web…

Details

Author
ptbsare
Downloads
231
Categories
Developer Tools, API, Automation, Other

- 🌐 Web UI for managing all connected MCP servers
- 🔧 Granular tool enable/disable and display name/description overrides
- 🔒 Dual SSE authentication (Bearer token or X-API-Key)
- 🔄 Robust session handling with client reconnection support
- ✨ Real-time Stdio install output streamed to the Admin UI
- 🖥️ Integrated web terminal for direct server interaction (opt‑in)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Proxy Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Configure backend servers in config/mcp_server.json and optionally override tool properties in config/tool_config.json. Set environment variables (PORT, MCP_PROXY_SSE_ALLOWED_KEYS, ENABLE_ADMIN_UI, etc.). Run the server in development mode with npm run dev (Stdio) or npm run dev:sse (SSE). For production, use the Docker image from GHCR. Access the Admin UI at the server’s URL (if enabled) to manage servers and tools live.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp proxy server": {
            "mcp-proxy-server-ptbsare": {
                "command": "docker",
                "args": [
                    "pull",
                    "ghcr.io/ptbsare/mcp-proxy-server/mcp-proxy-server:latest"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-proxy-server-ptbsare": {
        "command": "docker",
        "args": [
            "pull",
            "ghcr.io/ptbsare/mcp-proxy-server/mcp-proxy-server:latest"
        ]
    }
}

MCP Proxy Server

简体中文

✨ Key Features Highlight

🌐 Web UI Management: Easily manage all connected MCP servers through an intuitive web interface (optional, requires enabling).
🔧 Granular Tool Control: Enable or disable individual tools, and override display names/descriptions via the Web UI.
🔒 Dual SSE Authentication: Secure your SSE endpoint with flexible authentication options (Authorization: Bearer <token> or X-API-Key: <key>).
🔄 Improved SSE Session Handling: More robust handling of client reconnections, relying on server-sent endpoint events for session synchronization.
✨ Real-time Install Output: Monitor Stdio server installation progress (stdout/stderr) directly in the Web UI.
✨ Web Terminal: Access a command-line terminal within the Admin UI for direct server interaction (optional, use with caution due to security risks).

---

This server acts as a central hub for Model Context Protocol (MCP) resource servers. It can:

- Connect to and manage multiple backend MCP servers (both Stdio and SSE types).
- Expose their combined capabilities (tools, resources) through a single, unified SSE interface or act as a single Stdio-based MCP server itself.
- Handle routing of requests to the appropriate backend servers.
- Aggregate responses if needed (though primarily acts as a proxy).
- Support multiple simultaneous SSE client connections with optional API key authentication.

Features

Resource & Tool Management via Proxy

- Discovers and connects to multiple MCP resource servers defined in config/mcp_server.json. - Aggregates tools and resources from all connected active servers. - Routes tool calls and resource access requests to the correct backend server. - Maintains consistent URI schemes.

✨ Optional Web Admin UI (ENABLE_ADMIN_UI=true)

Provides a browser-based interface for managing the proxy server configuration and connected tools. Features include: - Server Configuration: View, add, edit, and delete server entries (mcp_server.json). Supports both Stdio and SSE server types with relevant options (command, args, env, url, apiKey, bearerToken, install config). - Tool Configuration: View all tools discovered from active backend servers. Enable or disable specific tools. Override the display name and description for each tool (tool_config.json). - Live Reload: Apply server and tool configuration changes by triggering a configuration reload without needing to restart the entire proxy server process. - Stdio Server Installation: For Stdio servers, you can define installation commands in the configuration. The Admin UI allows you to: - Trigger the execution of these installation commands. - Monitor installation progress in real-time with live stdout and stderr output streamed directly to the UI. - Web Terminal: Access an integrated web-based terminal that provides shell access to the environment where the proxy server is running. - Security Warning: This feature grants significant access and should be used with extreme caution, especially if the admin interface is exposed.

Configuration

Configuration is primarily done via environment variables and JSON files located in the ./config directory.

1. Server Connections (config/mcp_server.json)

This file defines the backend MCP servers the proxy should connect to.

Example config/mcp_server.json:

{
"mcpServers": {
"unique-server-key1": {
"name": "My Stdio Server",
"active": true,
"command": "/path/to/server/executable",
"args": ["--port", "1234"],
"env": {
"API_KEY": "server_specific_key"
},
"installDirectory": "/custom_install_path/unique-server-key1",
"installCommands": [
"git clone https://github.com/some/repo unique-server-key1",
"cd unique-server-key1 && npm install && npm run build"
]
},
"another-sse-server": {
"name": "My SSE Server",
"active": true,
"url": "http://localhost:8080/sse",
"apiKey": "sse_server_api_key"
},
"stdio-default-install": {
"name": "Stdio Server with Default Install Path",
"active": true,
"command": "my_other_server",
"installCommands": ["echo 'Installing to default location...'"]
}
}
}

Fields:
- mcpServers: (Required) An object where each key is a unique identifier for a backend server.
- name: (Optional) A user-friendly display name for the server (used in Admin UI).
- active: (Optional, default: true) Set to false to prevent the proxy from connecting to this server.
- command: (Required for Stdio type) The command to execute the server process.
- args: (Optional for Stdio type) An array of string arguments to pass to the command.
- env: (Optional for Stdio type) An object of environment variables (KEY: "value") to set for the server process. These are merged with the proxy server's environment.
- url: (Required for SSE type) The full URL of the backend server's SSE endpoint.
- apiKey: (Optional for SSE type) An API key to send in the X-Api-Key header when the proxy connects to this specific backend SSE server.
- bearerToken: (Optional for SSE type) A token to send in the Authorization: Bearer <token> header when connecting to this specific backend SSE server. (If both apiKey and bearerToken are provided, bearerToken takes precedence).
- installDirectory: (Optional for Stdio type) The absolute path where the server itself should be installed (e.g., /opt/my-server-files). Used by the Admin UI's installation feature.
- If provided in mcp_server.json, this exact path is used.
- If omitted, the effective directory depends on the TOOLS_FOLDER environment variable (see Environment Variables section).
- If TOOLS_FOLDER is set and not empty, the server will be installed in a subdirectory named after the server key within this folder (e.g., ${TOOLS_FOLDER}/<server_key>).
- If TOOLS_FOLDER is also empty or not set, it defaults to a tools subdirectory within the proxy server's working directory (e.g., ./tools/<server_key>).
- Ensure the parent directory of the target installation path (e.g., TOOLS_FOLDER or ./tools) is writable by the user running the proxy server.
- installCommands: (Optional for Stdio type) An array of shell commands executed sequentially by the Admin UI's installation feature if the target server directory (derived from installDirectory or defaults) does not exist. Commands are executed from the parent directory of the target server installation directory (e.g., if installDirectory resolves to /opt/tools/my-server, commands run in /opt/tools/). Use with extreme caution due to security risks.

2. Tool Configuration (config/tool_config.json)

This file allows overriding properties of tools discovered from backend servers. It is primarily managed via the Admin UI but can be edited manually.

Example config/tool_config.json:

{
"tools": {
"unique-server-key1--tool-name-from-server": {
"enabled": true,
"displayName": "My Custom Tool Name",
"description": "A more user-friendly description."
},
"another-sse-server--another-tool": {
"enabled": false
}
}
}

- Keys are in the format <server_key>--<original_tool_name>.
- enabled: (Optional, default: true) Set to false to hide this tool from clients connecting to the proxy.
- displayName: (Optional) Override the tool's name in client UIs.
- description: (Optional) Override the tool's description.

3. Environment Variables

- PORT: Port for the proxy server's main SSE endpoint (and Admin UI if enabled). Default: 3663. Note: This is only used when running in SSE mode (e.g., via npm run dev:sse or the Docker container). The npm run dev script runs in Stdio mode.

    export PORT=8080

- MCP_PROXY_SSE_ALLOWED_KEYS: (Optional) Comma-separated list of API keys to secure the proxy's main /sse endpoint (only applicable in SSE mode). If not set, authentication is disabled. Clients must provide a key via X-Api-Key header or ?key= query parameter.
    export MCP_PROXY_SSE_ALLOWED_KEYS="client_key1,client_key2"

- ENABLE_ADMIN_UI: (Optional) Set to true to enable the Web Admin UI (only applicable in SSE mode). Default: false.
    export ENABLE_ADMIN_UI=true

- ADMIN_USERNAME: (Required if Admin UI enabled) Username for Admin UI login. Default: admin.
- ADMIN_PASSWORD: (Required if Admin UI enabled) Password for Admin UI login. Default: password (Change this!).
    export ADMIN_USERNAME=myadmin
export ADMIN_PASSWORD=aVerySecurePassword123!

- SESSION_SECRET: (Optional, recommended if Admin UI enabled) Secret used to sign session cookies. If not set, a default, less secure secret is used, and a warning is issued. A secure secret is automatically generated and saved to config/.session_secret on first run if not provided via environment variable.
    # Recommended: Generate a strong secret (e.g., openssl rand -hex 32)
export SESSION_SECRET='your_very_strong_random_secret_here'

- TOOLS_FOLDER: (Optional) Specifies the base directory for Stdio server installations initiated via the Admin UI, used when installDirectory is not explicitly set in mcp_server.json for a specific server.
- If set (e.g., /custom/tools_path), installations for servers without a specific installDirectory will target a subdirectory named after the server key within this folder (e.g., ${TOOLS_FOLDER}/<server_key>).
- If TOOLS_FOLDER is not set or is empty, such installations will default to a tools subdirectory within the proxy server's working directory (e.g., ./tools/<server_key>).
- The Dockerfile sets this to /tools by default.
    export TOOLS_FOLDER=/srv/mcp_tools

Development

Install dependencies:
```bash
npm install

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.