Skip to content

Add Springdoc OpenAPI MCP support #3246

@bnasslahsen

Description

@bnasslahsen

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:

get_user_by_id

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions