2.13.0
Install auth stack to your FastMCP server with Scalekit using the Remote OAuth pattern: Scalekit handles user authentication, and the MCP server validates issued tokens.
Prerequisites
Before you begin- Get a Scalekit account and grab your Environment URL from Dashboard > Settings .
- Have your FastMCP serverās base URL ready (can be localhost for development, e.g.,
http://localhost:8000/)
Step 1: Configure MCP server in Scalekit environment
1
Register MCP server and set environment
In your Scalekit dashboard:
- Open the MCP Servers section, then select Create new server
- Enter server details: a name, a resource identifier, and the desired MCP client authentication settings
- Save, then copy the Resource ID (for example, res_92015146095)
.env:Step 2: Add auth to FastMCP server
Create your FastMCP server file and use the ScalekitProvider to handle all the OAuth integration automatically:Warning: The legacymcp_urlandclient_idparameters are deprecated and will be removed in a future release. Usebase_urlinstead ofmcp_urland removeclient_idfrom your configuration.
server.py
Testing
Start the MCP server
Provider selection
Setting this environment variable allows the Scalekit provider to be used automatically without explicitly instantiating it in code.default:"Not set"
Set to
fastmcp.server.auth.providers.scalekit.ScalekitProvider to use Scalekit authentication.Scalekit-specific configuration
These environment variables provide default values for the Scalekit provider, whether itās instantiated manually or configured viaFASTMCP_SERVER_AUTH.
required
Your Scalekit environment URL from the Admin Portal (e.g.,
https://your-env.scalekit.com)required
Your Scalekit resource server ID from the MCP Servers section
required
Public URL of your FastMCP server (e.g.,
https://your-server.com or http://localhost:8000/ for development)FASTMCP_SERVER_AUTH_SCALEKITPROVIDER_MCP_URL is still recognized for backward compatibility but will be removed soon-rename it to ...BASE_URL.default:"[]"
Comma-, space-, or JSON-separated list of scopes that tokens must include to access your server
.env:
server.py