Calculator MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add calculator-mcp-server -- uvx --from . --with mcp calculator-mcp-server
README.md

A mathematical utility server implementing the Model Context Protocol

Calculator MCP Server

A simple calculator server implementing the Model Context Protocol (MCP).

Features

This MCP server provides the following calculator operations:

  • add: Add two numbers together
  • subtract: Subtract second number from first
  • multiply: Multiply two numbers
  • divide: Divide first number by second (with zero-check)
  • power: Raise a number to a power
  • sqrt: Calculate square root
  • percentage: Calculate percentage of a number

Installation

Using uv (recommended)

The easiest way is to use uvx which was just installed:

# Test the server directly
export PATH="$HOME/.local/bin:$PATH"
uvx --from . --with mcp calculator-mcp-server

Manual Installation with pip

If you prefer pip, install in a virtual environment:

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install git+https://github.com/modelcontextprotocol/python-sdk.git

# Run the server
python calculator_mcp_server.py

Configuration

Add this to your Kiro MCP configuration file (.kiro/settings/mcp.json):

{
  "mcpServers": {
    "calculator": {
      "command": "/Users/anshikagupta/.local/bin/uvx",
      "args": ["--from", "/Users/anshikagupta/calculator", "--with", "mcp", "python", "calculator_mcp_server.py"],
      "disabled": false,
      "autoApprove": ["add", "subtract", "multiply", "divide", "power", "sqrt", "percentage"]
    }
  }
}

Usage Examples

Once configured, you can use the calculator through Kiro:

  • "Add 5 and 3"
  • "What's 10 divided by 2?"
  • "Calculate 2 to the power of 8"
  • "What's the square root of 144?"
  • "Calculate 20% of 500"

Tools Available

add

Add two numbers together.

  • Parameters: a (number), b (number)
  • Example: {"a": 5, "b": 3} → "5 + 3 = 8"

subtract

Subtract second number from first.

  • Parameters: a (number), b (number)
  • Example: {"a": 10, "b": 3} → "10 - 3 = 7"

multiply

Multiply two numbers.

  • Parameters: a (number), b (number)
  • Example: {"a": 4, "b": 5} → "4 × 5 = 20"

divide

Divide first number by second.

  • Parameters: a (number), b (number)
  • Example: {"a": 20, "b": 4} → "20 ÷ 4 = 5"

power

Raise base to exponent.

  • Parameters: base (number), exponent (number)
  • Example: {"base": 2, "exponent": 8} → "2^8 = 256"

sqrt

Calculate square root.

  • Parameters: number (number, non-negative)
  • Example: {"number": 144} → "√144 = 12"

percentage

Calculate percentage of a number.

  • Parameters: number (number), percent (number)
  • Example: {"number": 500, "percent": 20} → "20% of 500 = 100"

License

MIT

Tools (7)

addAdd two numbers together.
subtractSubtract second number from first.
multiplyMultiply two numbers.
divideDivide first number by second.
powerRaise base to exponent.
sqrtCalculate square root.
percentageCalculate percentage of a number.

Configuration

claude_desktop_config.json
{"mcpServers": {"calculator": {"command": "/Users/anshikagupta/.local/bin/uvx", "args": ["--from", "/Users/anshikagupta/calculator", "--with", "mcp", "python", "calculator_mcp_server.py"], "disabled": false, "autoApprove": ["add", "subtract", "multiply", "divide", "power", "sqrt", "percentage"]}}}

Try it

Add 5 and 3
What's 10 divided by 2?
Calculate 2 to the power of 8
What's the square root of 144?
Calculate 20% of 500

Frequently Asked Questions

What are the key features of Calculator MCP Server?

Perform basic arithmetic operations like addition, subtraction, multiplication, and division. Calculate powers of numbers. Compute square roots. Calculate percentages of given numbers. Implements the Model Context Protocol for seamless integration.

What can I use Calculator MCP Server for?

Quickly solving complex math problems during a chat session. Verifying calculations while writing technical documentation. Automating repetitive numerical tasks within an AI-assisted workflow.

How do I install Calculator MCP Server?

Install Calculator MCP Server by running: uvx --from . --with mcp calculator-mcp-server

What MCP clients work with Calculator MCP Server?

Calculator MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Calculator MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare