An open source proxy for MCP servers
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omproxy-0.3.0.tar.gz.
File metadata
- Download URL: omproxy-0.3.0.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53e32fba1f735ed8547430df4f0803a6999676db3303511b7c0050fe25304b32
|
|
| MD5 |
03b3328982cd2c483d0a53f40fab403e
|
|
| BLAKE2b-256 |
dba53d338894fcb59655ccc324863e0b82c10537ae1cd36e2a436acf931d194e
|
Provenance
The following attestation bundles were made for omproxy-0.3.0.tar.gz:
Publisher:
release.yml on grll/open-mcp-proxy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omproxy-0.3.0.tar.gz -
Subject digest:
53e32fba1f735ed8547430df4f0803a6999676db3303511b7c0050fe25304b32 - Sigstore transparency entry: 159327603
- Sigstore integration time:
-
Permalink:
grll/open-mcp-proxy@ce9ed2752df2f236f01e5463eb31f100d47db78c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/grll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce9ed2752df2f236f01e5463eb31f100d47db78c -
Trigger Event:
release
-
Statement type:
File details
Details for the file omproxy-0.3.0-py3-none-any.whl.
File metadata
- Download URL: omproxy-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5499bffc3666ac7f975e6d219384c49e2922c2fd12a6750573d186cda2585c36
|
|
| MD5 |
49f90e6a90692ed1f2ec430817b4ceb0
|
|
| BLAKE2b-256 |
639dae8f649ab395110252126e99f9d2a73501ba91999c3f5056e3c14978b18e
|
Provenance
The following attestation bundles were made for omproxy-0.3.0-py3-none-any.whl:
Publisher:
release.yml on grll/open-mcp-proxy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omproxy-0.3.0-py3-none-any.whl -
Subject digest:
5499bffc3666ac7f975e6d219384c49e2922c2fd12a6750573d186cda2585c36 - Sigstore transparency entry: 159327605
- Sigstore integration time:
-
Permalink:
grll/open-mcp-proxy@ce9ed2752df2f236f01e5463eb31f100d47db78c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/grll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ce9ed2752df2f236f01e5463eb31f100d47db78c -
Trigger Event:
release
-
Statement type: