mcp-server-auth-template
Enables the MCP server to validate OAuth 2.1 access tokens issued by Auth0, allowing authenticated access to its tools via Auth0's OIDC and JWKS endpoints.
Enables the MCP server to validate OAuth 2.1 access tokens issued by Keycloak, allowing authenticated access to its tools via Keycloak's OIDC discovery and JWKS endpoints.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-auth-templatewhoami"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-auth-template
A reusable template for an MCP server that acts as an OAuth 2.1 resource server - never an authorization server - against either Microsoft Entra ID or any standards-compliant OIDC authorization server (Auth0, Keycloak, WorkOS AuthKit, ...). Targets the MCP 2026-07-28 specification.
The MCP 2026-07-28 authorization spec models every remote MCP server this way: it verifies bearer
tokens minted elsewhere, it never mints them itself. Entra ID also can't act as a full MCP
authorization server for arbitrary clients (no Dynamic Client Registration, no Client ID Metadata
Documents), so a real integration needs an adapter either way. This template is that adapter,
built once, correctly, so a new MCP server doesn't have to re-derive JWKS caching, issuer/audience
checks, and Entra's split scp/roles claim shape from scratch. See
docs/adr/0002-oauth21-resource-server.md for the full reasoning, and the companion repository,
mcp-client-auth-template, for the
client-side half of this pattern.
Auth quick start
Copy
.env.exampleto.envand fill in one of the two provider blocks (Entra ID or a generic OIDC authorization server).Run the server:
uv run uvicorn mcp_server_auth_template.entrypoints.mcp_server:create_app --factory --reloadProtected Resource Metadata is served automatically at
/.well-known/oauth-protected-resource- point an MCP client athttp://localhost:8000/mcpand it will discover the configured authorization server from there:{ "resource": "https://mcp.example.invalid/", "authorization_servers": ["https://as.example.invalid"], "bearer_methods_supported": ["header"] }A request with no (or an invalid) bearer token gets a
401with aWWW-Authenticateheader pointing back at that same metadata document, exactly as the spec requires - the server never issues its own login page:HTTP/1.1 401 Unauthorized www-authenticate: Bearer error="invalid_token", error_description="Authentication required", resource_metadata="https://mcp.example.invalid/.well-known/oauth-protected-resource"Two example tools are registered:
whoamireturns the identity carried by the caller's token (client ID, subject, scopes), andhealthis a liveness check for an already-authenticated caller.
Swap MCP_SERVER_AUTH_PROVIDER between entra and generic to switch adapters -
no other code changes. See src/mcp_server_auth_template/adapters/ for the two
TokenVerifier implementations and tests/unit/test_*_token_verifier.py for how
each is tested offline with a locally-signed JWT (no network, no real IdP needed).
Related MCP server: Model Context Protocol Template
Development
uv lock --check
uv sync --frozen --all-groups --extra observability
uv run pytest
uv run python scripts/quality_gate.pyList or select gate checks with --list and --check NAME. See AGENTS.md for build, lint,
format, typecheck, test, security, architecture, MCP, and completion requirements, and
docs/DEVELOPMENT.md for the container build and local setup.
Codex loads the checked-in .codex/config.toml, .codex/hooks.json, and .agents/skills/ only
within the appropriate project/trust context. Review lifecycle hooks with /hooks before use.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceA comprehensive Model Context Protocol server template that implements HTTP-based transport with OAuth proxy for third-party authorization servers like Auth0, enabling AI tools to securely connect while supporting Dynamic Application Registration.Last updated257MIT
- Alicense-qualityDmaintenanceA production-ready MCP server template that connects LLMs and AI agents to external data, tools, and services with built-in OAuth 2.1 authentication, Redis-backed session management, and a modular tools engine.Last updated1MIT
- Flicense-qualityCmaintenanceA minimal, well-commented MCP server that authenticates its callers with Microsoft Entra ID (Azure AD).Last updated
- Alicense-qualityBmaintenanceA production-ready MCP server template with OAuth 2.1, RBAC, and audit logging for building secure, observable tool servers.Last updatedMIT
Related MCP Connectors
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
MCP server for verifying EUDI/Talao wallet data via OIDC4VP (pull) for AI agents.
MCP server for Argo RPG Platform — connects AI assistants to campaign data via OAuth2
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/brunovicco/mcp-server-auth-template'
If you have feedback or need assistance with the MCP directory API, please join our Discord server