# MCP

> Connect AI tools to ImgSearch through its MCP server: setup, tools, the order and what each client gets.

## What it is

ImgSearch runs a remote MCP server. Connect it once to an AI tool (Claude, ChatGPT, Claude Code, Codex, Cursor or another MCP client) and the tool can search the ImgSearch library and the person’s own generations, and get the files that fit.

- **No key to copy.** The tool signs in with OAuth: the person approves it in their browser, and the tool gets its own token. It never sees the password. People see and disconnect their tools at Account → Connected apps.
- **The person’s own account.** Everything the tool does counts as theirs: what they own, their limits, their history.
- Every verified account can connect.

## Server URL

```text
https://imgsearch.com/mcp
```

It speaks Streamable HTTP and finds its sign-in through standard OAuth discovery, so most clients need only the URL.

## Set it up

Server URL:

```text
https://imgsearch.com/mcp
```

**Claude Code**

```bash
claude mcp add --transport http imgsearch --scope user https://imgsearch.com/mcp
```

**Codex**

```bash
codex mcp add imgsearch --url https://imgsearch.com/mcp
codex mcp login imgsearch
```

**Cursor** (in `mcpServers` of `.cursor/mcp.json`)

```json
"imgsearch": {
    "url": "https://imgsearch.com/mcp"
}
```

**Claude Code**: after adding the server, type `/mcp` in a session and choose to authenticate; approve the connection in your browser.

**Codex**: the login command opens the sign-in in your browser. Until you run it, `/mcp` shows ImgSearch as not authenticated.

**Cursor**: add the entry to `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (one project). Cursor shows "Needs login" next to ImgSearch: select it and approve in your browser.

**Claude** (web and desktop): open Customize → Connectors, choose Add custom connector, paste the server URL, then Connect and approve. In a chat, turn ImgSearch on from the connectors menu.

**ChatGPT** (web): with developer mode on (Settings → Security and login), create a developer-mode app named ImgSearch with the server URL and OAuth, sign in, then pick it from the + menu in a chat.

## Tools

What each client gets, with each tool’s title:

**Local agents (Claude Code, Codex, Cursor)**

| Tool | Title | Reads only |
|---|---|---|
| `search` | Search your generations and the ImgSearch library | Yes |
| `download` | Prepare ImgSearch downloads | Yes |
| `generate` | Generate with the AI balance | No |
| `estimate_generation` | Estimate a generation | Yes |
| `get_generations` | Your generations | Yes |
| `process_generation` | Upscale, export or cancel a generation | No |
| `update_generation` | Rename or star a generation | No |
| `delete_generation` | Delete a generation | No |
| `list_models` | AI models and options | Yes |
| `get_account` | Your ImgSearch account | Yes |
| `prepare_upload` | Upload a reference picture | No |

**Claude**

| Tool | Title | Reads only |
|---|---|---|
| `search` | Search your generations and the ImgSearch library | Yes |
| `download` | Prepare ImgSearch downloads | Yes |
| `generate` | Generate with the AI balance | No |
| `estimate_generation` | Estimate a generation | Yes |
| `get_generations` | Your generations | Yes |
| `process_generation` | Upscale, export or cancel a generation | No |
| `update_generation` | Rename or star a generation | No |
| `delete_generation` | Delete a generation | No |
| `list_models` | AI models and options | Yes |
| `get_account` | Your ImgSearch account | Yes |

**ChatGPT**

| Tool | Title | Reads only |
|---|---|---|
| `search_images` | Search ImgSearch Images | Yes |
| `download_images` | Download ImgSearch Images | Yes |
| `search_assets` | Search SVGs, packs, brands, sound effects, 3D models and videos | Yes |
| `download_asset` | Prepare an asset download | Yes |

## The order

The server’s instructions and its search and generation tools carry the same four steps as the API:

1. Search first. For any need for an image, illustration, icon, video, sound, music, voice or 3D model, search once per distinct need, in the user’s own generations and the ImgSearch library. Searching is free.
2. Inspect. Read each result’s description, size and license, and its band where one is given: strong usually fits when the description shows what was asked for; possible needs a closer look. Prefer results the user made or already owns, which cost nothing. If a search says it is incomplete, search again before deciding.
3. Reuse if one fits. Download only the items you chose.
4. Generate only if nothing fits, and only where generating is offered. Check the estimate first and stay within the most the user allowed; ask the user before going higher. If a request is refused for its content, tell the user; do not rephrase or retry it.

## Permissions

The consent screen lists what the tool may do: search, download, read your generations and, for tools other than ChatGPT, manage them and read your account. Spending AI balance is a separate, unticked box with a monthly limit that the person sets; the first time, it also asks the person to confirm they are 18 or older and have the rights to the pictures they upload. Without it, generation tools answer `spending_not_enabled`.

Each connected tool has its own page under Account → Connected apps: when it connected, what it may do, what it spent this month, and buttons to change the limit, stop or allow spending, or disconnect. A connection approved without spending connects again to get it.

## Answers and links

- Every tool answers JSON with a `status` and a `message`. A refused call is a status, not an error: the [error code](https://imgsearch.com/developers/errors.md) and a `user_message` to pass on.
- `search` takes up to 10 needs at once, each its own query. Each answer says what generating instead would cost.
- `download` prepares up to 20 items. Coding agents get a `resource_url` and a `file_name` for each: fetch the `resource_url` yourself and save the file under that name. Fetching it is what counts the download.
- `download_url` is for the person’s own browser: show it to them, never fetch it yourself. Chat apps (Claude, ChatGPT) get only `download_url`.
- File links work for 10 minutes and preview links for up to 60 minutes, while the connection’s token that asked for them is valid. Files the account already owns are free to fetch again.
- `generate` needs `max_usd`, the most it may cost in US dollars. Without `request_key`, the same request in the same ten-minute window answers the first generation (`deduplicated: true`) instead of starting a second one; send a new `request_key` or `variation` to make another on purpose. Read the result with `get_generations` after `poll_after_seconds`.

## ChatGPT

ChatGPT gets search and downloads: `search_images`, `download_images`, `search_assets` and `download_asset`. It finds photos, SVGs and packs, brand logos, sound effects, 3D models and videos, and hands the person download links to save themselves. It has no generation tools yet.

`search_assets` and `download_asset` also take the person’s own generations (type `generation`), and search results carry their `band`.

## Limits

The MCP server shares one budget with the website and the API: searches, result cards and downloads count the same wherever they happen. See [rate and crawl limits](https://imgsearch.com/developers/limits.md). A file link that answers `429` asks for a pause: wait its `Retry-After`, then go on.
