Educational MCP server demonstrating persistent workspace patterns and mathematical operations. Built with FastMCP 2.0 and the official Model Context Protocol Python SDK.
Available on:
- Official MCP Registry -
io.github.clouatre-labs/math-mcp-learning-server - PyPI -
math-mcp-learning-server - FastMCP Cloud - No installation required
Requires an MCP client:
- Claude Desktop - Anthropic's desktop app
- Claude Code - Command-line MCP client
- Goose - Open-source AI agent framework
- OpenCode - Open-source MCP client by SST
- Kiro - AWS's AI assistant
- Gemini CLI - Google's command-line tool
- Any MCP-compatible client
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"
}
}
}Automatic with uvx (recommended):
{
"mcpServers": {
"math": {
"command": "uvx",
"args": ["math-mcp-learning-server"]
}
}
}Manual installation:
# Basic installation
uv pip install math-mcp-learning-server
# With matrix operations support
uv pip install math-mcp-learning-server[scientific]
# With visualization support
uv pip install math-mcp-learning-server[plotting]
# All features
uv pip install math-mcp-learning-server[scientific,plotting]- Cross-Session Persistence: Variables survive server restarts and session changes
- Safe Expression Evaluation: Secure mathematical expression parsing with security logging
- Statistical Analysis: Mean, median, mode, standard deviation, variance
- Financial Calculations: Compound interest with formatted output
- Unit Conversions: Length, weight, temperature
- Function Plotting: Base64-encoded PNG plots (matplotlib)
- Statistical Histograms: Distribution visualization with indicators
- Type Safety: Full Pydantic validation for all inputs
- Comprehensive Testing: Complete coverage with security validation
- Cross-Platform Storage: Windows, macOS, Linux support
Primitives:
- Tools: 17 tools for mathematical operations, persistence, visualization, and matrix operations
- Resources: 1 resource (
math://workspace) for viewing persistent workspace - Prompts: 2 prompts (
math_tutor,formula_explainer) for educational interactions
Transports:
- stdio - Standard input/output for local clients
- HTTP/SSE - Server-Sent Events for cloud/web clients
Workspace persists across all transport modes and sessions.
save_calculation: Save calculations to persistent storage for cross-session accessload_variable: Access previously saved calculations from any MCP client session
calculate: Safely evaluate mathematical expressions (supports basic ops and math functions)statistics: Perform statistical calculations (mean, median, mode, std_dev, variance)compound_interest: Calculate compound interest for investmentsconvert_units: Convert between units (length, weight, temperature)
plot_function: Generate mathematical function plots (base64-encoded PNG)create_histogram: Create statistical histograms with distribution analysisplot_line_chart: Create line charts for sequential data visualizationplot_scatter_chart: Create scatter plots for relationship analysisplot_box_plot: Create box plots for statistical distribution comparisonplot_financial_line: Create financial trend plots with bullish/bearish/volatile patterns
matrix_multiply: Multiply two matrices with dimension validationmatrix_transpose: Transpose a matrix (swap rows and columns)matrix_determinant: Calculate determinant of square matricesmatrix_inverse: Compute matrix inverse with singular matrix detectionmatrix_eigenvalues: Calculate eigenvalues (supports complex numbers)
Note: Matrix operations require NumPy. Install with uv pip install math-mcp-learning-server[scientific]
See Usage Examples for detailed examples of each tool.
math_tutor: Generate structured tutoring prompts for mathematical concepts (configurable difficulty level)formula_explainer: Generate comprehensive formula explanation prompts with step-by-step breakdowns
See Usage Examples for detailed examples of each prompt.
View your complete persistent workspace with all saved calculations, metadata, and statistics.
Returns:
- All saved variables with expressions and results
- Educational metadata (difficulty, topic)
- Workspace statistics (total calculations, session count)
- Timestamps for tracking calculation history
# Clone and setup
git clone https://github.com/clouatre-labs/math-mcp-learning-server.git
cd math-mcp-learning-server
uv sync --extra dev --extra plotting
# Test server locally
uv run fastmcp dev src/math_mcp/server.py# Run all tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ --cov=src --cov-report=html --cov-report=term
# Run specific test category
uv run pytest tests/test_matrix_operations.py -vTest Suite: 126 tests across 5 categories (HTTP, Math, Matrix, Persistence, Visualization) Coverage: See detailed testing documentation
# Linting
uv run ruff check
# Formatting
uv run ruff format --check
# Security checks
uv run ruff check --select SSee CONTRIBUTING.md for guidelines on submitting changes.
- Cloud Deployment Guide: FastMCP Cloud deployment instructions and configuration
- Usage Examples: Practical examples for all tools and resources
- Contributing Guidelines: Development workflow, code standards, and testing procedures
- Roadmap: Planned features and enhancement opportunities
- Code of Conduct: Community guidelines and expectations
The calculate tool uses restricted eval() with:
- Whitelist of allowed characters and functions
- Restricted global scope (only
mathmodule andabs) - No access to dangerous built-ins or imports
- Security logging for potentially dangerous attempts
- Input Validation: All tool inputs validated with Pydantic models
- Error Handling: Structured errors without exposing sensitive information
- Least Privilege: File operations restricted to designated workspace directory
- Type Safety: Complete type hints and validation for all operations
We welcome contributions! See CONTRIBUTING.md for development workflow, code standards, and testing procedures.
For maintainers: See MAINTAINER_GUIDE.md for release procedures.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to hugues+mcp-coc@linux.com.
MIT License - Full license details available in the LICENSE file.