mcp server of tavily
A Model Context Protocol (MCP) server implementation for Tavily API, providing advanced search and content extraction capabilities.
search
: Basic search functionality with customizable optionssearchContext
: Context-aware search for better relevancesearchQNA
: Question and answer focused searchAdd the Tavily MCP server to your MCP configuration:
{
"mcpServers": {
"tavily": {
"command": "npx",
"args": ["-y", "@mcptools/mcp-tavily"],
"env": {
"TAVILY_API_KEY": "your-api-key"
}
}
}
}
Note: Make sure to replace
your-api-key
with your actual Tavily API key. You can also set it as an environment variableTAVILY_API_KEY
before running the server.
The server provides three search tools that can be called through MCP:
// Tool name: search
{
query: "artificial intelligence",
options: {
searchDepth: "advanced",
topic: "news",
maxResults: 10
}
}
// Tool name: searchContext
{
query: "latest developments in AI",
options: {
topic: "news",
timeRange: "week"
}
}
// 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
}
}
All search tools share these options:
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
}
All tools return responses in the following format:
{
content: Array<{
type: "text",
text: string
}>
}
For search results, each item includes:
For extracted content, each item includes:
All tools include proper error handling and will throw descriptive error messages if something goes wrong.
To install Tavily API Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @kshern/mcp-tavily --client claude
npm install @mcptools/mcp-tavily
Or use it directly with npx:
npx @mcptools/mcp-tavily
npm install
export TAVILY_API_KEY=your_api_key
npm run build
For development and debugging, we recommend using MCP Inspector, a powerful development tool for MCP servers.
The Inspector provides a user interface for:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)This project is licensed under the MIT License.
For any questions or issues: