MCP Proxy Server

hybrid server

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

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 서버 전송 방식을 전환할 수 있는 도구입니다. 지원되는 모드는 두 가지입니다.

  1. stdio를 SSE로
  2. SSE에서 stdio로

1. stdio를 SSE로

stdio에서 원격 SSE 서버에 연결하는 프록시 서버를 실행합니다.

이 모드를 사용하면 Claude Desktop과 같은 클라이언트가 기본적으로 지원되지 않더라도 SSE를 통해 원격 서버와 통신할 수 있습니다.

지엑스피1

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 서버를 노출하는 프록시 서버를 실행합니다.

이렇게 하면 로컬 stdio 서버에 원격으로 연결할 수 있습니다. mcp-proxy SSE 요청을 수신하기 위해 포트를 열고, MCP 요청을 처리하는 로컬 stdio 서버를 생성합니다.

2.1 구성

이 모드에서는 --sse-port 인수를 설정해야 합니다. --sse-host 인수를 설정하여 SSE 서버가 수신 대기할 호스트 IP 주소를 지정할 수 있습니다. --env 인수를 사용하여 추가 환경 변수를 로컬 stdio 서버로 전달할 수 있습니다. 로컬 stdio 서버의 명령줄 인수는 -- 구분 기호 뒤에 전달해야 합니다.

인수

이름필수의설명
command_or_urlMCP stdio 서버를 생성하는 명령uvx mcp-server-fetch
--sse-port아니요, 무작위로 사용 가능수신할 SSE 서버 포트8080
--sse-host아니요, 기본값은 127.0.0.1 입니다.SSE 서버가 수신할 호스트 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 에 연결할 수 있는 MCP 서버가 시작됩니다.

설치

Smithery를 통해 설치

Smithery 를 통해 Claude Desktop용 MCP 프록시를 자동으로 설치하려면:

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 기본적으로 포함되어 있지 않지만, 이를 사용하여 사용자 지정 이미지를 만들 수 있습니다.

# 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 서버를 실행하여 확인하세요. 검사기 도구를 사용하여 대상 서버를 테스트할 수 있습니다.

# 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

STDIO 대신 SSE 전송을 사용하여 원격 MCP 서버와의 상호작용을 활성화하여 통신 기능을 향상시킵니다.

  1. About
    1. 1. stdio to SSE
      1. 1.1 Configuration
      2. 1.2 Example usage
    2. 2. SSE to stdio
      1. 2.1 Configuration
      2. 2.2 Example usage
    3. Installation
      1. Installing via Smithery
      2. Installing via PyPI
      3. Installing via Github repository (latest)
      4. Installing as container
      5. Troubleshooting
    4. Extending the container image
      1. Docker Compose Setup
        1. Command line arguments
          1. Testing
            ID: zcgl7bfx4e