MCPSERV.CLUB
addozhang

Spring Web to MCP Converter

MCP Server

Transform Spring REST APIs into AI‑ready MCP tools

Stale(55)
34stars
2views
Updated 15 days ago

About

An OpenRewrite recipe collection that automatically converts Spring Web REST controllers into Spring AI Model Context Protocol (MCP) server tools, updating annotations, dependencies, and configuration for seamless AI agent integration.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Spring Web to MCP Converter

The Spring Web to MCP Converter addresses a common friction point in modern AI‑driven development: bridging legacy Spring Web REST APIs with the Model Context Protocol (MCP). As AI assistants grow more sophisticated, they increasingly rely on standardized tool definitions to invoke external services. Traditional Spring MVC controllers expose endpoints in a way that is opaque to these assistants, requiring manual re‑implementation of each API as an MCP tool. This converter automates that migration, turning every annotated controller method into a fully documented that can be discovered and called by any MCP‑compatible AI agent.

At its core, the server performs three complementary transformations. First, it rewrites Maven files to pull in the latest Spring AI MCP server dependencies and snapshot repositories, ensuring that the target project can compile against the new tooling. Second, it scans all controller classes for Spring Web mapping annotations (, , etc.) and decorates the corresponding methods with . The annotation carries a description extracted from JavaDoc, while each method parameter is wrapped in and inherits its own documentation. Third, it registers the newly annotated tools by creating or updating a bean and injects essential MCP configuration into the application’s properties file, setting server name, version, type, and message endpoints.

The result is a seamless transition: developers can continue to use familiar Spring MVC patterns while immediately exposing those endpoints to AI assistants. The MCP server exposes each controller as a first‑class tool, complete with human‑readable descriptions and typed parameters. This eliminates the need for duplicate code or manual API wrappers, dramatically reducing maintenance overhead.

Key use cases include:

  • Rapid prototyping of AI‑enabled microservices: Convert an existing REST API to MCP in minutes, allowing Claude or other assistants to call the service without custom adapters.
  • Enterprise AI orchestration: Embed legacy Spring applications into an AI workflow pipeline, where the assistant can discover and invoke business logic as tools.
  • Documentation‑centric development: Since the converter pulls descriptions from JavaDoc, your API documentation automatically propagates to MCP tool definitions, keeping the assistant’s knowledge up‑to‑date.

By automating dependency injection, annotation conversion, and configuration, this MCP server gives developers a powerful shortcut. It removes the manual labor of re‑implementing APIs, ensures consistency across tools, and leverages Spring AI’s mature MCP infrastructure to deliver a robust, standards‑compliant interface for any AI assistant.