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.
A Model Context Protocol (MCP) server for numerical computations with NumPy
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.
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"
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
Test the server locally with the MCP Inspector:
mcp dev server.py
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:
For advanced usage or custom deployments:
python server.py # or mcp run server.py
The server provides the following mathematical functions through the MCP interface:
add(a: int, b: int) -> int
: Add two integers togethermatrix_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 matrixstatistical_analysis(data: List[float]) -> dict[str, float]
: Calculate basic statistics for a dataset including:
polynomial_fit(x: List[float], y: List[float], degree: int = 2) -> List[float]
: Fit a polynomial of specified degree to the given data pointsmath-mcp/
├── requirements.txt
├── README.md
└── server.py
This project adheres to strict code quality standards:
This project is licensed under the MIT License.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!