Math MCP Server
# Math MCP Server
## Overview
This is an MCP (Model Context Protocol) server that can do basic arithmetic in 64 bit precision, along with matrix multiplication.
<a href="https://glama.ai/mcp/servers/@avanishd-3/math-mcp">
<img width="380" height="200" src="https://glama.ai/mcp/servers/@avanishd-3/math-mcp/badge" alt="Math Server MCP server" />
</a>
## Features
- Addition
- Subtraction
- Multiplication
- Division
- Matrix multiplication
## Installation
### Prerequisities
Ensure you have the following installed:
- Python 3.13+
- uv
#### Installing UV
See [installation guide](https://docs.astral.sh/uv/getting-started/installation/#standalone-installer) for all options.
##### Unix/MacOS
```
curl -LsSf https://astral.sh/uv/install.sh | sh
```
or
```
brew install uv
```
##### Windows
```
winget install --id=astral-sh.uv -e
```
### Clone the Repository
```
git clone https://github.com/avanishd-3/math-mcp.git
cd math-mcp-server
uv sync
```
## Integration with Clients
### Claude Code
fastmcp install claude-code src/math_server.py:math_mcp
### Claude Desktop
fastmcp install claude-desktop src/math_server.py:math_mcp
### Cursor
fastmcp install cursor src/math_server.py:math_mcp
### VS Code
Add the following .vscode/mcp.json and use your actual path.
```
{
"servers": {
"Math MCP Server": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"--with",
"numpy",
"fastmcp",
"run",
"/absolute/path/Desktop/to/math-mcp-server/src/math_server.py:math_mcp"
]
}
},
}
```
## Contributing
1. Fork the repository
2. Create a new branch:
```
git checkout -b add-feature
```
3. Make changes and commit (remember to add unit tests in test/ directory)
```
git commit -m "Added a new feature"
```
4. Push to your fork
```
git push origin add-feature
```
5. Open a pull request.
## Project Structure
```text
/
├── src
│ └── math_server.py
├── tests
│ ├── test_arithmetic.py
│ │ └── astro.svg
│ ├── test_linear_algebra.py
├── pytest.ini
├── pyproject.toml
└── uv.lock
```
### Architecture
This MCP server uses [Fast MCP 2.0](https://gofastmcp.com/getting-started/welcome), which provides many more features than
Fast MCP 1.0, which is what the official Python SDK for MCP uses.
Also, the unit tests are written with Pytest, which is what Fast MCP 2.0 recommends.
Lastly, if you don't know, uv is a much faster version of pip that also provides a lockfile for project dependencies (this will be familiar if you've used npm or cargo before). The MCP Python SDK itself uses uv, and I use it for all new Python projects, because it's 10-100x faster than pip, and the lockfile makes dependency version management much simpler.
TDQS
Scored across 5 tools
Each tool has a clearly distinct mathematical operation: addition, division, matrix multiplication, multiplication, and subtraction. There is no overlap in purpose—add and multiply handle lists for their respective operations, while divide and subtract handle two numbers, and matrix_multiplication is uniquely for matrices. An agent can easily tell them apart based on their specific functions.
All tool names follow a consistent verb-based pattern (add, divide, matrix_multiplication, multiply, subtract) without mixing conventions. The naming is straightforward and predictable, using simple action words that directly describe the operation, with matrix_multiplication as a compound term that still fits the verb_noun style.
With 5 tools, the count is reasonable for a math server covering basic arithmetic and matrix operations. It is well-scoped, but slightly under for a comprehensive math toolkit, as it lacks tools for operations like exponentiation, trigonometry, or advanced linear algebra, which might be expected in a broader math domain.
The tool set covers basic arithmetic (add, subtract, multiply, divide) and matrix multiplication, but there are notable gaps for a math server. Missing operations include exponentiation, square roots, trigonometric functions, and other matrix operations (e.g., inversion, determinant), which limits the surface for handling common mathematical tasks and could lead to agent workarounds.