Skip to main content

mcp-login-oauth

OAuth 2.1 browser login for FastMCP servers that sit in front of another service. Clients that can't send a token header, such as claude.ai, the Claude desktop and mobile apps, log in once with a form. The form is checked by the service behind the server, for example a Trilium password, an InvoiceNinja email, password and 2FA code, or a Paperless username and password. The client then only holds opaque OAuth tokens. Your server turns each login into a grant, such as a service token minted at login, and reads it back in tool code.

The library provides:

  • dynamic client registration, PKCE, refresh rotation and revocation, including revocation for public clients, which the MCP SDK's own /revoke rejects;
  • a Fernet-encrypted file store that survives restarts;
  • the login page with configurable fields, hints and collapsed sections for alternative logins, and honest dead-end pages for broken flows;
  • tokens bound to this server (RFC 8707 resource indicators) and the issuer named on the code redirect (RFC 9207);
  • protection against password guessing: a delay after each failed login, and login links that end after 5 failures or 10 minutes;
  • optional static header tokens next to OAuth.

What this library stands for and where it is going are on the documentation site.

TypeScript? This library is Python only; TypeScript apps sign in with Better Auth, see Coming from TypeScript.

Used by trilium-mcp, invoiceninja-mcp, paperless-ngx-mcp and the recall engine in trilium-llm-wiki.

Install

From PyPI:

uv add mcp-login-oauth

Needs Python ≥ 3.12 and FastMCP ≥ 4.1.3.

Documentation: mcp-login-oauth.marceltov.de: getting started, the reference, behaviour, development and the design decisions.

License

Copyright © 2026 Marcel Bruckner.

Licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). You may use, modify, and redistribute it, but any modified version — including one you run as a network service — must be released under the same license with its source made available to its users, and the original copyright notice preserved. See LICENSE for the full terms.

Metadata

Release files for mcp-login-oauth 0.2.2

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

Source distribution (sdist)

Source distribution for mcp-login-oauth 0.2.2
File Size Uploaded Provenance Actions
mcp_login_oauth-0.2.2.tar.gz 27.7 kB With provenance Details for mcp_login_oauth-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-login-oauth 0.2.2
File Interpreter ABI Platform Actions
mcp_login_oauth-0.2.2-py3-none-any.whl Python 3 none any Details for mcp_login_oauth-0.2.2-py3-none-any.whl

Total release size: 52.3 kB

Release files / mcp_login_oauth-0.2.2.tar.gz

Download URL mcp_login_oauth-0.2.2.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
86459da2d36126e4d918aa561f3a620d8a0f4d7ebc8fbcab316ad75d68f93972
BLAKE2b-256 checksum
How to use checksums
803c5514acfbf2aabd9d571551a1651ce47caaffca4d991649742d02de12adcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / mcp_login_oauth-0.2.2-py3-none-any.whl

Download URL mcp_login_oauth-0.2.2-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d76d57b56c39d6707a8a907d97d77dcbdf674784d00a39fd5ff8ff82e1f9e90
BLAKE2b-256 checksum
How to use checksums
7edaf38b5ef5809a5f0128cc221c024f10d66d547b28ac9cff25c3572f5ab709
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for mcp-login-oauth 0.2.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_login_oauth-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

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.2.2 This release

2 release files Full 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