Metadata-Version: 2.4
Name: mcp-calculator-wyt
Version: 0.2.0
Summary: A comprehensive MCP calculator service supporting basic arithmetic and advanced mathematical functions
Author-email: WYT <wyt@example.com>
License: MIT
Project-URL: Homepage, https://github.com/wyt/mcp-calculator-wyt
Project-URL: Repository, https://github.com/wyt/mcp-calculator-wyt
Project-URL: Issues, https://github.com/wyt/mcp-calculator-wyt/issues
Keywords: mcp,calculator,math,arithmetic,fastmcp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastmcp>=2.12.5
Requires-Dist: mcp[cli]>=1.9.2
Provides-Extra: dev
Requires-Dist: build>=1.2.2.post1; extra == "dev"
Requires-Dist: twine>=6.1.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Dynamic: license-file

# MCP Calculator

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

## 功能特性

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

## 安装

### 从PyPI安装（推荐）

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

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

### 从源码安装

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

# 使用uv安装
uv sync

# 或使用pip安装
pip install .
```

## 使用方法

### 1. stdio传输方式（默认）

```bash
# 直接运行
python -m mcp_calculator_kel

# 或使用脚本入口
mcp_calculator_kel
```

### 2. HTTP传输方式

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

# 或使用脚本入口
mcp_calculator_kel_http

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

### 3. 测试传输方式

```bash
# 运行测试脚本
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. **进入项目根目录**
   ```bash
   cd D:\实验\mcp-calculator
   ```

2. **运行集成测试**
   ```bash
   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_INTEGRATION.md) 获取完整的集成说明和故障排除方法。

### 配置文件

项目提供了预配置的 CherryStudio 配置文件：
- `cherrystudio_config.json` - CherryStudio MCP 服务器配置
- `test_cherrystudio_integration.py` - 集成测试脚本

## 开发

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