thatch
@broswwit/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 (이름이 있는 연결 + 히스토리) · channnel (전송, 안전한 주장) · 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-