
tavily search
基于 Tavily API 的搜索代理工具,支持 Google 搜索和基础数学运算。
Repository Info
About This Server
基于 Tavily API 的搜索代理工具,支持 Google 搜索和基础数学运算。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Tavily Search Agent
這是一個基於 Tavily API 的搜索代理工具,使用 Model Context Protocol (MCP) 實現。該工具提供了 Google 搜索功能和基礎的數學運算功能。
功能特點
- Google 搜索:使用 Tavily API 進行高級網絡搜索
- 數學運算:提供基礎的加法運算功能
- MCP 整合:使用 FastMCP 實現工具接口
安裝要求
- Python 3.11 或更高版本
- 必要的 Python 套件:
- tavily-python (>=0.2.0): Tavily API 的 Python SDK
- python-dotenv (>=1.0.0): 用於載入環境變數
- fastmcp (>=0.1.0): MCP 協議實現
- requests (>=2.31.0): HTTP 請求庫
- typing-extensions (>=4.8.0): Python 類型提示擴展
安裝步驟
- 克隆此專案:
git clone [repository-url]
cd tavily-search
- 建議使用虛擬環境(可選但推薦):
# Windows
python -m venv venv
.\venv\Scripts\activate
# Linux/MacOS
python -m venv venv
source venv/bin/activate
- 安裝依賴套件:
# 使用requirements.txt安裝所有依賴
pip install -r requirements.txt
# 或者手動安裝個別套件
pip install tavily-python>=0.2.0
pip install python-dotenv>=1.0.0
pip install fastmcp>=0.1.0
pip install requests>=2.31.0
pip install typing-extensions>=4.8.0
- 驗證安裝:
# 確認所有套件都已正確安裝
pip list | findstr "tavily-python python-dotenv fastmcp requests typing-extensions"
- 設置環境變數:
- 創建
.env文件 - 添加您的 Tavily API 金鑰:
- 創建
TAVILY_API_KEY=your_api_key_here
使用方法
- 啟動 MCP 服務器:
python search_google_agent.py
- 可用的工具函數:
search_google_agent(query: str): 使用 Tavily API 進行 Google 搜索add(a: int, b: int): 執行兩個整數的加法運算
配置
- 搜索深度設置為 "advanced",可以在代碼中根據需要調整
- MCP 服務器使用 stdio 作為傳輸方式
MCP 配置文件設定
- 在專案根目錄下的
.vscode資料夾中創建mcp.json文件 - 添加以下配置內容:
{
"type": "stdio",
"command": ["python", "search_google_agent.py"],
"title": "Tavily Search Agent",
"env": {
"PYTHONPATH": "${workspaceFolder}"
}
}
配置說明:
type: 使用 stdio 作為通信方式command: 指定要執行的 Python 文件title: MCP 服務的顯示名稱env: 設定環境變數,確保 Python 可以正確找到模組
注意事項
- 請確保您有有效的 Tavily API 金鑰
- 環境變數文件 (.env) 不應提交到版本控制系統
Quick Start
Clone the repository
git clone https://github.com/kcf7012/tavily-searchInstall dependencies
cd tavily-search
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.