Skip to main content
Glama
mitvvce-mdot

mcp-calculator

by mitvvce-mdot

MCP Calculator Server

A simple Model Context Protocol server that exposes basic calculator tools. Built with the official mcp Python SDK and FastMCP.

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.

cd mcp-calculator
uv sync

Run

Start the server (stdio transport, default for MCP clients like Cursor):

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:

{
  "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.