Summary
Add optional Model Context Protocol (MCP) integration to Springdoc
that automatically exposes OpenAPI-documented REST endpoints as AI
tools for MCP-compatible agents (Claude Desktop, Cursor, etc.).
Motivation
AI agents increasingly need structured ways to interact with backend
APIs. Today this requires manually defining tool schemas that duplicate
existing API definitions.
Since Springdoc already generates an OpenAPI specification, this
metadata can be reused to automatically generate MCP tools.
This would allow Spring applications to become AI-agent ready with
minimal configuration.
Proposed Behavior
When enabled:
springdoc.ai.mcp.enabled=true
Springdoc would:
- Convert OpenAPI operations into MCP tools
- Generate JSON input schemas from parameters and request bodies
- Use OpenAPI descriptions for tool metadata
- Group tools by OpenAPI
@Tag
- Provide optional guardrails (human approval for mutating operations)
Example Mapping
GET /users/{id}
operationId: getUserById
→ MCP tool:
Additional Capabilities
Possible features:
@McpToolDescription annotation for AI-optimized descriptions
McpToolCustomizer extension point to rename/filter tools
- Guardrails for mutating endpoints (
POST, PUT, DELETE)
- Optional developer dashboard for testing MCP tools
Benefits
- No duplicated tool definitions
- APIs automatically usable by AI agents
- Safer AI-driven automation with guardrails
- Reuses existing OpenAPI metadata
Summary
Add optional Model Context Protocol (MCP) integration to Springdoc
that automatically exposes OpenAPI-documented REST endpoints as AI
tools for MCP-compatible agents (Claude Desktop, Cursor, etc.).
Motivation
AI agents increasingly need structured ways to interact with backend
APIs. Today this requires manually defining tool schemas that duplicate
existing API definitions.
Since Springdoc already generates an OpenAPI specification, this
metadata can be reused to automatically generate MCP tools.
This would allow Spring applications to become AI-agent ready with
minimal configuration.
Proposed Behavior
When enabled:
springdoc.ai.mcp.enabled=trueSpringdoc would:
@TagExample Mapping
→ MCP tool:
Additional Capabilities
Possible features:
@McpToolDescriptionannotation for AI-optimized descriptionsMcpToolCustomizerextension point to rename/filter toolsPOST,PUT,DELETE)Benefits