Something went wrong. Try again.
mirror of github.com/PrefectHQ/fastmcp
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061---title: descopesidebarTitle: descope---
# `fastmcp.server.auth.providers.descope`
Descope authentication provider for FastMCP.
This module provides DescopeProvider - a complete authentication solution that integrateswith Descope's OAuth 2.1 and OpenID Connect services, supporting Dynamic Client Registration (DCR)for seamless MCP client authentication.
## Classes
### `DescopeProvider` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/auth/providers/descope.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
Descope metadata provider for DCR (Dynamic Client Registration).
This provider implements Descope integration using metadata forwarding.This is the recommended approach for Descope DCRas it allows Descope to handle the OAuth flow directly while FastMCP actsas a resource server.
IMPORTANT SETUP REQUIREMENTS:
1. Create an MCP Server in Descope Console: - Go to the [MCP Servers page](https://app.descope.com/mcp-servers) of the Descope Console - Create a new MCP Server - Ensure that **Dynamic Client Registration (DCR)** is enabled - Note your Well-Known URL
2. Note your Well-Known URL: - Save your Well-Known URL from [MCP Server Settings](https://app.descope.com/mcp-servers) - Format: ``https://.../v1/apps/agentic/P.../M.../.well-known/openid-configuration``
For detailed setup instructions, see:https://docs.descope.com/identity-federation/inbound-apps/creating-inbound-apps#method-2-dynamic-client-registration-dcr
**Methods:**
#### `get_routes` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/auth/providers/descope.py#L165" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```pythonget_routes(self, mcp_path: str | None = None) -> list[Route]```
Get OAuth routes including Descope authorization server metadata forwarding.
This returns the standard protected resource routes plus an authorization servermetadata endpoint that forwards Descope's OAuth metadata to clients.
**Args:**- `mcp_path`: The path where the MCP endpoint is mounted (e.g., "/mcp")This is used to advertise the resource URL in metadata.