MCP-Mathematics
A comprehensive Model Context Protocol (MCP) server that turns any AI assistant into a powerful mathematical computation engine.
claude mcp add --transport stdio shsharkar-mcp-mathematics uvx mcp-mathematics
How to use
MCP Mathematics turns any MCP-compatible AI into a secure, production-ready mathematical computation engine. It supports a rich feature set including 52 built-in mathematical functions, 158 unit conversions across 15 categories, and comprehensive financial calculations. The server evaluates expressions using Python's Abstract Syntax Tree (AST) to prevent code injection while preserving full mathematical capability, making it suitable for use in live assistants and analytics workflows. You can perform single expressions or run batch computations, convert units across domains, and compute financial metrics all within a single, consistent interface.
The available tools expose domain-specific capabilities through clearly named functions like evaluate_mathematical_expression for single expressions, evaluate_multiple_mathematical_expressions for parallel processing, and numerous helper utilities for conversions and advanced math. Typical usage involves sending a string expression such as sin(pi/2) or compound_interest(principal, rate, years) and receiving a precise numeric result or a structured response with detailed breakdowns depending on the function used. Practically, you can quickly compute derivatives, trigonometric values, logarithms, unit conversions, and financial calculations, all while relying on a safe execution sandbox.
How to install
Prerequisites:
- Python 3.10 or later installed on your system
- An MCP-compatible AI assistant or client to connect to the MCP server (e.g., Claude Desktop, VS Code with Continue, or similar)
Installation options:
Option 1: Quick Install with uv (Recommended)
- Install the uv package manager if you haven't already curl -LsSf https://astral.sh/uv/install.sh | sh
- Install and run MCP Mathematics uvx mcp-mathematics
Option 2: Traditional pip Installation
- Install the package via pip pip install mcp-mathematics
- Run the server as appropriate for your environment (e.g., via your MCP client configuration)
Option 3: Development Installation
- Clone the repository and install in editable mode git clone https://github.com/SHSharkar/MCP-Mathematics.git cd MCP-Mathematics pip install -e .
Package Information: mcp-mathematics on PyPI (https://pypi.org/project/mcp-mathematics)
Additional notes
Tips and notes:
- Security: The server uses AST-based evaluation to prevent code injection. Ensure you keep runtime environments isolated if running in multi-tenant setups.
- Environment variables: The project may support configuration via environment variables in production; consult the codebase or docs for any VARNAME placeholders.
- Configuring clients: For Claude Desktop, VS Code with Continue, or other MCP clients, use the recommended command (uvx mcp-mathematics) or install via pip and point the client to the local/mapped endpoint.
- Troubleshooting: If calculations fail or you see unexpected results, check that the expression uses supported functions and that the server is running the correct version of the package. Ensure proper connectivity between your MCP client and the server.
- Services and scaling: The design includes thread-safe operations and a timer-based timeout system; monitor resource usage if handling large batches or high-concurrency workloads.
Related MCP Servers
MCP-Bridge
A middleware to provide an openAI compatible endpoint that can call MCP tools
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
mcp
🤖 Taskade MCP · Official MCP server and OpenAPI to MCP codegen. Build AI agent tools from any OpenAPI API and connect to Claude, Cursor, and more.
mcp-flight-search
MCP Server implementation for the Model Context Protocol (MCP) enabling AI tool usage - Realtime Flight Search
asterisk
Asterisk Model Context Protocol (MCP) server.
symfony
A Symfony package designed for building secure servers based on the Model Context Protocol, utilizing Server-Sent Events (SSE) and/or StreamableHTTP for real-time communication. It offers a scalable tool system tailored for enterprise-grade applications.