Skip to main content
Spring AI is the JVM path to an MCP server, and its mcp-security modules are the only Java option that can be a full OAuth authorization server with dynamic client registration — via the mcp-authorization-server module, built on Spring Authorization Server. The official Java SDK deliberately delegates authorization to Spring, so this page is really about the Spring security modules. They’re authoritative; this page covers the choices and the one gotcha that matters most for MCP Manager.
Start with Building Your Own MCP Server for the requirements and the auth-mode decision tree. This page is the Spring AI layer on top.

Serve the STREAMABLE protocol

Use the WebMVC server starter (spring-ai-starter-mcp-server-webmvc) and set spring.ai.mcp.server.protocol=STREAMABLE (or STATELESS for a stateless deployment). That gives you the Streamable HTTP transport MCP Manager requires.
mcp-security supports WebMVC, not WebFlux — a WebFlux MCP server isn’t covered by the security modules today. And as with every framework here, don’t ship a server that only speaks the legacy HTTP+SSE transport; MCP Manager won’t connect to it.

Choose a security module per MCP Manager mode

mcp-security has two distinct modules. Pick the one matching your chosen MCP Manager mode.
You wantUse in SpringNotes
Standard OAuth + DCRmcp-authorization-server (McpAuthorizationServerConfigurer.mcpAuthorizationServer())Built on Spring Authorization Server; DCR is on by default. Also serves RFC 8414 + RFC 9728 metadata
Pre-registration / bearer tokenmcp-server-security (McpServerOAuth2Configurer.mcpServerOAuth2())Resource server: validates inbound JWTs against an issuer, serves RFC 9728 at /.well-known/oauth-protected-resource/mcp
Token in a headerMcpApiKeyConfigurer.mcpServerApiKey()API-key auth, maps to MCP Manager’s header-token mode
See Spring AI — MCP Security and the Securing MCP Servers blog post.

The gotcha: the default client repository is in-memory

If you run mcp-authorization-server, registered clients are stored in Spring Authorization Server’s RegisteredClientRepository, which defaults to InMemoryRegisteredClientRepository — dev/test only, and ephemeral. On a multi-instance deployment that’s the classic DCR failure: MCP Manager registers against one instance, the authorize hop lands on another, and the client isn’t found. The fix is to wire a JdbcRegisteredClientRepository backed by a shared database (applying the oauth2-registered-client-schema.sql tables). This is an explicit configuration step — it does not happen automatically.
Switching to JdbcRegisteredClientRepository is required for any production or multi-instance deployment. Leaving the default in-memory repository in place is the single most common reason a Spring-based DCR server works in testing and fails once it scales.

MCP Manager compatibility checklist

1

STREAMABLE protocol on WebMVC

Set spring.ai.mcp.server.protocol=STREAMABLE with the WebMVC starter; mcp-security doesn’t cover WebFlux.
2

Pick the right module

mcp-authorization-server for DCR; mcp-server-security for bearer-token resource-server; McpApiKeyConfigurer for header tokens.
3

Use JdbcRegisteredClientRepository

Replace the default in-memory client repository with the JDBC one so registrations survive restarts and are shared across instances.
4

Public issuer and resource

Ensure the authorization server’s issuer and the resource server’s audience are your public URL, so discovery and token validation line up.

Spring AI gotchas

The default loses clients on restart and isn’t shared across instances. Wire JdbcRegisteredClientRepository for production. See Debug Self-Hosted OAuth.
mcp-security targets WebMVC. If you’re on WebFlux, the security modules don’t apply — plan for WebMVC or handle auth yourself.
A documented limitation of the current modules is that every client supports all resource identifiers. If you rely on per-resource audience separation, validate that behavior against your version.

Further reading

Spring AI — MCP Security

The authoritative reference for the resource-server and authorization-server modules.

Securing MCP Servers (blog)

A walkthrough of the Spring AI MCP server security model.

Debug Self-Hosted OAuth

The dynamic-client-registration failure and why in-memory storage causes it.

Building Your Own MCP Server

The cross-framework requirements, decision tree, and troubleshooting catalog.