SpringActions
Integrate your Spring Boot applications with Google's A2A Protocol
Install / Use
/learn @vishalmysore/SpringActionsREADME
Spring Actions - A2A & MCP Integration Framework
Overview
Integrate your Spring Boot applications with Google's A2A Protocol and Anthropic's Model Context Protocol (MCP) using a2ajava. This integration allows any Spring bean to be exposed as an AI-actionable service—no need for extra annotations or custom wiring.
A2AJava is the Java implementation of the Google A2A protocol you can check the project here .
Live Demo of this server is available here
This server exposes spring bean actions as A2A and MCP tools, allowing AI agents to discover and interact with them seamlessly. You can integrate this with Claude Desktop client or VS client or a2a client or simple rest client
What is A2A?
A2A (Agent-to-Agent) is Google's protocol that enables AI agents to discover and interact with services through a standardized format. It makes services discoverable and executable by AI systems.
What is MCP?
MCP (Model Context Protocol) is Anthropic's specification for enabling structured interactions between AI models and external tools/services. It provides a standardized way to define tool interfaces that can be called by AI models, with features like runtime type validation and standardized error handling.
Google A2A Integration with Spring Boot
Integrate your Spring Boot applications with Google's A2A Protocol using a2ajava. This integration allows any Spring bean to be exposed as an AI-actionable service—no need for extra annotations or custom wiring.
✅ Key Features
- Auto-discovery of Spring Beans as A2A Actions
- Built-in support for prompt-based execution
- Zero boilerplate integration using @Agent and @Action annotations
- Ideal for building intelligent microservices and AI-enhanced APIs
Example: Compare Two Cars with AI-Driven Spring Bean
@Service
@Log
@Agent(groupName ="compareCar", groupDescription = "Provide 2 cars and compare them", prompt = "You are an expert car reviewer. You will be given 2 car names and you have to compare them and tell which one is better and why.")
public class CompareCarService implements A1uiAware, ProcessorAware {
public CompareCarService() {
log.info("created compare car service");
}
private ActionCallback callback;
@Action(description = "compare 2 cars", prompt = "You will be given 2 car names and you have to compare them and tell which one is better and why.")
public String compareCar(String car1 , String car2) {
log.info(car2);
log.info(car1);
// implement the comparison logic here
if((callback!= null) && (callback.getType().equals(CallBackType.A2A.name()))) {
log.info("callback is not null");
((Task) callback.getContext()).setDetailedAndMessage(TaskState.COMPLETED, "I compared the car and this is better "+car2 );
}
return " this is better - "+car2;
}
}
- A2A card will be available here http://localhost:7860/.well-known/agent.json
- MCP Tools can be integrated to claude desktop via passthrough server connector
or you can use curl command to get the list of MCP tools
curl -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 1
}' http://localhost:7860/
use curl command to call a specific tool
{
"method": "tools/call",
"params": {
"name": "whatThisPersonFavFood",
"arguments": {
"provideAllValuesInPlainEnglish": "vishal is coming home what should i cook"
}
},
"jsonrpc": "2.0",
"id": 17
}
curl -v -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "tasks/send",
"params": {
"id": "999789",
"sessionId": "sdf44555",
"message": {
"role": "user",
"parts": [
{
"type": "text",
"text": "should i buy honda or fiat.",
"metadata": null
}
]
}
}
}' https://vishalmysore-a2amcpspring.hf.space/
📝 set up
mvn clean install
and then
mvn spring-boot:run
Screenshots
add agets to the ui

chatting with agent

events being generated

multiple agents in same ui

