Labsco
OvertliDS logo

MCP-SearXNG-Enhanced Web Search

β˜… 54

from OvertliDS

An enhanced MCP server for SearXNG web searching, utilizing a category-aware web-search, web-scraping, and includes a date/time retrieval tool.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

MseeP.ai Security Assessment Badge

MCP SearXNG Enhanced Server

A Model Context Protocol (MCP) server for category-aware web search, website scraping, and date/time tools. Designed for seamless integration with SearXNG and modern MCP clients.

Features

  • πŸ” SearXNG-powered web search with category support (general, images, videos, files, map, social media)
  • πŸ“„ Website content scraping with citation metadata and automatic Reddit URL conversion
  • πŸ“œ Intial PDF reading support with a conversion to Markdown using PyMuPDF/PyMuPDF4LLM
  • πŸ’Ύ In-memory caching with automatic freshness validation
  • 🚦 Domain-based rate limiting to prevent service abuse
  • πŸ•’ Timezone-aware date/time tool
  • ⚠️ Robust error handling with custom exception types
  • 🐳 Dockerized and configurable via environment variables
  • βš™οΈ Configuration persistence between container restarts

HTTP Server Mode (FastMCP)

In addition to the default stdio transport, the server can expose an MCP endpoint over HTTP using FastMCP. This is useful for clients that connect via HTTP rather than spawning a subprocess.

Starting the HTTP Server

Copy & paste β€” that's it
python mcp_server.py --http

The server will start on 0.0.0.0:8000 by default and accept MCP requests at:

Copy & paste β€” that's it
http://<host>:<port>/mcp

All origins are allowed (CORS is fully open), so the endpoint is accessible from any client or browser-based tool.

HTTP Server Environment Variables

VariableDescriptionDefault
MCP_HTTP_HOSTHost address to bind to0.0.0.0
MCP_HTTP_PORTPort to listen on8000

Example β€” custom host and port:

Copy & paste β€” that's it
MCP_HTTP_HOST=127.0.0.1 MCP_HTTP_PORT=9000 python mcp_server.py --http

Windows (Command Prompt):

Copy & paste β€” that's it
set MCP_HTTP_HOST=127.0.0.1
set MCP_HTTP_PORT=9000
python mcp_server.py --http

Windows (PowerShell):

Copy & paste β€” that's it
$env:MCP_HTTP_HOST="127.0.0.1"
$env:MCP_HTTP_PORT="9000"
python mcp_server.py --http

Connecting an MCP Client via HTTP

Point your MCP client at the /mcp endpoint:

Copy & paste β€” that's it
{
  "mcpServers": {
    "mcp-searxng-enhanced-http": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

Note: All server configuration variables (SEARXNG_ENGINE_API_BASE_URL, DESIRED_TIMEZONE, etc.) apply in HTTP mode exactly as they do in stdio mode. The ods_config.json file is written at startup before the server begins accepting connections.


Environment Variables

The following environment variables control the server's behavior. You can set them in your MCP client's configuration (recommended for client-managed servers) or when running Docker manually.

VariableDescriptionDefault (from Dockerfile)Notes
SEARXNG_ENGINE_API_BASE_URLSearXNG search endpointhttp://host.docker.internal:8080/searchCrucial for server operation
MCP_HTTP_HOSTBind address for HTTP server mode0.0.0.0Only used when starting with --http
MCP_HTTP_PORTPort for HTTP server mode8000Only used when starting with --http
DESIRED_TIMEZONETimezone for date/time toolAmerica/New_YorkE.g., America/Los_Angeles. List of tz database time zones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
ODS_CONFIG_PATHPath to persistent configuration file/config/ods_config.jsonTypically left as default within the container.
RETURNED_SCRAPPED_PAGES_NOMax pages to return per search3
SCRAPPED_PAGES_NOMax pages to attempt scraping5
PAGE_CONTENT_WORDS_LIMITMax words per scraped page5000
CITATION_LINKSEnable/disable citation eventsTrueTrue or False
MAX_IMAGE_RESULTSMaximum image results to return10
MAX_VIDEO_RESULTSMaximum video results to return10
MAX_FILE_RESULTSMaximum file results to return5
MAX_MAP_RESULTSMaximum map results to return5
MAX_SOCIAL_RESULTSMaximum social media results to return5
TRAFILATURA_TIMEOUTContent extraction timeout (seconds)15
SCRAPING_TIMEOUTHTTP request timeout (seconds)20
CACHE_MAXSIZEMaximum number of cached websites100
CACHE_TTL_MINUTESCache time-to-live (minutes)5
CACHE_MAX_AGE_MINUTESMaximum age for cached content (minutes)30
RATE_LIMIT_REQUESTS_PER_MINUTEMax requests per domain per minute10
RATE_LIMIT_TIMEOUT_SECONDSRate limit tracking window (seconds)60
IGNORED_WEBSITESComma-separated list of sites to ignore"" (empty)E.g., "example.com,another.org"

Tools & Aliases

Tool NamePurposeAliases
search_webWeb search via SearXNGsearch, web_search, find, lookup_web, search_online, access_internet, lookup*
get_websiteScrape website contentfetch_url, scrape_page, get, load_website, lookup*
get_current_datetimeCurrent date/timecurrent_time, get_time, current_date

*lookup is context-sensitive:

  • If called with a url argument, it maps to get_website
  • Otherwise, it maps to search_web

Example: Calling Tools

Web Search

Copy & paste β€” that's it
{ "name": "search_web", "arguments": { "query": "open source ai" } }

or using an alias:

Copy & paste β€” that's it
{ "name": "search", "arguments": { "query": "open source ai" } }

Category-Specific Search

Copy & paste β€” that's it
{ "name": "search_web", "arguments": { "query": "landscapes", "category": "images" } }

Website Scraping

Copy & paste β€” that's it
{ "name": "get_website", "arguments": { "url": "example.com" } }

or using an alias:

Copy & paste β€” that's it
{ "name": "lookup", "arguments": { "url": "example.com" } }

Current Date/Time

Copy & paste β€” that's it
{ "name": "get_current_datetime", "arguments": {} }

or:

Copy & paste β€” that's it
{ "name": "current_time", "arguments": {} }

Advanced Features

Category-Specific Search

The search_web tool supports different categories with tailored outputs:

  • images: Returns image URLs, titles, and source pages with optional Markdown embedding
  • videos: Returns video information including titles, source, and embed URLs
  • files: Returns downloadable file information including format and size
  • map: Returns location data including coordinates and addresses
  • social media: Returns posts and profiles from social platforms
  • general: Default category that scrapes and returns full webpage content

Reddit URL Conversion

When scraping Reddit content, URLs are automatically converted to use the old.reddit.com domain for better content extraction.

Rate Limiting

Domain-based rate limiting prevents excessive requests to the same domain within a time window. This prevents overwhelming target websites and potential IP blocking.

Cache Validation

Cached website content is automatically validated for freshness based on age. Stale content is refreshed automatically while valid cached content is served quickly.

Error Handling

The server implements a robust error handling system with these exception types:

  • MCPServerError: Base exception class for all server errors
  • ConfigurationError: Raised when configuration values are invalid
  • SearXNGConnectionError: Raised when connection to SearXNG fails
  • WebScrapingError: Raised when web scraping fails
  • RateLimitExceededError: Raised when rate limit for a domain is exceeded

Errors are properly propagated to the client with informative messages.

Acknowledgements

Inspired by:

License

MIT License Β© 2025 OvertliDS