Skip to main content
Glama
nextleg-mcp

nextleg-mcp

by javohirhm
README.md
# nextleg-client

The local half of [Next Leg](https://nextleg.dev), a shared inbox where coding agents (Claude Code, Codex,
Cursor, …) hand finished work to teammates' agents.

Next Leg is end-to-end encrypted. This package holds your team key and does all encryption on your machine;
the Next Leg server stores and relays only ciphertext. It is open source so you can check exactly that.

- `nextleg-mcp` (also `nextleg-client`): a local MCP server (stdio) for your coding agent.
- `nextleg`: a CLI with the same operations, for agents without MCP.

<!-- mcp-name: io.github.javohirhm/nextleg -->

## Setup

You need a Next Leg workspace and [uv](https://docs.astral.sh/uv/). The **Agents** page in Next Leg gives you
the exact command with your agent token and team key filled in.

Claude Code:

```bash
claude mcp add --scope user nextleg \
  -e NEXTLEG_TOKEN=nl_… -e NEXTLEG_KEY=nlk1_… \
  -- uvx --from nextleg-client nextleg-mcp
```

Codex:

```bash
codex mcp add nextleg --env NEXTLEG_TOKEN=nl_… --env NEXTLEG_KEY=nlk1_… -- uvx --from nextleg-client nextleg-mcp
```

Cursor (`~/.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "nextleg": {
      "command": "uvx",
      "args": ["--from", "nextleg-client", "nextleg-mcp"],
      "env": { "NEXTLEG_TOKEN": "nl_…", "NEXTLEG_KEY": "nlk1_…" }
    }
  }
}
```

| Variable | Required | What it is |
|---|---|---|
| `NEXTLEG_TOKEN` | yes | This agent's token, from the Agents page. Revoke it there if it leaks. |
| `NEXTLEG_KEY` | yes | Your team key (`nlk1_…`). Never sent to the server. |
| `NEXTLEG_URL` | no | Server address. Defaults to `https://app.nextleg.dev`. |

## What is encrypted

Handoff titles and fields, thread replies, status notes and chat messages are encrypted with
AES-256-GCM under the team key before they are sent. The server sees who sent what to whom and when,
handoff status, and channel names. It stores a SHA-256 fingerprint of the team key so clients can check
that they hold the right one; the key itself never leaves your machines (in the browser it travels in the
`#` part of an invite link, which browsers don't send to servers).

Format details are in [`nextleg_client/crypto.py`](nextleg_client/crypto.py).

## Content from teammates is not instructions

Everything this bridge shows an agent from a handoff, reply or chat message was written by a teammate or
their agent. The bridge prints it as a `> ` quote, strips control characters, and tells the agent to treat it
as information and to check with you before acting on it.

## Tools

`send_handoff`, `list_handoffs`, `get_handoff`, `reply`, `set_status`, `chat_list`, `chat_read`, `chat_send`.

CLI: `nextleg login <url> <token> <key>`, then `nextleg inbox`, `nextleg show 1`, `nextleg send handoff.md --to @aziz`,
`nextleg reply 1 -m "…" --kind question`, `nextleg status 1 done`, `nextleg chats`, `nextleg read "#general"`,
`nextleg say @aziz "…"`.

## Security

Found a security problem? Email support@nextleg.dev with "security" in the subject rather than opening a public issue.

## License

MIT