mcp.auth

mcp.auth — opt-in authentication / authorization plumbing for the MCP SDK.

The bare import mcp; does not dump the auth layer at the top level. Token verifiers (JWT, introspection, static), the OAuth client / login helpers, the resource-server helpers, and the OAuth proxy are brought in explicitly with import mcp.auth;.

Modules

client
module mcp.auth.client
Undocumented in source.
csprng
module mcp.auth.csprng
Undocumented in source.
introspection_verifier
module mcp.auth.introspection_verifier

A ready-made opaque-token verifier that validates bearer tokens via OAuth 2.0 Token Introspection (RFC 7662), so MCP server authors don't have to hand-roll the introspection request, response parsing, and claim checks. It is the D analogue of FastMCP's IntrospectionTokenVerifier.

jwt
module mcp.auth.jwt
Undocumented in source.
jwt_verifier
module mcp.auth.jwt_verifier

A ready-made JWT (RFC 7519) access-token verifier that plugs into ResourceServerConfig.validator, so MCP server authors don't have to hand-roll JWS signature verification, JWKS fetching, and claim checks. It is the D analogue of FastMCP's JWTVerifier.

login
module mcp.auth.login
Undocumented in source.
oauth
module mcp.auth.oauth
Undocumented in source.
oauth_proxy
module mcp.auth.oauth_proxy

A server-side OAuth provider that fronts an upstream OAuth identity provider which does NOT support Dynamic Client Registration (GitHub, Google, Azure, etc.). It is the D analogue of FastMCP's OAuthProxy.

providers
module mcp.auth.providers

Turnkey server-side auth presets for common identity providers, the D analogue of FastMCP's provider integrations. Each preset is a thin wrapper that fills in the IdP's well-known issuer / JWKS URI / endpoints / default audience + scopes, so an MCP server author writes one line instead of hand-wiring discovery.

resource_server
module mcp.auth.resource_server
Undocumented in source.
ssrf
module mcp.auth.ssrf
Undocumented in source.
static_verifier
module mcp.auth.static_verifier

A trivial bearer-token verifier built from an in-memory map of token string → TokenInfo, for local development and tests. It is the D analogue of FastMCP's StaticTokenVerifier.

Public Imports

mcp.auth.csprng
public import mcp.auth.csprng;
Undocumented in source.
mcp.auth.oauth
public import mcp.auth.oauth;
Undocumented in source.
mcp.auth.client
public import mcp.auth.client;
Undocumented in source.
mcp.auth.login
public import mcp.auth.login;
Undocumented in source.
mcp.auth.resource_server
public import mcp.auth.resource_server;
Undocumented in source.
mcp.auth.jwt
public import mcp.auth.jwt;
Undocumented in source.
mcp.auth.jwt_verifier
public import mcp.auth.jwt_verifier;
Undocumented in source.
mcp.auth.introspection_verifier
public import mcp.auth.introspection_verifier;
Undocumented in source.
mcp.auth.static_verifier
public import mcp.auth.static_verifier;
Undocumented in source.
mcp.auth.oauth_proxy
public import mcp.auth.oauth_proxy;
Undocumented in source.
mcp.auth.providers
public import mcp.auth.providers;
Undocumented in source.