Skip to main content
Glama
JonnadulaNagaSambaSivaRao

MCP Calculator Server

README.md
# 🧮 MCP Calculator Server

<p align="center">
  <img src="https://img.shields.io/badge/MCP-Model%20Context%20Protocol-8A2BE2?style=for-the-badge" alt="MCP">
  <img src="https://img.shields.io/badge/Python-3.12-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python">
  <img src="https://img.shields.io/badge/uv-Package%20Manager-DE5FE9?style=for-the-badge" alt="uv">
  <img src="https://img.shields.io/badge/Cursor-MCP%20Client-000000?style=for-the-badge" alt="Cursor">
</p>

<p align="center">
  <b>A simple MCP server that exposes calculator operations as tools and connects them to Cursor.</b>
</p>

---

## 🌟 Project Overview

This project demonstrates how to build a simple **Model Context Protocol (MCP) server** using Python.

The MCP server exposes calculator operations as tools that can be called by an MCP-compatible client such as **Cursor**.

Instead of manually writing Python code for every calculation, Cursor can understand the user's request and call the appropriate MCP tool.

### 🔥 Available Calculator Tools

| 🔧 Tool | 📝 Description | 💡 Example |
|---|---|---|
| ➕ `add` | Adds two numbers | `add(10, 20)` → `30` |
| ➖ `subtract` | Subtracts two numbers | `subtract(20, 10)` → `10` |
| ✖️ `multiply` | Multiplies two numbers | `multiply(10, 5)` → `50` |
| ➗ `divide` | Divides two numbers | `divide(100, 4)` → `25` |
| 🔢 `power` | Calculates power | `power(2, 10)` → `1024` |

---

# 🏗️ Architecture

```text
                  👤 USER
                    │
                    │
                    ▼
             🤖 CURSOR AGENT
                    │
                    │ MCP Protocol
                    ▼
             🔌 MCP CLIENT
                    │
                    │ stdio
                    ▼
        🧮 CALCULATOR MCP SERVER
                    │
       ┌────────────┼────────────┐
       │            │            │
       ▼            ▼            ▼
     ➕ add      ➖ subtract   ✖️ multiply
       │            │            │
       └────────────┼────────────┘
                    │
              ┌─────┴─────┐
              ▼           ▼
          ➗ divide    🔢 power