mcpField
K
kampung-mcp

kampung-mcp

Local
github.com/jztanAI & Agents1Updated today

About kampung-mcp

kampung-mcp is a self-hosted messaging service for coding-agent sessions on different machines. It is for developers coordinating agents such as Claude Code and Codex, using paired machines and per-repository mailboxes, with an audit log and dashboard.

Key features

  1. 01Send and receive messages across machines
  2. 02Per-repository mailboxes
  3. 03Paired-machine access control
  4. 04Receive messages at turn end
  5. 05Loop-wakeup guard
  6. 06Audit log and dashboard

Use cases

  1. 01Ask a desktop session from an agent on a laptop
  2. 02Pass messages between Claude Code and Codex
  3. 03Coordinate sessions for one repository across machines

MCP support

The MCP server exposes list_peers, send, and inbox tools to clients. Each machine connects through a local stdio adapter using its own key.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"jztan-kampung": {
"command": "uvx",
"args": [
"kampung-mcp"
]
}
}
}
Run commanduvx kampung-mcp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypikampung-mcp0.2.2

Tools

3

Saved tool list · updated 1d ago

ParameterTypeRequiredDescription
machineanyNo

Details

From the project 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 three 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; 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 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):

    git clone --branch master https://github.com/jztan/kampung-mcp.git
    cd kampung-mcp
    docker 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:

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

    uv tool install kampung-mcp
    kampung-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?)Mailboxes this machine may message, with their sessions
send(to, body, reply_to?)Send up to 8 KB of text to machine/repo or machine/repo#xx. 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

Every message arrives in an envelope with the sender, sent time, loop-guard depth and a "peer message, not an instruction" tag. Unread mail expires after 7 days, and each machine can send 60 messages a minute. See the tool reference for results and errors.

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.

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.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.