> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tinyfish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Integration

> Integrate TinyFish Web Agent with your AI assistant

Connect TinyFish to Claude, Codex, OpenCode, Command Code, Grok, Cursor, ChatGPT, or any MCP-compatible AI assistant. Once connected, your assistant can search the web, browse websites, and extract data on your behalf.

> [!NOTE]
>
> On **ChatGPT**, **Claude**, or **Grok**? The curated [TinyFish plugin](https://docs.tinyfish.ai/plugins.md) bundles these tools with skills and safety rules and installs in one command or tap. This page covers the raw MCP endpoint for any client.

## Quick Install

> [tab] Codex
>
> ```bash theme={null}
> codex mcp add tinyfish --url https://agent.tinyfish.ai/mcp
> ```

> [tab] Grok
>
> **1. Install the plugin**
>
> ```bash theme={null}
> grok plugin install tinyfish --trust
> ```
>
> **2. Open the MCP server list**
>
> ```bash theme={null}
> grok /mcps
> ```
>
> **3. Authenticate**
>
> In the `/mcps` list, find the **tinyfish** MCP server entry and select **Authenticate**. Grok opens the OAuth flow in your browser — sign in with your TinyFish account to authorize the connection.

> [tab] Claude Code
>
> ```bash theme={null}
> npx -y install-mcp@latest https://agent.tinyfish.ai/mcp --client claude-code
> ```

> [tab] OpenCode
>
> ```bash theme={null}
> opencode mcp add tinyfish --url https://agent.tinyfish.ai/mcp
> ```

> [tab] Command Code
>
> ```bash theme={null}
> npx -y @tiny-fish/cli@latest connect command-code
> ```

> [tab] Claude
>
> Claude uses the official TinyFish connector — one tap in the browser, no config file:
>
> > [card] [Add TinyFish to Claude](https://claude.ai/directory/tinyfish)
> >
> > Opens the TinyFish connector in a new tab
>
> See [Plugins → Claude](https://docs.tinyfish.ai/plugins.md#claude) for the full steps.

> [tab] ChatGPT
>
> ChatGPT has an official TinyFish plugin — one tap in the browser, no config file:
>
> > [card] [Add TinyFish to ChatGPT](https://chatgpt.com/plugins/plugin_asdk_app_695325bae7348191b58ae9349a963d22)
> >
> > Opens the TinyFish plugin in a new tab
>
> See [Plugins → ChatGPT](https://docs.tinyfish.ai/plugins.md#chatgpt) for the full steps. To add it as a custom MCP connector instead, use this server URL:
>
> ```text theme={null}
> https://agent.tinyfish.ai/mcp/chatgpt
> ```

> [tab] Cursor
>
> ```bash theme={null}
> npx -y install-mcp@latest https://agent.tinyfish.ai/mcp --client cursor
> ```

> [tab] Windsurf
>
> ```bash theme={null}
> npx -y install-mcp@latest https://agent.tinyfish.ai/mcp --client windsurf
> ```

> [accordion] Manual configuration
>
> > [tab] Codex
> >
> > ```bash theme={null}
> > codex mcp add tinyfish --url https://agent.tinyfish.ai/mcp
> > ```
>
> > [tab] Grok
> >
> > ```bash theme={null}
> > grok mcp add --transport http tinyfish https://agent.tinyfish.ai/mcp
> > ```
> >
> > Or add to `~/.grok/config.toml` (user-level) or `.grok/config.toml` (project-level):
> >
> > ```toml theme={null}
> > [mcp_servers.tinyfish]
> > url = "https://agent.tinyfish.ai/mcp"
> > ```
>
> > [tab] Claude Code
> >
> > ```bash theme={null}
> > claude mcp add --transport http tinyfish https://agent.tinyfish.ai/mcp
> > ```
>
> > [tab] OpenCode
> >
> > ```bash theme={null}
> > opencode mcp add tinyfish --url https://agent.tinyfish.ai/mcp
> > ```
> >
> > Or add to `~/.config/opencode/opencode.jsonc` (OpenCode reads JSON or JSONC):
> >
> > ```json theme={null}
> > {
> >   "mcp": {
> >     "tinyfish": {
> >       "type": "remote",
> >       "url": "https://agent.tinyfish.ai/mcp"
> >     }
> >   }
> > }
> > ```
> >
> > Then run `opencode mcp auth tinyfish` to complete OAuth (or authenticate on first use).
> >
> > OpenCode needs a model that supports **tool use** — TinyFish runs on tool calls, so image-only models (e.g. Nano Banana Pro) will error with "No endpoints found that support tool use." Switch OpenCode's model if you hit that.
>
> > [tab] Command Code
> >
> > Command Code connects with a TinyFish API key. The CLI writes it for you:
> >
> > ```bash theme={null}
> > npx -y @tiny-fish/cli@latest connect command-code --api-key sk-tinyfish-...
> > ```
> >
> > Drop `--api-key` if you have already run `tinyfish auth login`. There is no browser sign-in
> > for this client, so without a key the command stops rather than registering something that
> > cannot authenticate.
> >
> > To do it by hand, add to `~/.commandcode/mcp.json` with your key from the [dashboard](https://agent.tinyfish.ai/api-keys):
> >
> > ```json theme={null}
> > {
> >   "mcpServers": {
> >     "tinyfish": {
> >       "transport": "http",
> >       "url": "https://agent.tinyfish.ai/mcp",
> >       "headers": {
> >         "Authorization": "Bearer YOUR_API_KEY"
> >       }
> >     }
> >   }
> > }
> > ```
> >
> > That file is the user-wide config. `cmd mcp add` writes a project-only entry by default, and it opens a browser sign-in even when you pass a header, so TinyFish connects to Command Code by API key only.
>
> > [tab] Claude
> >
> > Nothing to configure by hand. The [TinyFish connector](https://claude.ai/directory/tinyfish) registers the server and completes OAuth in one tap — see [Plugins → Claude](https://docs.tinyfish.ai/plugins.md#claude).
>
> > [tab] ChatGPT
> >
> > Add a custom MCP connector in ChatGPT with:
> >
> > ```text theme={null}
> > https://agent.tinyfish.ai/mcp/chatgpt
> > ```
> >
> > ChatGPT will prompt you to authenticate via OAuth.
>
> > [tab] Cursor
> >
> > Add to your Cursor MCP settings:
> >
> > ```json theme={null}
> > {
> >   "mcpServers": {
> >     "tinyfish": {
> >       "url": "https://agent.tinyfish.ai/mcp"
> >     }
> >   }
> > }
> > ```
>
> > [tab] Windsurf
> >
> > Add to `~/.codeium/windsurf/mcp_config.json` (macOS/Linux) or `%USERPROFILE%\.codeium\windsurf\mcp_config.json` (Windows):
> >
> > ```json theme={null}
> > {
> >   "mcpServers": {
> >     "tinyfish": {
> >       "serverUrl": "https://agent.tinyfish.ai/mcp"
> >     }
> >   }
> > }
> > ```

## Available Tools

### Web Automation

* **`run_web_automation`** — Execute multi-step web automation given a URL and natural language goal. Streams progress in real-time. Use this for tasks that require clicking, navigating, filling forms, logging in, or interacting with a website. For authenticated recurring workflows, pass `use_profile: true`; add `profile_id` to select a specific TinyProfile.
* **`run_web_automation_async`** — Same as `run_web_automation` but returns a `run_id` immediately without waiting. Use for long-running tasks where you don't need real-time progress. Poll with `get_run`. Supports the same `use_profile`, `profile_id`, and `use_vault` controls.
* **`get_run`** — Retrieve details of a specific automation run by ID. Returns status, result, and error info.
* **`list_runs`** — List your automation runs with optional filtering by status and pagination.
* **`cancel_run`** — Cancel a running or pending automation run by ID. Idempotent — already-terminal runs return their current status.

### Batch Automation

* **`batch_status`** — Check the status of multiple runs at once (up to 8). Poll every 30–60 seconds until `all_terminal` is true.
* **`batch_cancel`** — Cancel multiple running or pending runs by their IDs (up to 8). Idempotent.

### Web Search

* **`search`** — Search the web and get structured results with titles, snippets, and URLs. Use this to find information or discover URLs before automating a specific site. Optional filters: `recency_minutes`, `after_date`, `before_date`, `domain_type` (`"web"` | `"news"` | `"research_paper"`), `pub_year_min` / `pub_year_max`. When `domain_type=research_paper`, `recency_minutes`, `after_date`, and `before_date` are not supported — use `pub_year_min` / `pub_year_max` instead to scope by publication year (inclusive integers, `0`-`9999`, with `pub_year_min <= pub_year_max` when both are set). You can also narrow or bias results with `location` (country code, e.g. `"US"`), `language` (language code, e.g. `"en"`), and `include_domains` / `exclude_domains` (comma-separated domain allow/deny lists, combined length capped). Use `page` (0-indexed, `0`-`10`) to paginate. You can also pass an optional `purpose` — a short statement of why you're searching — to give the search additional intent signal for better-quality results.
* **`get_search_usage`** — List past search usage records with filtering by date range and status.

### Content Extraction

* **`fetch_content`** — Fetch web pages, render JavaScript-heavy pages when needed, and extract clean, structured content. Preferred over `run_web_automation` when you only need to read page content. Supports up to 10 URLs per request. Control the output with `format` (`"markdown"` default | `"html"` | `"json"`), `links` and `image_links` (extract outbound/image URLs), `ttl` (cache freshness tolerance in seconds), and `per_url_timeout_ms` (per-URL wall-clock budget). Scope extraction with `include_selectors` / `exclude_selectors` (1–20 CSS selectors each). For conditional requests, pass `if_none_match` / `if_modified_since` (single URL only) and set `include_etag_and_last_modified` to get the validators back. You can also pass an optional `purpose` — a short statement of why you're fetching the URLs — to give the fetch additional intent signal for better-quality results.
* **`list_fetch_usage`** — List past fetch requests with filtering by date range and status. Returns metadata only.

### Deep Research

* **`run_deep_research_async`** — Start a deep research run that searches, reads, and synthesizes many sources into a cited report. Pass `query` and an optional `mode`: `"deep"` (default) or `"max"` (deeper, with a larger step budget, for when you ask for maximum depth). Returns a `research_run_id` and a `report_url` immediately; sign in to open the report there any time. For a follow-up, pass `prior_run_id` to reuse a completed report and its evidence, or `session_id` to continue an existing research session; these fields are mutually exclusive. A continued session's ID is returned as `session_id`. New-run responses omit `session_id`; use the returned run ID as `prior_run_id` for a follow-up.
* **`get_deep_research`** — Check a run by `research_run_id`. Waits up to about 25 seconds, then returns its status, progress and `report_url`. When `output_ready` is true, the result includes the report and its citations, plus `freshness_report` and `termination_reason` when available. The freshness report describes source dates; the termination reason explains why research stopped. A `synthesis_failed` termination means the report contains interim findings.
* **`list_deep_research`** — List your runs, newest first, with status and `report_url`; filter by status, text or date and page with `cursor`, like `GET /v1/research-run`.
* **`cancel_deep_research`** — Stop a run by `research_run_id`. Idempotent — finished runs return their current status.

Use the optional `domain_filter` on `run_deep_research_async` to control sources:

```json theme={null}
{
  "query": "Research recent grid-scale energy storage deployments",
  "domain_filter": {
    "mode": "exclusive",
    "domains": ["energy.gov", "iea.org"],
    "block": ["example.com"]
  }
}
```

`include` prioritizes the listed domains; `exclusive` restricts results to them.
`block` excludes domains in either mode. Each list accepts up to 150 entries.

Research runs usually take several minutes. The assistant starts a run, then calls `get_deep_research` with the same `research_run_id` while the status is `QUEUED` or `RUNNING`. `COMPLETED` returns the report. `FAILED`, `CANCELLED`, and `TIMED_OUT` are also terminal and return no report. Deep research is for explicit multi-source research requests, such as a cited landscape, literature review, or comparison across many options. For quick questions, the assistant uses `search` and `fetch_content`. Paid runs cost $2 (Deep) or $3 (Max) from your wallet when they complete, with up to 5 running at once. See [Research limits](https://docs.tinyfish.ai/tinyresearch/reference.md#limits). See the [TinyResearch](https://docs.tinyfish.ai/tinyresearch.md) for modes and report details.

Follow-ups create new runs and are priced the same way. See [Research limits](https://docs.tinyfish.ai/tinyresearch/reference.md#limits).

### Monitors

* **`create_monitor`** — Create a recurring [Monitor](https://docs.tinyfish.ai/tinymonitor.md) and get its baseline result immediately. Set `type` to `"search"` with `config.query` to watch a topic, or `"fetch"` with `config.url` to watch a page. `schedule_cron` is a 5-field cron, UTC unless prefixed with `CRON_TZ=<zone>`. Optional: `name`, `webhook_url`, `purpose`. Scheduled runs post to `webhook_url`; Page payloads say whether the page changed and include the diff. When the page changed and `purpose` is set, they also judge the change against it ([payload](https://docs.tinyfish.ai/tinymonitor/api-reference.md#scheduled-webhook-payloads)).
* **`list_monitors`** — List your Monitors with their id, type, target, schedule, and status.
* **`get_monitor`** — Get one Monitor by `monitor_id`.
* **`pause_monitor`** — Pause a Monitor's schedule by `monitor_id`.
* **`resume_monitor`** — Resume a paused Monitor's schedule by `monitor_id`.
* **`update_monitor`** — Change a Monitor's `schedule_cron`, `name`, `webhook_url`, or `purpose` by `monitor_id`. Omitted fields keep their values; `null` clears `name`, `webhook_url`, or `purpose`. The query or URL cannot change.
* **`run_monitor`** — Run a Monitor once now by `monitor_id` and return that result.
* **`cancel_monitor`** — Delete a Monitor and its schedule by `monitor_id`.

### Datasets

* **`create_dataset`** — Build a [dataset](https://docs.tinyfish.ai/tinyset.md): a table of many entities with the same fields, each row found and filled from the web. Pass `prompt`, or a `spec` returned by `plan_dataset` once you have reviewed the columns (at most 10, the key included), and an optional `target_rows` (1-250, default 100). Returns `dataset_id` and `run_id` immediately.
* **`plan_dataset`** — Design the columns for a `prompt` without creating anything, up to 10 including the key. Edit the returned `spec` and pass it to `create_dataset`.
* **`get_dataset`** — Check a dataset by `dataset_id`. Waits up to about 25 seconds, then returns its status, `row_count`, and the first 50 rows. When `output_ready` is true the rows stand; call `get_dataset_rows` for more.
* **`get_dataset_rows`** — One page of rows, up to 500, in column order. Pass the previous `next_cursor` as `after` for the next page.
* **`list_datasets`** — Your datasets, newest first, with status and row counts.
* **`populate_dataset`** — Fill an existing dataset again by `dataset_id`: raise `target_rows` to add rows, or set `reset` to rebuild it. Refused while a run is live.
* **`cancel_dataset_run`** — Stop a run by `dataset_id` and `run_id`. Rows already added stay.
* **`delete_dataset`** — Delete a dataset and its rows by `dataset_id`. Cancel any live run first.

Filling a dataset usually takes minutes. The assistant creates it, then calls `get_dataset` with the same `dataset_id` while `status` is `populating`; `ready`, `empty`, `failed`, and `cancelled` are final. Datasets are for an explicit table or list of many entities, such as companies, products, or places with the same fields per row. For a single fact or page, the assistant uses `search` and `fetch_content`. Each complete row a run adds costs \$0.10 from your wallet, with up to 3 runs going at once. See the [TinySet](https://docs.tinyfish.ai/tinyset.md) for the spec format and limits.

### Browser Sessions

* **`create_browser_session`** — Create a remote, stealth Chrome browser session and get CDP connection details. Use for direct programmatic browser control with Playwright, Puppeteer, or Selenium.
* **`list_browser_sessions`** — List your browser sessions with optional filtering by session ID, time range, and status.
* **`close_browser_session`** — Close a browser session by ID to release it early instead of waiting for its inactivity timeout. Idempotent — already-ended sessions return success.

### Wallet

* **`get_wallet`** — Read-only. Returns your current wallet balance, auto-reload state, per-product contract rates, and any in-flight top-up. Auto-reload changes happen in the dashboard.
* **`top_up_wallet`** — Adds money to your wallet, paid by the agent over the Machine Payments Protocol: the first call returns a payment challenge, the second call presents the paid credential. Out-of-funds refusals point at it, and your wallet asks you to approve the payment. Accounts outside the rollout don't see this tool in the tool list, and calling it anyway returns `Unknown tool: top_up_wallet`. See [TinyAgent Payments](https://docs.tinyfish.ai/agent-payments.md#mcp).

## Profile-Aware Automation

TinyProfiles let MCP automation reuse saved login state. If the user asks for an authenticated or recurring workflow, prefer a saved profile instead of logging in from scratch every run. Use `run_web_automation` with `use_profile: true`. If the user provides a profile ID, pass it as `profile_id`; `profile_id` requires `use_profile: true`. Pair with `use_vault: true` when the run should repair stale sessions with saved credentials.

```json theme={null}
{
  "url": "https://app.example.com/dashboard",
  "goal": "Summarize the account health dashboard",
  "use_profile": true,
  "use_vault": true
}
```

```json theme={null}
{
  "url": "https://app.example.com/dashboard",
  "goal": "Summarize the latest invoice, including the amount due and payment deadline.",
  "use_profile": true,
  "profile_id": "prof_abc123def4567890"
}
```

Create and save profiles from the [TinyProfiles API](https://docs.tinyfish.ai/tinyagent/api/profiles/tinyprofile.md) or dashboard before using them from MCP. API setup returns a `cdp_url` for Playwright/Puppeteer/CDP and a `base_url` for TinyFish HTTP session endpoints such as `/pages`. TinyProfiles are saved session state; [Browser Profiles](https://docs.tinyfish.ai/key-concepts/browser-profiles.md) are the `browser_profile: "lite" | "stealth"` runtime modes.

## Example Usage

```
"Go to https://example.com and extract the product prices"

"Use my saved Salesforce profile to summarize the dashboard"

"Fill out the vendor onboarding form using these company details, then stop before submitting."

"Find overdue invoices in my billing dashboard and list each customer, amount due, and due date."

"Search for the best Italian restaurants in San Francisco"

"Scrape the pricing pages from these 5 competitor websites at the same time"

"Fetch https://docs.stripe.com/api/charges and summarize the API parameters"

"Create a browser session on https://example.com so I can control it with Playwright"

"Do deep research on long-duration energy storage approaches and give me a cited report"

"Monitor https://example.com/pricing every morning and send each result to https://hooks.example.com/pricing"

"Build a dataset of specialty coffee shops in Oakland with their website and rating"
```

## Rates

| Tool | Rate |
| - | - |
| `search` | \$0.00 per request |
| `fetch_content` | \$0.00 per URL |
| `run_web_automation` | \$0.016 per step |
| `create_browser_session` | \$0.002 per browser-minute |
| `create_monitor` | \$0.005 per completed run, plus its Search or Fetch; failed runs are free |
| `create_dataset`, `populate_dataset` | \$0.10 per complete row added, including the run's Search and Fetch; incomplete, skipped and failed rows are free |

Accounts on legacy credit plans bill 1 credit per step and 1 credit per 4 browser-minutes instead.

## Authentication

TinyFish MCP uses OAuth 2.1 for secure authentication. The first time you connect, your browser will open to complete the OAuth flow.

### Before You Start

Make sure you are signed in to both of these in your **default browser** before triggering the OAuth flow:

1. [claude.ai](https://claude.ai) — your Claude/Anthropic account
2. [agent.tinyfish.ai](https://agent.tinyfish.ai) — your TinyFish account

### Authentication Flow

When you first configure the TinyFish MCP server, your client will open your default browser to complete OAuth. Since you're already signed in to both services, the flow will redirect automatically and complete without manual input.

> [!NOTE]
>
> You need a TinyFish account. Search and Fetch are free within a daily allowance; Agent and Browser draw from your wallet (plan credits on legacy accounts). [Sign up here](https://agent.tinyfish.ai/api-keys).

## Troubleshooting

> [accordion] Tool not showing up
>
> 1. Restart your AI client after adding the config
> 2. Check that the config JSON is valid
> 3. Ensure you're authenticated (OAuth prompt should appear)

> [accordion] Authentication failing
>
> **Before starting the OAuth flow**, make sure you are already signed in to both services in your default browser:
>
> 1. Open your default browser and sign in to [claude.ai](https://claude.ai)
> 2. In the same browser, sign in to [agent.tinyfish.ai](https://agent.tinyfish.ai)
> 3. Then restart your MCP client and trigger the OAuth flow again
>
> The OAuth redirect will open in your default browser. If you're not already signed in there, the flow will fail or get stuck.
>
> **Still not working?**
>
> * **Clear cookies** - Clear browser cookies for both claude.ai and agent.tinyfish.ai, then retry
> * **Check TinyFish account** - Verify your account is active at [agent.tinyfish.ai/api-keys](https://agent.tinyfish.ai/api-keys)

> [accordion] Server disconnected (Windows)
>
> On Windows, if you see "Server disconnected" errors:
>
> 1. **Close Claude Desktop completely** - Check Task Manager and end any Claude processes
> 2. **Reinstall via the connector** - The [TinyFish connector](https://docs.tinyfish.ai/plugins.md#claude) registers the server for you and avoids hand-edited config entirely
> 3. **Complete OAuth quickly** - When the browser opens, complete the sign-in promptly to avoid timeout issues

> [accordion] Automation timing out
>
> Complex automations may take 30-60 seconds. For sites with bot protection, the assistant should use `browser_profile: "stealth"`.

## Related

> [card] [Quick Start](https://docs.tinyfish.ai/quick-start.md)
>
> Get started with the REST API

> [card] [API Reference](https://docs.tinyfish.ai/api-reference)
>
> Full endpoint documentation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.