Skip to content

Commit d60f8d6

Browse files
Updating & scaffolding
1 parent ebafea3 commit d60f8d6

File tree

3 files changed

+296
-122
lines changed

3 files changed

+296
-122
lines changed

website/src/pages/en/subgraphs/mcp/claude.mdx

Lines changed: 62 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -2,100 +2,84 @@
22
title: Claude
33
---
44

5-
## Using Claude Desktop to Access Subgraphs via MCP
5+
The Subgraph Model Context Protocol (MCP) server enables Claude to interact directly with Subgraphs on The Graph Network. This integration allows you to explore Subgraph schemas, execute GraphQL queries, and find relevant Subgraphs for specific contracts—all through natural language conversations with Claude.
66

7-
The Subgraph Model Context Protocol (MCP) server enables Claude to interact directly with subgraphs on The Graph Network. This integration allows you to explore subgraph schemas, execute GraphQL queries, and find relevant subgraphs for specific contracts—all through natural language conversations with Claude.
8-
9-
### What You Can Do
7+
## What You Can Do
108

119
With the Subgraph MCP integration, you can:
1210

13-
- Access the GraphQL schema for any subgraph on The Graph Network
14-
- Execute GraphQL queries against any subgraph deployment
15-
- Find top subgraph deployments for a contract address on a specific chain
16-
- Ask natural language questions about subgraph data without writing GraphQL queries manually
17-
18-
### Requirements
19-
20-
Before setting up the Subgraph MCP server, make sure you have:
21-
22-
- **Claude Desktop**: Latest version installed
23-
- **Rust**: Latest stable version (1.75+)
24-
- **Gateway API key**: An API key from The Graph Network
11+
- Access the GraphQL schema for any Subgraph on The Graph Network
12+
- Execute GraphQL queries against any Subgraph deployment
13+
- Find top Subgraph deployments for a contract address on a specific chain
14+
- Ask natural language questions about Subgraph data without writing GraphQL queries manually
2515

26-
## Installation
16+
## Prerequisites
2717

28-
### Step 1: Install Rust (if not already installed)
18+
- [Claude Desktop](https://claude.ai/download) installed (latest version)
19+
- A Gateway API key from [Subgraph Studio](https://thegraph.com/studio/)
20+
- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path
2921

30-
```bash
31-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
32-
```
22+
## Configuration
3323

34-
Follow the on-screen instructions. For other platforms, see the [official Rust installation guide](https://www.rust-lang.org/tools/install).
24+
Create or edit your `claude_desktop_config.json` file.
3525

36-
### Step 2: Install the Subgraph MCP Server
26+
> **Settings** > **Developer** > **Edit Config**
3727
38-
```bash
39-
# Clone the repository
40-
git clone [email protected]:graphops/subgraph-mcp.git
41-
cd subgraph-mcp
28+
- OSX: `~/Library/Application Support/Claude/claude_desktop_config.json`
29+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
30+
- Linux: `.config/Claude/claude_desktop_config.json`
4231

43-
# Build the project
44-
cargo build --release
32+
```json label="claude_desktop_config.json"
33+
{
34+
"mcpServers": {
35+
"subgraph": {
36+
"command": "npx",
37+
"args": [
38+
"mcp-remote",
39+
"--header",
40+
"Authorization: Bearer GATEWAY_API_KEY",
41+
"https://subgraph-ai.graphops.xyz/sse"
42+
]
43+
}
44+
}
45+
}
4546
```
4647

47-
### Step 3: Get your Gateway API Key
48-
49-
You'll need an API key from [Subgraph Studio](https://thegraph.com/studio/) to authenticate requests to The Graph Network.
50-
51-
## Configuration
48+
Replace `GATEWAY_API_KEY` with your API key from Subgraph Studio.
5249

53-
### Configure Claude Desktop
54-
55-
1. Open Claude Desktop and click on the top left corner to access Settings
56-
2. Add the Subgraph MCP server to your `claude_desktop_config.json`
50+
## Using Both Token API MCP and Subgraph MCP Together
5751

58-
Here's how to set up your configuration:
52+
You can configure Claude Desktop to use both the Token API MCP and Subgraph MCP simultaneously:
5953

60-
```json
54+
```json label="claude_desktop_config.json"
6155
{
6256
"mcpServers": {
63-
"subgraph": {
64-
"command": "/path/to/your/subgraph-mcp/target/release/subgraph-mcp",
57+
"token-api": {
58+
"command": "npx",
59+
"args": ["@pinax/mcp", "--sse-url", "https://token-api.thegraph.com/sse"],
6560
"env": {
66-
"GATEWAY_API_KEY": "your-api-key-here"
61+
"ACCESS_TOKEN": "ACCESS_TOKEN"
6762
}
63+
},
64+
"subgraph": {
65+
"command": "npx",
66+
"args": [
67+
"mcp-remote",
68+
"--header",
69+
"Authorization: Bearer GATEWAY_API_KEY",
70+
"https://subgraph-ai.graphops.xyz/sse"
71+
]
6872
}
6973
}
7074
}
7175
```
7276

73-
#### Finding the Command Path
74-
75-
After building the project, you need to specify the absolute path to the compiled binary:
76-
77-
1. Navigate to your `subgraph-mcp` directory in the terminal
78-
2. Run `pwd` to get the full path to the directory
79-
3. Add `/target/release/subgraph-mcp` to that path
80-
81-
For example, if `pwd` outputs `/Users/username/subgraph-mcp`, your full command path would be: `/Users/username/subgraph-mcp/target/release/subgraph-mcp`
82-
83-
### Troubleshooting Installation
84-
85-
If you encounter issues with the setup:
86-
87-
1. Clean any existing build and rebuild:
77+
- For Token API access tokens, visit [The Graph Market](https://thegraph.com/explorer)
78+
- For Subgraph Gateway API keys, visit [Subgraph Studio](https://thegraph.com/studio/)
8879

89-
```bash
90-
cd subgraph-mcp
91-
cargo clean
92-
cargo build --release
93-
```
80+
## Troubleshooting
9481

95-
2. Ensure the executable has proper permissions:
96-
```bash
97-
chmod +x target/release/subgraph-mcp
98-
```
82+
To enable logs for the MCP, add the `--verbose true` option to your args array.
9983

10084
## Using The Graph Resource in Claude
10185

@@ -110,91 +94,47 @@ After configuring Claude Desktop:
11094

11195
## Available Tools and Usage
11296

113-
The Subgraph MCP provides several tools for interacting with subgraphs:
97+
The Subgraph MCP provides several tools for interacting with Subgraphs:
11498

11599
### Schema Retrieval Tools
116100

117101
- **Get schema by deployment ID**: Access the GraphQL schema using a deployment ID (0x...)
118-
- **Get schema by subgraph ID**: Access the schema for the current deployment of a subgraph (5zvR82...)
119-
- **Get schema by IPFS hash**: Access the schema using a subgraph's IPFS manifest hash (Qm...)
102+
- **Get schema by Subgraph ID**: Access the schema for the current deployment of a Subgraph (5zvR82...)
103+
- **Get schema by IPFS hash**: Access the schema using a Subgraph's IPFS manifest hash (Qm...)
120104

121105
### Query Execution Tools
122106

123107
- **Execute query by deployment ID**: Run GraphQL queries against specific, immutable deployments
124-
- **Execute query by subgraph ID**: Run GraphQL queries against the latest version of a subgraph
108+
- **Execute query by Subgraph ID**: Run GraphQL queries against the latest version of a Subgraph
125109

126110
### Discovery Tools
127111

128-
- **Get top subgraph deployments**: Find the top 3 subgraph deployments indexing a specific contract on a particular chain
112+
- **Get top Subgraph deployments**: Find the top 3 Subgraph deployments indexing a specific contract on a particular chain
129113

130114
## Natural Language Queries
131115

132116
One of the most powerful features of the Subgraph MCP integration is the ability to ask questions in natural language. Claude will:
133117

134-
1. Understand your goal (lookup, find subgraphs, query, get schema)
118+
1. Understand your goal (lookup, find Subgraphs, query, get schema)
135119
2. Find relevant deployments if needed
136-
3. Fetch and interpret the subgraph schema
120+
3. Fetch and interpret the Subgraph schema
137121
4. Convert your question into an appropriate GraphQL query
138122
5. Execute the query and present the results in a readable format
139123

140124
### Example Natural Language Queries
141125

142126
```
143-
What are the pairs with maximum volume on 0xde0a7b5368f846f7d863d9f64949b688ad9818243151d488b4c6b206145b9ea3?
127+
What are the pairs with maximum volume on deployment 0xde0a7b5368f846f7d863d9f64949b688ad9818243151d488b4c6b206145b9ea3?
144128
145-
Which tokens have the highest market cap in this subgraph?
129+
Which tokens have the highest market cap in this Subgraph?
146130
147131
Show me the most recent 5 swaps for the USDC/ETH pair
148132
```
149133

150-
## Using Both Token API MCP and Subgraph MCP Together
151-
152-
You can configure Claude Desktop to use both the Token API MCP and Subgraph MCP simultaneously:
153-
154-
```json
155-
{
156-
"mcpServers": {
157-
"token-api": {
158-
"command": "path-to-bunx",
159-
"args": ["@pinax/mcp", "--sse-url", "https://token-api.thegraph.com/sse"],
160-
"env": {
161-
"ACCESS_TOKEN": "access-token-from-graph-market"
162-
}
163-
},
164-
"subgraph": {
165-
"command": "/path/to/subgraph-mcp/target/release/subgraph-mcp",
166-
"env": {
167-
"GATEWAY_API_KEY": "api-key-from-subgraph-studio"
168-
}
169-
}
170-
}
171-
}
172-
```
173-
174-
For Token API access tokens, visit [The Graph Market](https://thegraph.com/explorer). For Subgraph Gateway API keys, visit [Subgraph Studio](https://thegraph.com/studio/).
175-
176134
## Key Identifier Types
177135

178-
When working with subgraphs, you'll encounter different types of identifiers:
136+
When working with Subgraphs, you'll encounter different types of identifiers:
179137

180-
- **Subgraph ID** (e.g., `5zvR82...`): Logical identifier for a subgraph
138+
- **Subgraph ID** (e.g., `5zvR82...`): Logical identifier for a Subgraph
181139
- **Deployment ID** (e.g., `0x4d7c...`): Identifier for a specific, immutable deployment
182140
- **IPFS Hash** (e.g., `QmTZ8e...`): Identifier for the manifest of a specific deployment
183-
184-
## Example Interactions
185-
186-
Here are some examples of how you can interact with Claude once the Subgraph MCP is set up:
187-
188-
```
189-
Get the schema for subgraph deployment 0xYourDeploymentIdHere
190-
191-
Run this query against subgraph 5zvR82YourSubgraphIdHere: { users(first: 1) { id } }
192-
193-
Find the top subgraphs for contract 0x1f98431c8ad98523631ae4a59f267346ea31f984 on arbitrum-one
194-
```
195-
196-
## Additional Resources
197-
198-
- [The Graph Documentation](https://thegraph.com/docs/)
199-
- [Subgraph MCP GitHub Repository](https://github.com/graphops/subgraph-mcp)
200-
- [Token API MCP Documentation](https://thegraph.com/docs/en/token-api/mcp/claude/)

website/src/pages/en/subgraphs/mcp/cline.mdx

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,120 @@
22
title: Cline
33
---
44

5+
The Subgraph Model Context Protocol (MCP) server enables Cline to interact directly with Subgraphs on The Graph Network. This integration allows you to explore Subgraph schemas, execute GraphQL queries, and find relevant Subgraphs for specific contracts—all through natural language conversations with Cline.
6+
7+
## Prerequisites
8+
9+
- [Cline](https://cline.bot/) installed (latest version)
10+
- A Gateway API key from [Subgraph Studio](https://thegraph.com/studio/)
11+
- [`npx`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) or [`bunx`](https://bun.sh/) installed and available in your path
12+
13+
## Configuration
14+
15+
Create or edit your `cline_mcp_settings.json` file.
16+
17+
> **MCP Servers** > **Installed** > **Configure MCP Servers**
18+
19+
```json label="cline_mcp_settings.json"
20+
{
21+
"mcpServers": {
22+
"subgraph": {
23+
"command": "npx",
24+
"args": [
25+
"mcp-remote",
26+
"--header",
27+
"Authorization: Bearer GATEWAY_API_KEY",
28+
"https://subgraph-ai.graphops.xyz/sse"
29+
]
30+
}
31+
}
32+
}
33+
```
34+
35+
Replace `GATEWAY_API_KEY` with your API key from Subgraph Studio.
36+
37+
## Using Both Token API MCP and Subgraph MCP Together
38+
39+
You can configure Cline to use both the Token API MCP and Subgraph MCP simultaneously:
40+
41+
```json label="cline_mcp_settings.json"
42+
{
43+
"mcpServers": {
44+
"token-api": {
45+
"command": "npx",
46+
"args": ["@pinax/mcp", "--sse-url", "https://token-api.thegraph.com/sse"],
47+
"env": {
48+
"ACCESS_TOKEN": "ACCESS_TOKEN"
49+
}
50+
},
51+
"subgraph": {
52+
"command": "npx",
53+
"args": [
54+
"mcp-remote",
55+
"--header",
56+
"Authorization: Bearer GATEWAY_API_KEY",
57+
"https://subgraph-ai.graphops.xyz/sse"
58+
]
59+
}
60+
}
61+
}
62+
```
63+
64+
- For Token API access tokens, visit [The Graph Market](https://thegraph.com/explorer)
65+
- For Subgraph Gateway API keys, visit [Subgraph Studio](https://thegraph.com/studio/)
66+
67+
## Using The Graph Resource in Cline
68+
69+
After configuring Cline:
70+
71+
1. Restart Cline
72+
2. Start a new conversation
73+
3. Enable the Subgraph MCP from the context menu
74+
4. Add "The Graph" resource to your chat context
75+
76+
## Available Tools and Usage
77+
78+
The Subgraph MCP provides several tools for interacting with Subgraphs:
79+
80+
### Schema Retrieval Tools
81+
82+
- **Get schema by deployment ID**: Access the GraphQL schema using a deployment ID (0x...)
83+
- **Get schema by Subgraph ID**: Access the schema for the current deployment of a Subgraph (5zvR82...)
84+
- **Get schema by IPFS hash**: Access the schema using a Subgraph's IPFS manifest hash (Qm...)
85+
86+
### Query Execution Tools
87+
88+
- **Execute query by deployment ID**: Run GraphQL queries against specific, immutable deployments
89+
- **Execute query by Subgraph ID**: Run GraphQL queries against the latest version of a Subgraph
90+
91+
### Discovery Tools
92+
93+
- **Get top Subgraph deployments**: Find the top 3 Subgraph deployments indexing a specific contract on a particular chain
94+
95+
## Natural Language Queries
96+
97+
One of the most powerful features of the Subgraph MCP integration is the ability to ask questions in natural language. Cline will:
98+
99+
1. Understand your goal (lookup, find Subgraphs, query, get schema)
100+
2. Find relevant deployments if needed
101+
3. Fetch and interpret the Subgraph schema
102+
4. Convert your question into an appropriate GraphQL query
103+
5. Execute the query and present the results in a readable format
104+
105+
### Example Natural Language Queries
106+
107+
```
108+
What are the pairs with maximum volume on deployment 0xde0a7b5368f846f7d863d9f64949b688ad9818243151d488b4c6b206145b9ea3?
109+
110+
Which tokens have the highest market cap in this Subgraph?
111+
112+
Show me the most recent 5 swaps for the USDC/ETH pair
113+
```
114+
115+
## Key Identifier Types
116+
117+
When working with Subgraphs, you'll encounter different types of identifiers:
118+
119+
- **Subgraph ID** (e.g., `5zvR82...`): Logical identifier for a Subgraph
120+
- **Deployment ID** (e.g., `0x4d7c...`): Identifier for a specific, immutable deployment
121+
- **IPFS Hash** (e.g., `QmTZ8e...`): Identifier for the manifest of a specific deployment

0 commit comments

Comments
 (0)