Calculator MCP Server
Calculator MCP Server
A Model Context Protocol (MCP) server built with FastMCP that exposes a
calculator as a set of tools, resources, and prompts for use by an LLM
client.
Tools
Basic:
add,subtract,multiply,divideAdvanced:
power,square_root,percentage
Each tool validates its inputs (division by zero, negative square roots, undefined powers, zero-denominator percentages) and returns a formatted string, and logs every successful calculation to an in-memory history.
Resources
constants://math— pi, e, the golden ratio, and tauhistory://calculations— a chronological log of every calculation made during the current session
Prompts
solve_equation(problem)— walks a word problem step by step, directing the model to use the calculator tools for arithmeticcalculation_help(topic)— explains which tools/resources are relevant to a topic, with a worked example
Running it
uv sync
uv run python calculator_server.pyPoint an MCP client (e.g. Claude Desktop, or an MCP inspector) at that command over stdio.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/JamaalDavis/calculator-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server