Skip to main content

lane-mcp-auth

OAuth 2.1 resource server and consent gate for an MCP server behind Lane — the Python distribution of @getonlane/mcp-auth.

Docsoverview · 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.

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lane_mcp_auth-0.3.0.tar.gz (142.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lane_mcp_auth-0.3.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file lane_mcp_auth-0.3.0.tar.gz.

File metadata

  • Download URL: lane_mcp_auth-0.3.0.tar.gz
  • Upload date:
  • Size: 142.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lane_mcp_auth-0.3.0.tar.gz
Algorithm Hash digest
SHA256 78dd29e2a4bad1a5db4235c40ebd2b6d91cdb57ca6bdde9fbf34ac15571cf96b
MD5 c35e7214732967c4a94ae08d0c4e57f4
BLAKE2b-256 999969fda1e775c4d55f0ac4102154804c31ee8f6b14d6438ab2ef6f4400a5c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for lane_mcp_auth-0.3.0.tar.gz:

Publisher: publish-mcp-auth.yml on Lane-Technologies-Inc/lane

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lane_mcp_auth-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: lane_mcp_auth-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lane_mcp_auth-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 640a85338ae959cc7b9d3d5ab2cf103c5b1d4671b453d578438529d0042f599b
MD5 1bdf46c160225035b56337c3a4ca763a
BLAKE2b-256 7a0e61319d0a50d8e90e8400dac09e21dae0e716898d5cb51745684cb3cf1751

See more details on using hashes here.

Provenance

The following attestation bundles were made for lane_mcp_auth-0.3.0-py3-none-any.whl:

Publisher: publish-mcp-auth.yml on Lane-Technologies-Inc/lane

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.1

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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