Repolode
fatwang2

fatwang2/search2ai

A self-hosted search gateway that gives AI agents unified search, news and page extraction over MCP, HTTP API or a TypeScript library, with provider fallback.

Open-source alternative to:Tavily

Stars
1,285
Forks
195
Open issues
18
Last commit
5 days ago

What is it?

search2ai sits between AI agents or applications and multiple search and page extraction services. You configure the providers you have credentials for, and the gateway returns results in a consistent shape with title, URL, snippet and optional date or content fields.

Each operation (search, news, crawl) has its own ordered provider chain. When a provider is rate limited, times out or fails, the gateway tries the next one and reports the reason in a warnings field, so callers can see which service answered. Results can be cached in memory or in Cloudflare KV.

The project can run as a local MCP server for clients like Claude Desktop or Cursor, as a standalone HTTP service on Node.js, Docker or Cloudflare Workers, as a library imported into a Node process, or as Hono routes mounted in an existing app. An optional chat proxy lets chat clients with a custom OpenAI-compatible base URL use tool calling to search while answering. Compatibility routes accept requests shaped for Exa, Tavily, Search1API, SearXNG and Firecrawl single-page scrape.

Key features

  • 01Unified search, news and page extraction interface across multiple providers
  • 02Automatic provider fallback with reasons recorded in warnings
  • 03Local or remote MCP server, HTTP API, and TypeScript library
  • 04In-memory caching and Cloudflare KV caching
  • 05Compatibility endpoints for Exa, Tavily, Search1API, SearXNG and Firecrawl clients

Use cases

  • Giving Claude Desktop or Cursor web search tools through MCP
  • Supplying search results to an agent or backend service over REST
  • Switching existing Tavily or Exa SDK integrations to a self-hosted gateway
  • Adding web access to a chat client that accepts a custom OpenAI-compatible base URL

Quick start

  1. 1

    Create a .env file with your search provider key

  2. 2

    Start a local HTTP service

    npx -y search2ai serve --host 127.0.0.1
  3. 3

    Search from another terminal

    curl http://localhost:3014/v1/search -H 'Content-Type: application/json' -d '{"query":"hono cloudflare workers","max_results":3}'

Things to know

  • Search requires at least one configured provider, and most providers need an API key.
  • The local CLI and npm package require Node.js 22.18 or newer.
  • Some providers ignore certain filters, such as country, language or date range, without triggering fallback.

In collections

Topics

FAQ

What is search2ai?
A self-hosted search gateway that gives AI agents unified search, news and page extraction over MCP, HTTP API or a TypeScript library, with provider fallback. search2ai sits between AI agents or applications and multiple search and page extraction services. You configure the providers you have credentials for, and the gateway returns results in a consistent shape with title, URL, snippet and optional date or content fields.
Is search2ai free to use? What license does it have?
search2ai is open source under the MIT license. Check the license terms before using it in commercial products.
Is search2ai still maintained?
Actively maintained. The last commit to search2ai was on Nov 2, 2026.
What can I use search2ai for?
Giving Claude Desktop or Cursor web search tools through MCP Supplying search results to an agent or backend service over REST Switching existing Tavily or Exa SDK integrations to a self-hosted gateway Adding web access to a chat client that accepts a custom OpenAI-compatible base URL
How do I install search2ai?
Create a .env file with your search provider key Start a local HTTP service: npx -y search2ai serve --host 127.0.0.1 Search from another terminal: curl http://localhost:3014/v1/search -H 'Content-Type: application/json' -d '{"query":"hono cloudflare workers","max_results":3}'
Where can I get search2ai?
The source code and installation instructions are on GitHub: https://github.com/fatwang2/search2ai

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects