MCP塔维利
](https://smithery.ai/server/@kshern/mcp-tavily)
Tavily API的模型上下文协议(MCP)服务器实现,提供高级搜索和内容提取功能。
特性
- 多种搜索工具:
- search:具有可自定义选项的基本搜索功能 - searchContext:上下文感知搜索以获得更好的相关性 - searchQNA:以问答为中心的搜索
- 内容提取:使用可配置选项从URL中提取内容
- 丰富的配置选项:搜索深度、过滤和内容包含的广泛选项
使用MCP
将Tavily MCP服务器添加到您的MCP配置中:
{
"mcpServers": {
"tavily": {
"command": "npx",
"args": ["-y", "@mcptools/mcp-tavily"],
"env": {
"TAVILY_API_KEY": "your-api-key"
}
}
}
}注意:一定要更换your-api-key使用您的Tavilly API密钥。您还可以将其设置为环境变量TAVILY_API_KEY在运行服务器之前。
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
}对于搜索结果,每个项目包括:
- 标题
- 内容
- 统一资源定位符
对于提取的内容,每个项目包括:
- 统一资源定位符
- 原始内容
- 失败URL列表(如果有)
错误处理
所有工具都包含正确的错误处理,如果出现问题,将抛出描述性错误消息。
安装
通过Smithery安装
通过自动安装Tavily API Server for Claude Desktop 史密瑟里:
npx -y @smithery/cli install @kshern/mcp-tavily --client claude手动安装
npm install @mcptools/mcp-tavily或者直接与npx一起使用:
npx @mcptools/mcp-tavily先决条件
- Node.js 16或更高版本
- npm或纱线
- Tavilly API密钥(从 塔维利)
设置
- 克隆存储库
- 安装依赖项:
npm install- 设置Tavily API密钥:
export TAVILY_API_KEY=your_api_key建筑
npm run build使用MCP检查器进行调试
对于开发和调试,我们建议使用 MCP检查员,MCP服务器的强大开发工具。
Inspector提供了一个用户界面,用于:
- 测试工具调用
- 查看服务器响应
- 调试工具执行
- 监控服务器状态
贡献
欢迎投稿!请随时提交拉取请求。
- 分叉存储库
- 创建功能分支(
git checkout -b feature/AmazingFeature) - 提交您的更改(
git commit -m 'Add some AmazingFeature') - 推到分支(
git push origin feature/AmazingFeature) - 打开拉取请求
许可证
该项目根据MIT许可证获得许可。
支持
如有任何疑问或问题:

