UpMath MCP服务器
MCP服务器,允许Claude Code通过以下方式直接访问LaTeX渲染 UpMath API。无需本地TeX安装,即可将方程、TikZ图和完整文档渲染为SVG/PNG。
工具
| 工具 | 说明 |
|---|---|
render_equation | 将LaTeX方程渲染为SVG或PNG |
render_tikz | 将TikZ/pgfplots/circuitikz图渲染为SVG或PNG |
render_batch | 一次渲染多个方程,保存到文件 |
render_markdown_with_math | 使用渲染标记 $$...$$ 数学到HTML的嵌入SVG |
check_syntax | 验证LaTeX语法而不保存 |
get_render_url | 获取用于嵌入HTML/makdown的UpMath URL |
支持的软件包
TeX Live支持的所有内容,包括:
| 类别 | 套餐 |
|---|---|
| 数学 | 所有标准LaTeX数学, mathrsfs, esvect, stmaryrd |
| 图形 | tikz +图书馆, tikz-3dplot, pgfplots, pgflibrary |
| 图表 | circuitikz (电路), bussproofs (证明) |
| 化学 | mhchem |
| 格式化 | array, xcolor, kotex |
设置
git clone https://github.com/danielsimonjr/upmath-mcp.git
cd upmath-mcp
npm install添加 ~/.claude/.mcp.json:
{
"mcpServers": {
"upmath": {
"command": "node",
"args": ["/path/to/upmath-mcp/server.js"]
}
}
}重新启动克劳德代码。渲染工具将可用。
示例
渲染二次公式:
render_equation({ latex: "\\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}", format: "svg" })渲染电路:
render_tikz({
tikz: "\\begin{circuitikz}\\draw (0,0) to[R, l=$R_1$] (2,0) to[C, l=$C_1$] (4,0);\\end{circuitikz}",
packages: ["circuitikz"],
format: "svg",
saveTo: "circuit.svg"
})自我寄宿
您可以运行自己的UpMath渲染器:
docker run -t -p 8080:80 ghcr.io/parpalak/i.upmath.me:master然后设置 UPMATH_URL=http://localhost:8080 在您的环境中。
许可证
麻省理工学院
学分
- i.upath.me -LaTeX-to-SVG API
