X

searxng-mcp

Information

SearXNG MCP 服务器 一个模型上下文协议(MCP)服务器,使AI助手能够使用SearXNG(一种尊重隐私的元搜索引擎)进行网络搜索。通过自动从SearX.space中选择一个随机实例来实现开箱即用,无需额外部署,同时也支持带有基本身份验证的私有实例。 特性 零配置设置:通过使用来自SearX.space的随机公共实例立即工作 私有实例支持:连接到您自己的SearXNG实例,并可选地使用基本身份验证 使用可自定义参数执行网络搜索 支持多个搜索引擎 专注于隐私的搜索结果 Markdown格式的搜索结果 所有参数的合理默认值 注意 - 公共实例可能无法用于此目的,并返回“请求失败,状态码429” 安装 前提条件 Node.js (v16 或更高版本) npm (v7 或更高版本) 访问SearXNG实例(自托管或公共) 从源代码安装 # Clone the repository git clone https://github.com/tisDDM/searxng-mcp.git cd searxng-mcp # Install dependencies npm install # Build the project npm run build 配置 SearXNG MCP 服务器可以通过以下环境变量进行配置: SEARXNG_URL(可选):您的SearXNG实例的URL(例如,https://searx.example.com)。如果未提供,则会自动从SearX.space中选择一个随机公共实例,从而使服务器在没有额外部署的情况下即可使用。 USE_RANDOM_INSTANCE(可选):设置为 "false" 以禁用在未提供URL时的随机实例选择。默认值为 "true"。 SEARXNG_USERNAME(可选):连接到私有实例时的基本身份验证用户名 SEARXNG_PASSWORD(可选):连接到私有实例时的基本身份验证密码 您可以在项目的根目录下的 .env 文件中设置这些环境变量: SEARXNG_URL=https://searx.example.com SEARXNG_USERNAME=your_username SEARXNG_PASSWORD=your_password 使用 运行服务器 # If installed globally searxngmcp # If installed from source node build/index.js 与Claude Desktop集成 打开Claude Desktop 转到设置 > MCP 服务器 添加一个新的MCP服务器,配置如下: \{ "mcpServers": \{ "searxngmcp": \{ "command": "searxngmcp", "env": \{ // 可选:如果不提供,则将使用随机公共实例 "SEARXNG_URL": "https://searx.example.com", // 只有在需要对带身份验证的私有实例进行连接时才需要 "SEARXNG_USERNAME": "your_username", "SEARXNG_PASSWORD": "your_password" \}, "disabled": false, "autoApprove": [] \} \} \} 与VSCode中的Claude集成 打开 VSCode 转到 设置 > 扩展 > Claude > MCP 设置 添加一个新的 MCP 服务器,配置如下: \{ "mcpServers": \{ "searxngmcp": \{ "command": "node", "args": ["/path/to/searxng-mcp/build/index.js"], "env": \{ // 可选:如果不提供,则将使用一个随机的公共实例 "SEARXNG_URL": "https://searx.example.com", // 可选:仅在需要身份验证的私有实例中需要 "SEARXNG_USERNAME": "your_username", "SEARXNG_PASSWORD": "your_password" \}, "disabled": false, "autoApprove": [] \} \} \} 与 Smolagents 一起使用 SearXNG MCP 可以轻松集成到 Smolagents 中,这是一个用于构建 AI 代理的轻量级框架。这使您能够创建强大的研究代理,这些代理可以搜索网络并处理结果: from smolagents import CodeAgent, LiteLLMModel, ToolCollection from mcp import StdioServerParameters # Configure the SearXNG MCP server server_parameters = StdioServerParameters( command="node", args=["path/to/searxng-mcp/build/index.js"], env=\{ "SEARXNG_URL": "https://your-searxng-instance.com", "SEARXNG_USERNAME": "your_username", # Optional "SEARXNG_PASSWORD": "your_password" # Optional \} ) # Create a tool collection from the MCP server with ToolCollection.from_mcp(server_parameters) as tool_collection: # Initialize your LLM model model = LiteLLMModel( model_id="your-model-id", api_key="your-api-key", temperature=0.7 ) # Create an agent with the search tools search_agent = CodeAgent( name="search_agent", tools=tool_collection.tools, model=model ) # Run the agent with a search prompt result = search_agent.run( "Perform a search about: 'climate change solutions' and summarize the top 5 results." ) print(result) 可用工具 searxngsearch 使用 SearXNG(一种尊重隐私的元搜索引擎)执行网络搜索。返回具有可自定义参数的相关网页内容。 参数 参数类型描述默认值是否必填querystring搜索查询-是languagestring搜索结果的语言代码(例如 'en', 'de', 'fr')'en'否time_rangestring搜索结果的时间范围。选项:'day', 'week', 'month', 'year'null否categories字符串数组搜索的类别(例如 'general', 'images', 'news')null否engines字符串数组使用的具体搜索引擎null否safesearchnumber安全搜索级别:0(关闭),1(适中),2(严格)1否pagenonumber结果页码。必须至少为 11否max_resultsnumber返回的最大搜索结果数。范围:1-5010否 示例 // Example request const result = await client.callTool('searxngsearch', \{ query: 'climate change solutions', language: 'en', time_range: 'year', categories: ['general', 'news'], safesearch: 1, max_results: 5 \}); 开发 设置 # Clone the repository git clone https://github.com/tisDDM/searxng-mcp.git cd searxng-mcp # Install dependencies npm install 构建 npm run build 监视模式(开发用) npm run watch 使用 MCP Inspector 进行测试 npm run inspector 许可证 MIT

Prompts

Reviews

Tags

Write Your Review

Detailed Ratings

ALL
Correctness
Helpfulness
Interesting
Upload Pictures and Videos

Name
Size
Type
Download
Last Modified
  • Community

Add Discussion

Upload Pictures and Videos