About
This Spring Boot application demonstrates how to protect a Model Context Protocol (MCP) server using OAuth2. It issues client‑credentials and authorization code tokens, enabling secure access to weather data via the MCP inspector.
Capabilities
MCP Weather Starter Webmvc OAuth2 Server
The MCP Weather Starter Webmvc OAuth2 Server is a minimal, yet fully‑featured example that shows how to secure an MCP server with OAuth 2.0. It demonstrates the token‑based authentication flow required by the MCP specification and provides a ready‑to‑run Spring Boot application that can be used as a template for any MCP implementation needing secure access.
Problem Solved
Many AI assistants rely on external services that expose data or actions through MCP. Without a robust authentication mechanism, those services become vulnerable to misuse and can’t enforce fine‑grained access control. This server solves that problem by integrating OAuth 2.0 into the MCP stack, allowing clients to request short‑lived access tokens that grant precise permissions. The result is a secure, standards‑compliant interface that protects sensitive resources while remaining easy to consume by AI agents.
What the Server Does
- OAuth 2.0 Authorization – Implements the client credentials grant for machine‑to‑machine scenarios and a browser‑based authorization code with PKCE flow for interactive users. Tokens are issued by Spring Authorization Server and validated by Spring Security’s OAuth 2.0 Resource Server support.
- MCP Endpoints – Exposes the standard MCP endpoints (resources, tools, prompts, sampling) behind the OAuth layer. Each request must present a valid bearer token; otherwise the server rejects it with an appropriate HTTP status.
- Token Lifecycle Management – Tokens are short‑lived (15 minutes by default), encouraging frequent renewal and reducing the risk window for compromised credentials.
- Spring MVC Integration – Built on Spring Boot’s servlet stack, making it straightforward to add custom MCP resources or extend the server with additional services.
Key Features Explained
- Client Credentials Grant – Ideal for background jobs or server‑to‑server interactions. Clients authenticate using a pre‑shared client ID and secret, then receive an access token that can be attached to every MCP request.
- Authorization Code with PKCE – Provides a secure browser flow for end‑user authentication without exposing client secrets. The server generates an authorization code, which the client exchanges for a token using a PKCE verifier.
- Inspector Compatibility – The server is fully compatible with the MCP Inspector tool. After obtaining a token, users can paste it into the inspector to explore available resources and tools instantly.
- Spring Security Hooks – Leveraging Spring’s established security ecosystem, the server benefits from configurable scopes, audience validation, and revocation capabilities without extra code.
Real‑World Use Cases
- Weather Data API – Expose real‑time weather information to AI assistants while ensuring only authorized applications can retrieve data, preventing abuse of API limits.
- Enterprise Resource Planning – Securely expose internal business data (e.g., inventory, sales) to AI agents that assist employees or customers.
- IoT Device Management – Protect device control commands behind OAuth tokens, allowing AI assistants to trigger actions on a fleet of devices safely.
- Compliance‑Driven Environments – Meet regulatory requirements by enforcing token validation, audit logging, and short token lifetimes.
Integration into AI Workflows
Developers can integrate this server into their AI pipelines by:
- Deploying the application behind a reverse proxy or Kubernetes service.
- Registering client applications (e.g., Claude, Gemini) with the OAuth server to obtain client credentials or PKCE support.
- Configuring AI assistants to include the bearer token in every MCP request header ().
- Using the MCP Inspector or custom tooling to discover available resources and invoke them securely.
Because the server follows the official MCP specification, any compliant AI client can interact with it without modification. The OAuth layer adds a robust security boundary while preserving the simplicity of MCP’s resource‑based model.
This overview provides a concise yet comprehensive picture of the MCP Weather Starter Webmvc OAuth2 Server, highlighting its purpose, capabilities, and practical value for developers building secure AI‑powered services.
Related Servers
Netdata
Real‑time infrastructure monitoring for every metric, every second.
Awesome MCP Servers
Curated list of production-ready Model Context Protocol servers
JumpServer
Browser‑based, open‑source privileged access management
OpenTofu
Infrastructure as Code for secure, efficient cloud management
FastAPI-MCP
Expose FastAPI endpoints as MCP tools with built‑in auth
Pipedream MCP Server
Event‑driven integration platform for developers
Weekly Views
Server Health
Information
Explore More Servers
DuckDuckGo Web Search MCP Server
A TypeScript MCP server for simple note management
GitHub MCP Server
Connect Model Context Protocol to GitHub repositories effortlessly
Comment Stripper MCP
Strip comments from code across languages
Strapi MCP
Connect your Strapi CMS to the Model Context Protocol
Fhir Mcp Server Medagentbench
Simulate FHIR API calls for MedAgentBench testing
Gongrzhe Calendar Autoauth Mcp Server
MCP Server: Gongrzhe Calendar Autoauth Mcp Server