Skip to content

Commit 594ec1b

Browse files
committed
Merge branch 'main' of github.com:pathintegral-institute/mcpm.sh into melio
2 parents 1ad9814 + 64c31ed commit 594ec1b

File tree

14 files changed

+414
-123
lines changed

14 files changed

+414
-123
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ wheels/
2121
.installed.cfg
2222
*.egg
2323

24+
# Nix Build
25+
result
26+
2427
# Virtual environments
2528
.venv
2629
venv/

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [1.13.3](https://github.com/pathintegral-institute/mcpm.sh/compare/v1.13.2...v1.13.3) (2025-06-05)
2+
3+
4+
### Bug Fixes
5+
6+
* remove stdout stream handling for share ([#167](https://github.com/pathintegral-institute/mcpm.sh/issues/167)) ([11fddcc](https://github.com/pathintegral-institute/mcpm.sh/commit/11fddcc1ce68e96105cd33f1050f3dd0814ce9e0))
7+
8+
## [1.13.2](https://github.com/pathintegral-institute/mcpm.sh/compare/v1.13.1...v1.13.2) (2025-06-05)
9+
10+
11+
### Bug Fixes
12+
13+
* trigger semantic release for Windows compatibility fix ([16b5e44](https://github.com/pathintegral-institute/mcpm.sh/commit/16b5e44f01c34422c8f8c72528b781cd5f908e44))
14+
115
## [1.13.1](https://github.com/pathintegral-institute/mcpm.sh/compare/v1.13.0...v1.13.1) (2025-05-29)
216

317

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,31 @@ mcpm router share # Share the router to public
146146
mcpm router unshare # Unshare the router
147147
```
148148

149+
### 🤝 Share Management (`share`)
150+
151+
The `mcpm share` command allows you to take any shell command that starts an MCP server and instantly expose it as an SSE (Server-Sent Events) server. It uses `mcp-proxy` to handle the server transformation and then creates a secure tunnel for remote access, making your local MCP server accessible from anywhere.
152+
153+
This is particularly useful for quickly sharing a development server, a custom MCP server, or even a standard server with specific configurations without needing to deploy it publicly.
154+
155+
```bash
156+
# 🚀 Share a local MCP server
157+
mcpm share "COMMAND" # Replace COMMAND with your actual server start command
158+
159+
# ⚙️ Options
160+
# COMMAND: The shell command that starts your MCP server (e.g., "uvx mcp-server-fetch", "npx mcp-server"). This must be enclosed in quotes if it contains spaces.
161+
# --port PORT: Specify a local port for the mcp-proxy to listen on. Defaults to a random available port.
162+
# --address ADDRESS: Specify a public address for the tunnel (e.g., yourdomain.com:7000). If not provided, a random tunnel URL will be generated.
163+
# --http: If set, the tunnel will use HTTP instead of HTTPS. Use with caution.
164+
# --timeout TIMEOUT: Timeout in seconds for the mcp-proxy to wait for the server to start. Defaults to 60.
165+
# --retry RETRY: Number of times to retry starting the server if it fails. Defaults to 0.
166+
167+
# 💡 Usage Examples
168+
mcpm share "uvx mcp-server-fetch"
169+
mcpm share "npx mcp-server" --port 5000
170+
mcpm share "uv run my-mcp-server" --address myserver.com:7000
171+
mcpm share "npx -y @modelcontextprotocol/server-everything" --retry 3
172+
```
173+
149174
### 🛠️ Utilities (`util`)
150175

151176
```bash

README.nix.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# MCPM Nix Packaging
2+
3+
This repository contains Nix packaging for MCPM (Model Context Protocol Manager).
4+
5+
## Using with Nix Flakes
6+
7+
If you have flakes enabled, you can use this package directly:
8+
9+
```bash
10+
# Run MCPM directly
11+
nix run .
12+
13+
# Install MCPM to your profile
14+
nix profile install github:pathintegral-institute/mcpm.sh
15+
16+
# Enter a development shell
17+
nix develop .
18+
```
19+
20+
## Building from Source
21+
22+
To build the package from source:
23+
24+
1. Clone the repository:
25+
```bash
26+
git clone https://github.com/pathintegral-institute/mcpm.sh
27+
cd mcpm.sh
28+
```
29+
30+
2. Build the package:
31+
```bash
32+
nix build
33+
```
34+
35+
3. Run the built package:
36+
```bash
37+
./result/bin/mcpm --help
38+
```
39+
40+
## Notes
41+
42+
- The nix package requires Python 3.12 or higher.
43+

README.zh-CN.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,31 @@ mcpm router share # 将router分享到公网
179179
mcpm router unshare # 取消分享
180180
```
181181

182+
### 🤝 共享管理 (`share`)
183+
184+
`mcpm share` 命令允许您将任何启动 MCP 服务器的 shell 命令,并立即将其公开为 SSE (Server-Sent Events) 服务器。它使用 `mcp-proxy` 处理服务器转换,然后创建一个安全隧道进行远程访问,使您的本地 MCP 服务器可以从任何地方访问。
185+
186+
这对于快速共享开发服务器、自定义 MCP 服务器,甚至具有特定配置的标准服务器(无需公开部署)特别有用。
187+
188+
```bash
189+
# 🚀 共享本地 MCP 服务器
190+
mcpm share "COMMAND" # 将 COMMAND 替换为您的实际服务器启动命令
191+
192+
# ⚙️ 选项
193+
# COMMAND: 启动 MCP 服务器的 shell 命令 (例如 "uvx mcp-server-fetch", "npx mcp-server")。如果包含空格,则必须用引号括起来。
194+
# --port PORT: 指定 mcp-proxy 监听的本地端口。默认为随机可用端口。
195+
# --address ADDRESS: 指定隧道的公共地址 (例如 yourdomain.com:7000)。如果未提供,将生成随机隧道 URL。
196+
# --http: 如果设置,隧道将使用 HTTP 而不是 HTTPS。请谨慎使用。
197+
# --timeout TIMEOUT: mcp-proxy 等待服务器启动的超时时间(秒)。默认为 60。
198+
# --retry RETRY: 如果服务器启动失败,重试启动服务器的次数。默认为 0。
199+
200+
# 💡 使用示例
201+
mcpm share "uvx mcp-server-fetch"
202+
mcpm share "npx mcp-server" --port 5000
203+
mcpm share "uv run my-mcp-server" --address myserver.com:7000
204+
mcpm share "npx -y @modelcontextprotocol/server-everything" --retry 3
205+
```
206+
182207
### 🛠️ 实用工具 (`util`)
183208

184209
```bash

default.nix

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
lib,
3+
python3,
4+
}:
5+
6+
let
7+
# Use Python 3.12
8+
python = python3; # pkgs.python312;
9+
10+
# Override Python to include our custom packages
11+
pythonWithPackages = python.override {
12+
packageOverrides = self: super: {
13+
# Add our custom packages
14+
};
15+
};
16+
in
17+
pythonWithPackages.pkgs.buildPythonApplication rec {
18+
pname = "mcpm";
19+
version = "1.13.1"; # From src/mcpm/version.py
20+
21+
src = ./.; # Use the local directory as the source
22+
23+
format = "pyproject";
24+
25+
nativeBuildInputs = with pythonWithPackages.pkgs; [
26+
hatchling
27+
setuptools
28+
wheel
29+
pip
30+
];
31+
32+
propagatedBuildInputs = with pythonWithPackages.pkgs; [
33+
# Core dependencies from pyproject.toml
34+
click
35+
rich
36+
requests
37+
pydantic
38+
duckdb
39+
psutil
40+
prompt-toolkit
41+
deprecated
42+
43+
# dependencies only available for Python>=3.12 on nixpkgs
44+
mcp
45+
ruamel-yaml
46+
watchfiles
47+
48+
# Additional dependencies that might be needed
49+
typer
50+
httpx
51+
anyio
52+
fastapi
53+
uvicorn
54+
websockets
55+
jinja2
56+
pyyaml
57+
toml
58+
python-dotenv
59+
packaging
60+
colorama
61+
];
62+
63+
# Disable tests for now
64+
#doCheck = false;
65+
66+
meta = with lib; {
67+
description = "MCPM - Model Context Protocol Manager";
68+
homepage = "https://mcpm.sh";
69+
license = licenses.mit;
70+
maintainers = with maintainers; [ luochen1990 ];
71+
mainProgram = "mcpm";
72+
};
73+
}

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
description = "MCPM - Model Context Protocol Manager";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
...
15+
}:
16+
flake-utils.lib.eachDefaultSystem (
17+
system:
18+
let
19+
pkgs = import nixpkgs {
20+
inherit system;
21+
config = {
22+
allowUnfree = true;
23+
permittedInsecurePackages = [ ];
24+
};
25+
};
26+
in
27+
{
28+
packages = {
29+
default = pkgs.callPackage ./default.nix { };
30+
};
31+
32+
apps.default = flake-utils.lib.mkApp {
33+
drv = self.packages.${system}.default;
34+
};
35+
36+
devShells.default = pkgs.mkShell {
37+
inputsFrom = [ self.packages.${system}.default ];
38+
39+
buildInputs = with pkgs.python3.pkgs; [
40+
self.packages.${system}.default
41+
42+
# From pyproject.toml's dev dependencies
43+
ipython
44+
pytest
45+
pytest-asyncio
46+
ruff
47+
jsonschema
48+
openai
49+
];
50+
51+
shellHook = ''
52+
echo "MCPM development environment"
53+
'';
54+
};
55+
}
56+
);
57+
}

pages/index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,27 @@ <h3><span><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox
10011001
</div>
10021002
</div>
10031003

1004+
<h2><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-share-2"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg> Share MCP Servers (<code>mcpm share</code>)</h2>
1005+
<p>Share a local MCP server with a public URL. MCPM uses mcp-proxy to expose a stdio MCP server as an SSE server and then creates a tunnel to make it accessible remotely.</p>
1006+
<div class="features">
1007+
<div class="feature">
1008+
<h3><span><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-terminal"><polyline points="4 17 10 17 10 7"></polyline><line x1="20" y1="17" x2="4" y2="17"></line></svg></span> Share a Server</h3>
1009+
<p>Share a server using a specific command:</p>
1010+
<div class="code-block">
1011+
<code><span class="command-prompt">$</span> mcpm share "uvx mcp-server-fetch"</code>
1012+
<button class="copy-button" data-command='mcpm share "uvx mcp-server-fetch"'><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></button>
1013+
</div>
1014+
</div>
1015+
<div class="feature">
1016+
<h3><span><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg></span> Share with Options</h3>
1017+
<p>Share a server and specify a port:</p>
1018+
<div class="code-block">
1019+
<code><span class="command-prompt">$</span> mcpm share "npx mcp-server" --port 5000</code>
1020+
<button class="copy-button" data-command='mcpm share "npx mcp-server" --port 5000'><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></button>
1021+
</div>
1022+
</div>
1023+
</div>
1024+
10041025
<h2>Client Management</h2>
10051026
<div class="features">
10061027
<div class="feature">

0 commit comments

Comments
 (0)