home / mcp / calculator mcp server

Calculator MCP Server

Provides arithmetic calculation capabilities to AI models via MCP with safe evaluation for basic operations.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "functicons-calculator-mcp-server": {
      "command": "./start-mcp-server.sh",
      "args": []
    }
  }
}

The Calculator MCP Server provides a dedicated backend for arithmetic computations that you can access via the Model Context Protocol (MCP). By delegating numerical calculations to this server, you ensure accurate results for mathematical queries within your AI workflows while keeping the evaluation safe and isolated.

How to use

You interact with the Calculator MCP Server through MCP by invoking the calculator_tool to evaluate arithmetic expressions. Use it to offload calculations from your LLM host or orchestration layer. Typical usage patterns include handling user queries that require precise numeric results, verifying intermediate calculations during complex reasoning, and ensuring consistent numeric outputs across different sessions.

How to install

Prerequisites you need before starting the server are installed Docker, bash, and Python 3.12 for understanding the code (not strictly required when you run everything in Docker). You will also use the provided helper scripts to build, run, and test the MCP server.

# Step 1: Ensure prerequisites
# Docker is installed on your system
# Bash is available
# Python 3.12 is installed (optional for local code exploration)

# Step 2: Start the server environment
./build-image.sh
./start-mcp-server.sh

# Step 3: Run tests to verify the server is reachable
./run-tests.sh
```} ,{

Additional notes

The server is designed to run as a Docker container and exposes its MCP endpoint on port 8000 by default. It uses the official MCP Python SDK and implements a single MCP tool named calculator_tool that accepts a string-based arithmetic expression and returns the calculated result. If you want to test the server locally without modifying your client, you can use the provided test scripts to interact with the server after it has started.

Available tools

calculator_tool

Accepts a string-based arithmetic expression and returns the calculated numerical result. This tool enables LLMs to offload math queries to ensure precise evaluations for expressions like 3.8 - 3.11 or 10 * (2 + 3) - 5 / 2.