MCP-latex-server

varennes-ecofin/MCP-latex-server

3.2

If you are the rightful owner of MCP-latex-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP LaTeX Server is a Python-based server designed for users of TeX Live and MikTeX who want to integrate AI into their LaTeX workflow, specifically on Windows systems.

MCP LaTeX Server - Windows Installation

This MCP LaTeX server, coded in Python, is intended for TeX Live and MikTeX users wishing for a deeper AI integration in their use of LaTeX. The installation is documented for Windows with Claude Desktop as an example, but it also works on Mac with other AIs.

šŸ“ Locations on your system

  • MCP Server: C:\Users\username\Documents\MCP\latex-server\
  • LaTeX Projects: C:\Users\username\Documents\LaTeX\
  • Claude Config: C:\Users\username\AppData\Roaming\Claude\claude_desktop_config.json

⚔ Manual Installation

  1. Create the directories:

    mkdir C:\Users\username\Documents\MCP\latex-server
    mkdir C:\Users\username\Documents\LaTeX
    
  2. Install dependencies:

    cd C:\Users\username\Documents\MCP\latex-server
    pip install mcp aiofiles
    
  3. Copy the server:

    • Place mcp_latex_server.py in C:\Users\username\Documents\MCP\latex-server\
  4. Configure Claude Desktop:

    • Edit C:\Users\username\AppData\Roaming\Claude\claude_desktop_config.json
    • Add:
      {
        "mcpServers": {
          "latex-server": {
            "command": "python",
            "args": [
              "C:\\Users\\username\\Documents\\MCP\\latex-server\\mcp_latex_server.py",
              "--workspace",
              "C:\\Users\\username\\Documents\\LaTeX"
            ]
          }
        }
      }
      
  5. Restart Claude Desktop

āœ… Verification

Quick test in Claude Desktop

Type into Claude:

"Create a test.tex file with an article template"

If it works, Claude will create C:\Users\username\Documents\LaTeX\test.tex

Command line test

cd C:\Users\username\Documents\MCP\latex-server
python mcp_latex_server.py --workspace C:\Users\username\Documents\LaTeX

šŸ“‚ Final Structure

C:\Users\username\
ā”œā”€ā”€ Documents\
│   ā”œā”€ā”€ MCP\
│   │   └── latex-server\
│   │       ā”œā”€ā”€ mcp_latex_server.py      # Main server
│   │       └── README.md                 # This file
│   │
│   └── LaTeX\                           # Your projects
│       ā”œā”€ā”€ Articles\
│       ā”œā”€ā”€ Presentations\
│       └── (your .tex files)
│
└── AppData\
    └── Roaming\
        └── Claude\
            └── claude_desktop_config.json  # Configuration

šŸŽÆ Daily Usage

Essential commands in Claude

ActionCommand in Claude
Create a document"Create article.tex with article template"
Read a file"Read my thesis.tex file"
Compile"Compile main.tex with pdflatex"
Validate"Check the syntax of document.tex"
Organize"Organize my LaTeX files"
Clean up"Clean up auxiliary files"
Change directory"Change the working directory to ..."

Recommended Workflows

New article:

  1. "Create an article on AI with mathematical support"
  2. "Compile the article"

Existing project:

  1. Copy your project into C:\Users\username\Documents\LaTeX\my-project\
  2. "List the files in my-project"
  3. "Compile my-project/main.tex"

šŸ”§ Troubleshooting

The server does not load

  • Verify that Claude Desktop has been properly closed and restarted
  • Check the JSON config file (be careful with commas and quotes)

"python not recognized" error

  • Add Python to the system PATH
  • Or use the full path: "command": "C:\\Python312\\python.exe"
  • If the error persists, opt for a virtual environment and add the PATH to the JSON config

LaTeX compilation error

  • Check that MiKTeX or TeX Live is installed
  • Test pdflatex --version in cmd

šŸ“ž Support

  • Logs: In Claude Desktop, Ctrl+Shift+I → Console
  • Test: mcp_latex_server.py in the server folder
  • Debug: Add "--log-level", "DEBUG" in the args of the JSON config

MCP LaTeX Server v1.0.0 Server path: C:\Users\username\Documents\MCP\latex-server LaTeX Workspace: C:\Users\username\Documents\LaTeX