sumit-saha/calculator
3.1
If you are the rightful owner of 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 dayong@mcphub.com.
This project demonstrates a simple use of the Model Context Protocol (MCP) to perform basic mathematical operations using a custom MCP server and a Streamlit client UI.
Tools
4
Resources
0
Prompts
0
MCP Calculator
This project demonstrates a simple use of the Model Context Protocol (MCP) to perform basic mathematical operations using a custom MCP server and a Streamlit client UI.
Features
- MCP Server: Exposes four operations — Add, Subtract, Multiply, Divide — as MCP tools.
- Streamlit Client: Simple web UI to select operation and input numbers, powered by MCP protocol.
- Session-based Communication: Client and server communicate over a session, locally (stdio).
- No authentication or persistent storage: Pure MVP.
Directory Structure
project/
│
├── calculator_server.py # MCP Server (Python)
├── mcp_client.py # Streamlit UI MCP Client (Python)
└── README.md
Prerequisites
- Python 3.8+
- pip
Installation
- Clone or copy this repo/project directory
- Install dependencies:
pip install streamlit "mcp[cli]"
Running the Demo
- Start the Streamlit client:
streamlit run mcp_client.py
- This will automatically launch the MCP server as needed.
- The UI will open in your browser at http://localhost:8501.
-
Using the app:
- Enter two numbers.
- Select an operation (Add, Subtract, Multiply, Divide).
- Click Compute.
- The result will be displayed instantly!
How It Works
- The Streamlit client launches the MCP server (
calculator_server.py) as a subprocess using MCP’s stdio transport. - The server exposes math functions as MCP tools.
- Each calculation runs in a session — the client requests the operation, the server computes and responds, and the result is shown in the UI.
- The server and client can be easily extended with more operations.
References
License
This demo is provided as-is for educational and MVP purposes.