Skip to main content
# Math Calculator MCP Server

A custom MCP server that provides mathematical calculation tools and resources for AI assistants.

## Components

### Tools
The server provides basic and advanced mathematical operations:

- **add**: Add two numbers together
- **subtract**: Subtract the second number from the first
- **multiply**: Multiply two numbers together
- **divide**: Divide the first number by the second
- **calculate_percentage**: Calculate a percentage of a value
- **power**: Raise a number to a specified power
- **square_root**: Calculate the square root of a number

### Resources
The server provides reference formulas as resources:

- **formula://area**: Common formulas for calculating area of different shapes
- **formula://volume**: Common formulas for calculating volume of different 3D shapes
- **formula://trigonometry**: Common trigonometric formulas and identities

### Prompts
The server includes templates for solving mathematics problems:

- **solve_math_problem**: Template for solving math word problems step by step
- **formula_application**: Template for applying a specific formula to solve a problem

## Configuration

### Environment Variables
This server doesn't require any specific environment variables.

## Quickstart

### Install

#### Claude Desktop
On MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
On Windows: `%APPDATA%/Claude/claude_desktop_config.json`

<details>
<summary>Development/Unpublished Servers Configuration</summary>

```json
"mcpServers": {
  "mcp-server": {
    "command": "uv",
    "args": [
      "--directory",
      "/Users/Ajinkya25/Documents/Idea-Labs/MCP/mcp-server",
      "run",
      "mcp-server"
    ]
  }
}
Published Servers Configuration
"mcpServers": {
  "mcp-server": {
    "command": "uvx",
    "args": [
      "mcp-server"
    ]
  }
}

Development

Testing Locally

To test the server locally:

# Activate the virtual environment (if not already activated)
source .venv/bin/activate  # On macOS/Linux

# Test the server in development mode
mcp dev -m mcp_server.server

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:
uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory /Users/Ajinkya25/Documents/Idea-Labs/MCP/mcp-server run mcp-server

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

License

MIT


## Testing Your MCP Server

Now let's make sure your MCP server works properly:

1. Save the updated code to `src/mcp_server/server.py`
2. Save the updated README.md
3. Test your server using:

```bash
mcp dev -m mcp_server.server

This should open the MCP Inspector in your browser where you can try out your math tools.

Publishing to PyPI

Once you've tested your server and confirmed it works, you can publish it to PyPI:

  1. Make sure you have a PyPI account (register at https://pypi.org/account/register/ if needed)
  2. Build your package:
uv build
  1. Publish to PyPI:
uv publish --token YOUR_PYPI_TOKEN

Or if you prefer to use username/password:

uv publish --username YOUR_USERNAME --password YOUR_PASSWORD

After publishing, anyone can install your MCP server using:

pip install mcp-server

And then use it with Claude Desktop by configuring their claude_desktop_config.json as shown in the README.

Release files for mcp-server 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-server 0.1.4
File Size Uploaded
mcp_server-0.1.4.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-server 0.1.4
File Interpreter ABI Platform
mcp_server-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / mcp_server-0.1.4.tar.gz

Download URL mcp_server-0.1.4.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8440ff4427e31006aec8782f8490bd57ccaf3f63e806e180a9042a70602f141e
BLAKE2b-256 checksum
How to use checksums
97d4e47e2c1a17a05a2764715ede29a230e5d0c1f507a23505d36d752d6678c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.12

Release files / mcp_server-0.1.4-py3-none-any.whl

Download URL mcp_server-0.1.4-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3f0be6028aff41e2969f68be2ca5c0282b6337ebed33d0556dea1c9a1337221
BLAKE2b-256 checksum
How to use checksums
dd761edf7103089231cc7de340bcdd466e0550ff5e7594cf8061081d6f551a17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.12

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page