MCP Proxy Server

MIT License
500
  • Apple

Integrations

  • Provides code coverage reporting for the mcp-proxy project as indicated by the codecov badge at the top of the README.

  • Supports running and extending the proxy as a Docker container, with instructions for creating custom Docker images and Docker Compose setup.

  • Allows installation of the proxy via GitHub repository and displays GitHub license information through a badge.

mcp-プロキシ

について

mcp-proxyサーバートランスポートを切り替えるためのツールです。サポートされているモードは2つあります。

  1. stdio から SSE へ
  2. SSEからstdioへ

1. stdio から SSE へ

リモート SSE サーバーに接続するプロキシ サーバーを stdio から実行します。

このモードでは、Claude Desktop などのクライアントは、ネイティブではサポートされていない場合でも、SSE 経由でリモート サーバーと通信できます。

1.1 構成

このモードでは、プログラムの最初の引数として MCP サーバー SSE エンドポイントへの URL を渡す必要があります。

議論

名前必須説明
command_or_urlはい接続するMCPサーバーのSSEエンドポイントhttp://example.io/sse
--headersいいえMCP サーバーの SSE 接続に使用するヘッダー承認「Bearer my-secret-access-token」

環境変数

名前必須説明
API_ACCESS_TOKENいいえ--headers Authorization 'Bearer <API_ACCESS_TOKEN>'の代わりに使用できます。あなたのトークン

1.2 使用例

mcp-proxy MCP クライアントによって起動されるはずなので、それに応じて構成を行う必要があります。

Claude Desktop の場合、構成エントリは次のようになります。

{ "mcpServers": { "mcp-proxy": { "command": "mcp-proxy", "args": ["http://example.io/sse"], "env": { "API_ACCESS_TOKEN": "access-token" } } } }

2. SSEからstdioへ

ローカル stdio サーバーに接続する SSE サーバーを公開するプロキシ サーバーを実行します。

これにより、ローカル標準入出力サーバーへのリモート接続が可能になります。mcp mcp-proxy SSE リクエストをリッスンするためのポートを開き、MCP リクエストを処理するローカル標準入出力サーバーを起動します。

2.1 構成

このモードでは、 --sse-port引数を設定する必要があります。-- --sse-host引数は、SSE サーバーが listen するホストの IP アドレスを指定するために使用できます。-- --env引数を使用して、追加の環境変数をローカル stdio サーバーに渡すことができます。ローカル stdio サーバーのコマンドライン引数は、 --区切り記号の後に渡す必要があります。

議論

名前必須説明
command_or_urlはいMCP stdioサーバーを起動するコマンドuvx mcp-server-fetch
--sse-portいいえ、ランダムに利用可能ですリッスンするSSEサーバーポート8080
--sse-hostいいえ、デフォルトでは127.0.0.1SSEサーバーがリッスンするホストIPアドレス0.0.0.0
--envいいえMCP stdio サーバーに渡す追加の環境変数フード=バー
--pass-environmentいいえサーバーの起動時にすべての環境変数を渡す--no-pass-environment
--allow-originいいえサーバーの起動時にすべての環境変数を渡す--allow-cors "*"

2.2 使用例

ポート 8080 をリッスンし、ローカル MCP サーバーに接続するmcp-proxyサーバーを起動するには:

# Start the MCP server behind the proxy mcp-proxy uvx mcp-server-fetch # Start the MCP server behind the proxy with a custom port mcp-proxy --sse-port=8080 uvx mcp-server-fetch # Start the MCP server behind the proxy with a custom host and port mcp-proxy --sse-host=0.0.0.0 --sse-port=8080 uvx mcp-server-fetch # Start the MCP server behind the proxy with a custom user agent # Note that the `--` separator is used to separate the `mcp-proxy` arguments from the `mcp-server-fetch` arguments mcp-proxy --sse-port=8080 -- uvx mcp-server-fetch --user-agent=YourUserAgent

これにより、 http://127.0.0.1:8080/sse 8080/sse で接続できる MCP サーバーが起動します。

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の MCP Proxy を自動的にインストールするには:

npx -y @smithery/cli install mcp-proxy --client claude

PyPI経由でインストール

パッケージの安定版はPyPIリポジトリから入手できます。以下のコマンドでインストールできます。

# Option 1: With uv (recommended) uv tool install mcp-proxy # Option 2: With pipx (alternative) pipx install mcp-proxy

インストールが完了したら、 mcp-proxyコマンドを使用してサーバーを実行できます。各モードの設定オプションについては、上記の各モードの設定オプションをご覧ください。

Githubリポジトリ経由でインストール(最新)

最新バージョンのパッケージは、次のコマンドを使用して git リポジトリからインストールできます。

uv tool install git+https://github.com/sparfenyuk/mcp-proxy

[!NOTE] サーバーをすでにインストールしている場合は、 uv tool upgrade --reinstallコマンドを使用して更新できます。

[!NOTE] サーバーを削除する場合は、 uv tool uninstall mcp-proxyコマンドを使用します。

コンテナとしてインストール

バージョン 0.3.2 以降では、対応するコンテナ イメージをプルして実行できます。

docker run -t ghcr.io/sparfenyuk/mcp-proxy:v0.3.2-alpine --help

トラブルシューティング

  • 問題: Claude Desktop がサーバーを起動できません: ログに ENOENT コードが記録されています解決策:バイナリへのフルパスを使用してください。ターミナルを開き、コマンドwhere mcp-proxy (macOS、Linux) またはwhere.exe mcp-proxy (Windows) を実行します。出力パスを 'command' 属性の値として使用します。
    "fetch": { "command": "/full/path/to/bin/mcp-proxy", "args": [ "http://localhost:8932/sse" ] }

コンテナイメージの拡張

mcp-proxyコンテナイメージを拡張して、追加の実行ファイルを含めることができます。例えば、 uvはデフォルトでは含まれていませんが、uv を含むカスタムイメージを作成できます。

# file: mcp-proxy.Dockerfile FROM ghcr.io/sparfenyuk/mcp-proxy:latest # Install the 'uv' package RUN python3 -m ensurepip && pip install --no-cache-dir uv ENV PATH="/usr/local/bin:$PATH" \ UV_PYTHON_PREFERENCE=only-system ENTRYPOINT [ "mcp-proxy" ]

Docker Compose のセットアップ

カスタム Dockerfile を使用すると、Docker Compose ファイルでサービスを定義できます。

services: mcp-proxy-custom: build: context: . dockerfile: mcp-proxy.Dockerfile network_mode: host restart: unless-stopped ports: - 8096:8096 command: "--pass-environment --sse-port=8096 --sse-host 0.0.0.0 uvx mcp-server-fetch"

[!NOTE] --pass-environment引数を設定することを忘れないでください。そうしないと、「管理対象インストールまたは検索パスにインタープリターが見つかりません」というエラーが発生します。

コマンドライン引数

usage: mcp-proxy [-h] [-H KEY VALUE] [-e KEY VALUE] [--pass-environment | --no-pass-environment] [--sse-port SSE_PORT] [--sse-host SSE_HOST] [--allow-origin ALLOW_ORIGIN [ALLOW_ORIGIN ...]] [command_or_url] [args ...] Start the MCP proxy in one of two possible modes: as an SSE or stdio client. positional arguments: command_or_url Command or URL to connect to. When a URL, will run an SSE client, otherwise will run the given command and connect as a stdio client. See corresponding options for more details. options: -h, --help show this help message and exit SSE client options: -H KEY VALUE, --headers KEY VALUE Headers to pass to the SSE server. Can be used multiple times. stdio client options: args Any extra arguments to the command to spawn the server -e KEY VALUE, --env KEY VALUE Environment variables used when spawning the server. Can be used multiple times. --pass-environment, --no-pass-environment Pass through all environment variables when spawning the server. --debug, --no-debug Enable debug mode with detailed logging output. SSE server options: --sse-port SSE_PORT Port to expose an SSE server on. Default is a random port --sse-host SSE_HOST Host to expose an SSE server on. Default is 127.0.0.1 --allow-origin ALLOW_ORIGIN [ALLOW_ORIGIN ...] Allowed origins for the SSE server. Can be used multiple times. Default is no CORS allowed. Examples: mcp-proxy http://localhost:8080/sse mcp-proxy --headers Authorization 'Bearer YOUR_TOKEN' http://localhost:8080/sse mcp-proxy --sse-port 8080 -- your-command --arg1 value1 --arg2 value2 mcp-proxy your-command --sse-port 8080 -e KEY VALUE -e ANOTHER_KEY ANOTHER_VALUE mcp-proxy your-command --sse-port 8080 --allow-origin='*'

テスト

mcp-server-fetchサーバーでmcp-proxyサーバーを実行して確認します。inspectorツールを使用してターゲットサーバーをテストできます。

# Run the stdio server called mcp-server-fetch behind the proxy over SSE mcp-proxy --sse-port=8080 uvx mcp-server-fetch & # Connect to the SSE proxy server spawned above using another instance of mcp-proxy given the URL of the SSE server mcp-proxy http://127.0.0.1:8080/sse # Send CTRL+C to stop the second server # Bring the first server to the foreground fg # Send CTRL+C to stop the first server

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

通信機能を強化するために、STDIO の代わりに SSE トランスポートを使用してリモート MCP サーバーとの対話を有効にします。

  1. について
    1. 1. stdio から SSE へ
      1. 1.1 構成
      2. 1.2 使用例
    2. 2. SSEからstdioへ
      1. 2.1 構成
      2. 2.2 使用例
    3. インストール
      1. Smithery経由でインストール
      2. PyPI経由でインストール
      3. Githubリポジトリ経由でインストール(最新)
      4. コンテナとしてインストール
      5. トラブルシューティング
    4. コンテナイメージの拡張
      1. Docker Compose のセットアップ
        1. コマンドライン引数
          1. テスト

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              An MCP server to run commands.
              Last updated -
              2
              556
              133
              TypeScript
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              A simple MCP server that facilitates website fetching through a configurable server platform using stdio or SSE transport, allowing integration with tools like Cursor for streamlined access.
              Last updated -
              2
              23
              Python
              MIT License
            • -
              security
              F
              license
              -
              quality
              MCP server enabling LLMs to perform browser tasks via SSE transport, allowing clients like Cursor.ai and Claude to open websites and interact with web content through natural language commands.
              Last updated -
              • Apple
            • -
              security
              A
              license
              -
              quality
              A GDB/MI protocol server based on the MCP protocol, providing remote application debugging capabilities.
              Last updated -
              19
              Rust
              MIT License
              • Linux
              • Apple

            View all related MCP servers

            ID: zcgl7bfx4e