What dependencies are needed to add OAuth2 to an MCP server?
The sample uses Spring Security (infrastructure), Spring Authorization Server (token issuance), and Spring Security OAuth2 Resource Server (token-based authentication).
@akshay12390
基本信息
Reference https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/weather/starter-webmvc-oauth2-server
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"mcp-weather-oauth2-server": {
"command": "npx",
"args": [
"@modelcontextprotocol/inspector@0.6.0"
]
}
}
}工具列表暂未提供
当前收录暂时没有可展示的工具列表,不代表服务没有工具。请查阅项目文档了解支持的能力。
点击上方按钮,在临时沙箱中运行此服务器并实时获取工具列表。
MCP with OAuth is a sample project that demonstrates how to secure an MCP (Model Context Protocol) server using OAuth2, following the MCP specification’s authorization section. It is intended for developers who need to add OAuth2 authentication to an MCP server.
Run the project with ./mvnw spring-boot:run. Obtain tokens via client credentials or auth code (PKCE). For client credentials, call /oauth2/token with grant_type=client_credentials and authenticate as mcp-client:secret. For PKCE, first run pkce_generator.py and then token_request.py. Use the token with the MCP inspector (npx @modelcontextprotocol/inspector@0.6.0) by pasting it and clicking connect.
The sample uses Spring Security (infrastructure), Spring Authorization Server (token issuance), and Spring Security OAuth2 Resource Server (token-based authentication).
Tokens are valid for 15 minutes.
No. Spring Authorization Server does not support the reactive stack, so issuing tokens only works in Servlet environments.
Store the token obtained from the `/oauth2/token` endpoint, boot the MCP inspector (`npx @modelcontextprotocol/inspector@0.6.0`), paste the token, and click connect.

LinkedIn Ads MCP server by AdPlug, connecting LinkedIn Ads to Claude, ChatGPT and other MCP-compatible AI assistants. Analyse performance, audiences, creatives and conversions. Generate reports and manage campaigns, budg

Plan, create and schedule social media content from your AI assistant. Blaze makes on-brand posts, carousels and short videos, writes blog posts and newsletters, and schedules them to Instagram, TikTok, YouTube, LinkedIn

TrueClicks is PPC audit and monitoring software for agencies and advertisers managing Google Ads, Microsoft Ads, and Meta Ads at scale. This connector gives read-only access to your TrueClicks data, so you can ask questi

Break down any TikTok or Instagram Reels ad and rewrite it for your product, right inside Claude, Cursor, or ChatGPT. Hooks, UGC scripts, and CPM. Free, no API key.

Built by movie lovers, for movie lovers and their assistants. SceneF puts every screen in California and Hawaii on one board — 33 regions, from San Francisco's single-screen neighborhood houses and nightly repertory cale
评论