Calculator MCP Server
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 MCP Server Convert 100 degrees Fahrenheit to Celsius"
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 (Python)
A feature-rich Model Context Protocol (MCP) server for mathematical calculations, scientific functions, unit conversions, financial metrics, and statistical analysis.
Built with Python 3.10+, the official mcp SDK (FastMCP), and sympy. Supports both stdio (Claude Desktop) and sse (Claude Web / Remote HTTP Connectors) transport modes.
🚀 Features & Exposed Tools
evaluate_math_expression: Evaluates custom mathematical expressions safely using SymPy (e.g.2 * (3 + 4),sqrt(144) + sin(pi / 2),log(100, 10),5^3).perform_arithmetic: Basic arithmetic (add,subtract,multiply,divide) on arrays of numbers.scientific_calculation: Powers, roots (sqrt,cbrt), factorials, logarithms (log,ln), and trigonometric functions (sin,cos,tan).convert_unit: Physical unit conversions (Length, Mass/Weight, Temperature, Volume, Time).financial_calculator: Simple interest, Compound interest, Loan EMI calculations, and Percentages.calculate_statistics: Summary statistics (mean,median,mode,variance,stdev,summary).
Related MCP server: MCP Mathematics
📦 Installation & Setup
Install Dependencies:
pip install -r requirements.txt pip install -e .Run Automated Unit Tests:
pytest
💻 1. Connecting to Claude Desktop (Stdio Mode)
Your claude_desktop_config.json has been automatically created at:
C:\Users\ADMIN\AppData\Roaming\Claude\claude_desktop_config.json
{
"mcpServers": {
"calculator": {
"command": "C:\\Users\\ADMIN\\AppData\\Local\\Programs\\Python\\Python312\\python.exe",
"args": [
"-m",
"calculator_mcp.server"
],
"env": {
"PYTHONPATH": "E:/mcp tutorials"
}
}
}
}Usage in Claude Desktop:
Fully exit and restart Claude Desktop.
Open a chat and look for the 🔨 (hammer/tools icon) at the bottom right of the message bar.
Ask Claude: "What is sqrt(144) + sin(pi / 2)?" or "Convert 100 degC to degF".
🌐 2. Connecting to Claude Web & Remote Web Clients (SSE HTTP Mode)
To run the Calculator MCP as a web HTTP service (for web-based platforms, web connectors, or remote AI agents):
Start the SSE Web Server:
python -m calculator_mcp.server --transport sse --port 8000Web Client Configuration:
{ "mcpServers": { "calculator-web": { "serverUrl": "http://localhost:8000/sse" } } }Public Tunneling for Remote Web Apps (Optional): If your web client (like remote Claude Web) is hosted outside your local network, expose port 8000 using
ngrokorlocaltunnel:npx localtunnel --port 8000 # Or using ngrok: ngrok http 8000Then use the generated public HTTPS URL:
https://<your-subdomain>.loca.lt/ssein your Web MCP connector configuration.
🔍 Interactive Testing via Web Interface (MCP Inspector)
You can launch the official Model Context Protocol interactive Web Inspector UI to visually test all tools in your browser:
mcp dev calculator_mcp/server.pyOr via Node:
npx @modelcontextprotocol/inspector@0.4.1 python -m calculator_mcp.serverAvailable Tools
6 toolscalculate_statisticsARead-onlyIdempotent
Calculate statistical summaries for a dataset of numbers.
Args: operation: 'mean', 'median', 'mode', 'variance', 'stdev', or 'summary' data: List of numerical observations
Inputs: data (required), operation (required). Returns: result
convert_unitARead-onlyIdempotent
Convert quantities between physical units (length, weight/mass, temperature, volume, time).
Examples:
convert_unit(100, "degC", "degF") -> Fahrenheit
convert_unit(5, "km", "miles") -> Miles
convert_unit(2, "hours", "sec") -> Seconds
Args: value: Numerical value to convert from_unit: Source unit string (e.g., 'km', 'miles', 'kg', 'lbs', 'degC', 'degF', 'hr', 'sec') to_unit: Target unit string
Inputs: value (required), to_unit (required), from_unit (required). Returns: result
evaluate_math_expressionARead-onlyIdempotent
Evaluate complex mathematical expressions safely.
Supports addition, subtraction, multiplication, division, exponents (^ or **), roots (sqrt, cbrt), trigonometric functions (sin, cos, tan), logarithms (log, log10, ln), and constants (pi, e).
Args: expression: The mathematical expression string (e.g., '2 * (3 + 4)', 'sqrt(144) + sin(pi / 2)', '5^3') precision: Number of decimal digits of precision for symbolic evaluation (default 10)
Inputs: expression (required), precision. Returns: result
financial_calculatorARead-onlyIdempotent
Calculate financial metrics like Simple Interest, Compound Interest, Loan EMI, and Percentages.
Args: calc_type: 'simple_interest', 'compound_interest', 'loan_emi', or 'percentage' principal: Principal loan/investment amount (or base value for percentage) rate: Annual interest rate in percent (e.g., 7.5 for 7.5%) time: Duration in years compounding_frequency: Times per year compounding occurs (1=annual, 4=quarterly, 12=monthly) amount: Optional secondary parameter
Inputs: calc_type (required), rate, time, amount, +2 more. Returns: result
perform_arithmeticBRead-onlyIdempotent
Perform basic arithmetic on a list of numbers.
Args: operation: 'add', 'subtract', 'multiply', or 'divide' numbers: List of numbers to operate on in sequence
Inputs: numbers (required), operation (required). Returns: result
scientific_calculationARead-onlyIdempotent
Perform scientific mathematical calculations.
Args: operation: 'power', 'sqrt', 'cbrt', 'factorial', 'sin', 'cos', 'tan', 'log', 'ln' value: Primary number input (for trig functions, value is in degrees if secondary_value is 1, else radians) secondary_value: Exponent for power, base for log, or 1 to indicate degree mode for trig functions
Inputs: value (required), operation (required), secondary_value. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
There is significant overlap between evaluate_math_expression, perform_arithmetic, and scientific_calculation. An agent could compute the same result via multiple tools (e.g., sqrt via expression or scientific_calculation), making tool selection ambiguous. The boundaries between expression evaluation, basic arithmetic, and scientific operations are not clearly defined.
Naming is inconsistent: some tools follow verb_noun (evaluate_math_expression, perform_arithmetic, convert_unit, calculate_statistics) while others are adjective_noun (scientific_calculation, financial_calculator). This mixed convention breaks predictability and could cause confusion about the tool's primary action.
With 6 tools covering math expressions, arithmetic, scientific operations, unit conversion, finance, and statistics, the count is well-scoped for a comprehensive calculator server. Each tool addresses a distinct domain, and the number is neither too thin nor bloated.
The tool set covers a broad range of calculation needs, from basic arithmetic to scientific, financial, and statistical operations. Minor gaps exist (e.g., no modulus, percentile, or matrix support), but for a general-purpose calculator the surface is largely complete and usable.
Maintenance
Related MCP Connectors
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
MCPCalc gives agents access to a comprehensive library of calculators spanning finance, math, health, construction, engineering, food, automotive, and more. It includes a full Computer Algebra System (CAS) and a grid-based Spreadsheet calculator.
MCP server for aerospace calculations: orbital mechanics, ephemeris, DSN operations, ...
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server that enables file operations, mathematical calculations with unit conversions, and system information retrieval. Provides secure access to local file system, calculator functions with statistics, and system monitoring capabilities.8 npmISC
- AlicenseCqualityDmaintenanceA comprehensive MCP server that turns any AI assistant into a powerful mathematical computation engine, providing 52 advanced functions, 158 unit conversions, financial calculations, and secure AST-based evaluation.1816MIT
- AlicenseAqualityDmaintenanceA symbolic mathematics MCP server supporting calculus, linear algebra, number theory, statistics, and unit conversion via natural language.8MIT
- FlicenseBqualityDmaintenanceA comprehensive MCP server providing basic and advanced math operations (addition, subtraction, statistics, etc.) as well as smart prompts for multiplication tables, equation solving, financial calculations, geometry, unit conversion, loan amortization, probability, and fitness analytics.231-