Configuration
Prerequisites
Before you begin, you will need:- To sign up for a Free Forever Descope account
- Your FastMCP server’s URL (can be localhost for development, e.g.,
http://localhost:8000)
Step 1: Configure Descope
1
Configure a Descope application
You can use either a resource-specific Descope MCP Server or a project-level inbound app.To create an MCP Server, go to the MCP Servers page of the Descope Console, create a server, and enable Dynamic Client Registration (DCR).
2
Copy the Well-Known URL
DescopeProvider accepts both resource-specific MCP Server URLs:Step 2: Environment Setup
Create a.env file with your Descope configuration:
Step 3: FastMCP Configuration
Create your FastMCP server file and use the DescopeProvider to handle all the OAuth integration automatically. Nothing reads.env automatically, so load it explicitly with python-dotenv (pip install python-dotenv) before constructing the provider — otherwise the values you just wrote stay invisible to os.environ.
server.py
Scope discovery and validation
When bothscopes_supported and required_scopes are omitted, DescopeProvider discovers scopes_supported lazily from the OpenID configuration and advertises them to MCP clients. Provider construction remains network-free, and a transient discovery failure is retried on a later metadata request.
Set both options when clients should request a broader set of scopes than the server requires on every token:
scopes_supported controls what the protected resource metadata advertises. required_scopes controls what the JWT verifier requires during token validation. When only required_scopes is set, those scopes are also advertised to clients.
Testing
To test your server, you can use thefastmcp CLI to run it locally. Assuming you’ve saved the above code to server.py (after replacing the environment variables with your actual values!), you can run the following command:
Production Configuration
For production deployments, load configuration from environment variables:server.py

