---
name: sqd
description: Set up a coding agent for SQD Portal and pick the right SQD tool. Use when the user asks to be set up for SQD or SQD Portal, to connect the Portal MCP server, to configure a Portal API key, or to choose between the Portal API, Pipes SDK, Squid SDK and SQD Cloud for blockchain data.
license: Apache-2.0
metadata:
  author: subsquid
  version: "2.0.0"
---

# SQD

SQD Portal serves blockchain data from 110+ networks (EVM, Solana, Substrate, Bitcoin, Tron, Hyperliquid) over plain HTTP. Agents reach it through the Portal MCP server for questions and the Portal API for raw data. Indexers built with the Pipes SDK or the Squid SDK read from the same Portal.

## Set up SQD Portal

Follow these steps when the user asks to be set up, for example after pasting the prompt from the Portal app's "Onboard your agent" card. Skip a step that is already done, and report what you configured at the end.

### 1. Connect the Portal MCP server

The server is `https://portal.sqd.dev/mcp`. It needs no account and no key. Check the client's existing MCP servers first so you do not add it twice.

| Client | How to add it |
|---|---|
| Claude Code | `claude mcp add --transport http sqd-portal https://portal.sqd.dev/mcp` |
| Codex | `codex mcp add sqd-portal --url https://portal.sqd.dev/mcp` |
| Cursor | Add `"sqd-portal": {"url": "https://portal.sqd.dev/mcp"}` under `mcpServers` in `mcp.json` |
| VS Code | Add `"sqd-portal": {"type": "http", "url": "https://portal.sqd.dev/mcp"}` under `servers` in `.vscode/mcp.json` |
| Claude (web, desktop) | Add the [SQD connector](https://claude.ai/directory/connectors/sqd) from the Claude Directory |

Other MCP clients take the same URL as a streamable HTTP server. Most clients load a new server only in a new session, so tell the user to restart the client and then check that the `portal_` tools are listed.

### 2. Install SQD's agent skills

```bash
npx skills add subsquid-labs/skills --all --full-depth
```

`--full-depth` is required: two of the four skills sit one directory down. The skills are `portal` (queries, dataset names, exports, Portal setup and keys), `pipes-sdk` (indexers), `migrate-to-portal` (moving a squid off the v2 gateway) and `squid-perf` (sync-time reports).

The SQD plugins for [Claude Code](https://docs.sqd.dev/en/ai/plugins-claude), [Codex](https://docs.sqd.dev/en/ai/plugins-codex) and [Cursor](https://docs.sqd.dev/en/ai/plugins-cursor) bundle the MCP server and the same skills. Use either the plugin or the two steps above, not both, or the agent gets two copies of each skill.

### 3. Add a Portal API key, only if the user's plan has one

The public Portal (`https://portal.sqd.dev`) and the MCP server need no key. Testing and paid plans, and dedicated Portals, take a key on every Portal API request, with the same paths and request bodies as the public Portal. Do not ask for a key when the public Portal answers the user's need.

- The user creates the key in the Portal app at [portal.sqd.dev/app](https://portal.sqd.dev/app), under **API keys**. Keys start with `sqd_prt_`, can be limited to chosen chains and given an expiry, and take up to five minutes to work after they are created or changed.
- The user puts the key in an untracked `.env` file or the deployment's secret store as `SQD_PORTAL_API_KEY`, next to `SQD_PORTAL_URL`, the base URL their plan gives them. Never ask for the key in chat, and never print it.
- Add both names with placeholder values to `.env.example`, and check that `.env` is in `.gitignore`.
- Send the key as `Authorization: Bearer <key>`. Portal also accepts `x-api-key: <key>`. See [Presenting an API key](https://docs.sqd.dev/en/portal/introduction/error-handling#presenting-an-api-key).

### 4. Check the key

Send a one-block stream request, which is what a client sends. A `200` with one line of JSON means the key works. Reading the header from a process substitution keeps the key out of the command's arguments:

```bash
curl -sS --compressed -X POST "$SQD_PORTAL_URL/datasets/ethereum-mainnet/stream" \
  -H 'content-type: application/json' \
  -H @<(printf 'Authorization: Bearer %s\n' "$SQD_PORTAL_API_KEY") \
  -d '{"type":"evm","fromBlock":20000000,"toBlock":20000000,"fields":{"block":{"number":true}}}'
```

A key problem answers `403` with an `error.code`: `missing_credential`, `invalid_credential`, `revoked_credential`, `expired_credential`, `portal_not_allowed` (the plan does not include this Portal) or `dataset_not_allowed` (the key is not allowed this chain). A `529` with `overloaded` is a capacity answer; wait `Retry-After` seconds and try again. The `portal` skill explains each code and the fix.

### 5. Report

Tell the user which MCP entry you added and whether a restart is needed, which skills are installed, where the key variable lives (without its value), and whether the key check passed.

## Choose the SQD tool

| Need | Use |
|---|---|
| A bounded answer in chat: a wallet, a contract, recent activity, a chart | Portal MCP tools |
| Raw rows, an export, or a reproducible request from any language | [Portal API](https://docs.sqd.dev/en/portal/introduction/portal-api) |
| A TypeScript pipeline into PostgreSQL, ClickHouse, BigQuery or Parquet | [Pipes SDK](https://docs.sqd.dev/en/sdk/pipes-sdk/evm/quickstart) |
| A dApp backend with a GraphQL API, or a managed deployment on SQD Cloud | [Squid SDK](https://docs.sqd.dev/en/sdk/squid-sdk/evm/quickstart) |
| An existing Ponder indexer | [Ponder on Portal](https://docs.sqd.dev/en/sdk/alternative-clients/ponder) |

Once a query has to run on a schedule, backfill a long range, join datasets or feed an application, move it from MCP or curl to Pipes or a squid. SQD Cloud runs squids only; Pipes indexers run on your own infrastructure.

## Portal API essentials

- Endpoint: `POST https://portal.sqd.dev/datasets/{dataset}/stream`. Dataset names are specific: `ethereum-mainnet`, `arbitrum-one`, `base-mainnet`, `binance-mainnet`, `solana-mainnet`, `bitcoin-mainnet`, `tron-mainnet`, `hyperliquid-fills`. The [dataset list](https://portal.sqd.dev/datasets) is current.
- Every request names `type` (`evm`, `solana`, `substrate`, `bitcoin`, `tron`, `hyperliquidFills`) and `fromBlock`, and selects `fields`. Portal returns only the fields you request.
- The response is NDJSON, one block per line. A response can end before `toBlock`; resume from the last block number plus one.
- For a live stream, pass `parentBlockHash` and handle `409` (a fork), or use `/finalized-stream`.
- Resolve a time to a block with `GET /datasets/{dataset}/timestamps/{unix-seconds}/block` instead of estimating from block times.
- Errors share one envelope: branch on `error.type`, match on `error.code`, and honor `Retry-After`. See [Error handling](https://docs.sqd.dev/en/portal/introduction/error-handling).

## Resources

- [Portal MCP server](https://docs.sqd.dev/en/ai/mcp-server): endpoint, clients and tool behavior
- [Agent skills](https://docs.sqd.dev/en/ai/agent-skills): install options for each skill
- [Portal pricing](https://docs.sqd.dev/en/portal/pricing): plans and which ones use a key
- [llms.txt](https://docs.sqd.dev/llms.txt): index of every docs page
- [OpenAPI](https://docs.sqd.dev/openapi.json): machine-readable Portal API contract
