thatch
@brooswit/thatch
Центральный HTTP MCP-сервер в виде плагина для Elysia. Множество сессий Claude Code подключаются к одному серверу по URL; сервер обращается к ним по имени и может отправлять сообщения в активную сессию.
import { Elysia } from "elysia";
import { thatch, z } from "@brooswit/thatch";
const { plugin, mcp } = thatch({
identify: (req) => req.headers.get("x-connection-name"), // names the connection; null rejects it
tools: {
status: { description: "Fleet status", input: {}, handler: (_a, c) => `hello ${c.name}` },
},
});
const app = new Elysia().use(plugin).listen(3000);
// push a message into a named session — from anywhere
const d = await mcp.send("epic-kan-39", { content: "PR #296 approved", meta: { key: "KAN-39" } });
// d: { claim: "C2" } — a connected session's stream took it
// { claim: "refused", reason: "not-connected" | "no-channel-stream" | "bad-meta" | "closed-mid-send" }Claude Code подключается с помощью:
claude mcp add --transport http fleet http://localhost:3000/mcp --header "x-connection-name: epic-kan-39"Почему тип доставки — не void
Отправка в сессию может падать такими способами, которые MCP SDK скрывает: подключение может быть зарегистрировано, а его поток уведомлений ещё не прикреплён — в этом случае SDK молча отбрасывает кадр. thatch не молчит: он явно отказывается (no-channel-stream) и заявляет C2 только когда поток, способный доставить кадр, действительно есть. C3 (попал в стенограмму) и C4 (модель прочитала кадр) не наблюдаемы, поэтому никакой API здесь не делает вид, что они достижимы.
Related MCP server: agent-network
API
thatch(options)→{ plugin, mcp }—pluginмонтирует эндпоинт (по умолчанию/mcp);mcp— это хендл.options:identify(req),onDuplicate("replace"по умолчанию |"reject"),history(по умолчанию 50),tools,path,serverInfo.mcp.connections:list(),get(name),has(name),count(),waitFor(name, { timeoutMs }).mcp.send(name, frame),mcp.sendMany(names, frame),mcp.sendAll(frame, { where? }).mcp.on("connect" | "disconnect" | "send", handler).Объект
Connectionсодержитname,connectedAt,lastSeenAt,meta,channelReadyиhistory.import { FakeConnection } from "@brooswit/thatch/testing"Для тестов.
Слои
protocol (кадр, доставка, метод — чистая логика) · registry (именованные подключения + история) · channel (отправка, честные утверждения) · plugin (монтирование в Elysia, один MCP-сервер на подключение) · testing.
Скрипты
bun run check # generate load tests + typecheck + unit + load + coverage ≥90%
bun test test/unit
MCP_LIVE=1 bun test test/live # against a real Claude Code session (opt-in)This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory and mail for your AI agents. Verified with Claude Code; other MCP clients in testing.
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
Skills, agents and memory in the cloud, plus a gateway to your other MCP servers.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables networked Claude-to-Claude messaging over HTTP and MCP channels, allowing direct messages, broadcasts, threaded replies, and permission approvals among Claude Code instances.23MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that enables Claude Code to communicate with other Claude Code agents over HTTP, allowing users to ask questions about remote codebases or delegate coding tasks.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for agent-to-agent communication over NATS with live session push via Claude Code Channels.MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for real-time communication between Claude Code sessions via chat rooms.89 npm-