LaTeX to MathML MCP Server

by HappyAny

LaTeX to MathML MCP Server

A Model Context Protocol (MCP) server that converts LaTeX mathematical expressions to MathML format. And this README.md is written by DeepSeek V3.

Features

  • Converts LaTeX mathematical expressions to MathML
  • Provides both tool-based conversion and resource-based access
  • Standard MCP protocol implementation for easy integration
  • Lightweight and fast conversion using MathJax-node

Installation

  1. Clone this repository:
    git clone https://github.com/HappyAny/latex-mathml-mcp-server.git cd latex-mathml-mcp-server
  2. Install dependencies:
    npm install mathjax-node npm install @modelcontextprotocol/sdk

Usage

Starting the Server

Run the server using Node.js:

node index.js

The server will start and listen for MCP client connections via stdio transport.

Available Services

  1. Tool-based Conversion:
    • Tool name: latex2mathml
    • Input: LaTeX string
    • Output: MathML string
  2. Resource-based Access:
    • Resource URI pattern: mathml://{latex_expression}
    • Returns: MathML representation of the LaTeX expression

Client Integration

To connect to this server from an MCP client, add the following configuration to your client's settings:

{ "mcpServers": { "latex-mathml-server": { "isActive": true, "command": "node", "args": [ "path_to_your_server/index.js" ] } } }

Replace path_to_your_server/index.js with the actual path to the server script.

API Details

Tool: latex2mathml

Request Format:

{ "latex": "your_LaTeX_expression" }

Example Request:

{ "latex": "E = mc^2" }

Response Format:

{ "content": [ { "type": "text", "text": "<math xmlns=\"http://www.w3.org/1998/Math/MathML\">...</math>" } ] }

Resource: mathml://{id}

Access mathematical expressions as resources using the URI pattern:

mathml://E%20%3D%20mc%5E2

(Note: LaTeX expressions should be URL-encoded in the resource URI)

Development

Dependencies

  • @modelcontextprotocol/sdk: MCP server SDK
  • mathjax-node: LaTeX to MathML conversion
  • zod: Input validation

Building

This is a Node.js project. Simply clone and install dependencies as shown in the Installation section.

License

MIT

-
security - not tested
-
license - not tested
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

A Model Context Protocol (MCP) server that converts LaTeX mathematical expressions to MathML format.

  1. Features
    1. Installation
      1. Usage
        1. Starting the Server
        2. Available Services
      2. Client Integration
        1. API Details
          1. Tool: latex2mathml
          2. Resource: mathml://{id}
        2. Development
          1. Dependencies
          2. Building
        3. License

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol (MCP) server that provides mathematical calculations and operations using NumPy, enabling users to perform numerical computations like matrix operations, statistical analysis, and polynomial fitting directly through Claude.
            Last updated -
            Python
            • Linux
            • Apple
          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that enables LLMs to perform precise numerical calculations by evaluating mathematical expressions.
            Last updated -
            1
            29
            Python
            MIT License
            • Linux
            • Apple
          • -
            security
            -
            license
            -
            quality
            A specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.
            Last updated -
            1
            TypeScript
          • -
            security
            -
            license
            -
            quality
            A tool server that processes mathematical expressions via Multi-Chain Protocol (MCP), allowing LLMs to solve math problems through tool integration.
            Last updated -
            Python
            MIT License

          View all related MCP servers

          ID: yrx9i3gud0