EB

evilran/baidu-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

28 stars 10 forks 质量 63 趋势 11MIT

百度搜索MCP服务器 一台模型上下文协议(MCP)服务器,通过百度提供网页搜索功能,并具备内容获取和解析的额外功能。

概览

一款模型上下文协议(MCP)服务器,通过百度提供网页搜索功能,并具备内容获取和解析的额外功能。 - : 采用高级速率限制和结果格式的百度搜索 - : 通过智能文本提取检索和解析网页内容 - : 内置搜索和内容取用速率限制保护 - : 全面的错误处理和日志记录 - : 专门为大型语言模型使用格式化的结果 通过Smithery自动安装百度搜索服务器(Claude Desktop): 1. 下载 Claude Desktop 2.创建或编辑您的 Claude Desktop 配置:- 在 macOS 上:~/Library/Application Support/Claude/claude_desktop_config.json - 在 Windows 上:%APPDATA%\Claude\claude_desktop_config.json 对于本地开发,您可以使用MCP CLI: 在百度上进行网络搜索,返回格式化的结果。

概述(AI 翻译)

一款模型上下文协议(MCP)服务器,通过百度提供网页搜索功能,并具备内容获取和解析的额外功能。

特色

  • 网页搜索:搜索百度,支持高级速率限制和结果格式
  • 内容获取:利用智能文本提取技术检索和解析网页内容
  • 速率限制:内置对搜索和内容获取速率限制的保护
  • 错误处理:全面的错误处理与日志记录
  • LLM 友好输出:专门为大型语言模型使用格式化的结果

安装

通过Smithery安装

通过Smithery自动安装百度搜索服务器(Claude Desktop):

通过 uv 安装

通过 uv 直接从 PyPI 安装:

用途

用Claude桌面运行

  1. 下载Claude桌面版
  2. 创建或编辑您的Claude桌面配置:
  • macOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows版:%APPDATA%\Claude\claude_desktop_config.json

添加以下配置:

  1. 重启 Claude Desktop

发展

对于本地开发,您可以使用MCP CLI:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Baidu Search MCP Server

A Model Context Protocol (MCP) server that provides web search capabilities through Baidu, with additional features for content fetching and parsing.

Features

  • Web Search: Search Baidu with advanced rate limiting and result formatting
  • Content Fetching: Retrieve and parse webpage content with intelligent text extraction
  • Rate Limiting: Built-in protection against rate limits for both search and content fetching
  • Error Handling: Comprehensive error handling and logging
  • LLM-Friendly Output: Results formatted specifically for large language model consumption

Installation

Installing via Smithery

To install Baidu Search Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @Evilran/baidu-mcp-server --client claude

Installing via uv

Install directly from PyPI using uv:

uv pip install baidu-mcp-server

Usage

Running with Claude Desktop

  1. Download Claude Desktop
  2. Create or edit your Claude Desktop configuration:
    • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • On Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the following configuration:

{
    "mcpServers": {
        "baidu-search": {
            "command": "uvx",
            "args": ["baidu-mcp-server"]
        }
    }
}
  1. Restart Claude Desktop

Development

For local development, you can use the MCP CLI:

# Run with the MCP Inspector
mcp dev server.py

# Install locally for testing with Claude Desktop
mcp install server.py

Available Tools

1. Search Tool

async def search(query: str, max_results: int = 10) -> str

Performs a web search on Baidu and returns formatted results.

Parameters:

  • query: Search query string
  • max_results: Maximum number of results to return (default: 10)

Returns: Formatted string containing search results with titles, URLs, and snippets.

2. Content Fetching Tool

async def fetch_content(url: str) -> str

Fetches and parses content from a webpage.

Parameters:

  • url: The webpage URL to fetch content from

Returns: Cleaned and formatted text content from the webpage.

Features in Detail

Rate Limiting

  • Search: Limited to 30 requests per minute
  • Content Fetching: Limited to 20 requests per minute
在 GitHub 查看完整 README

安装

uvx baidu-mcp-server
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "baidu-search": { "command": "uvx", "args": ["baidu-mcp-server"] } } }