Skip to content

Commit b57ecf3

Browse files
DavidS-ovmtphoney
authored andcommitted
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: babc653a2dd493aeee7c3141818f98d7e5d47a1f
1 parent 4d88848 commit b57ecf3

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ require (
132132
github.com/miekg/dns v1.1.72
133133
github.com/mitchellh/go-homedir v1.1.0
134134
github.com/mitchellh/go-ps v1.0.0
135+
github.com/modelcontextprotocol/go-sdk v1.4.0
135136
github.com/muesli/reflow v0.3.0
136137
github.com/nats-io/jwt/v2 v2.8.0
137138
github.com/nats-io/nats-server/v2 v2.12.4
@@ -324,6 +325,7 @@ require (
324325
github.com/google/go-github/v75 v75.0.0 // indirect
325326
github.com/google/go-querystring v1.1.0 // indirect
326327
github.com/google/go-tpm v0.9.8 // indirect
328+
github.com/google/jsonschema-go v0.4.2 // indirect
327329
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect
328330
github.com/google/s2a-go v0.1.9 // indirect
329331
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
@@ -436,6 +438,7 @@ require (
436438
github.com/samber/lo v1.52.0 // indirect
437439
github.com/samber/slog-common v0.20.0 // indirect
438440
github.com/segmentio/asm v1.2.0 // indirect
441+
github.com/segmentio/encoding v0.5.3 // indirect
439442
github.com/shirou/gopsutil/v3 v3.23.7 // indirect
440443
github.com/shoenig/go-m1cpu v0.1.6 // indirect
441444
github.com/sorairolake/lzip-go v0.3.5 // indirect
@@ -471,6 +474,7 @@ require (
471474
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
472475
github.com/xiam/to v0.0.0-20191116183551-8328998fc0ed // indirect
473476
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
477+
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
474478
github.com/yuin/goldmark v1.7.10 // indirect
475479
github.com/yuin/goldmark-emoji v1.0.5 // indirect
476480
github.com/yusufpapurcu/wmi v1.2.4 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u
601601
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
602602
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
603603
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
604+
github.com/google/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbcqoRA8=
605+
github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
604606
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
605607
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
606608
github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc=
@@ -840,6 +842,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
840842
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
841843
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
842844
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
845+
github.com/modelcontextprotocol/go-sdk v1.4.0 h1:u0kr8lbJc1oBcawK7Df+/ajNMpIDFE41OEPxdeTLOn8=
846+
github.com/modelcontextprotocol/go-sdk v1.4.0/go.mod h1:Nxc2n+n/GdCebUaqCOhTetptS17SXXNu9IfNTaLDi1E=
843847
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
844848
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
845849
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -1022,6 +1026,8 @@ github.com/sashabaranov/go-openai v1.41.2 h1:vfPRBZNMpnqu8ELsclWcAvF19lDNgh1t6TV
10221026
github.com/sashabaranov/go-openai v1.41.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
10231027
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
10241028
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
1029+
github.com/segmentio/encoding v0.5.3 h1:OjMgICtcSFuNvQCdwqMCv9Tg7lEOXGwm1J5RPQccx6w=
1030+
github.com/segmentio/encoding v0.5.3/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0=
10251031
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
10261032
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
10271033
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
@@ -1168,6 +1174,8 @@ github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZ
11681174
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
11691175
github.com/yl2chen/cidranger v1.0.2 h1:lbOWZVCG1tCRX4u24kuM1Tb4nHqWkDxwLdoS+SevawU=
11701176
github.com/yl2chen/cidranger v1.0.2/go.mod h1:9U1yz7WPYDwf0vpNWFaeRh0bjwz5RVgRy/9UEQfHl0g=
1177+
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
1178+
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
11711179
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
11721180
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
11731181
github.com/yuin/goldmark v1.7.10 h1:S+LrtBjRmqMac2UdtB6yyCEJm+UILZ2fefI4p7o0QpI=

0 commit comments

Comments
 (0)