This is a Model Context Protocol (MCP) server that provides a tool to interact with a SearXNG instance.
- Exposes a
search
tool to perform searches via a configured SearXNG instance. - Supports standard SearXNG parameters like
query
,categories
,language
,page_number
,time_range
, andsafesearch
.
- Node.js (v18 or later recommended)
- npm
- Access to a running SearXNG instance (either self-hosted or public)
This server can be installed as an npm package.
npm install -g searxng-mcp-ts # Install globally
# OR
# npm install searxng-mcp-ts # Install as a project dependency
Alternatively, you can clone the repository and build it:
git clone <repository-url> # Replace with the actual URL after publishing
cd searxng-mcp-ts
npm install
npm run build
This server requires the URL of your SearXNG instance. You can provide this by setting the SEARXNG_URL
environment variable.
If you installed the package globally or as a project dependency, you can set the environment variable before running the command.
For convenience during development when cloning the repository, you can also create a .env
file in the project root with the following content:
SEARXNG_URL=https://your-searxng-instance.com # <-- Update this URL
In your MCP client's settings file (e.g., mcp_settings.json
for Roo/Cline), you can configure the server using npx
(if not installed globally) or the command name (if installed globally):
{
"mcpServers": {
"searxng": {
"description": "Search aggregator that queries multiple search engines and returns combined results",
"command": "npx",
"args": ["-y", "searxng-mcp-ts@latest"],
"env": {
"SEARXNG_URL": "https://your-searxng-instance.com" // <-- Update this URL
},
"timeout": 60,
"transportType": "stdio",
"disabled": false,
"alwaysAllow": []
}
}
}
Important:
- Replace
https://your-searxng-instance.com
with the actual base URL of your SearxNG instance.
Restart your MCP client after updating the configuration.
Once configured, the server provides a search
tool. You can use it through your MCP client like this:
Example Request:
{
"tool_name": "search",
"server_name": "searxng",
"arguments": {
"query": "Model Context Protocol",
"categories": "general",
"language": "en"
}
}
Example Natural Language (if supported by client):
"Search for 'Model Context Protocol' using SearXNG"
This server includes improved error handling and logging to assist in debugging and monitoring in a production environment.
-
Watch for changes:
npm run watch
(automatically rebuilds on file changes) -
Linting:
npm run lint
-
Formatting:
npm run format
MIT License