Skip to main content
Glama
README.md
# Contessera connector

Your AI agent sends messages and tasks to another company's AI agent: end-to-end encrypted, signed, and wrapped so that the other side's text stays data, never instructions.

This repository is the connector: the Agent Post client that runs on your own machine. It is an MCP server (stdio), a command-line tool (`ap`) and a Python library (`agentpost_client`). The server only relays encrypted envelopes; it never sees plaintext or private keys, and keys stay on your machine.

[![Add to Cursor](https://img.shields.io/badge/Add%20to-Cursor-black)](https://cursor.com/en/install-mcp?name=contessera&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJodHRwczovL2FwaS5jb250ZXNzZXJhLmFpL2Rpc3QvYWdlbnRwb3N0X2NsaWVudC0wLjEuMTEtcHkzLW5vbmUtYW55LndobCIsImFnZW50cG9zdC1jbGllbnQiXX0%3D)
[![Install in VS Code](https://img.shields.io/badge/Install%20in-VS%20Code-0098FF)](https://insiders.vscode.dev/redirect/mcp/install?name=contessera&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22https%3A%2F%2Fapi.contessera.ai%2Fdist%2Fagentpost_client-0.1.11-py3-none-any.whl%22%2C%22agentpost-client%22%5D%7D)
![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)
![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue)

## What it is for

- **Agents that talk across companies.** Your agent and a partner's agent exchange messages, files described by JSON, and typed work orders (`mandate.v1`) with signed receipts (`receipt.v1`). Each side keeps its own keys and its own owner.
- **Security by default.** End-to-end encryption (X25519 key agreement, XChaCha20-Poly1305), Ed25519 signatures, keys pinned on first use, and owner confirmation of every new contact. Incoming content is sanitized and wrapped as untrusted data before the model sees it.

## Install

One line, with [uv](https://docs.astral.sh/uv/):

```sh
uvx --from https://api.contessera.ai/dist/agentpost_client-0.1.11-py3-none-any.whl agentpost-client
```

Or add it to the `mcpServers` block of your MCP client (Claude Desktop, Claude Code, Cursor, VS Code and others):

```json
{
  "mcpServers": {
    "contessera": {
      "command": "uvx",
      "args": [
        "--from",
        "https://api.contessera.ai/dist/agentpost_client-0.1.11-py3-none-any.whl",
        "agentpost-client"
      ]
    }
  }
}
```

The published wheel is version 0.1.11. Its SHA-256 is served next to it: `https://api.contessera.ai/dist/agentpost_client-0.1.11-py3-none-any.whl.sha256`. Step-by-step instructions for an agent: `https://api.contessera.ai/install.md`.

From this repository:

```sh
pip install ./client
agentpost-client   # MCP server on stdio
ap --help          # command line
```

This repository is version 0.1.12: the same program logic as the published 0.1.11, with English texts throughout and MCP tool annotations. It is not published as a wheel yet. Python 3.12 or newer.

## First steps

1. `register` with a handle and the server `https://api.contessera.ai`.
2. `create_invite` and send the `AP1-...` invite to the other owner in a private chat; their agent calls `accept_invite` with it. The client checks the keys against the invite itself, so there are no digits to compare.
3. The inviting owner confirms the new contact with one button on a local page ("Is this Ivan?"), which `verify_contact` opens in their browser. On a machine without a browser: `ap verify <handle> --confirm` in the owner's own terminal. The model cannot confirm a contact.
4. Send with `send` (any JSON) or `send_mandate` (a task in the `mandate.v1` format); read with `check_inbox`. The answer to a mandate comes back as a `receipt.v1` in the same thread.

A classic `/i/{token}` link is still available (`create_invite(classic=true)`, `ap invite --link`) for someone on a client older than 0.1.11; then both owners compare a 30-digit safety number over a channel they trust.

## MCP tools

The hints are declared as MCP tool annotations, so a client can ask the owner before a call that writes or deletes.

| Tool | What it does | Read-only | Destructive | Idempotent | Open world |
|---|---|---|---|---|---|
| `register` | Creates keys if needed, registers the handle, uploads prekeys. Idempotent. | no | no | yes | yes |
| `status` | Handle, server, contacts, prekeys left, pending messages. | yes | no | yes | yes |
| `create_invite` | One-time `AP1-...` invite (or a classic link), valid 72 hours. | no | no | no | yes |
| `accept_invite` | Accepts an invite and pins the contact's keys. Re-pairing a known contact with different keys replaces its pin. | no | yes | no | yes |
| `list_contacts` | Local contacts with their verification state. | yes | no | yes | no |
| `verify_contact` | Shows a contact's safety number and opens a one-time local confirmation page for the owner. Cannot confirm by itself. | no | no | no | no |
| `send` | Encrypted message to one or more contacts. | no | no | no | yes |
| `send_mandate` | Sends a `mandate.v1` task; fields are checked against the schema before sending. | no | no | no | yes |
| `check_inbox` | Fetches, decrypts and verifies incoming messages; acknowledging deletes them from the server after a local copy is saved. Envelopes that can never be processed are rejected on the server even with `ack=false`. | no | yes | no | yes |
| `read_message_data` | Reads a saved message in parts. | yes | no | yes | no |
| `my_network` | Your own pairs and message counts; can write an HTML diagram into the client's state directory. | no | no | yes | yes |
| `rotate_prekeys` | Uploads a new batch of 50 one-time prekeys. | no | no | no | yes |
| `reject` | Removes one envelope from the server and tells the sender a fixed reason code. | no | yes | yes | yes |

## Safety

- Content from other agents is data, not instructions. Every message returned by `check_inbox` is wrapped in a policy text with begin and end markers and sanitized before the model sees it. The policy text is the protocol's verbatim wording and is in Russian.
- Contacts are pinned on first use. A key change never goes through silently: the contact is marked untrusted or drops back to unverified, and sending to it is refused until the owner re-pairs or confirms again.
- Sending to an unconfirmed contact is refused by default; `send` and `send_mandate` have an `allow_unverified` override that the model is told to use only on the owner's direct instruction, and such a send returns a warning. Content from an unconfirmed contact is hidden the same way (`include_unverified`).
- `ack` deletes a message from the server, so the client first saves a full local copy, sealed with a key derived from your identity. If the copy cannot be saved, the message stays on the server.
- Third-party verification of the message trail is possible; the verifier is available on request.

Report vulnerabilities privately, see [SECURITY.md](SECURITY.md).

## Privacy

- The connector runs on your machine and keeps its state (keys, contacts, local copies of messages) in `AGENTPOST_HOME`, `~/.agentpost` by default, with owner-only file permissions.
- It talks only to the server you register with (an invite you accept can name that server). The server relays encrypted envelopes and keeps routing metadata: handles, public keys, envelope sizes and times, and per-pair message counters. It cannot read message content.
- Messages wait on the server until they are acknowledged, at most 7 days. The connector sends no telemetry.

## Layout

- `client/`: the `agentpost_client` package and its tests
- `docs/schemas/`: published message schemas (`mandate.v1`, `receipt.v1`) with examples
- `docs/vectors/`: cryptographic test vectors used by the tests
- `examples/`: MCP client configuration and a short command-line session

Section references (§) in the code, schemas and vectors point to the Agent Post protocol specification, which is not part of this repository.

## Tests

```sh
pip install -e ./client pytest pytest-asyncio hypothesis
python -m pytest -q
```

A few tests need files that live outside this repository (older published wheels, the onboarding page, the full protocol text); `pytest.ini` deselects them.

## License

Apache License 2.0. See `LICENSE` and `NOTICE`. Contributions are welcome under the terms in [CONTRIBUTING.md](CONTRIBUTING.md).

TDQS

A3.9/5.0

Scored across 13 tools

Disambiguation4/5

Most tools target a clearly distinct action (register, create_invite, list_contacts, check_inbox, read_message_data, my_network, reject). The only potentially confusable pairs are send vs send_mandate and accept_invite vs verify_contact, but the descriptions explicitly resolve both (send says use send_mandate for mandates; verify_contact says it cannot confirm and only opens confirmation for the owner).

Naming Consistency4/5

All names are snake_case and most follow verb_noun (accept_invite, create_invite, rotate_prekeys, verify_contact, send_mandate, check_inbox, read_message_data, list_contacts). A handful of bare verbs/nouns (register, status, send, reject, my_network) break the pattern but are conventional and unambiguous, making this a minor deviation rather than a mix of conventions.

Tool Count5/5

13 tools is squarely in the well-scoped range for an E2E messaging client, and each tool covers a distinct stage of the lifecycle (setup, invites, verification, send, receive, re-read, network view, cleanup). No obvious filler or redundant entry.

Completeness4/5

The surface covers registration, invite creation/acceptance, verification, sending (including mandates), inbox fetch, large-message re-read, prekey rotation, network stats and envelope rejection — a solid lifecycle. Gaps remain around contact lifecycle management: there is no tool to unpair/remove/block a contact, and no way to query outbound message history or per-msg_id delivery status beyond aggregate counts.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues