Skip to main content

A custom MCP server that provides useful tools and resources for AI assistants

Project description

# 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server-0.1.4.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server-0.1.4-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server-0.1.4.tar.gz.

File metadata

  • Download URL: mcp_server-0.1.4.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for mcp_server-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8440ff4427e31006aec8782f8490bd57ccaf3f63e806e180a9042a70602f141e
MD5 bf09f5eb6e0acc657ac0e43a3de37af7
BLAKE2b-256 97d4e47e2c1a17a05a2764715ede29a230e5d0c1f507a23505d36d752d6678c3

See more details on using hashes here.

File details

Details for the file mcp_server-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: mcp_server-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for mcp_server-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f3f0be6028aff41e2969f68be2ca5c0282b6337ebed33d0556dea1c9a1337221
MD5 31b8e12a6f700af8142460c5f298d7d0
BLAKE2b-256 dd761edf7103089231cc7de340bcdd466e0550ff5e7594cf8061081d6f551a17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page