Get the FREE Ultimate OpenClaw Setup Guide →

api2mcp4j

This is a revolutionary AI MCP plugin with excellent pluggable and encapsulated features. With just a few lines of configuration, it can easily integrate into your Spring boot web program and give it MCP capabilities,inheriting the powerful engineering capabilities of the Spring series framework

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio theeterna-api2mcp4j java -jar path/to/api2mcp4j.jar \
  --env MCP_LOG_LEVEL="INFO" \
  --env SPRING_PROFILES_ACTIVE="default" \
  --env SPRING_OUTPUT_ANSI_ENABLED="ALWAYS"

How to use

api2mcp4j is a Spring Boot Starter designed for automated integration of MCP (Model Context Protocol) services in Java applications. It exposes MCP tooling and callback mechanisms that allow your Java service to register tools, resources, and prompts, and to participate in MCP-based interactions through the Spring AI framework. The server-side configuration enables automatic MCP interface wiring, with optional annotations like @ToolScan and @ResourceScan to customize what gets registered as MCP tools or resources. You can leverage built-in parsers (Javadoc, Jackson, Swagger, etc.) and extend with custom parsers if needed. Start this server as part of a Spring Boot application and expose MCP interfaces that clients can call via MCP endpoints.

To use its capabilities, integrate the starter into your Spring Boot project, configure the mcp sections in your application.yml or application.properties, and ensure MCP-related beans are discovered by Spring. You can register your own tools via the McpTool mechanism, customize prompts, and register resources by using the provided annotations. Client calls to MCP interfaces will be routed through the registered tools and parsers, enabling automated AI-driven interactions through MCP.

How to install

Prerequisites:

  • Java Development Kit (JDK) 17 or newer
  • Maven or Gradle build tool
  • A compatible MCP SDK version (as required by the project)
  1. Clone the repository
  1. Build the project
  • Using Maven: mvn clean package -DskipTests
  • Using Gradle: ./gradlew clean build -x test
  1. Run the server
  • java -jar path/to/api2mcp4j.jar
  • Alternatively, run within your IDE as a Spring Boot application
  1. Configure MCP in your application
  • Add MCP-related configuration to application.yml or application.properties as described in the README (parser params, scope, etc.)

Additional notes

Notes and tips:

  • This project targets an MCP setup compatible with Spring AI and MCP SDK snapshots; ensure your MCP SDK version aligns with the project version to avoid compatibility issues.
  • If you encounter tool or resource registration issues, verify your @ToolScan, @ResourceScan, and @PromptScan annotations are correctly placed and detected by component scanning.
  • When upgrading MCP SDK versions, you may need to recompile and adjust parser configurations if breaking changes are introduced.
  • The environment variables shown in the example mcp_config are placeholders; adjust SPRING_PROFILES_ACTIVE, MCP_LOG_LEVEL, and any other settings according to your deployment environment.
  • Ensure network connectivity between MCP clients and the server; expose the MCP endpoints through your chosen deployment configuration (e.g., container, VM, or bare metal).
  • If you are upgrading from an older server2mcp integration, review the latest documentation linked in the README for any migration notes or breaking changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers