latex-mathml
A Model Context Protocol (MCP) server that converts LaTeX mathematical expressions to MathML format.
claude mcp add --transport stdio happyany-latex-mathml-mcp-server node index.js
How to use
This MCP server provides two ways to convert LaTeX expressions to MathML using the MCP protocol. First, you can use the tool-based conversion by calling the latex2mathml tool with a JSON payload that includes a LaTeX string; the server responds with a MathML string wrapped in the MCP response format. Second, you can access predefined MathML representations via a resource URI using the mathml:// pattern, where the LaTeX expression is URL-encoded in the URI. The server is built with MathJax-node for fast, lightweight conversion and integrates with the standard MCP SDK for easy client integration.
To connect from an MCP client, start the server (for example with node index.js) and configure your client to point to the latex-mathml-server MCP endpoint. You can then invoke the latex2mathml tool by sending a request like { "tool": "latex2mathml", "latex": "E = mc^2" } and receive a response containing the corresponding MathML. For resource-based access, request a URI such as mathml://E%20%3D%20mc%5E2 to retrieve the MathML for the encoded LaTeX expression.
How to install
Prerequisites:
- Node.js (and npm) installed on your system
- Access to the project repository for latex-mathml-mcp-server
Installation steps:
-
Clone the repository: git clone https://github.com/HappyAny/latex-mathml-mcp-server.git cd latex-mathml-mcp-server
-
Install dependencies: npm install npm install mathjax-node npm install @modelcontextprotocol/sdk
-
Verify installation:
- Ensure node is available: node -v
- Ensure npm packages are installed: npm ls
-
Run the server: node index.js
-
Optional: run in the background or via a process manager (e.g., pm2) for production use.
Additional notes
Notes and tips:
- The latex2mathml tool converts a given LaTeX string to MathML using MathJax-node.
- The resource-based access uses the mathml:// URI pattern with a URL-encoded LaTeX expression, e.g., mathml://E%20%3D%20mc%5E2.
- If you modify the path to the server script, update your MCP client configuration accordingly (e.g., replace index.js with the correct path).
- Ensure dependencies are installed in the same project directory where the server runs.
- Common issues: incorrect LaTeX syntax may cause conversion errors; always validate inputs before sending to the server.
- Environment variables are not mandatory by default but can be added for advanced configuration (e.g., port, logging).
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.