Add Two Numbers MCP Server
一个简单而实用的 MCP 服务,提供数字相加计算和个性化问候功能。
功能特性
- 数字相加工具: 提供两个整数相加的计算功能
- 个性化问候资源: 根据提供的姓名生成个性化问候语
- 轻量级设计: 基于 FastMCP 框架,简单易用
- 标准 MCP 协议: 完全兼容 Model Context Protocol 标准
安装方式
通过 pip 安装
pip install add-two-num
从源码安装
git clone <your-repo-url>
cd add-two-num
pip install -e .
服务配置
基本配置
{
"mcpServers": {
"add-two-num": {
"command": "uvx",
"args": ["add-two-num@latest"],
"env": {}
}
}
}
本地开发配置
{
"mcpServers": {
"add-two-num": {
"command": "python",
"args": ["-m", "add_two_num"],
"cwd": "/path/to/add-two-num",
"env": {}
}
}
}
可用工具
sum
计算两个整数的和。
参数:
a(int): 第一个整数b(int): 第二个整数
返回值:
int: 两个数的和
示例:
# 调用示例
result = sum(5, 3) # 返回 8
可用资源
greeting://{name}
生成个性化问候语。
参数:
name(str): 要问候的姓名
返回值:
str: 个性化问候语
示例:
greeting://Alice # 返回 "Hello, Alice!"
使用指南
- 配置 MCP 客户端: 将上述服务配置添加到你的 MCP 客户端配置文件中
- 启动服务: MCP 客户端会自动启动 add-two-num 服务
- 使用工具: 通过 MCP 客户端调用
sum工具进行数字计算 - 访问资源: 通过
greeting://URI 获取个性化问候语
技术规格
- Python 版本: >= 3.13
- 依赖框架: FastMCP, MCP CLI
- 通信协议: stdio
- 协议版本: MCP 1.11.0+
开发说明
本地开发
# 克隆仓库
git clone <your-repo-url>
cd add-two-num
# 安装依赖
pip install -e .
# 运行服务
python -m add_two_num
测试
# 测试工具调用
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "sum", "arguments": {"a": 5, "b": 3}}}' | python -m add_two_num
许可证
本项目采用 MIT 许可证。
贡献
欢迎提交 Issue 和 Pull Request 来改进这个项目!
作者
- Abin - trashwbin@gmail.com
更新日志
v0.1.0
- 初始版本发布
- 实现基本的数字相加功能
- 添加个性化问候资源
Metadata
Release files for abin-add-two-num 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| abin_add_two_num-0.1.2.tar.gz | 2.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| abin_add_two_num-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.4 kB
Release files / abin_add_two_num-0.1.2.tar.gz
| Download URL | abin_add_two_num-0.1.2.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92900447a33f2ef4102f815a4805790d40b8164a1674d8d48566eb5c16841a06
|
|
BLAKE2b-256 checksum How to use checksums |
1fb8d468e919903d5b57825666967c27a69fe368562b55b7a34de0e1082c32bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.20
|
Release files / abin_add_two_num-0.1.2-py3-none-any.whl
| Download URL | abin_add_two_num-0.1.2-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af38809831faf89b807522d341a83d1d836dfba042337969a7cbc2b863148550
|
|
BLAKE2b-256 checksum How to use checksums |
04d74fcab632e9a648f02666f23be6a74bcfbebfb26f7b5f6ff23e012c098e70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.20
|
Security for abin-add-two-num 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.