关于 Fermatmcp
Fermat MCP 是一个基于 FastMCP 的 MCP 服务,提供数值计算、符号计算和绘图功能。它基于 NumPy、SymPy 和 Matplotlib 构建,适合需要在 AI 助手中执行数学运算的用户。
主要功能
- 01数值计算工具(NumPy)
- 02符号计算工具(SymPy)
- 03Matplotlib 绘图工具
- 04线性代数运算,如特征值、求解与 SVD
- 05微积分运算,如求导、积分与极限
适用场景
- 01求解高维矩阵的特征值
- 02绘制函数曲线,如 x**2 与 sin(x) 对比
- 03用符号方式化简表达式或求解方程
MCP 相关
该项目是一个 MCP 服务,将数学计算与绘图功能以工具形式提供给 MCP 客户端调用。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
暂未收录安装方式
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Fermat MCP
本项目提供用于数学计算的 FastMCP 服务,包括数值计算、符号计算以及绘图。
模块
1. mpl_mcp - Matplotlib 集成
| 功能 | 描述 |
|---|---|
plot_barchart | 根据给定的数据值绘制条形图 |
plot_scatter | 根据数据点创建散点图 |
plot_chart | 绘制折线图、散点图或条形图 |
plot_stem | 为离散数据创建茎叶图 |
plot_stack | 生成堆叠面积图或条形图 |
eqn_chart | 绘制数学方程图 |
2. numpy_mcp - NumPy 集成
| 类别 | 操作 |
|---|---|
| 基本数学 | add、sub、mul、div、power、abs、exp、log、sqrt |
| 三角函数 | sin、cos、tan |
| 统计 | mean、median、std、var、min、max、argmin、argmax、percentile |
| 线性代数 | dot、matmul、inv、det、eig、solve、svd |
| 矩阵运算 | create、zeros、ones、full、arange、linspace |
| 数组操作 | reshape、flatten、concatenate、transpose、stack |
3. sympy_mcp - SymPy 集成
| 类别 | 操作 |
|---|---|
| 代数 | simplify、expand、factor、collect |
| 微积分 | diff、integrate、limit、series |
| 方程 | solve、solveset、linsolve、nonlinsolve |
| 矩阵运算 | create、det、inv、rref、eigenvals |
设置
要求
克隆仓库
git clone https://github.com/abhiphile/fermat-mcp
Visual Studio Code、Windsurf
您可以在 MCP: Open User Configuration 或 MCP: Open Workspace Configuration 中找到 mcp.json 文件。

将以下内容添加到 mcp.json:
{
"mcpServers": {
"fmcp": {
"command": "bash",
"args": ["MCP_SERVER_ABSOLUTE_PATH/setup.sh"],
"description": "fmcp server is for mathematical computations, including numerical and symbolic calculations, as well as plotting."
}
}
}
Claude(Anthropic)
如果您使用 Claude 或 Anthropic MCP 客户端,请将此可用的 MCP 配置添加到 mcp.json(将目录路径更新为本地克隆目录):
{
"mcpServers": {
"fmcp": {
"command": "uv",
"args": [
"--directory",
"/home/ty/Repositories/fermat-mcp",
"run",
"server.py"
]
}
}
}
Gemini CLI
-
打开位于 ~/.gemini/settings.json 的 Gemini 设置 JSON 文件,其中 ~ 表示您的主目录。
-
将以下内容添加到 settings.json:
{
"mcpServers": {
"fmcp": {
"command": "bash",
"args": ["MCP_SERVER_ABSOLUTE_PATH/setup.sh"],
"description": "fmcp server is for mathematical computations, including numerical and symbolic calculations, as well as plotting."
}
}
}
通过 Smithery 安装
若要通过 Smithery 自动在本地安装 Fermat MCP:
npx -y @smithery/cli install @abhiphile/fermat-mcp --client gemini
使用示例
- 使用 Gemini CLI
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Can you use fmcp server and using numpy method find the eigen values of this 8*8 matrix, |
│ 2 1 3 1 1 8 4 2 |
│ 6 6 0 7 1 4 6 1 │
│ 9 2 1 8 7 9 9 0 │
│ 2 5 6 6 9 8 0 1 │
│ 1 3 6 2 3 8 8 1 │
│ 9 4 2 2 1 2 2 9 │
│ 8 6 4 4 2 0 2 8 │
│ 0 0 0 6 6 7 5 6 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ numpy_mcp_numerical_operation (fmcp MCP Server) {"a":[[2,1,3,1,1,8,4,2],[6,6,0,7,1,4,6,1],[9,2,1,8,7,9,9,0],[2,5,6,6,9,8,0,1],[1,3,… │
│ │
│ {"eigenvalues":["32.077244457548815+0j","-11.531090644775198+0j","-6.6653982146786195+0j","0.6715984762411508+3.37024850 │
│ 10270413j","0.6715984762411508-3.3702485010270413j","4.541270555490195+2.776364664923869j","4.541270555490195-2.77636466 │
│ 4923869j","3.6935063384423428+0j"],"eigenvectors":[["-0.23263835483680192+0j","-0.2264723575289234+0j","-0.4308391916391 │
│ 0195+0j","-0.012346573390129022+0.17748655663058255j","-0.012346573390129022-0.17748655663058255j","-0.21221572277027187 │
│ +0.3524396218277479j","-0.21221572277027187-0.3524396218277479j","0.3451499664861578+0j"],["-0.31955742545335186+0j","-0 │
│ .2569860493445581+0j","0.05691886770041556+0j","-0.35591013681869693-0.2242364092694275j","-0.35591013681869693+0.224236 │
│ 4092694275j","0.1932161673963751-0.39527849111641133j","0.1932161673963751+0.39527849111641133j","-0.7979681696063214+0j │
│ "],["-0.46626263247473404+0j","-0.4684914620112376+0j","0.5469400556350749+0j","0.34325164099973565+0.06607019711949293j │
│ ","0.34325164099973565-0.06607019711949293j","0.21312270185159682+0.28822307710358636j","0.21312270185159682-0.288223077 │
│ 10358636j","0.42707422750984786+0j"],["-0.41589316441674523+0j","0.2291771012892302+0j","0.09410792992600435+0j","0.6375 │
│ 92441360358+0j","0.637592441360358+-0j","0.46446646137729414+0j","0.46446646137729414+-0j","0.08171661775583623+0j"],["- │
│ 0.35812884189789035+0j","-0.26551071423139044+0j","-0.649979374400915+0j","-0.2999153430497845+0.20110182336747695j","-0 │
│ .2999153430497845-0.20110182336747695j","0.04424367733961273-0.020400357434930304j","0.04424367733961273+0.0204003574349 │
│ 30304j","-0.037276545325188024+0j"],["-0.3042416233100104+0j","0.4027405071320744+0j","0.2343447346668298+0j","-0.119224 │
│ 87219398595+0.10317726668781271j","-0.11922487219398595-0.10317726668781271j","-0.3387759141362585+0.15790241128043445j" │
│ ,"-0.3387759141362585-0.15790241128043445j","0.11473144194899779+0j"],["-0.35389732755448017+0j","0.5359362131480812+0j" │
│ ,"0.13989902586074168+0j","-0.16008513226461316-0.26111873108374495j","-0.16008513226461316+0.26111873108374495j","0.055 │
│ 729749650881726-0.22748184206919145j","0.055729749650881726+0.22748184206919145j","-0.19838514696566653+0j"],["-0.327615 │
│ 5213691367+0j","-0.30122843153433887+0j","0.07858579556736099+0j","0.00042251379361638556-0.11670182367986544j","0.00042 │
│ 251379361638556+0.11670182367986544j","-0.18590228871569267-0.2479130526139182j","-0.18590228871569267+0.247913052613918 │
│ 2j","-0.03374593856285834+0j"]]} │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ Of course, I can do that. Here are the eigenvalues for the given matrix:
32.077244457548815
-11.531090644775198
-6.6653982146786195
0.6715984762411508 + 3.3702485010270413j
0.6715984762411508 - 3.3702485010270413j
4.541270555490195 + 2.776364664923869j
4.541270555490195 - 2.776364664923869j
3.6935063384423428
- 使用 Visual Studio Code、Windsurf
此处的任务是要在同一张图中绘制 x**2 和 sin(x)。

评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。