API2MCP4J
Spring Boot Starter: Auto-convert existing REST APIs (@RestController) to MCP Server with zero/low-code. Expose controllers as MCP Tools instantly.
What is API2MCP4J?
API2MCP4J is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to spring boot starter: auto-convert existing rest apis (@restcontroller) to mcp server with zero/low-code. expose controllers as mcp tools instantly.
Spring Boot Starter: Auto-convert existing REST APIs (@RestController) to MCP Server with zero/low-code. Expose controllers as MCP Tools instantly.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Spring Boot Starter: Auto-convert existing REST APIs (@RestC
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx api2mcp4jConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use API2MCP4J
Api2Mcp4J is a Spring Boot Starter library that automatically converts existing Java REST controllers into MCP (Model Context Protocol) tools with zero or minimal code changes. By adding a Maven dependency and enabling a configuration flag, every @RestController or @Service method in a Spring Boot application is scanned and exposed as a callable MCP tool, letting AI agents like Claude interact with your backend APIs without building a separate integration layer. It supports multi-source documentation parsing from Swagger/OpenAPI, Javadoc, Spring MVC annotations, and Jackson metadata to generate rich, accurate tool descriptions for AI consumption.
Prerequisites
- Java 17+ and Maven 3.6+ (or Gradle equivalent)
- An existing Spring Boot 3.x application with @RestController beans
- MCP-compatible AI client such as Cursor or Continue for testing
- Basic familiarity with Spring Boot application.yml configuration
Clone and build the starter locally
Since the artifact is not yet on Maven Central, clone the repository and install it to your local Maven repository.
git clone https://github.com/TheEterna/api2mcp4j.git
cd api2mcp4j/server2mcp-starter-webmvc
mvn clean installAdd the Maven dependency to your Spring Boot project
Add the server2mcp-starter-webmvc dependency to your project's pom.xml. Use the version installed in the previous step.
<dependency>
<groupId>com.ai.plug</groupId>
<artifactId>server2mcp-starter-webmvc</artifactId>
<version>1.1.4-SNAPSHOT</version>
</dependency>Enable MCP in application.yml
Add the plugin.mcp configuration block to your application.yml. Set scope to 'interface' to auto-register all controller methods, or use annotations for selective exposure.
plugin:
mcp:
enabled: true
parser:
params: SWAGGER3, SWAGGER2, SpringMVC, JACKSON, TOOL
des: SWAGGER3, SWAGGER2, JAVADOC, TOOL, JACKSON
scope: interfaceStart your Spring Boot application
Launch your application normally. The starter will scan all @RestController beans at startup and register them as MCP tools on the /mcp endpoint.
mvn spring-boot:runConfigure your MCP client to connect
Point your MCP client (e.g. Cursor, Continue) at the running server's MCP endpoint. The server runs on the same port as your Spring Boot app.
{
"mcpServers": {
"api2mcp4j": {
"url": "http://localhost:8080/mcp"
}
}
}API2MCP4J Examples
Client configuration
MCP client config connecting to a locally running Spring Boot app with api2mcp4j enabled on port 8080.
{
"mcpServers": {
"api2mcp4j": {
"url": "http://localhost:8080/mcp"
}
}
}Prompts to try
Example prompts once your Spring Boot controllers are exposed as MCP tools.
- "List all the MCP tools available from this Spring Boot service."
- "Call the createOrder endpoint with product ID 42 and quantity 3."
- "Search for users with the name 'Smith' using the UserController search method."
- "What parameters does the updateInventory tool require?"
- "Run the getProductDetails tool for SKU ABC-123 and summarise the result."Troubleshooting API2MCP4J
Dependency not found in Maven repository
The artifact is a SNAPSHOT not yet published to Maven Central. Run `mvn clean install` inside the cloned api2mcp4j/server2mcp-starter-webmvc directory first, then add the dependency to your project.
No MCP tools registered at /mcp after startup
Confirm `plugin.mcp.enabled: true` is set in application.yml and that `scope` is set to 'interface'. Check the startup logs for lines mentioning MCP tool registration. If using @ToolScan, ensure it is placed on the correct beans.
Tool descriptions are empty or generic
Add Swagger/OpenAPI annotations (@Operation, @Parameter) or Javadoc comments to your controller methods. Set the parser.des property to include SWAGGER3 and JAVADOC so the starter can extract rich descriptions.
Frequently Asked Questions about API2MCP4J
What is API2MCP4J?
API2MCP4J is a Model Context Protocol (MCP) server that spring boot starter: auto-convert existing rest apis (@restcontroller) to mcp server with zero/low-code. expose controllers as mcp tools instantly. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install API2MCP4J?
Follow the installation instructions on the API2MCP4J GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with API2MCP4J?
API2MCP4J works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is API2MCP4J free to use?
Yes, API2MCP4J is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.
API2MCP4J Alternatives — Similar Developer Tools Servers
Looking for alternatives to API2MCP4J? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up API2MCP4J in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use API2MCP4J?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.