This is a calculator that includes addition, subtraction, multiplication, and division
Project description
FastMCP Calculator
这是一个基于FastMCP的测试项目,提供了基本的数学运算功能。
功能介绍
该项目实现了一个简单的MCP服务器,包含以下工具:
add: 计算两个整数的和subtract: 计算两个整数的差multiply: 计算两个整数的积divide: 计算两个数的商(包含除数为零检查)
安装要求
- Python 3.13或更高版本
- MCP CLI 1.13.0或更高版本
安装步骤
- 从PyPI安装:
pip install fastmcp-calculator - 或者克隆此项目后本地安装:
- 进入项目目录:
cd d:\MCP_test1 - 安装依赖:
uv install(如果使用uv)或pip install -e .
- 进入项目目录:
使用方法
- 启动服务器:
python main.py - 使用MCP客户端调用工具,例如:
mcp call mcp.config.usrlocalmcp.mcp-calculate add --a 10 --b 5
示例
调用add工具
mcp call mcp.config.usrlocalmcp.mcp-calculate add --a 233 --b 1
# 输出: 234
调用subtract工具
mcp call mcp.config.usrlocalmcp.mcp-calculate subtract --a 233 --b 1
# 输出: 232
调用multiply工具
mcp call mcp.config.usrlocalmcp.mcp-calculate multiply --a 10 --b 5
# 输出: 50
调用divide工具
mcp call mcp.config.usrlocalmcp.mcp-calculate divide --a 10 --b 2
# 输出: 5.0
贡献指南
欢迎提交问题和拉取请求来改进这个项目。
许可证
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastmcp_calculator-0.1.1.tar.gz.
File metadata
- Download URL: fastmcp_calculator-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f36b0255d33e06fad9d9e9f4f69d0f1e4347e4f3e54967fbfeed8ab2e686e2aa
|
|
| MD5 |
676e92db9ce30205184d160ca2d8d30e
|
|
| BLAKE2b-256 |
6b4bfeac8d47679ed6acebfdbfee7d50dfa6a6540a49ae70ad425f83a7c50ed1
|
File details
Details for the file fastmcp_calculator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fastmcp_calculator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23d6341c889007cf488c36cd324913fd0c56d7be5cd7d07aef2fd730bf799e24
|
|
| MD5 |
50e3b028351bb51684e7e69070c5ac7b
|
|
| BLAKE2b-256 |
12d99ad1e6809962cf9106db8bfb252bdc35945f5b79b9511a782b2fb0f441b3
|