NumPy Calculator
A Model Context Protocol (MCP) server that provides mathematical calculations and operations using NumPy, enabling users to perform numerical computations like matrix operations, statistical analysis, and polynomial fitting directly through Claude.
colesmcintosh
README
NumPy MCP Server
<div align="center">
<strong>A Model Context Protocol (MCP) server for numerical computations with NumPy</strong>
</div>
A Model Context Protocol (MCP) server that provides mathematical calculations and operations using NumPy. This server exposes various mathematical tools through a standardized MCP interface, making it easy to perform numerical computations directly through Claude or other MCP-compatible LLMs.
Features
- Basic arithmetic operations (addition)
- Linear algebra computations (matrix multiplication, eigendecomposition)
- Statistical analysis (mean, median, standard deviation, min, max)
- Polynomial fitting
Installation
Quick Setup with Claude Desktop
The fastest way to get started is to install this server directly in Claude Desktop:
# Install the server in Claude Desktop
mcp install server.py --name "NumPy Calculator"
Manual Installation
This project uses UV for dependency management. To install:
# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone https://github.com/yourusername/math-mcp.git
cd math-mcp
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Unix/macOS
# or
# .venv\Scripts\activate # On Windows
uv pip install -r requirements.txt
Usage
Development Testing
Test the server locally with the MCP Inspector:
mcp dev server.py
Claude Desktop Integration
-
Install the server in Claude Desktop:
mcp install server.py --name "NumPy Calculator" -
The server will now be available in Claude Desktop under "NumPy Calculator"
-
You can use it by asking Claude to perform mathematical operations, for example:
- "Calculate the eigenvalues of matrix [[1, 2], [3, 4]]"
- "Find the mean and standard deviation of [1, 2, 3, 4, 5]"
- "Multiply matrices [[1, 0], [0, 1]] and [[2, 3], [4, 5]]"
Direct Execution
For advanced usage or custom deployments:
python server.py
# or
mcp run server.py
Available Functions
The server provides the following mathematical functions through the MCP interface:
Basic Arithmetic
add(a: int, b: int) -> int: Add two integers together
Linear Algebra
matrix_multiply(matrix_a: List[List[float]], matrix_b: List[List[float]]) -> List[List[float]]: Multiply two matriceseigen_decomposition(matrix: List[List[float]]) -> Tuple[List[float], List[List[float]]]: Compute eigenvalues and eigenvectors of a square matrix
Statistics
statistical_analysis(data: List[float]) -> dict[str, float]: Calculate basic statistics for a dataset including:- Mean
- Median
- Standard deviation
- Minimum value
- Maximum value
Data Analysis
polynomial_fit(x: List[float], y: List[float], degree: int = 2) -> List[float]: Fit a polynomial of specified degree to the given data points
Development
Project Structure
math-mcp/
├── requirements.txt
├── README.md
└── server.py
Code Quality
This project adheres to strict code quality standards:
- Type hints throughout the codebase
- Comprehensive docstrings following Google style
- Error handling for numerical operations
Dependencies
- NumPy: For numerical computations and linear algebra operations
- FastMCP: For Model Context Protocol server implementation
License
This project is licensed under the MIT License.
Acknowledgments
- NumPy team for their excellent scientific computing library
- Model Context Protocol (MCP) for enabling standardized LLM interactions
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.
Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.
Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.