Skip to main content
Glama

math-mcp-learning-server

PyPI Python License REUSE OpenSSF Best Practices

Educational MCP server with 17 tools, persistent workspace, and cloud hosting. Built with FastMCP and the official Model Context Protocol Python SDK.

Available on the MCP Registry (io.github.clouatre-labs/math-mcp-learning-server) and PyPI.

Demo

math-mcp Demo

See CONTRIBUTING.md for instructions to record your own demo.

Related MCP server: math-mcp

Quick Start

Cloud (No Installation)

Connect your MCP client to the hosted server:

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "math-cloud": {
      "transport": "http",
      "url": "https://math-mcp.fastmcp.app/mcp"
    }
  }
}

Local Installation

{
  "mcpServers": {
    "math": {
      "command": "uvx",
      "args": ["math-mcp-learning-server[scientific,plotting]"]
    }
  }
}

For other installation options (basic, scientific-only, plotting-only), see CONTRIBUTING.md.

Tools

Category

Tool

Description

Workspace

workspace_save

Save calculations to persistent storage

workspace_load

Retrieve previously saved calculations

Math

calc_expression

Safely evaluate mathematical expressions

calc_statistics

Statistical analysis (mean, median, mode, std_dev, variance)

calc_interest

Calculate compound interest for investments

calc_units

Convert between units (length, weight, temperature)

Matrix

matrix_multiply

Multiply two matrices

matrix_transpose

Transpose a matrix

matrix_determinant

Calculate matrix determinant

matrix_inverse

Calculate matrix inverse

matrix_eigenvalues

Calculate eigenvalues

Visualization

plot_function

Plot mathematical functions

plot_histogram

Create statistical histograms

plot_line_chart

Create line charts

plot_scatter

Create scatter plots

plot_box_plot

Create box plots

plot_financial_line

Create financial line charts

Resources

  • math://workspace - Persistent calculation workspace summary

  • math://history - Chronological calculation history

  • math://functions - Available mathematical functions reference

  • math://constants/{constant} - Mathematical constants (pi, e, golden_ratio, etc.)

  • math://catalog/tools - Tool catalog with metadata and usage examples

  • math://variables - Active variables in the current workspace

  • math://test - Server health check

Prompts

  • math_tutor - Structured tutoring prompts (configurable difficulty)

  • formula_explainer - Formula explanation with step-by-step breakdowns

See Usage Examples for detailed examples.

Development

See CONTRIBUTING.md for development setup, testing, and contribution guidelines.

Security

  • OpenSSF Best Practices Silver - Fewer than 1% of open source projects reach this level

  • REUSE/SPDX - License compliance for all files

  • Signed Commits - GPG-signed commits required

  • Dependency Scanning - Automated updates via Renovate

  • pip-audit CVE Scanning - Automated dependency vulnerability checks

  • gitleaks Secret Scanning - Detects secrets in code and history

  • zizmor GitHub Actions Security - Workflow security scanning

  • commitlint Enforcement - Conventional commit validation in CI

  • OpenSSF Scorecard - Continuous open source security assessment

The calc_expression tool uses restricted eval() with a whitelist of allowed characters and functions, restricted global scope (only math module and abs), and no access to dangerous built-ins or imports. All tool inputs are validated with Pydantic models. File operations are restricted to the designated workspace directory. Complete type hints and validation are enforced for all operations.

Documentation

Available Tools

17 tools
calc_expressionMathematical CalculatorA
Read-onlyIdempotent
Inspect

Safely evaluate mathematical expressions with support for basic operations and math functions.

Supported operations: +, -, *, /, **, () Supported functions: sin, cos, tan, log, sqrt, abs, pow

Note: Use this tool to evaluate a single mathematical expression. To compute descriptive statistics over a list of numbers, use the statistics tool instead.

Examples:

  • "2 + 3 * 4" → 14

  • "sqrt(16)" → 4.0

  • "sin(3.14159/2)" → 1.0

Inputs: expression (required). Returns: Result of a mathematical expression evaluation.

calc_interestCompound Interest CalculatorA
Read-onlyIdempotent
Inspect

Calculate compound interest for investments.

Formula: A = P(1 + r/n)^(nt) Where:

  • P = principal amount

  • r = annual interest rate (as decimal)

  • n = number of times interest compounds per year

  • t = time in years

Examples: compound_interest(10000, 0.05, 5) # $10,000 at 5% for 5 years → $12,762.82 compound_interest(5000, 0.03, 10, 12) # $5,000 at 3% compounded monthly → $6,744.25

Inputs: rate (required), time (required), principal (required), compounds_per_year. Returns: Result of compound interest calculation.

calc_statisticsStatistical AnalysisA
Read-onlyIdempotent
Inspect

Perform statistical calculations on a list of numbers.

Available operations: mean, median, mode, std_dev, variance

Note: Use this tool to compute descriptive statistics over a list of numbers. To evaluate a single mathematical expression, use the calculate tool instead.

Examples: statistics([1.0, 2.5, 3.0, 4.5, 5.0], "mean") # Returns 3.2 statistics([1.0, 2.5, 3.0, 4.5, 5.0], "std_dev") # Returns ~1.58

Inputs: numbers (required), operation (required). Returns: Result of statistical calculation.

calc_unitsUnit ConverterA
Read-onlyIdempotent
Inspect

Convert between different units of measurement.

Supported unit types:

  • length: mm, cm, m, km, in, ft, yd, mi

  • weight: g, kg, oz, lb

  • temperature: c, f, k (Celsius, Fahrenheit, Kelvin)

Examples: convert_units(5, "km", "mi", "length") # 5 kilometers → 3.11 miles convert_units(150, "lb", "kg", "weight") # 150 pounds → 68.04 kilograms

Inputs: value (required), to_unit (required), from_unit (required), unit_type (required). Returns: Result of unit conversion.

matrix_determinantMatrix DeterminantA
Read-onlyIdempotent
Inspect

Calculate the determinant of a square matrix.

Note: Requires NumPy. Raises ValueError if NumPy is unavailable.

Examples: matrix_determinant([[1, 2], [3, 4]]) matrix_determinant([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) # Identity matrix

Inputs: matrix (required). Returns: Result of matrix determinant calculation.

matrix_eigenvaluesMatrix EigenvaluesA
Read-onlyIdempotent
Inspect

Calculate the eigenvalues of a square matrix.

Note: Requires NumPy. Raises ValueError if NumPy is unavailable.

Examples: matrix_eigenvalues([[4, 2], [1, 3]]) matrix_eigenvalues([[3, 0, 0], [0, 5, 0], [0, 0, 7]]) # Diagonal matrix

Inputs: matrix (required). Returns: Result of matrix eigenvalues calculation.

matrix_inverseMatrix InverseA
Read-onlyIdempotent
Inspect

Calculate the inverse of a square matrix.

Note: Requires NumPy. Raises ValueError if NumPy is unavailable.

Examples: matrix_inverse([[1, 2], [3, 4]]) matrix_inverse([[2, 0], [0, 2]]) # Diagonal matrix

Inputs: matrix (required). Returns: Result of matrix inverse calculation.

matrix_multiplyMatrix MultiplicationA
Read-onlyIdempotent
Inspect

Multiply two matrices (A × B).

Note: Requires NumPy. Raises ValueError if NumPy is unavailable.

Examples: matrix_multiply([[1, 2], [3, 4]], [[5, 6], [7, 8]]) matrix_multiply([[1, 2, 3]], [[1], [2], [3]])

Inputs: matrix_a (required), matrix_b (required). Returns: Result of matrix multiplication operation.

matrix_transposeMatrix TransposeA
Read-onlyIdempotent
Inspect

Transpose a matrix (swap rows and columns).

Note: Requires NumPy. Raises ValueError if NumPy is unavailable.

Examples: matrix_transpose([[1, 2, 3], [4, 5, 6]]) matrix_transpose([[1], [2], [3]])

Inputs: matrix (required). Returns: Result of matrix transpose operation.

plot_box_plotBox PlotA
Read-onlyIdempotent
Inspect

Create a box plot for comparing distributions (requires matplotlib).

Examples: plot_box_plot([[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]], group_labels=["A", "B"]) plot_box_plot([[10, 20, 30], [15, 25, 35], [5, 15, 25]], title="Comparison")

Inputs: data_groups (required), color, title, y_label, +1 more.

plot_financial_lineFinancial Line ChartA
Read-onlyIdempotent
Inspect

Generate and plot synthetic financial price data (requires matplotlib).

Creates realistic price movement patterns for educational purposes. Does not use real market data.

Note: Use for time-series price data with optional moving average overlay. For general XY data, use plot_line_chart instead.

Examples: plot_financial_line(days=60, trend='bullish') plot_financial_line(days=90, trend='volatile', start_price=150.0, color='orange')

Inputs: days, color, trend, start_price.

plot_functionFunction PlotterA
Read-onlyIdempotent
Inspect

Generate mathematical function plots (requires matplotlib).

Examples: plot_function("x**2", (-5, 5)) plot_function("sin(x)", (-3.14, 3.14))

Inputs: x_range (required), expression (required), num_points.

plot_histogramStatistical HistogramA
Read-onlyIdempotent
Inspect

Create statistical histograms (requires matplotlib).

Examples: plot_histogram([1.0, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0]) plot_histogram([10, 20, 30, 40, 50], bins=5, title="Test Scores")

Inputs: data (required), bins, title.

plot_line_chartLine ChartA
Read-onlyIdempotent
Inspect

Create a line chart from data points (requires matplotlib).

Note: Use for general XY data. For time-series price data with optional moving average, use plot_financial_line instead.

Examples: plot_line_chart([1, 2, 3, 4], [1, 4, 9, 16], title="Squares") plot_line_chart([0, 1, 2], [0, 1, 4], color='red', x_label='Time', y_label='Distance')

Inputs: x_data (required), y_data (required), color, title, +3 more.

plot_scatterScatter PlotA
Read-onlyIdempotent
Inspect

Create a scatter plot from data points (requires matplotlib).

Examples: plot_scatter([1, 2, 3, 4], [1, 4, 9, 16], title="Correlation Study") plot_scatter([1, 2, 3], [2, 4, 5], color='purple', point_size=100)

Inputs: x_data (required), y_data (required), color, title, +3 more.

workspace_loadLoad VariableA
Read-onlyIdempotent
Inspect

Load previously saved calculation result from workspace.

Examples: load_variable("portfolio_return") # Returns saved calculation load_variable("circle_area") # Access across sessions

Inputs: name (required). Returns: Result of loading a variable from the workspace.

workspace_saveSave Calculation to WorkspaceAInspect

Save calculation to persistent workspace (survives restarts).

Examples: save_calculation("portfolio_return", "10000 * 1.07^5", 14025.52) save_calculation("circle_area", "pi * 5^2", 78.54)

Inputs: name (required), result (required), expression (required). Returns: Result of saving a calculation to the workspace.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool targets a distinct operation: expression evaluation, interest calculation, statistics, unit conversion, matrix operations (5 separate), plot types (6 separate), and workspace management. No two tools have overlapping purposes, and cross-references in descriptions clarify boundaries (e.g., calc_statistics vs calc_expression).

    Naming Consistency5/5

    All tool names follow a consistent pattern: a domain prefix (calc_, matrix_, plot_, workspace_) followed by a descriptive noun (e.g., expression, interest, determinant, histogram, save). Snake_case is used uniformly, with no mixing of styles.

    Tool Count5/5

    17 tools is well-scoped for a math learning server, covering arithmetic, statistics, linear algebra, unit conversion, plotting, and data persistence. Each tool has a clear role, neither too few nor too many for the domain's breadth.

    Completeness4/5

    The tool set covers core mathematical areas (expressions, statistics, matrices, unit conversion, plotting) and workspace persistence, but lacks dedicated tools for algebra, calculus, or probability distributions. Minor gaps exist, but the core learning workflows are supported.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Python-based MCP server providing mathematical computation tools and plotting utilities for a wide range of math topics including calculus, matrix operations, statistics, and more.
      22
      5
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A secure MCP server for evaluating mathematical expressions with grammar validation, function whitelisting, and sandboxed execution. It provides tools for expression evaluation, variable management, and resources for grammar and function documentation.
      6
      35 npm
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A comprehensive MCP server providing 21+ tools for mathematical operations, string manipulation, file handling, utilities, and web requests via FastAPI and WebSocket.
      -
    • A
      license
      A
      quality
      B
      maintenance
      An MCP server that performs exact arithmetic calculations, avoiding the pitfalls of float64 and unsafe eval, with resource limits for safe execution.
      1
      36 PyPI
      MIT