Skip to main content
Glama
nilay320

Tavily Web Search MCP Server

by nilay320

AI Makerspace: MCP Event

This project is a demonstration of the MCP (Model Context Protocol) server, which utilizes the Tavily API for web search capabilities. The server is designed to run in a standard input/output (stdio) transport mode.

Related MCP server: Tavily Web Search MCP Server

Project Overview

The MCP server is set up to handle web search queries using the Tavily API. It is built with the following key components:

  • TavilyClient: A client for interacting with the Tavily API to perform web searches.

Prerequisites

  • Python 3.13 or higher

  • A valid Tavily API key

⚠️NOTE FOR WINDOWS:⚠️

You'll need to install this on the Windows side of your OS.

This will require getting two CLI tool for Powershell, which you can do as follows:

  • winget install astral-sh.uv

  • winget install --id Git.Git -e --source winget

After you have those CLI tools, please open Cursor into Windows.

Then, you can clone the repository using the following command in your Cursor terminal:

git clone https://github.com/AI-Maker-Space/MCP-Session-Code.git

After that, you can follow from Step 2. below!

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-directory>
  2. Configure environment variables: Copy the .env.sample to .env and add your Tavily API key:

    TAVILY_API_KEY=your_api_key_here
  3. 🏗️ Add a new tool to your MCP Server 🏗️

Create a new tool in the server.py file, that's it!

Running the MCP Server

To start the MCP server, you will need to add the following to your MCP Profile in Cursor:

NOTE: To get to your MCP config. you can use the Command Pallete (CMD/CTRL+SHIFT+P) and select "View: Open MCP Settings" and replace the contents with the JSON blob below.

{
    "mcpServers":  {
        "mcp-server": {
            "command" : "uv",
            "args" : ["--directory", "/PATH/TO/REPOSITORY", "run", "server.py"]
        }
    }
}

The server will start and listen for commands via standard input/output.

Usage

The server provides a web_search tool that can be used to search the web for information about a given query. This is achieved by calling the web_search function with the desired query string.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Available Tools

4 tools
generate_qr_codeB

Generate a QR code for the given data.

Args: data: The text or URL to encode in the QR code error_correction: Error correction level - "L" (Low ~7%), "M" (Medium ~15%), "Q" (Quartile ~25%), "H" (High ~30%) border: Size of the border (minimum is 4) box_size: Size of each box in pixels (default 10)

Returns: Base64 encoded PNG image of the QR code that can be displayed or saved

ParametersJSON Schema
NameRequiredDescriptionDefault
dataYes
error_correctionNoM
borderNo
box_sizeNo

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return format (Base64 encoded PNG image) but lacks details on performance, rate limits, error handling, or side effects. For a tool with no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by Args and Returns sections. It's appropriately sized with no redundant information, though the parameter explanations could be slightly more concise (e.g., the error correction percentages are detailed but not strictly necessary).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 4 parameters, the description is moderately complete. It covers parameters well and specifies the return format, but lacks context on behavioral aspects like error conditions or usage limits, making it adequate but with clear gaps for a tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides detailed semantic explanations for all four parameters: 'data' as text/URL to encode, 'error_correction' with levels and percentages, 'border' with minimum value, and 'box_size' with default. This adds substantial meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Generate a QR code for the given data,' which is a specific verb+resource combination. However, it doesn't differentiate from sibling tools (roll_dice, scientific_calculator, web_search) since they serve completely different domains, so sibling differentiation isn't relevant here.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, constraints, or scenarios where this tool is preferred over other methods for generating QR codes or handling the data.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

roll_diceC

Roll the dice with the given notation

ParametersJSON Schema
NameRequiredDescriptionDefault
notationYes
num_rollsNo

TDQS

C2.3/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must disclose behavioral traits. It only says 'Roll the dice,' which is a direct restatement of the tool name and adds no depth about random generation, validation, error handling, or return format. This is effectively a tautology with no added transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no waste, which is positive. However, it is under-specified: it front-loads little useful information and does not structure any context for the parameters. It cannot be considered 'appropriately sized' because it omits essential detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with two parameters, no output schema, and no annotations, the description is severely inadequate. It does not explain dice notation, the meaning of num_rolls, or any behaviors/limitations. Even the sibling context (web_search) offers no help in situating this tool, making the description insufficient for reliable tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. 'Given notation' loosely aligns with the 'notation' parameter but fails to define its format or semantics. The 'num_rolls' parameter is entirely absent from the description, leaving its purpose unexplained. Overall, minimal added meaning beyond the schema titles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear verb ('Roll') and resource ('dice'), indicating the tool's primary action. However, it does not specify what 'notation' means (e.g., standard dice notation like '2d6'), which leaves some ambiguity. It is distinct from the sibling web_search, but not explicitly differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool vs alternatives. The sibling list includes web_search, but the description gives no context for when dice rolling is appropriate or any exclusions. Users are left to infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

scientific_calculatorA

Evaluate mathematical expressions using a scientific calculator.

Supports:

  • Basic arithmetic: +, -, *, /, //, %, **

  • Scientific functions: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh

  • Logarithmic functions: log, log10, log2, ln (natural log)

  • Exponential functions: exp, sqrt, cbrt

  • Constants: pi, e, tau

  • Complex numbers: 1+2j, complex operations

  • Trigonometric functions work with radians by default

  • Use degrees(x) to convert radians to degrees, radians(x) to convert degrees to radians

Examples:

  • "sin(pi/2)" -> 1.0

  • "log10(100)" -> 2.0

  • "sqrt(16)" -> 4.0

  • "2**3" -> 8

  • "exp(1)" -> 2.718281828459045

ParametersJSON Schema
NameRequiredDescriptionDefault
expressionYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does this well by specifying the calculator's capabilities (scientific functions, complex numbers), default behavior (trigonometric functions work with radians), and conversion utilities (degrees, radians). However, it doesn't mention error handling, precision limits, or performance characteristics that would be useful for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by categorized bullet points and examples. Every sentence earns its place by providing specific, actionable information. It could be slightly more concise by combining some bullet points, but overall it's efficiently organized and front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (mathematical evaluation with many functions), no annotations, no output schema, and low schema coverage, the description does an excellent job of providing context. It covers capabilities, syntax, defaults, and examples. The main gap is the lack of information about return values or error cases, which would be helpful since there's no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage with only one parameter 'expression' of type string. The description compensates fully by providing extensive semantic context: it explains what the expression parameter should contain (mathematical notation), lists all supported operations and functions, shows syntax examples, and even provides conversion utilities. This adds significant value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Evaluate mathematical expressions using a scientific calculator' with a specific verb ('evaluate') and resource ('mathematical expressions'), distinguishing it from sibling tools like generate_qr_code, roll_dice, and web_search which have completely different domains.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through the extensive list of supported operations and examples, suggesting this tool is for mathematical evaluation. However, it doesn't explicitly state when to use this versus alternatives or provide any exclusion criteria, leaving the context somewhat implied rather than clearly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • Changedgenerate_qr_code1 field changed
      • addedInput schema / title
        Added value: +"generate_qr_codeArguments"
    • Changedroll_dice1 field changed
      • addedInput schema / title
        Added value: +"roll_diceArguments"
    • Changedscientific_calculator1 field changed
      • addedInput schema / title
        Added value: +"scientific_calculatorArguments"
    • Changedweb_search1 field changed
      • addedInput schema / title
        Added value: +"web_searchArguments"
  2. 4 tool updates
    • First observedgenerate_qr_code
    • First observedroll_dice
    • First observedscientific_calculator
    • First observedweb_search

TDQS

B3.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool serves a completely distinct purpose with no overlap: QR code generation, dice rolling, scientific calculation, and web search. An agent can easily differentiate between these unrelated functionalities, eliminating any risk of misselection.

Naming Consistency4/5

Three tools follow a consistent verb_noun pattern (generate_qr_code, roll_dice, web_search), but 'scientific_calculator' deviates as a noun_noun compound. This minor inconsistency slightly reduces predictability, though the names remain clear and readable.

Tool Count3/5

With only 4 tools, the set feels thin for a server named 'Tavily Web Search MCP Server', as web search is just one component among unrelated utilities. The count is borderline—too few to fully cover a coherent domain, suggesting a miscellaneous toolkit rather than a focused service.

Completeness2/5

For a web search server, the toolset is severely incomplete, lacking essential operations like filtering results, pagination, or retrieving specific content. The inclusion of unrelated tools (QR code, dice, calculator) further dilutes the domain, creating significant gaps that will hinder agent workflows focused on search.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    C
    quality
    D
    maintenance
    Enables web search capabilities through the Tavily API, allowing users to search the internet for information using natural language queries. Demonstrates MCP server implementation with external API integration.
    3
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables web search capabilities through the Tavily API, allowing users to search the web for information using natural language queries. Demonstrates MCP server implementation with stdio transport mode for integration with LLM applications.
    -
  • F
    license
    C
    quality
    D
    maintenance
    Enables web search capabilities through the Tavily API. Allows users to search the web for information using natural language queries through the MCP protocol.
    3
    -