本地搜索服务器

CasaOS SearXNG MCP服务器提供通过本地托管的SearXNG实例进行搜索的功能。

  • by chantling
  • JavaScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 chantling/searxng-mcp-server

使用说明

CasaOS SearXNG MCP Server

This MCP server provides search capabilities through your locally hosted CasaOS SearXNG instance.

Overview

  • Server Name: searxng-casaos-mcp
  • Target Instance: CasaOS SearXNG at http://casaos:7888
  • Tools Available: search, get_engines, health_check

Installation

1. Install Dependencies

Navigate to the MCP server directory and install Node.js dependencies:

cd searxng-mcp-server
npm install

2. Configure Cline

Copy the contents of cline-mcp-config.json to your Cline configuration file:

Windows: %APPDATA%\Cline\config.json macOS/Linux: ~/.config/cline/config.json

Add the MCP server configuration to the mcpServers section:

{
  "mcpServers": {
    "searxng-casaos": {
      "command": "node",
      "args": [
        "d:/Programs/AI/!MCPServers!/searXNG/searxng-mcp-server/index.js"
      ],
      "cwd": "d:/Programs/AI/!MCPServers!/searXNG/searxng-mcp-server",
      "env": {
        "NODE_ENV": "production"
      },
      "description": "SearXNG search server for CasaOS instance",
      "version": "1.0.0"
    }
  }
}

3. Configure OpenCode

For OpenCode, use the configuration in opencode-mcp-config.json and add it to your OpenCode MCP configuration.

Usage

Available Tools

1. search - Web Search

Search the web using your CasaOS SearXNG instance.

Parameters:

  • query (required): The search query
  • format (optional): Output format (json, csv, rss) - default: json
  • language (optional): Language code (en, es, fr) - default: en
  • category (optional): Search category (general, images, videos, etc.)
  • time_range (optional): Time range (day, week, month, year)
  • safesearch (optional): Safe search level (0=off, 1=moderate, 2=strict) - default: 0
  • limit (optional): Maximum results to return (1-100) - default: 10

Example:

{
  "query": "latest AI developments",
  "language": "en",
  "category": "general",
  "limit": 5
}

2. get_engines - Get Available Engines

Get information about available search engines.

Parameters:

  • format (optional): Output format - default: json

3. health_check - Health Check

Check if the CasaOS SearXNG instance is accessible.

Parameters: None

Example Usage in Cline

# Search for information
Search for "latest Python release" using the searxng-casaos MCP server

# Check server health
Run health_check on the searxng-casaos MCP server

# Get available search engines
Run get_engines on the searxng-casaos MCP server

Configuration

Server Configuration

The MCP server is configured in index.js with the following settings:

const SEARXNG_CONFIG = {
  baseUrl: 'http://casaos:7888',  // Your CasaOS SearXNG URL
  defaultTimeout: 10000,          // 10 seconds default timeout
  maxTimeout: 60000,              // 60 seconds max timeout
};

Environment Variables

  • NODE_ENV: Set to production for production use

Troubleshooting

Connection Issues

  1. Verify CasaOS SearXNG is running:

    curl http://casaos:7888
    
  2. Check Tailscale connection: Ensure your device is connected to the same Tailscale network as CasaOS.

  3. Verify port accessibility:

    telnet casaos 7888
    

MCP Server Issues

  1. Check Node.js version:

    node --version
    

    Requires Node.js 18+ with ES modules support.

  2. Install dependencies:

    cd searxng-mcp-server
    npm install
    
  3. Test server manually:

    cd searxng-mcp-server
    node index.js
    

Common Errors

  • "CasaOS SearXNG instance is not accessible": Check network connectivity and Tailscale connection
  • "HTTP 500": SearXNG server error - check CasaOS logs
  • "Network timeout": Increase timeout or check network speed

Security Notes

  • The MCP server connects to your local CasaOS instance over the internal network
  • No external API keys or credentials are required
  • All communication stays within your local network via Tailscale

Development

Running in Development Mode

cd searxng-mcp-server
npm run dev

Adding New Tools

To add new tools, modify the ListToolsRequestSchema handler in index.js and add the corresponding handler in the CallToolRequestSchema switch statement.

License

MIT License - See package.json for details.

Support

For issues with this MCP server, check:

  1. CasaOS SearXNG logs
  2. Tailscale connectivity
  3. Node.js dependencies
  4. Network configuration