mcp-proxy

An MCP proxy server that aggregates and serves multiple MCP resource servers through a single HTTP server.

GitHub Stars

514

User Rating

Not Rated

Favorites

0

Views

20

Forks

61

Issues

9

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Go: 1.16以上

Installation

Installation

Prerequisites

Please specify required software and versions:
Go: 1.16 or higher

Installation Steps

1. Clone Repository

bash
git clone https://github.com/TBXark/mcp-proxy.git
cd mcp-proxy

2. Build

bash
make build
./build/mcp-proxy --config path/to/config.json

3. Install by Go

bash

Install the latest version of mcp-proxy

go install github.com/TBXark/mcp-proxy@latest

Or install stable version

go install github.com/TBXark/mcp-proxy

4. Install via Docker

bash
docker run -d -p 9090:9090 -v /path/to/config.json:/config/config.json ghcr.io/tbxark/mcp-proxy:latest

or

docker run -d -p 9090:9090 ghcr.io/tbxark/mcp-proxy:latest --config https://example.com/path/to/config.json

Configuration

Configuration

Basic Configuration

The server is configured using a JSON file. Below is an example configuration:
jsonc
{
  "mcpProxy": {
    "baseURL": "https://mcp.example.com",
    "addr": ":9090",
    "name": "MCP Proxy",
    "version": "1.0.0",
    "type": "streamable-http",
    "options": {
      "panicIfInvalid": false,
      "logEnabled": true,
      "authTokens": [
        "DefaultTokens"
      ]
    }
  },
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": ""
      },
      "options": {
        "toolFilter": {
          "mode": "block",
          "list": [
            "create_or_update_file"
          ]
        }
      }
    },
    "fetch": {
      "command": "uvx",
      "args": [
        "mcp-server-fetch"
      ],
      "options": {
        "panicIfInvalid": true,
        "logEnabled": false,
        "authTokens": [
          "SpecificTokens"
        ]
      }
    },
    "amap": {
      "url": "https://mcp.amap.com/sse?key="
    }
  }
}

Examples

Examples

Basic Usage

Here are basic usage examples for the MCP server:

Programmatic Usage

javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');

const client = new MCPClient();
await client.connect();

// Execute tool
const result = await client.callTool('toolName', {
  parameter1: 'value1',
  parameter2: 'value2'
});

console.log(result);

Automation Script

bash
#!/bin/bash

Batch processing example

for file in *.txt; do mcp-tool process "$file" done

API Integration

python

Python example

import requests import json def call_mcp_tool(tool_name, params): response = requests.post( 'http://localhost:3000/mcp/call', json={ 'tool': tool_name, 'parameters': params } ) return response.json()

Usage example

result = call_mcp_tool('analyze', { 'input': 'sample data', 'options': {'format': 'json'} })

Use Cases

Using as a proxy server to manage multiple MCP resource servers centrally
Utilizing in applications that require real-time data
Integrating with MCP clients having different client types
Testing and debugging MCP servers in a development environment