Serves as the HTTP transport layer for the math server, enabling HTTP endpoints for MCP protocol messages, health checks, and Server-Sent Events for streaming intensive computations
Provides integration with GitHub for documentation, issue tracking, and project management through GitHub Wiki and Issues
Includes test suite integration for verifying functionality of the mathematical computation server
Built as a Python package requiring Python 3.11+ with comprehensive mathematical functions across multiple domains like arithmetic, number theory, and advanced math
Integrates with Shields.io for displaying status badges in the README for Python version, MCP compatibility, version, and license information
Supports YAML configuration files for server setup, allowing detailed configuration of transport options, function filtering, performance settings, and more
🧮 Chuk MCP Math Server
A highly configurable Mathematical Computation Protocol (MCP) server that provides comprehensive mathematical functions with flexible transport options. Built on the high-performance chuk-mcp-server framework.
⚡ Performance
36,000+ RPS peak throughput (inherited from chuk-mcp-server)
Sub-3ms latency per tool call
642 Mathematical Functions available
Zero-config startup - works out of the box
Related MCP server: MCP Calculator Server
✨ Features
🔢 Mathematical Capabilities
642 Mathematical Functions across multiple domains
Number Theory: Prime testing, factorization, GCD, LCM, sequences (328 functions)
Arithmetic: Basic operations, advanced calculations (44 functions)
Trigonometry: Comprehensive trigonometric operations (71 functions)
Linear Algebra: Vector and matrix operations (33 functions)
Statistics: Descriptive and inferential statistics (15 functions)
Calculus: Derivatives, integration, root finding (9 functions)
Geometry: Shapes, distances, intersections (12 functions)
Probability: Distribution functions (10 functions)
Advanced Operations: Complex mathematical operations (22 functions)
Sequences: Mathematical sequences (12 functions)
Constants: Mathematical constants (25 functions)
Conversions: Unit and type conversions (7 functions)
Real-time Computation: Async processing with proper error handling
Function Filtering: Configurable allowlists and denylists by domain, category, or function
🚀 Transport & Architecture
Dual Transport: STDIO (Claude Desktop) and HTTP support
High Performance: Built on chuk-mcp-server framework
Auto-detection: Automatically selects optimal transport mode
Production Ready: 36,000+ RPS, <3ms latency
Type Safe: Automatic schema generation from Python type hints
⚙️ Configuration
CLI Configuration: Comprehensive command-line options
File Configuration: YAML and JSON config file support
Environment Variables: Container-friendly configuration
Dynamic Filtering: Runtime function filtering with allowlists and denylists
Granular Control: Filter by function, domain, or category
🛡️ Production Features
Zero Configuration: Works out of the box with sensible defaults
High Test Coverage: 97% code coverage with 114 comprehensive tests
Type Safe: 100% type-checked with mypy, fully Pydantic-native
Error Handling: Graceful failure management
Logging: Configurable log levels and output
MCP Resources: Built-in resources for function discovery and stats
Timeout Management: Configurable computation timeouts
🚀 Quick Start
💡 Try it now! Use our free public server at https://math.chukai.io/mcp - no installation required! See Public Server section below.
Installation
Using uvx (Recommended - No Installation Required!)
The easiest way to use the server is with uvx, which runs it without installing:
This automatically downloads and runs the latest version. Perfect for Claude Desktop!
Using uv (Recommended for Development)
Using pip (Traditional)
Basic Usage
STDIO Transport (Claude Desktop)
HTTP Transport (Web APIs)
Claude Desktop Integration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Option 1: Use the Public Server (Easiest)
Connect to the hosted public server:
This requires no local installation and is always up-to-date!
Option 2: Run Locally with uvx
Option 3: Run Locally with Local Installation
Important: Use absolute paths, not relative or ~ paths.
Restart Claude Desktop and ask: "Can you check if 97 is prime?" - Claude will use the math server!
Example HTTP API Usage
📖 Documentation
Available Functions
The server provides 642 mathematical functions across these domains:
Domain | Functions | Examples |
Arithmetic & Number Theory (420) | Basic operations, primes, sequences, divisibility |
,
,
,
,
,
|
Trigonometry (71) | Trig functions, hyperbolic, conversions |
,
,
,
,
|
Linear Algebra (33) | Vector and matrix operations |
,
,
|
Statistics (15) | Descriptive statistics |
,
,
,
|
Calculus (9) | Derivatives, integration, root finding |
,
,
|
Geometry (12) | Shapes, distances, intersections |
,
,
|
Probability (10) | Distribution functions |
,
|
Other (17) | Advanced operations, sequences, constants, conversions |
,
,
|
Function Filtering
Control which functions are exposed:
Configuration Options
Command Line
Configuration File
MCP Resources
The server provides built-in resources for introspection:
🛠️ Development
Project Structure
Development Setup
Running Tests
Code Quality
Building
Running Locally
Custom Server
🚀 Deployment
Docker
Build and run with Docker:
The server will be available at http://localhost:8000.
Fly.io
Deploy to Fly.io for a public server:
The fly.toml configuration is already set up for HTTP mode on port 8000. The server will auto-scale based on traffic (min 0, auto-start/stop).
Environment Variables
Configure via Fly.io secrets:
GitHub Actions
The repository includes automated workflows:
Test: Runs on all PRs and commits (Ubuntu, Windows, macOS)
Release: Creates GitHub releases when tags are pushed
Publish: Publishes to PyPI automatically on releases
Fly Deploy: Auto-deploys to Fly.io on main branch pushes
To create a release:
This will automatically:
Create a GitHub release with changelog
Run tests on all platforms
Build and publish to PyPI
Deploy to Fly.io (if configured)
📊 Performance
Benchmarks
Peak Throughput: 36,000+ requests/second
Average Latency: <3ms per tool call
Startup Time: ~2 seconds (642 functions loaded)
Memory Usage: ~50MB baseline
Success Rate: 100% under load testing
Performance comes from:
chuk-mcp-server framework: High-performance MCP implementation
Async operations: Non-blocking I/O for all function calls
Type safety: Automatic schema validation with zero overhead
Optimized registry: Fast function lookup and execution
Optimization Tips
Use function filtering to reduce memory footprint
Enable caching for repeated calculations (
--cache-strategy smart)Use HTTP transport for web APIs, STDIO for local/Claude Desktop
Adjust
--max-concurrent-callsfor high-throughput scenarios
🔧 Troubleshooting
Common Issues
Server Won't Start
Functions Not Loading
Claude Desktop Not Showing Tools
Use absolute paths in claude_desktop_config.json (not
~or relative)Test manually:
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | uv run chuk-mcp-math-serverRestart Claude Desktop after config changes
Check Claude Desktop logs (Help → Show Logs)
HTTP Connection Issues
🌐 Public Server
A free public math server is available at https://math.chukai.io/mcp for anyone to use!
Features
✅ Always Available: Hosted on Fly.io with auto-scaling
✅ Always Up-to-Date: Automatically deploys from main branch
✅ All 642 Functions: Full mathematical function library
✅ No Installation Required: Just add to Claude Desktop config
✅ Free to Use: No authentication or API keys needed
Quick Start
Add this to your Claude Desktop config:
Then restart Claude Desktop and ask: "Can you check if 97 is prime?"
Testing the Public Server
The server requires session management for MCP over HTTP. Use chuk-mcp-client to connect:
Note: The server uses chuk-mcp-server's session-based HTTP transport, which requires the chuk-mcp-client for proper session management.
Privacy & Usage
No logging of tool calls or personal data
No rate limiting (fair use applies)
Automatically scales based on demand
Source code is open and auditable
Self-Hosting
Want to host your own? See the Deployment section above for Docker and Fly.io instructions.
🤝 Contributing
We welcome contributions! Here's how to help:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes
Add tests if applicable
Ensure tests pass (
pytest)Submit a pull request
Code Style
Follow PEP 8 guidelines
Maintain 100% type safety with mypy and Pydantic
Add type hints where appropriate
Update documentation for new features
Keep the README up to date
Aim for high test coverage (currently 97%)
📋 Requirements
Core Dependencies
Python 3.11+
chuk-mcp-server >= 0.6(provides high-performance MCP framework)chuk-mcp-math >= 0.1.0(provides mathematical functions)pyyaml >= 6.0.2(for YAML configuration)
What's Included via chuk-mcp-server
High-performance HTTP/STDIO transport
Automatic type inference and validation
Built-in logging and error handling
Zero-config startup capability
Production-grade performance (36K+ RPS)
Optional Dependencies
Development tools:
pytest,pytest-asyncioAll optional:
pip install -e .[dev]
🏗️ Architecture
Built on chuk-mcp-server framework:
chuk-mcp-server: High-performance MCP server framework (36K+ RPS)
chuk-mcp-math: Mathematical function library (642 functions)
This server: Bridges the two with filtering and configuration
The refactored architecture is simpler and more performant:
Removed custom base server implementation
Uses chuk-mcp-server's decorator-based API
Maintains all filtering and configuration features
Gains automatic performance optimization
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Built on chuk-mcp-server - High-performance MCP framework
Mathematical functions from chuk-mcp-math
Follows the Model Context Protocol specification
🔗 Links
chuk-mcp-math: GitHub
MCP Protocol: Official Specification
Issues: GitHub Issues
Made with ❤️ by the Chuk MCP Team
High-performance mathematical computation for the Model Context Protocol ecosystem