本项目是一个使用 Model Context Protocol (MCP) 的服务器,可将 LaTeX 数学表达式转换为 MathML 格式,为数学表达式的处理提供了便捷的解决方案。此 README.md 文件由 DeepSeek V3 编写。
本服务器能将 LaTeX 数学表达式转换为 MathML 格式,支持工具转换和资源访问两种方式,且基于标准 MCP 协议实现,便于集成。下面为你介绍启动服务器的步骤:
# 克隆此仓库
git clone https://github.com/HappyAny/latex-mathml-mcp-server.git
cd latex-mathml-mcp-server
# 安装依赖项
npm install mathjax-node
npm install @modelcontextprotocol/sdk
# 启动服务器
node index.js
服务器启动后将通过 stdio 传输监听 MCP 客户端连接。
git clone https://github.com/HappyAny/latex-mathml-mcp-server.git
cd latex-mathml-mcp-server
npm install mathjax-node
npm install @modelcontextprotocol/sdk
node index.js
latex2mathmlmathml://{latex_expression}要从 MCP 客户端连接到此服务器,请在客户端设置中添加以下配置:
{
"mcpServers": {
"latex-mathml-server": {
"isActive": true,
"command": "node",
"args": [
"path_to_your_server/index.js"
]
}
}
}
请将 path_to_your_server/index.js 替换为您实际的服务器脚本路径。
请求格式:
{
"latex": "your_LaTeX_expression"
}
示例请求:
{
"latex": "E = mc^2"
}
响应格式:
{
"content": [
{
"type": "text",
"text": ""
}
]
}
使用以下 URI 模式访问数学表达式:
mathml://E%20%3D%20mc%5E2
⚠️ 重要提示:LaTeX 表达式应在资源 URI 中进行 URL 编码。
@modelcontextprotocol/sdk:MCP 服务器 SDKmathjax-node:LaTeX 到 MathML 转换zod:输入验证这是一个 Node.js 项目。只需克隆仓库并按照安装部分安装依赖项即可。
本项目采用 MIT 许可证。