search2ai MCP
Self-hosted web search gateway for agents: MCP server, HTTP API and library with fallback across Tavily, Brave, Exa, SearXNG
- 1,288 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The agent sends queries and page URLs to third-party services and reads pages from the network
- Provider keys sit in the client `env` or `.env`, and an HTTP service without `AUTH_KEYS` is open to anyone who can reach the port
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add mcp/search2aiDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The agent sends queries and page URLs to third-party services and reads pages from the network
- Provider keys sit in the client `env` or `.env`, and an HTTP service without `AUTH_KEYS` is open to anyone who can reach the port
This is third-party code. Review the repository files before installing.
What it does
search2ai gives an agent three operations: `search`, `news` and `crawl` (page reading). Behind them sit search services you connect yourself: Search1API, Tavily, Brave, Exa, Serper, SerpAPI, Google, SearXNG, Jina and Firecrawl. Every answer has the same shape: title, URL, snippet and optional fields such as date and content. No provider is switched on automatically; you list only the ones you want. When a provider hits a rate limit, times out or fails, the gateway tries the next one in your chain and reports which service answered and why the others failed. Chains are set separately for search, news and page reading, and there is an in-memory cache and a Cloudflare KV cache. There are three ways to connect. A local MCP server runs with `npx -y search2ai mcp` over stdio. The HTTP service `npx -y search2ai serve` listens on port 3014 and serves `/v1/search`, `/v1/news`, `/v1/crawl` and a remote MCP at `/mcp`. The TypeScript library `search2ai` runs inside your own process. An optional chat proxy also adds web search to models that support tool calling.
Who it is for. For developers who want to give Cursor, Claude Desktop or their own app search with fallback providers so they do not depend on one service.
Good fit when
- Your agent searches through one provider and its limits or outages keep breaking tasks
- You want one response format for search, news and page reading across several services
- You run your own SearXNG and want it first in the chain with paid services as backup
- Your app already speaks the Exa, Tavily, Search1API, SearXNG or Firecrawl API and you want to move it to a gateway with minimal changes
Not a fit when
- You want search that works without your own keys: the gateway does not search itself, and a search request with no provider returns a 503 error
- Your environment cannot run Node.js 22.18 or newer, which the package requires
- You need strict country, language, domain and date filters on every request: not every provider supports them, and keyless Parallel returns an `unsupported` warning
- One official search vendor MCP server covers the job and you do not need fallback providers
Example request
Use search2ai to find recent news about the Hono release and read the first page in fullMCP
- Transport
- stdio, http
- Authentication
- API key
Environment variables
SEARCH1API_KEYrequired, secret- Search1API key. A key for at least one provider is required; you can use another provider's instead.
TAVILY_KEYsecret- Tavily key for search, news and page reading.
BRAVE_KEYsecret- Brave key for search and news.
SEARXNG_BASE_URL- URL of your SearXNG instance with JSON output enabled.
AUTH_KEYSsecret- Access keys for the HTTP service; clients send them in an `Authorization: Bearer` header.
Limitations
- Needs Node.js 22.18 or newer and a key for at least one provider that supports the operation.
- Capabilities depend on the provider: Brave, Serper and SerpAPI do not read pages, Google news is regular search sorted by date, and Jina and Parallel are enabled only explicitly.
- Queries and page contents go to the third-party services you choose.
- With `AUTH_KEYS` set, the HTTP service requires an `Authorization: Bearer` header. Without that variable the service is open, so restrict the port yourself.
- The same author runs the paid Search1API service alongside the project, and the setup examples use it.
How to disable. Remove the `search2ai` entry from `mcpServers` in your client config. Stop the HTTP service (Ctrl+C or stopping the container); the npm package can be removed with `npm rm search2ai`.
FAQ
How do I connect search2ai to Cursor or Claude Desktop?
Add a server under `mcpServers` with command `npx` and args `-y search2ai mcp`, and put a provider key in `env`. The client starts the gateway locally and gets the `search`, `news` and `crawl` tools over stdio.
Which search services does search2ai support?
Search1API, Tavily, Brave, Exa, Serper, SerpAPI, Google, SearXNG, Jina and Firecrawl, plus keyless Parallel if you name it in a chain. Providers are never enabled automatically.
What happens when a provider is down or rate limited?
The gateway tries the next provider in that operation's chain and reports in the response who answered and why the others failed.
Do I need a model API key?
No, the gateway only calls search services. A model key is needed only by the optional chat proxy, which calls your model.
How is search2ai different from a single vendor's MCP server?
An official server talks to one service. search2ai combines several under one response format and switches between them on failure.
Discussion
No questions or reviews yet.
Related
MCP serversA unified search MCP server: one interface to Tavily, Brave, Kagi, Exa, Linkup, Firecrawl and GitHub search
Local web search for agents: searches, reads pages and returns compact passages with sources, saving context tokens
SearXNG AI Kit gives agents web search across 180+ engines through a CLI and an MCP server, with no search API key
The official Search1API MCP: web search, news, page crawling, sitemaps and trends with OAuth sign-in or an API key.
MCP server for web search and crawling: SearXNG and You.com plus clean Markdown from pages, sites and logged-in areas
Agent Search MCP searches in English and Chinese with no API key, returns multi-source evidence and records provider failures.
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| search2ai (this card) | no | API key | 1,288 | |
| Tavily MCP Server | yes | API key | 2,488 | an official server for one service, while this one chains several providers with fallback |
| SearXNG MCP Server | no | not required | 1,358 | search through your SearXNG only, with no paid fallback services |
| Brave Search MCP Server | yes | API key | 1,577 | Brave's official server for a single search engine |
README in short
The README starts with a quick start: a `.env` file with a key, running the HTTP service and a `curl` example. It then covers connection options for clients, apps and chat interfaces, a provider table with capabilities and variables, the gateway API and compatibility endpoints for Exa, Tavily, Search1API, SearXNG and Firecrawl clients. Deployment, the chat proxy and upgrading close the page.