api2mcp4j
by TheEterna·★ 102·Score 47
Spring Boot starter that automatically converts REST APIs to MCP servers with zero to low code.
Overview
api2mcp4j is an innovative Spring Boot extension that enables developers to expose existing REST APIs as MCP tools without extensive code changes. The project automatically scans @RestController and @Service beans, leveraging information from Swagger/OpenAPI, Javadoc, and Spring MVC metadata to generate MCP tool definitions. This non-intrusive approach allows for quick integration of AI capabilities into existing Java applications while maintaining business logic integrity. The project supports custom annotations for fine-grained control and is compatible with the latest MCP Java SDK features including callbacks, resources, and prompts.
Try asking AI
After installing, here are 6 things you can ask your AI assistant:
When to choose this
Choose api2mcp4j when you have existing Spring Boot REST APIs that you want to expose as MCP tools without refactoring your business logic.
When NOT to choose this
Don't choose this if you need a stable, published artifact (currently only available as a build from source) or if you're not using Spring Boot.
Tools this server exposes
4 tools extracted from the READMEauto-discover_controllersvoid discoverControllers()Automatically scans and registers all controller methods as MCP tools
parse_swaggervoid parseSwagger(String apiPath)Parse Swagger/OpenAPI documentation to generate MCP tool descriptions
parse_javadocvoid parseJavadoc(String sourcePath)Extract Java documentation comments for tool descriptions
configure_mcp_servervoid configureMcpServer(Config config)Configure MCP server with custom settings and parser combinations
Note: Tool names were inferred from the features described in the README, as actual tool names weren't explicitly listed. The server exposes automatic discovery and parsing capabilities rather than specific named tools.
Comparable tools
Installation
Installation
- Clone and build the project:
git clone https://github.com/TheEterna/api2mcp4j.git
cd api2mcp4j/server2mcp-starter-webmvc
mvn clean install- Add dependency to your pom.xml:
<dependency>
<groupId>com.ai.plug</groupId>
<artifactId>server2mcp-starter-webmvc</artifactId>
<version>1.1.4-SNAPSHOT</version>
</dependency>- Enable in application.yml:
plugin:
mcp:
enabled: true
parser:
params: SWAGGER3, SWAGGER2, SpringMVC, JACKSON, TOOL
des: SWAGGER3, SWAGGER2, JAVADOC, TOOL, JACKSON
scope: interface- Start your application and test with any MCP client
FAQ
- What is the main advantage of api2mcp4j over traditional MCP implementations?
- The main advantage is zero to low code integration - it automatically converts existing REST APIs to MCP tools without requiring manual @Tool annotations or code refactoring.
- Does api2mcp4j support all Spring Boot versions?
- api2mcp4j is designed for Spring Boot 3.x and requires Java 17 or higher for compatibility.
- Can I combine multiple parsers for better tool descriptions?
- Yes, the project supports combining multiple parsers including Swagger/OpenAPI, Javadoc, Spring MVC metadata, Jackson, and custom annotations for comprehensive tool descriptions.
Compare api2mcp4j with
Last updated · Auto-generated from public README + GitHub signals.