A2a catalog closes #298 #792
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A2A (Agent-to-Agent) Catalog Implementation
Closes #298
🎯 Overview
Implemented a comprehensive A2A (Agent-to-Agent) catalog system for the MCP Gateway, enabling registration and management of external AI agents (OpenAI, Anthropic, custom) and exposing them as MCP tools for seamless integration.
🚀 Features Implemented
Core Infrastructure
A2AAgent
andA2AAgentMetric
models with full SQLAlchemy relationshipsA2AAgentCreate/Update/Read
,A2AAgentMetrics
,A2AAgentInvocation
)A2AAgentService
including agent invocation and metricsAPI Integration
/a2a
API with all CRUD operations:GET/POST /a2a
- List and create agentsGET/PUT/DELETE /a2a/{agent_id}
- Individual agent operationsPOST /a2a/{agent_id}/toggle
- Status managementPOST /a2a/{agent_name}/invoke
- Direct agent invocation/metrics
endpointsAdmin UI
Protocol Support
Configuration & Security
MCPGATEWAY_A2A_ENABLED
- Master switchMCPGATEWAY_A2A_MAX_AGENTS
- Capacity controlMCPGATEWAY_A2A_DEFAULT_TIMEOUT
- Performance tuningMCPGATEWAY_A2A_MAX_RETRIES
- Reliability settingsMCPGATEWAY_A2A_METRICS_ENABLED
- Observability controlMonitoring & Observability
Virtual Server Integration
associated_a2a_agents
🔧 Technical Implementation Details
Database Schema
Key Service Methods
register_agent()
- Register new A2A agent with validationlist_agents()
- List agents with filtering and paginationget_agent()
/get_agent_by_name()
- Retrieve specific agentsupdate_agent()
- Update agent configurationtoggle_agent_status()
- Enable/disable agentsdelete_agent()
- Remove agentsinvoke_agent()
- Call external agents with protocol detectionaggregate_metrics()
- Performance metrics aggregationProtocol Detection Logic
📁 Files Modified/Created
Core Backend Files
mcpgateway/db.py
- Added A2A database models and relationshipsmcpgateway/schemas.py
- Added A2A Pydantic schemas and validationmcpgateway/main.py
- Added A2A router, service initialization, and metrics integrationmcpgateway/config.py
- Added A2A configuration optionsmcpgateway/services/a2a_service.py
- NEW - Complete A2A service implementationmcpgateway/services/server_service.py
- Added A2A agent association supportmcpgateway/services/tool_service.py
- Added A2A tool creation and invocation supportAdmin UI & Frontend
mcpgateway/admin.py
- Added A2A admin routes and handlersmcpgateway/templates/admin.html
- Added A2A tab, forms, and agent displaymcpgateway/static/admin.js
- Added A2A test functionality and tab supportDatabase Migration
mcpgateway/alembic/versions/add_a2a_agents_and_metrics.py
- NEW - Database migrationDocumentation
README.md
- Added A2A features to overview and API documentationCLAUDE.md
- Added A2A configuration and usage documentation.env.example
- Added A2A environment variable examplesdocs/docs/using/agents/a2a.md
- NEW - Complete A2A usage guidedocs/docs/using/agents/index.md
- Added A2A integration overviewdocs/docs/overview/tags.md
- Added A2A agents to taggable entitiesTesting
tests/unit/mcpgateway/services/test_a2a_service.py
- NEW - A2A service teststests/unit/mcpgateway/test_main.py
- Updated metrics tests for A2A integrationtests/e2e/test_admin_apis.py
- Updated for A2A environment configurationtests/unit/mcpgateway/test_ui_version.py
- Updated for A2A compatibility🧪 Testing & Verification
Manual Testing Verified
http://localhost:4444/admin#a2a-agents
)API Testing Verified
Test Results
🔍 Code Quality
Linting & Standards
make lint-web
passes)Performance Considerations
📊 Real-World Results
Successfully tested with actual A2A agent:
http://localhost:9999
message/send
methodExecutions: 2 | Success Rate: 100.0%
🔄 Integration Patterns
A2A Agent as MCP Tool Workflow
Supported Agent Types
🎛️ Configuration Examples
Environment Variables
Agent Configuration
🎉 Impact & Benefits
For Users
For Developers
For Operations
🔗 Related Issues/Features
This implementation enables:
✅ Acceptance Criteria Met
🚀 Ready for Production
The A2A catalog system is fully implemented, tested, and documented. It provides a complete solution for integrating external AI agents into the MCP Gateway ecosystem with enterprise-grade features including security, monitoring, and configuration control.
Status: ✅ COMPLETE AND OPERATIONAL