web-search-mcp is a locally hosted Web search MCP server designed to provide web search and content extraction capabilities for locally running large language models (LLMs). It is written in TypeScript, implements search functionality by connecting directly to search engines (no API keys required), and provides three dedicated tools to meet the needs of different scenarios.
Purpose
This server is mainly used to enhance the online search capabilities of local LLMs, enabling them to obtain real-time web page information. It is suitable for scenarios that require local models to access internet content, for example, providing search tools for models in clients such as LM Studio or LibreChat.
Main Capabilities
- Multi-engine search: Prioritizes Bing, then Brave, and finally DuckDuckGo, to improve reliability and performance.
- Full page content extraction: Retrieves and extracts the full web page content from search results.
- Three dedicated tools:
full-web-search: Performs a comprehensive search and extracts the full content of each result page, with support for concurrent processing.get-web-search-summaries: Returns only the summaries/descriptions of search results without extracting full content, suitable for quick searches.get-single-web-page-content: Extracts the main content of the web page at the specified URL, removing non-content elements such as navigation and advertisements.
- Intelligent request strategy: Automatically switches between the Playwright browser and fast axios requests to ensure results are returned.
- Concurrent processing: Extracts content from multiple pages simultaneously, with timeout protection.
- HTTP/2 error recovery: Automatically falls back to HTTP/1.1 when protocol errors are encountered.
- Browser isolation and automatic cleanup: Each search engine uses an independent browser instance, and automatic cleanup after operations prevents memory leaks.
Usage
Installation
- Ensure that Node.js 18.0.0 or later and npm 8.0.0 or later are installed.
- Download the latest release package from the Releases page and extract it.
- Run the following command in the extracted directory:
Note:npm install npx playwright install npm run buildnpm installmust be run in the root directory of the extracted directory, not in thedist/directory. - Configure
mcp.jsonto point to the generateddist/index.jsfile. For example:- macOS/Linux:
~/mcp-servers/web-search-mcp/dist/index.js - Windows:
C:\\mcp-servers\\web-search-mcp\\dist\\index.js
- macOS/Linux:
- In LibreChat, you can add the MCP server configuration to
librechat.yaml. If LibreChat is run using Docker, you need to first mount the local directory indocker-compose.override.yml.
Environment Variables
The server supports configuration through the following environment variables:
MAX_CONTENT_LENGTH: Maximum content length (number of characters), default 500000.DEFAULT_TIMEOUT: Default request timeout in milliseconds, default 6000.MAX_BROWSERS: Maximum number of browser instances, default 3.BROWSER_TYPES: List of browser types to use, comma-separated, default 'chromium,firefox', options are chromium, firefox, webkit.BROWSER_FALLBACK_THRESHOLD: Number of axios failures before falling back to the browser, default 3.ENABLE_RELEVANCE_CHECKING: Whether to enable search result quality validation, default true.RELEVANCE_THRESHOLD: Minimum quality score for search results (0.0-1.0), default 0.3.FORCE_MULTI_ENGINE_SEARCH: Whether to try all search engines and return the best result, default false.DEBUG_BROWSER_LIFECYCLE: Whether to enable detailed browser lifecycle logs, default false.
Model Compatibility
It is recommended to use newer models that support tool calling. According to the project documentation, Qwen3 and Gemma 3 work best, Llama 3.2 and newer Llama 3.1 are usable, some Llama and Deepseek R1 versions may have issues, and older versions may not work.
Use Cases
- When a local LLM needs to search the internet.
- When complete web page content needs to be extracted from search results for analysis.
- When search summaries need to be obtained quickly without extracting full text.
- When specific web page content needs to be extracted.
Limitations
- This project has been tested in LM Studio and LibreChat, and has not been tested in other MCP clients.
- Model compatibility is limited, and older models may not work properly.
- Search relies on browser automation, and some network environments may block browser automation, requiring network adjustments or the use of a VPN.
- Content length limits may cause abnormal behavior, which can be adjusted via
MAX_CONTENT_LENGTH. - Response speed may be affected by network and browser performance, and can be optimized by adjusting timeouts and the number of browsers.