MCP塔维利

中文詳細
Tavily API 的模型上下文协议 (MCP) 服务器实现,提供高级搜索和内容提取功能。
特征
与 MCP 一起使用
将 Tavily MCP 服务器添加到您的 MCP 配置中:
{
"mcpServers": {
"tavily": {
"command": "npx",
"args": ["-y", "@mcptools/mcp-tavily"],
"env": {
"TAVILY_API_KEY": "your-api-key"
}
}
}
}
注意:请确保将your-api-key替换为你的实际 Tavily API 密钥。你也可以在运行服务器之前将其设置为环境变量TAVILY_API_KEY 。
Related MCP server: Deep Research MCP Server
API 参考
搜索工具
服务器提供了三种可以通过MCP调用的搜索工具:
1. 基本搜索
// Tool name: search
{
query: "artificial intelligence",
options: {
searchDepth: "advanced",
topic: "news",
maxResults: 10
}
}
2. 上下文搜索
// Tool name: searchContext
{
query: "latest developments in AI",
options: {
topic: "news",
timeRange: "week"
}
}
3. 问答搜索
// Tool name: searchQNA
{
query: "What is quantum computing?",
options: {
includeAnswer: true,
maxResults: 5
}
}
提取工具
// Tool name: extract
{
urls: ["https://example.com/article1", "https://example.com/article2"],
options: {
extractDepth: "advanced",
includeImages: true
}
}
搜索选项
所有搜索工具都具有以下选项:
interface SearchOptions {
searchDepth?: "basic" | "advanced"; // Search depth level
topic?: "general" | "news" | "finance"; // Search topic category
days?: number; // Number of days to search
maxResults?: number; // Maximum number of results
includeImages?: boolean; // Include images in results
includeImageDescriptions?: boolean; // Include image descriptions
includeAnswer?: boolean; // Include answer in results
includeRawContent?: boolean; // Include raw content
includeDomains?: string[]; // List of domains to include
excludeDomains?: string[]; // List of domains to exclude
maxTokens?: number; // Maximum number of tokens
timeRange?: "year" | "month" | "week" | "day" | "y" | "m" | "w" | "d"; // Time range for search
}
提取选项
interface ExtractOptions {
extractDepth?: "basic" | "advanced"; // Extraction depth level
includeImages?: boolean; // Include images in results
}
响应格式
所有工具都以以下格式返回响应:
{
content: Array<{
type: "text",
text: string
}>
}
对于搜索结果,每项包括:
对于提取的内容,每项包括:
错误处理
所有工具都包含适当的错误处理,如果出现问题,将会抛出描述性错误消息。
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Tavily API 服务器:
npx -y @smithery/cli install @kshern/mcp-tavily --client claude
手动安装
npm install @mcptools/mcp-tavily
或者直接通过 npx 使用:
先决条件
Node.js 16 或更高版本
npm 或 yarn
Tavily API 密钥(从Tavily获取)
设置
克隆存储库
安装依赖项:
设置您的 Tavily API 密钥:
export TAVILY_API_KEY=your_api_key
建筑
使用 MCP Inspector 进行调试
对于开发和调试,我们建议使用MCP Inspector ,它是 MCP 服务器的强大开发工具。
检查器提供了以下用户界面:
测试工具调用
查看服务器响应
调试工具执行
监控服务器状态
贡献
欢迎贡献代码!欢迎提交 Pull 请求。
分叉存储库
创建你的功能分支( git checkout -b feature/AmazingFeature )
提交您的更改( git commit -m 'Add some AmazingFeature' )
推送到分支( git push origin feature/AmazingFeature )
打开拉取请求
执照
该项目已获得 MIT 许可。
支持
如有任何疑问或问题: