Skip to content

Commit 36f0c73

Browse files
committed
fix: exclude MCP paths from basic auth and route OAuth discovery
- Exclude /mcp, /sse, /message, and /.well-known/oauth-* from basic auth so MCP clients can connect without HTTP credentials. - Route OAuth discovery paths to the MCP server instead of the frontend SPA, so clients receive proper HTTP responses (404 when OAuth is disabled) instead of HTML.
1 parent 7194b53 commit 36f0c73

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

deploy/demo/Caddyfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ demo.meridianhub.cloud, *.demo.meridianhub.cloud {
1919
# Uses a negated matcher to explicitly exclude health probes from auth,
2020
# since Caddy's default directive order runs basicauth before handle blocks.
2121
@not_health_probes {
22-
not path /healthz /readyz
22+
not path /healthz /readyz /mcp /sse /message /.well-known/oauth-*
2323
}
2424
basicauth @not_health_probes {
2525
demo $2a$14$xfFb2xnq6vOhKOEh7TTgTula3G.F6MxoT7DawQLGBPziCgjTcWCrS
@@ -32,6 +32,8 @@ demo.meridianhub.cloud, *.demo.meridianhub.cloud {
3232

3333
# MCP Server: streamable HTTP + legacy SSE transport
3434
# NOTE: Requires mcp-server container to be running; routes will 502 until deployed.
35+
# OAuth discovery paths must also route to MCP server so Claude Code's
36+
# MCP client receives proper JSON (not the frontend SPA HTML).
3537
handle /mcp {
3638
reverse_proxy mcp-server:8090
3739
}
@@ -41,6 +43,12 @@ demo.meridianhub.cloud, *.demo.meridianhub.cloud {
4143
handle /message {
4244
reverse_proxy mcp-server:8090
4345
}
46+
handle /.well-known/oauth-authorization-server {
47+
reverse_proxy mcp-server:8090
48+
}
49+
handle /.well-known/oauth-protected-resource {
50+
reverse_proxy mcp-server:8090
51+
}
4452

4553
# API: ConnectRPC + version
4654
@api {

0 commit comments

Comments
 (0)