mcpport — A lightweight gateway & registry for Model Context Protocol (MCP), enabling standardized connectivity for AI applications.
Project description
mcpport
mcpport — A lightweight gateway & registry for Model Context Protocol (MCP), enabling standardized connectivity for AI applications.
Quick Start
- Start your MCP Gateway
uvx mcpport gateway
It will start the gateway on port 8765 by default. And the common access points are:
ws://localhost:8765/mcp/registeris the registration endpoint.http://localhost:8765/sseis the event stream endpoint(SSE).http://localhost:8765/messagesis the message endpoint(HTTP).
- Register your MCP Server to the Gateway
uvx mcpport register \
--stdio "npx -y @modelcontextprotocol/server-filesystem ./" \
--gateway-url "ws://localhost:8765/mcp/register" \
--server-name "file"
It will register a MCP server named file to the gateway. The server is a simple file system server, which is implemented by @modelcontextprotocol/server-filesystem.
Authentication
You can use --auth-token to set the auth token for the gateway.
uvx mcpport gateway --auth-token "my-token1" --auth-token "my-token2"
The default authentication method is Bearer token(Set to Authorization header).
If you set the auth token for the gateway, you need to set the same auth token for the MCP server when you register it.
uvx mcpport register \
--stdio "npx -y @modelcontextprotocol/server-filesystem ./" \
--gateway-url "ws://localhost:8765/mcp/register" \
--server-name "file" \
--header "Authorization: Bearer my-token1"
And you must set the auth token for SSE connections. You can set the auth token in the Authorization header.
Architecture
The architecture of the MCP gateway is as follows:
NAT Traversal Architecture for Cross-Network MCP Tool Access
The MCPPort solution enables edge devices to seamlessly provide MCP services through secure NAT traversal. By establishing persistent bidirectional WebSocket connections between MCPPort Clients (running on edge devices) and the central MCPPort Gateway, the system creates secure tunnels that bypass firewall restrictions.
Advanced Usage
ipv6 Support
Start Your MCP Gateway With ipv6 Support
uvx mcpport gateway --host "::" --ipv6
SSL Support
You can use --ssl-enabled to enable SSL support for the gateway.
uv run mcpport gateway \
--ssl-enabled \
--ssl-keyfile {path_to_your_keyfile} \
--ssl-certfile {path_to_your_certfile}
Then you can register your MCP server to the gateway with wss:// protocol. And access the SSE and message endpoints with https:// protocol.
uvx mcpport register \
--stdio "npx -y @modelcontextprotocol/server-filesystem ./" \
--gateway-url "wss://localhost:8765/mcp/register" \
--server-name "file"
If you want to disable the SSL verification, you can use --no-ssl-verify option.
uvx mcpport register \
--stdio "npx -y @modelcontextprotocol/server-filesystem ./" \
--gateway-url "wss://localhost:8765/mcp/register" \
--server-name "file" \
--no-ssl-verify
Note: This is not safe and should only be used for testing purposes.
SSL Support With CA Cert
You use your own CA cert to sign the server certificate. It is recommended if you not have a trusted CA cert.
Fist, you need to generate a CA cert and sign the server certificate with it. We have a script to do this. You can find it in the scripts folder.
./scripts/generate-certs.sh --domain localhost
The all generated files will be in the certs folder. It will generate the following files:
ls certs
ca.crt ca.key ca.srl index.txt openssl.cnf serial server.crt server.csr server.key
Then start the gateway with the CA cert.
uvx mcpport gateway \
--ssl-enabled \
--ssl-keyfile ./certs/server.key \
--ssl-certfile ./certs/server.crt
Then register your MCP server to the gateway with the CA cert.
uvx mcpport register \
--stdio "npx -y @modelcontextprotocol/server-filesystem ./" \
--gateway-url "wss://localhost:8765/mcp/register" \
--ssl-ca-cert ./certs/ca.crt
More Options
Other options are also available, you can use uvx mcpport gateway --help to get more information.
There are some options for the gateway:
--hostis the host of the gateway.--portis the port of the gateway, default is8765.--ipv6is to enableipv6support, default isfalse.--log-levelis the log level of the gateway, default isINFO.--timeout-rpcis the timeout of communication with the MCP server, default is10s.--timeout-run-toolis the timeout to run the tool, default is120s.--sse-pathis the path of the event stream endpoint, default is/sse.--messages-pathis the path of the message endpoint, default is/messages.--auth-tokenis the auth token for the gateway, (can be used multiple times).--ssl-enabledis to enable SSL support, default isfalse.--ssl-keyfileis the path to the SSL key file.--ssl-certfileis the path to the SSL cert file.--ssl-ca-certis the path to the SSL CA cert file.
And there are some options for the register command:
--stdiois the command to run the MCP server, it will be run in a subprocess.--gateway-urlis the URL of the gateway, default isws://localhost:8765/mcp/register.--portLocal HTTP port, 0 means don't start local server, default is0.--enable-corsis to enable CORS for the local server, default isfalse.--health-endpointis the health endpoint of local server, default is/health.--server-nameis the name of the MCP server, must be provided.--server-idis the id of the MCP server, default isuuid.--require-gatewayExit if unable to connect to gateway--log-levelis the log level of the gateway, default isINFO.--headerAdd one or more headers (format: 'Key: Value'). Can be used multiple times.--no-ssl-verifyDisable SSL certificate verification.--ssl-ca-certPath to CA certificate bundle for verification
Project details
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 mcpport-0.1.4.tar.gz.
File metadata
- Download URL: mcpport-0.1.4.tar.gz
- Upload date:
- Size: 67.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caa9d8a3f3d2094ed4833325746f73d9759b842ee5699485a57be1608dc72ead
|
|
| MD5 |
68c74a0375271b68c61d435006145acd
|
|
| BLAKE2b-256 |
ef36fd1c7229754349bafa8fc7ad995dc605966bdbf9bc0efa7b747e078cb70d
|
File details
Details for the file mcpport-0.1.4-py3-none-any.whl.
File metadata
- Download URL: mcpport-0.1.4-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f56bb9e8b41e289d74674f56ff388c35e2b964fab6301a2efed26daab5ba8f9
|
|
| MD5 |
6b5dc2e49b948ff75629bb7b992ff29c
|
|
| BLAKE2b-256 |
35927ee16c7d1a4d8daeea94a768b826b41419c8b7c2116dab0dd0b179ab6a20
|