Calculator MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Calculator MCP Servercalculate 45 times 12 plus 30"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Calculator MCP Server
A minimal, fully functional Model Context Protocol (MCP) server written in Python using the official mcp>=2.0 SDK.
This repository serves as a clear reference implementation for understanding:
How Python type annotations and docstrings generate JSON Schema for AI agents.
Local IPC pipes (
stdio) vs. modern cloud transport (streamable-http).Direct JSON-RPC 2.0 handshake and tool invocation.
Tools Implemented
add(a, b): Adds two numbers.subtract(a, b): Subtractsbfroma.multiply(a, b): Multiplies two numbers.divide(a, b): Dividesabyb(with divide-by-zero validation).
Related MCP server: Simple Calculator MCP Server
Quickstart
1. Installation
Ensure you have uv installed:
git clone https://github.com/yuntaozhang999/calculator-mcp.git
cd calculator-mcp
uv sync2. Local Interactive Inspection (stdio)
Run the MCP Inspector to test the tools via a web UI:
uv run mcp dev server.py3. Headless stdio Mode
Run directly in headless mode for AI agents (AGY, Claude Code):
uv run mcp run server.pyRunning as a Cloud Service (streamable-http)
To run as an HTTP microservice on port 8000:
# In server.py:
if __name__ == "__main__":
mcp.run(transport="streamable-http", host="127.0.0.1", port=8000)Start the service:
uv run python server.pyTesting with curl
Initialize session and extract the
Mcp-Session-Idheader:
curl -i -X POST http://127.0.0.1:8000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'List available tools:
curl -X POST http://127.0.0.1:8000/mcp \
-H "Content-Type: application/json" \
-H "Mcp-Session-Id: <YOUR_SESSION_ID>" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'Execute tool call:
curl -X POST http://127.0.0.1:8000/mcp \
-H "Content-Type: application/json" \
-H "Mcp-Session-Id: <YOUR_SESSION_ID>" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"add","arguments":{"a":100,"b":250}}}'License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Math.js MCP — wraps the mathjs.org API (free, no auth)
Tested financial & practical calculators as free, no-auth MCP tools for AI agents.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- FlicenseDqualityDmaintenanceProvides basic mathematical operations (addition, subtraction, multiplication, division) through a calculate tool. Supports both stdio and HTTP/SSE transport modes.110 npm-
- AlicenseNot gradedqualityDmaintenanceEnables basic arithmetic operations (add, subtract, multiply, divide, modulo) via natural language, with a FastMCP-based server and client for exploring MCP tool calling.MIT
- FlicenseNot gradedqualityDmaintenanceA stateless MCP server that exposes arithmetic operations (add, subtract, multiply, divide) as tools over HTTP, enabling AI assistants to perform basic calculations conversationally.-
- AlicenseAqualityBmaintenanceProvides basic arithmetic operations (add, subtract, multiply, divide) through MCP, enabling AI clients to perform calculations via natural language.47 npmMIT