# SearXNG MCP Server
A Model Context Protocol (MCP) server that provides web search capabilities using SearXNG.
## Features
- š Web search using your SearXNG instance
- šÆ Category filtering (general, news, images, videos, science, etc.)
- š Multi-language support
- ā° Time range filtering
- š”ļø Safe search options
- š Formatted results with titles, URLs, snippets, and metadata
## Quick Start
### Prerequisites
- Node.js 18 or higher
- A running SearXNG instance
- ngrok (for public sharing)
### Installation
```bash
npm install
```
### Configuration
The server uses the SearXNG instance at `http://192.168.1.44:55001` by default. You can override this with the `SEARXNG_URL` environment variable:
```bash
export SEARXNG_URL=http://your-searxng-instance:port
```
### Running Locally
```bash
npm start
```
### Sharing Publicly with ngrok
1. Install ngrok if you haven't already:
```bash
npm install -g ngrok
```
2. Start the MCP server:
```bash
npm start
```
3. In another terminal, expose it via ngrok:
```bash
ngrok http 3000
```
4. Use the ngrok URL in your MCP client configuration
## Usage in LM Studio
### For Local Use
Add this to your LM Studio MCP settings:
```json
{
"mcpServers": {
"searxng": {
"command": "node",
"args": ["C:\\Users\\claym\\Desktop\\public mcp\\index.js"],
"env": {
"SEARXNG_URL": "http://192.168.1.44:55001"
}
}
}
}
```
### For Public/Shared Use (via ngrok)
When sharing with others, they can use this configuration:
```json
{
"mcpServers": {
"searxng": {
"command": "npx",
"args": ["-y", "searxng-mcp-server@latest"]
}
}
}
```
**Note:** For the npx version to work, you'll need to publish this to npm first.
## Available Tools
### `web_search`
Search the web using SearXNG.
**Parameters:**
- `query` (required): The search query
- `categories` (optional): Search categories - "general", "news", "images", "videos", "science", etc. Default: "general"
- `language` (optional): Language code like "en", "es", "fr". Default: "en"
- `time_range` (optional): Filter by time - "day", "week", "month", "year". Default: all time
- `safesearch` (optional): Safe search level - 0 (off), 1 (moderate), 2 (strict). Default: 0
**Example:**
```
Search for "latest AI news" in the news category from the past week
```
## Development
### Project Structure
```
.
āāā index.js # Main MCP server implementation
āāā package.json # Dependencies and scripts
āāā README.md # This file
```
### Testing
You can test the server using any MCP-compatible client like:
- LM Studio
- Claude Desktop
- Other MCP clients
## Troubleshooting
### Connection Issues
If you can't connect to SearXNG:
1. Verify your SearXNG instance is running: `curl http://192.168.1.44:55001`
2. Check firewall settings
3. Ensure the URL is correct in the configuration
### No Results
If searches return no results:
1. Test the same query directly in SearXNG web interface
2. Try different categories or remove filters
3. Check SearXNG logs for errors
## License
MIT