ai-oriented-a2a-mcp 0.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: ai-oriented-a2a-mcp
3
+ Version: 0.4.5
4
+ Summary: MCP bridge for the AI-oriented A2A peer protocol: send, verify and look up Experience Packets from an MCP host.
5
+ Project-URL: Homepage, https://github.com/robotmarvin0706/ai-oriented-a2a
6
+ Project-URL: Repository, https://github.com/robotmarvin0706/ai-oriented-a2a
7
+ Project-URL: Changelog, https://github.com/robotmarvin0706/ai-oriented-a2a/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/robotmarvin0706/ai-oriented-a2a/issues
9
+ Author: robotmarvin0706
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: a2a,absorption,experience-packet,mcp,model-context-protocol,peer-protocol
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: ai-oriented-a2a==0.4.5
23
+ Requires-Dist: jsonschema>=4.18
24
+ Requires-Dist: mcp<3,>=2
25
+ Description-Content-Type: text/markdown
26
+
27
+ # ai-oriented-a2a-mcp
28
+
29
+ MCP bridge for the AI-oriented A2A peer protocol: send, verify and look up Experience Packets from an MCP host.
30
+
31
+ 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:
32
+
33
+ | Tool | Direction | What it does |
34
+ | --- | --- | --- |
35
+ | `send_packet` | outbound | Signs and sends one Experience Packet to a configured peer, returns the peer's Absorption Result unchanged. |
36
+ | `report_absorption` | outbound | Signs and sends one Absorption Result back to the peer that sent a packet, returns the peer's reply unchanged. |
37
+ | `query_experience` | local | Ranks Experience Packets from a local corpus for a failure description. Never touches the network. |
38
+ | `verify_packet` | local | Runs the reference receiver's checks (version, hard gate, JSON Schema, optional HMAC) on one message. Never sends anything. |
39
+
40
+ `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`).
41
+
42
+ 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.
43
+
44
+ <!-- mcp-name: io.github.robotmarvin0706/ai-oriented-a2a -->
45
+
46
+ 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)).
47
+
48
+ ## Peer discovery
49
+
50
+ 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.
51
+
52
+ ## Configuration
53
+
54
+ ### Claude Desktop
55
+
56
+ Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`) and restart Claude Desktop:
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "ai-oriented-a2a": {
62
+ "command": "uvx",
63
+ "args": ["ai-oriented-a2a-mcp"],
64
+ "env": {
65
+ "A2A_PEER_URL": "http://127.0.0.1:8002",
66
+ "A2A_ALLOWED_PEERS": "http://127.0.0.1:8002",
67
+ "A2A_SIGN_KEY": "<shared key; never commit it>"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ `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.
75
+
76
+ ### Cursor
77
+
78
+ 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`:
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "ai-oriented-a2a": {
84
+ "command": "uvx",
85
+ "args": ["ai-oriented-a2a-mcp"],
86
+ "env": {
87
+ "A2A_PEER_URL": "http://127.0.0.1:8002",
88
+ "A2A_SIGN_KEY": "<shared key; never commit it>"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ### Generic stdio hosts, and without uv
96
+
97
+ ```bash
98
+ uvx ai-oriented-a2a-mcp # one line, needs uv
99
+ uvx --python 3.12 ai-oriented-a2a-mcp # fallback when the default Python is older than 3.10
100
+ pipx run ai-oriented-a2a-mcp # one line, needs pipx
101
+ pip install ai-oriented-a2a-mcp && ai-oriented-a2a-mcp # plain pip, Python >= 3.10
102
+ ```
103
+
104
+ The same fallback as a JSON argument list: `"args": ["--python", "3.12", "ai-oriented-a2a-mcp"]`.
105
+
106
+ 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.
107
+
108
+ ### Environment variables
109
+
110
+ All settings are read from the environment on every call.
111
+
112
+ | Variable | Meaning |
113
+ | --- | --- |
114
+ | `A2A_PEER_URL` | Default peer base URL (`/a2a/message` is appended). Always allowed. |
115
+ | `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. |
116
+ | `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. |
117
+ | `A2A_EXPERIENCE_DIR` | Directory of Experience Packet JSON files used by `query_experience`. Default: the bundled corpus. |
118
+ | `A2A_NO_SCHEMA` | `1` to skip JSON Schema checks. |
119
+
120
+ ## Bundled corpus
121
+
122
+ `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.
123
+
124
+ ## License
125
+
126
+ 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).
@@ -0,0 +1,24 @@
1
+ mcp_a2a/__init__.py,sha256=lMgDxozbNurLaGvJHFWvqVkugprPYbdf8W89Z9dA5lU,2753
2
+ mcp_a2a/lookup.py,sha256=1asWFPxCrT73Gq6k01CiSk7NP_NptR4HiIu084OPTLc,9716
3
+ mcp_a2a/server.py,sha256=ikdGaHBAuZfQpIQTpY94EJKYYouuBHCp1RPwLnpulRM,14179
4
+ mcp_a2a/_second_impl/__init__.py,sha256=j903MOdOTbqtJPuZ_B-tFtNt89ltjcTrmkmpEAVh8Vg,223
5
+ mcp_a2a/_second_impl/a2a_core.py,sha256=UjXbUbqQOg9er07KLEciF04lvVgouJxTTQ2NvgPEv_0,28633
6
+ mcp_a2a/_second_impl/minimal_client.py,sha256=k6_gLNSeiEv9UBqGTNqJKAahxyCR8QDjkywZdHuQXWY,15266
7
+ mcp_a2a/corpus/LICENSE,sha256=cwpNVOoD7voca_jRJHDBDQ3B0UUSPCDGJxb9zfD8ruQ,691
8
+ mcp_a2a/corpus/pkt-synth-timeout-001.json,sha256=kYyw-zptJbdzLN0PJcZGC2SkhRorobsZTHZimtVLWUw,734
9
+ mcp_a2a/corpus/pkt-synth-timeout-002.json,sha256=fA7OhGtSHee_ni74DLDb2ogzbz5AIqilJsHNf874KHQ,1137
10
+ mcp_a2a/corpus/pkt-synth-timeout-003.json,sha256=oEH9yVGD3Pv5cgcOtZw1yDrkqowahfeLrdstuvzrSrY,1093
11
+ mcp_a2a/corpus/pkt-synth-timeout-004.json,sha256=qiyVz1YkD1OW9671Je3FdDZghckb5teml019KIya8u4,1152
12
+ mcp_a2a/corpus/pkt-synth-timeout-005.json,sha256=K3GAKW6IrT8Vjxyal-NYDQCegUcZQ7LAVXGzjAzOtU0,1013
13
+ mcp_a2a/corpus/pkt-synth-timeout-006.json,sha256=qBalG1ZB58r24PQknJDb8lB3zbYVQP-IJ4ZS_5Vl5Ew,1102
14
+ mcp_a2a/corpus/pkt-synth-timeout-007.json,sha256=FZRQSA5YYlMJB-cohEl8aMCydW1wU9fv2Q6aMsCOm2k,1215
15
+ mcp_a2a/corpus/pkt-synth-timeout-008.json,sha256=I_FCGggm5FtN0Gbnf2DWV1tBM7ESsXR4v4Zq3lfZ20I,1303
16
+ mcp_a2a/schema/absorption-result.schema.json,sha256=tBKVxi2I4BZ-tgQ0EbXPWtEHfg0yiNX4z49YHC-1gJo,2185
17
+ mcp_a2a/schema/agent-profile.schema.json,sha256=yPwf-aPd5ayIGpKBzvt5ieVsaRDp4vbvACbHKRQpAX4,2442
18
+ mcp_a2a/schema/experience-packet.schema.json,sha256=QDLxLheKaEvQHvLOXBer-BfNwSq78a2u2v0Y2xVrvCU,3946
19
+ mcp_a2a/schema/negotiation.schema.json,sha256=4hz1WFuEEq_wR7wi6YP5cJ94dQwBkbrXPvNrYFvrxys,7377
20
+ ai_oriented_a2a_mcp-0.4.5.dist-info/METADATA,sha256=gvQ5_FK0fpBChCwG9G4XicZH64ilSo41DoEClHyK-ys,6856
21
+ ai_oriented_a2a_mcp-0.4.5.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
22
+ ai_oriented_a2a_mcp-0.4.5.dist-info/entry_points.txt,sha256=naXWe_IdoJjbi3E6m4dUqb1Ei_U4aIIEqs-bJ8t3qzE,60
23
+ ai_oriented_a2a_mcp-0.4.5.dist-info/licenses/LICENSE,sha256=FeprKLCdcmoSMntfQoHoHvKyatQb6kDsZN2KdWKddYo,1072
24
+ ai_oriented_a2a_mcp-0.4.5.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ai-oriented-a2a-mcp = mcp_a2a.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 robotmarvin0706
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mcp_a2a/__init__.py ADDED
@@ -0,0 +1,70 @@
1
+ """MCP bridge to AI-oriented A2A v0.4 peers (outbound messages and a local lookup). See README.md.
2
+
3
+ Importing the package does not import the MCP SDK; ``mcp_a2a.server`` does.
4
+ ``mcp_unavailable_reason()`` tells callers (and the tests) whether the
5
+ installed SDK satisfies ``MCP_REQUIREMENT`` without importing it.
6
+
7
+ Outbound signing is mandatory: ``require_sign_key()`` raises ``MissingSignKey``
8
+ when ``A2A_SIGN_KEY`` is unset or blank, so the bridge never sends an unsigned
9
+ message. The key is read from the environment only, never from a tool argument.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import os
15
+ import re
16
+ import sys
17
+ from typing import Dict, Optional
18
+
19
+ #: Environment variable holding the HMAC-SHA256 key for outbound messages.
20
+ SIGN_KEY_ENV = "A2A_SIGN_KEY"
21
+
22
+
23
+ class MissingSignKey(ValueError):
24
+ """``A2A_SIGN_KEY`` is unset or blank; the bridge refuses to send unsigned."""
25
+
26
+ # Same bound as the ``mcp`` extra in pyproject.toml.
27
+ MCP_REQUIREMENT = "mcp>=2,<3"
28
+ MCP_MIN_MAJOR = 2
29
+ MCP_MAX_MAJOR_EXCLUSIVE = 3
30
+
31
+
32
+ def mcp_unavailable_reason() -> Optional[str]:
33
+ """None when an ``mcp`` SDK in ``MCP_REQUIREMENT`` is installed, else why not."""
34
+ if sys.version_info < (3, 10):
35
+ return f"the MCP bridge needs Python >= 3.10 (running {sys.version_info[0]}.{sys.version_info[1]})"
36
+ try:
37
+ from importlib.metadata import PackageNotFoundError, version
38
+ except ImportError: # pragma: no cover - Python < 3.8
39
+ return "importlib.metadata unavailable"
40
+ try:
41
+ installed = version("mcp")
42
+ except PackageNotFoundError:
43
+ return f"mcp is not installed (needs {MCP_REQUIREMENT})"
44
+ m = re.match(r"\s*(\d+)", installed)
45
+ if m is None:
46
+ return f"mcp {installed} has an unreadable version (needs {MCP_REQUIREMENT})"
47
+ major = int(m.group(1))
48
+ if not MCP_MIN_MAJOR <= major < MCP_MAX_MAJOR_EXCLUSIVE:
49
+ return f"mcp {installed} is installed but the bridge needs {MCP_REQUIREMENT}"
50
+ return None
51
+
52
+
53
+ def require_sign_key(environ: Optional[Dict[str, str]] = None) -> str:
54
+ """The HMAC-SHA256 key for outbound messages, or ``MissingSignKey``.
55
+
56
+ There is no unsigned fallback: a bridge that silently drops the signature
57
+ would let a misconfigured host send unauthenticated Experience Packets,
58
+ which is exactly what SPEC §2.1 and docs/SECURITY.md warn about.
59
+ """
60
+ env = os.environ if environ is None else environ
61
+ key = (env.get(SIGN_KEY_ENV) or "").strip()
62
+ if not key:
63
+ raise MissingSignKey(
64
+ f"{SIGN_KEY_ENV} is not set: the MCP bridge signs every outbound message and "
65
+ "refuses to send unsigned ones"
66
+ )
67
+ return key
68
+
69
+
70
+ __all__ = ["MCP_REQUIREMENT", "MissingSignKey", "SIGN_KEY_ENV", "mcp_unavailable_reason", "require_sign_key"]
@@ -0,0 +1,5 @@
1
+ """Independent second implementation of the AI-oriented A2A peer protocol (v0.4).
2
+
3
+ Written from SPEC.md and docs/TRANSPORT.md only. It does not import
4
+ ``ai_oriented_a2a`` or anything under ``examples/``. See README.md.
5
+ """