loading…
Search for a command to run...
loading…
Enables two or more Claude Code terminals on the same machine to communicate by registering and sending messages via the local filesystem.
Enables two or more Claude Code terminals on the same machine to communicate by registering and sending messages via the local filesystem.
An MCP server that lets two or more Claude Code terminals on the same machine talk to each other. Register each terminal with a short name, then send messages between them.
┌──────────────┐ ┌──────────────┐
│ terminal A │ ── send_message ──► │ terminal B │
│ │ ◄── send_message ── │ │
└──────────────┘ └──────────────┘
│ file-based │
└──────► ~/.claude/terminal-messages ──┘
Pair-running two Claude Code sessions and want one to hand off a long log or a task summary to the other? That's it.
Wire it into Claude Code's MCP config (Claude Code → ~/.claude.json or via the CLI):
claude mcp add terminal-share -- npx -y mcp-terminal-share
Or by hand in your MCP config:
{
"mcpServers": {
"terminal-share": {
"command": "npx",
"args": ["-y", "mcp-terminal-share"]
}
}
}
Requires Node.js 18+.
| Tool | Purpose |
|---|---|
register |
Give this terminal a name (e.g. A1, dev). Required before others can address it. |
list_terminals |
Show all live terminals. Stale records are cleaned up automatically. |
send_message |
Send {from, to, summary, content} to another terminal. |
get_messages |
Read messages addressed to you. Deletes them on read by default. |
watch_messages |
Block until a message arrives or timeout (default 300s) expires. |
Names must match ^[A-Za-z0-9_-]{1,32}$. Message content is capped at 1 MB, summary at 500 B.
If you already use the bundled t-rg / t-list / t-send / t-get / t-watch skills, they map 1:1 onto the tools above.
After a successful register, the server writes a tiny session record keyed by a hash of the working directory:
~/.claude/terminal-messages/sessions/<sha256(cwd)[:16]>.json
The MCP server, your statusline, and any helper subprocess it spawns all inherit cwd from the same Claude Code session, so they can find each other without any extra plumbing.
Add --extra-cmd "mcp-terminal-share-label" to your statusline command:
{
"statusLine": {
"type": "command",
"command": "claude-hud --extra-cmd \"mcp-terminal-share-label\""
}
}
The bundled mcp-terminal-share-label bin reads the record for the current cwd and outputs claude-hud's expected {"label": "📟 <name>"} (or {} when nothing is registered). Override the emoji/prefix with MCP_TERMINAL_SHARE_LABEL_PREFIX.
Roll your own. The minimal Node version:
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { homedir } from "node:os";
import { createHash } from "node:crypto";
const key = createHash("sha256").update(process.cwd()).digest("hex").slice(0, 16);
try {
const { name } = JSON.parse(
readFileSync(
join(homedir(), ".claude", "terminal-messages", "sessions", `${key}.json`),
"utf-8",
),
);
process.stdout.write(`📟 ${name}`);
} catch {
// not registered
}
The file is removed automatically when the MCP server shuts down.
Known limitation: if you open two Claude Code sessions in the same directory, the later one's register overwrites the earlier one's session record. This only affects the statusline label — message routing between terminals is unaffected.
~/.claude/terminal-messages/terminals/<name>.json.~/.claude/terminal-messages/messages/to_<recipient>_<ts>_<rand>.json.~/.claude/terminal-messages/sessions/<sha256(cwd)[:16]>.json.Override the storage root with MCP_TERMINAL_SHARE_DIR (mostly useful for tests).
~/.claude/terminal-messages can read or spoof messages. This is fine on a personal dev machine and explicitly out of scope to defend otherwise.If you need cross-machine sharing or untrusted multi-tenant isolation, this is the wrong tool — reach for a real message bus.
npm install
npm test
Tests use Node's built-in node:test runner with isolated temp dirs (no extra deps).
Run in your terminal:
claude mcp add mcp-terminal-share -- npx