Skip to content

Commit 7529641

Browse files
Polymarket Token API data & x402 Subgraphs Payments (#1095)
* Adding Token API Polymarket Overview * Adding x402 Subgraph payment doc (with update 2) * Ran prettier * Adding Subgraph and Substreams Skills * Cleaned Subgraph and Substreams Skills * Debugging _meta.json issue * Fixing Prettier issues * Update website/src/pages/en/ai-suite/subgraph-skills/setup.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/ai-suite/subgraph-skills/setup.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/ai-suite/substreams-skills/setup.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/subgraphs/guides/x402-payments.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/subgraphs/guides/x402-payments.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/subgraphs/guides/x402-payments.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/subgraphs/guides/x402-payments.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/token-api/guides/polymarket.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Update website/src/pages/en/ai-suite/subgraph-skills/setup.mdx Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Address Benoit's comments * Updating missed URL updates * Update nginx.conf Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com> * Delete website/.Rhistory Removing accidental .Rhistory file * Apply suggestion from @benface * Apply suggestion from @benface * Apply suggestion from @benface --------- Co-authored-by: Benoît Rouleau <1059139+benface@users.noreply.github.com>
1 parent facf22c commit 7529641

File tree

12 files changed

+573
-5
lines changed

12 files changed

+573
-5
lines changed

nginx.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ http {
173173
rewrite ^/docs/en/token-api/mcp/cline/$ $scheme://$http_host/docs/en/ai-suite/token-api-mcp/ permanent;
174174
rewrite ^/docs/en/token-api/mcp/cline/$ $scheme://$http_host/docs/en/ai-suite/token-api-mcp/ permanent;
175175
rewrite ^/docs/en/token-api/endpoint-pricing/$ $scheme://$http_host/docs/en/token-api/endpoints/pricing/ permanent;
176+
rewrite ^/docs/en/ai-suite/token-api-skills/quick-setup$ $scheme://$http_host/docs/en/ai-suite/token-api-skills/ permanent;
176177
# Temporary redirects (302)
177178
rewrite ^/docs/en/querying/graph-client/$ $scheme://$http_host/docs/en/subgraphs/querying/graph-client/README/ redirect;
178179
rewrite ^/docs/en/developing/graph-ts/$ $scheme://$http_host/docs/en/subgraphs/developing/creating/graph-ts/README/ redirect;

website/src/pages/en/ai-suite/_meta-titles.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"ai-introduction": "The Graph's AI",
33
"subgraph-mcp": "Subgraph MCP",
44
"token-api-mcp": "Token API MCP",
5-
"token-api-skills": "Token API Skills"
5+
"token-api-skills": "Token API Skills",
6+
"subgraph-skills": "Subgraph Skills",
7+
"substreams-skills": "Substreams Skills"
68
}

website/src/pages/en/ai-suite/_meta.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ export default {
55
'subgraph-mcp': titles['subgraph-mcp'],
66
'token-api-mcp': titles['token-api-mcp'],
77
'token-api-skills': titles['token-api-skills'],
8+
'subgraph-skills': titles['subgraph-skills'],
9+
'substreams-skills': titles['substreams-skills'],
810
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Agent Skills for Subgraphs
3+
sidebarTitle: Subgraph Skills
4+
---
5+
6+
A collection of AI agent skills providing expert knowledge for developing, testing, and deploying subgraphs with The Graph protocol.
7+
8+
## Overview
9+
10+
This repository provides subgraph development expertise for AI coding assistants in **two formats**:
11+
12+
| Format | Location | Use With |
13+
| ---------------------- | ----------- | ------------------- |
14+
| **Claude Code Plugin** | `skills/` | Claude Code CLI |
15+
| **OpenClaw Skills** | `openclaw/` | OpenClaw / Clawdbot |
16+
17+
Same knowledge, different agent platforms.
18+
19+
## Skills
20+
21+
### Subgraph Development
22+
23+
Core development knowledge including:
24+
25+
- Schema design and GraphQL types
26+
- Manifest configuration (subgraph.yaml)
27+
- AssemblyScript mapping handlers
28+
- Data source templates
29+
- Contract bindings and calls
30+
- **Subgraph Composition** - Combine multiple subgraphs
31+
- **Common Patterns** - ERC20, DEX, NFT, Lending, Staking, Governance
32+
- Subgraph Uncrashable (safe code generation)
33+
- Deployment workflows
34+
35+
### Subgraph Optimization
36+
37+
Performance best practices from The Graph docs:
38+
39+
- Pruning with indexerHints
40+
- Arrays with `@derivedFrom`
41+
- Immutable entities and Bytes as IDs
42+
- Avoiding `eth_calls`
43+
- Timeseries and aggregations
44+
- Grafting for hotfixes
45+
46+
### Subgraph Testing
47+
48+
Quality assurance with Matchstick and Subgraph Linter:
49+
50+
- **Subgraph Linter** - Static analysis to catch bugs before runtime
51+
- **Common Errors** - Troubleshooting guide for indexing issues
52+
- Unit testing setup and patterns with Matchstick
53+
- Mock events and contract calls
54+
- Entity assertions
55+
- Data source mocking
56+
- CI/CD integration
57+
58+
## Installation
59+
60+
### Claude Code
61+
62+
```bash
63+
# Add as a Claude Code plugin
64+
claude plugins add PaulieB14/subgraphs-skills
65+
```
66+
67+
### OpenClaw / Clawdbot
68+
69+
```bash
70+
# Copy skills to OpenClaw directory
71+
cp -r openclaw/subgraph-* ~/.openclaw/skills/
72+
73+
# Or via ClawHub (when published)
74+
clawdbot skill install subgraph-dev
75+
clawdbot skill install subgraph-optimization
76+
clawdbot skill install subgraph-testing
77+
```
78+
79+
## Usage Examples
80+
81+
Once installed, the AI assistant will have access to subgraph development expertise:
82+
83+
**Schema Design:**
84+
85+
> "Create a schema for tracking DEX swaps with proper relationships"
86+
87+
**Optimization:**
88+
89+
> "How do I optimize my subgraph for faster indexing?"
90+
91+
**Testing:**
92+
93+
> "Write unit tests for my Transfer event handler"
94+
95+
## Resources
96+
97+
- [Subgraph Best Practices](/subgraphs/best-practices/pruning/)
98+
- [Subgraph Composition](/subgraphs/guides/subgraph-composition/) - Combine multiple subgraphs
99+
- [Subgraph Linter](/subgraphs/developing/subgraph-linter/) - Static analysis tool
100+
- [Subgraph Uncrashable](/subgraphs/developing/subgraph-uncrashable/) - Safe code generation
101+
- [Matchstick Testing Framework](/subgraphs/developing/creating/unit-testing-framework/)
102+
- [AssemblyScript API](/subgraphs/developing/creating/assemblyscript-api/)
103+
104+
## Platforms
105+
106+
This skill pack works with:
107+
108+
| Platform | Description | Link |
109+
| --- | --- | --- |
110+
| **Claude Code** | Anthropic's official CLI for Claude | [claude.ai/claude-code](https://claude.ai/claude-code) |
111+
| **OpenClaw** | Open-source AI agent framework | [github.com/openclaw/openclaw](https://github.com/openclaw/openclaw) |
112+
113+
## Acknowledgments
114+
115+
- Built with [Claude](https://claude.ai) (Anthropic's AI assistant)
116+
- Subgraph expertise from [The Graph Documentation](https://thegraph.com/docs/)
117+
- Inspired by [AGENTS.md](https://github.com/agentsmd/agents.md) format
118+
- OpenClaw format based on [substreams-skills](https://github.com/streamingfast/substreams-skills)
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
title: Substreams Search MCP
3+
sidebarTitle: Substreams Search
4+
---
5+
6+
MCP server that lets AI agents search, inspect, and analyze [Substreams](https://substreams.dev) packages — from registry discovery to sink deployment. Supports dual transport for local clients and SSE/HTTP for remote agents (OpenClaw, custom frameworks).
7+
8+
## Tools
9+
10+
### Search Substreams
11+
12+
`search_substreams`: Search the substreams.dev package registry.
13+
14+
| Parameter | Type | Default | Description |
15+
| --- | --- | --- | --- |
16+
| `query` | string (required) || Search term, e.g. `"solana dex"` or `"uniswap"` |
17+
| `sort` | string | `"most_downloaded"` | `most_downloaded`, `alphabetical`, `most_used`, `last_uploaded` |
18+
| `network` | string || Filter by chain: `ethereum`, `solana`, `arbitrum-one`, etc. |
19+
20+
Returns package name, URL, creator, network, version, published date, and download count.
21+
22+
### Inspect Package
23+
24+
`inspect_package`: Inspect a Substreams package (.spkg) to see its full module graph, protobuf types, and metadata.
25+
26+
| Parameter | Type | Description |
27+
| --------- | ----------------- | ---------------------------- |
28+
| `url` | string (required) | Direct URL to a `.spkg` file |
29+
30+
Returns:
31+
32+
- Package metadata (name, version, documentation, network)
33+
- All modules with their kind (map/store/blockIndex), output types, and update policies
34+
- Full DAG: each module's `dependsOn` and `dependedBy` relationships
35+
- Input chain for each module (source blocks, other maps, stores with get/deltas mode, params)
36+
- List of all protobuf output types and proto files
37+
- Mermaid diagram of the module graph
38+
39+
### List Package Modules
40+
41+
`list_package_modules`: Lightweight alternative to `inspect_package` — just the module names, types, and inputs/outputs.
42+
43+
| Parameter | Type | Description |
44+
| --------- | ----------------- | ---------------------------- |
45+
| `url` | string (required) | Direct URL to a `.spkg` file |
46+
47+
### Get Sink Configuration
48+
49+
`get_sink_config`: Analyze a package's sink configuration and generate ready-to-run CLI commands.
50+
51+
| Parameter | Type | Description |
52+
| --------- | ----------------- | ---------------------------- |
53+
| `url` | string (required) | Direct URL to a `.spkg` file |
54+
55+
Returns one of three results:
56+
57+
- **`sink_configured`** — Package has an embedded sink config. Extracts the SQL schema (for SQL sinks), identifies the sink module and type, and generates `install`, `setup`, and `run` commands with the correct network endpoint.
58+
- **`no_sink_config_but_compatible_modules_found`** — No embedded config, but modules output sink-compatible types (e.g. `DatabaseChanges`). Identifies them and suggests how to wire up sinking.
59+
- **`no_sink_support`** — No sink-compatible modules. Lists all module output types so you know what custom consumer you'd need.
60+
61+
## Workflow
62+
63+
```
64+
search_substreams("uniswap", network: "polygon")
65+
→ find package, get spkg.io URL
66+
67+
inspect_package("https://spkg.io/creator/package-v1.0.0.spkg")
68+
→ see module DAG, output types, what it produces
69+
70+
get_sink_config("https://spkg.io/creator/package-v1.0.0.spkg")
71+
→ get SQL schema + CLI commands to deploy
72+
```
73+
74+
## Quick Start (npx)
75+
76+
No installation needed:
77+
78+
### Claude Desktop / Cursor / Claude Code
79+
80+
Add to your MCP config (`claude_desktop_config.json`, `~/.cursor/mcp.json`, or `~/.claude/mcp.json`):
81+
82+
```json
83+
{
84+
"mcpServers": {
85+
"substreams-search": {
86+
"command": "npx",
87+
"args": ["substreams-search-mcp"]
88+
}
89+
}
90+
}
91+
```
92+
93+
### OpenClaw / Remote Agents (SSE)
94+
95+
Start the server with the HTTP transport:
96+
97+
```bash
98+
# Dual transport — stdio + SSE on port 3849
99+
npx substreams-search-mcp --http
100+
101+
# SSE only (for remote/server deployments)
102+
npx substreams-search-mcp --http-only
103+
104+
# Custom port
105+
MCP_HTTP_PORT=4000 npx substreams-search-mcp --http
106+
```
107+
108+
Then point your agent at the SSE endpoint:
109+
110+
```json
111+
{
112+
"mcpServers": {
113+
"substreams-search": {
114+
"url": "http://localhost:3849/sse"
115+
}
116+
}
117+
}
118+
```
119+
120+
### Transport Modes
121+
122+
| Invocation | Transports | Use case |
123+
| --------------------------------------- | ----------------- | ----------------------------------- |
124+
| `npx substreams-search-mcp` | stdio | Claude Desktop, Cursor, Claude Code |
125+
| `npx substreams-search-mcp --http` | stdio + SSE :3849 | Dual — local + remote agents |
126+
| `npx substreams-search-mcp --http-only` | SSE :3849 | OpenClaw, remote deployments |
127+
128+
A `/health` endpoint is available at `http://localhost:3849/health` when HTTP transport is active.
129+
130+
## How it works
131+
132+
- **Search**: The substreams.dev registry has no public API. This server scrapes the package listing pages, paginates through all results, deduplicates, and returns structured JSON. Multi-word queries search for the first word server-side and filter the rest client-side.
133+
- **Inspect**: Uses [`@substreams/core`](https://github.com/substreams-js/substreams-js) to fetch and parse `.spkg` files (protobuf-encoded Substreams packages), extracting module definitions, DAG relationships, and proto type information.
134+
- **Sink config**: Reads the embedded `sinkConfig` (a `google.protobuf.Any` field) from the package, decodes it based on the type URL, and maps networks to Substreams endpoints for correct CLI commands.
135+
136+
## Acknowledgments
137+
138+
Thanks for PaulieB for creating the [Substreams Search MCP](https://github.com/PaulieB14/substreams-search-mcp)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Agent Skills for Substreams
3+
sidebarTitle: Substreams Skills
4+
---
5+
6+
AI coding assistants can be enhanced with specialized Substreams expertise through agent skills. These open-source knowledge packages give AI assistants deep understanding of Substreams development patterns, best practices, and debugging techniques.
7+
8+
## Available Skills
9+
10+
### Substreams Development (`substreams-dev`)
11+
12+
Expert knowledge for developing, building, and debugging Substreams projects on any blockchain:
13+
14+
- Creating and configuring `substreams.yaml` manifests
15+
- Writing efficient Rust modules (map, store, index types)
16+
- Protobuf schema design and code generation
17+
- Performance optimization and avoiding excessive cloning
18+
- Debugging and troubleshooting common issues
19+
20+
### Substreams SQL (`substreams-sql`)
21+
22+
Expert knowledge for building SQL database sinks from Substreams data:
23+
24+
- **Database Changes (CDC)** - Stream individual row changes for real-time consistency
25+
- **Relational Mappings** - Transform data into normalized tables with proper relationships
26+
- **PostgreSQL** - Advanced patterns, indexing strategies, and performance optimization
27+
- **ClickHouse** - Analytics-optimized schemas, materialized views, and time-series patterns
28+
- **Schema Design** - Best practices for blockchain data modeling
29+
30+
### Substreams Testing (`substreams-testing`)
31+
32+
Expert knowledge for testing Substreams applications at all levels:
33+
34+
- **Unit Testing** - Testing individual functions with real blockchain data
35+
- **Integration Testing** - End-to-end workflows with real block processing
36+
- **Performance Testing** - Benchmarking, memory profiling, and production mode validation
37+
- **FireCore Tools** - Using Firehose, StreamingFast API, and testing utilities
38+
- **CI/CD Integration** - Automated testing pipelines and regression detection
39+
40+
## Installation
41+
42+
### Claude Code
43+
44+
Install the plugin from the marketplace:
45+
46+
```bash
47+
claude plugin marketplace add https://github.com/streamingfast/substreams-skills
48+
```
49+
50+
Then enable the skills:
51+
52+
1. Run `/plugin` to open the plugin manager
53+
2. Go to the **Discover** tab
54+
3. Find and install the `substreams-dev` plugin (which pulls all defined skills automatically)
55+
4. Restart Claude instance(s) for skills to be discovered
56+
57+
After installation, Claude automatically uses Substreams expertise when working on relevant projects.
58+
59+
#### Alternative: Local Development
60+
61+
Clone and load directly without installing from the marketplace:
62+
63+
```bash
64+
git clone https://github.com/streamingfast/substreams-skills.git
65+
claude --plugin-dir ./substreams-skills
66+
```
67+
68+
### Cursor
69+
70+
Clone the repository and add the skill directory path in Cursor settings:
71+
72+
```
73+
~/substreams-skills/skills/substreams-dev
74+
```
75+
76+
### VS Code
77+
78+
VS Code 1.107+ supports Claude Skills as an experimental feature:
79+
80+
1. Enable the experimental feature in settings
81+
2. Add skill paths to your configuration
82+
3. Skills will be available to Claude in VS Code
83+
84+
See the [VS Code 1.107 release notes](https://code.visualstudio.com/updates/v1_107#_reuse-your-claude-skills-experimental) for details.
85+
86+
## Resources
87+
88+
- [Substreams Skills Repository](https://github.com/streamingfast/substreams-skills)
89+
- [Claude Code Plugins Documentation](https://docs.anthropic.com/en/docs/claude-code/plugins)

website/src/pages/en/ai-suite/token-api-skills/quick-setup.mdx renamed to website/src/pages/en/ai-suite/token-api-skills.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Quick Setup
2+
title: Agent Skills for Token API
3+
sidebarTitle: Token API Skills
34
---
45

56
## Quick Setup

website/src/pages/en/ai-suite/token-api-skills/_meta.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

website/src/pages/en/subgraphs/guides/_meta.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export default {
1010
'secure-api-keys-nextjs': '',
1111
polymarket: '',
1212
agent0: '',
13+
'x402-payments': '',
1314
'contract-analyzer': '',
1415
}

0 commit comments

Comments
 (0)