Skip to main content
Glama

Tavily Web Search MCP Server

by nilay320
test_server.py911 B
from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client async def main(): # Connect via stdio to a local script server_params = StdioServerParameters(command="python", args=["server.py"]) async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as session: tools = await session.list_tools() print(f"Available tools: {[tool.name for tool in tools.tools]}") result = await session.call_tool("scientific_calculator", {"expression": "2 + 3 * 4"}) print(f"Calculator result: {result.content[0].text}") result = await session.call_tool("web_search", {"query": "What is the capital of France?"}) print(f"Search result: {result.content[0].text}") if __name__ == "__main__": import asyncio asyncio.run(main())

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/nilay320/MCP-Session-Code'

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