Skip to main content
Glama

Tavily Web Search MCP Server

by BQ31X
server.py1.23 kB
from dotenv import load_dotenv from mcp.server.fastmcp import FastMCP from tavily import TavilyClient import os from dice_roller import DiceRoller from Reference.tardis import TardisEpisodeLookup from Reference.adventure_game import play_adventure_game load_dotenv() mcp = FastMCP("mcp-server") client = TavilyClient(os.getenv("TAVILY_API_KEY")) @mcp.tool() def web_search(query: str) -> str: """Search the web for information about the given query""" search_results = client.get_search_context(query=query) return search_results @mcp.tool() def roll_dice(notation: str, num_rolls: int = 1) -> str: """Roll the dice with the given notation""" roller = DiceRoller(notation, num_rolls) return str(roller) """ Add your own tool here, and then use it through Cursor! """ @mcp.tool() def doctor_who_episode_info(query: str) -> str: """Get information about a specific Doctor Who episode""" return str(TardisEpisodeLookup(query)) @mcp.tool() def adventure_game(command: str = "look") -> str: """Play an interactive text adventure game. Use commands like 'look', 'go north', 'take sword', 'help'""" return play_adventure_game(command) if __name__ == "__main__": mcp.run(transport="stdio")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BQ31X/MCP-Session-Code'

If you have feedback or need assistance with the MCP directory API, please join our Discord server