hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Connects to SearxNG instances to provide privacy-focused web search capabilities with configurable parameters like result count, language, and format
SearxNG MCP Server
A Model Context Protocol (MCP) server that provides web search capabilities using SearxNG, allowing AI assistants like Claude to search the web.
Created by AI with human supervision - because sometimes even artificial intelligence needs someone to tell it when to take a coffee break! 🤖☕
Overview
This project implements an MCP server that connects to SearxNG, a privacy-respecting metasearch engine. The server provides a simple and efficient way for Large Language Models to search the web without tracking users.
The server is specifically designed for LLMs and includes only essential features to minimize context window usage. This streamlined approach ensures efficient communication between LLMs and the search engine, preserving valuable context space for more important information.
Features
- Privacy-focused web search through SearxNG
- Simple API for LLM integration
- Compatible with Claude Desktop and other MCP-compliant clients
- Configurable search parameters
- Clean, formatted search results optimized for LLMs
Integration with MCP-Compatible Applications
Integration Examples
Using pipx run (Recommended, no installation required)
Create a .clauderc
file in your home directory:
Using uvx run (No installation required)
Using Python with pip (requires installation)
Using with Docker (No installation required)
Note: When using Docker with MCP servers:
- Environment variables must be passed directly using the
-e
flag in theargs
array, as theenv
object is not properly passed to the Docker container. - If you need to access a SearxNG instance running on localhost (e.g., http://localhost:8080), you must use the
--network=host
flag to allow the container to access the host's network. Otherwise, "localhost" inside the container will refer to the container itself, not your host machine. - When using
--network=host
, port mappings (-p
) are not needed and will be ignored, as the container shares the host's network stack directly.
Configuration
Configure the server using environment variables:
Environment Variable | Description | Default Value |
---|---|---|
SEARXNG_MCP_SEARXNG_URL | URL of the SearxNG instance to use | https://paulgo.io/ |
SEARXNG_MCP_TIMEOUT | HTTP request timeout in seconds | 10 |
SEARXNG_MCP_DEFAULT_RESULT_COUNT | Default number of results to return | 10 |
SEARXNG_MCP_DEFAULT_LANGUAGE | Language code for results (e.g., 'en', 'ru', 'all') | all |
SEARXNG_MCP_DEFAULT_FORMAT | Default format for results ('text', 'json') | text |
SEARXNG_MCP_LOG_LEVEL | Logging level (e.g., 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL') | ERROR |
TRANSPORT_PROTOCOL | Transport protocol ('stdio' or 'sse') | stdio |
Note: Setting log levels higher than ERROR (such as DEBUG or INFO) may break integration with some applications due to excessive output in the communication channel.
You can find a list of public SearxNG instances at https://searx.space if you don't want to host your own.
Installation & Usage
Prerequisites
- Python 3.10 or higher
- A SearxNG instance (public or self-hosted)
Option 1: Run Without Installation (Recommended)
The easiest way to use this server is with pipx or uvx, which allows you to run the package without installing it permanently:
You can pass configuration options directly:
Option 2: Install from PyPI or Source
For more permanent installation:
After installation, you can run the server with:
Option 3: Docker
If you prefer using Docker:
For complete Docker usage information, see the Docker Configuration section below.
Transport Protocols
The MCP server supports two transport protocols:
- STDIO (default): For CLI applications and direct integration
- Used by default in all examples
- Suitable for integration with Claude Desktop and other MCP-compliant clients
- No HTTP server is started
- SSE (Server-Sent Events): For web-based clients and HTTP-based integrations
- Starts an HTTP server that clients can connect to
- Useful for web applications and services that need real-time updates
- Requires port mapping when using Docker
Using SSE Transport
To use the SSE transport protocol:
- With direct execution:Copy
- With Docker:Copy
- With Docker Compose (from the included
docker-compose.yml
):Copy
When using SSE, the server will be accessible via HTTP at http://localhost:8000
by default.
To connect to the SSE server from an MCP client, use a configuration like:
Note: Not all applications support the SSE transport protocol. Make sure your MCP client is compatible with SSE before using this transport method.
Development
For development and testing:
Publishing to PyPI
For maintainers who need to publish new versions of the package to PyPI:
These commands will:
- Update the version in both package.json and pyproject.toml
- Clean the dist directory to remove old builds
- Build the package (creating wheel and source distribution)
- Check the package for errors
- Upload the package to PyPI
You'll need to have a PyPI account and be authenticated with twine. You can set up authentication by:
- Creating a
.pypirc
file in your home directory - Using environment variables (
TWINE_USERNAME
andTWINE_PASSWORD
) - Using PyPI API tokens (recommended)
Docker Configuration
When using Docker with MCP servers, keep these points in mind:
- Integration with MCP clients: Use the configuration shown in the Using with Docker section for integrating with Claude Desktop or other MCP-compliant clients.
- Transport protocols:
- By default, the Docker container uses the stdio transport protocol
- For SSE transport, see the Using SSE Transport section
- Configuration options:
- Use an environment file (.env) to configure the server:
docker run --env-file .env ...
- Pass individual environment variables with the
-e
flag:docker run -e SEARXNG_MCP_SEARXNG_URL=https://example.com ...
- See the Configuration section for available environment variables
- Use an environment file (.env) to configure the server:
- Networking:
- Use
--network=host
when you need to access services on your host machine - Use
-p 8000:8000
when exposing the SSE server to your network
- Use
Package Structure
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
You must be authenticated.
Tools
Provides web search capabilities using SearxNG, allowing AI assistants like Claude to search the web with a privacy-respecting metasearch engine.
- Overview
- Integration with MCP-Compatible Applications
- Configuration
- Installation & Usage
- Transport Protocols
- Development
- Publishing to PyPI
- Docker Configuration
- Package Structure
- Contributing
- License