mcp-use Scalekit MCP Auth
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-use Scalekit MCP AuthWho am I?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-use + Scalekit MCP Auth
An mcp-use MCP server that authenticates with Scalekit OAuth 2.1.
Teammates share one server URL. Each person signs in. Tools see their identity (ctx.auth.user.id), not a shared API key.
This example does not use @scalekit-sdk/node and does not need a Scalekit client id or secret. The resource server verifies JWTs against Scalekit JWKS.
The cookbook-style how-to lives in docs/v2/typescript/server/authentication/providers/scalekit.mdx. This README is the runbook for this repository.
Useyour own Scalekit environment. This repository ships placeholders only. Never commit .env.
What you get
Streamable HTTP MCP at
/mcp401 +
WWW-Authenticatepointing at RFC 9728 protected-resource metadataScalekit as the authorization server (DCR and CIMD)
whoami— authenticated user, scopes, and tokeniss/audgreet— a tool that keys offctx.auth.user.id
Related MCP server: Access Self-Hosted MCP Server
How a client signs in
sequenceDiagram
participant Client as MCP client
participant Server as This server
participant SK as Your Scalekit env
Client->>Server: POST /mcp (no token)
Server-->>Client: 401 + WWW-Authenticate
Client->>Server: GET /.well-known/oauth-protected-resource/mcp
Server-->>Client: authorization_servers = Scalekit resource issuer
Client->>SK: Discover AS metadata, register via DCR or CIMD
Client->>SK: User signs in and consents
SK-->>Client: Access token (aud includes res_…)
Client->>Server: POST /mcp Authorization: Bearer …
Server-->>Client: Tool result scoped to ctx.auth.user.idPrerequisites
Node.js 22.22.2 or newer
At least one auth method enabled (Google, GitHub, passwordless, or enterprise SSO)
1. Register an MCP server in Scalekit
Follow the MCP Auth quickstart with these values:
Open Scalekit Dashboard → MCP servers → Add MCP server.
Give it a name. That name appears on the consent screen.
Enable dynamic client registration and Client ID Metadata Document (CIMD). Public clients such as Inspector, Claude, and Cursor need at least one of these; keep both on.
Under advanced settings, set Server URL to:
http://localhost:3000/mcpNo trailing slash. When set, Scalekit writes this URL into the access-token
audclaim alongside theres_…id. If you leave it empty,audis onlyres_…— this example still verifies.Save. Copy from the server page:
Environment URL —
https://<your-env>.scalekit.cloudResource ID —
res_…
If you toggle DCR or CIMD later, restart this example. Some MCP clients cache authorization-server metadata.
2. Configure this repo
git clone git@github.com:scalekit-developers/scalekit-mcpuse-example.git
cd scalekit-mcpuse-example
npm install
cp .env.example .envEdit .env with your values. There are no sample credentials in this repo.
SCALEKIT_ENVIRONMENT_URL=https://your-env.scalekit.cloud
SCALEKIT_RESOURCE_ID=res_xxxxxxxx
MCP_URL=http://localhost:3000/mcpVariable | Where it comes from |
| Dashboard → API credentials → Environment URL |
| Dashboard → MCP servers → this server → |
| Must match Server URL exactly (no trailing slash) |
There is no SCALEKIT_CLIENT_ID or SCALEKIT_CLIENT_SECRET. The resource server only verifies tokens that Scalekit already issued.
3. Run and sign in
npm run devMCP endpoint | |
Inspector |
Open Inspector.
Connect to
http://localhost:3000/mcp. The first call returns 401; Inspector starts Scalekit login.Complete consent in the browser.
Call
whoami.
You should see a usr_… id, subjectType: "user", scopes such as openid / profile, and:
{
"iss": "https://your-env.scalekit.cloud",
"aud": ["http://localhost:3000/mcp", "res_xxxxxxxx"]
}iss may also be https://your-env.scalekit.cloud/resources/res_xxxxxxxx. This example accepts both while Scalekit migrates issuer values.
Then call greet. The greeting uses ctx.auth.user.id from the verified token — that is the pattern for scoping tool data per user.
How verification works
oauth: oauthScalekitProvider({
environmentUrl: process.env.SCALEKIT_ENVIRONMENT_URL!,
resourceId: process.env.SCALEKIT_RESOURCE_ID!,
resource: process.env.MCP_URL!,
}),Check | Source |
Signature | JWKS at |
| Environment root or |
| Must include |
Identity |
|
resourceId is the per-server security boundary. A token minted for a different MCP server in the same Scalekit environment must fail.
Authorization belongs next to the tool:
async (_args, ctx) => {
// ctx.auth.user.id is this caller — scope your data to it
if (!ctx.auth.scopes.includes("todos:write")) {
return { isError: true, content: [{ type: "text", text: "Missing scope" }] };
}
};oauth/scalekit.ts is a prototype of a first-class mcp-use/oauth/scalekit adapter. It is not published on npm yet.
Project structure
Path | Role |
| mcp-use server, OAuth wiring, |
| JWT + JWKS provider |
| Cookbook: authenticate an mcp-use server with Scalekit |
| Placeholders only |
Changing the public URL
If you expose the server (tunnel, deploy, custom host):
Set Server URL in Scalekit to that origin +
/mcp(no trailing slash).Set
MCP_URLto the same string.Restart this process.
The verifier does not change. resourceId stays the audience check.
Troubleshooting
Symptom | Likely cause |
Server throws on boot about |
|
Inspector never starts login | DCR/CIMD off, or you did not restart after toggling them |
Login works, every tool is 401 | Server URL does not match |
| Server URL was left empty in the dashboard — still valid; this example binds on |
Need claim details on a 401 | Set |
Scalekit also publishes a MCP auth troubleshooting guide.
Security
Do not put client secrets, API keys, or personal environment URLs in this repository.
.envis gitignored. Commit only.env.example.This process never calls Scalekit with a client secret. It only verifies bearer tokens.
MCP_USE_OAUTH_DEBUG=1decodes the JWT payload foriss/aud/sub. It does not print the token.
Docs
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceA remote MCP server implementation that demonstrates authentication and authorization capabilities using OAuth 2.1. This is a workshop project for learning how to build secure MCP servers with user authentication.27,437MIT
- Alicense-qualityCmaintenanceAn MCP server protected by Cloudflare Access, validating JWTs to conditionally expose tools based on user identity.2,504MIT
- Alicense-qualityDmaintenanceAn MCP server demonstrating OAuth 2.0 authentication with Keycard's Security Token Service, providing tools for displaying the Keycard logo and retrieving authenticated user information.181Apache 2.0
- Flicense-qualityCmaintenanceA toy MCP server demonstrating OAuth 2.1 scoped authorization with three tools for minion status, listing, and summoning.
Related MCP Connectors
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
MCP server for Argo RPG Platform — connects AI assistants to campaign data via OAuth2
MCP server teaching AI agents to implement TideCloak: auth, E2EE, IGA, security analysis
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/scalekit-developers/scalekit-mcpuse-example'
If you have feedback or need assistance with the MCP directory API, please join our Discord server