Skip to content

Commit 96978a1

Browse files
authored
mcp: simplify MCP documentation (#1712)
move client-integrations to a separate page: - reduce the amount of content on the MCP landing page as more clients are added remove 'example usage' - these were raw MCP tool call schemas, not particularly relevant to how a user will interact with MCP via an agent made 'getting started' the first section on the MCP page
1 parent 3655d5e commit 96978a1

3 files changed

Lines changed: 316 additions & 353 deletions

File tree

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
# Client Integrations
2+
3+
<p className="subtitle">
4+
Set up the Sourcegraph MCP server with your preferred AI coding tool or IDE.
5+
</p>
6+
7+
<TierCallout>
8+
Supported on [Enterprise](/pricing/plans/enterprise) plans.
9+
</TierCallout>
10+
11+
## Supported Clients
12+
13+
- [Amp](#amp)
14+
- [Claude Code](#claude-code)
15+
- [Google Gemini Code Assist](#google-gemini-code-assist)
16+
- [VS Code](#vs-code)
17+
- [Cursor](#cursor)
18+
- [Antigravity](#antigravity)
19+
- [Windsurf](#windsurf)
20+
- [OpenCode](#opencode)
21+
22+
### Amp
23+
24+
You can add the Sourcegraph MCP server to [Amp](https://ampcode.com) in two ways:
25+
26+
#### Option 1: VSCode settings.json
27+
28+
1. Open VSCode's `settings.json` file.
29+
2. Add the following configuration:
30+
31+
```json
32+
{
33+
"amp.mcpServers": {
34+
"sourcegraph": {
35+
"url": "https://your-sourcegraph-instance.com/.api/mcp",
36+
"headers": {
37+
"Authorization": "token YOUR_ACCESS_TOKEN"
38+
}
39+
}
40+
}
41+
}
42+
```
43+
44+
<Callout type="info">
45+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
46+
URL and `YOUR_ACCESS_TOKEN` with your access token.
47+
</Callout>
48+
49+
3. Save the configuration file.
50+
4. Restart VS Code to apply the new configuration.
51+
52+
#### Option 2: Amp CLI
53+
54+
Run the following command in your terminal:
55+
56+
```bash
57+
amp mcp add sourcegraph --header "Authorization=token YOUR_ACCESS_TOKEN" https://sourcegraph.sourcegraph.com/.api/mcp
58+
```
59+
60+
<Callout type="info">
61+
Replace `sourcegraph.sourcegraph.com` with your Sourcegraph instance URL and
62+
set `YOUR_ACCESS_TOKEN` environment variable to your access token.
63+
</Callout>
64+
65+
### Claude Code
66+
67+
You can add the Sourcegraph MCP server to [Claude Code](https://claude.ai/code) in two ways:
68+
69+
#### Option 1: Project-scoped server (via .mcp.json file)
70+
71+
1. Create a `.mcp.json` file in your project root if it doesn't exist.
72+
2. Add the following configuration:
73+
74+
```json
75+
{
76+
"mcpServers": {
77+
"sourcegraph": {
78+
"type": "http",
79+
"url": "https://your-sourcegraph-instance.com/.api/mcp",
80+
"headers": {
81+
"Authorization": "token YOUR_ACCESS_TOKEN"
82+
}
83+
}
84+
}
85+
}
86+
```
87+
88+
<Callout type="info">
89+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
90+
URL and `YOUR_ACCESS_TOKEN` with your access token.
91+
</Callout>
92+
93+
3. Save the configuration file.
94+
4. Restart Claude Code to apply the new configuration.
95+
96+
#### Option 2: Locally-scoped server (via CLI command)
97+
98+
You can also add the Sourcegraph MCP server as a locally-scoped server, which is only available to you in the current project:
99+
100+
1. Run the following command in your terminal:
101+
102+
```bash
103+
claude mcp add --transport http sourcegraph https://your-sourcegraph-instance.com/.api/mcp \
104+
--header "Authorization: token YOUR_ACCESS_TOKEN"
105+
```
106+
107+
<Callout type="info">
108+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
109+
URL and `YOUR_ACCESS_TOKEN` with your access token.
110+
</Callout>
111+
112+
Locally-scoped servers take precedence over project-scoped servers with the same name and are stored in your project-specific user settings.
113+
114+
### Google Gemini Code Assist
115+
116+
You can add the Sourcegraph MCP server to Google Gemini Code Assist by configuring the `.gemini/settings.json` file:
117+
118+
1. Open or create the configuration file at `~/.gemini/settings.json` (or the equivalent path on your system).
119+
2. Add the following configuration:
120+
121+
```json
122+
{
123+
"mcpServers": {
124+
"sourcegraph": {
125+
"httpUrl": "https://your-sourcegraph-instance.com/.api/mcp",
126+
"headers": {
127+
"Authorization": "token YOUR_ACCESS_TOKEN"
128+
}
129+
}
130+
}
131+
}
132+
```
133+
134+
<Callout type="info">
135+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
136+
URL and `YOUR_ACCESS_TOKEN` with your access token.
137+
</Callout>
138+
139+
3. Save the configuration file.
140+
4. Restart Gemini Code Assist to apply the new configuration.
141+
142+
### VS Code
143+
144+
You can add the Sourcegraph MCP server to VS Code in one of two ways:
145+
146+
#### Option 1: `code` CLI
147+
148+
1. Run the following command to add the MCP server to the global configuration
149+
150+
```bash
151+
code --add-mcp "{ \"name\": \"sourcegraph\", \"type\": \"remote\", \"url\": \"https://your-sourcegraph-instance.com/.api/mcp\" }"
152+
```
153+
154+
2. Launch or restart VS Code to apply the new configuration.
155+
156+
#### Option 2: VSCode `mcp.json`
157+
158+
1. Create `.vscode/mcp.json` in your project.
159+
2. Add the following configuration:
160+
161+
```json
162+
{
163+
"servers": {
164+
"sourcegraph": {
165+
"type": "http",
166+
"url": "https://your-sourcegraph-instance.com/.api/mcp"
167+
}
168+
},
169+
"inputs": []
170+
}
171+
```
172+
173+
3. Save the configuration file.
174+
4. Restart VS Code to apply the new configuration.
175+
176+
#### Cursor
177+
178+
1. Open or create the MCP configuration file at `~/.cursor/mcp.json` (or the equivalent path on your system).
179+
2. Add the following:
180+
181+
```json
182+
{
183+
"mcpServers": {
184+
"sourcegraph": {
185+
"url": "https://your-sourcegraph-instance.com/.api/mcp",
186+
"type": "http",
187+
"headers": {
188+
"Authorization": "token YOUR_ACCESS_TOKEN"
189+
}
190+
}
191+
}
192+
}
193+
```
194+
195+
<Callout type="info">
196+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
197+
URL and `YOUR_ACCESS_TOKEN` with your access token.
198+
</Callout>
199+
200+
3. Save the configuration file.
201+
4. Restart Cursor to apply the new configuration.
202+
203+
#### Antigravity
204+
205+
1. Create ⁠`.vscode/mcp.json` (Antigravity uses `.vscode` for configs) in your project.
206+
2. Add the following:
207+
208+
```json
209+
{
210+
"servers": {
211+
"sourcegraph": {
212+
"url": "https://your-sourcegraph-instance.com/.api/mcp",
213+
"type": "http",
214+
"headers": {
215+
"Authorization": "token YOUR_ACCESS_TOKEN"
216+
}
217+
}
218+
},
219+
"inputs": []
220+
}
221+
```
222+
223+
<Callout type="info">
224+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
225+
URL and `YOUR_ACCESS_TOKEN` with your access token.
226+
</Callout>
227+
228+
#### Windsurf
229+
230+
1. Create ⁠`~/.codeium/windsurf/mcp_config.json`.
231+
2. Add the following:
232+
233+
```json
234+
{
235+
"mcpServers": {
236+
"sourcegraph": {
237+
"serverUrl": "https://your-sourcegraph-instance.com/.api/mcp",
238+
"headers": {
239+
"Authorization": "token YOUR_ACCESS_TOKEN",
240+
"Content-Type": "application/json"
241+
}
242+
}
243+
}
244+
}
245+
```
246+
247+
<Callout type="info">
248+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
249+
URL and `YOUR_ACCESS_TOKEN` with your access token.
250+
</Callout>
251+
252+
3. Save the configuration file.
253+
254+
### OpenCode
255+
256+
You can add the Sourcegraph MCP server to OpenCode by configuring it in your MCP settings file:
257+
258+
1. Open or create the MCP configuration file at `~/.config/opencode/opencode.jsonc` (or the equivalent path on your system).
259+
2. Add the following configuration:
260+
261+
```json
262+
{
263+
"mcp": {
264+
"sourcegraph": {
265+
"type": "remote",
266+
"url": "https://your-sourcegraph-instance.com/.api/mcp",
267+
"oauth": false,
268+
"headers": {
269+
"Authorization": "token {env:YOUR_ACCESS_TOKEN}"
270+
}
271+
}
272+
},
273+
"$schema": "https://opencode.ai/config.json"
274+
}
275+
```
276+
277+
<Callout type="info">
278+
Replace `your-sourcegraph-instance.com` with your Sourcegraph instance
279+
URL and `YOUR_ACCESS_TOKEN` with your access token.
280+
</Callout>
281+
282+
3. Save the configuration file.
283+
4. Restart OpenCode to apply the changes.

0 commit comments

Comments
 (0)