FS

fatwang2/search2ai

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

1285 stars 193 forks 质量 87 趋势 67MIT

自办AI代理搜索网关. 统一搜索,新闻和页面提取与提供者倒置. REST API,MCP服务器和TypeScript库.

概览

连接您配置的搜索和页面提取服务 。 当一个提供者受费率限制、 时间中断或失败时, 网关会按您所配置的顺序尝试下一个网关, 并报告哪些服务被回答, 以及为什么其他人失败 。 搜索端点返回结构化结果和页面内容供您的代理或应用程序使用。 一个可选的还允许支持在回答时调用网络搜索的工具的模型. -:标题,url,片段,以及日期和内容等可选字段. - 搜索、新闻和爬行,取决于配置的提供者。 - :根据需要提供服务URL或证书;未配置的提供者永远不会自动启用. - :每次操作分开的链子,内膜活塞和Cloudflare KV活塞活塞. - 本地MCP,一个独立的HTTP服务,直接的图书馆电话,以及可挂载的Hono路线。 -:被支持的Exa,Tavily,Search1API,SearXNG和Firecrawl单页呼叫可以使用专用的HTTP API / SDK相容端点.

概述(AI 翻译)

** 联合国**

寻找2ai

** 为AI代理商和AI客户端自备的搜索网关。 **

通过MCP、HTTP API或JavaScript / TypeScript 库 连接您配置的搜索和页面提取服务。 当一个提供者受费率限制、 时间中断或失败时, 网关会按您所配置的顺序尝试下一个网关, 并报告哪些服务被回答, 以及为什么其他人失败 。

搜索端点返回结构化结果和页面内容供您的代理或应用程序使用。 一个可选的聊天代理还允许支持在回答时调用网络搜索的工具的模型.

  • ** 一致结果**:[[T0]、[T1]、[[T2],以及[T3]和[[T4]等可选字段。
  • 搜索、新闻和页面内容:[[T5]、[T6]和[T7],取决于配置的提供者。
  • ** 您选择的提供者**: 需要时提供服务 URL或证书; 未配置的提供者永远不会自动启用 。
  • ** Fallback and caching**:每次操作时分开的链子,内膜活塞和Cloudflare KV活塞活塞.
  • 灵活整合:当地MCP、独立的HTTP服务、直接图书馆电话和可挂载的Hono路线.

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

English · 简体中文

search2ai

A self-hosted search gateway for AI agents and AI clients.

Connect the search and page extraction services you configure through MCP, an HTTP API, or a JavaScript / TypeScript library. When a provider is rate limited, times out, or fails, the gateway tries the next one in your configured order and reports which service answered and why others failed.

Search endpoints return structured results and page content for your agent or application to use. An optional chat proxy also lets models that support tool calling search the web while answering.

  • Consistent results: title, url, snippet, and optional fields such as date and content.
  • Search, news, and page content: search, news, and crawl, depending on the configured providers.
  • Your choice of providers: supply service URLs or credentials as needed; unconfigured providers are never enabled automatically.
  • Fallback and caching: separate chains per operation, in-memory caching, and Cloudflare KV caching.
  • Flexible integration: local MCP, a standalone HTTP service, direct library calls, and mountable Hono routes.
  • Existing API clients: supported Exa, Tavily, Search1API, SearXNG and Firecrawl single-page calls can use dedicated HTTP API / SDK compatibility endpoints.

Looking for hosted search? Search1API is this project’s companion hosted service for search, news, and page extraction. Use its API directly or configure it as a search2ai provider. It also offers hosted compatible APIs to help existing integrations switch with minimal changes. The examples below use Search1API; you can choose any other supported provider.

Website · Quick start · Choose an integration · Providers and configuration · HTTP API · API / SDK compatibility · Deployment · Chat proxy · Upgrading · Development and contributing

Quick start

The local CLI and npm package require Node.js ≥ 22.18. Configure at least one provider that supports the operation you need. In the current version, search requests return 503 when no search provider is configured.

Create .env in your working directory with your search provider key:

SEARCH1API_KEY=your_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}'
在 GitHub 查看完整 README

安装

npx -y search2ai mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "search2ai": { "command": "npx", "args": ["-y", "search2ai", "mcp"], "env": { "SEARCH1API_KEY": "your_provider_key" } } } }