使用MCP的计算器
一个具有基本算术运算的演示Python计算器应用程序。
特性
- 加法
- 减法
- 乘法
- 部门
- 力量
- 模
安装
- 克隆存储库:
git clone https://github.com/chitskate17/calculator-using-mcp.git
cd calculator-using-mcp- 运行计算器:
python calculator.py用法
交互模式
在交互模式下运行计算器:
python calculator.py按照屏幕上的提示执行计算。
作为一个模块
您还可以在自己的Python代码中导入和使用Calculator类:
from calculator import Calculator
calc = Calculator()
result = calc.add(5, 3)
print(f"5 + 3 = {result}")测试
运行单元测试:
python -m pytest test_calculator.py需求
- Python 3.6或更高版本
许可证
MIT许可证
