
api2mcp4j
by TheEterna
api2mcp4j
Turn your existing Spring Boot REST controllers into MCP (Model Context Protocol) tools — no rewrites, no @Tool everywhere.
<dependency>
<groupId>com.ai.plug</groupId>
<artifactId>server2mcp-starter-webmvc</artifactId>
<version>1.1.4-SNAPSHOT</version>
</dependency>
English · 中文 · Docs · Integration Matrix
Why api2mcp4j?
Most MCP integrations force you to:
- Add
@Tool/@McpToolto every method - Duplicate business logic into a parallel "MCP" code path
- Maintain separate tool descriptions
api2mcp4j scans your existing @RestController beans and exposes their methods as MCP tools — zero changes to business code. Like MyBatis-Plus enhances MyBatis, api2mcp4j enhances Spring AI MCP.
// Your existing controller — unchanged
@RestController
public class OrderController {
@GetMapping("/orders/{id}")
public Order getOrder(@PathVariable Long id) { ... }
}
// Becomes an MCP tool: orders_get_order
// With auto-generated description from Swagger / Javadoc / Spring MVC / Jackson / Spring AI
✨ Key Features
| 🎯 Non-intrusive | interface scope auto-registers all controllers; no @Tool annotation needed |
| 🔍 5-parser chain | Swagger v3 / Swagger v2 / Javadoc / Spring MVC / Jackson / Spring AI — best description wins |
| 🛠️ Full MCP coverage | Tools / Resources / Prompts / Completions / Elicitation / Sampling / Roots |
| 🆕 Protocol 2026-07-28 | Wire schema + JSON-RPC routing + SSE long-poll + MRTR + OTel traceparent — 100% |
| 🔌 Custom parsers | Implement AbstractDesParser / AbstractParamParser, plug into the chain |
| 🧪 TDD discipline | JUnit5, double commit [RED] then [GREEN], 600 tests all green |
| 🚀 Quick start | mvn spring-boot:run → MCP endpoint ready |
🚀 Quick Start (≈ 3 minutes)
1. Clone & build
git clone https://github.com/TheEterna/api2mcp4j.git
cd api2mcp4j
mvn clean install -DskipTests
2. Add to your Spring Boot project
<dependency>
<groupId>com.ai.plug</groupId>
<artifactId>server2mcp-starter-webmvc</artifactId>
<version>1.1.4-SNAPSHOT</version>
</dependency>
3. Configure
plugin:
mcp:
enabled: true
scope: interface # 'interface' = auto-register all controllers; 'custom' = @ToolScan only
parser:
des: SWAGGER3, JAVADOC, TOOL, JACKSON, SWAGGER2
param: MCPTOOL, JAVADOC, TOOL, SpringMVC, JACKSON, SWAGGER2, SWAGGER3
4. Start & test
mvn spring-boot:run
Your MCP server is live on http://localhost:8080/mcp/jsonrpc (and HTTP fallbacks on /mcp/discover, /mcp/tasks, /mcp/sse).
📡 MCP Protocol 2026-07-28 — 100% Compatible
Related servers

n8n
Updated todayby n8n-io
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

mcp-server-git
OfficialUpdated todayA Model Context Protocol server providing tools to read, search, and manipulate Git repositories programmatically via LLMs

mcp-server-fetch
OfficialUpdated todayA Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs