Java or Kotlin
Get an OpenAPI spec from Spring Boot
Add the springdoc dependency. The spec is served at /v3/api-docs.
How it works
springdoc reads your @RestController classes, their mappings (@GetMapping, @PostMapping...), @RequestBody classes and validation annotations while the app starts, and serves the spec.
Step by step
Step 1: Add the dependency
Pick the version line that matches your Spring Boot version: 2.x for Spring Boot 3, 3.x for Spring Boot 4. Check Maven Central for the newest release in that line.
pom.xml (Maven, Spring Boot 3)<dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.8.6</version> </dependency>build.gradle (Gradle, Spring Boot 3)implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.6'Using WebFlux? Use springdoc-openapi-starter-webflux-ui instead. Still on Spring Boot 2? Use org.springdoc:springdoc-openapi-ui:1.8.0.
Step 2: Run the app and open the spec
The spec is at /v3/api-docs (JSON) and /v3/api-docs.yaml. A browsable page is at /swagger-ui.html.
Terminal (Maven)./mvnw spring-boot:runTerminal (Gradle)./gradlew bootRunTerminal (save a file)curl http://localhost:8080/v3/api-docs -o openapi.jsonOn your live server the link is https://api.example.com/v3/api-docs. Paste it into MCPEasy under OpenAPI URL.
Step 3: If you use Spring Security
The spec links need to be reachable without signing in. Add this matcher to your existing security rules:
SecurityConfig.javahttp.authorizeHttpRequests(auth -> auth .requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll() .anyRequest().authenticated());Step 4: Optional: better descriptions
@Operation gives each tool a clear description.
BookingController.javaimport io.swagger.v3.oas.annotations.Operation; @PostMapping("/bookings") @Operation(summary = "Create a booking", description = "Books an appointment in a free slot.") public Booking create(@Valid @RequestBody CreateBookingRequest request) { // ... }
Check that it worked
- http://localhost:8080/v3/api-docs returns JSON with every controller route under "paths".
Give it to MCPEasy
Have a link? Paste it (best)
In MCPEasy, create a server, choose OpenAPI URL and paste the link, for example https://api.example.com/openapi.json. Later changes to your API can be picked up with a sync.
Have a file? Upload it
Choose Upload file and drop in the .json or .yaml file (up to 5 MB). MCPEasy turns each endpoint into a tool, and you review them all before anything goes live.
If something goes wrong
- /v3/api-docs returns 401 or 403.
- Spring Security blocks it. Add the permitAll matcher from step 3.
- /v3/api-docs returns 404 in production only.
- Your production profile may set springdoc.api-docs.enabled=false. Turn it on, or download the file locally and upload it.
- The app fails to start after adding the dependency.
- The springdoc version line does not match your Spring Boot version. See step 1.
Still stuck, or no time to set this up? In MCPEasy choose From code (GitHub): it reads your routes straight from the repository, read-only, and tests every tool against your live API before it goes live.
Official documentation
Other frameworks
More guides for MCP and OpenAPI
- OpenAPI to MCP serverHow a spec maps to MCP tools, which endpoints to keep, and how auth works.
- REST API to MCP serverConvert any API, with or without a spec: Postman, cURL, code, plus a worked example.
- Get an OpenAPI spec from your frameworkExport an OpenAPI (Swagger) file from 11 frameworks, step by step.
- OpenAPI spec from FastAPINothing to install: FastAPI already serves your spec at /openapi.json.
- OpenAPI spec from ExpressThe packages, code and commands to produce a spec from an Express app.