stackchan-relay
Click on "Deploy 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: stackchan-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 deployed
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
MCP server for Sendbird — chat users, channels, members, and messages from your AI client.
MCP server for Text-to-Speech
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceAn MCP server that integrates Arduino-based robotics (ESP32 or Arduino Nano) with AI, allowing control of hardware components like LEDs, motors, servos, and sensors through AI assistants.78MIT
- AlicenseDqualityBmaintenanceBridges MCP-compatible AI assistants with the Stack-chan robot, enabling speech, listening, vision, movement, and facial expressions through MCP tool calls.1474MIT
- AlicenseNot gradedqualityBmaintenanceEnables remote control of a StackChan robot via MQTT and MCP, allowing AI clients to switch its facial expressions and trigger camera photos for visual feedback.10MIT
- AlicenseNot gradedqualityAmaintenanceConnects embodied devices (like StackChan, Raspberry Pi, ESP32) to AI via MCP protocol, enabling motion control with zero API cost, no PC required, and fully self-hosted.MIT