https://github.com/fangyinc/mcpport
mcpport — A lightweight gateway & registry for Model Context Protocol (MCP), enabling standardized connectivity for AI applications.
https://github.com/fangyinc/mcpport
Last synced: over 1 year ago
JSON representation
mcpport — A lightweight gateway & registry for Model Context Protocol (MCP), enabling standardized connectivity for AI applications.
- Host: GitHub
- URL: https://github.com/fangyinc/mcpport
- Owner: fangyinc
- License: mit
- Created: 2025-04-01T01:32:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-02T04:31:48.000Z (over 1 year ago)
- Last Synced: 2025-04-02T05:20:07.898Z (over 1 year ago)
- Language: Python
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mcp-devtools - fangyinc/mcpport - A lightweight gateway & registry for MCP servers with NAT traversal support, allowing edge devices to provide MCP services across networks. Features include WebSocket/SSE/HTTP endpoints, authentication, IPv6 support, and a CLI tool for easy registration of stdio-based MCP servers. (Utilities / Proxies and Gateways)
- awesome-mcp-devtools - fangyinc/mcpport - A lightweight gateway & registry for MCP servers with NAT traversal support, allowing edge devices to provide MCP services across networks. Features include WebSocket/SSE/HTTP endpoints, authentication, IPv6 support, and a CLI tool for easy registration of stdio-based MCP servers. (Utilities / Proxies and Gateways)
README
# mcpport
mcpport — A lightweight gateway & registry for Model Context Protocol (MCP), enabling standardized connectivity for AI applications.
## Quick Start
1. Start your MCP Gateway
```bash
uvx mcpport gateway
```
It will start the gateway on port 8765 by default. And the common access points are:
- `ws://localhost:8765/mcp/register` is the registration endpoint.
- `http://localhost:8765/sse` is the event stream endpoint(`SSE`).
- `http://localhost:8765/messages` is the message endpoint(`HTTP`).
2. Register your MCP Server to the Gateway
```bash
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.
```bash
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.
```bash
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.
## Advanced Usage
1. Start Your MCP Gateway With `ipv6` Support
```bash
uvx mcpport gateway --host "::" --ipv6
```
Other options are also available, you can use `uvx mcpport gateway --help` to get more information.
There are some options for the gateway:
- `--host` is the host of the gateway.
- `--port` is the port of the gateway, default is `8765`.
- `--ipv6` is to enable `ipv6` support, default is `false`.
- `--log-level` is the log level of the gateway, default is `INFO`.
- `--timeout-rpc` is the timeout of communication with the MCP server, default is `10s`.
- `--timeout-run-tool` is the timeout to run the tool, default is `120s`.
- `--sse-path` is the path of the event stream endpoint, default is `/sse`.
- `--messages-path` is the path of the message endpoint, default is `/messages`.
- `--auth-token` is the auth token for the gateway, (can be used multiple times).