mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-18 11:39:12 +02:00
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ravi Madabhushi <ravi.madabhushi@scalekit.com> Co-authored-by: Ravi Madabhushi <innovativeravi@gmail.com> Co-authored-by: saif-at-scalekit <saif.shaik@scalekit.com> |
||
|---|---|---|
| .. | ||
| client.py | ||
| README.md | ||
| server.py | ||
Scalekit OAuth Example
Demonstrates FastMCP server protection with Scalekit OAuth.
Setup
1. Configure MCP server in Scalekit environment
Create a Scalekit Account:
- Go to Scalekit Dashboard
- Navigate to Developers → Settings
- Copy your Environment URL, Client ID, and Client Secret
Register Your MCP Server:
- Go to MCP Servers → Create New Server
- Fill in your MCP server details
- Note the Resource ID (e.g.,
res_123)
Create a .env file:
# Required Scalekit credentials
SCALEKIT_ENVIRONMENT_URL=<YOUR_APP_ENVIRONMENT_URL>
SCALEKIT_CLIENT_ID=<YOUR_APP_CLIENT_ID> # skc_7008EXAMPLE46
SCALEKIT_RESOURCE_ID=<YOUR_APP_RESOURCE_ID> # res_926EXAMPLE5878
MCP_URL=http://localhost:8000/mcp
2. Run the Example
Start the server:
# From this directory
uv run python server.py
The server will start on http://localhost:8000/mcp with Scalekit OAuth authentication enabled.
Test with client:
uv run python client.py
The client.py will:
- Attempt to connect to the server
- Detect that OAuth authentication is required
- Open a browser for Scalekit authentication
- Complete the OAuth flow and connect to the server
- Demonstrate calling authenticated tools