# 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:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--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:
- Make sure you have a PyPI account (register at https://pypi.org/account/register/ if needed)
- Build your package:
uv build
- 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.
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_server-0.1.4.tar.gz | 9.9 kB | Without provenance | Details for mcp_server-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_server-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for mcp_server-0.1.4-py3-none-any.whl |
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
|
Security for mcp-server 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.