READMEmain
We couldn't render this README. Read it on GitHub
Spring AI MCP Security demo
This repository showcases Spring AI MCP security integration.
Usage
Before starting, set your Anthropic key in the env var ANTHROPIC_API_KEY.
- Run the authorization-server project, it starts on port 9000
- Run the MCP Server (mcp-weather-webmvc-server)
- Run the MCP client Servlet app (mcp-sse-servlet-webflux-client)
- Navigate to http://localhost:8080/
- When you try to get the temperature for, say, Paris, you will be redirected to the auth-server on port 9000. Log in
with
user/password. Tadaa 🎉- there will be a nasty error in the console logs. This is expected, it's from Spring Security's OAuth2 internals.
- Subsequent calls will not require a login.
Notes on WebFlux
If you would like to build a fully reactive Spring AI app, you need to use WebFlux. Some changes to Spring AI are required to get it to work.
You MUST use this exact build of Spring AI: https://github.com/Kehrlann/spring-ai/tree/dgarnier/poc-propagate-reactive-context-to-mcp-async
You MUST use the Anthropic model.
- Run the authorization-server project, it starts on port 9000
- Run the MCP Server (mcp-weather-webmvc-server)
- Run the MCP client Reactive app (mcp-sse-webflux)
- Navigate to http://localhost:8081/
- When you try to get the temperature for, say, Paris, you will be redirected to the auth-server on port 9000. Log in
with
user/password. Tadaa 🎉- there will be a nasty error in the console logs. This is expected, it's from Spring Security's OAuth2 internals.
- Subsequent calls will not require a login.
