Skip to main content
Glama
tisDDM

SearXNG MCP Server

by tisDDM

SearXNG MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to perform web searches using SearXNG, a privacy-respecting metasearch engine. Works out-of-the-box with zero additional deployment by automatically selecting a random instance from SearX.space, while also supporting private instances with basic authentication.

This project is deprecated. Its successor is searxNcrawl at https://github.com/DasDigitaleMomentum/searxNcrawl

Related MCP server: OneSearch MCP Server

Deprecated

This repository is deprecated in favor of searxNcrawl. The successor currently does not include round-robin instance selection (it is usually unreliable). If you file a suitable defect report, it can be added.

Features

  • Zero-configuration setup: Works immediately by using a random public instance from SearX.space

  • Private instance support: Connect to your own SearXNG instance with optional basic authentication

  • Perform web searches with customizable parameters

  • Support for multiple search engines

  • Privacy-focused search results

  • Markdown-formatted search results

  • Sensible default values for all parameters

CAVEAT - Public Instances might be unavailabe for this purpose and return "Request failed with status code 429"

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 from SearX.space will be automatically selected, making the server usable with zero additional deployment.

  • 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 when connecting to a private instance

  • SEARXNG_PASSWORD (optional): Password for basic authentication when connecting to a private instance

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": {
            // Optional: If not provided, a random public instance will be used
            "SEARXNG_URL": "https://searx.example.com",
            // Optional: Only needed for private instances with authentication
            "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": {
            // Optional: If not provided, a random public instance will be used
            "SEARXNG_URL": "https://searx.example.com",
            // Optional: Only needed for private instances with authentication
            "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

Available Tools

1 tool
searxngsearchC

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

ParametersJSON Schema
NameRequiredDescriptionDefault
categoriesNoCategories to search in (e.g., 'general', 'images', 'news'). Default: null (all categories).
enginesNoSpecific search engines to use. Default: null (all available engines).
languageNoLanguage code for search results (e.g., 'en', 'de', 'fr'). Default: 'en'en
max_resultsNoMaximum number of search results to return. Range: 1-50. Default: 10.
pagenoNoPage number for results. Must be minimum 1. Default: 1.
queryYesSearch query
safesearchNoSafe search level: 0 (off), 1 (moderate), 2 (strict). Default: 1 (moderate).
time_rangeNoTime range for search results. Options: 'day', 'week', 'month', 'year'. Default: null (no time restriction).

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'privacy-respecting' and 'returns relevant web content,' but doesn't disclose key behavioral traits like rate limits, authentication needs, error handling, or what 'relevant' entails (e.g., ranking, source diversity). For a search tool with no annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the core purpose in the first sentence. The second sentence adds useful context about returns and parameters without redundancy. It could be slightly more structured (e.g., bullet points), but it's efficient with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (8 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and hints at behavior, but lacks details on output format, error cases, or operational constraints. Without annotations or output schema, more context would help the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 8 parameters. The description adds minimal value beyond the schema by mentioning 'customizable parameters' but doesn't provide additional semantics or context for parameter usage. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs web searches using SearXNG, specifying it's a privacy-respecting metasearch engine. It distinguishes the tool by mentioning its privacy focus and customizable parameters, though without siblings, differentiation isn't needed. However, it could be more specific about the exact verb and resource (e.g., 'search the web' rather than 'perform web searches').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or contextual constraints. It mentions 'customizable parameters' but doesn't explain when specific settings are appropriate. Without siblings, this is less critical, but it still lacks usage context for the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.1/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tools. The tool's purpose is clearly defined as performing web searches using SearXNG, making it distinct by default.

Naming Consistency5/5

Since there is only one tool, naming consistency is inherently perfect. The tool name 'searxngsearch' follows a single pattern without any deviations or mixing of conventions.

Tool Count2/5

A single tool is too few for a server that appears to handle web searches, as it lacks operations for refining searches, managing results, or handling other aspects of a search engine's functionality. This feels thin and incomplete for the domain.

Completeness2/5

The tool surface is severely incomplete for a search engine server. It only provides a basic search function, with no tools for filtering results, handling pagination, accessing advanced search features, or managing search history, leading to significant gaps in coverage.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tisDDM/searxng-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server