Airsc miễn phí cho tất cả. Nếu nó giúp bạn, hãy ủng hộ $2–$20.

Ủng hộ
MCP serverAn toànQuy trình & bộ nhớ agentNâng cao

mcp-proxy

sparfenyuk · sparfenyuk/mcp-proxy

Một công cụ proxy chuyển đổi giữa các phương thức vận chuyển giao tiếp của MCP server (Model Context Protocol) khác nhau, như stdio và SSE/StreamableHTTP.

Một cầu nối giữa các giao thức truyền tải Streamable HTTP và stdio MCP.

2.8k sao270Giấy phép: MITCập nhật 4 ngày trước0 lượt mở

Xem trước

▍

Bạn có thể làm gì với nó

  • Kết nối một client Claude Desktop (stdio) với một MCP server bên ngoài chỉ hỗ trợ SSE.
  • Cho phép một MCP server sử dụng StreamableHTTP giao tiếp với các client mong đợi stdio.
  • Phát triển và kiểm thử các MCP server bằng cách điều chỉnh giao thức giao tiếp của chúng.

Kiểm tra an toàn

An toàn

Không thấy dấu hiệu rủi ro trong các file đã quét.

Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.

Trích từ README

mcp-proxy

About

The mcp-proxy is a tool that lets you switch between server transports. There are two supported modes:

  1. stdio to SSE/StreamableHTTP
  2. SSE to stdio

1. stdio to SSE/StreamableHTTP

Run a proxy server from stdio that connects to a remote SSE server.

This mode allows clients like Claude Desktop to communicate to a remote server over SSE even though it is not supported natively.

graph LR
    A["Claude Desktop"] <--> |stdio| B["mcp-proxy"]
    B <--> |SSE| C["External MCP Server"]

    style A fill:#ffe6f9,stroke:#333,color:black,stroke-width:2px
    style B fill:#e6e6ff,stroke:#333,color:black,stroke-width:2px
    style C fill:#e6ffe6,stroke:#333,color:black,stroke-width:2px

1.1 Configuration

This mode requires providing the URL of the MCP Server's SSE endpoint as the program’s first argument. If the server uses Streamable HTTP transport, make sure to enforce it on the mcp-proxy side by passing --transport=streamablehttp.

Arguments

NameRequiredDescriptionExample
command_or_urlYesThe MCP server SSE endpoint to connect tohttp://example.io/sse
--headersNoHeaders to use for the MCP server SSE connectionAuthorization 'Bearer my-secret-access-token'
--transportNoDecides which transport protocol to use when connecting to an MCP server. Can be either 'sse' or 'streamablehttp'streamablehttp
--client-idNoOAuth2 client ID for authenticationyour_client_id
--client-secretNoOAuth2 client secret for authenticationyour_client_secret
--token-urlNoOAuth2 token endpoint URL for authenticationhttps://auth.example.com/oauth/token
--usernameNoUsername for authenticationuser
--passwordNoPassword for authenticationpassword
--digestNoUse digest authentication

Environment Variables

NameRequiredDescriptionExample
API_ACCESS_TOKENNoCan be used instead of --headers Authorization 'Bearer 'YOUR_TOKEN

1.2 Example usage

mcp-proxy is supposed to be started by the MCP Client, so the configuration must be done accordingly.

For Claude Desktop, the configuration entry can look like this:

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

2. SSE to stdio

Run a proxy server exposing a SSE server that connects to a local stdio server.

This allows remote connections to the local stdio server. The mcp-proxy opens a port to listen for SSE requests, spawns a local stdio server that handles MCP requests.

graph LR
    A["LLM Client"] <-->|SSE| B["mcp-proxy"]
    B <-->|stdio| C["Local MCP Server"]

    style A fill:#ffe6f9,stroke:#333,color:black,stroke-width:2px
    style B fill:#e6e6ff,stroke:#333,color:black,stroke-width:2px
    style C fill:#e6ffe6,stroke:#333,color:black,stroke-width:2px

2.1 Configuration

This mode requires the --sse-port argument to be set. The --sse-host argument can be set to specify the host IP address that the SSE server will listen on. Additional environment variables can be passed to the local stdio server using the --env argument. The command line arguments for the local stdio server must be passed after the -- separator.

Arguments

| Name | Required | Description | Example

Xem mã nguồn trên GitHub