Navigation
SearXNG MCP Server: Secure Privacy-Powered AI Search - MCP Implementation

SearXNG MCP Server: Secure Privacy-Powered AI Search

Empower AI assistants with secure, privacy-first web searches via SearXNG MCP Server – accurate results without compromising user data." )

Research And Data
4.3(92 reviews)
138 saves
64 comments

Users create an average of 16 projects per month with this tool

About SearXNG MCP Server

What is SearXNG MCP Server: Secure Privacy-Powered AI Search?

SearXNG MCP Server is a privacy-focused middleware solution enabling secure integration of AI-driven web search capabilities into applications. Built atop the SearXNG metasearch engine, it provides a customizable API layer with robust privacy controls, allowing developers to embed contextual search functionality while maintaining user data confidentiality. The server acts as an intermediary, aggregating results from multiple search engines while enforcing strict security protocols to protect query data.

Key Features of SearXNG MCP Server

Core features include granular search parameter control through configurable APIs, support for 140+ search engines, category-specific filtering (general/web/images/news), and adaptive privacy settings (safesearch levels 0-2). The server offers programmatic access to time-bound results (day/week/month/year), language localization (ISO 639-1 codes), and result pagination. Advanced customization options allow developers to specify preferred engines, restrict content categories, and limit result quantities between 1-50 entries per request.

SearXNG MCP Server Features

How to Use SearXNG MCP Server

Deployment involves three core steps: 1) Server setup with Node.js dependencies 2) Configuration of engine preferences and privacy policies via environment variables 3) Integration using RESTful APIs or SDKs in supported programming languages. Developers can customize behavior through parameters like query modifiers, result sorting preferences, and content safety thresholds. The server supports concurrent request handling with automatic load balancing across configured search engines.

Use Cases of SearXNG MCP Server

Common applications include:

  • Context-aware chatbots needing real-time information verification
  • Enterprise knowledge bases requiring cross-engine content aggregation
  • Academic platforms needing time-filtered research material sourcing
  • Content moderation systems using category blocking features
  • IoT devices needing lightweight search interface with minimal data exposure

SearXNG MCP Server FAQ

FAQ from SearXNG MCP Server

Q: How does privacy protection work?
All search queries are anonymized through server-side proxy routing, with optional TLS encryption for data in transit. Query logs can be configured for automatic purging after 72 hours.

Q: Can I prioritize specific search engines?
Yes, via the SE_ENGINES_PREFERENCE config parameter that defines weighted search engine rankings in JSON format.

Q: What languages are supported?
Language support mirrors underlying engines, with primary interface languages covering all ISO 639-1 codes through automatic translation APIs.

Q: How is performance scaled?
Built-in load balancer distributes requests across configured engines, with automatic failover to secondary sources if primary services become unavailable.

Q: Are there rate limits?
Adjustable via MAX_REQUESTS_PER_MINUTE parameter, with optional API key authentication for enterprise-grade throttling.

Content

SearXNG MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to perform web searches using SearXNG, a privacy-respecting metasearch engine.

Features

  • Perform web searches with customizable parameters
  • Support for multiple search engines
  • Privacy-focused search results
  • Optional basic authentication for SearXNG instances
  • Markdown-formatted search results
  • Sensible default values for all parameters

Installation

Prerequisites

  • Node.js (v16 or higher)
  • npm (v7 or higher)
  • Access to a SearXNG instance (self-hosted or public)

Install from source

# Clone the repository
git clone https://github.com/tisDDM/searxng-mcp.git
cd searxng-mcp

# Install dependencies
npm install

# Build the project
npm run build

Configuration

The SearXNG MCP server can be configured with the following environment variables:

  • SEARXNG_URL (optional): The URL of your SearXNG instance (e.g., https://searx.example.com). If not provided, a random public instance will be selected.
  • USE_RANDOM_INSTANCE (optional): Set to "false" to disable random instance selection when no URL is provided. Default is "true".
  • SEARXNG_USERNAME (optional): Username for basic authentication
  • SEARXNG_PASSWORD (optional): Password for basic authentication

You can set these environment variables in a .env file in the root directory of the project:

SEARXNG_URL=https://searx.example.com
SEARXNG_USERNAME=your_username
SEARXNG_PASSWORD=your_password

Usage

Running the server

# If installed globally
searxngmcp

# If installed from source
node build/index.js

Integrating with Claude Desktop

  1. Open Claude Desktop

  2. Go to Settings > MCP Servers

  3. Add a new MCP server with the following configuration:

    {
    "mcpServers": {
    "searxngmcp": {
    "command": "searxngmcp",
    "env": {
    "SEARXNG_URL": "https://searx.example.com",
    "SEARXNG_USERNAME": "your_username",
    "SEARXNG_PASSWORD": "your_password"
    },
    "disabled": false,
    "autoApprove": []
    }
    }

}

Integrating with Claude in VSCode

  1. Open VSCode

  2. Go to Settings > Extensions > Claude > MCP Settings

  3. Add a new MCP server with the following configuration:

    {
    "mcpServers": {
    "searxngmcp": {
    "command": "node",
    "args": ["/path/to/searxng-mcp/build/index.js"],
    "env": {
    "SEARXNG_URL": "https://searx.example.com",
    "SEARXNG_USERNAME": "your_username",
    "SEARXNG_PASSWORD": "your_password"
    },
    "disabled": false,
    "autoApprove": []
    }
    }

}

Usage with Smolagents

SearXNG MCP can be easily integrated with Smolagents, a lightweight framework for building AI agents. This allows you to create powerful research agents that can search the web and process the results:

from smolagents import CodeAgent, LiteLLMModel, ToolCollection
from mcp import StdioServerParameters

# Configure the SearXNG MCP server
server_parameters = StdioServerParameters(
    command="node",
    args=["path/to/searxng-mcp/build/index.js"],
    env={
        "SEARXNG_URL": "https://your-searxng-instance.com",
        "SEARXNG_USERNAME": "your_username",  # Optional
        "SEARXNG_PASSWORD": "your_password"   # Optional
    }
)

# Create a tool collection from the MCP server
with ToolCollection.from_mcp(server_parameters) as tool_collection:
    # Initialize your LLM model
    model = LiteLLMModel(
        model_id="your-model-id",
        api_key="your-api-key",
        temperature=0.7
    )
    
    # Create an agent with the search tools
    search_agent = CodeAgent(
        name="search_agent",
        tools=tool_collection.tools,
        model=model
    )
    
    # Run the agent with a search prompt
    result = search_agent.run(
        "Perform a search about: 'climate change solutions' and summarize the top 5 results."
    )
    
    print(result)

Available Tools

searxngsearch

Perform web searches using SearXNG, a privacy-respecting metasearch engine. Returns relevant web content with customizable parameters.

Parameters

Parameter Type Description Default Required
query string Search query - Yes
language string Language code for search results (e.g., 'en', 'de', 'fr') 'en' No
time_range string Time range for search results. Options: 'day', 'week', 'month', 'year' null No
categories array of strings Categories to search in (e.g., 'general', 'images', 'news') null No
engines array of strings Specific search engines to use null No
safesearch number Safe search level: 0 (off), 1 (moderate), 2 (strict) 1 No
pageno number Page number for results. Must be minimum 1 1 No
max_results number Maximum number of search results to return. Range: 1-50 10 No

Example

// Example request
const result = await client.callTool('searxngsearch', {
  query: 'climate change solutions',
  language: 'en',
  time_range: 'year',
  categories: ['general', 'news'],
  safesearch: 1,
  max_results: 5
});

Development

Setup

# Clone the repository
git clone https://github.com/tisDDM/searxng-mcp.git
cd searxng-mcp

# Install dependencies
npm install

Build

npm run build

Watch mode (for development)

npm run watch

Testing with MCP Inspector

npm run inspector

License

MIT

Related MCP Servers & Clients