Skip to content

Commit be71dfb

Browse files
update MCP docs for 7.0 GA release (#1558)
- Remove experimental callout - MCP is now generally available - DCR is now enabled by default, update docs accordingly - Add new 'mcp' scope documentation for OAuth and access tokens - Add 'Disabling DCR' section for admins who need to turn it off - Add upgrade notes for users migrating from 7.0 - Update mcp-remote example to use 'mcp' scope instead of 'user:all' --------- Co-authored-by: Amp <amp@ampcode.com>
1 parent f315571 commit be71dfb

1 file changed

Lines changed: 37 additions & 32 deletions

File tree

docs/api/mcp/index.mdx

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ seoPriority: 1.0
1313
Supported on [Enterprise](/pricing/plans/enterprise) plans.
1414
</TierCallout>
1515

16-
<Callout type="note">
17-
This feature is
18-
[experimental](/admin/beta-and-experimental-features#experimental-features)
19-
and might change or be removed in the future.
20-
</Callout>
21-
2216
The Sourcegraph Model Context Protocol (MCP) Server provides AI agents and applications with programmatic access to your Sourcegraph instance's code search, navigation, and analysis capabilities through a standardized interface.
2317

2418
## Server Endpoints
@@ -36,44 +30,35 @@ Example URL:
3630
https://your-sourcegraph-instance.com/.api/mcp
3731
```
3832

39-
## Authentication
40-
41-
The Sourcegraph MCP server supports two authentication methods:
42-
43-
### OAuth 2.0 with Dynamic Client Registration
44-
45-
Sourcegraph supports MCP spec-compliant OAuth with Dynamic Client Registration ([RFC 7591](https://datatracker.ietf.org/doc/html/rfc7591)), allowing AI agents to authenticate without pre-configured client IDs.
46-
47-
#### Enabling Dynamic Client Registration
33+
## Getting Started
4834

49-
Enable this feature by setting the following site configuration:
50-
51-
```json
52-
{
53-
"auth.idpDynamicClientRegistrationEnabled": true
54-
}
55-
```
56-
57-
Once enabled, MCP clients that support OAuth can authenticate automatically. For example, for [Amp](https://ampcode.com/), you can run:
35+
MCP clients that support OAuth can connect directly—just point them at your Sourcegraph instance and authenticate through your browser:
5836

37+
**[Amp](https://ampcode.com/)**
5938
```bash
6039
amp mcp add sg https://sourcegraph.example.com/.api/mcp
6140
```
6241

63-
For [Claude Code](https://www.claude.com/product/claude-code), you can run:
64-
42+
**[Claude Code](https://www.claude.com/product/claude-code)**
6543
```bash
6644
claude mcp add --transport http sg https://sourcegraph.example.com/.api/mcp
6745
```
6846

47+
This works similarly for other MCP-compatible agents. See [Client Integration](#client-integration) for detailed setup instructions for each client.
48+
49+
## Authentication
50+
51+
The MCP server supports OAuth 2.0 and access token authentication.
6952

70-
This works similarly for other MCP-compatible agents.
53+
### OAuth 2.0
7154

72-
#### Manual OAuth Setup
55+
Sourcegraph implements Dynamic Client Registration ([RFC 7591](https://datatracker.ietf.org/doc/html/rfc7591)), so compatible clients can authenticate automatically without pre-configured client IDs. DCR-registered applications are restricted to the `mcp` scope, which limits access to MCP endpoints only.
56+
57+
<Accordion title="Manual OAuth Setup">
7358

7459
If your agent doesn't support Dynamic Client Registration, you can manually create an OAuth application:
7560

76-
1. Create an OAuth application in your Sourcegraph instance following the instructions [here](/admin/oauth-apps#creating-an-oauth-app). (Note: you will need the `user:all` scope)
61+
1. Create an OAuth application in your Sourcegraph instance following the instructions [here](/admin/oauth-apps#creating-an-oauth-app). (Note: you can use the `mcp` scope for MCP-only access, or `user:all` for full access)
7762
2. Use `mcp-remote` as a fallback with the following configuration:
7863

7964
```json
@@ -88,7 +73,7 @@ If your agent doesn't support Dynamic Client Registration, you can manually crea
8873
"--static-oauth-client-info",
8974
"{\"client_id\":\"<your-client-id>\"}",
9075
"--static-oauth-client-metadata",
91-
"{\"scope\":\"user:all\"}"
76+
"{\"scope\":\"mcp\"}"
9277
]
9378
}
9479
}
@@ -101,14 +86,30 @@ If your agent doesn't support Dynamic Client Registration, you can manually crea
10186
</ul>
10287
</Callout>
10388

104-
### Authorization Header
89+
</Accordion>
90+
91+
<Accordion title="Disabling Dynamic Client Registration">
92+
93+
To disable DCR, set the following site configuration:
94+
95+
```json
96+
{
97+
"auth.idpDynamicClientRegistrationEnabled": false
98+
}
99+
```
100+
101+
</Accordion>
102+
103+
### Access Tokens
105104

106-
Include your token in the Authorization header:
105+
Alternatively, include an access token in the Authorization header:
107106

108107
```
109108
Authorization: token YOUR_ACCESS_TOKEN
110109
```
111110

111+
Access tokens can use the `mcp` scope to restrict access to MCP endpoints only.
112+
112113
## Client Integration
113114

114115
The Sourcegraph MCP server can be integrated with various AI tools and IDEs that support the Model Context Protocol.
@@ -529,6 +530,10 @@ Find repositories where a contributor has made commits.
529530

530531
### Deep Search
531532

533+
<Callout type="info">
534+
Admins can disable the `deepsearch` tool on the default and v1 MCP endpoints by setting the environment variable `SRC_MCP_DISABLE_DEEPSEARCH_TOOL=true` on the Sourcegraph instance. This does not affect `deepsearch_read` or the dedicated `/deepsearch` endpoint. This is a temporary measure available in 7.0 and will be replaced by a proper tool allowlist in a future release.
535+
</Callout>
536+
532537
### `deepsearch`
533538

534539
Create a new Deep Search conversation to answer complex questions about your codebase.

0 commit comments

Comments
 (0)