Stackchan Cloud MCP logo

Stackchan Cloud MCP

Community
tianyupaipai-cmd

Cloud MCP gateway that connects a StackChan desk robot to claude.ai — OAuth 2.1 bridge, reflex daemon, pixel avatar toolkit, and the field notes from making it work

Publishertianyupaipai-cmd
Repositorystackchan-cloud-mcp
LanguagePython
Forks
6
Stars
40
Available tools
0
Transport typestdio
LicenseMIT
Links
  • Connect tools to AI workflows

    Stackchan Cloud MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    40 stars and 6 forks from the linked repository.

stackchan-cloud-mcp

把 StackChan 桌面机器人接到 claude.ai, 让它从"要连着一台电脑"变成一台自己在线的设备:手机上跟 Claude 说话,桌上的机器人开口、换表情、转头、亮灯。

Turn a StackChan desk robot into a device claude.ai can talk to directly — no laptop in the loop. Speak to Claude on your phone; the robot on your desk speaks back.

claude.ai / phone
      │  MCP over HTTPS (OAuth 2.1: DCR + PKCE)
      ▼
Cloudflare Tunnel  →  oauth_proxy :8770  →  stackchan-mcp gateway :8767
                                                    │  WebSocket
                                                    ▼
                                          StackChan (M5Stack CoreS3)

整套跑在一台便宜 VPS 上。设备直连 VPS,家里那台电脑可以关机。

这个仓库解决什么

上游 kisaragi-mochi/stackchan-mcp 已经把"网关 ↔ 设备"这段做得很好。这个仓库补的是把它搬上公网、接进 claude.ai 之后遇到的那一层问题:

问题症状在这里的解法
claude.ai 只认 OAuth 2.1静态 token 连不上自定义连接器cloud/oauth_proxy.py — 最小可用 OAuth 授权服务器(DCR + PKCE + 单租户门禁)
NAT 回收长连接设备稳定 ~90 秒掉线,两端都没发关闭帧密心跳 20s/60s(patches/)
音频推不出去TTS 合成成功但设备不出声缺 opuslib(patches/)
自定义表情包被拒设备退回固件默认表情,set_avatar 全无效放开网关尺寸校验(patches/)
STT 模型下不动(中国大陆)listen 卡在 Loading modelHF 镜像 + 禁 Xet(patches/)
开机版本检查等超时设备开机后一两分钟才连上网关cloud/fake_ota.py — 永远回"已是最新版"
断线后一身"裸奔"重连后表情丢失、音量亮度被重置cloud/reflex.py — 反射弧守护进程
机器人不知道 AI 在干嘛只会被动反应,和 AI 此刻的状态、情绪对不上cloud/xinchao_mood.py — 跟着 AI 状态 + 心潮情绪换脸亮灯动头(见 docs/XINCHAO.md)

踩坑全录在 patches/README.md,每条都有症状 / 根因 / 修改 / 验证。 这部分大概是这个仓库最值钱的东西——照着走能省掉一整天。

组成

目录内容
cloud/oauth_proxy.pyOAuth 2.1 门:让 claude.ai 自定义连接器能连上你的网关。单租户,一个门禁密钥。
cloud/fake_ota.py假 OTA 端点:让设备开机的版本检查秒过,不然它会等到超时才连网关。
cloud/reflex.py反射弧守护进程:重连自动补表情/恢复设备偏好、说完自动收表情、摸头反馈、待机小动作与省电。
cloud/xinchao_mood.py心潮适配:AI 在想 / 刚回完 / 打电话 / 歇着、心潮情绪词、想念冲满 → 换脸、亮灯、小动作、念你写的台词;安静时段、不在家休眠、早上叫起床都可配。不费模型额度。
cloud/agent_state_hook.sh给 AI 框架的钩子(Claude Code 的 UserPromptSubmit / Stop),把「在想 / 回完」写成状态文件,只认主人的消息。
cloud/restore.sh上游重装(uv tool install --force)会冲掉包目录里的补丁,这个脚本一键打回来。
patches/对上游网关的 4 处修改:说明 + 幂等打补丁脚本。
sprites/像素表情包生成器(纯 JS 无依赖):16 表情 × A/B 帧,RGB565,直接生成设备能吃的 .bin。
docs/部署指南。

快速开始

前置:一台能被公网访问的 VPS、一个域名(走 Cloudflare Tunnel 则不需要公网 80/443)、 一台刷了 xiaozhi-esp32 系固件的 StackChan。

bash
# 1. 装上游网关(含 STT 与 opus 编码)
uv tool install "stackchan-mcp[stt-faster-whisper]" --with opuslib

# 2. 打补丁(NAT 心跳 / 表情包尺寸校验)
sh patches/apply_patches.sh

# 3. 起 OAuth 门(环境变量见 docs/DEPLOY.md)
MCP_GATE_KEY=... MCP_ISSUER=https://your.domain python3 cloud/oauth_proxy.py

# 4. 起反射弧
STACKCHAN_TOKEN=... AVATAR_SET_PATH=/root/avatar_set.bin python3 cloud/reflex.py

完整步骤(systemd unit、Cloudflare Tunnel、claude.ai 连接器怎么加)见 docs/DEPLOY.md。

安全须知

  • 所有密钥走环境变量,仓库里没有任何真实 token、域名、IP。部署时自己设。
  • OAuth 门是单租户设计:MCP_GATE_KEY 是唯一门禁,只有知道它的人能拿到 access_token。 这不是给多用户 SaaS 用的,请勿直接用于公开服务。
  • 网关的 STACKCHAN_TOKEN 会被强制校验;OAuth 门转发时会改写 Authorization, 所以 claude.ai 拿到的 token 和网关内部 token 是分开的。
  • 机器人带麦克风和摄像头。上麦克风/摄像头能力前,想清楚你的隐私边界; 推荐做法:拍照时给出可见指示(屏幕提示或灯环变色)、不落盘、一次调用只拍一张。

状态

在真实设备上跑通并长期使用:说话(Edge TTS)、听写(faster-whisper)、字幕、 16 表情 + 场景图、头部动作、灯环、断线自愈、claude.ai 手机端驱动。

已知边界:

  • Edge TTS 是白嫖微软免费接口,国内 VPS 会被间歇限流,生产环境建议换付费或自建 TTS。
  • "唤醒词 → 本地大脑自动接话"需要网关侧能访问一个 LLM;如果你的 VPS 到 API 不通, 这条链走不通(本仓库的用法是把大脑放在 claude.ai 端,VPS 只做中继)。

致谢

License

MIT

Use Stackchan Cloud MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Stackchan Cloud MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Stackchan Cloud MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Stackchan Cloud MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "stackchan-cloud-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Stackchan Cloud MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Stackchan Cloud MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Stackchan Cloud MCP to help me with this task?
Stackchan Cloud MCP
Sure. I read it.
Here is what I found using Stackchan Cloud MCP.

Frequently asked questions

What is the Stackchan Cloud MCP MCP server used for?

Stackchan Cloud MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Stackchan Cloud MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Stackchan Cloud MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Stackchan Cloud MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Stackchan Cloud MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Stackchan Cloud MCP MCP to TypingMind?

Stackchan Cloud MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Stackchan Cloud MCP MCP provide in TypingMind?

Stackchan Cloud MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Stackchan Cloud MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Stackchan Cloud MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇