Simple_Python_MCP_calculator

Simple_Python_MCP_calculator

3.2

If you are the rightful owner of Simple_Python_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.

This project demonstrates how to build and test a Model Context Protocol (MCP) server locally using Python, exposing calculator functions as MCP tools.

Simple_Python_MCP_calculator

This is a simple python MCP calculator. Simple to create, implement and run a MCP server. This also help with creation of MCP server locally.

# MCP Server Example

A simple example of building and testing a Model Context Protocol (MCP) server locally using Python and MCP Inspector. This project demonstrates how to expose calculator functions as MCP tools and test them interactively.

---

## 🚀 Features

- Implements a basic MCP server in Python
- Exposes calculator operations as MCP tools
- Includes a sample resource endpoint
- Easily testable locally with MCP Inspector

---

## 🛠️ Prerequisites

- Python 3.8 or higher
- [MCP Python SDK]
- [MCP CLI]
- (Recommended) Virtual Environment

---

## 📦 Installation

1. Clone the repository

git clone https://github.com/ItsMistahJi/Simple_Python_MCP_calculator.git


cd Simple_Python_MCP_calculator



2. Create and activate a virtual environment


python3 -m venv venv
source venv/bin/activate



3. Install dependencies


pip install mcp
pip install mcp[cli]



## ▶️ Running & Testing the Server

1. Start the MCP server using the MCP CLI:

mcp dev calculator.py



2. Open the MCP Inspector link provided in your terminal.

3. Test your tools and resources interactively in the Inspector UI.

---

## To add it in your MCP client. Use the below JSON in the MCP client settings.

            "Calculator": {
                "type": "stdio",
                "command": "/path/to/your/venv/bin/python",
                "args": [
                    "/path/to/your/calculator.py"
                ]
            }


*Happy building with MCP!*