Prerequisites
You need a Graph API key for all usage (including testnet). Create one at thegraph.com/studio.Setup
The Graph MCP uses SSE transport, which requiresmcp-remote as a local proxy. The server name (nile-graph below) is a local alias you choose — it’s how your agent identifies this MCP connection.
- Claude Desktop
- Cursor
Add to your Replace
claude_desktop_config.json (Settings > Developer > Edit Config):YOUR_GRAPH_API_KEY with your key from Subgraph Studio, then restart Claude Desktop.graphql://subgraph as a resource in your agent’s context to activate the MCP tools. You specify which subgraph to query at query time — by deployment ID, subgraph ID, or keyword search.
Available Entities
The Nile Markets subgraph indexes 13 entity types across protocol state, positions, oracle data, and analytics.
Mutable entities reflect current state and are updated over time. Immutable entities are append-only event records that never change after creation.
Example Queries
Once connected, your agent can run arbitrary GraphQL against the Nile Markets subgraph. Fetch all open positions for an account:Graph MCP vs Nile MCP
Both give AI agents access to Nile Markets data. They serve different use cases.
Use Graph MCP when you need custom queries, cross-entity joins, or aggregations that the typed tools don’t support — for example, filtering positions by multiple criteria simultaneously or computing custom analytics across entities.
Use Nile MCP when you want structured interactions with response formatting, real-time RPC data (current prices, live PnL), or write operation calldata. The Nile MCP server is at
mcp.nilemarkets.com/api/mcp — see MCP Server for setup.