mcp-weather-oauth2-server logo

mcp-weather-oauth2-server

by akshay12390

This sample demonstrates how to secure an MCP server using OAuth2, as per the MCP specification. It provides a basic implementation for issuing and validating OAuth2 tokens.

View on GitHub

Last updated: N/A

What is mcp-weather-oauth2-server?

This is a sample MCP server secured with OAuth2. It demonstrates how to implement the authorization flow specified in the MCP specification using Spring Security and Spring Authorization Server.

How to use mcp-weather-oauth2-server?

To use this server, first run the project using ./mvnw spring-boot:run. Then, obtain an OAuth2 token by calling the /oauth2/token endpoint with client credentials. Finally, use the token to connect to the MCP inspector and interact with the server.

Key features of mcp-weather-oauth2-server

  • OAuth2 authentication for MCP server

  • Spring Security integration

  • Spring Authorization Server for token issuance

  • Client credentials grant type

  • Token validation

Use cases of mcp-weather-oauth2-server

  • Securing MCP endpoints with OAuth2

  • Implementing authorization in MCP applications

  • Demonstrating OAuth2 flow with Spring Security

  • Providing a sample for MCP security implementation

FAQ from mcp-weather-oauth2-server

What is MCP?

MCP stands for Model Context Protocol, a specification for data exchange.

What is OAuth2?

OAuth2 is an authorization framework that enables applications to obtain limited access to user accounts on an HTTP service.

How do I get a token?

You can obtain a token by calling the /oauth2/token endpoint with client credentials using a tool like curl.

How long is the token valid?

The token is valid for 5 minutes.

What dependencies are used?

The project uses Spring Security, Spring Authorization Server, and Spring Security: OAuth2 Resource Server.