搜索API集成服务

一个用于Microsoft Bing搜索API集成的模型上下文协议服务器,允许AI助手执行网页、新闻和图像搜索。

  • by leehanchung
  • Python
  • 本地部署
  • 81 星标
  • 更新于
在 GitHub 查看 leehanchung/bing-search-mcp

使用说明

Bing搜索MCP服务器

用于Microsoft Bing搜索API集成的模型上下文协议(MCP)服务器,允许人工智能助手执行网络、新闻和图像搜索。

特性

  • 网络搜索一般信息
  • 新闻搜索最近的事件和及时的信息
  • 视觉内容的图像搜索
  • 限制价格以防止API滥用
  • 全面的错误处理

需求

  • Python 3.10或更高版本
  • Microsoft必应搜索API密钥
  • MCP兼容客户端(例如,Claude Desktop、Cursor)

安装

  1. 克隆此存储库
  2. 安装依赖项:
    uv venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    uv pip install -e .
    

配置

设置所需的环境变量:

export BING_API_KEY="your-bing-api-key"
export BING_API_URL="https://api.bing.microsoft.com/"  # Optional

对于Windows:

set BING_API_KEY=your-bing-api-key
set BING_API_URL=https://api.bing.microsoft.com/

用法

运行服务器

uvx bing-search-mcp

使用Claude for Desktop进行配置

将以下内容添加到您的Claude Desktop配置文件中(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS或 %APPDATA%\Claude\claude_desktop_config.json 在Windows上):

{
  "mcpServers": {
    "bing-search": {
      "command": "uvx",
      "args": [
        "/path/to/your/bing-search-mcp"
      ],
      "env": {
        "BING_API_KEY": "your-bing-api-key"
      }
    }
  }
}

可用工具

1.bing_web_search

信息、网站和内容的一般网络搜索。

bing_web_search(query: str, count: int = 10, offset: int = 0, market: str = "en-US")

2.bing_news_search

搜索新闻文章和时事。

bing_news_search(query: str, count: int = 10, market: str = "en-US", freshness: str = "Day")

3.bing_image_search

搜索图像。

bing_image_search(query: str, count: int = 10, market: str = "en-US")

获取必应API密钥

  1. 访问 微软Azure门户
  2. 创建或登录您的Azure帐户
  3. 创建新的Bing搜索资源
  4. 转到资源并在“密钥和端点”部分找到您的API密钥

许可证

MIT许可证