# search2ai [Health: Active]

**Category:** 🔎 Search & Data Extraction  
**Repository:** https://github.com/fatwang2/search2ai  
**GitHub Stars:** 1291  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/search2ai

## Description
Self-hosted search gateway for AI agents. Unified search, news and page extraction with provider fallback. REST API, MCP server and TypeScript library.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "search2ai": {
    "command": "npx",
    "args": ["-y","search2ai"],
    "env": {
      "SEARCH1API_KEY": "",
      "TAVILY_KEY": "",
      "BRAVE_KEY": "",
      "EXA_KEY": "",
      "SERPER_KEY": "",
      "SERPAPI_KEY": "",
      "SEARXNG_BASE_URL": "",
      "AUTH_KEYS": ""
    }
  }
}
```

**Requires environment variables:** `SEARCH1API_KEY`, `TAVILY_KEY`, `BRAVE_KEY`, `EXA_KEY`, `SERPER_KEY`, `SERPAPI_KEY`, `SEARXNG_BASE_URL`, `AUTH_KEYS` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What search2ai MCP server does

search2ai connects AI clients and applications to configured search, news, and page-extraction providers. Through MCP, it presents the gateway's unified tools rather than exposing each provider's individual API shape. Results use common fields such as titles, URLs, snippets, and optional dates or page content.

The server supports local MCP over stdio and remote MCP through an HTTP service. The same deployment can expose REST endpoints for applications and MCP for AI clients. A JavaScript or TypeScript library is also available when embedding the gateway directly in an application is more suitable than running a separate process.

An optional chat proxy can provide web access to chat clients with custom API base URLs. In that mode, search2ai calls the configured model upstream while using its provider configuration for web access.

## How it works

Configure one or more providers and assign them to the operations they support. Search, news, and crawl requests can use separate fallback chains. When a provider is rate limited, times out, or fails, the gateway tries the next configured provider and reports the responding service along with warnings about earlier failures.

The local CLI reads `.env.local` and `.env` from its working directory, with existing process environment variables taking precedence. Library entry points do not load environment files; the host application supplies configuration directly or passes an environment object to the provided configuration helpers.

Caching can be handled in memory or through Cloudflare KV. Providers are opt-in: unconfigured services are not enabled automatically. A request needs a provider that supports its operation; for example, search requires a configured search provider, while crawl requires a page-extraction provider.

## Setup and configuration

The local CLI and npm package require Node.js 22.18 or newer. Install or invoke the package with npm, then configure at least one provider. A basic local service can be started with:

```bash
npx -y search2ai serve --host 127.0.0.1
```

For an MCP client using an `mcpServers` configuration, run `npx -y search2ai mcp` with the provider credentials in the client environment. A deployed HTTP service exposes MCP at `/mcp`; clients supporting Streamable HTTP can connect to that endpoint. If `AUTH_KEYS` is configured, remote clients send the gateway key as a bearer token.

Supported providers include Search1API, Tavily, Brave, Exa, Serper, SerpAPI, Google, SearXNG, Outcrawl, Cloro, Autom, Keenable, Specstream, Sofya, Jina, Firecrawl, and Parallel. Their capabilities vary across search, news, and page extraction. Parallel and Jina require explicit opt-in for the relevant operation, and SearXNG requires JSON output to be enabled.

## Tools and capabilities

The MCP interface provides three gateway operations:

- `search` retrieves structured web search results.
- `news` retrieves news-oriented results where the selected provider supports the operation.
- `crawl` extracts content from a page URL where a configured provider supports page extraction.

The gateway uses consistent request and response parameters across backends. Applications can use equivalent REST routes at `/v1/search`, `/v1/news`, and `/v1/crawl`, or call `createGateway()` from the TypeScript library. Hono applications can mount the routes and MCP endpoint under an application-defined path.

## Limitations and notes

Provider capabilities are not interchangeable. Some providers support only search, while others support search and news but not page extraction. Google news requests use regular search with date sorting rather than a dedicated news endpoint.

A deployment with no configured search provider returns HTTP 503 for search requests. Provider credentials, service URLs, and fallback order must be configured explicitly. The library does not load `.env` files on its own, and remote MCP authentication applies only when `AUTH_KEYS` is configured.

Compatibility endpoints exist for selected Exa, Tavily, Search1API, SearXNG, and Firecrawl single-page API or SDK integrations. MCP clients use the unified gateway tools directly instead of those provider-specific compatibility routes.

_Full upstream README: https://allmcps.com/mcp/search2ai/readme_

