Skip to content

Commit f37d74e

Browse files
authored
Mention mcp-remote as fallback for oauth 2 mcp registeration (#1439)
- Callout about redirect URI
1 parent ec8097f commit f37d74e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/api/mcp/index.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,37 @@ For programmatic access without storing credentials, use OAuth 2.0 with device f
3535

3636
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)
3737

38+
#### Registering the MCP Server
39+
40+
Once you have your Client ID, you can register the MCP server in your client using that ID.
41+
42+
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:
43+
44+
```json
45+
{
46+
"sourcegraph": {
47+
"type": "stdio",
48+
"command": "npx",
49+
"args": [
50+
"mcp-remote",
51+
"https://your-sourcegraph-instance.com/.api/mcp/v1",
52+
"3334",
53+
"--static-oauth-client-info",
54+
"{\"client_id\":\"<your-client-id>\"}",
55+
"--static-oauth-client-metadata",
56+
"{\"scope\":\"user:all\"}"
57+
]
58+
}
59+
}
60+
```
61+
62+
<Callout type="info">
63+
<ul>
64+
<li>Replace `your-sourcegraph-instance.com` with your Sourcegraph instance URL and `<your-client-id>` with the ID of the client you registered in the prerequisites step.</li>
65+
<li>When using the `mcp-remote` fallback, ensure the OAuth client you use has one of it's redirect URI set to `http://localhost:3334`.</li>
66+
</ul>
67+
</Callout>
68+
3869
### Authorization Header
3970

4071
Include your token in the Authorization header:

0 commit comments

Comments
 (0)