MCP-calculator

smazziotta/MCP-calculator

3.1

If you are the rightful owner of MCP-calculator and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

MCP-calculator is a simple Model Context Protocol server generated by Claude, designed to perform basic arithmetic operations.

Calculator MCP Server

A simple calculator implemented as an MCP (Model Context Protocol) server for learning purposes.

Features

This calculator provides the following operations as MCP tools:

  • add: Add two numbers
  • subtract: Subtract two numbers
  • multiply: Multiply two numbers
  • divide: Divide two numbers (with zero division protection)
  • power: Raise a number to a power
  • sqrt: Calculate square root (with negative number protection)

Setup

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Run the MCP server:

    python calculator.py
    

MCP Integration

This server can be integrated with MCP clients by configuring the mcp_config.json file in your MCP client settings.

Learning MCP

This project demonstrates:

  • How to create MCP tools with proper schemas
  • Error handling in MCP servers
  • Async/await patterns for MCP operations
  • Standard input/output communication protocol