Skip to main content

Open MCP Proxy

A simple and lightweight open-source bidirectional proxy for MCP servers.

It exposes several callbacks that you can use to implement your own logic and do your own actions during the MCP protocol lifecycle.

It supports both SSE and STDIO protocols so it can be used to enable MCP Client supporting only stdio (like the Claude Desktop App) to also support SSE.

It leverages as much as possible the official mcp-python-sdk to remains simple, lightweight and future-proof.

it declines in 2 versions to support both SSE and STDIO protocols:

SSE Proxy

graph LR
    STDIN -->|stdio| Proxy[Open MCP Proxy]
    Proxy -->|SSE| Server[Remote MCP Server]
graph RL
    Server[Remote MCP Server] -->|SSE| Proxy[Open MCP Proxy]
    Proxy -->|stdio| STDOUT

STDIO Proxy

graph LR
    STDIN -->|stdio| Proxy[Open MCP Proxy]
    Proxy -->|stdio| Server[Local MCP Server]
graph RL
    Server[Local MCP Server] -->|stdio| Proxy[Open MCP Proxy]
    Proxy -->|stdio| STDOUT

Note that in both cases the proxy listen to STDIN and write to STDOUT to work seemlessly with stdio MCP Clients.

Usage

Hook into the MCP protocol lifecycle

The recommended approach to hook into the MCP protocol lifecycle is to subclass one of the Proxy class that we expose and override the callback methods you need.

At the moment, we expose 4 callback methods:

Method Description Parameters
_on_mcp_client_message Can be used to handle messages from the MCP client message: JSONRPCMessage
_on_mcp_server_message Can be used to handle messages from the MCP server message: JSONRPCMessage | Exception
_on_start Can be used to handle the start of the proxy None
_on_close Can be used to handle the close of the proxy None

For example if you need a proxy over the stdio protocol:

from omproxy.proxy import StdioProxy

class MyStdioProxy(StdioProxy):
    def _on_start(self):
        print("Starting proxy", file=sys.stderr)

    def _on_mcp_client_message(self, message: JSONRPCMessage):
        print(message, file=sys.stderr)

    def _on_mcp_server_message(self, message: JSONRPCMessage | Exception):
        print(message, file=sys.stderr)

    def _on_close(self):
        print("Closing proxy", file=sys.stderr)

if __name__ == "__main__":
    proxy = MyStdioProxy()
    proxy.run(StdioServerParameters(command="uv", args=["run", "src/example_server.py"]))

tip: dont write to stdout in your callbacks or anywhere really as it will mess with the stdio MCP communication.

MCP Client supporting only STDIO to your SSE MCP Server

We provide a simple CLI to start the proxy if you have an SSE MCP server running and you want to make it available to an MCP Client supporting only stdio you can simply do:

uvx omproxy@latest sse --url https://yourssemcpserver.io

see uvx omproxy@latest sse --help for more information including setting headers for authorization for example.

Release files for omproxy 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for omproxy 0.3.0
File Size Uploaded
omproxy-0.3.0.tar.gz 22.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for omproxy 0.3.0
File Interpreter ABI Platform
omproxy-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 kB

Release files / omproxy-0.3.0.tar.gz

Download URL omproxy-0.3.0.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
53e32fba1f735ed8547430df4f0803a6999676db3303511b7c0050fe25304b32
BLAKE2b-256 checksum
How to use checksums
dba53d338894fcb59655ccc324863e0b82c10537ae1cd36e2a436acf931d194e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2025.

Transparency log

Release files / omproxy-0.3.0-py3-none-any.whl

Download URL omproxy-0.3.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5499bffc3666ac7f975e6d219384c49e2922c2fd12a6750573d186cda2585c36
BLAKE2b-256 checksum
How to use checksums
639dae8f649ab395110252126e99f9d2a73501ba91999c3f5056e3c14978b18e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 3, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page