A Model Context Protocol (MCP) server providing AI-powered Baidu search with intelligent reranking and web content extraction
Project description
Search MCP Server
A powerful Model Context Protocol (MCP) server providing AI-enhanced Baidu search with intelligent reranking and comprehensive web content extraction capabilities.
โจ Features
- ๐ Baidu Search Integration: Fast and reliable search results from Baidu
- ๐ค AI-Powered Reranking: Uses multiple AI agents (Qwen) to intelligently rerank search results by relevance
- ๐ Web Content Extraction: Extract clean, readable text from web pages with pagination support
- ๐ฏ Batch Processing: Extract content from multiple URLs simultaneously
- ๐ MCP Standard: Fully compliant with Model Context Protocol for seamless integration
๐ Quick Start
Prerequisites
- Python 3.10 or higher
- uv (recommended) or pip
- DashScope API key (for AI search features)
Installation
Using uv (Recommended)
# Clone the repository
git clone https://github.com/Vist233/Google-Search-Tool.git
cd search-mcp
# Install with uv
uv pip install -e .
Using pip
pip install -e .
Environment Setup
Create a .env file or set environment variables for AI features:
export DASHSCOPE_API_KEY="your-api-key-here"
๐ Usage
As an MCP Server
Add to your MCP client configuration (e.g., Claude Desktop):
For macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
For Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"aiwebsearcher": {
"command": "uvx",
"args": [
"aiwebsearcher"
]
}
}
}
Note: API key is read from environment variable DASHSCOPE_API_KEY. Set it before running:
# macOS/Linux
export DASHSCOPE_API_KEY="your-api-key-here"
# Windows (PowerShell)
$env:DASHSCOPE_API_KEY="your-api-key-here"
Standalone Testing
# Install the package
pip install aiwebsearcher
# Set API key
export DASHSCOPE_API_KEY="your-key"
# Run the server
aiwebsearcher
๐ ๏ธ Available Tools
1. search_baidu
Execute basic Baidu search and return structured results.
Parameters:
query(str): Search keywordmax_results(int, optional): Maximum results to return (default: 5)language(str, optional): Search language (default: "zh")
Returns: JSON string with title, url, and abstract for each result.
Example:
{
"query": "ไบบๅทฅๆบ่ฝๅๅฑ็ฐ็ถ",
"max_results": 5
}
2. AI_search_baidu
AI-enhanced search with intelligent reranking and content extraction. Takes ~3x longer but provides higher quality, ranked results with full page content.
Parameters:
query(str): Search keywordmax_results(int, optional): Initial results to fetch (default: 5, recommended 5+)language(str, optional): Search language (default: "zh")
Returns: JSON string with rank, title, url, and Content (full page text) for each result.
Example:
{
"query": "AIๅๅฑ่ถๅฟ 2025",
"max_results": 12
}
3. extractTextFromUrl
Extract clean, readable text from a single webpage.
Parameters:
url(str): Target webpage URLfollow_pagination(bool, optional): Follow rel="next" links (default: true)pagination_limit(int, optional): Max pagination depth (default: 3)timeout(float, optional): HTTP timeout in seconds (default: 10.0)user_agent(str, optional): Custom User-Agent headerregular_expressions(list[str], optional): Regex patterns to filter text
Returns: Extracted text content as string.
4. extractTextFromUrls
Extract text from multiple webpages in batch.
Parameters: Same as extractTextFromUrl, plus:
urls(list[str]): List of target URLs
Returns: Combined text from all URLs, separated by double newlines.
๐๏ธ Project Structure
search-mcp/
โโโ searcher/
โ โโโ src/
โ โโโ server.py # MCP server entry point
โ โโโ FetchPage/
โ โ โโโ fetchWeb.py # Web content extraction
โ โโโ WebSearch/
โ โ โโโ baiduSearchTool.py # Baidu search implementation
โ โ โโโ SearchAgent.py # AI agent definitions (legacy)
โ โโโ useAI2Search/
โ โโโ SearchAgent.py # AI-powered search orchestration
โโโ tests/ # Test files
โโโ pyproject.toml # Project configuration
โโโ requirements.txt # Dependencies
โโโ README.md # This file
๐ง Development
Install Development Dependencies
uv pip install -e ".[dev]"
Run Tests
pytest
Code Formatting
# Format with black
black searcher/
# Lint with ruff
ruff check searcher/
๐ Configuration
MCP Client Configuration Examples
Minimal configuration:
{
"mcpServers": {
"search": {
"command": "python",
"args": ["server.py"],
"cwd": "/path/to/search-mcp/searcher/src"
}
}
}
With uv for dependency isolation:
{
"mcpServers": {
"search": {
"command": "uv",
"args": ["--directory", "/path/to/search-mcp/searcher/src", "run", "python", "server.py"]
}
}
}
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with FastMCP
- AI models powered by Agno and DashScope
- Search powered by baidusearch
- Content extraction using trafilatura
๐ฎ Contact
- GitHub: @Vist233
- Repository: Google-Search-Tool
โ ๏ธ Disclaimer
This tool is for educational and research purposes. Please respect website terms of service and rate limits when scraping content.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiwebsearcher-0.1.1.tar.gz.
File metadata
- Download URL: aiwebsearcher-0.1.1.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
704be2c74502793ec4fdfef76e0d9c2239ae1a341262444bf0a0dbafdf5dbc00
|
|
| MD5 |
24d5679b259d9d01e456bae300d287b9
|
|
| BLAKE2b-256 |
92ffc219dc6be40620c3c0267591d34a06332b77a60d41da940ea49f151ce0fa
|
File details
Details for the file aiwebsearcher-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aiwebsearcher-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8b002ec3d7beb095dd153fc42b9b27aa39a7b4ba19484000ac4241026d4610
|
|
| MD5 |
d4cb3a087867aa9208346fbb725c56cf
|
|
| BLAKE2b-256 |
e96be22a429174c115e4ef06ce55fce6dfac7a3d2a5172e27a152051d749ed29
|