Commit b57ecf3
feat: add MCP server skeleton with OAuth PRM and JWT auth (#4131)
Integrate MCP Go SDK v1.4.0 with Streamable HTTP (stateless) behind
admin:read JWT middleware. Serves Protected Resource Metadata (RFC 9728)
at /.well-known/oauth-protected-resource for MCP client OAuth discovery.
Handlers mount before the /area51/ catch-all to avoid route shadowing.
Devcontainer nginx proxies .well-known endpoints to api-server and
Auth0.
Using local JWT:
<img width="2288" height="1808" alt="image"
src="https://github.com/user-attachments/assets/76385f2b-504d-49fd-abd1-59bb603cc36a"
/>
Using the search accounts tool with mock data:
<img width="3430" height="1154" alt="image"
src="https://github.com/user-attachments/assets/e05493ed-84fd-424b-a852-8cfd549bb13c"
/>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Adds new externally reachable endpoints (`/area51/mcp` plus an
unauthenticated `/.well-known/oauth-protected-resource`) and adjusts
routing/proxying for OAuth discovery, which could impact auth or request
routing if misconfigured.
>
> **Overview**
> **Adds an Area51 MCP server skeleton** using the MCP Go SDK via
stateless Streamable HTTP, mounting `/area51/mcp` behind the existing
JWT middleware and registering an initial read-only `search_accounts`
tool with stubbed results (plus tests).
>
> **Enables OAuth discovery for MCP clients** by serving Protected
Resource Metadata at `/.well-known/oauth-protected-resource` (including
a configurable pre-registered MCP client ID), wiring new config/env for
`API_SERVER_API_DNS` and `API_SERVER_MCP_CLIENT_ID`, and updating the
devcontainer nginx proxy to forward `.well-known` discovery endpoints
(including proxying Auth0 OIDC metadata) and Cursor MCP config to target
the new endpoint.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
cd166b3d4bc2493445c36e38c3158d7d46b874cd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
GitOrigin-RevId: babc653a2dd493aeee7c3141818f98d7e5d47a1f1 parent 4d88848 commit b57ecf3
2 files changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
| 328 | + | |
327 | 329 | | |
328 | 330 | | |
329 | 331 | | |
| |||
436 | 438 | | |
437 | 439 | | |
438 | 440 | | |
| 441 | + | |
439 | 442 | | |
440 | 443 | | |
441 | 444 | | |
| |||
471 | 474 | | |
472 | 475 | | |
473 | 476 | | |
| 477 | + | |
474 | 478 | | |
475 | 479 | | |
476 | 480 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
| 604 | + | |
| 605 | + | |
604 | 606 | | |
605 | 607 | | |
606 | 608 | | |
| |||
840 | 842 | | |
841 | 843 | | |
842 | 844 | | |
| 845 | + | |
| 846 | + | |
843 | 847 | | |
844 | 848 | | |
845 | 849 | | |
| |||
1022 | 1026 | | |
1023 | 1027 | | |
1024 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
1025 | 1031 | | |
1026 | 1032 | | |
1027 | 1033 | | |
| |||
1168 | 1174 | | |
1169 | 1175 | | |
1170 | 1176 | | |
| 1177 | + | |
| 1178 | + | |
1171 | 1179 | | |
1172 | 1180 | | |
1173 | 1181 | | |
| |||
0 commit comments