From 836552da9dedff1d2b143b22da369b20dcb6d42a Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Fri, 21 Nov 2025 15:03:41 +0200 Subject: [PATCH 1/3] Mention mcp-remote as fallback for oauth 2 mcp registeration --- docs/api/mcp/index.mdx | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/api/mcp/index.mdx b/docs/api/mcp/index.mdx index 9e9d3837f..d0ddb446c 100644 --- a/docs/api/mcp/index.mdx +++ b/docs/api/mcp/index.mdx @@ -28,7 +28,35 @@ For programmatic access without storing credentials, use OAuth 2.0 with device f #### Prerequisites -Before using OAuth, you must create an OAuth application in your Sourcegraph instance. Follow the instructions [here](/admin/oauth_apps#creating-an-oauth-app). (Note: you will need the `user:all` scope) +Before using OAuth, you must create an OAuth application in your Sourcegraph instance. Follow the instructions [here](/admin/oauth_apps#creating-an-oauth-app). (Note: you will need the `user:all` scope) + +#### Registering the MCP Server + +Once you have your Client ID, you can register the MCP server in your client using that ID. + +If your client does not natively support specifying an OAuth 2.0 Client ID, you can use `mcp-remote` as a fallback. Add the following configuration to the relevant section for MCP servers of your client to use the `stdio` transport with the following configuration: + +```json +{ + "sourcegraph": { + "type": "stdio", + "command": "npx", + "args": [ + "mcp-remote", + "https://your-sourcegraph-instance.com/.api/mcp/v1", + "3334", + "--static-oauth-client-info", + "{\"client_id\":\"\"}", + "--static-oauth-client-metadata", + "{\"scope\":\"user:all\"}" + ] + } +} +``` + + + Replace `your-sourcegraph-instance.com` with your Sourcegraph instance URL and `` with the ID of the client you registered in the prerequisites step. + ### Authorization Header From 0ddd9bce21346219d79c1b9cdd86ed9edb2fa21d Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Tue, 25 Nov 2025 17:10:40 +0200 Subject: [PATCH 2/3] mention redirect URI when using mcp-remote --- docs/api/mcp/index.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/api/mcp/index.mdx b/docs/api/mcp/index.mdx index d0ddb446c..94c6e93d6 100644 --- a/docs/api/mcp/index.mdx +++ b/docs/api/mcp/index.mdx @@ -55,7 +55,10 @@ If your client does not natively support specifying an OAuth 2.0 Client ID, you ``` - Replace `your-sourcegraph-instance.com` with your Sourcegraph instance URL and `` with the ID of the client you registered in the prerequisites step. +
    +
  • Replace `your-sourcegraph-instance.com` with your Sourcegraph instance URL and `` with the ID of the client you registered in the prerequisites step.
  • +
  • When using the `mcp-remote` fallback, ensure the OAuth client you uses has it's redirect URI set to `http://localhost:3334`.
  • +
### Authorization Header From 52d9c9a38d63695c53ee25594ec492b2b3fa29f3 Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Wed, 26 Nov 2025 11:40:04 +0200 Subject: [PATCH 3/3] Apply suggestion from @burmudar --- docs/api/mcp/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/mcp/index.mdx b/docs/api/mcp/index.mdx index 94c6e93d6..a65b6d488 100644 --- a/docs/api/mcp/index.mdx +++ b/docs/api/mcp/index.mdx @@ -57,7 +57,7 @@ If your client does not natively support specifying an OAuth 2.0 Client ID, you
  • Replace `your-sourcegraph-instance.com` with your Sourcegraph instance URL and `` with the ID of the client you registered in the prerequisites step.
  • -
  • When using the `mcp-remote` fallback, ensure the OAuth client you uses has it's redirect URI set to `http://localhost:3334`.
  • +
  • When using the `mcp-remote` fallback, ensure the OAuth client you use has one of it's redirect URI set to `http://localhost:3334`.