SearXNG MCP server

Connects AI systems to SearXNG metasearch engine, enabling privacy-respecting web searches with customizable parameters for language, time range, and category filtering.
Back to servers
Setup instructions
Provider
tisDDM
Release date
Mar 24, 2025
Language
TypeScript
Stats
17 stars

The SearXNG MCP server enables AI assistants to perform web searches using SearXNG, a privacy-respecting metasearch engine. It works immediately with zero configuration by automatically selecting random public instances from SearX.space, while also supporting private instances with authentication.

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 these environment variables:

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

You can set these in a .env file in the root directory:

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 this 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 this 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 integrated with Smolagents to create research agents:

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 with customizable parameters.

Parameters

Parameter Type Description Default Required
query string Search query - Yes
language string Language code for results (e.g., 'en', 'de', 'fr') 'en' No
time_range string Time range for 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
});

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "searxngmcp" '{"command":"searxngmcp","env":{"SEARXNG_URL":"https://searx.example.com","SEARXNG_USERNAME":"your_username","SEARXNG_PASSWORD":"your_password"},"disabled":false,"autoApprove":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later