Skip to main content
Glama

MCP Calculator Server

client.py592 B
# client.py import asyncio from mcp.client.streamable_http import streamablehttp_client from mcp import ClientSession async def call_calculator(expression: str, url="http://127.0.0.1:8500"): async with streamablehttp_client(url) as (read_stream, write_stream, _): async with ClientSession(read_stream, write_stream) as session: await session.initialize() result = await session.call_tool("calculate", arguments={"payload": expression}) print("Response:", result) if __name__ == "__main__": asyncio.run(call_calculator("sqrt(25) + 2**3"))

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/linuxacademyir/calculator-mcp'

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