Mathematical MCP Server
Click on "Install 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., "@Mathematical MCP ServerCalculate (12 + 8) * 3 / 2"
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.
Mathematical MCP Server
A small, secure Model Context Protocol (MCP) server that exposes 6 basic mathematical tools to any MCP-compatible AI client (e.g., Claude Desktop, Cursor, VS Code).
Built using Python, FastMCP, Pydantic, and SymPy, this server performs basic arithmetic and safe symbolic expression evaluation.
Features
Standardized Structured Responses: Returns structured JSON responses containing
success,result(properly serialized to JSON-friendly types),error, andexecution_time_ms.Input Validation: Enforces strict type checking using Pydantic.
Safe Expression Evaluation: Parses and evaluates string equations (e.g.,
(5+7)*9/3) using a secure whitelist-based SymPy AST walker.Robust Error Handling: Intercepts and formats errors like division-by-zero and complex roots.
Strict I/O Logging: Automatically logs incoming requests, runtime arguments, execution speeds, and errors strictly to
stderrto preserve stdout for MCP JSON-RPC protocol transport.
Related MCP server: Math Operations MCP Server
Folder Structure
Calculator_MCP_Server/
├── config.py # Computational boundaries and whitelists
├── schemas.py # Pydantic response models
├── utils.py # Logging configurations and tool execution wrappers
├── calculator.py # Pure mathematical algorithms
├── tools.py # MCP tools definitions and binding using FastMCP
├── server.py # Application entry point
├── requirements.txt # Python dependencies
├── pyproject.toml # Formatter (black/ruff) and pytest config
├── .gitignore # Git files pattern exclusions
└── tests/
├── test_calculator.py # Unit tests for core algorithms
└── test_tools.py # Integration tests for tool wrappersInstallation & Setup
1. Prerequisites
Python 3.12+
pip (Python package installer)
2. Set Up Virtual Environment
Clone this repository and navigate into the folder:
cd Calculator_MCP_ServerCreate a virtual environment:
# On Windows
python -m venv .venv
.venv\Scripts\activate
# On macOS/Linux
python3 -m venv .venv
source .venv/bin/activate3. Install Dependencies
pip install -r requirements.txtRunning the MCP Server
The server communicates via standard I/O (stdio) by default, making it ideal for local LLM integrations.
# Run server
python server.pyTo run with live reloading and access the MCP Inspector web interface (ideal for testing tools in the browser):
fastmcp dev server.pyConnecting to MCP Clients
Claude Desktop
To integrate this mathematical server with Claude Desktop, add it to your configuration file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add the following to the mcpServers object:
{
"mcpServers": {
"math-server": {
"command": "python",
"args": [
"c:/Users/Admin/OneDrive/Documents/Projects/Calculator_MCP_Server/server.py"
],
"env": {
"LOG_LEVEL": "INFO",
"MAX_FACTORIAL_N": "10000"
}
}
}
}Note: Make sure to specify the absolute path to your Python executable if it's not globally available in your environment's PATH.
Available Tools
add(a, b): Returns $a + b$.subtract(a, b): Returns $a - b$.multiply(a, b): Returns $a \times b$.divide(a, b): Returns $a / b$ (raises division-by-zero errors).power(base, exponent): Returns $base^{exponent}$ (handles negative bases/exponent calculations).evaluate_expression(expression): Safely parses and evaluates mathematical expression strings (e.g.(5+7)*9/3). Supports basic math operators and trigonometric/root functions.
Example AI Prompts
You can write naturally to any MCP client equipped with this server:
"What is 567 × 897?" (calls
multiply)"What is 2 raised to the power of 10?" (calls
power)"Calculate (12 + 8) * 3 / 2" (calls
evaluate_expression)"What is sin(0) + cos(0)?" (calls
evaluate_expression)
Testing
To run the automated tests:
pytestTo run with coverage or verbose mode:
pytest -vFuture Improvements
Caching Layer: Cache expensive symbolic evaluations and factorial queries.
Extended Solvers: Implement solvers for cubic equations and system of linear equations (using SymPy's
linsolve).Advanced Matrix Algorithms: Eigenvalue and eigenvector calculations using NumPy/SciPy.
Calculus Tools: Symbolic derivative and integration tools.
License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA simple educational MCP server providing basic math operations, string manipulation, and greeting functionality. Demonstrates how to implement MCP tools for learning purposes.Last updated
- Alicense-qualityDmaintenanceEnables mathematical operations and calculations through an MCP server interface. Provides computational capabilities accessible via HTTP endpoints for mathematical processing tasks.Last updatedMIT
- FlicenseAqualityDmaintenanceA basic MCP server built with the FastMCP framework that provides fundamental mathematical operations like addition, subtraction, multiplication, and division. It serves as a demonstration for integrating math-based tools into MCP-compatible environments like Cursor IDE.Last updated4
- AlicenseCqualityCmaintenanceA 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.Last updated1810MIT
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
A basic MCP server to operate on the Postman API.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/deepa11042004/Calculator_MCP_Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server