mcp-oauth
A provider-agnostic OAuth 2.1 Authorization Server library for Model Context Protocol (MCP) servers, with support for multiple identity providers.
接入你的智能体
从发布者处安装。不是 PlugMCP 端点。
远程 URL 还是本机命令? 两种安装方式的区别
来自发布者
A provider-agnostic OAuth 2.1 Authorization Server library for Model Context Protocol (MCP) servers, with support for multiple identity providers.
OAuth 2.1 Authorization Server library for Model Context Protocol (MCP) servers
| Specification Version | Support Status | Documentation |
|---|---|---|
| 2025-11-25 | Full Support | Migration Guide |
| 2025-06-18 (previous) | Full Support | Backward compatible |
503 temporarily_unavailable with Retry-After on the token endpoint, on bearer validation and on introspection, never as a dead token┌─────────────────┐
│ Your MCP App │
└────────┬────────┘
│
┌────▼─────┐
│ Handler │ HTTP layer
└────┬─────┘
│
┌────▼─────┐
│ Server │ Business logic
└──┬───┬───┘
│ │
┌───▼┐ ┌▼────────┐
│Pro-│ │ Storage │
│vider│ │ │
└────┘ └─────────┘
package main
import (
"net/http"
"os"
oauth "github.com/giantswarm/mcp-oauth"
"github.com/giantswarm/mcp-oauth/handler"
"github.com/giantswarm/mcp-oauth/providers/google"
"github.com/giantswarm/mcp-oauth/storage/memory"
)
func main() {
// 1. Choose a provider
provider, _ := google.NewProvider(&google.Config{
ClientID: os.Getenv("GOOGLE_CLIENT_ID"),
ClientSecret: os.Getenv("GOOGLE_CLIENT_SECRET"),
RedirectURL: "http://localhost:8080/oauth/callback",
Scopes: []string{"openid", "email", "profile"},
})
// 2. Choose storage
store := memory.New()
defer store.Stop()
// 3. Create OAuth server
server, _ := oauth.NewServer(
provider,
store, // TokenStore
store, // ClientStore
store, // FlowStore
&oauth.ServerConfig{
Issuer: "http://localhost:8080",
},
nil,
)
// 4. Create HTTP handler and routes
h := handler.New(server, nil)
mux := http.NewServeMux()
h.RegisterProtectedResourceMetadataRoutes(mux, "/mcp")
mux.Handle("/mcp", h.ValidateToken(yourMCPHandler))
http.ListenAndServe(":8080", mux)
}
go get github.com/giantswarm/mcp-oauth
The examples/ directory contains runnable examples:
This library implements OAuth 2.1 with secure defaults:
NEVER use environment variables for production secrets!
Production deployments MUST use a secret manager:
NEVER:
See Production Example - Secret Management for implementation guidance and examples.
See the Security Guide for configuration and the Security Architecture for implementation details.
Vulnerability Reporting: See SECURITY.md for responsible disclosure.
Contributions welcome. Especially:
See CONTRIBUTING.md for guidelines.
Apache License 2.0
OAuth 2.1 Authorization Server library for Model Context Protocol (MCP) servers
工具
暂无工具列表。远程服务器在首次健康检查后会获得工具列表。
常见问题
在本页复制适用于 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 配置。它使用发布者的安装方式,而不是 PlugMCP 代理。
此记录未列出必需的环境变量。
MCP Oauth 通过 stdio 在本地运行。
上次检查时间:2026-10-27。 OAuth 2.1 Authorization Server library for Model Context Protocol (MCP) servers