getmcpauth
Drop-in OAuth 2.1 + Dynamic Client Registration (RFC 7591) token verification for Python MCP servers, backed by mcpauth.
Implements the official mcp SDK's TokenVerifier protocol — the official SDK ships a full bearer-auth middleware stack (BearerAuthBackend, RequireAuthMiddleware) but no ready-made verifier that actually checks a token against a real authorization server. This package is that verifier.
Install
pip install getmcpauth
Usage
import os
from mcp.server.fastmcp import FastMCP
from getmcpauth import McpAuthTokenVerifier, build_auth_settings
mcp = FastMCP(
"my-server",
token_verifier=McpAuthTokenVerifier(
"https://getmcpauth.dev/api/oauth/introspect",
registration_secret=os.environ["MCPAUTH_SECRET"],
),
auth=build_auth_settings(
"https://getmcpauth.dev",
resource_server_url="https://my-server.example.com",
),
)
Get a registration_secret by creating a project at getmcpauth.dev/dashboard.
API
McpAuthTokenVerifier— implementsmcp.server.auth.provider.TokenVerifier. Successful verifications are cached in-process (default 30s) so a chatty agent conversation doesn't trigger a network round trip on every tool call.build_auth_settings(issuer_url, *, resource_server_url, required_scopes=None)— builds anAuthSettingsforFastMCPwith Dynamic Client Registration enabled.required_scope_for_call(body)/is_authorized(required_scope, granted_scopes)/check_batch(bodies, granted_scopes)— helpers for MCP-native tool scoping (tool:<name>scope strings mapped directly totools/callrequests).
Full docs: getmcpauth.dev/docs
Development
pip install -e ".[test]"
pytest
License
MIT
Metadata
Release files for getmcpauth 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| getmcpauth-0.1.0.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| getmcpauth-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / getmcpauth-0.1.0.tar.gz
| Download URL | getmcpauth-0.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39560cdd514109a8720fe034cb3c6bbc77bc33215008f146b073d2de5a7cb5ab
|
|
BLAKE2b-256 checksum How to use checksums |
e2fe1a501d186a56641d605ca1a880b58b17c51a0761bfd78b977bb6aff9b89d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / getmcpauth-0.1.0-py3-none-any.whl
| Download URL | getmcpauth-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03f47fa7fa85d64ad49730224046b853e1d6cc542662a3a99dd80ddc505b9b33
|
|
BLAKE2b-256 checksum How to use checksums |
ed28f7762d19468cb4c201c1516ea41598b0a849df43f10508ca54905815339c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|