- Explore MCP Servers
- spring-ai-mcp-authorization-demo
Spring Ai Mcp Authorization Demo
What is Spring Ai Mcp Authorization Demo
spring-ai-mcp-authorization-demo is a demonstration project that showcases the integration of Spring AI with MCP security features, particularly focusing on authorization mechanisms.
Use cases
Use cases include applications that require user authentication to access AI-driven services, such as querying weather information for specific locations.
How to use
To use spring-ai-mcp-authorization-demo, set your Anthropic API key in the environment variable ‘ANTHROPIC_API_KEY’. Then, run the authorization-server on port 9000, followed by the MCP Server (mcp-weather-webmvc-server) and the MCP client app (mcp-sse-http-client or mcp-sse-webflux-client for reactive). Navigate to the appropriate localhost URL to interact with the application.
Key features
Key features include OAuth2 authentication, integration with the Anthropic model, and support for both traditional and reactive web applications using Spring AI.
Where to use
spring-ai-mcp-authorization-demo can be used in areas requiring secure access to AI services, such as weather data retrieval, where user authentication is necessary.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Spring Ai Mcp Authorization Demo
spring-ai-mcp-authorization-demo is a demonstration project that showcases the integration of Spring AI with MCP security features, particularly focusing on authorization mechanisms.
Use cases
Use cases include applications that require user authentication to access AI-driven services, such as querying weather information for specific locations.
How to use
To use spring-ai-mcp-authorization-demo, set your Anthropic API key in the environment variable ‘ANTHROPIC_API_KEY’. Then, run the authorization-server on port 9000, followed by the MCP Server (mcp-weather-webmvc-server) and the MCP client app (mcp-sse-http-client or mcp-sse-webflux-client for reactive). Navigate to the appropriate localhost URL to interact with the application.
Key features
Key features include OAuth2 authentication, integration with the Anthropic model, and support for both traditional and reactive web applications using Spring AI.
Where to use
spring-ai-mcp-authorization-demo can be used in areas requiring secure access to AI services, such as weather data retrieval, where user authentication is necessary.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
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
withuser
/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
withuser
/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.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.