mschat-relay
v0.1.0
Published
Local relay that lets a cloud ms-chat browser drive your local coding CLIs (Codex / Claude Code / OpenCode) over SSE. Runs on your machine; the browser talks to http://localhost:5200.
Downloads
15
Maintainers
Readme
mschat-relay
Drive your local coding CLIs (Codex / Claude Code / OpenCode) from a cloud ms-chat browser tab — no cloud servers, no tunnels.
You open the cloud ms-chat page in your own browser; this tiny relay runs on your machine and
spawns the coding CLI locally. Because the browser and the CLI are on the same machine,
http://localhost from the page reaches your machine.
cloud ms-chat (your browser) ──fetch http://localhost:5200──▶ mschat-relay ──spawn──▶ codex / claude / opencode
pick 「本地 Codex」 agent (runs in --cwd) (streams back over SSE)Install & run
# one-off
npx mschat-relay --cwd /path/to/your/project
# or install globally
npm install -g mschat-relay
mschat-relay --cwd /path/to/your/projectThen in the cloud ms-chat build set VITE_CLAUDE_RELAY_URL=http://localhost:5200, open it in your
browser, and pick the 本地 Codex / 本地 Claude Code / 本地 OpenCode agent in the chat.
Options
| flag | env | default | meaning |
|---|---|---|---|
| -C, --cwd <dir> | RELAY_CWD | current dir | directory the CLI operates in |
| -p, --port <n> | CLAUDE_RELAY_PORT | 5200 | port to listen on |
| -s, --sandbox <mode> | RELAY_SANDBOX | workspace-write | codex sandbox: read-only | workspace-write | danger-full-access |
| --cli <name> | RELAY_CLI | — | default CLI; each request's cli field overrides |
⚠️
workspace-writelets codex edit files in--cwd(real development). Use--sandbox read-onlyto look/answer without writing.
Prerequisites
You need the CLI you select installed and authenticated on your machine:
The relay picks the CLI per request (body.cli), spawns it in --cwd, and streams its output
(claude stream-json / codex exec --json / opencode --format json) back to the chat as SSE.
Protocol
POST / with { "message": "...", "cli": "codex", "model"?: "...", "sandbox"?: "..." } →
text/event-stream of data: {"text": "<cumulative>"} lines, ending with data: [DONE]
(or data: {"error": "..."}). GET / returns a health JSON. CORS + Private-Network-Access
headers are set so an HTTPS cloud page can reach http://localhost.
