A2A Registry
Provides a unified registry for discovering and managing agents that implement the A2A (Agent-to-Agent) protocol, enabling registration, querying, and CRUD operations on agent metadata through both REST API and MCP tools.
README
A2A Registry
A Model Context Protocol (MCP) server providing a unified registry for agents implementing the A2A (Agent-to-Agent) protocol. The registry exposes both a REST API and MCP tools for registering, querying, and managing agent metadata.
Features
- Dual API Access: REST API and MCP server running on a single HTTP server
- Intelligent Agent Registration: Automatically fetches AgentCards from URLs using smart routing
- Multiple Storage Backends: JSON file or SQLite database
- Concurrent Access: SSE-based MCP transport allows multiple clients simultaneously
- Full CRUD Operations: Create, read, update, and delete agents
- A2A Protocol Compliant: Uses standard AgentCard model from
@a2a-js/sdk
Installation
npm install
npm run build
Usage
Basic Usage
# Start with default settings (JSON store, port 3000)
npm start
# Or run directly
node dist/index.js
Configuration Options
# Use SQLite storage
node dist/index.js --store=sqlite --file=./agents.db
# Custom port
node dist/index.js --port=4000
# Custom JSON file location
node dist/index.js --store=json --file=./my-agents.json
# Combine options
node dist/index.js --store=sqlite --file=./agents.db --port=4000
CLI Options
| Flag | Values | Description | Default |
|---|---|---|---|
--store |
json, sqlite |
Storage backend | json |
--file |
path | Database or JSON file path | a2a-registry.json or a2a-registry.db |
--port |
number | HTTP server port | 3000 |
--help |
- | Show help message | - |
Using PM2
# Start with PM2
pm2 start ecosystem.config.cjs
# View logs
pm2 logs a2a-registry
# Stop
pm2 stop a2a-registry
# Restart
pm2 restart a2a-registry
API Endpoints
REST API
All REST endpoints are under /agents:
List All Agents
GET /agents
Get Agent by Name
GET /agents/:name
Register New Agent
POST /agents
Content-Type: application/json
{
"url": "https://example.com"
}
The registry will automatically:
- Determine the AgentCard URL using intelligent routing
- Fetch the AgentCard from the URL
- Validate the AgentCard structure
- Store it using the agent's name as the primary key
URL Routing Examples:
https://example.com→ Fetches fromhttps://example.com/.well-known/agent-card.jsonhttps://example.com/my-agent→ Fetches fromhttps://example.com/my-agent/.well-known/agent-card.jsonhttps://cdn.example.com/agent.json→ Fetches directly (URL ends with.json)
Update Agent
PUT /agents/:name
Content-Type: application/json
{
"url": "https://new-url.com" # Optional, re-fetches from existing URL if omitted
}
Delete Agent
DELETE /agents/:name
MCP Server
The MCP server is available at /mcp using SSE (Server-Sent Events) transport.
Config example
{
"mcpServers": {
"a2a-registry": {
"type": "http",
"url": "http://localhost:3005/mcp"
}
}
}
Available MCP Tools
-
a2a_register_agent
- Register a new agent by URL
- Parameters:
{ url: string }
-
a2a_list_agents
- List all registered agents
- Parameters: none
-
a2a_get_agent
- Get agent details by name
- Parameters:
{ name: string }
-
a2a_update_agent
- Update agent by re-fetching AgentCard
- Parameters:
{ name: string, url?: string }
-
a2a_delete_agent
- Delete agent from registry
- Parameters:
{ name: string }
Architecture
┌─────────────────────────────────────────┐
│ REST API │ MCP Server │
│ (HTTP Routes) │ (MCP Tools) │
├─────────────────────┴───────────────────┤
│ AgentService │
│ (Business Logic & Validation) │
├─────────────────────────────────────────┤
│ Store Interface │
│ (Storage Abstraction) │
├─────────────────────────────────────────┤
│ JsonFileStore │ SqliteStore │
│ (Implementations) │
└─────────────────────────────────────────┘
Key Design Principles
- Service Layer Pattern: AgentService encapsulates all business logic
- No Code Duplication: REST and MCP APIs are thin adapters calling AgentService
- Intelligent Registration: Automatic AgentCard discovery and fetching
- Pluggable Storage: Easy to add new storage backends
- Concurrent Access: Stateless SSE transport for MCP
AgentCard Structure
The registry uses the standard AgentCard model from the A2A protocol. Required fields include:
name: Agent name (used as primary key)description: Agent purpose and capabilitiesurl: Primary A2A endpoint URLversion: Agent versioncapabilities: Supported A2A protocol featuresdefaultInputModes: Supported input MIME typesdefaultOutputModes: Supported output MIME typesskills: Agent's distinct capabilities
See the A2A Protocol Specification for complete details.
Development
Project Structure
a2a-registry/
├── src/
│ ├── index.ts # Main entry point
│ ├── types/ # TypeScript type definitions
│ ├── store/ # Storage implementations
│ │ ├── JsonFileStore.ts
│ │ └── SqliteStore.ts
│ ├── services/ # Business logic
│ │ └── AgentService.ts
│ ├── api/ # REST API
│ │ └── restApi.ts
│ ├── mcp/ # MCP server
│ │ └── mcpServer.ts
│ └── utils/ # Utilities
│ └── validation.ts
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── ecosystem.config.cjs # PM2 configuration
Build
npm run build
Development Mode (with auto-reload)
npm run dev
Clean Build
npm run clean
npm run build
Error Handling
The registry provides clear, actionable error messages:
- 404: Agent not found
- 409: Agent already exists (use update instead)
- 400: Invalid URL, fetch failure, or validation error
- 500: Internal server error
All errors include helpful messages to guide next steps.
License
MIT
Contributing
Contributions are welcome! Please ensure:
- Code follows the existing architecture patterns
- All business logic is in AgentService
- APIs are thin adapters
- Tests pass and build succeeds
Support
For issues or questions, please open an issue on GitHub.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。