math-mcp-learning-server
You can use this educational MCP server to perform math calculations, matrix operations, statistics, conversions, plotting, and persistent workspace management.
Safely evaluate mathematical expressions with
calc_expression.Compute descriptive statistics (mean, median, mode, std_dev, variance) with
calc_statistics.Calculate compound interest and convert length, weight, and temperature units.
Perform matrix multiplication, transpose, determinant, inverse, and eigenvalues (NumPy required).
Generate function, histogram, line, scatter, box, and financial plots (matplotlib required).
Save and load named calculations persistently across sessions with
workspace_saveandworkspace_load.Read MCP resources for workspace summary, calculation history, available functions, math constants, tool catalog, active variables, and health checks.
Use tutoring and formula-explainer prompts.
Connect locally via
uvxor to the hosted HTTP MCP endpoint.
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., "@math-mcp-learning-server multiply matrices [[1,2],[3,4]] and [[5,6],[7,8]]"
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.
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.
Architecture
Figure 1: An MCP client reaches math-mcp over stdio or HTTP; mounted sub-servers persist results to workspace files.
The full component map, tool taxonomy, and request lifecycle are documented in docs/ARCHITECTURE.md.
Related MCP server: math-mcp
Demo

See CONTRIBUTING.md for instructions to record your own demo.
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 |
| Save calculations to persistent storage |
| Retrieve previously saved calculations | |
Math |
| Safely evaluate mathematical expressions |
| Statistical analysis (mean, median, mode, std_dev, variance) | |
| Calculate compound interest for investments | |
| Convert between units (length, weight, temperature) | |
Matrix |
| Multiply two matrices |
| Transpose a matrix | |
| Calculate matrix determinant | |
| Calculate matrix inverse | |
| Calculate eigenvalues | |
Visualization |
| Plot mathematical functions |
| Create statistical histograms | |
| Create line charts | |
| Create scatter plots | |
| Create box plots | |
| Create financial line charts |
Resources
math://workspace- Persistent calculation workspace summarymath://history- Chronological calculation historymath://functions- Available mathematical functions referencemath://constants/{constant}- Mathematical constants (pi, e, golden_ratio, etc.)math://catalog/tools- Tool catalog with metadata and usage examplesmath://variables- Active variables in the current workspacemath://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
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 toolscalc_expressionMathematical CalculatorARead-onlyIdempotentInspect
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 CalculatorARead-onlyIdempotentInspect
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 AnalysisARead-onlyIdempotentInspect
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 ConverterARead-onlyIdempotentInspect
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 DeterminantARead-onlyIdempotentInspect
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 EigenvaluesARead-onlyIdempotentInspect
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 InverseARead-onlyIdempotentInspect
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 MultiplicationARead-onlyIdempotentInspect
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 TransposeARead-onlyIdempotentInspect
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 PlotARead-onlyIdempotentInspect
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 ChartARead-onlyIdempotentInspect
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 PlotterARead-onlyIdempotentInspect
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 HistogramARead-onlyIdempotentInspect
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 ChartARead-onlyIdempotentInspect
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 PlotARead-onlyIdempotentInspect
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 VariableARead-onlyIdempotentInspect
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
Scored across 17 tools
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).
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.
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.
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
Related MCP Connectors
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
An MCP server for deep research or task groups
Build your own tools from chat: design, test and host them on a shareable MCP server URL.
Related MCP Servers
- AlicenseBqualityDmaintenanceA 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.225MIT
- AlicenseAqualityDmaintenanceA 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.636 npmMIT
- FlicenseNot gradedqualityNot gradedmaintenanceA comprehensive MCP server providing 21+ tools for mathematical operations, string manipulation, file handling, utilities, and web requests via FastAPI and WebSocket.-
- AlicenseAqualityBmaintenanceAn MCP server that performs exact arithmetic calculations, avoiding the pitfalls of float64 and unsafe eval, with resource limits for safe execution.155 PyPIMIT