---
agent:
  instructions: "Search crawlapi docs via GET /.well-known/search?q={query} (add &format=json or Accept: application/json for JSON)."
  endpoint: "https://docs.crawlapi.dev/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.crawlapi.dev/llms.txt"
---

> Documentation index: https://docs.crawlapi.dev/llms.txt
> Search docs: https://docs.crawlapi.dev/.well-known/search?q={query}
> OpenAPI 3.1 specification: https://docs.crawlapi.dev/openapi.json

# MCP server

> Connect Claude Code, Codex, Cursor, VS Code, OpenCode, or pi to live crawlapi tools.

Connect your coding agent to crawlapi's hosted MCP server to read web pages, JavaScript apps, PDFs, Office files, X posts, YouTube videos, and docs sites directly from chat. Authentication runs through browser OAuth so no API key sits in your editor config.

> **Hosted endpoint**
>
> `https://mcp.crawlapi.dev/mcp` — Include the `/mcp` path and leave API keys out of the URL.

## Let your agent wire it up

Paste this prompt into the coding agent you want to connect:

**Agent prompt**

```text
Read https://docs.crawlapi.dev/mcp.md and connect the crawlapi MCP server to this client only, including its sign-in command if listed. When done, tell me how to verify it in a fresh session.
```

Your agent registers the MCP server in its own config, runs its OAuth sign-in command if supported, and tells you how to verify in a fresh session.

To make your agent prefer crawlapi automatically without naming it each time, follow [Use crawlapi as default](https://docs.crawlapi.dev/default-scrape.md).

## Connect manually

Pick the section for the client you are connecting — each client stores its own config and OAuth sign-in separately.

**Claude Code**

```bash
claude mcp add --transport http --scope user crawlapi https://mcp.crawlapi.dev/mcp
claude mcp login crawlapi
```

**Codex**

```bash
codex mcp add crawlapi --url https://mcp.crawlapi.dev/mcp
codex mcp login crawlapi
```

**OpenCode**

```bash
opencode mcp add --global crawlapi --url https://mcp.crawlapi.dev/mcp
opencode mcp auth crawlapi
```

**pi**

```bash
pi mcp add crawlapi --exposure direct --url https://mcp.crawlapi.dev/mcp
pi mcp login crawlapi
```

**Cursor**

```json
{
  "mcpServers": {
    "crawlapi": {
      "url": "https://mcp.crawlapi.dev/mcp"
    }
  }
}
```

**VS Code**

```bash
code --add-mcp '{"name":"crawlapi","type":"http","url":"https://mcp.crawlapi.dev/mcp"}'
```

- **Claude Code:** Omit `--scope user` to register for the current project only. Pass `--no-browser` to `claude mcp login crawlapi` over SSH, or run `/mcp` and select `crawlapi` inside an active session.
- **Codex:** For a single trusted project, add `[mcp_servers.crawlapi]` with `url = "https://mcp.crawlapi.dev/mcp"` to `.codex/config.toml`, then run `codex mcp login crawlapi`.
- **OpenCode:** Alternatively, add `"crawlapi": {"type": "remote", "url": "https://mcp.crawlapi.dev/mcp"}` under `mcp.servers` in `opencode.json`, then run `opencode mcp auth crawlapi`.
- **Cursor:** Add the JSON block above to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project), then click **Authenticate** in Cursor's MCP settings.
- **Amp & Grok:** Run `amp mcp add crawlapi https://mcp.crawlapi.dev/mcp` (Amp), or `grok mcp add --transport http crawlapi https://mcp.crawlapi.dev/mcp` followed by `grok mcp login crawlapi` (Grok).
- **Gemini CLI & Antigravity:** Install the extension with `gemini extensions install https://github.com/crawlapi-dev/crawl` (or `gemini mcp add -s user -t http crawlapi https://mcp.crawlapi.dev/mcp`), or add the JSON block above to `~/.gemini/config/mcp_config.json` in Antigravity.
- **Crush & Kimi Code:** In Crush `crushrc`, add `mcp add crawlapi --type http --url https://mcp.crawlapi.dev/mcp --oauth true`; in Kimi Code, run `/mcp-config` or add `mcpServers` to `~/.kimi-code/mcp.json`.
- **VS Code:** For workspace scope instead of user profile, create `.vscode/mcp.json` with `{"servers": {"crawlapi": {"type": "http", "url": "https://mcp.crawlapi.dev/mcp"}}}`.
- **Windsurf & other clients:** Add `"crawlapi": { "serverUrl": "https://mcp.crawlapi.dev/mcp" }` inside `mcpServers` in `~/.codeium/windsurf/mcp_config.json`, or point any remote MCP client (Claude, ChatGPT, Gemini, Copilot, and others) at `https://mcp.crawlapi.dev/mcp` with OAuth discovery enabled.

## Verify the connection

Open a new session and run:

**Connection check**

```text
Use the crawlapi MCP server to check my account with the account tool, then scrape https://example.com in markdown and tell me which tool you called.
```

## Tools

| Tool | Inputs | What it does |
| --- | --- | --- |
| `scrape` | `url`, `format` (`markdown` \| `json`), `timeout_ms` (`1000`–`60000`), `offset` | Reads one web page or document as clean markdown (default, full text) or structured JSON (metadata, JSON-LD, tables, links; no prose). Pass `offset` from `next_offset` to continue a long page |
| `site` | `url`, `max_pages` (`1`–`50`, default `10`), `max_depth` (`0`–`3`, default `1`), `max_credits` (`1`–`500`, default `25`), `format`, `include`, `exclude` | Crawls pages on the same host and port within page, depth, and credit bounds |
| `account` | `{}` | Checks your email, credit balance, holds, and rate limits |

## Authentication and output handling

Supported MCP clients sign in through your browser at `app.crawlapi.dev` using OAuth (PKCE), keeping API keys out of config files. Clients without OAuth support can send `Authorization: Bearer <key>` instead.

To stop an agent from spending too many credits during a crawl, pass `max_credits` (default `25`, max `500`) and `max_pages` (default `10`, max `50`) to `site`. See [Credits and pricing](https://docs.crawlapi.dev/credits.md) for request billing. Signing out of all sessions or suspending an account revokes connected MCP clients immediately.

Page text is fenced as untrusted data before reaching your model. Very large pages return `truncated=true` with a `next_offset` value — call `scrape` again with `offset` set to `next_offset` to read the next chunk. Long `site` crawls return every page fetched so far.

> **Keep tool approvals enabled for multi-page crawls**
>
> Scraped web pages are untrusted input. Keep client approvals enabled for `site` crawls so instructions inside a page cannot trigger follow-up crawls on their own.

## Local MCP (`crawl mcp`)

If you already installed the [CLI](https://docs.crawlapi.dev/cli.md) — or want full output from large pages written to local temp files on disk — run the local MCP server instead:

**Shell**

```bash
crawl login
crawl setup
```

`crawl setup` installs the CLI skill and prints the local `crawl mcp` config for each supported agent on your machine. Local `crawl mcp` also includes a `login` tool so agents can trigger browser approval straight from chat.

## Manage access and delete data

- **Disconnect an MCP client:** Revoke access inside your AI platform's connected-apps settings (which notifies our OAuth revocation endpoint immediately), or sign out of all sessions at [app.crawlapi.dev/account](https://app.crawlapi.dev/account) to revoke every active MCP token right away. If you connected with a bearer API key instead of OAuth, revoke that key at [app.crawlapi.dev/keys](https://app.crawlapi.dev/keys).
- **What we store:** crawlapi stores your account profile, credit ledger, and request receipts (host, status, timing, and credits — never URL paths, query strings, or page text in logs). See our [privacy policy](https://crawlapi.dev/privacy) for full data handling and retention details.
- **Delete your account:** Email `support@crawlapi.dev` from your account address to suspend and permanently erase your account identity and connected OAuth grants.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| Server missing or no tools listed | Confirm the URL ends in `/mcp`, restart or refresh your client, and verify the server is enabled for the current session. |
| Agent answers from memory without calling a tool | Name `crawlapi` explicitly in the prompt, ask for a live check, and require the agent to report which tool ran. |
| `401 Unauthorized` or repeated OAuth prompts | Re-authenticate from your client's MCP menu, or check your `Authorization: Bearer` key at [app.crawlapi.dev/keys](https://app.crawlapi.dev/keys). |
| `INSUFFICIENT_CREDITS` | Run the `account` tool to check your balance and top up at [app.crawlapi.dev/billing](https://app.crawlapi.dev/billing). |
| Long page or crawl was trimmed | For `scrape`, call it again with `offset` set to `next_offset` to continue reading. For `site`, narrow the crawl with `max_pages`, `include`, or `exclude` (or run local `crawl mcp` to save full output to disk). |
