手机端网页中继:邮箱验证码登录后,把对话发给 Cursor Cloud Agent,并能通过 Val Town MCP 改你点名(或白名单里)的 val。
已经配过的不用再设。Remix 一份时需要:
👉 Add CURSOR_API_KEY here: https://www.val.town/x/yuxiaoy/cursor-chat/environment-variables?key=CURSOR_API_KEY
验证码默认发到 Val Town 账号邮箱。若要发到别的邮箱:
👉 Add LOGIN_EMAIL here: https://www.val.town/x/yuxiaoy/cursor-chat/environment-variables?key=LOGIN_EMAIL
改其它 val 时需要:
👉 Add VALTOWN_MCP_TOKEN here: https://www.val.town/x/yuxiaoy/cursor-chat/environment-variables?key=VALTOWN_MCP_TOKEN
可选,把 Agent 能改的 val 限制在名单里(逗号分隔,例如 yuxiaoy/douban,yuxiaoy/xianyu):
👉 Add MCP_VAL_ALLOWLIST here: https://www.val.town/x/yuxiaoy/cursor-chat/environment-variables?key=MCP_VAL_ALLOWLIST
VALTOWN_MCP_TOKEN 只注入 Cloud Agent,不会回退到当前 val 自带的 valtown token。客户端不提交邮箱地址,验证码只发到上面绑定的邮箱。旧的 APP_PASSWORD 已不再使用。
index.ts Hono:页面 + API
backend/auth.ts 邮箱验证码 + 哈希 session(__Host- cookie)
backend/cursor.ts Cursor Cloud Agents
backend/cursor-http.ts Cursor API 客户端
backend/db.ts SQLite:对话、消息、session、OTP
backend/icon.ts 按尺寸生成 PNG 图标
backend/security.ts CSP 等响应头
backend/selftest.ts 离线自检(不创建 Agent)
frontend/ React 手机 UI + PWA
验证码 10 分钟有效、一次性。同一来源连错 5 次锁 15 分钟,全局限 40 次。发码间隔 45 秒。Session 只存 SHA-256,退出或过期后失效。
个人免费档无法把 HTTP 改成 restricted,应用靠验证码 + 限速。