mcp-calculator
by mitvvce-mdot
README.md
# MCP Calculator Server
A simple [Model Context Protocol](https://modelcontextprotocol.io) server that exposes basic calculator tools. Built with the official [`mcp`](https://pypi.org/project/mcp/) Python SDK and [FastMCP](https://py.sdk.modelcontextprotocol.io/).
## Tools
| Tool | Description |
|------|-------------|
| `add` | Add two numbers |
| `subtract` | Subtract one number from another |
| `multiply` | Multiply two numbers |
| `divide` | Divide one number by another |
| `power` | Raise a number to a power |
| `square_root` | Compute the square root of a number |
## Setup
Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).
```bash
cd mcp-calculator
uv sync
```
## Run
Start the server (stdio transport, default for MCP clients like Cursor):
```bash
uv run calculator_server.py
```
For HTTP transport (e.g. MCP Inspector), change the last line of `calculator_server.py` to `mcp.run(transport="streamable-http")` and connect to `http://localhost:8000/mcp`.
## Cursor configuration
Add this to your Cursor MCP settings:
```json
{
"mcpServers": {
"calculator": {
"command": "uv",
"args": [
"run",
"--directory",
"/Users/premithun/Downloads/cursor_projects/mcp-calculator",
"calculator_server.py"
]
}
}
}
```
Replace the `--directory` path with the absolute path to this project on your machine.
TDQS
A3.8/5.0
Scored across 6 tools
Disambiguation5/5
Each tool performs a unique mathematical operation (add, subtract, multiply, divide, power, square root) with no overlap.
Naming Consistency5/5
All tool names are single-word or underscore-separated (e.g., square_root), using consistent imperative verbs.
Tool Count5/5
Six tools cover essential arithmetic plus power and square root, appropriate for a basic calculator.
Completeness4/5
Covers addition, subtraction, multiplication, division, exponentiation, and square root. Missing common operations like modulus or floor division, but reasonable for a simple calculator.
Maintenance
ActivityStale
ResponsivenessNo issues