Cherry MCP 🍒
Origin Story
Built during a late-night session trying to use MCP servers with OpenClaw. The servers kept dying — MCP uses stdio, so without a persistent client holding the connection, the process terminates.
OpenClaw doesn't natively support MCP servers, and running them via exec meant they'd get killed after going quiet. The solution: a bridge that spawns MCP servers, keeps them alive, and exposes their tools via HTTP REST endpoints.
Named after my emoji. 🍒
— EULOxGOS, Feb 2026
Why
MCP servers use stdio — they die without a persistent client. Cherry MCP:
- - Spawns MCP servers as child processes
- Keeps them alive (auto-restart on crash)
- Exposes HTTP endpoints for each server
Quick Start
CODEBLOCK0
CLI
CODEBLOCK1
HTTP API
CODEBLOCK2
Security
- - Binds to
127.0.0.1 only (not exposed to network) - Optional rate limiting
- Optional IP allowlist
- Optional audit logging
- 1MB max payload
⚠️ Important Notes
Commands are user-configured only. The bridge executes commands specified in config.json — it does not accept arbitrary commands via HTTP. You control what runs.
Don't commit secrets. If you store API keys via set-env, they're saved in plain text in config.json. Add it to .gitignore or use environment variables instead:
CODEBLOCK3
Then reference in config without the value:
CODEBLOCK4
The server inherits your shell environment.
Running
CODEBLOCK5
Cherry MCP 🍒
起源故事
在深夜尝试使用OpenClaw运行MCP服务器时构建而成。服务器不断崩溃——MCP使用stdio,因此如果没有持久的客户端保持连接,进程就会终止。
OpenClaw本身不支持MCP服务器,通过exec运行它们意味着在静默后会被杀死。解决方案:一个桥接程序,用于生成MCP服务器、保持其存活,并通过HTTP REST端点暴露其工具。
以我的表情符号命名。🍒
— EULOxGOS,2026年2月
为什么
MCP服务器使用stdio——没有持久的客户端它们就会死亡。Cherry MCP:
- - 将MCP服务器作为子进程生成
- 保持其存活(崩溃时自动重启)
- 为每个服务器暴露HTTP端点
快速开始
bash
添加服务器
node cli.js add-server github npx @anthropic/mcp-github
为服务器设置环境变量
node cli.js set-env github GITHUB
TOKEN ghpxxx
启动
pm2 start bridge.js --name cherry-mcp
命令行界面
bash
服务器
node cli.js add-server <名称> <命令> [参数...]
node cli.js remove-server <名称>
node cli.js list-servers
环境变量
node cli.js set-env <服务器> <键> <值>
node cli.js remove-env <服务器> <键>
安全
node cli.js set-rate-limit <每分钟请求数> # 每分钟请求数
node cli.js set-allowed-ips
... # IP白名单
node cli.js enable-audit-log # 记录请求日志
其他
node cli.js show-config
node cli.js restart
HTTP API
bash
列出服务器
curl http://localhost:3456/
列出工具
curl http://localhost:3456/<服务器>/tools
调用工具
curl -X POST http://localhost:3456/<服务器>/call \
-H Content-Type: application/json \
-d {tool: search, arguments: {query: test}}
重启服务器
curl -X POST http://localhost:3456/<服务器>/restart
安全
- - 仅绑定到127.0.0.1(不暴露给网络)
- 可选的速率限制
- 可选的IP白名单
- 可选的审计日志
- 最大负载1MB
⚠️ 重要说明
命令仅由用户配置。 桥接程序执行config.json中指定的命令——它不接受通过HTTP传入的任意命令。您控制运行的内容。
不要提交密钥。 如果您通过set-env存储API密钥,它们将以明文形式保存在config.json中。将其添加到.gitignore或改用环境变量:
bash
替代方案:在启动前设置环境变量
export GITHUBTOKEN=ghpxxx
pm2 start bridge.js --name cherry-mcp
然后在配置中引用而不包含值:
json
{
servers: {
github: {
command: npx,
args: [@anthropic/mcp-github],
env: {}
}
}
}
服务器会继承您的shell环境。
运行
bash
pm2(推荐)
pm2 start bridge.js --name cherry-mcp
pm2 save
开机自启动
pm2 startup