Math Svg Mcp

io.github.wspringer由 GitHub 账号 wspringer 发布v1.1.2更新于 Oct 24, 2026

Convert LaTeX math expressions to crisp, scalable SVG images

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

将 LaTeX 数学表达式转换为可缩放的 SVG 图像,可直接返回内容或保存为文件。

可以做什么
这个本地 MCP 服务器提供两个把 LaTeX 数学公式转成 SVG 的工具。latex_to_svg 渲染表达式并直接返回 SVG 内容,latex_to_svg_file 渲染后把结果写入你指定的路径。两者都可设置输出单位、块级或行内模式、字号、x 高度比例,并可从十种数学字体中选择,默认的 Latin Modern 字体已内置。
适用场景
适合需要为文档、幻灯片或网页生成公式图片的场景,也适合希望把数学公式输出为矢量图形而非纯文本的情况。当 LaTeX 已是源格式、且输出需要在任意尺寸下保持清晰时尤为合适。
运行要求
以 npm 包(math-svg-mcp)形式通过 stdio 在本地运行,需要 Node.js 18 或更高版本。未声明任何账号、API 密钥或环境变量。非默认数学字体会在首次使用时下载并缓存到用户缓存目录,因此这些字体需要网络访问。
安装前请注意
写文件工具会把 SVG 输出保存到你提供的路径,请只指向你确实要写入的位置。非默认字体会在首次使用时从网络获取并缓存在本地。不涉及凭据或付费。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Math Svg Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

math-svg-mcp

An MCP server that converts LaTeX math expressions to SVG.

Once configured, Claude (or your favorite AI assistant) is able to convert LaTeX math expressions to SVG. So you could, for instance, ask:

Give me the Laplace transform formula as SVG

The assistant will generate the LaTeX:

latex
\mathcal{L}\{f(t)\} = \int_0^\infty f(t) e^{-st} \, dt = F(s)

and use the tool to render it:

[Laplace transform]

[Works great with Sidekick for InDesign]

Quick Install (Claude Desktop)

Download and open the .mcpb file from the latest release to automatically configure Claude Desktop.

Or use this direct link: math-svg-mcp.mcpb

Manual Configuration

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

json
{  "mcpServers": {    "math-svg": {      "command": "npx",      "args": ["-y", "math-svg-mcp"]    }  }}

Claude Code

Add to your Claude Code settings (.claude/settings.json or global settings):

json
{  "mcpServers": {    "math-svg": {      "command": "npx",      "args": ["-y", "math-svg-mcp"]    }  }}

Or run directly:

bash
claude mcp add math-svg -- npx -y math-svg-mcp

Other MCP Clients

Any MCP-compatible client can use this server with the same configuration pattern:

json
{  "command": "npx",  "args": ["-y", "math-svg-mcp"]}

Global Installation (Optional)

For faster startup, install globally:

bash
npm install -g math-svg-mcp

Then configure your client to use:

json
{  "command": "math-svg-mcp"}

Tools

latex_to_svg

Converts a LaTeX expression to SVG and returns the content directly.

ParameterRequiredDefaultDescription
latexYes—LaTeX math expression
unitYes—Output unit: pt, px, mm, or ex
displayNotrueDisplay mode (block) vs inline
fontSizeNo16Font size in the specified unit
xHeightRatioNo0.5Ratio of x-height to font size
fontNomodernMath font (see Available Fonts)

Example: E = mc^2

latex_to_svg_file

Converts a LaTeX expression to SVG and saves to a file.

ParameterRequiredDefaultDescription
latexYes—LaTeX math expression
outputPathYes—File path for the SVG
unitYes—Output unit: pt, px, mm, or ex
displayNotrueDisplay mode (block) vs inline
fontSizeNo16Font size in the specified unit
xHeightRatioNo0.5Ratio of x-height to font size
fontNomodernMath font (see Available Fonts)

Example: \int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2} → /tmp/gaussian.svg

Available Fonts

The font parameter lets you choose from 10 math fonts. The default modern font (Latin Modern) is bundled; others are automatically downloaded on first use and cached in ~/.cache/math-svg-mcp/fonts/.

FontDescription
modernLatin Modern (default, bundled)
stix2STIX Two Math
newcmNew Computer Modern
firaFira Math
bonumTeX Gyre Bonum
pagellaTeX Gyre Pagella
scholaTeX Gyre Schola
termesTeX Gyre Termes
dejavuDejaVu
asanaAsana Math

Requirements

  • Node.js 18 or later

Development

bash
npm installnpm run buildnpm test

License

MIT

来源:README.md,提交 027f83a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.1.2最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。