# Use GraphOps with AI agents

Source: https://docs.graphops.xyz/ai-agents

Help your coding agent write working code against GraphOps on the first attempt. GraphOps publishes
agent skills, short instructions your agent loads when a task needs them, and an MCP server for the
documentation. The skills tell the agent which service fits a task, how to authenticate, how to
keep requests bounded and what to do when a request fails.

To have your agent do this setup for you, paste the setup prompt from
[AI agent quickstart](/ai-agent-quickstart).

## Install the skills

GraphOps publishes four skills:

| Skill                 | Loads when a task                                                         |
| --------------------- | ------------------------------------------------------------------------- |
| `graphops`            | Chooses between services, uses an API key, or explains an error code.     |
| `graphops-rpc`        | Reads chain state, calls contracts, fetches logs or submits transactions. |
| `graphops-subgraphs`  | Queries indexed entities with GraphQL.                                    |
| `graphops-substreams` | Streams blocks or module output, backfills a range, or runs a sink.       |

The skills are listed at `https://docs.graphops.xyz/.well-known/agent-skills/index.json`, the
[Agent Skills Discovery](https://github.com/cloudflare/agent-skills-discovery-rfc) location that
skill installers read. To install all four with the open-source `skills` installer, run
`npx skills add https://docs.graphops.xyz`.

You can also download one skill from
`https://docs.graphops.xyz/.well-known/agent-skills/<name>/SKILL.md` and save it where your agent
reads skills. For example, Claude Code reads `~/.claude/skills/<name>/SKILL.md`.

An agent that doesn't support skills can still read `https://docs.graphops.xyz/skill.md`, the
general skill, as plain instructions.

The skills contain instructions and links only, never scripts.

### Skill link relation

An agent that starts from a service endpoint can find that service's skill in the service's
[RFC 9727](https://www.rfc-editor.org/rfc/rfc9727) API catalog at `/.well-known/api-catalog`, and in
the merged catalog at `https://graphops.xyz/.well-known/api-catalog`. No registered link relation
names an agent skill yet, so the catalog entry links the skill's `SKILL.md` with the extension
relation `https://docs.graphops.xyz/ai-agents#skill-link-relation` and the type `text/markdown`.

## Give the agent an API key

The skills read each service's key from an environment variable, so the key never has to appear in
the conversation:

| Service    | Variable                     |
| ---------- | ---------------------------- |
| RPC        | `GRAPHOPS_RPC_API_KEY`       |
| Subgraphs  | `GRAPHOPS_SUBGRAPHS_API_KEY` |
| Substreams | `SUBSTREAMS_API_KEY`         |

Create a separate key for the environment your agent works in, with a label that names it, so you can
revoke it without affecting your applications. Requests your agent sends use credits like any other
request. The skills tell the agent to stop on `credits_exhausted` instead of retrying; to keep an
agent's usage in check, set a spending limit on
[automatic top-ups](/platform/billing-and-credits#automatic-top-ups) and
watch [usage](/platform/usage-and-limits).

See [API keys](/platform/api-keys) to create and revoke keys.

## Connect the docs MCP server

The docs MCP server lets an agent search and read these docs, explain an error code, and list the
supported networks with their endpoints, without leaving its session. It needs no API key.

| Tool            | Use                                                   |
| --------------- | ----------------------------------------------------- |
| `search`        | Search the docs.                                      |
| `list_pages`    | List every docs page.                                 |
| `get_page`      | Read one page in Markdown.                            |
| `explain_error` | Explain an error code and what to do next.            |
| `list_networks` | List each service's supported networks and endpoints. |

Add `https://docs.graphops.xyz/api/mcp` as a remote MCP server using the Streamable HTTP transport.
For example, in Claude Code, run
`claude mcp add --transport http graphops-docs https://docs.graphops.xyz/api/mcp`.

## Keep the skills current

Each skill states its version and the URL it was published at, and tells the agent to compare its
copy with the published one at the start of a task. When your agent reports that your GraphOps
skills are out of date, install them again.

## Next steps

* [Choose a data service](/choose-a-service): Compare RPC, Subgraphs and Substreams for your workload.
* [Production readiness](/production-readiness): Review credentials, limits and retries before your agent's code ships.
* [Error reference](/platform/errors): Look up an error code your agent reported.