搜索 MCP 服务器 logo

搜索 MCP 服务器

Community
fengin

一个基于MCP协议的搜索服务实现,提供网络搜索和本地搜索功能,Cursor和Claude Desktop能与之无缝集成。

Publisherfengin
Repositorysearch-server
LanguagePython
Forks
6
Stars
78
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    搜索 MCP 服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    78 stars and 6 forks from the linked repository.

Search MCP Server

image

一个基于MCP协议的搜索服务实现,提供多种搜索引擎支持,Cursor和Claude Desktop能与之无缝集成。

使用Python开发,支持异步处理和高并发请求,目前支持三种搜索引擎选择:

  • Brave Search :国外一家专业提供搜索接口服务产品

  • 秘塔(Metaso)搜索:秘塔AI搜索的逆向实现接口,非官方接口

  • 博查(bocha)搜索:国内Search API市场占有率最高的搜索API产品

更多MCP知识,见AI全书( 一文看懂什么是MCP(大模型上下文)?用来干什么的?怎么用它?)

作者: 凌封(微信fengin)

网址:https://aibook.ren(AI全书)

使用示例

image

功能特点

  • 多搜索引擎支持:
    • Brave Search: 提供网络搜索和位置搜索
    • Metaso搜索: 提供网络搜索和学术搜索,支持简洁和深入两种模式
    • 博查搜索: 提供网络搜索,支持时间范围过滤、详细摘要和图片搜索
  • 适用场景: Claude Desktop或者Cursor无缝集成使用,大大扩展工具的内容获取能力
  • 模块化设计: 每个搜索引擎都是独立的模块,也可以单独拷出去其他地方使用

三种搜索的选择

运行时只能生效一种搜索引擎,为了方便大家选择配置哪个上线,我列了下大致的对比:

搜索引擎国内/外需魔法自带总结质量免费官方速度注册门槛
Brave国外是否高是(限量)是中很高
Metaso国内否是中是否慢(AI总结)低
Bocha国内否否高否是极快低

安装和使用

1. 环境要求

  • Python 3.10+
  • uv 0.24.0+
  • node.js v20.15.0
  • cursor >=0.45.10 (低于该版本mcp server配置老是连不上)
  • 科学上网(仅使用Brave Search需要)

1.1 安装浏览器驱动(仅Metaso需要)

# 安装Playwright框架
pip install playwright>=1.35.0
# 安装浏览器驱动,仅安装chromium
playwright install chromium

2.下载代码

bash
git clone https://github.com/fengin/search-server.git

3. 启用你要的搜索引擎

打开项目根目录,修改server.py以下代码选择启用类型:

python
# 搜索引擎配置
SEARCH_ENGINE = os.getenv("SEARCH_ENGINE", "bocha")

其中值分别对应有brave、metaso、bocha,也可以通过配置环境变量SEARCH_ENGIN

4. 配置对应的搜索模块

以下三个模块目录下都对应有一个config.py文件:

  • src\search\proxy\brave

  • src\search\proxy\metaso

  • src\search\proxy\bocha

根据你的选择,修改对应的config.py文件配置

4.1 brave search配置

python
# 检查API密钥
BRAVE_API_KEY = os.getenv("BRAVE_API_KEY")
if not BRAVE_API_KEY:
    BRAVE_API_KEY = "你申请的 brave_api_key"

在Claude Desktop里面使用的话,也可以在Claude Desktop里配置通过环境变量传这个参数,但是Cursor目前不支持环境变量,只能在这文件里修改

API KEY 申请地址:Brave Search - API

申请门槛比较高,要求:

4.2 秘塔(metaso)配置

python
# 认证信息
METASO_UID = os.getenv("METASO_UID")
METASO_SID = os.getenv("METASO_SID")
if not METASO_UID or not METASO_SID:
    METASO_UID = "你获取的 metaso_uid"
    METASO_SID = "你获取的 metaso_sid"

同样Claude Desktop使用可以通过 MCP Servers配置里环境变量;

uid和sid获取方式:

进入秘塔AI搜索,登录账号(建议登录账号,否则可能遭遇奇怪的限制),然后F12打开开发者工具,从Application > Cookies中找到uid和sid的值。

获取uid-sid

多账号接入

注意:目前怀疑秘塔对IP地址的总搜索次数有限制,建议加入IP轮换

你可以通过提供多个账号的uid-sid并使用,修改下相关的使用代码,每次请求服务会从中挑选一个,本人后续再考虑。

4.3 博查(bocha)配置

python
BOCHA_API_KEY = os.getenv("BOCHA_API_KEY", "")
if not BOCHA_API_KEY:
    BOCHA_API_KEY="你申请的 bocha_api_key"

注册申请地址:https://open.bochaai.com/

调用按次数收费,不便宜,但是搜索质量确实比较好,我这有少量的免费试用码,有需要的微信联系我;

5. AI工具配置

5.1 Cursor里配置

Cursor配置

  • name: search

  • type: cmd

  • command: uv --directory D:\code\search-server run search

其中 “D:\code\search-server” 就是你拉下来源代码目录

5.2 Claude Desktop配置

找到配置文件

方法一

# widnows
C:\Users\{用户}\AppData\Roaming\Claude\claude_desktop_config.json
# mac/linux 应该在用户家目录下找

方法二

打开Claude Desktop应用进入查看: Claude Desktop—>菜单—>Settings—>Developer—>Edit Config

编辑增加以下MCP Server:

json
{
  "mcpServers": {
    "search": {
            "command": "uv",
            "args": [
                "--directory",
                "D:\\code\\search-server",
                "run",
                "search"
            ],
            "env": {
                "BRAVE_API_KEY": "你申请的API KEY"
            }
        }
  }
}

环境变量看你需要,如果代码改了这就没必要配置了

Cursor会弹出一个黑窗口,不要关闭,不要关闭,这是启动的MCP Server进程,目前没办法解决不弹出来。

Claude Desktop配置完一定要重启应用才生效。

5.4 问题排错

配置Cursor后很多人遇到,MCP Servers里面配置完,还是显示状态红点,Tools Not Found,使用时也不会去调用,这是因为根本没配置好。

大部分可能出现的情况是:

  1. 环境没准备好,包括需要的软件及版本要求,详见环境章节

  2. 准备的环境不对,像windows有cmd终端、powershell终端、还有可能装了gitbash终端,你打开cmd终端(cursor一般是这个)检查下环境,直接运行下uv --directory D:\code\search-server run search

  3. 配置路径/命令不对,可以打开终端运行命令看下:uv --directory D:\code\search-server run search

  4. 把黑窗口关闭了,再次开启需要重启Cursor

  5. Cursor版本太旧

  6. 运行时报以下错,原因是没有安装chromium,解决办法见环境准备1.1章节

    shell
    错误:搜索执行错误:BrowserType.launch persistent context:Executable doesn't exist atC:\Users\fengi\AppDatalLocal\ms-playwright\chromium headless shell-1155\chrome-winlheadless shell.exe

6. 使用

在你的Claude Desktop 或者 Cursor 里直接你正常的工作就行了,必要时它会自动调用搜索接口获取内容,比如说,你整理下网络上2025年技术发展方向作为软件什么内容,它就会去调用搜索工具获取网络信息:

  • 配置好工具后,它的信息里面就知道有这个工具

  • 根据你的要求,它自动会分析判断需要用到搜索工具

  • 根据需求,提取关键词,调用搜索工具

  • 根据搜索返回内容,组织你要的结果

有一点需要注意的,在Cursor里面,必须启用composer的agent模式工作才会生效,调用工具时,也需要你点下执行;

技术内幕

项目结构

shell
search/
├── __init__.py
├── server.py              # MCP服务器实现
└── proxy/                 # 搜索引擎代理
    ├── brave/             # Brave搜索模块
    │   ├── __init__.py
    │   ├── client.py      # 核心客户端实现
    │   ├── config.py      # 配置和速率限制
    │   └── exceptions.py  # 异常定义
    ├── metaso/            # Metaso搜索模块
    │   ├── __init__.py
    │   ├── client.py      # 核心客户端实现
    │   ├── config.py      # 配置和速率限制
    │   └── exceptions.py  # 异常定义
    ├── bocha/             # 博查搜索模块
    │   ├── __init__.py
    │   ├── client.py      # 核心客户端实现
    │   ├── config.py      # 配置和速率限制
    │   └── exceptions.py  # 异常定义
    ├── brave_search.py    # Brave MCP工具实现
    ├── metaso_search.py   # Metaso MCP工具实现
    └── bocha_search.py    # 博查搜索MCP工具实现

接口参数

Brave Search引擎

  • search

    • 执行网络搜索,支持分页和过滤
    • 输入参数:
      • query (string): 搜索关键词
      • count (number, 可选): 每页结果数量(最大20)
      • offset (number, 可选): 分页偏移量(最大9)
  • location_search

    • 搜索地理位置相关信息(商家、餐厅等)
    • 输入参数:
      • query (string): 位置搜索关键词
      • count (number, 可选): 结果数量(最大20)
    • 无相关结果时自动切换到网络搜索

Metaso搜索引擎

  • search

    • 执行网络搜索,支持多种模式
    • 输入参数:
      • query (string): 搜索关键词
      • mode (string, 可选): 搜索模式
        • concise: 简洁模式,回答简短精炼
        • detail: 深入模式,回答详细全面(默认)
        • research: 研究模式,回答深度分析(目前暂不支持,逆向没有成功)
  • scholar_search

    • 执行学术搜索,专门用于查找学术资源
    • 输入参数:
      • query (string): 学术搜索关键词
      • mode (string, 可选): 搜索模式,同上

博查搜索引擎

  • search
    • 执行网络搜索,支持时间范围过滤和详细摘要
    • 输入参数:
      • query (string): 搜索关键词
      • count (number, 可选): 结果数量(1-10,默认10)
      • page (number, 可选): 页码,从1开始
      • freshness (string, 可选): 时间范围
        • noLimit: 不限时间(默认)
        • oneDay: 一天内
        • oneWeek: 一周内
        • oneMonth: 一月内
        • oneYear: 一年内
      • summary (boolean, 可选): 是否显示详细摘要,默认false
    • 返回内容:
      • 搜索统计信息(总结果数、当前页/总页数、本页结果数)
      • 网页搜索结果(标题、URL、来源、摘要、发布时间)
      • 相关图片信息(尺寸、来源、URL)

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "fengin-search-server": {
      "command": "",
      "args": []
    }
  }
}

Use 搜索 MCP 服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once 搜索 MCP 服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add 搜索 MCP 服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the 搜索 MCP 服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "fengin-search-server": {
      "command": "npx",
      "args": [
        "-y",
        "search-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the 搜索 MCP 服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the 搜索 MCP 服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use 搜索 MCP 服务器 to help me with this task?
搜索 MCP 服务器
Sure. I read it.
Here is what I found using 搜索 MCP 服务器.

Frequently asked questions

What is the 搜索 MCP 服务器 MCP server used for?

搜索 MCP 服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use 搜索 MCP 服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use 搜索 MCP 服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use 搜索 MCP 服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With 搜索 MCP 服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect 搜索 MCP 服务器 MCP to TypingMind?

搜索 MCP 服务器 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does 搜索 MCP 服务器 MCP provide in TypingMind?

搜索 MCP 服务器 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use 搜索 MCP 服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If 搜索 MCP 服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇