Metadata-Version: 2.5
Name: lane-mcp-auth
Version: 1.4.0
Summary: OAuth 2.1 resource server and consent gate for an MCP server behind Lane. FastMCP-friendly.
Project-URL: Homepage, https://github.com/Lane-Technologies-Inc/lane-mcp-auth
Project-URL: Source, https://github.com/Lane-Technologies-Inc/lane-mcp-auth
License: MIT
License-File: LICENSE
Keywords: fastmcp,mcp,model-context-protocol,oauth,oauth2,rfc8693,rfc9728
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pyjwt[crypto]>=2.8
Provides-Extra: fastmcp
Requires-Dist: fastmcp<5,>=4.0; extra == 'fastmcp'
Description-Content-Type: text/markdown

# lane-mcp-auth

Add Lane sign-in, tool permissions, and user-approved purchases to an MCP server.

## Install and register

```sh
pip install "lane-mcp-auth[fastmcp]"
python -m lane_mcp_auth setup https://acme.com/mcp --name="Acme shop"
```

Replace the URL with your public MCP endpoint. Setup writes `.env` with the server credentials. The library also needs `LANE_ORG_KEY`, even for free tools. Keep that file out of version control.

Use Python 3.10 or later. The adapter supports FastMCP `>=4.0,<5`, which the `[fastmcp]` extra installs.

## Run a server

On FastMCP, `enable_lane_auth(mcp, auth)` gates your tools, and installs the HTTP gate on `mcp.http_app()` and `mcp.run(transport="http")`. The gate serves discovery and verifies the bearer. On another ASGI framework, put `LaneAuthMiddleware` from `lane_mcp_auth.asgi` in front of your MCP app.

[Existing servers](https://docs.getonlane.com/sell/auth/existing-server) has the complete code: the connection store, test auth, the server and a local test. Follow the [FastMCP](https://docs.getonlane.com/sell/auth/framework-integration?framework=fastmcp) guide for the deployed configuration.

Use an [in-memory connection store](https://docs.getonlane.com/sell/auth/connections#in-memory) for one process. Use [PostgreSQL](https://docs.getonlane.com/sell/auth/connections#postgresql) for multiple processes or registrations that must survive a restart.

## Add capabilities

- [Scopes](https://docs.getonlane.com/sell/auth/scopes): require permission before a tool runs.
- [Guest access](https://docs.getonlane.com/sell/auth/how-guest-access-works): open selected read tools without sign-in.
- [Claims](https://docs.getonlane.com/sell/auth/claims): read the buyer's shared details.
- [Payments](https://docs.getonlane.com/sell/auth/payments): propose a purchase for the user to approve.
- [Plan events](https://docs.getonlane.com/sell/auth/plan-events): handle results and release reservations.
- [API reference](https://docs.getonlane.com/api-reference/mcp-auth): options, methods, types, and errors.
