$git clone https://github.com/anysearch-ai/anysearch-mcp-serverUnified real-time search MCP server supporting general web search, vertical domain search, parallel batch search, and full-page URL content extraction.
| 1 | # AnySearch MCP Server |
| 2 | |
| 3 | Unified real-time search MCP server supporting general web search, vertical domain search, parallel batch search, and full-page URL content extraction. |
| 4 | |
| 5 | ## Features |
| 6 | |
| 7 | - **General Web Search** — open-ended natural language queries |
| 8 | - **Vertical Domain Search** — structured queries across finance, academic, security, legal, code, and more |
| 9 | - **Parallel Batch Search** — execute multiple independent queries in one call |
| 10 | - **URL Content Extraction** — fetch and extract full page content as Markdown |
| 11 | - **Anonymous Access** — works without an API key (with lower rate limits) |
| 12 | |
| 13 | ## API Key Configuration |
| 14 | |
| 15 | An API key is **optional but recommended**. Without a key, all features still work via anonymous access with lower rate limits. |
| 16 | |
| 17 | ### Register for an API Key (Recommended) |
| 18 | |
| 19 | The agent can register the user and obtain an API key in a **single call** — no verification code, no manual signup. Ask the user for a **real email address**: it becomes the account username, and a randomly generated password is emailed to it. |
| 20 | |
| 21 | ```bash |
| 22 | curl -s -X POST "https://api.anysearch.com/v1/auth/email/register" \ |
| 23 | -H "Content-Type: application/json" \ |
| 24 | -d '{"email": "you@example.com"}' |
| 25 | ``` |
| 26 | |
| 27 | Success response (`code: 0`) returns the account info and a one-time plaintext API key: |
| 28 | |
| 29 | ```json |
| 30 | { |
| 31 | "code": 0, |
| 32 | "message": "success", |
| 33 | "data": { |
| 34 | "username": "you@example.com", |
| 35 | "email": "you@example.com", |
| 36 | "login_url": "https://www.anysearch.com/login", |
| 37 | "api_key": { |
| 38 | "id": "key_xxxxxxxx", |
| 39 | "key": "as_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", |
| 40 | "key_prefix": "as_sk_xxxxxx...", |
| 41 | "name": "default", |
| 42 | "rate_limit": 100, |
| 43 | "quota_limit": 0, |
| 44 | "expires_at": null, |
| 45 | "created_at": "2026-06-23T10:23:00Z" |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | ``` |
| 50 | |
| 51 | On success the agent MUST: |
| 52 | |
| 53 | 1. Put `data.api_key.key` into the MCP server config as the `Authorization: Bearer <key>` value (and/or set `ANYSEARCH_API_KEY`) — it is shown only once (it can also be retrieved later from the dashboard). |
| 54 | 2. Tell the user their username (= email), the `login_url`, and that a **random password has been emailed to that address**. |
| 55 | 3. Relay this note to the user: *A verification email has been sent to your inbox. If you don't see it within a few minutes, please check your spam or junk folder. You may need to mark it as "Not Spam" to ensure future emails arrive correctly.* |
| 56 | |
| 57 | Error handling (always `code: -1` on error; branch on the `message` string): |
| 58 | |
| 59 | | message | what to do | |
| 60 | | --------------------------------- | --------------------------------------------------------------------------------------------------- | |
| 61 | | `Invalid email address.` | ask the user to re-enter the email | |
| 62 | | `email_already_registered` | email is taken — tell the user to sign in at `login_url`; do **not** retry | |
| 63 | | contains `Rate limited` | read retry seconds from message (e.g. `"Rate limited, retry after 300 seconds."`), wait, then retry | |
| 64 | | starts with `Key creation failed.` | account created but key failed — extract the email and URL from the message (`"Key creation failed. Your account <email> was created; sign in at <url>."`) and tell the user to sign in there to create a key manually | |
| 65 | | `Internal server error.` | retry later or fall back to anonymous | |
| 66 | |
| 67 | > The email **must be real and reachable** — the password is delivered there. There is **no verification code** in this flow; the agent only ever asks for an email. |
| 68 | |
| 69 | ### Get an API Key |
| 70 | |
| 71 | Alternatively, visit https://anysearch.com/console/api-keys to create a free API key. |
| 72 | |
| 73 | ### Key Priority |
| 74 | |
| 75 | | Priority | Source | |
| 76 | |----------|--------| |
| 77 | | 1 (highest) | `--api_key` CLI flag / `Authorization` header | |
| 78 | | 2 | Environment variable `ANYSEARCH_API_KEY` | |
| 79 | | 3 | `.env |