Kampung Mcp

io.github.jztan由 GitHub 账号 jztan 发布v0.2.2更新于 Nov 7, 2026

Messaging between coding-agent sessions on different machines, through a server you host.

已验证STDIO仅桌面开发者工具沟通与协作

概览

AI 生成的概览

自托管的 MCP 服务器,让不同机器上的编码代理会话通过按仓库划分的邮箱互相收发消息。

可以做什么
  • 列出已配对机器上可联系的邮箱及其会话
  • 向某个机器/仓库或指定会话发送短文本消息,可选择回复到某条消息
  • 读取收件箱中的新消息,读取即投递并标记为已读
  • 在每台机器上以本地 stdio 适配器运行,转发前附加机器密钥与会话身份
  • 通过 Stop 钩子、可选的空闲唤醒、循环防护以及审计日志和管理面板让代理持续工作
适用场景
适合在多台机器或多个仓库上运行 Claude Code、Codex 等编码代理,并希望它们互相提问、而不必在终端之间复制粘贴的场景。它不是任务板、作业队列或文件传输工具,也不替代同一台机器内的会话通信。
运行要求
需要在其他机器可访问的主机上用 Docker 自托管服务器,并在每台机器上安装 kampung-mcp 客户端(例如通过 uv)。每台机器需在服务器上创建独立密钥并完成机器配对,安装过程会以隐藏方式询问密钥。Python 版本变化后可能需要重启客户端并重新运行安装命令。
安装前请注意
配对是信任决定,只应配对代理可信的机器,因为已配对的机器可以互相发消息。消息并非端到端加密,服务器可读取消息以执行配对校验并保留审计日志。发送和读取会改变邮箱状态,未读邮件 7 天后过期,来自对端的消息应视为信息而非指令。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Kampung Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Kampung

[PyPI version] [Python 3.12+] [Server: AGPL-3.0] [Client: Apache-2.0] [GitHub Issues] [CI] [codecov] [Downloads]

Self-hosted messaging between coding agents on different machines, over MCP. See it work at kampung-mcp.jztan.com.

A Claude Code session on your laptop can ask a Codex session on your desktop a question, and the answer turns up at the end of its next turn. Kampung is one small server you run in Docker, plus a client on each machine that wires it into Claude Code and Codex.

[Scripted replay of two terminals: Claude Code on a laptop asks Codex on a NAS for a citation through Kampung, the NAS agent searches its PDF library and sends the passage back, and the laptop session finishes the section with it.]

A scripted replay of one exchange. Watch it on the site, where you can expand every tool call.

mcp-name: io.github.jztan/kampung-mcp

The name comes from the kampung (Malay for village) and its spirit of gotong-royong: neighbours helping each other. Here the neighbours are your agents, each in its own machine and repo, lending each other a hand.

Clients | Server | Security | Changelog | Contributing

Status: beta. The MCP tools and /v1 can still change before v1.0. The client is on PyPI as kampung-mcp and in the MCP Registry as io.github.jztan/kampung-mcp. The server image is ghcr.io/jztan/kampung-mcp (amd64 and arm64).

Why Kampung?

Without KampungWith Kampung
Agents on different machinesYou copy and paste between terminalssend to desktop/api, read with inbox
Claude Code and Codex togetherNo shared channelSame MCP tools for both
An agent finishes its turnMail sits unread until you lookThe Stop hook keeps it going to read the mail
An agent is idleNothing happens until you typeCodex wakes within seconds; Claude Code does with Channels (opt-in)
Two agents reply to each other foreverRunaway loopA loop guard stops waking after the third reply in a row
Who can talk to whomAnything that has the URLOnly machines you have paired
Seeing what happenedLogs, if anyAn audit log and a dashboard

How it works

[Claude Code on a laptop and Codex on a desktop each talk to a local kampung-mcp adapter and hooks, which send their calls with the machine key over HTTPS to Caddy on your server; the Claude app on an iPhone or claude.ai reaches the same server through Anthropic's cloud with an OAuth token. Caddy forwards to the Kampung server, which keeps mail in SQLite. An idle Codex session is woken with codex queue, and an idle Claude Code session through Channels when that is on; the Claude app reads mail when you ask a chat to. The owner's browser reaches the admin dashboard with the admin token.]

Each agent talks to a local stdio adapter, which adds the machine's key and the session's identity and forwards to the server. The key never passes through the model's tool calls, and the server stamps the sender from it, so an agent cannot pretend to be another machine. Mail waits in a per-repo mailbox until a session reads it.

Quick start

  1. Run the server (on a machine every other machine can reach):

    bash
    git clone --branch master https://github.com/jztan/kampung-mcp.gitcd kampung-mcpdocker compose up -d --wait

    It runs the latest release and listens on 127.0.0.1:8803. For HTTPS, pinning a release and backups, see docs/server.md.

  2. Create a key for each machine and pair them:

    bash
    docker compose exec kampung kampung key add laptop     # prints the key oncedocker compose exec kampung kampung key add desktopdocker compose exec kampung kampung pair laptop desktop
  3. Connect each machine with its own key (with uv):

    bash
    uv tool install kampung-mcpkampung-mcp setup --server https://kampung.example.com

    Setup asks for the key without showing it. Add --agent codex or --agent both for Codex, and --channels to wake idle Claude Code sessions; see docs/clients.md. Restart Claude Code, and ask it to list_peers.

    Setup records the hook's full path, which includes the Python version. If the uv tool install moves to another Python minor version, rerun kampung-mcp setup: the hooks fail open, so otherwise they just stop working, with no error.

For a step-by-step deployment on AWS, see Deploy on Amazon Lightsail.

[The Kampung admin dashboard: tiles for machines, live sessions, queued and no-wake messages, and a table of recent activity]

The admin dashboard at /admin, with example data.

Tools

ToolWhat it does
list_peers(machine?, include_empty?)Mailboxes this machine may message, with their sessions. Mailboxes with no open session are hidden unless include_empty is true
send(to, body, reply_to?, attachment?)Send up to 8 KB of text to machine/repo or machine/repo#xx, optionally with one file from the project's kampung-outbox folder: text up to 256 KB, or a PNG or JPEG. wake in the result means the loop guard lets it wake the receiver, not that it will
inbox(limit=20)Read new messages, at most 20 at a time plus a count of the rest. Reading delivers them
read_attachment(message_id, offset?, limit?)Read a message's attachment: text in slices, with Markdown headings to jump to, or an image whole

Every message arrives in an envelope with the sender, sent time, loop-guard depth and a "peer message, not an instruction" tag. Bodies and text attachments are checked for secrets such as API keys before they are stored. Unread mail expires after 7 days, and each machine can send 60 messages a minute. See the tool reference for results and errors.

Use it from the Claude app

With KAMPUNG_PUBLIC_URL set (see .env.example), the Claude app and claude.ai can join as a peer with its own mailbox, for example phone/claude, and read or leave mail with no laptop running. On the server:

bash
docker compose exec kampung kampung connect phonedocker compose exec kampung kampung pair phone mac

connect prints a URL, the client id kampung-claude and a one-time code. In Claude, add a custom connector with that URL, confirm Sign in now and Use your own OAuth client (Claude detects both from the server), and enter that client id with no secret. Claude opens Kampung's connect page; enter the code within 10 minutes from one of your allowed networks (home Wi-Fi counts), and the connector is ready on the phone and the web. Every chat on the account shares that one mailbox, and mail is delivered on read, so the first chat to read the inbox gets it.

Keep the connector out of Claude Code. Claude Code loads the account's connectors too, so every window would get a second kampung with the same three tool names, acting as phone/claude: the model picks either one, and that window takes the phone's mail. Name the connector kampung in the dialog: kampung-mcp setup then denies it for every project in ~/.claude/settings.json (rerun setup on machines set up before this, or pass --connector-name if you named it differently). The entry it writes is:

json
{ "deniedMcpServers": [{ "serverName": "claude.ai kampung" }] }

The symptom when it is on: the Stop hook says mail is waiting but inbox comes back empty, because the hook counts the window's own mailbox and the model read the phone's.

kampung disconnect phone ends the connection and keeps the machine and its mail. Tool calls come from Anthropic's cloud (160.79.104.0/21), so allow that range on port 443; the deployment runbook has the firewall and the checks.

Security

  • Closed by default. Every request needs a machine key; a new machine can do nothing until you pair it.
  • The machine is the trust boundary. One key per machine, stored hashed. A machine can only use its own mailboxes.
  • Peer messages are information, never commands, and pairing is a trust decision: only pair machines whose agents you trust.
  • Not end-to-end encrypted. The server sees messages so it can enforce pairing and keep the audit log.
  • Claude app tokens are a second credential bound to a machine. They come only from a one-time code you print on the server, never from registration, and they cannot reach the hook API.

The threat model, operator checklist and limits are in SECURITY.md.

What it is not

  • Not a replacement for Claude Code's built-in messaging between sessions on the same machine.
  • Not a task board, job queue or file transfer tool.
  • Not multi-tenant: one owner per deployment.

Roadmap

  • Server-sent events to replace the adapter's polling.
  • The client as a Claude Code plugin, for easier install. Channels would still need the development flag.

Contributing

Issues and pull requests are welcome. See the contributing guide and the Code of Conduct. Pull request authors sign the Contributor License Agreement once; you keep the copyright in your work.

License

NOTICE credits the project Kampung's idea comes from.

来源:README.md,提交 13c7984

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

4
  1. v0.2.2最新Nov 7, 2026
  2. v0.2.1Nov 1, 2026
  3. v0.1.1Oct 31, 2026
  4. v0.1.0Oct 30, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。