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
# So your Keycard Resource must be configured as: http://localhost:8000/
253
253
```
254
254
255
-
### Client Credentials for Token Exchange
255
+
### Application Credentials for Token Exchange
256
256
257
-
To enable token exchange (required for the `@grant` decorator), provide application credentials:
257
+
To enable token exchange (required for the `@grant` decorator), you need to configure application credentials. The SDK supports multiple credential types and provides automatic discovery via environment variables.
258
+
259
+
#### Credential Types
260
+
261
+
The SDK supports three types of application credentials:
262
+
263
+
1.**ClientSecret** - OAuth client credentials (client_id/client_secret) issued by Keycard
264
+
2.**WebIdentity** - Private key JWT authentication for MCP servers
265
+
3.**EKSWorkloadIdentity** - AWS EKS Pod Identity for Kubernetes deployments
266
+
267
+
#### Configuration Methods
268
+
269
+
##### 1. Explicit Configuration (Recommended for Production)
270
+
271
+
Explicitly provide credentials when creating the `AuthProvider`:
258
272
259
273
```python
260
-
from keycardai.mcp.integrations.fastmcp import ClientSecret
274
+
from keycardai.mcp.integrations.fastmcp importAuthProvider, ClientSecret
|`KEYCARD_APPLICATION_CREDENTIAL_TYPE`| Explicit credential type selection | All | None |
393
+
|`KEYCARD_WEB_IDENTITY_KEY_STORAGE_DIR`| Directory for private key storage |`WebIdentity`|`"./mcp_keys"`|
394
+
|`AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE`| Path to EKS token file |`EKSWorkloadIdentity`| None |
395
+
396
+
#### Running Without Application Credentials
397
+
398
+
If no application credentials are configured, the `AuthProvider` will work for basic authentication but the `@grant` decorator will be unable to perform token exchange. This is useful for MCP servers that only need user authentication without delegated access to external resources.
399
+
270
400
## Testing
271
401
272
402
This section provides comprehensive guidance on testing your FastMCP servers that use Keycard authentication. The examples show how to use the `mock_access_context` utility to easily mock authentication without needing to understand the internal SDK implementation.
0 commit comments