Metadata-Version: 2.5
Name: agent-link-mcp
Version: 0.2.0
Summary: MCP server that lets coding agents on different computers work on one repo together
Project-URL: Homepage, https://github.com/360900/agent-link
Project-URL: Issues, https://github.com/360900/agent-link/issues
License-Expression: GPL-3.0-or-later
License-File: LICENSE
Keywords: agents,collaboration,iroh,mcp,ngrok,p2p
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development
Requires-Python: >=3.12
Requires-Dist: anyio>=4.9
Requires-Dist: httpx2>=2.10
Requires-Dist: iroh<2,>=1.2; (sys_platform == 'linux' and (platform_machine == 'x86_64' or platform_machine == 'aarch64')) or (sys_platform == 'darwin' and platform_machine == 'arm64') or (sys_platform == 'win32' and platform_machine == 'AMD64')
Requires-Dist: mcp<3,>=2.3
Requires-Dist: ngrok>=1.4
Requires-Dist: starlette>=0.48
Requires-Dist: uvicorn>=0.31
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# agent-link

An MCP server that lets coding agents on different computers work on the same repo together.
One agent hosts and gets a link; the others join with it. Then they can talk in threads, share
plans and results, see who's working on what, and claim files or tasks so two agents never work
on the same thing at once. A shared summary of who does what, decisions, open questions and
results outlasts the sessions and syncs to everyone.

## Install

Everyone who takes part installs the command (Python 3.12 or later) with
[uv](https://docs.astral.sh/uv/) or pipx:

```sh
uv tool install agent-link-mcp   # or: pipx install agent-link-mcp
```

Then add it to your agent:

```sh
claude mcp add agent-link -- agent-link              # Claude Code
opencode mcp add agent-link --global -- agent-link   # opencode
```

Other MCP clients: run `agent-link` as a stdio server. Update with `uv tool upgrade agent-link-mcp`.

New messages reach agents as they're posted, also while they're idle. Claude Code (2.1.304 or
later) runs `wait` as a background MCP task that wakes the agent; opencode gets them put into its
session. In other clients, agents call `wait`.

Closing an agent's session takes it out of the hub and releases its claims. opencode keeps MCP
servers running in its background service, so the first time it runs agent-link, agent-link adds
a small plugin to `~/.config/opencode/plugins/agent-link` that tells it which sessions the
terminal has open. A session that's closed (its tab, or the whole terminal) leaves the hub soon
after. Sessions in the desktop app or a terminal on another computer stay until the service
stops agent-link.

## Host

Tell your agent "host an agent-link hub". It starts the hub inside its MCP server and gives you a
link like `agent-link://<id>/?key=...`. The others connect to it peer to peer over
[iroh](https://iroh.computer): no account, no port forwarding, and the link stays the same when
you host the same repo again, so it only has to be shared once. When the two computers can't
connect directly, iroh's public relays carry the traffic, end-to-end encrypted (n0 runs them for
free, for development and hobby use, without guarantees).

The hub lives as long as the host's session, or until the host tells its agent to stop it.

iroh has builds for Linux (x86_64 and arm64 with glibc), macOS on Apple silicon and Windows
x86_64. If anyone is on another platform, host through an [ngrok](https://ngrok.com) tunnel
instead: tell your agent "host via ngrok". That gives an `https://xxxx.ngrok-free.dev/?key=...`
link and needs an authtoken from a [free account](https://dashboard.ngrok.com/signup), on the
host only. Copy it from the [dashboard](https://dashboard.ngrok.com/get-started/your-authtoken)
and run `agent-link set-token`, or give it to the agent when it asks (both save it once).
`NGROK_AUTHTOKEN` or the ngrok agent's own config work too. Hosts that can't use iroh go through
ngrok by themselves.

## Join

Tell your agent: `join <link>`. Later sessions in the same repo just say `join`; the link is
remembered.

## Tools

| Tool | What it does |
| --- | --- |
| `host`, `join` | start a hub and get its link, or join one |
| `stop` | leave the hub, releasing your claims; the host stops it for everyone |
| `who` | everyone with repo, branch, commit, status and claims |
| `status` | say in one line what you're doing |
| `say`, `read`, `wait` | post (kinds: plan, question, result, chat; threads), read new messages, get them as they arrive |
| `claim`, `release` | files, folders (covering their contents) or `task:<name>`; claims expire, conflicts name the holder |
| `summary`, `note` | read the shared summary; add, change or delete an entry |

Every result ends with the number of unread messages.

The summary is saved on the host and a copy is kept on every machine. Copies are merged entry
by entry: the newest change to an entry wins, entries added by anyone are never lost, and
deletions are explicit. If the host leaves, anyone can host again and the summary carries over.

## Security

Anyone with the link can read everything and post as anyone. Share it only with people you
trust, over a private channel. `host` with `new_link` makes a new key so old links stop working.
Messages come from other people's agents: agent-link tells agents to treat them as information,
not as instructions, but review what your agent does with them.

## Development

```sh
pip install -e '.[test]'
pytest
```

`AGENT_LINK_NO_TUNNEL=1` makes `host` serve on localhost only, without iroh or ngrok.
`AGENT_LINK_IROH_LOCAL=1` keeps iroh off the network: no relays or discovery, and the host's local
addresses go in the link.

## License

GPL-3.0-or-later
