Skip to main content
Glama
netixc

SearXNG MCP Server

search

Perform quick web or news searches to find information and articles using privacy-focused SearXNG metasearch engine.

Instructions

Quick search for web or news content.

Use this when:

  • User asks for a simple web search or lookup

  • Need quick information, not comprehensive research

  • Looking for news articles on a topic

This runs a SINGLE search and returns up to max_results (default 10). For comprehensive research with multiple sources, use research_topic instead.

Parameters: query* - What to search for category - "general" for web search, "news" for news articles (default: general) engines - Optional: Specific engines (e.g., "google,bing") max_results - Number of results (default: 10, max: 50)

Returns: Search results with titles, URLs, and snippets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
categoryNoSearch categorygeneral
enginesNoComma-separated engine list
max_resultsNoMaximum results

Implementation Reference

  • Core handler function for the 'search' tool that queries SearXNG via _search, formats and truncates results, and returns as List[TextContent].
    def search(
        self,
        query: str,
        category: Literal["general", "news"] = "general",
        engines: Optional[str] = None,
        max_results: int = 10
    ) -> List[TextContent]:
        """Quick search for web or news.
    
        Args:
            query: Search query
            category: "general" for web search, "news" for news
            engines: Comma-separated engine list (e.g., "google,bing,brave")
            max_results: Maximum results to return
    
        Returns:
            Formatted search results
        """
        results = self._search(query, category=category, engines=engines)
    
        if category == "news":
            output = f"đź“° News Results for: {query}\n\n"
        else:
            output = f"🔍 Search Results for: {query}\n\n"
    
        for i, result in enumerate(results.get("results", [])[:max_results], 1):
            output += f"{i}. **{result.get('title', 'No title')}**\n"
            output += f"   {result.get('url', '')}\n"
            if result.get('content'):
                content = result['content'][:200] + "..." if len(result['content']) > 200 else result['content']
                output += f"   {content}\n"
            if category == "news" and result.get('publishedDate'):
                output += f"   đź“… {result['publishedDate']}\n"
            output += "\n"
    
        if not results.get("results"):
            output += "No results found.\n"
    
        return [TextContent(type="text", text=output)]
  • Registers the 'search' tool with the MCP server using FastMCP.tool decorator, defines input schema with Pydantic Field validations, and delegates execution to SearchTools.search instance method.
    @self.mcp.tool(description=SEARCH_DESC)
    def search(
        query: Annotated[str, Field(description="Search query")],
        category: Annotated[Literal["general", "news"], Field(description="Search category")] = "general",
        engines: Annotated[Optional[str], Field(description="Comma-separated engine list")] = None,
        max_results: Annotated[int, Field(description="Maximum results", ge=1, le=50)] = 10
    ):
        return self.search_tools.search(query, category, engines, max_results)
  • Internal helper method that constructs SearXNG API request parameters and performs HTTP GET to fetch raw JSON search results.
    def _search(
        self,
        query: str,
        category: Optional[str] = None,
        engines: Optional[str] = None,
        language: str = "en",
        page: int = 1
    ) -> Dict[str, Any]:
        """Internal search method.
    
        Args:
            query: Search query
            category: Search category (general, images, videos, news, etc.)
            engines: Comma-separated list of engines
            language: Search language
            page: Page number
    
        Returns:
            Search results from SearXNG
        """
        params = {
            "q": query,
            "format": "json",
            "language": language,
            "pageno": page
        }
    
        if category:
            params["categories"] = category
    
        if engines:
            params["engines"] = engines
    
        try:
            self.logger.info(f"Searching: {query} (category: {category})")
            response = requests.get(
                f"{self.searxng_url}/search",
                params=params,
                timeout=self.timeout
            )
            response.raise_for_status()
            return response.json()
        except Exception as e:
            self.logger.error(f"Search failed: {e}")
            raise RuntimeError(f"Search failed: {e}")
  • Input schema definition for the 'search' tool using Pydantic's Annotated and Field for validation, descriptions, constraints (e.g., max_results 1-50). Note: this overlaps with registration block.
    query: Annotated[str, Field(description="Search query")],
    category: Annotated[Literal["general", "news"], Field(description="Search category")] = "general",
    engines: Annotated[Optional[str], Field(description="Comma-separated engine list")] = None,
    max_results: Annotated[int, Field(description="Maximum results", ge=1, le=50)] = 10
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it 'runs a SINGLE search', returns 'up to max_results (default 10)', and specifies the return format ('Search results with titles, URLs, and snippets'). It doesn't mention rate limits, authentication needs, or error handling, keeping it from a perfect score.

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

Conciseness5/5

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

The description is well-structured with clear sections (purpose, usage guidelines, behavioral note, parameters, returns), front-loaded with the core purpose. Every sentence adds value—no redundancy or fluff—making it efficient and easy to parse.

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

Completeness4/5

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

Given no annotations and no output schema, the description does a strong job covering purpose, usage, behavior, and parameters. It lacks details on error cases, pagination, or authentication, but for a search tool with 100% schema coverage and clear behavioral notes, it's nearly complete. A 5 would require output schema or more edge-case coverage.

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 baseline is 3. The description adds minimal value beyond the schema: it clarifies 'category' options with examples ('general' for web, 'news' for news) and notes 'engines' as 'comma-separated', but doesn't provide additional semantic context like query formatting tips or engine-specific behaviors.

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

Purpose5/5

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

The description clearly states the tool performs a 'quick search for web or news content' with specific verbs ('search', 'lookup') and resources ('web', 'news content'). It distinguishes from sibling 'research_topic' by emphasizing 'simple' vs 'comprehensive' and from 'search_media' by focusing on web/news rather than media.

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

Usage Guidelines5/5

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

The description provides explicit 'Use this when' guidelines with three specific scenarios and explicitly states when NOT to use it ('not comprehensive research'), naming the alternative 'research_topic'. This gives clear context for tool selection among siblings.

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

Install Server

Other Tools

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/netixc/SearxngMCP'

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