Unlocking Efficient Search: A Complete Guide to SearXNG MCP Server
In today’s information age, finding accurate information quickly has become increasingly important. Today I want to introduce a tool that can significantly improve search efficiency—the SearXNG MCP Server. This is a Model Context Protocol server designed specifically for the SearXNG metasearch engine, supporting parallel multi-query searches and offering two different transport protocols.
What is the SearXNG MCP Server?
The SearXNG MCP Server acts as a bridge connecting modern AI tools with powerful search engines. It allows you to execute multiple search queries simultaneously through a simple application interface, dramatically improving information retrieval efficiency.
The most attractive feature of this tool is its parallel processing capability. Imagine you need to search for three related topics: “climate change impacts,” “renewable energy technology,” and “carbon neutrality technology.” Traditional methods require searching each term individually, but with the SearXNG MCP Server, you can perform all these searches simultaneously and get comprehensive results in much less time.
Core Features and Capabilities
Multi-Query Parallel Search
This is the server’s most prominent feature. It can handle multiple search requests concurrently, transforming the traditional linear search process into parallel processing, saving considerable time. For researchers, content creators, or anyone who needs to process large amounts of information, this feature is truly revolutionary.
Dual Transport Protocol Support
The server provides two connection methods: stdio and HTTP. The stdio mode is suitable for direct integration with clients that support the MCP protocol, while the HTTP mode offers more flexible web integration capabilities. This design ensures that both desktop and web applications can easily use the service.
Direct API Integration
Unlike browser automation approaches, this tool communicates directly with SearXNG’s REST API. This means faster response times, more stable connections, and lower resource consumption.
Security Authentication Support
If your SearXNG server has basic authentication protection, this tool fully supports username and password verification, ensuring your search service is both powerful and secure.
Containerized Deployment
With Docker and Docker Compose support, you can easily deploy and manage this search service in any container-friendly environment.
How to Get Started Quickly?
Simple Usage via NPM
Standard Input/Output Mode (Default)
If you want to quickly experience this tool, the simplest way is to use the npx command:
SEARXNG_URL=https://your.searxng.com npx -y searxng-mul-mcp
This approach is suitable for direct integration with clients that support the MCP protocol, such as Claude Desktop.
HTTP Server Mode
If you prefer to use the service through a web interface, you can start HTTP mode:
SEARXNG_URL=https://your.searxng.com npx -y searxng-mul-mcp --transport=http --host=0.0.0.0 --port=3000
After starting, you can access the search service through the specified port.
Environment Variable Configuration
The tool offers flexible configuration through environment variables:
# Required: SearXNG server address
SEARXNG_URL=https://your.searxng.com
# Optional: Basic authentication credentials
USERNAME=your_username
PASSWORD=your_password
# Optional: Transport protocol configuration (can also be set via command line parameters)
TRANSPORT=stdio|http
HOST=0.0.0.0 # Only effective in HTTP mode
PORT=3000 # Only effective in HTTP mode
# Optional: Debug mode
DEBUG=false
Detailed Configuration Guide
Claude Desktop Integration Configuration
If you use Claude Desktop, you can integrate this search tool by modifying the configuration file:
Locate Claude Desktop’s claude_desktop_config.json
file and add the following configuration:
{
"mcpServers": {
"searxng-mul-mcp": {
"command": "npx",
"args": ["-y", "searxng-mul-mcp"],
"env": {
"SEARXNG_URL": "https://your.searxng.com",
"USERNAME": "your_username",
"PASSWORD": "your_password"
}
}
}
}
After this configuration, you can directly use the powerful parallel search functionality within Claude Desktop.
SearXNG Server Setup
To use this MCP server, you need an available SearXNG instance. There are three ways to obtain one:
-
Use a public SearXNG instance (such as https://your.searxng.com
) -
Deploy your own SearXNG server -
Use a private SearXNG instance with basic authentication protection
Basic Authentication Setup
If your SearXNG server requires username and password verification, simply set two environment variables:
export USERNAME=your_username
export PASSWORD=your_password
Transport Protocol Details
Standard Input/Output Transport
This is the default mode for MCP client integration, using standard input/output for communication. It’s suitable for direct client connections, offering high efficiency and low resource usage.
HTTP Transport
HTTP mode provides a complete web service interface, including:
-
StreamableHTTP JSON-RPC interface (protocol version 2025-03-26) -
Health check endpoint /health
-
MCP communication endpoint /mcp
-
Session management and automatic cleanup functionality -
Complete cross-origin request support
This mode is particularly suitable for web-based integrations and modern MCP clients.
Installation Methods Explained
Installation from Source Code
If you want to customize features or participate in development, you can install from source code:
git clone <repository-url>
cd searxng-mul-mcp
npm install
npm run build
npm start
This method requires you to have Node.js 18 or higher pre-installed.
Docker Containerized Deployment
For production environments, Docker deployment is recommended. First create a docker-compose.yml
file:
services:
searxng-mul-mcp:
image: ghcr.io/jae-jae/searxng-mul-mcp:latest
environment:
- SEARXNG_URL=https://your.searxng.com
# Optional: Basic authentication
# - USERNAME=your_username
# - PASSWORD=your_password
ports:
- "3000:3000"
environment:
- TRANSPORT=http
- HOST=0.0.0.0
- PORT=3000
Then use the following command to start the service:
docker-compose up -d
Tool Usage Guide
The server provides a powerful search
tool that accepts the following parameters:
Search Parameters Explained
-
queries (required): Array of search query strings to execute in parallel -
engines (optional): Specific search engines to use (e.g., “google”, “bing”, “duckduckgo”) -
categories (optional): Search categories to filter results (e.g., “general”, “images”, “news”) -
safesearch (optional): Safe search level (0=off, 1=moderate, 2=strict) -
language (optional): Search language code (e.g., “en”, “zh”, “es”)
Through flexible combination of these parameters, you can precisely control search behavior to obtain the most relevant results.
Development Guide
Development Environment Requirements
-
Node.js 18 or higher -
npm or yarn package manager -
TypeScript compiler
Common Development Commands
# Install dependencies
npm install
# Compile TypeScript
npm run build
# Start development server
npm run dev
# Run in production
npm start
# Clean build directory
npm run clean
# Run tests
npm test
# Code linting
npm run lint
# Code formatting
npm run format
Project Structure Analysis
Understanding the project structure helps in better using and customizing this tool:
searxng-mul-mcp/
├── src/
│ ├── index.ts # Application entry point
│ ├── server.ts # MCP server core logic
│ ├── config/
│ │ └── index.ts # Configuration management
│ ├── tools/
│ │ ├── index.ts # Tool definitions
│ │ └── searxng.ts # SearXNG search tool implementation
│ ├── transports/
│ │ ├── index.ts # Transport factory
│ │ ├── stdio.ts # Stdio transport implementation
│ │ ├── http.ts # HTTP transport implementation
│ │ └── types.ts # Transport type definitions
│ ├── services/
│ │ └── searxng-api.ts # SearXNG API client
│ └── utils/
│ └── logger.ts # Logging utilities
├── build/ # TypeScript compilation output
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── Dockerfile # Docker image build
├── docker-compose.yml # Docker Compose configuration
└── README.md # Documentation
API Integration Details
SearXNG API Integration
This server features deep integration with the SearXNG search API. SearXNG is an open-source metasearch engine that aggregates results from multiple search engines, providing a more comprehensive and anonymous search experience.
By directly integrating with the SearXNG API, this tool can provide more efficient and stable search services compared to traditional browser automation methods. If you want to learn more about SearXNG API capabilities, you can refer to the official documentation: https://docs.searxng.org/dev/search_api.html
Error Handling Mechanism
The server implements comprehensive error handling strategies:
-
Network errors: Automatic retry mechanism (up to 3 attempts) -
Authentication errors: Clear authentication failure error messages -
API rate limiting: Graceful degradation and error reporting -
Timeout handling: Configurable request timeout (default: 30 seconds)
These mechanisms ensure service stability and reliability under various exceptional conditions.
System Monitoring and Maintenance
Health Checks
In HTTP mode, the server provides a health check endpoint:
curl http://localhost:3000/health
You will receive a response similar to this:
{
"status": "healthy",
"timestamp": "2024-01-01T00:00:00.000Z",
"version": "1.0.0"
}
This endpoint is very useful for automated monitoring and operations.
Logging System
The server provides structured logging with configurable log levels:
-
ERROR: Critical errors and failure information -
WARN: Warning messages and functionality degradation notifications -
INFO: General operational information -
DEBUG: Detailed debugging information (enabled with DEBUG=true
)
Proper log configuration can help you better monitor system status and troubleshoot issues.
Frequently Asked Questions
What to do if connection fails?
First check if your SEARXNG_URL
setting is correct and if the network connection is normal. Ensure your SearXNG server is running and accessible.
How to resolve authentication errors?
If you encounter authentication errors, confirm that your set USERNAME
and PASSWORD
environment variables are correct. These credentials need to match your SearXNG server configuration.
How to handle occupied ports?
In HTTP mode, if the default port 3000 is already used by another program, you can modify the PORT
environment variable to use other available ports.
How to adjust search timeout?
If search requests frequently time out, you can check your SearXNG server’s performance status, or consider increasing the request timeout limit.
What does debug mode do?
Enabling debug mode provides more detailed operational information to help diagnose complex issues:
DEBUG=true npx searxng-mul-mcp
Open Source License
This project is released under the MIT license, a very permissive open source license that allows you to freely use, modify, and distribute this software, whether for personal or commercial projects.
How to Contribute?
If you’re interested in this project, you’re welcome to contribute:
-
Fork this project to your account -
Create a feature branch -
Make your modifications and improvements -
Add appropriate test cases if applicable -
Submit a pull request
Community contributions are vital for open source project development—every improvement you make could help more people.
Getting Support
If you encounter problems during use:
-
First check the troubleshooting section in this article -
Refer to the official SearXNG documentation -
Submit an issue report on GitHub
Through this comprehensive guide, you should now have a deep understanding of the SearXNG MCP Server. This tool provides a powerful solution for modern information retrieval needs through parallel search capabilities and flexible integration options. Whether you’re a researcher, developer, or content creator, this tool can significantly enhance your work efficiency.
Remember, in the information age, the ability to efficiently obtain and process information is a key factor for success. The SearXNG MCP Server is designed specifically to enhance this capability. Start trying it now and experience the efficiency improvements brought by parallel search!