|
| 1 | +# agentcard-mcp |
| 2 | + |
| 3 | +> **AgentCard v1.0 identity layer for agent-to-agent (A2A) communication.** |
| 4 | +> Give any Claude / LLM agent a machine-readable identity using the open [AgentCard](https://github.com/kwailapt/AgentCard) standard. |
| 5 | +
|
| 6 | +[](../../LICENSE) |
| 7 | +[](https://modelcontextprotocol.io) |
| 8 | +[](https://github.com/kwailapt/AgentCard) |
| 9 | + |
| 10 | +## What is AgentCard? |
| 11 | + |
| 12 | +AgentCard is to A2A communication what HTTP headers are to the web: |
| 13 | +a standardised, machine-parseable capability declaration that works |
| 14 | +with any framework (LangChain, CrewAI, AutoGen, MCP, custom). |
| 15 | + |
| 16 | +```json |
| 17 | +{ |
| 18 | + "agent_id": "01HZQK3P8EMXR9V7T5N2W4J6C0", |
| 19 | + "name": "WebSearchAgent", |
| 20 | + "version": "1.0.0", |
| 21 | + "capabilities": [ |
| 22 | + {"id": "web.search", "description": "Search the web for current information."}, |
| 23 | + {"id": "web.scrape", "description": "Extract content from web pages."} |
| 24 | + ], |
| 25 | + "endpoint": { |
| 26 | + "protocol": "https", |
| 27 | + "url": "https://my-agent.example.com/api" |
| 28 | + }, |
| 29 | + "pricing": { |
| 30 | + "base_cost_joules": 2.854e-21 |
| 31 | + } |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +## Installation |
| 36 | + |
| 37 | +```bash |
| 38 | +pip install agentcard-mcp |
| 39 | +``` |
| 40 | + |
| 41 | +## Quick Start — Claude Desktop |
| 42 | + |
| 43 | +Add to `~/Library/Application Support/Claude/claude_desktop_config.json`: |
| 44 | + |
| 45 | +```json |
| 46 | +{ |
| 47 | + "mcpServers": { |
| 48 | + "agentcard": { |
| 49 | + "command": "python", |
| 50 | + "args": ["-m", "agentcard_mcp"] |
| 51 | + } |
| 52 | + } |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +Then restart Claude Desktop and ask: |
| 57 | + |
| 58 | +> *"Register my identity as a code assistant using AgentCard."* |
| 59 | +
|
| 60 | +## Tools |
| 61 | + |
| 62 | +### `agentcard_declare` |
| 63 | +Register your AgentCard identity for this session. |
| 64 | + |
| 65 | +``` |
| 66 | +Input: card_json (string) — JSON conforming to AgentCard v1.0 schema. |
| 67 | +
|
| 68 | +Required fields: |
| 69 | + agent_id — 26-char Crockford Base32 ULID (e.g. 01HZQK3P8EMXR9V7T5N2W4J6C0) |
| 70 | + name — Display name (1–128 chars) |
| 71 | + version — Semantic version (e.g. "1.0.0") |
| 72 | + capabilities — Array with ≥1 entry, each with dot-namespaced "id" |
| 73 | + endpoint — { "protocol": "https"|"http"|"grpc"|"stdio"|"mcp", "url": "..." } |
| 74 | +``` |
| 75 | + |
| 76 | +### `agentcard_resolve` |
| 77 | +Look up a registered agent's AgentCard by name or agent_id. |
| 78 | + |
| 79 | +``` |
| 80 | +Input: query (string) — partial name (case-insensitive) or exact 26-char ULID. |
| 81 | +``` |
| 82 | + |
| 83 | +### `agentcard_validate` |
| 84 | +Validate any JSON against the AgentCard v1.0 schema. |
| 85 | + |
| 86 | +Checks: |
| 87 | +- 26-char Crockford Base32 ULID format |
| 88 | +- Semver 2.0 version string |
| 89 | +- Dot-namespaced capability ids (`^[a-z0-9][a-z0-9._-]*$`) |
| 90 | +- Landauer floor physics check on pricing (`base_cost_joules ≥ 2.854e-21 J`) |
| 91 | + |
| 92 | +### `agentcard_list` |
| 93 | +List all AgentCards registered in this session. |
| 94 | + |
| 95 | +## Resources |
| 96 | + |
| 97 | +| URI | Description | |
| 98 | +|-----|-------------| |
| 99 | +| `agentcard://schema` | Canonical AgentCard v1.0 JSON Schema | |
| 100 | +| `agentcard://registry` | All declared cards as JSON array | |
| 101 | + |
| 102 | +## Usage Examples |
| 103 | + |
| 104 | +### Declare an identity |
| 105 | +``` |
| 106 | +User: Register my identity as a data analysis agent. |
| 107 | +
|
| 108 | +Claude uses agentcard_declare({ |
| 109 | + "agent_id": "01HZQK3P8EMXR9V7T5N2W4J6C0", |
| 110 | + "name": "DataAnalysisAgent", |
| 111 | + "version": "1.0.0", |
| 112 | + "capabilities": [ |
| 113 | + {"id": "data.analyze", "description": "Analyze datasets and produce insights."}, |
| 114 | + {"id": "data.visualize", "description": "Create charts and visualizations."} |
| 115 | + ], |
| 116 | + "endpoint": {"protocol": "mcp", "url": "mcp://claude-desktop/data-agent"} |
| 117 | +}) |
| 118 | +→ ✓ AgentCard declared — agent_id=01HZQK3P8EMXR9V7T5N2W4J6C0, name='DataAnalysisAgent', capabilities=2 |
| 119 | +``` |
| 120 | + |
| 121 | +### Validate a peer's card |
| 122 | +``` |
| 123 | +User: Is this AgentCard valid? [paste JSON] |
| 124 | +
|
| 125 | +Claude uses agentcard_validate(card_json) |
| 126 | +→ VALID ✓ |
| 127 | + agent_id : 01HZQK3P8EMXR9V7T5N2W4J6C0 |
| 128 | + capabilities: 2 — [data.analyze, data.visualize] |
| 129 | + endpoint : mcp://claude-desktop/data-agent |
| 130 | +``` |
| 131 | + |
| 132 | +### Resolve a peer agent |
| 133 | +``` |
| 134 | +User: What can the researcher agent do? |
| 135 | +
|
| 136 | +Claude uses agentcard_resolve("researcher") |
| 137 | +→ { "agent_id": "...", "capabilities": [...], ... } |
| 138 | +``` |
| 139 | + |
| 140 | +## AgentCard Schema Highlights |
| 141 | + |
| 142 | +| Field | Type | Description | |
| 143 | +|-------|------|-------------| |
| 144 | +| `agent_id` | string | 26-char Crockford Base32 ULID — globally unique | |
| 145 | +| `name` | string | Display name 1–128 chars | |
| 146 | +| `version` | string | Semantic version (semver 2.0) | |
| 147 | +| `capabilities[].id` | string | Dot-namespaced (`web.search`, `tool.python`) | |
| 148 | +| `endpoint.protocol` | enum | `http`, `https`, `grpc`, `stdio`, `mcp` | |
| 149 | +| `pricing.base_cost_joules` | float | ≥ Landauer floor (2.854e-21 J) or 0 | |
| 150 | +| `metadata.pacr:trust_tier` | enum | `untrusted \| basic \| established \| verified \| banned` | |
| 151 | + |
| 152 | +Full schema: [`agentcard://schema`](../../schema.json) |
| 153 | + |
| 154 | +## Framework Adapters |
| 155 | + |
| 156 | +| Framework | Package | Import | |
| 157 | +|-----------|---------|--------| |
| 158 | +| LangChain | `pip install agentcard-adapters[langchain]` | `from agentcard_adapters import tool_to_agentcard` | |
| 159 | +| CrewAI | `pip install agentcard-adapters[crewai]` | `from agentcard_adapters import agent_to_agentcard` | |
| 160 | +| AutoGen | `pip install agentcard-adapters[autogen]` | `from agentcard_adapters.autogen_adapter import agent_to_agentcard` | |
| 161 | + |
| 162 | +## Development |
| 163 | + |
| 164 | +```bash |
| 165 | +pip install -e ".[dev]" |
| 166 | +pytest tests/ |
| 167 | +``` |
| 168 | + |
| 169 | +## License |
| 170 | + |
| 171 | +Apache 2.0 + CC-BY 4.0 (spec). |
| 172 | +Patent non-reservation: [NOTICE](../../NOTICE). |
| 173 | + |
| 174 | +## References |
| 175 | + |
| 176 | +- [AgentCard Specification](https://github.com/kwailapt/AgentCard) |
| 177 | +- [JSON Schema](https://github.com/kwailapt/AgentCard/blob/main/schema.json) |
| 178 | +- [Model Context Protocol](https://modelcontextprotocol.io) |
0 commit comments