使用说明
数学MCP服务器
概述
这是一个MCP(模型上下文协议)服务器,可以进行64位精度的基本算术运算以及矩阵乘法。
特性
-
加法
-
减法
-
乘法
-
部门
-
矩阵乘法
安装
先决条件
确保已安装以下内容:
- Python 3.13+
- 紫外线
安装UV
看 安装指南 对于所有选项。
Unix/MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh
或
brew install uv
视窗
winget install --id=astral-sh.uv -e
克隆存储库
git clone https://github.com/avanishd-3/math-mcp.git
cd math-mcp-server
uv sync
与客户整合
克劳德代码
fastmcp安装claude代码src/math_server。py:math_mcp
克劳德桌面
fastmcp安装claude桌面src/math_server。py:math_mcp
光标
fastmcp安装游标src/math_server。py:math_mcp
VS代码
添加以下.vcode/mcp.json并使用实际路径。
{
"servers": {
"Math MCP Server": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"--with",
"numpy",
"fastmcp",
"run",
"/absolute/path/Desktop/to/math-mcp-server/src/math_server.py:math_mcp"
]
}
},
}
贡献
-
分叉存储库
-
创建新分支:
git checkout -b add-feature
- 进行更改并提交(记得在test/目录中添加单元测试)
git commit -m "Added a new feature"
- 推你的叉子
git push origin add-feature
- 打开一个pull请求。
项目结构
/
├── src
│ └── math_server.py
├── tests
│ ├── test_arithmetic.py
│ │ └── astro.svg
│ ├── test_linear_algebra.py
├── pytest.ini
├── pyproject.toml
└── uv.lock
建筑
此MCP服务器使用 快速MCP 2.0,它提供的功能比 快速MCP 1.0,这是MCP官方Python SDK使用的。
此外,单元测试是用Pytest编写的,这是Fast MCP 2.0推荐的。
最后,如果你不知道,uv是pip的一个更快的版本,它还为项目依赖关系提供了一个锁文件(如果你以前使用过npm或cargo,这会很熟悉)。MCP Python SDK本身使用uv,我将其用于所有新的Python项目,因为它比pip快10-100倍,并且锁文件使依赖版本管理变得更加简单。