返回市场
数学-MCP

数学-MCP

作者:avanishd-31 星标更新:2025-09-18

项目介绍

Math MCP 服务器

概述

这是一个可以进行64位精度基本算术运算以及矩阵乘法的MCP(模型上下文协议)服务器。

<a href="https://glama.ai/mcp/servers/@avanishd-3/math-mcp"> <img width="380" height="200" src="https://gips1.baidu.com/it/u=2357375568,521790922&fm=3081&app=3081&f=PNG?w=760&h=400" alt="数学服务器MCP服务器" /> </a>

特性

  • 加法

  • 减法

  • 乘法

  • 除法

  • 矩阵乘法

安装

先决条件

确保已安装以下内容:

  • Python 3.13+
  • uv

安装UV

查看安装指南以获取所有选项。

Unix/MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh

brew install uv
Windows
winget install --id=astral-sh.uv  -e

克隆仓库

git clone https://github.com/avanishd-3/math-mcp.git
cd math-mcp-server
uv sync

与客户端集成

Claude代码

fastmcp install claude-code src/math_server.py:math_mcp

Claude桌面

fastmcp install claude-desktop src/math_server.py:math_mcp

Cursor

fastmcp install cursor src/math_server.py:math_mcp

VS Code

添加以下.vscode/mcp.json并使用实际路径。

{
  "servers": {
    "Math MCP Server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "fastmcp",
        "--with",
        "numpy",
        "fastmcp",
        "run",
        "/绝对路径/Desktop/to/math-mcp-server/src/math_server.py:math_mcp"
      ]
    }
  },
}

贡献

  1. 分叉仓库

  2. 创建新分支:

git checkout -b add-feature
  1. 进行更改并提交(记得在test/目录中添加单元测试)
git commit -m "添加了一个新功能"
  1. 推送到您的分叉
git push origin add-feature
  1. 打开拉取请求。

项目结构

/
├── src
│   └── math_server.py
├── tests
│   ├── test_arithmetic.py
│   │   └── astro.svg
│   ├── test_linear_algebra.py
├── pytest.ini
├── pyproject.toml
└── uv.lock

架构

此MCP服务器使用Fast MCP 2.0,它比官方Python SDK使用的Fast MCP 1.0提供了更多功能。

此外,单元测试是用Pytest编写的,这是Fast MCP 2.0推荐的工具。

最后,如果您不知道的话,uv是一个比pip快得多的版本,并且还提供了一个用于项目依赖项的锁文件(如果您之前使用过npm或cargo,这应该很熟悉)。MCP Python SDK本身使用uv,我将其用于所有新的Python项目,因为它比pip快10-100倍,而锁文件使依赖项版本管理更加简单。