calculator-mcp
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-mcpround 3.14159 to 2 decimal places"
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
calculator-mcp is a small Streamable HTTP MCP (Model Context Protocol) server
that exposes 16 arithmetic operations as callable tools for an AI LLM (Large
Language Model) to consume. It contains no math of its own — every tool is a
thin synchronous wrapper that logs its arguments and delegates to an
open-source shared math calculator calculator-lib-rubens PyPI library
package.
Features
16 calculator tools available via MCP:
Two-operand operations: add, subtract, multiply, divide, power,
nth_root, modulo, floor_divide
Single-operand operations: sqrt, absolute, floor, ceil, log10,
ln, exp
Rounding: round_number (with configurable decimal places)
Related MCP server: Simple Calculator MCP Server
AI Disclaimer
This project includes code and documentation created with the assistance of AI tools. For details on usage, limits, and review practices, please see the AI Disclaimer.
Prerequisites
Python 3.14+
pip 26.2+
curl 8.7+
Installation and Usage
IMPORTANT: It is recommended that you run pip uninstall to remove any
previously installed versions of this software from your local machine. The
application's release versioning was recently reset and to re-start again at
version 0.0.1.
Uninstall earlier possible installed release:
pip uninstall calculator-mcp-rubens # recommend to purge the cache as well pip cache purge
Installation
The calculator-mcp can be installed by running
pip install calculator-mcp-rubens. It requires python 3.14+ and pip to
run.
To install locally into the user's home environment run command below
# install "calculator-mcp" and depdencies into user local pip environment # NOTE: use --no-cache-dir to avoid issues with earlier version in cache pip --no-cache-dir install -U --user calculator-mcp-rubens --verboseConfirm installed version with most recently released GitHub version at calculator-mcp/releases
# install "calculator-mcp" and depdencies into user local pip environment pip show calculator-mcp-rubens
Usage
Running the MCP Server
Launch
calculator-mcplocally with sensible defaults:# Launches the Streamable HTTP MCP server locally at: # http://0.0.0.0:8080/mcp # The "0.0.0.0" is used because this application is meant to run from # within a Docker container, which requires the wildcard address, or # INADDR_ANY, to accept HTTP connections from outside the container. calculator-mcp
Exercise the MCP Server Endpoints
Health check
curl -v http://localhost:8080/health # Expect: OKInitialize MCP session
The MCP endpoint requires a session, established via initialize first. Run these in order:
a) Store JSON below in a local file
/tmp/initialize.json:# remove indentation spaces when copying/pasting this command to the shell cat > /tmp/initialize.json <<EOF { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": { "name": "curl-test", "version": "1.0" } } } EOFb) MCP client initializes session — grab the
Mcp-Session-Idfrom the response headers# Look for the "mcp-session-id: <SID>" header in the output curl -i http://localhost:8080/mcp \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d @/tmp/initialize.jsonc) MCP client sends the required "initialized" notification (use the SID from step b)
SID="<paste-mcp-session-id-here>" # Expect "202 Accepted" response curl -v http://localhost:8080/mcp \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "Mcp-Session-Id: $SID" \ -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'
List tools
Once you have initialized your MCP session, list all the tools:
curl -s http://localhost:8080/mcp \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "Mcp-Session-Id: $SID" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
This returns all 16 tools: add, subtract, multiply, divide, power, nth_root, modulo, floor_divide, sqrt, absolute, floor, ceil, log10, ln, exp, round_number.
Call a tool (e.g.
add)
To call one of the tools (e.g.,
add)curl -s http://localhost:8080/mcp \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "Mcp-Session-Id: $SID" \ -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"add","arguments":{"a":2,"b":3}}}'
Returns {"result": 5.0} in structuredContent. Swap name and arguments
to call any other tool, e.g.
{"name": "divide", "arguments": {"a": 15, "b": 4}}
or {"name": "sqrt", "arguments": {"a": 16}}.
Note: the same Mcp-Session-Id must be reused across steps b, c, 3, and 4
— the server ties the session to that ID.
Configuration
The server ships with a default config.yaml bundled inside the package. To
override it, set the CALCULATOR_MCP_CONFIG environment variable to the
absolute path of your custom configuration file:
export CALCULATOR_MCP_CONFIG=/path/to/your/config.yamlWhen CALCULATOR_MCP_CONFIG is not set, the bundled default is used
automatically.
The configuration file has three sections. The logging section controls Python
logging via dictConfig. The default configuration logs calculator_mcp
messages at DEBUG level to stderr.
# =============================================================================
# Server Configuration
# =============================================================================
server:
# the home page of this project
homepage: "https://github.com/rubensgomes-org/calculator-mcp"
# MCP transport: "stdio" or "http"
# http: for web services using the Streamable HTTP protocol
transport: "http"
# Host IP address for the HTTP/MCP server.
# The "0.0.0.0" is used because this application is meant to run from
# within a Docker container, which requires the wildcard address or
# NADDR_ANY to accept HTTP connections
# from outside the Docker container.
# Use 127.0.0.1 to restrict the server to localhost only.
host: "0.0.0.0"
#host: "127.0.0.1"
# Port for the HTTP/MCP server, defaults to:
port: 8080
#port: 9090
# timeout in seconds
timeout: 10
# =============================================================================
# Client Configuration
# =============================================================================
client:
# the URL the client should use when the server transport is "http"
# is_oauth: false
# url: "http://127.0.0.1:8080/mcp"
is_oauth: true
url: "https://rubens-calculator-mcp.fastmcp.app/mcp"
# location to store OAuth token
token_dir: "~/.fastmcp"
# fixed port for the OAuth callback server
callback_port: 10000
# =============================================================================
# Logging Configuration
# =============================================================================
logging:
version: 1
disable_existing_loggers: false
formatters:
standard:
format: "%(asctime)s [%(levelname)s] %(name)s: %(message)s"
handlers:
console:
class: logging.StreamHandler
formatter: standard
stream: ext://sys.stderr
loggers:
calculator_mcp:
level: DEBUG
handlers:
- console
propagate: false
# MCP protocol tracing — set to DEBUG to see full JSON-RPC messages
mcp.client.streamable_http:
level: INFO
handlers:
- console
propagate: false
# HTTP request/response summaries — set to DEBUG for detail
httpx:
level: DEBUG
handlers:
- console
propagate: false
# HTTP wire-level tracing (headers, TCP) — set to DEBUG for detail
httpcore:
level: INFO
handlers:
- console
propagate: false
# Server: inbound JSON-RPC messages — set to DEBUG to see parsed requests
mcp.server.lowlevel.server:
level: INFO
handlers:
- console
propagate: false
# Server: StreamableHTTP transport — set to DEBUG for method-level tracing
mcp.server.streamable_http:
level: INFO
handlers:
- console
propagate: false
# Server: session/transport lifecycle — set to DEBUG for session details
mcp.server.streamable_http_manager:
level: INFO
handlers:
- console
propagate: false
# Server: HTTP request lines (method, path, status)
uvicorn.access:
level: INFO
handlers:
- console
propagate: false
root:
level: WARNING
handlers:
- consoleLicense
The project is licensed under MIT License.
Author: Rubens Gomes
This server cannot be deployed
Maintenance
Related MCP Connectors
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
Tested financial & practical calculators as free, no-auth MCP tools for AI agents.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA calculator server that exposes mathematical functions as tools (add, subtract, multiply, divide, square, power, square root), enabling language models to perform calculations through Model Context Protocol (MCP).-
- 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 gradedqualityDmaintenanceAn advanced calculator MCP server that provides a wide range of mathematical operations over streamable HTTP, enabling users to perform complex calculations via natural language with any MCP client.-
- AlicenseNot gradedqualityBmaintenanceA calculator MCP server built as part of a step-by-step tutorial that demonstrates core MCP primitives—tools, resources, and prompts—and can be upgraded to a live weather server.MIT