Skip to main content

browserid-mcp-auth (Python)

Warrant-gated MCP tools over MCP's own OAuth 2.1 — the Python port of @browserid-ng/mcp-auth. No API keys: an agent redeems its human's short-lived, scoped, revocable BrowserID warrant for a bearer, and every tool call is attributable to "agent X on behalf of human Y". Revoke at browserid.me/account and the agent dies on its next call.

An embedded authorization server (the RFC 7521 jwt-bearer assertion grant) + a resource-server guard that re-checks the warrant's revocation status fail-closed on every call. Verification is delegated to the broker's DNSSEC-rooted hosted verifier (POST /verify) and POST /status/check — no crypto in Python. Stdlib-only (no runtime deps).

Use

from browserid_mcp_auth import McpAuth, McpAuthError

auth = McpAuth(
    resource="https://mcp.example.com",           # this server (OAuth resource + audience)
    scopes_for_tool={"create_issue": ["issues:create"]},
)

# 1. Discovery (serve as JSON):
#    GET /.well-known/oauth-protected-resource   -> auth.protected_resource_metadata()
#    GET /.well-known/oauth-authorization-server  -> auth.authorization_server_metadata()

# 2. Token endpoint (the embedded AS):
#    POST /token  ->  auth.handle_token(request_body)   # {grant_type, assertion, scope?}

# 3. Gate a tool call:
ctx = auth.require_warrant(authorization_header, "create_issue")
# ctx.grantor (human), ctx.grantee (agent), ctx.holder, ctx.issuer, ctx.scopes

On failure handle_token / require_warrant raise McpAuthError with .oauth_error and .http_status; render err.to_token_error_response() at the token endpoint and auth.challenge() in the WWW-Authenticate header on a 401.

FastMCP

FastMCP servers speak MCP OAuth; mount the three surfaces above on the server's HTTP app (the token endpoint + the two discovery routes), and call auth.require_warrant(request.headers.get("authorization"), tool_name) at the top of each tool. The core is synchronous and dependency-free; call it directly or wrap in a thread from async handlers. http_post is injectable if you prefer httpx/requests over the stdlib urllib default.

API

McpAuth(resource, broker="https://browserid.me", scopes_for_tool=None, token_ttl_s=3600, status_cache_s=60, accepted_fallbacks=None, store=None, http_post=None); handle_token(params), authenticate(header), require_warrant(header, tool_or_scopes), protected_resource_metadata(), authorization_server_metadata(), challenge(). MPL-2.0.

Metadata

Release files for browserid-mcp-auth 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for browserid-mcp-auth 0.1.1
File Size Uploaded Provenance Actions
browserid_mcp_auth-0.1.1.tar.gz 6.9 kB Without provenance Details for browserid_mcp_auth-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for browserid-mcp-auth 0.1.1
File Interpreter ABI Platform Actions
browserid_mcp_auth-0.1.1-py3-none-any.whl Python 3 none any Details for browserid_mcp_auth-0.1.1-py3-none-any.whl

Total release size: 12.8 kB

Release files / browserid_mcp_auth-0.1.1.tar.gz

Download URL browserid_mcp_auth-0.1.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
68b2492ff63b4cfa5e952b85450f75d4ef6aa9e1fd2eb753495a83062ebcfa1a
BLAKE2b-256 checksum
How to use checksums
1c3a47f8819b76a152f492ed33035ce5950e02433706a7b2a71b9f896a349851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / browserid_mcp_auth-0.1.1-py3-none-any.whl

Download URL browserid_mcp_auth-0.1.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8c83330635cfffc6c9470e96af07565dfe7602c1c37cf31bbd41ca2d01bd511
BLAKE2b-256 checksum
How to use checksums
7fda3e305b293ecfd1393d99569c949ffd38300f11dc4f26a26fa5e82452f09e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for browserid-mcp-auth 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page