Spring Boot starter that automatically exposes SpringDoc OpenAPI operations as MCP tools. - Auto-discovery of OpenAPI operations from your running Spring app - Auto-registration of MCP tools for discovered API operations - Smart-context tools: metadiscoverapitools, metainvokeapibyintent - Response optimization with projection/summarization controls - Risk controls for dangerous operations (confirm
Add this skill
npx mdskills install Neo1228/spring-boot-starter-swagger-mcpWell-documented Spring Boot starter that auto-exposes OpenAPI operations as MCP tools with smart discovery and security controls
1# spring-boot-starter-swagger-mcp23[](https://github.com/Neo1228/spring-boot-starter-swagger-mcp/actions/workflows/ci.yml)4[](https://opensource.org/licenses/Apache-2.0)5[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)6[](https://spring.io/projects/spring-boot)78Spring Boot starter that automatically exposes SpringDoc OpenAPI operations as MCP tools.910## What You Get1112- Auto-discovery of OpenAPI operations from your running Spring app13- Auto-registration of MCP tools for discovered API operations14- Smart-context tools: `meta_discover_api_tools`, `meta_invoke_api_by_intent`15- Response optimization with projection/summarization controls16- Risk controls for dangerous operations (`_confirm`, blocked paths, role checks, audit logs)1718## Architecture1920```mermaid21graph TD22 User([User / LLM Client]) <--> MCP[MCP Client / Claude Desktop]23 MCP <--> Bridge[Swagger MCP Bridge /starter/]24 Bridge <--> Docs[SpringDoc OpenAPI /v3/api-docs]25 Bridge <--> API[Your Spring Controller /hello]26```2728## Quick Start (New Empty Spring Boot Project)2930### 1. Create a Spring Boot app3132Use:3334- Java 17+35- Spring Boot 3.5.x36- Spring Web3738### 2. Add dependencies3940Gradle (`build.gradle.kts`):4142```kotlin43plugins {44 id("org.springframework.boot") version "3.5.9"45 id("io.spring.dependency-management") version "1.1.7"46 java47}4849java {50 sourceCompatibility = JavaVersion.VERSION_1751}5253repositories {54 mavenCentral()55}5657dependencies {58 implementation("org.springframework.boot:spring-boot-starter-web")59 implementation("org.springdoc:springdoc-openapi-starter-webmvc-api:2.8.3")60 implementation("io.github.neo1228:spring-boot-starter-swagger-mcp:<version>")61}62```6364Maven (`pom.xml`):6566```xml67<properties>68 <swagger-mcp.version>0.1.0-SNAPSHOT</swagger-mcp.version>69</properties>7071<dependencies>72 <dependency>73 <groupId>org.springframework.boot</groupId>74 <artifactId>spring-boot-starter-web</artifactId>75 </dependency>76 <dependency>77 <groupId>org.springdoc</groupId>78 <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>79 <version>2.8.3</version>80 </dependency>81 <dependency>82 <groupId>io.github.neo1228</groupId>83 <artifactId>spring-boot-starter-swagger-mcp</artifactId>84 <version>${swagger-mcp.version}</version>85 </dependency>86</dependencies>87```8889Use a release version (for example `0.1.0`) when consuming from a remote artifact repository.9091### 3. Add one controller9293```java94import io.swagger.v3.oas.annotations.Operation;95import org.springframework.web.bind.annotation.GetMapping;96import org.springframework.web.bind.annotation.RequestParam;97import org.springframework.web.bind.annotation.RestController;9899import java.util.Map;100101@RestController102public class HelloController {103104 @Operation(operationId = "getHello", summary = "Get greeting message")105 @GetMapping("/hello")106 public Map<String, Object> hello(@RequestParam(defaultValue = "world") String name) {107 return Map.of("message", "Hello " + name);108 }109}110```111112### 4. Add configuration (`application.yml`)113114```yaml115spring:116 ai:117 mcp:118 server:119 protocol: STREAMABLE_HTTP120 streamable-http:121 mcp-endpoint: /mcp122123swagger:124 mcp:125 enabled: true126 api-docs-path: /v3/api-docs127 tool-name-prefix: api_128```129130### 5. Run and verify1311321. Start app: `./gradlew bootRun` or `./mvnw spring-boot:run`1332. Verify OpenAPI: `http://localhost:8080/v3/api-docs`1343. Verify MCP endpoint: `http://localhost:8080/mcp`1354. Connect from an MCP client136137Generated tool names follow `<tool-name-prefix><operation-id>` (example: `api_gethello`).138139## Use It Before Public Release (Local Development Install)140141If the artifact is not published to a remote registry yet:1421431. Build and publish to local Maven cache:144 - `./gradlew publishToMavenLocal`1452. In your consumer app:146 - add `mavenLocal()` repository147 - use version `0.1.0-SNAPSHOT` (or your chosen local version)148149## Key Configuration150151- `swagger.mcp.enabled`: enable/disable bridge (default `true`)152- `swagger.mcp.api-docs-path`: OpenAPI docs path (default `/v3/api-docs`)153- `swagger.mcp.tool-name-prefix`: tool name prefix (default `api_`)154- `swagger.mcp.smart-context.gateway-only`: expose only meta tools155- `swagger.mcp.security.require-confirmation-for-risky-operations`: require `_confirm` token for risky methods156157For risky HTTP methods (`POST`, `PUT`, `PATCH`, `DELETE`), default policy requires `_confirm=CONFIRM`.158159## Compatibility Matrix160161| Starter | Java | Spring Boot | springdoc-openapi | Spring AI BOM |162|---|---|---|---|---|163| 0.1.x | 17+ | 3.5.x | 2.8.3 | 1.1.2 |164165Spring Boot 4.x is not supported in this repository.166167## Example Consumer Project168169See `examples/minimal-webmvc-gradle` for a minimal app using this starter.170171## Release And Versioning172173- Release process: `RELEASING.md`174- Versioning policy: `VERSIONING.md`175- Changelog: `CHANGELOG.md`176177## Development178179- Run tests: `./gradlew test`180- Contribution guide: `CONTRIBUTING.md`181- Security reporting: `SECURITY.md`182183## License184185Apache License 2.0 (`LICENSE`)186
Full transparency — inspect the skill content before installing.