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
List of allowed redirect URI patterns for MCP clients. Patterns support wildcards (e.g., `"http://localhost:*"`, `"https://*.example.com/*"`).
167
-
-`None` (default): Only localhost redirect URIs allowed (`http://localhost:*`, `http://127.0.0.1:*`)
168
-
- Empty list `[]`: All redirect URIs allowed (not recommended for production)
167
+
-`None` (default): All redirect URIs allowed (for MCP/DCR compatibility)
168
+
- Empty list `[]`: No redirect URIs allowed
169
169
- Custom list: Only matching patterns allowed
170
170
171
171
These patterns apply to MCP client loopback redirects, NOT the upstream OAuth app redirect URI.
@@ -230,29 +230,45 @@ The proxy automatically:
230
230
231
231
## Client Redirect URI Security
232
232
233
-
<Warning>
234
-
By default, OAuth Proxy only accepts localhost redirect URIs from MCP clients for security. You can customize this with the `allowed_client_redirect_uris` parameter:
233
+
<Note>
234
+
OAuth Proxy accepts all redirect URIs by default to maintain compatibility with MCP's Dynamic Client Registration (DCR) pattern, where clients register with unpredictable redirect URIs.
235
+
236
+
If you know which clients will connect, you can restrict redirect URIs using the `allowed_client_redirect_uris` parameter:
235
237
236
238
```python
237
-
# Default: localhost only (secure)
239
+
# Default: allow all (for DCR compatibility)
238
240
auth = OAuthProxy(...)
239
241
240
-
# Custom patterns with wildcards
242
+
# Restrict to localhost only
243
+
auth = OAuthProxy(
244
+
...,
245
+
allowed_client_redirect_uris=[
246
+
"http://localhost:*",
247
+
"http://127.0.0.1:*"
248
+
]
249
+
)
250
+
251
+
# Allow specific known clients (e.g., Claude.ai)
241
252
auth = OAuthProxy(
242
253
...,
243
254
allowed_client_redirect_uris=[
244
255
"http://localhost:*",
245
-
"https://app.example.com/auth/*"
256
+
"https://claude.ai/api/mcp/auth_callback"
246
257
]
247
258
)
248
259
249
-
#Allow all (NOT recommended for production)
260
+
#Custom patterns with wildcards
250
261
auth = OAuthProxy(
251
262
...,
252
-
allowed_client_redirect_uris=[]
263
+
allowed_client_redirect_uris=[
264
+
"http://localhost:*",
265
+
"https://*.example.com/auth/*"
266
+
]
253
267
)
254
268
```
255
-
</Warning>
269
+
270
+
**Tip:** Check your server logs for debug messages that say "Client registered with redirect_uri" messages to see what redirect URIs your clients are using.
0 commit comments