@getonlane/mcp-auth
Add Lane sign-in, tool permissions, and user-approved purchases to an MCP server.
Install and register
npm install @getonlane/mcp-auth
npx @getonlane/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 Node.js 22.22.2 or later. The adapters support MCP TypeScript SDK v2 (@modelcontextprotocol/server >=2.1.0 <3), SDK v1 (@modelcontextprotocol/sdk ^1.31.0) and mcp-use ~2.8.0. Each is an optional peer dependency: install the one that your server uses.
Run a server
On MCP TypeScript SDK 2, laneMcpHandler from @getonlane/mcp-auth/mcp-sdk builds the server, gates your tools, serves discovery and verifies the bearer. On mcp-use, oauthLaneProvider and withLaneAuth do the same. On another framework, put laneHttpHandler from @getonlane/mcp-auth/http in front of your MCP transport.
Existing servers has the complete code for each framework: the connection store, test auth, the server and a local test. Follow the MCP SDK or mcp-use guide for the deployed configuration.
Use an in-memory connection store for one process. Use PostgreSQL for multiple processes or registrations that must survive a restart.
Add capabilities
- Scopes: require permission before a tool runs.
- Guest access: open selected read tools without sign-in.
- Claims: read the buyer's shared details.
- Payments: propose a purchase for the user to approve.
- Plan events: handle results and release reservations.
- API reference: options, methods, types, and errors.