AgentStack
MCP unreviewed MIT Self-run

MCP Mathematics

mcp-shsharkar-mcp-mathematics · by SHSharkar

A comprehensive Model Context Protocol (MCP) server that turns any AI assistant into a powerful mathematical computation engine.

No reviews yet
0 installs
15 views
0.0% view→install

Install

$ agentstack add mcp-shsharkar-mcp-mathematics

Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.

Security review

⚠ Flagged

1 finding(s); flagged for manual review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures
  • high Pipes remote content directly into a shell (remote code execution).

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of MCP Mathematics? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

MCP Mathematics

A comprehensive Model Context Protocol (MCP) server that turns any AI assistant into a powerful mathematical computation engine. MCP Mathematics gives you professional-grade features including 52 advanced mathematical functions, 158 unit conversions across 15 categories, complete financial calculations, and secure AST-based evaluation—all in a production-ready, secure environment.

What Is MCP Mathematics?

MCP Mathematics is the most complete mathematical computation server for AI assistants, built specifically for the Model Context Protocol. This production-ready solution turns any MCP-compatible AI into a powerful mathematical tool that handles everything from simple arithmetic to complex financial calculations, unit conversions across many different fields, and advanced scientific computations.

Key Innovation: Using Python's Abstract Syntax Tree (AST) evaluation, MCP Mathematics gives you exceptional mathematical capabilities while staying completely secure—stopping code injection vulnerabilities without losing any features.

Why Choose MCP Mathematics?

Uncompromising Security

  • AST-Based Evaluation: Every calculation is checked and verified through Python's AST, which stops code injection attacks
  • Sandboxed Execution: All calculations run in a secure, controlled environment that only allows safe operations
  • Zero External Dependencies: Lower security risk since the core features don't need any external libraries

Complete Mathematical Power

  • 52 Built-In Functions: From simple math to complex scientific calculations
  • 158 Unit Conversions: Wide-ranging unit conversion support covering 15 different categories
  • Financial Calculations: Full set of financial tools including interest, loan, and tax calculations
  • Unicode Operator Support: Easy mathematical symbols like ×, ÷, and ^ that feel natural to use
  • Full Math Library Coverage: Complete access to all of Python's mathematical functions

Production-Ready Architecture

  • Type-Safe Design: Complete type checking throughout the code makes sure everything works reliably
  • Clean Production Code: Professional code with no debugging leftovers or extra comments
  • Complete Testing: 130 tests make sure all features work properly
  • Thread-Safe Operations: 100% reliable concurrent execution with Timer-based timeout system
  • Advanced Memory Management: Bounded LRU/TTL caches stop memory leaks in production environments
  • Enterprise Error Handling: Proper exception chaining and graceful resource cleanup

Getting Started

Prerequisites

Before you install MCP Mathematics, make sure you have:

  • Python 3.10 or later on your system
  • An MCP-compatible AI assistant (Claude Desktop, VS Code with Continue, or similar)

Installation Options

Choose the installation method that works best for you:

Option 1: Quick Install with uv (Recommended)

This is the fastest way to get started:

# 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

If you prefer using pip:

pip install mcp-mathematics

📦 Package Information: mcp-mathematics on PyPI

Option 3: Development Installation

If you want to help out or need the latest development version:

git clone https://github.com/SHSharkar/MCP-Mathematics.git
cd MCP-Mathematics
pip install -e .

Configuration Guide

Configuring Claude Desktop

To use MCP Mathematics with Claude Desktop, you'll need to update your configuration file.

Configuration file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
If you installed with uv:
{
  "mcpServers": {
    "mcp-mathematics": {
      "command": "uvx",
      "args": [
        "mcp-mathematics"
      ]
    }
  }
}
If you installed with pip:
{
  "mcpServers": {
    "mcp-mathematics": {
      "command": "mcp-mathematics"
    }
  }
}

Configuring VS Code with Continue

If you're using VS Code with the Continue extension:

{
  "models": [
    {
      "model": "claude-3-5-sonnet",
      "provider": "anthropic",
      "mcpServers": {
        "mcp-mathematics": {
          "command": "uvx",
          "args": [
            "mcp-mathematics"
          ]
        }
      }
    }
  ]
}

FastMCP Cloud Configuration

MCP Mathematics is available as a cloud-hosted service through FastMCP for instant access without local installation. Choose from multiple connection methods:

Connect to Claude Code

Access your tools from the command line with quick setup:

claude mcp add --scope local --transport http mathematics https://mathematics.fastmcp.app/mcp
Connect to Claude Desktop

Use your tools directly in Claude's desktop app with one-click installation:

Download Link: https://mathematics.fastmcp.app/manifest.dxt?v=aa76634e-bffb-4be5-b1fd-c680cd7f7142

Downloads .dxt file. Open the file to connect automatically.

Connect to Codex CLI

Access your tools in a Codex CLI session:

codex mcp add -- mathematics npx -y mcp-remote@latest https://mathematics.fastmcp.app/mcp
Configure Codex

Durably store your MCP via Codex's configuration file by adding this to .codex/config.toml:

[mcp_servers.mathematics]
command = "npx"
args = ["-y", "mcp-remote@latest", "https://mathematics.fastmcp.app/mcp"]
Connect to Gemini CLI

Access your tools from the command line with quick setup:

gemini mcp add mathematics https://mathematics.fastmcp.app/mcp --transport http
Connect to Cursor

AI-powered code editor with built-in tool support. Click to connect instantly:

Connection Link: [cursor://anysphere.cursor-deeplink/mcp/install?name=mathematics&config=eyJ1cmwiOiJodHRwczovL21hdGhlbWF0aWNzLmZhc3RtY3AuYXBwL21jcCJ9](cursor://anysphere.cursor-deeplink/mcp/install?name=mathematics&config=eyJ1cmwiOiJodHRwczovL21hdGhlbWF0aWNzLmZhc3RtY3AuYXBwL21jcCJ9)

FastMCP Cloud Benefits:

  • No local installation required
  • Always up-to-date with latest features
  • Enhanced performance with cloud infrastructure
  • Instant access across multiple platforms
  • Production-ready deployment

Available MCP Tools

MCP Mathematics gives you access to all its mathematical features through 21 specialized tools with descriptive, mathematical domain names for maximum clarity and memorability. Each tool is designed for specific tasks and built for excellent performance:

Core Calculation Tools

1. evaluate_mathematical_expression - Single Expression Evaluation

The main tool for working with mathematical expressions. It supports all 52 built-in functions, unit conversions, and financial calculations. It handles everything from simple arithmetic to complex scientific computations.

Use Cases:

  • Quick calculations: "2 * pi * 10""62.83185307179586"
  • Scientific computing: "sin(pi/2) + log10(1000)""4.0"
  • Financial analysis: "compound_interest(5000, 6.5, 15)" → Complete interest breakdown
  • Unit conversions: "convert_between_measurement_units(100, 'km', 'mi', 'length')" → Automatic unit detection and conversion
2. evaluate_multiple_mathematical_expressions - Parallel Processing Engine

Built to handle many expressions at the same time, giving you much better performance when doing lots of calculations or data analysis work.

Use Cases:

  • Data processing: Process arrays of financial calculations
  • Scientific analysis: Batch trigonometric computations
  • Bulk conversions: Convert multiple values simultaneously
Input: ["sin(pi/2)", "cos(0)", "sqrt(16)", "factorial(5)"]
Output: ["1.0", "1.0", "4.0", "120"]

Specialized Calculation Tools

3. convert_between_measurement_units - Advanced Unit Conversion System

Smart unit conversion system that works with 158 units across 15 categories. It automatically figures out unit types, supports different spellings, and handles complex compound units.

Advanced Features:

  • Smart detection: Automatically figures out unit categories
  • Alias support: Accepts multiple spellings and abbreviations
  • Compound units: Handles complex units like m/s², kg·m/s²
  • History tracking: Keeps a conversion audit trail
Input: value=100, from_unit="meters", to_unit="feet"
Output: "328.084" (with automatic precision handling)
4. convert_units_from_natural_language - Natural Language Unit Conversion

Converts units using natural language queries, making unit conversions more intuitive and accessible. This tool parses natural language requests and automatically determines the appropriate conversion.

Supported Natural Language Patterns:

  • "convert 100 meters to feet"
  • "what is 32 Celsius in Fahrenheit"
  • "50 mph -> km/h"
  • "5 kilograms equals how many pounds"
  • "from 100 USD to EUR"
Input: "convert 100 kilometers to miles"
Output: {
  "success": true,
  "conversion": {
    "original_query": "convert 100 kilometers to miles",
    "input_value": 100,
    "input_unit": "kilometers",
    "output_value": 62.137119,
    "output_unit": "miles",
    "unit_type": "length"
  }
}
5. compute_statistical_operations - Statistical Analysis Engine

Performs comprehensive statistical calculations on datasets, providing essential statistical measures for data analysis and scientific computing.

Available Statistical Operations:

  • Descriptive statistics: mean, median, mode, range
  • Variability measures: variance, standard deviation
  • Distribution analysis: skewness, kurtosis
  • Data quality: quartiles, percentiles
Input: data=[1, 2, 3, 4, 5], operation="mean"
Output: "Result: 3.0"
6. perform_matrix_mathematical_operations - Matrix Mathematics Engine

Advanced matrix operations for linear algebra, engineering calculations, and scientific computing with support for multiple matrix operations.

Supported Matrix Operations:

  • Basic operations: multiply, transpose
  • Advanced operations: determinant, inverse
  • Matrix analysis: rank, eigenvalues (where applicable)
  • Error handling for invalid operations
Input: matrices=[[[1,2],[3,4]], [[5,6],[7,8]]], operation="multiply"
Output: Matrix multiplication result with proper formatting
7. perform_number_theory_analysis - Number Theory Analysis

Advanced number theory operations for mathematical research, cryptography, and computational mathematics.

Available Number Theory Operations:

  • Prime testing: Check if numbers are prime
  • Prime factorization: Find all prime factors
  • Divisor analysis: Calculate all divisors
  • Euler's totient: Compute φ(n) function
Input: n=97, operation="is_prime"
Output: "Result: 97 is prime"

Session Management Tools

8. create_mathematical_calculation_session - Session Initialization

Creates a new calculation session with optional initial variables, enabling stateful mathematical computations across multiple operations.

Session Features:

  • Variable storage: Save and reuse calculation results
  • State persistence: Maintain context across operations
  • Isolated environments: Multiple independent sessions
  • Custom initialization: Set initial variables
Input: session_id="analysis_1", variables={"x": 10, "pi": 3.14159}
Output: "Session created: analysis_1"
9. evaluate_expression_in_session_context - Stateful Calculations

Performs calculations within a specific session context, with access to stored variables and the ability to save results for later use.

Input: session_id="analysis_1", expression="x * 2 + pi", save_as="result"
Output: "Result: 23.14159" (and saves as 'result' variable)
10. list_mathematical_session_variables - Variable Management

Lists all variables currently stored in a calculation session, showing their names and values for easy reference.

Input: session_id="analysis_1"
Output: {"x": 10, "pi": 3.14159, "result": 23.14159}
11. delete_mathematical_calculation_session - Session Cleanup

Safely removes a calculation session and all associated variables, freeing up memory and ensuring clean state management.

System Monitoring Tools

12. get_mathematical_computation_performance_metrics - Performance Monitoring

Provides comprehensive system performance metrics including computation statistics, memory usage, and operational uptime for monitoring system health.

Metrics Included:

  • Computation statistics: Total calculations performed
  • Performance data: Average response times
  • Memory usage: Current memory consumption
  • System uptime: Server operational time
13. get_mathematical_security_audit_report - Security Information

Returns current security status including rate limiting information and session data for security monitoring and compliance.

14. get_mathematical_memory_usage_statistics - Memory Analytics

Detailed memory usage statistics for cache and session management, helping with performance optimization and resource planning.

Management and Discovery Tools

15. get_mathematical_computation_history - Calculation Audit Trail

Keeps a complete record of all calculations with timestamps, so you can track, check, and repeat any mathematical work.

Features:

  • Timestamped records: Every calculation includes when it was run
  • Configurable limits: Get 1-100 recent calculations
  • Expression tracking: Full input and output logging
  • Error logging: Failed calculations with error details
16. clear_mathematical_computation_history - History Management

Lets you safely clear your calculation history when you need to for privacy, performance, or storage reasons.

17. optimize_mathematical_computation_memory - Memory Optimization

Cleans up expired cache entries and optimizes memory usage, helping maintain optimal performance in long-running sessions.

Optimization Features:

  • Cache cleanup: Removes expired cache entries
  • Memory defragmentation: Optimizes memory allocation
  • Resource reclamation: Frees unused resources
  • Performance improvement: Maintains system responsiveness
18. list_all_available_mathematical_functions_and_constants - Complete Capability Discovery

Complete reference tool that gives you instant access to all available mathematical functions, constants, unit conversions, and their settings.

Discovery Categories:

  • Mathematical functions: All 52 available functions with signatures
  • Constants: Mathematical and physical constants with values
  • Unit conversions: All 158 units organized by category
  • System capabilities: Available operations and limits

Note: This tool consolidates the functionality of listing functions, constants, and recent history access in a single comprehensive interface.

MCP Resources

Access these resources directly through the MCP protocol with their corresponding implementation functions:

  • history://recent - View recent calculation history (implemented by recent_calculation_history)
  • functions://available - Browse available mathematical functions (implemented by mathematical_functions_catalog)
  • constants://math - Access mathematical constants with their values (implemented by mathematical_constants_catalog)

MCP Prompts

Pre-configured prompts for common calculation patterns:

  • scientific_calculation - Structured template for scientific computations
  • batch_calculation - Optimized template for batch processing

Mathematical Capabilities

MCP Mathematics gives you a complete mathematical computation environment with support for over 52 functions spanning basic arithmetic, advanced scientific computin

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.