lane-mcp-auth
OAuth 2.1 resource server and consent gate for an MCP server behind Lane — the
Python distribution of @getonlane/mcp-auth.
Docs — overview · quickstart · the gate · reference
pip install lane-mcp-auth # core
pip install 'lane-mcp-auth[fastmcp]' # + the FastMCP helpers
Your server verifies bearer tokens, publishes the discovery document clients need, and refuses every tool until the caller holds a recorded, revocable grant.
Set up with one command where the server runs. It pairs with the Lane console
and writes the credential to .env; the secret never passes through a browser:
python -m lane_mcp_auth setup https://acme.example/mcp --name="Acme shop"
Pass client_id and announce_secret and the server announces the resource it
serves on its first guarded call, so Lane binds the hostname to the credential.
from lane_mcp_auth import LaneMcpAuth
auth = LaneMcpAuth(
resource="https://acme.example/mcp",
connections=connections, # yours: this is server-side state
exchanger=exchanger,
)
The three tiers
| tier | reached by | declared |
|---|---|---|
| authenticated only | — | not registrable |
| any connected caller | completing the step-up | no scope |
| a specific authority | the step-up granting it | scope="…" |
Registration is the floor. Omitting a scope means any connected caller, never anyone: a session that has not registered has nothing anyone can revoke, so a tool answering it would be answering something nobody can withdraw.
With FastMCP
from lane_mcp_auth.fastmcp import register_step_up_tool, guarded
register_step_up_tool(mcp, auth)
@mcp.tool()
@guarded(auth, "read_orders", scope="email")
async def read_orders(ctx) -> str:
return await orders_for(ctx)
Never authorize on the token's scopes
claims.scopes is the token's own claim: empty before the step-up, stale after.
Authority lives in the connection and is reachable only through has_scope() /
effective_scopes(), because Lane decides it at exchange time and can refuse an
exchange it would previously have allowed. A signed claim cannot be withdrawn.
Parity with the TypeScript
Same invariants, same names where Python idiom allows. The TypeScript package is
the reference implementation; where the two could drift — scope filtering, the
metadata paths, the gate's decision table — see SCOPE.md for what is
implemented here and what is not yet.
Licence
MIT
Release files for lane-mcp-auth 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lane_mcp_auth-0.7.1.tar.gz | 147.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lane_mcp_auth-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 170.3 kB
Release files / lane_mcp_auth-0.7.1.tar.gz
| Download URL | lane_mcp_auth-0.7.1.tar.gz |
|---|---|
| Size | 147.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
447860785d394b7b07793ecba67f964d0e956d75c15910b722ce0f228a21ffbe
|
|
BLAKE2b-256 checksum How to use checksums |
07557bf6f30081760471595100fbd04b73829510058c8fff2e44d6ffce1521b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 15, 2026.
Transparency logRelease files / lane_mcp_auth-0.7.1-py3-none-any.whl
| Download URL | lane_mcp_auth-0.7.1-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a5987b1e699a30287663bebfca8d12c13265553bab31ddbba4a62f7d10455c9
|
|
BLAKE2b-256 checksum How to use checksums |
572ba901e2e004ecd89f7886a1be938410e4238e9843faf5be74112d18bfebdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 15, 2026.
Transparency log