API2MCP4J

v1.0.0Developer Toolsstable

Spring Boot Starter: Auto-convert existing REST APIs (@RestController) to MCP Server with zero/low-code. Expose controllers as MCP Tools instantly.

agentaiframeworkjavamaven
Share:
102
Stars
0
Downloads
0
Weekly
0/5

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

REST API to MCP conversion
Spring Boot auto-conversion
Zero-code MCP server creation
TheEterna

Maintainer

LicenseApache-2.0
Languagejava
Versionv1.0.0
UpdatedMay 14, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx api2mcp4j

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 install
2

Add 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>
3

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: interface
4

Start 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:run
5

Configure 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.

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.

Quick Config Preview

{ "mcpServers": { "api2mcp4j": { "command": "npx", "args": ["-y", "api2mcp4j"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides