stackchan-relay
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@stackchan-relaymake StackChan say hello"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
stackchan-relay
单进程 FastAPI 服务,合并了:
MCP server (Streamable HTTP),挂载在
/mcp/<TOKEN>/,给 Claude.ai 的 MCP 连接器用Relay,给 ESP32 (M5Stack CoreS3) 长轮询用:
GET /poll?token=<TOKEN>— 拉取最新命令(latest-only,最多等STACKCHAN_POLL_TIMEOUT秒)POST /result?token=<TOKEN>— 上报上一条命令的执行结果
命令队列存在内存里,只保留"最新一条未消费的命令",不做持久化、不做FIFO。
提供的 MCP 工具
stackchan_speak(text)stackchan_emote(expression)stackchan_move_head(pitch, yaw)stackchan_wiggle()get_stackchan_status()— 返回 ESP32 是否在线、最近一条命令、最近一次上报结果
Related MCP server: esp-mcp
本地开发
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
cp .env.example .env # 修改 STACKCHAN_TOKEN
.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8011 --reload部署到 VPS (43.129.25.76, Ubuntu 24.04)
上传代码到
/opt/stackchan-relay(例如git clone或scp -r)建虚拟环境并装依赖:
cd /opt/stackchan-relay python3 -m venv .venv .venv/bin/pip install -r requirements.txt配置环境变量:
cp .env.example .env # 生成一个随机 token: python3 -c "import secrets; print(secrets.token_urlsafe(24))" # 把生成的值填进 .env 的 STACKCHAN_TOKEN安装 systemd 服务:
cp stackchan-relay.service /etc/systemd/system/ systemctl daemon-reload systemctl enable --now stackchan-relay systemctl status stackchan-relay配置 Caddy 反代(参考
Caddyfile.snippet,追加到/etc/caddy/Caddyfile):cat Caddyfile.snippet >> /etc/caddy/Caddyfile systemctl reload caddy这里用的是
43-129-25-76.nip.io(免费的 IP 通配 DNS,自动解析到你的VPS IP),Caddy 会自动申请 HTTPS 证书。以后换正式域名只需要把这一行换掉。验证:
curl https://43-129-25-76.nip.io/healthz # => {"ok":true}
在 Claude.ai 里添加 MCP 连接器
URL 填:
https://43-129-25-76.nip.io/mcp/<TOKEN>/(注意结尾的斜杠)保存后新开一个聊天窗口,Claude 就能看到 5 个 StackChan 工具
ESP32 (CoreS3) 固件需要做的事
循环长轮询:
GET https://43-129-25-76.nip.io/poll?token=<TOKEN>最多等待 ~25 秒(由服务端
STACKCHAN_POLL_TIMEOUT控制)响应示例:
有命令:
{"id":"cmd_000001","action":"speak","text":"你好"}没命令(超时):
{"action":null}
action取值:speak(带text)、emote(带expression)、move_head(带pitch/yaw)、wiggle执行完后上报结果(可选但建议):
POST https://43-129-25-76.nip.io/result?token=<TOKEN> Content-Type: application/json {"id":"cmd_000001","status":"ok"}
安全注意点
服务只监听
127.0.0.1:8011,外部只能通过 Caddy 的 443 访问STACKCHAN_TOKEN同时用作 MCP 路径的一部分和 ESP32 接口的?token=,务必用一个长随机字符串,不要用默认值.env不要提交到 git
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yuxin040712/stackchan-relay'
If you have feedback or need assistance with the MCP directory API, please join our Discord server