@@ -37,6 +37,100 @@ Include your token in the Authorization header:
3737Authorization: token YOUR_ACCESS_TOKEN
3838```
3939
40+ ## Client Integration
41+
42+ The Sourcegraph MCP server can be integrated with various AI tools and IDEs that support the Model Context Protocol.
43+
44+ ### Amp
45+
46+ <Callout type = " info" >
47+ To create an access token, visit [ Creating an access token] ( /cli/how-tos/creating_an_access_token ) .
48+ </Callout >
49+
50+ You can add the Sourcegraph MCP server to [ Amp] ( https://ampcode.com ) in two ways:
51+
52+ #### Option 1: VSCode settings.json
53+
54+ 1 . Open VSCode's ` settings.json ` file.
55+ 2 . Add the following configuration:
56+
57+ ``` json
58+ {
59+ "amp.mcpServers" : {
60+ "sourcegraph" : {
61+ "url" : " https://your-sourcegraph-instance.com/.api/mcp/v1" ,
62+ "headers" : {
63+ "Authorization" : " token YOUR_ACCESS_TOKEN"
64+ }
65+ }
66+ }
67+ }
68+ ```
69+
70+ <Callout type = " info" >
71+ Replace ` your-sourcegraph-instance.com ` with your Sourcegraph instance URL and ` YOUR_ACCESS_TOKEN ` with your access token.
72+ </Callout >
73+
74+ 3 . Save the configuration file.
75+ 4 . Restart VS Code to apply the new configuration.
76+
77+ #### Option 2: Amp CLI
78+
79+ Run the following command in your terminal:
80+
81+ ``` bash
82+ amp mcp add sourcegraph --header " Authorization=token YOUR_ACCESS_TOKEN" https://sourcegraph.sourcegraph.com/.api/mcp/v1
83+ ```
84+
85+ <Callout type = " info" >
86+ Replace ` sourcegraph.sourcegraph.com ` with your Sourcegraph instance URL and set ` YOUR_ACCESS_TOKEN ` environment variable to your access token.
87+ </Callout >
88+
89+ ### Claude Code
90+
91+ You can add the Sourcegraph MCP server to [ Claude Code] ( https://claude.ai/code ) in two ways:
92+
93+ #### Option 1: Project-scoped server (via .mcp.json file)
94+
95+ 1 . Create a ` .mcp.json ` file in your project root if it doesn't exist.
96+ 2 . Add the following configuration:
97+
98+ ``` json
99+ {
100+ "mcpServers" : {
101+ "sourcegraph" : {
102+ "url" : " https://your-sourcegraph-instance.com/.api/mcp/v1" ,
103+ "headers" : {
104+ "Authorization" : " token YOUR_ACCESS_TOKEN"
105+ }
106+ }
107+ }
108+ }
109+ ```
110+
111+ <Callout type = " info" >
112+ Replace ` your-sourcegraph-instance.com ` with your Sourcegraph instance URL and ` YOUR_ACCESS_TOKEN ` with your access token.
113+ </Callout >
114+
115+ 3 . Save the configuration file.
116+ 4 . Restart Claude Code to apply the new configuration.
117+
118+ #### Option 2: Locally-scoped server (via CLI command)
119+
120+ You can also add the Sourcegraph MCP server as a locally-scoped server, which is only available to you in the current project:
121+
122+ 1 . Run the following command in your terminal:
123+
124+ ``` bash
125+ claude mcp add sourcegraph -s local --url https://your-sourcegraph-instance.com/.api/mcp/v1 --header " Authorization: token YOUR_ACCESS_TOKEN"
126+ ```
127+
128+ <Callout type = " info" >
129+ Replace ` your-sourcegraph-instance.com ` with your Sourcegraph instance URL and ` YOUR_ACCESS_TOKEN ` with your access token.
130+ </Callout >
131+
132+ Locally-scoped servers take precedence over project-scoped servers with the same name and are stored in your project-specific user settings.
133+
40134## Available Tools
41135
42136The MCP server provides these tools for code exploration and analysis:
0 commit comments