Skip to main content

MCP Calculator

一个支持多种传输方式的MCP计算器服务,提供基本算术运算和高级数学函数。

功能特性

  • 基本算术运算: 加法、减法、乘法、除法
  • 高级数学函数: 幂运算、平方根、阶乘
  • 多种传输方式: 支持stdio和streamable HTTP传输
  • 错误处理: 完善的错误处理机制(如除零检查)

安装

从PyPI安装(推荐)

# 使用pip安装
pip install mcp-calculator-wyt

# 或使用uv安装
uv add mcp-calculator-wyt

从源码安装

# 克隆仓库
git clone https://github.com/wyt/mcp-calculator-wyt.git
cd mcp-calculator-wyt

# 使用uv安装
uv sync

# 或使用pip安装
pip install .

使用方法

1. stdio传输方式(默认)

# 直接运行
python -m mcp_calculator_kel

# 或使用脚本入口
mcp_calculator_kel

2. HTTP传输方式

# 启动HTTP服务器
python -m mcp_calculator_kel.http_server

# 或使用脚本入口
mcp_calculator_kel_http

# 自定义主机和端口
mcp_calculator_kel_http --host 0.0.0.0 --port 8080

3. 测试传输方式

# 运行测试脚本
python test_transports.py

可用工具

  • add(a: float, b: float): 执行浮点数加法运算
  • subtract(a: float, b: float): 执行浮点数减法运算
  • multiply(a: float, b: float): 执行浮点数乘法运算
  • divide(a: float, b: float): 执行浮点数除法运算
  • power(base: float, exponent: float): 计算幂运算
  • sqrt(number: float): 计算平方根
  • factorial(n: int): 计算整数阶乘

传输方式说明

  • stdio: 适用于本地进程间通信,通过标准输入输出进行交互
  • streamable-http: 适用于远程通信,通过HTTP协议提供更灵活的交互方式

CherryStudio 集成

快速开始

  1. 进入项目根目录

    cd D:\实验\mcp-calculator
    
  2. 运行集成测试

    uv run python test_cherrystudio_integration.py
    

    或直接双击 test_cherrystudio.bat

  3. 配置 CherryStudio

    • 打开 CherryStudio
    • 进入设置 → MCP 服务器
    • 添加服务器:
      • 名称: mcp-calculator
      • 命令: uv
      • 参数: run python -m mcp_calculator_kel
      • 工作目录: 项目根目录路径
  4. 开始使用

    • 在 CherryStudio 中直接使用计算工具
    • 支持自然语言交互,如:"请计算 15 + 27"

详细集成指南

查看 CherryStudio 集成指南 获取完整的集成说明和故障排除方法。

配置文件

项目提供了预配置的 CherryStudio 配置文件:

  • cherrystudio_config.json - CherryStudio MCP 服务器配置
  • test_cherrystudio_integration.py - 集成测试脚本

开发

项目使用fastmcp框架构建,支持MCP协议的标准功能。

Metadata

Release files for mcp-calculator-wyt 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-calculator-wyt 0.2.0
File Size Uploaded Provenance
mcp_calculator_wyt-0.2.0.tar.gz 5.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-calculator-wyt 0.2.0
File Interpreter ABI Platform
mcp_calculator_wyt-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / mcp_calculator_wyt-0.2.0.tar.gz

Download URL mcp_calculator_wyt-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8e3e9ada13c10857b53584c6dc1ec6de080ca6d39604b73a294e1adceb841671
BLAKE2b-256 checksum
How to use checksums
dc1dfe443c96e5079996b77c6f5856c8fd0ee8aa19bf4195d902bba64b078852
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / mcp_calculator_wyt-0.2.0-py3-none-any.whl

Download URL mcp_calculator_wyt-0.2.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd9f4eb7399975021027339bee06ab10a0671d34ddca57a62ee506b06b447fdf
BLAKE2b-256 checksum
How to use checksums
715841eacacbcbadc89ad201cae33f1b3b16e5dff7b35003fcf328d5fb34d52b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for mcp-calculator-wyt 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page