SearXNG搜索服务

一个基于SearXNG的MCP服务器,提供网络搜索功能。

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

使用说明

mcp searxng

MCP(模型上下文协议)服务器,通过 SearXNG 例子

先决条件

  • 锈1.85+(2024年版)
  • 启用JSON API的正在运行的SearXNG实例

建筑

cargo build --release

二进制文件将位于 target/release/mcp-searxng.

配置

启动时,二进制文件从以下位置加载TOML配置文件:

  1. $MCP_SEARXNG_CONFIG,如果设置,或
  2. $HOME/.config/mcp-searxng/config.toml (默认)

该文件是必需的——没有它,服务器将无法启动。请参阅 config.example.toml 对于模板。

领域

密钥 必填 描述
searxng_url yes SearXNG实例的基本URL(例如。 http://localhost:8080)

环境

变量 描述
MCP_SEARXNG_CONFIG 覆盖配置文件的路径
RUST_LOG 日志级别(例如。 info, debug)--日志转到stderr

使用Claude代码

添加到您的 .mcp.json:

{
  "mcpServers": {
    "searxng": {
      "command": "/path/to/mcp-searxng"
    }
  }
}

指向非默认配置位置:

{
  "mcpServers": {
    "searxng": {
      "command": "/path/to/mcp-searxng",
      "env": {
        "MCP_SEARXNG_CONFIG": "/path/to/config.toml"
      }
    }
  }
}

工具: search

使用SearXNG搜索网络。返回包含标题、URL和内容片段的结果列表。

参数

参数 类型 必填 说明
query string yes 搜索查询字符串
categories string no 逗号分隔的类别(例如。 "general", "news", "images", "it", "science").默认为 "general".
max_results integer no 要返回的结果数(1-50)。默认值为10。
pageno integer no 分页页码。默认为1。
time_range string no 时间范围筛选器: "day", "week", "month",或 "year".