Skip to main content
Glama
sparfenyuk

MCP Proxy Server

mcp-proxy

GitHub-LizenzPyPI – Python-VersionPyPI - Downloads Codecov Schmiedeabzeichen

Um

Der mcp-proxy ist ein Tool, mit dem Sie zwischen Servertransporten wechseln können. Es werden zwei Modi unterstützt:

  1. stdio zu SSE/StreamableHTTP

  2. SSE zu stdio

Related MCP server: MCP SSE Proxy

1. stdio zu SSE/StreamableHTTP

Führen Sie von stdio aus einen Proxyserver aus, der eine Verbindung zu einem Remote-SSE-Server herstellt.

Dieser Modus ermöglicht Clients wie Claude Desktop die Kommunikation mit einem Remote-Server über SSE, obwohl dies nicht nativ unterstützt wird.

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 Konfiguration

In diesem Modus muss die URL des SSE-Endpunkts des MCP-Servers als erstes Argument des Programms angegeben werden. Wenn der Server streambaren HTTP-Transport verwendet, muss dieser auf der mcp-proxy Seite durch die Angabe von --transport=streamablehttp erzwungen werden.

Argumente

Name

Erforderlich

Beschreibung

Beispiel

command_or_url

Ja

Der SSE-Endpunkt des MCP-Servers, mit dem eine Verbindung hergestellt werden soll

http://example.io/sse

--headers

NEIN

Für die MCP-Server-SSE-Verbindung zu verwendende Header

Autorisierung „Inhaber my-secret-access-token“

--transport

NEIN

Legt fest, welches Transportprotokoll bei der Verbindung mit einem MCP-Server verwendet werden soll. Möglich sind entweder „sse“ oder „streamablehttp“.

streamablehttp

Umgebungsvariablen

Name

Erforderlich

Beschreibung

Beispiel

API_ACCESS_TOKEN

NEIN

Kann anstelle von --headers Authorization 'Bearer <API_ACCESS_TOKEN>'

IHR_TOKEN

1.2 Anwendungsbeispiel

mcp-proxy soll vom MCP-Client gestartet werden, daher muss die Konfiguration entsprechend erfolgen.

Für Claude Desktop kann der Konfigurationseintrag folgendermaßen aussehen:

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

2. SSE zu stdio

Führen Sie einen Proxyserver aus, der einen SSE-Server verfügbar macht, der eine Verbindung zu einem lokalen Stdio-Server herstellt.

Dies ermöglicht Remoteverbindungen zum lokalen stdio-Server. Der mcp-proxy öffnet einen Port, um auf SSE-Anfragen zu warten, und startet einen lokalen stdio-Server, der MCP-Anfragen verarbeitet.

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 Konfiguration

Für diesen Modus muss das Argument --sse-port gesetzt sein. Das Argument --sse-host kann gesetzt werden, um die Host-IP-Adresse anzugeben, auf der der SSE-Server lauscht. Zusätzliche Umgebungsvariablen können mit dem Argument --env an den lokalen stdio-Server übergeben werden. Die Kommandozeilenargumente für den lokalen stdio-Server müssen nach dem Trennzeichen -- übergeben werden.

Argumente

Name

Erforderlich

Beschreibung

Beispiel

command_or_url

Ja

Der Befehl zum Starten des MCP-Stdio-Servers

uvx mcp-server-fetch

--port

Nein, zufällig verfügbar

Der zu überwachende MCP-Server-Port

8080

--host

Nein, standardmäßig 127.0.0.1

Die Host-IP-Adresse, auf der der MCP-Server lauscht

0.0.0.0

--env

NEIN

Zusätzliche Umgebungsvariablen zur Übergabe an den MCP-Standardserver. Kann mehrfach verwendet werden.

FOO BAR

--cwd

NEIN

Das Arbeitsverzeichnis, das an den MCP-stdio-Serverprozess übergeben werden soll.

/tmp

--pass-environment

NEIN

Übergeben Sie alle Umgebungsvariablen beim Starten des Servers

--no-pass-environment

--allow-origin

NEIN

Erlaubte Ursprünge für den SSE-Server. Kann mehrfach verwendet werden. Standardmäßig ist kein CORS zulässig.

--allow-origin "*"

--stateless

NEIN

Aktivieren Sie den zustandslosen Modus für streambare HTTP-Transporte. Der Standardwert ist „False“.

--no-stateless

--named-server NAME COMMAND_STRING

NEIN

Definiert einen benannten stdio-Server.

--named-server fetch 'uvx mcp-server-fetch'

--named-server-config FILE_PATH

NEIN

Pfad zu einer JSON-Datei, die benannte stdio-Server definiert.

--named-server-config /Pfad/zu/Servern.json

--sse-port (veraltet)

Nein, zufällig verfügbar

Der SSE-Server-Port, auf dem gelauscht werden soll

8080

--sse-host (veraltet)

Nein, standardmäßig 127.0.0.1

Die Host-IP-Adresse, auf der der SSE-Server lauscht

0.0.0.0

2.2 Anwendungsbeispiele

So starten Sie den mcp-proxy Proxyserver, der auf Port 8080 lauscht und eine Verbindung zum lokalen MCP-Server herstellt:

# Start the MCP server behind the proxy
mcp-proxy uvx mcp-server-fetch

# Start the MCP server behind the proxy with a custom port
# (deprecated) mcp-proxy --sse-port=8080 uvx mcp-server-fetch
mcp-proxy --port=8080 uvx mcp-server-fetch

# Start the MCP server behind the proxy with a custom host and port
# (deprecated) mcp-proxy --sse-host=0.0.0.0 --sse-port=8080 uvx mcp-server-fetch
mcp-proxy --host=0.0.0.0 --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
# (deprecated) mcp-proxy --sse-port=8080 -- uvx mcp-server-fetch --user-agent=YourUserAgent
mcp-proxy --port=8080 -- uvx mcp-server-fetch --user-agent=YourUserAgent

# Start multiple named MCP servers behind the proxy
mcp-proxy --port=8080 --named-server fetch 'uvx mcp-server-fetch' --named-server fetch2 'uvx mcp-server-fetch'

# Start multiple named MCP servers using a configuration file
mcp-proxy --port=8080 --named-server-config ./servers.json

Benannte Server

  • NAME wird im URL-Pfad /servers/NAME/ verwendet.

  • COMMAND_STRING ist der Befehl zum Starten des Servers (z. B. „uvx mcp-server-fetch“).

    • Kann mehrfach verwendet werden.

    • Dieses Argument wird ignoriert, wenn --named-server-config verwendet wird.

  • FILE_PATH – Falls angegeben, ist dies die exklusive Quelle für benannte Server und --named-server CLI-Argumente werden ignoriert.

Wenn ein Standardserver angegeben ist (das Argument command_or_url ohne --named-server oder --named-server-config ), ist dieser über die Stammpfade zugänglich (z. B. http://127.0.0.1:8080/sse ).

Benannte Server (unabhängig davon, ob sie mit --named-server oder --named-server-config definiert sind) sind unter /servers/<server-name>/ erreichbar (z. B. http://127.0.0.1:8080/servers/fetch1/sse ). Der Endpunkt /status stellt den globalen Status bereit.

JSON-Konfigurationsdateiformat für --named-server-config :

Die JSON-Datei sollte dieser Struktur folgen:

{
  "mcpServers": {
    "fetch": {
      "disabled": false,
      "timeout": 60,
      "command": "uvx",
      "args": [
        "mcp-server-fetch"
      ],
      "transportType": "stdio"
    },
    "github": {
      "timeout": 60,
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "transportType": "stdio"
    }
  }
}
  • mcpServers : Ein Wörterbuch, in dem jeder Schlüssel der Servername ist (verwendet im URL-Pfad, z. B. /servers/fetch/ ) und der Wert ein Objekt ist, das den Server definiert.

  • command : (Erforderlich) Der für den stdio-Server auszuführende Befehl.

  • args : (Optional) Eine Liste mit Argumenten für den Befehl. Standardmäßig ist die Liste leer.

  • enabled : (Optional) Wenn false , wird diese Serverdefinition übersprungen. Der Standardwert ist true .

  • timeout und transportType : Diese Felder sind in Standard-MCP-Clientkonfigurationen vorhanden, werden aber derzeit von mcp-proxy beim Laden benannter Server ignoriert . Der Transporttyp ist implizit „stdio“.

Installation

Installation über Smithery

So installieren Sie MCP Proxy für Claude Desktop automatisch über Smithery :

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

Installation über PyPI

Die stabile Version des Pakets ist im PyPI-Repository verfügbar. Sie können es mit dem folgenden Befehl installieren:

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

# Option 2: With pipx (alternative)
pipx install mcp-proxy

Nach der Installation können Sie den Server mit dem Befehl mcp-proxy ausführen. Die Konfigurationsoptionen für die einzelnen Modi finden Sie oben.

Installation über das Github-Repository (neueste Version)

Die neueste Version des Pakets kann mit dem folgenden Befehl aus dem Git-Repository installiert werden:

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

[!NOTE] Wenn Sie den Server bereits installiert haben, können Sie ihn mit dem Befehl uv tool upgrade --reinstall aktualisieren.

[!NOTE] Wenn Sie den Server löschen möchten, verwenden Sie den Befehl uv tool uninstall mcp-proxy .

Installation als Container

Ab Version 0.3.2 ist es möglich, das entsprechende Container-Image zu ziehen und auszuführen:

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

Fehlerbehebung

  • Problem : Claude Desktop kann den Server nicht starten: ENOENT-Code in den Protokollen

    Lösung : Versuchen Sie, den vollständigen Pfad zur Binärdatei zu verwenden. Öffnen Sie dazu ein Terminal und führen Sie den Befehl where mcp-proxy (macOS, Linux) oder where.exe mcp-proxy (Windows) aus. Verwenden Sie anschließend den Ausgabepfad als Wert für das Attribut „command“:

      "fetch": {
        "command": "/full/path/to/bin/mcp-proxy",
        "args": [
          "http://localhost:8932/sse"
        ]
      }

Erweitern des Container-Images

Sie können das mcp-proxy Container-Image um zusätzliche ausführbare Dateien erweitern. Beispielsweise ist uv nicht standardmäßig enthalten, Sie können damit aber ein benutzerdefiniertes Image erstellen:

# 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-Setup

Mit der benutzerdefinierten Docker-Datei können Sie einen Dienst in Ihrer Docker Compose-Datei definieren:

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

[!NOTE] Vergessen Sie nicht, das Argument --pass-environment festzulegen, da Sie sonst die Fehlermeldung „Kein Interpreter in verwalteten Installationen oder im Suchpfad gefunden“ erhalten.

Befehlszeilenargumente

usage: mcp-proxy [-h] [-H KEY VALUE] [--transport {sse,streamablehttp}] [-e KEY VALUE] [--cwd CWD] [--pass-environment | --no-pass-environment]
                 [--debug | --no-debug] [--named-server NAME COMMAND_STRING] [--named-server-config FILE_PATH] [--port PORT] [--host HOST]
                 [--stateless | --no-stateless] [--sse-port SSE_PORT] [--sse-host SSE_HOST] [--allow-origin ALLOW_ORIGIN [ALLOW_ORIGIN ...]]
                 [command_or_url] [args ...]

Start the MCP proxy.
It can run as an SSE client (connecting to a remote SSE server and exposing stdio).
Or, it can run as an SSE server (connecting to local stdio command(s) and exposing them over SSE).
When running as an SSE server, it can proxy a single default stdio command or multiple named stdio commands (defined via CLI or a config file).

positional arguments:
  command_or_url        Command or URL.
                        If URL (http/https): Runs in SSE/StreamableHTTP client mode.
                        If command string: Runs in SSE server mode, this is the default stdio server.
                        If --named-server or --named-server-config is used, this can be omitted if no default server is desired.

options:
  -h, --help            show this help message and exit

SSE/StreamableHTTP client options:
  -H, --headers KEY VALUE
                        Headers to pass to the SSE server. Can be used multiple times.
  --transport {sse,streamablehttp}
                        The transport to use for the client. Default is SSE.

stdio client options:
  args                  Any extra arguments to the command to spawn the default server. Ignored if only named servers are defined.
  -e, --env KEY VALUE   Environment variables used when spawning the default server. Can be used multiple times. For named servers, environment is inherited or passed via --pass-environment.
  --cwd CWD             The working directory to use when spawning the default server process. Named servers inherit the proxy's CWD.
  --pass-environment, --no-pass-environment
                        Pass through all environment variables when spawning all server processes.
  --debug, --no-debug   Enable debug mode with detailed logging output.
  --named-server NAME COMMAND_STRING
                        Define a named stdio server. NAME is for the URL path /servers/NAME/. COMMAND_STRING is a single string with the command and its arguments (e.g., 'uvx mcp-server-fetch --timeout 10'). These servers inherit the proxy's CWD and environment from --pass-environment. Can be specified multiple times. Ignored if --named-server-config is used.
  --named-server-config FILE_PATH
                        Path to a JSON configuration file for named stdio servers. If provided, this will be the exclusive source for named server definitions, and any --named-server CLI arguments will be ignored.

SSE server options:
  --port PORT           Port to expose an SSE server on. Default is a random port
  --host HOST           Host to expose an SSE server on. Default is 127.0.0.1
  --stateless, --no-stateless
                        Enable stateless mode for streamable http transports. Default is False
  --sse-port SSE_PORT   (deprecated) Same as --port
  --sse-host SSE_HOST   (deprecated) Same as --host
  --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 --transport streamablehttp http://localhost:8080/mcp
  mcp-proxy --headers Authorization 'Bearer YOUR_TOKEN' http://localhost:8080/sse
  mcp-proxy --port 8080 -- my-default-command --arg1 value1
  mcp-proxy --port 8080 --named-server fetch1 'uvx mcp-server-fetch' --named-server tool2 'my-custom-tool --verbose'
  mcp-proxy --port 8080 --named-server-config /path/to/servers.json
  mcp-proxy --port 8080 --named-server-config /path/to/servers.json -- my-default-command --arg1
  mcp-proxy --port 8080 -e KEY VALUE -e ANOTHER_KEY ANOTHER_VALUE -- my-default-command
  mcp-proxy --port 8080 --allow-origin='*' -- my-default-command

Beispielkonfigurationsdatei

{
  "mcpServers": {
    "fetch": {
      "enabled": true,
      "timeout": 60,
      "command": "uvx",
      "args": [
        "mcp-server-fetch"
      ],
      "transportType": "stdio"
    },
    "github": {
      "timeout": 60,
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "transportType": "stdio"
    }
  }
}

Testen

Überprüfen Sie den mcp-proxy Server, indem Sie ihn mit dem mcp-server-fetch -Server ausführen. Sie können das Inspector-Tool verwenden, um den Zielserver zu testen.

# Run the stdio server called mcp-server-fetch behind the proxy over SSE
mcp-proxy --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

Available Tools

1 tool
fetchA

Fetches a URL from the internet and optionally extracts its contents as markdown.

Although originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.

ParametersJSON Schema
NameRequiredDescriptionDefault
rawNoGet the actual HTML content of the requested page, without simplification.
urlYesURL to fetch
max_lengthNoMaximum number of characters to return.
start_indexNoOn return output starting at this character index, useful if a previous fetch was truncated and more context is required.

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description partially covers behavior: it mentions fetching and markdown extraction but omits error handling, rate limits, or response truncation details. The meta note about past limitations does not add behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief with two sentences, front-loading the main action. The second sentence is slightly verbose but still concise overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no siblings or output schema, the description covers the core functionality and parameter usage adequately. It lacks mention of error scenarios but is sufficient for a fetch tool with well-defined schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the description adds minimal value beyond parameter descriptions. It provides context by linking 'optionally extracts markdown' to the 'raw' parameter, but not enough to raise the score above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool fetches a URL from the internet and optionally extracts markdown. It distinguishes this from any other tool by emphasizing internet access, and there are no siblings to differentiate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description tells the agent to use this tool for obtaining up-to-date internet information. Though lacking explicit when-not-to-use, the context of granting internet access implies its primary use case.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool update
    • First observedfetch

TDQS

A3.9/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no risk of ambiguity. Its purpose is clear and distinct.

Naming Consistency5/5

With a single tool, naming consistency is not an issue. The tool name 'fetch' is clear and conventional.

Tool Count3/5

One tool is minimal. While it covers the core action of fetching a URL, a proxy server typically involves additional operations like caching, authentication, or transformation, making this feel slightly under-scoped.

Completeness2/5

The server only provides a single fetch operation, lacking obvious features for a proxy such as request customization, error handling, or support for different protocols. This is a significant gap for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Bridges STDIO-based MCP clients with SSE-based MCP servers, allowing applications like Claude Desktop to connect to remote MCP servers that use SSE transport.
    9
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Exposes any stdio-based MCP server to the internet via HTTP/SSE transport, enabling remote agents to access MCP tools over a network.
    29 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides an MCP server for automation via Server-Sent Events (SSE) to manage mock gRPC and Connect RPC services.
    18 npm
    1
    MIT