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: packages/mcp/README.md
+108Lines changed: 108 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,114 @@ Keycard allows MCP servers to access other resources on behalf of users with aut
112
112
3.**Set MCP server dependencies** to allow delegated access
113
113
4.**Create client secret identity** to provide authentication method
114
114
115
+
#### Application Credentials for Token Exchange
116
+
117
+
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.
118
+
119
+
##### Credential Types
120
+
121
+
The SDK supports three types of application credentials:
122
+
123
+
1.**ClientSecret** - OAuth client credentials (client_id/client_secret) issued by Keycard
124
+
2.**WebIdentity** - Private key JWT authentication for MCP servers
125
+
3.**EKSWorkloadIdentity** - AWS EKS Pod Identity for Kubernetes deployments
126
+
127
+
##### Configuration Methods
128
+
129
+
**1. Explicit Configuration (Recommended for Production)**
130
+
131
+
Explicitly provide credentials when creating the `AuthProvider`:
132
+
133
+
```python
134
+
from keycardai.mcp.server.auth import AuthProvider, ClientSecret
|`KEYCARD_APPLICATION_CREDENTIAL_TYPE`| Explicit credential type selection | All | None |
216
+
|`KEYCARD_WEB_IDENTITY_KEY_STORAGE_DIR`| Directory for private key storage |`WebIdentity`|`"./mcp_keys"`|
217
+
|`AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE`| Path to EKS token file |`EKSWorkloadIdentity`| None |
218
+
219
+
##### Running Without Application Credentials
220
+
221
+
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.
0 commit comments