MCP Server Auth Template
Reference OAuth 2.1 resource server for remote MCP with Entra ID or generic OIDC
- Pricing
- Open source
- Platforms
- API, self-hosted, CLI
- Runs
- Remotely
- Version
- 0.7.0
- Listing updated
- today
Similar MCP servers
About MCP Server Auth Template
MCP Server Auth Template is an open-source MCP server for security. It runs as a hosted remote server, so there is nothing to install locally.
The README frames this as a starting point for the authorization layer of a remote MCP server, rather than for the tools themselves. It covers token validation against exact issuer and audience rules, fail-closed behaviour, and per-principal filtering of tool listings, using Microsoft Entra ID or any generic OIDC provider selected by an environment variable.
The repository ships a small example server with a whoami tool and a health tool that demonstrates a scope step-up challenge. It runs as a Streamable HTTP service, published as a GHCR container image and listed in the Official MCP Registry. Metadata-only OpenTelemetry tracing is included, with sensitive OAuth and MCP values kept out of telemetry.
The README positions it for developers who need to expose MCP tools without weakening identity and authorization boundaries. It is a reference implementation rather than a hosted identity service, and it expects teams to add TLS, secret management and provider registration before production use.
Install
Run in a terminal
claude mcp add mcp-server-auth-template --env MCP_SERVER_RESOURCE_SERVER_URL='<MCP_SERVER_RESOURCE_SERVER_URL>' --env MCP_SERVER_AUTH_PROVIDER='<MCP_SERVER_AUTH_PROVIDER>' -- docker run -i --rm -e MCP_SERVER_RESOURCE_SERVER_URL -e MCP_SERVER_AUTH_PROVIDER ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0Add to claude_desktop_config.json
{
"mcpServers": {
"mcp-server-auth-template": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_SERVER_RESOURCE_SERVER_URL",
"-e",
"MCP_SERVER_AUTH_PROVIDER",
"ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0"
],
"env": {
"MCP_SERVER_RESOURCE_SERVER_URL": "<MCP_SERVER_RESOURCE_SERVER_URL>",
"MCP_SERVER_AUTH_PROVIDER": "<MCP_SERVER_AUTH_PROVIDER>"
}
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server-auth-template": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_SERVER_RESOURCE_SERVER_URL",
"-e",
"MCP_SERVER_AUTH_PROVIDER",
"ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0"
],
"env": {
"MCP_SERVER_RESOURCE_SERVER_URL": "<MCP_SERVER_RESOURCE_SERVER_URL>",
"MCP_SERVER_AUTH_PROVIDER": "<MCP_SERVER_AUTH_PROVIDER>"
}
}
}
}Add to .vscode/mcp.json
{
"servers": {
"mcp-server-auth-template": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_SERVER_RESOURCE_SERVER_URL",
"-e",
"MCP_SERVER_AUTH_PROVIDER",
"ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0"
],
"env": {
"MCP_SERVER_RESOURCE_SERVER_URL": "<MCP_SERVER_RESOURCE_SERVER_URL>",
"MCP_SERVER_AUTH_PROVIDER": "<MCP_SERVER_AUTH_PROVIDER>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-server-auth-template": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_SERVER_RESOURCE_SERVER_URL",
"-e",
"MCP_SERVER_AUTH_PROVIDER",
"ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0"
],
"env": {
"MCP_SERVER_RESOURCE_SERVER_URL": "<MCP_SERVER_RESOURCE_SERVER_URL>",
"MCP_SERVER_AUTH_PROVIDER": "<MCP_SERVER_AUTH_PROVIDER>"
}
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mcp-server-auth-template": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MCP_SERVER_RESOURCE_SERVER_URL",
"-e",
"MCP_SERVER_AUTH_PROVIDER",
"ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0"
],
"env": {
"MCP_SERVER_RESOURCE_SERVER_URL": "<MCP_SERVER_RESOURCE_SERVER_URL>",
"MCP_SERVER_AUTH_PROVIDER": "<MCP_SERVER_AUTH_PROVIDER>"
}
}
}
}Using several servers? Build one config file with the MCP config generator.
Configuration
MCP_SERVER_RESOURCE_SERVER_URLProtected-resource URL advertised by this deploymentRequiredMCP_SERVER_AUTH_PROVIDERAuthorization-server adapter to useRequiredMCP_SERVER_REQUIRED_SCOPESJSON array of baseline delegated OAuth scopesMCP_SERVER_TRANSPORT_ALLOWED_HOSTSAdditional exact Host values accepted by the local container transportMCP_SERVER_ENTRA_TENANT_IDRequired when MCP_SERVER_AUTH_PROVIDER=entraMCP_SERVER_ENTRA_AUDIENCERequired when MCP_SERVER_AUTH_PROVIDER=entraMCP_SERVER_ENTRA_APPLICATION_ID_URIRequired when MCP_SERVER_AUTH_PROVIDER=entraMCP_SERVER_GENERIC_ISSUER_URLRequired when MCP_SERVER_AUTH_PROVIDER=genericMCP_SERVER_GENERIC_AUDIENCERequired when MCP_SERVER_AUTH_PROVIDER=genericMCP_SERVER_GENERIC_JWKS_ALLOWED_ORIGINSOptional JSON array of explicitly trusted cross-origin JWKS origins
Tools this server provides (2)
Taken from the project documentation; the running server may differ.
- whoami
- Returns the verified caller identity.
- health
- Requires the mcp:tools:health scope and demonstrates a 403 insufficient_scope challenge.
What it does
- Entra and OIDC adapters
- Switches between Microsoft Entra ID and generic OIDC authorization servers through a single provider setting.
- Exact token validation
- Checks issuer, signature, expiry, algorithm and audience, and rejects wrong-audience tokens with a 401.
- Progressive scope challenges
- Returns a 403 insufficient_scope before dispatch when a tool needs a scope the caller lacks.
- Protected resource metadata
- Publishes RFC 9728 metadata so clients can discover the authorization server.
- Per-principal tool listing
- Filters tools/list by caller and keeps protected tools hidden from anonymous discovery.
- Metadata-only tracing
- Emits OpenTelemetry spans carrying W3C trace context while excluding credentials and MCP payloads.
Good for
- Adding OAuth 2.1 protection to a remote MCP server before exposing it beyond localhost
- Requiring Entra ID delegated scopes for MCP tools used by enterprise staff
- Enforcing per-tool scope step-up for sensitive operations in an MCP server
- Checking a team's MCP authorization design against a working reference implementation
Pricing
Open source
Open source under the MIT licence, self-hosted.
MCP Server Auth Template FAQ
Which authorization providers are supported?
The README describes Microsoft Entra ID and generic OIDC, selected with the MCP_SERVER_AUTH_PROVIDER setting.
Does it ship production-ready tools?
No. The README says the example whoami and health tools are reference tools and that domain tools need their own authorization policies.
How is the server run?
The README gives a uv-based quick start with uvicorn, a production entrypoint, and a published GHCR container image tagged v0.7.0.
Is MCP Server Auth Template free?
Yes. MCP Server Auth Template is open source, so you can use and self-host it for free.
How do I add MCP Server Auth Template to Claude Code?
Run this command in your terminal: claude mcp add mcp-server-auth-template --env MCP_SERVER_RESOURCE_SERVER_URL='<MCP_SERVER_RESOURCE_SERVER_URL>' --env MCP_SERVER_AUTH_PROVIDER='<MCP_SERVER_AUTH_PROVIDER>' -- docker run -i --rm -e MCP_SERVER_RESOURCE_SERVER_URL -e MCP_SERVER_AUTH_PROVIDER ghcr.io/brunovicco/mcp-server-auth-template:v0.7.0
What are the best alternatives to MCP Server Auth Template?
The closest alternatives to MCP Server Auth Template are mcp-agent-template, Security Mcp, MCP OAuth client-interop conformance, Toolmesh and Tempr MCP Connector.
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.