gitmyhub

iflow-search-js

TypeScript ★ 31 updated 13d ago

Official JavaScript SDK and integrations for iFlow Search

Official JavaScript and TypeScript SDK monorepo for iFlow Search, a Chinese web, image, and page-fetch API shaped for AI agents. Ships a core client, LangChain tools, and an MCP server.

TypeScriptpnpmLangChainLangGraphMCPsetup: easycomplexity 3/5

iflow-search-js is the official JavaScript and TypeScript SDK family for iFlow Search, a Chinese search API operated by Hangzhou Xingchen Qianxun Technology that offers web search, image search, and web page fetching. The output is shaped for AI consumption, meaning results come back as structured data that a language model can read directly.

The repository is a pnpm monorepo with four parts. The first is @iflow-ai/search-core, a small framework-agnostic client with no runtime dependencies, intended for backend code or for people writing their own integrations. The second is @iflow-ai/search-langchain, which wraps the core into three LangChain tools called iflow_web_search, iflow_image_search, and iflow_web_fetch. The third is an example LangGraph agent that uses createReactAgent and shows how to wire those tools into an agent loop. The fourth is @iflow-ai/search-mcp, a stdio MCP server that exposes the same three tools to clients like Hermes, Claude Code, and Claude Desktop.

The authors decided not to publish a separate LangGraph package because LangGraph already consumes LangChain tools directly, so the LangChain package is reused for both. The example agent directory is workspace-only and not meant to be installed as a dependency.

Basic use is short. You import createIFlowSearchClient from the core package, pass an apiKey from the IFLOW_API_KEY environment variable along with attribution fields, then call methods like webSearch with a query and a count. Errors come back as a result object with ok false and a code and message rather than as thrown exceptions. The LangChain entry point is createIFlowSearchTools, which returns tools ready to hand to any agent that calls bindTools.

Every outbound request adds IFlow-Source, IFlow-Integration, and IFlow-Integration-Version headers so the operator can see which adapter is calling. The MCP build also forwards IFlow-MCP-Client headers if the host sets IFLOW_MCP_CLIENT and IFLOW_MCP_CLIENT_VERSION. The README is explicit about not committing real API keys, and notes that the unit tests use mocked fetch with fake keys. The whole project is MIT licensed.

Where it fits