The SearXNG Model Context Protocol (MCP) server enables language models to perform web searches through SearXNG using the Model Context Protocol standard. It provides a straightforward interface for language models to send search queries to SearXNG and receive properly formatted results.
# Clone the repository
git clone https://github.com/aeon-seraph/searxng-mcp.git
cd searxng-mcp
# Install dependencies
npm install
# Build the project
npm run build
The basic command to start the server:
node build/index.js
The server runs on stdio, making it compatible with MCP-enabled language models.
You can customize the server behavior using environment variables:
Variable | Description | Default |
---|---|---|
SEARXNG_PROTOCOL | Protocol to use (http/https) | http |
SEARXNG_HOST | SearXNG host | localhost |
SEARXNG_PORT | SearXNG port | 8888 |
CACHE_TTL | Cache time-to-live in milliseconds | 600000 (10 minutes) |
MAX_CACHE_SIZE | Maximum number of cached queries | 100 |
SEARXNG_HOST=mysearx.example.com SEARXNG_PORT=443 SEARXNG_PROTOCOL=https node build/index.js
For containerized deployment, use the included Dockerfile:
# Build the Docker image
docker build -t searxng-mcp .
# Run the container with custom settings
docker run -e SEARXNG_HOST=mysearx.example.com -e SEARXNG_PROTOCOL=https searxng-mcp
When using the search functionality, the following parameters are available:
query
(required): The search query stringcategories
: Comma-separated list of search categoriespageno
: Search page number (default: 1)time_range
: Time range for results ("day", "week", "month", "year")raw_json
: Return raw JSON response instead of formatted text (default: false)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.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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.
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.