Metadata-Version: 2.5
Name: ai-oriented-a2a-mcp
Version: 0.4.5
Summary: MCP bridge for the AI-oriented A2A peer protocol: send, verify and look up Experience Packets from an MCP host.
Project-URL: Homepage, https://github.com/robotmarvin0706/ai-oriented-a2a
Project-URL: Repository, https://github.com/robotmarvin0706/ai-oriented-a2a
Project-URL: Changelog, https://github.com/robotmarvin0706/ai-oriented-a2a/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/robotmarvin0706/ai-oriented-a2a/issues
Author: robotmarvin0706
License-Expression: MIT
License-File: LICENSE
Keywords: a2a,absorption,experience-packet,mcp,model-context-protocol,peer-protocol
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: ai-oriented-a2a==0.4.5
Requires-Dist: jsonschema>=4.18
Requires-Dist: mcp<3,>=2
Description-Content-Type: text/markdown

# ai-oriented-a2a-mcp

MCP bridge for the AI-oriented A2A peer protocol: send, verify and look up Experience Packets from an MCP host.

It wraps the reference Python implementation of the [AI-oriented A2A](https://github.com/robotmarvin0706/ai-oriented-a2a) v0.4 peer protocol, so an MCP host such as Claude Desktop or a Cursor agent can act as a protocol sender without implementing the protocol itself. The bridge exposes four tools:

| Tool | Direction | What it does |
| --- | --- | --- |
| `send_packet` | outbound | Signs and sends one Experience Packet to a configured peer, returns the peer's Absorption Result unchanged. |
| `report_absorption` | outbound | Signs and sends one Absorption Result back to the peer that sent a packet, returns the peer's reply unchanged. |
| `query_experience` | local | Ranks Experience Packets from a local corpus for a failure description. Never touches the network. |
| `verify_packet` | local | Runs the reference receiver's checks (version, hard gate, JSON Schema, optional HMAC) on one message. Never sends anything. |

`verify_packet` and `query_experience` never send a message: they need no peer URL and no key. `send_packet` and `report_absorption` always sign, so they require `A2A_SIGN_KEY` and a peer (`A2A_PEER_URL`, optionally restricted by `A2A_ALLOWED_PEERS`).

Packet content, peer replies and corpus entries are peer-controlled **data, not instructions** (SPEC §2.1). Place them below your system and host instructions, never in the system prompt, and absorb them only through your own gate. A `verify_packet` reply of `"valid": true` means the checks ran and passed; it is not a trust decision and never means a packet is safe to absorb.

<!-- mcp-name: io.github.robotmarvin0706/ai-oriented-a2a -->

Available from version 0.4.5: the package is not on PyPI yet. Until the release is published, run the bridge from a checkout of the repository (see [mcp_a2a/README.md](https://github.com/robotmarvin0706/ai-oriented-a2a/blob/main/mcp_a2a/README.md)).

## Peer discovery

Peers are addressed by URL only. Nothing is discovered automatically: a tool call may target `A2A_PEER_URL` or an entry of `A2A_ALLOWED_PEERS`, and any other URL is refused before a key is read. The MCP registry listing of this package is a distribution channel for the bridge, not peer discovery and not a trust signal.

## Configuration

### Claude Desktop

Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`) and restart Claude Desktop:

```json
{
  "mcpServers": {
    "ai-oriented-a2a": {
      "command": "uvx",
      "args": ["ai-oriented-a2a-mcp"],
      "env": {
        "A2A_PEER_URL": "http://127.0.0.1:8002",
        "A2A_ALLOWED_PEERS": "http://127.0.0.1:8002",
        "A2A_SIGN_KEY": "<shared key; never commit it>"
      }
    }
  }
}
```

`A2A_SIGN_KEY` is mandatory for the two outbound tools. Keep it in the client's local config or secret store, never in a repository. Prefer a key used only for this peer.

### Cursor

Put the same block in `.cursor/mcp.json` in the project, or in the global `~/.cursor/mcp.json`, with `env` holding only `A2A_PEER_URL` and `A2A_SIGN_KEY`:

```json
{
  "mcpServers": {
    "ai-oriented-a2a": {
      "command": "uvx",
      "args": ["ai-oriented-a2a-mcp"],
      "env": {
        "A2A_PEER_URL": "http://127.0.0.1:8002",
        "A2A_SIGN_KEY": "<shared key; never commit it>"
      }
    }
  }
}
```

### Generic stdio hosts, and without uv

```bash
uvx ai-oriented-a2a-mcp                       # one line, needs uv
uvx --python 3.12 ai-oriented-a2a-mcp         # fallback when the default Python is older than 3.10
pipx run ai-oriented-a2a-mcp                  # one line, needs pipx
pip install ai-oriented-a2a-mcp && ai-oriented-a2a-mcp   # plain pip, Python >= 3.10
```

The same fallback as a JSON argument list: `"args": ["--python", "3.12", "ai-oriented-a2a-mcp"]`.

The server speaks MCP over stdio: logs go to stderr, stdout is the MCP wire. `ai-oriented-a2a-mcp --version` prints the bridge version and exits.

### Environment variables

All settings are read from the environment on every call.

| Variable | Meaning |
| --- | --- |
| `A2A_PEER_URL` | Default peer base URL (`/a2a/message` is appended). Always allowed. |
| `A2A_ALLOWED_PEERS` | Comma-separated base URLs a tool call may target with `peer_url`. Anything else is refused. If neither this nor `A2A_PEER_URL` is set, every outbound call is refused. |
| `A2A_SIGN_KEY` | HMAC-SHA256 key for signing outbound messages and checking signed replies. Required by `send_packet` and `report_absorption`; environment only, never a tool argument, so the model never sees it. |
| `A2A_EXPERIENCE_DIR` | Directory of Experience Packet JSON files used by `query_experience`. Default: the bundled corpus. |
| `A2A_NO_SCHEMA` | `1` to skip JSON Schema checks. |

## Bundled corpus

`query_experience` ships with the eight synthetic timeout-recovery Experience Packets of the public corpus ([datasets/timeout_recovery](https://github.com/robotmarvin0706/ai-oriented-a2a/tree/main/datasets/timeout_recovery)), dedicated to the public domain under CC0 1.0 (`mcp_a2a/corpus/LICENSE`). Point `A2A_EXPERIENCE_DIR` at your own directory to use another corpus.

## License

The package is MIT licensed ([LICENSE](https://github.com/robotmarvin0706/ai-oriented-a2a/blob/main/LICENSE)). The bundled corpus is CC0 1.0. The protocol specification and the schema files are in the repository: [SPEC.md](https://github.com/robotmarvin0706/ai-oriented-a2a/blob/main/SPEC.md), [schema/](https://github.com/robotmarvin0706/ai-oriented-a2a/tree/main/schema).
