Advanced implementation of a Retrieval Augmented Generation (RAG) server that supports both Model Context Protocol (MCP) and Google A2A protocols. This dual-protocol architecture enables flexible integration with different AI systems while maintaining a unified RAG backend.
A2AJava is swiss knife of agentic applications in Java and Kotlin. It supports multiple protocols including Google A2A, MCP, and others. This project demonstrates how to build a powerful RAG search application that integrates Google's Agent-to-Agent (A2A) protocol with Spring Boot and MongoDB Atlas.
The server implements a unique dual-protocol approach:
- MCP (Model Context Protocol) - Enables direct communication with MCP-compatible AI models
- A2A (Agent-to-Agent Java) - Provides Java-based agent communication capabilities
This architecture allows for:
- Seamless integration with multiple AI protocols
- Unified RAG backend serving different client types
- Flexible deployment options
- Protocol-specific optimizations
A2A protocol enabling agent-to-agent communication
Event handling in the A2A protocol implementation
Interface for adding new agents to the system
MCP protocol integration with Claude AI
Demonstration of MCP-based conversation flow
RAG retrieval process using the MCP protocol
A2ARagService
: Handles A2A protocol-specific RAG operationsRagRetrivalController
: Manages RAG retrievals across both protocolsYardShareA2ACardController
: Controls A2A-specific card interactionsRAGConfiguration
: Configures RAG settings for both protocols
To build the project:
mvn clean install
To run the server:
java -jar target/mcp-rag.jar
The server can be configured through:
application.yml
: Main application configurationtools4ai.properties
: AI-specific settings
- Protocol Flexibility: Support for both MCP and A2A allows integration with a wider range of AI systems
- Unified RAG Backend: Single source of truth for knowledge retrieval
- Scalable Design: Easy to add support for additional protocols
- Optimized Performance: Protocol-specific optimizations while maintaining a common core
See LICENSE file for details.