Scalekit Authentication
An MCP server with Scalekit authentication for B2B organizations. Per-user and per-org data isolation with optional RBAC.
An authenticated MCP server using Scalekit for per-user and per-organization access.
Features
- Scalekit OAuth 2.1 via the official @xmcp-dev/scalekit plugin
- Per-user and per-organization session via
getSession() - RBAC support using permissions from the access token
- Example tools:
whoami,save_note,list_my_notes(demonstrating isolation) - HTTP transport with middleware-based auth
- Works with Cursor, Claude Code, Claude Desktop, and other MCP clients
Getting Started
Prerequisites
You need a Scalekit account with:
- An MCP server resource registered in the dashboard
- Dynamic Client Registration enabled
1. Create the project
2. Environment setup
Edit .env with your Scalekit credentials:
3. Install & run
How It Works
- MCP clients send requests with
Authorization: Bearer <token>header - The middleware verifies the JWT using Scalekit's JWKS
- Valid sessions (including organization context) are stored in AsyncLocalStorage context
- Tools access session data via
getSession()
Using Session Data in Tools
Demonstrating Per-User and Per-Organization Isolation
This template includes example tools save_note and list_my_notes that scope data to the authenticated user and organization, with optional RBAC using permissions like notes:read and notes:write.
For a full test with multiple organizations, see the Scalekit Integration Guide.
RBAC with Permissions (Optional)
Scalekit can include permissions in the token. Enforce them in tools:
OAuth Endpoints
The plugin automatically registers:
GET /.well-known/oauth-protected-resource— Resource server metadataGET /.well-known/oauth-authorization-server— Authorization server metadata
Deploy
Learn More
Other templates
Auth0 Authentication
An MCP server with Auth0 authentication and tools to interact with Auth0 client.
Clerk Authentication
An MCP server with Clerk authentication, session data and organization management
WorkOS AuthKit
An MCP server with WorkOS AuthKit authentication

