loading…
Search for a command to run...
loading…
Turn your Spring Boot application into an MCP server instantly by reusing existing Swagger/OpenAPI documentation.
Turn your Spring Boot application into an MCP server instantly by reusing existing Swagger/OpenAPI documentation.
Spring Boot starter that automatically exposes SpringDoc OpenAPI operations as MCP tools.
meta_discover_api_tools, meta_invoke_api_by_intent_confirm, blocked paths, role checks, audit logs)graph TD
User([User / LLM Client]) <--> MCP[MCP Client / Claude Desktop]
MCP <--> Bridge[Swagger MCP Bridge /starter/]
Bridge <--> Docs[SpringDoc OpenAPI /v3/api-docs]
Bridge <--> API[Your Spring Controller /hello]
Use:
Gradle (build.gradle.kts):
plugins {
id("org.springframework.boot") version "3.5.9"
id("io.spring.dependency-management") version "1.1.7"
java
}
java {
sourceCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:2.8.3")
implementation("io.github.neo1228:spring-boot-starter-swagger-mcp:<version>")
}
Maven (pom.xml):
<properties>
<swagger-mcp.version>0.1.0-SNAPSHOT</swagger-mcp.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>2.8.3</version>
</dependency>
<dependency>
<groupId>io.github.neo1228</groupId>
<artifactId>spring-boot-starter-swagger-mcp</artifactId>
<version>${swagger-mcp.version}</version>
</dependency>
</dependencies>
Use a release version (for example 0.1.0) when consuming from a remote artifact repository.
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
public class HelloController {
@Operation(operationId = "getHello", summary = "Get greeting message")
@GetMapping("/hello")
public Map<String, Object> hello(@RequestParam(defaultValue = "world") String name) {
return Map.of("message", "Hello " + name);
}
}
application.yml)spring:
ai:
mcp:
server:
protocol: STREAMABLE_HTTP
streamable-http:
mcp-endpoint: /mcp
swagger:
mcp:
enabled: true
api-docs-path: /v3/api-docs
tool-name-prefix: api_
./gradlew bootRun or ./mvnw spring-boot:runhttp://localhost:8080/v3/api-docshttp://localhost:8080/mcpGenerated tool names follow <tool-name-prefix><operation-id> (example: api_gethello).
If the artifact is not published to a remote registry yet:
./gradlew publishToMavenLocalmavenLocal() repository0.1.0-SNAPSHOT (or your chosen local version)swagger.mcp.enabled: enable/disable bridge (default true)swagger.mcp.api-docs-path: OpenAPI docs path (default /v3/api-docs)swagger.mcp.tool-name-prefix: tool name prefix (default api_)swagger.mcp.smart-context.gateway-only: expose only meta toolsswagger.mcp.security.require-confirmation-for-risky-operations: require _confirm token for risky methodsFor risky HTTP methods (POST, PUT, PATCH, DELETE), default policy requires _confirm=CONFIRM.
| Starter | Java | Spring Boot | springdoc-openapi | Spring AI BOM |
|---|---|---|---|---|
| 0.1.x | 17+ | 3.5.x | 2.8.3 | 1.1.2 |
Spring Boot 4.x is not supported in this repository.
See examples/minimal-webmvc-gradle for a minimal app using this starter.
RELEASING.mdVERSIONING.mdCHANGELOG.md./gradlew testCONTRIBUTING.mdSECURITY.mdApache License 2.0 (LICENSE)
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"neo1228-spring-boot-starter-swagger-mcp": {
"command": "npx",
"args": []
}
}
}