You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/integrations/authkit.mdx
+21-16Lines changed: 21 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,29 +9,32 @@ import { VersionBadge } from "/snippets/version-badge.mdx"
9
9
10
10
<VersionBadgeversion="2.11.0" />
11
11
12
-
This guide shows you how to secure your FastMCP server using WorkOS's **AuthKit**, a complete authentication and user management solution. This integration uses the [**Remote OAuth**](/servers/auth/remote-oauth) pattern, where AuthKit handles user login and your FastMCP server validates the tokens.
13
-
14
-
<Warning>
15
-
AuthKit does not currently support [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html) resource indicators, so FastMCP cannot validate that tokens were issued for the specific resource server. If you need resource-specific audience validation, consider using [WorkOSProvider](/integrations/workos) (OAuth proxy pattern) instead.
16
-
</Warning>
12
+
This guide shows you how to secure your FastMCP server using WorkOS's **AuthKit**, a complete authentication and user management solution. This integration uses the [**Remote OAuth**](/servers/auth/remote-oauth) pattern with [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html) resource indicators: AuthKit issues tokens whose `aud` claim is bound to your server's resource URL, and FastMCP validates that claim automatically.
17
13
18
14
## Configuration
15
+
19
16
### Prerequisites
20
17
21
18
Before you begin, you will need:
22
19
1. A **[WorkOS Account](https://workos.com/)** and a new **Project**.
23
20
2. An **[AuthKit](https://www.authkit.com/)** instance configured within your WorkOS project.
24
-
3. Your FastMCP server's URL (can be localhost for development, e.g., `http://localhost:8000`).
21
+
3. Your FastMCP server's URL (can be localhost for development, e.g., `http://127.0.0.1:8000`).
25
22
26
-
### Step 1: AuthKit Configuration
23
+
### Step 1: WorkOS Dashboard
27
24
28
-
In your WorkOS Dashboard, enable AuthKit and configure the following settings:
25
+
In the WorkOS Dashboard, go to **Connect → Configuration** and configure:
29
26
30
27
<Steps>
31
-
<Steptitle="Enable Dynamic Client Registration">
32
-
Go to **Applications → Configuration** and enable **Dynamic Client Registration**. This allows MCP clients register with your application automatically.
28
+
<Steptitle="MCP Auth">
29
+
Enable **Dynamic Client Registration** (DCR) so MCP clients can register themselves. Alternatively, enable **Client ID Metadata Document** (CIMD) if your clients support it.
Add your FastMCP server's resource URL (e.g., `http://127.0.0.1:8000/mcp`) as a valid resource indicator.
34
+
35
+
This must exactly match what FastMCP advertises in its protected resource metadata. Start your server first and it will log the correct URL on startup — copy that value.
36
+
37
+
Without this step, AuthKit falls back to a default environment-scoped audience and audience validation will fail with a 401.
35
38
</Step>
36
39
37
40
<Steptitle="Note Your AuthKit Domain">
@@ -47,16 +50,18 @@ Create your FastMCP server file and use the `AuthKitProvider` to handle all the
47
50
from fastmcp import FastMCP
48
51
from fastmcp.server.auth.providers.workos import AuthKitProvider
When the server starts, it logs the resource URL it is validating against. Paste that URL into your Dashboard's **MCP resource indicators** list.
64
+
60
65
## Testing
61
66
62
67
To test your server, you can use the `fastmcp` CLI to run it locally. Assuming you've saved the above code to `server.py` (after replacing the `authkit_domain` and `base_url` with your actual values!), you can run the following command:
0 commit comments