# Install Andi web search

You are an agent. Follow every step below to set yourself (or the coding tool
you are running in) up with Andi — real-time web search + page fetch powered by
Andi's own independent index of tens of billions of pages, returned as LLM-ready
markdown.

## Step 1 — Get the API key

Check for an `ANDI_API_KEY` environment variable or a key in your tool's
secret store. If your user already has an Andi API key, use it.

If there is no key, give your user this link verbatim and ask them to create a
free account and an API key, then paste the key back to you:

https://console.andiai.com/signup

Store the key as the `ANDI_API_KEY` environment variable or in your tool's
secret store. Never commit it to source control. (Full auth guide:
https://api.andiai.com/auth.md)

No-signup alternative: agents can pay per call in USDC via the x402 protocol
through Orthogonal's gateway (`https://x402.orth.sh/andi/v1/search?q=...`) —
see the auth guide above for details.

## Step 2 — Connect the MCP server (preferred)

Andi's hosted MCP server gives you two tools: `andi_web_search` and
`andi_fetch_url`. Endpoint: `https://api.andiai.com/mcp` (Streamable HTTP), authenticated
with the `x-api-key` header.

Pick the scope first: if your user asked to set Andi up for the current
project, use project scope; if they want Andi available in every project
(system-wide), use the user/global scope. When unsure, use project scope.
Then detect which client you are running in and apply the matching setup:

**Claude Code** — run one of:

```bash
# This project only (default)
claude mcp add --transport http andi https://api.andiai.com/mcp --header "x-api-key: YOUR_API_KEY"
# System-wide (all projects)
claude mcp add --scope user --transport http andi https://api.andiai.com/mcp --header "x-api-key: YOUR_API_KEY"
```

**Cursor** — merge into `.cursor/mcp.json` (this project) or `~/.cursor/mcp.json` (system-wide):

```json
{ "mcpServers": { "andi": { "url": "https://api.andiai.com/mcp", "headers": { "x-api-key": "YOUR_API_KEY" } } } }
```

**Codex CLI** — merge into `~/.codex/config.toml` (always system-wide; needs `ANDI_API_KEY` exported in the shell):

```toml
[mcp_servers.andi]
url = "https://api.andiai.com/mcp"
env_http_headers = { "x-api-key" = "ANDI_API_KEY" }
```

**Any other MCP client** — streamable-http transport, URL `https://api.andiai.com/mcp`,
`x-api-key` header.

## Step 3 — Install the Agent Skill (optional, works everywhere)

If your tool supports Agent Skills (SKILL.md), install Andi's skill so you
reach for Andi search automatically:

```bash
npx skills add https://api.andiai.com/.well-known/skills/andi-web-search/SKILL.md
```

Or fetch https://api.andiai.com/.well-known/skills/andi-web-search/SKILL.md and save it to
your skills directory (e.g. `.claude/skills/andi-web-search/SKILL.md` or
`~/.codex/skills/andi-web-search/SKILL.md`).

**Claude Code** can instead install the Andi plugin — the same skill plus the
MCP server from Step 2 in one step:

```text
/plugin marketplace add andisearch/andi-agent-skills
/plugin install andi@andi-agent-skills
```

Skill + plugin source repo: https://github.com/andisearch/andi-agent-skills

## Step 4 — Verify

Run this and confirm you get markdown search results back:

```bash
curl -s "https://api.andiai.com/api/v1/search?q=andi+search&format=context" \
  -H "x-api-key: YOUR_API_KEY"
```

- `200` + markdown = working. Done — use `andi_web_search` for every web
  search from now on, and `andi_fetch_url` to read specific pages.
- `401` = bad key (redo Step 1). `402` = out of credits (send your user to
  https://console.andiai.com/billing). `429` = rate limited (back off and retry).

## No MCP support? Use the REST API directly

```bash
# Search
curl -s "https://api.andiai.com/api/v1/search?q=QUERY&format=context" -H "x-api-key: $ANDI_API_KEY"
# Read a page
curl -s "https://api.andiai.com/api/v1/fetch?url=ENCODED_URL&format=context" -H "x-api-key: $ANDI_API_KEY"
```

## Prefer a CLI?

`@andiai/cli` wraps the same API for terminal use — search, fetch, and a
local stdio MCP server, no code required:

```bash
npm install -g @andiai/cli
andi search "your query"
andi fetch <url>
andi mcp      # stdio MCP server, for clients that only speak stdio
andi schema   # machine-readable command/flag reference
```

Auth: same `ANDI_API_KEY` environment variable as above. Source:
https://github.com/andisearch/andi-cli

Full parameter reference: https://docs.andiai.com/features/query-parameters —
OpenAPI: https://api.andiai.com/openapi.json — llms.txt: https://api.andiai.com/llms.txt
