Provides comprehensive tools for creating, editing, and managing LaTeX documents, including document class customization, package management, and basic syntax validation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP LaTeX ServerCreate a new article template for a research paper on machine learning."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP LaTeX Server
A comprehensive Model Context Protocol (MCP) server that provides advanced LaTeX file creation, editing, and management capabilities for Large Language Models and AI assistants.
Overview
The MCP LaTeX Server enables AI assistants like Claude to seamlessly work with LaTeX documents through a standardized protocol. It provides tools for creating, editing, reading, and validating LaTeX files, making it easy to generate professional academic papers, reports, presentations, and other LaTeX documents.
Features
📝 Create LaTeX Documents: Generate new LaTeX files from templates or custom specifications
✏️ Edit Existing Files: Modify LaTeX documents with various edit operations
📖 Read File Contents: Access and analyze LaTeX file content
📁 File Management: List and organize LaTeX files in directories
✅ Syntax Validation: Basic LaTeX syntax checking and error detection
🎯 Document Types: Support for article, report, book, letter, beamer, and minimal document classes
📦 Package Management: Automatic handling of LaTeX packages and dependencies
🔧 Template System: Built-in templates for common document types
Prerequisites
Before installing the MCP LaTeX Server, ensure you have:
Python 3.8+ installed on your system
LaTeX Distribution (recommended for full functionality):
Windows: MiKTeX or TeX Live
macOS: MacTeX
Linux: TeX Live
VS Code (for VS Code integration)
Claude Desktop or Claude in VS Code (for Claude integration)
Installing LaTeX Distribution
Windows (MiKTeX)
Download MiKTeX from https://miktex.org/download
Run the installer and follow the setup wizard
Choose "Install packages on-the-fly" for automatic package management
Windows (TeX Live)
Download TeX Live from https://www.tug.org/texlive/
Run the installer (this may take some time as it's a large distribution)
macOS
Linux (Ubuntu/Debian)
Linux (Fedora/RHEL)
Installation
Method 1: Quick Setup (Recommended)
Clone or download the repository:
Run the setup script:
This will automatically install all required dependencies.
Method 2: Manual Installation
Create a virtual environment (recommended):
Install dependencies:
Verify installation:
Method 3: Using uv (Fast Python Package Manager)
Install uv (if not already installed):
Install dependencies with uv:
Configuration
Basic Configuration
The server can be configured to work with specific directories for LaTeX files. By default, it allows access to the current working directory and subdirectories.
Environment Variables
You can set the following environment variables:
Configuration File
Create a config.json file in the server directory:
MCP Integration
Claude Desktop Integration
Locate Claude Desktop Configuration:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add MCP Server Configuration:
For uv (recommended for better performance):
Restart Claude Desktop for changes to take effect.
VS Code Integration with Claude
Install the Claude extension in VS Code
Configure MCP Server in VS Code settings:
Open VS Code settings (Ctrl+, or Cmd+,) and add:
Alternative: Using tasks.json
Create .vscode/tasks.json in your workspace:
Testing the Integration
Start Claude Desktop or Claude in VS Code
Test the connection by asking Claude:
Can you list the available LaTeX tools?Create a test document:
Please create a simple LaTeX article with the title "Test Document" and some sample content.
Usage Examples
Basic Document Creation
Advanced Document Creation
Editing Operations
Available Tools
1. create_latex_file
Creates a new LaTeX document with specified parameters.
Parameters:
file_path(required): Path where the file should be createddocument_type: Document class (article, report, book, letter, beamer, minimal)title: Document titleauthor: Document authordate: Document date (default: \today)packages: List of LaTeX packages to includegeometry: Page geometry settingscontent: Main document content
2. edit_latex_file
Edits an existing LaTeX file with various operations.
Parameters:
file_path(required): Path to the file to editoperation(required): Type of edit (replace, insert_before, insert_after, append, prepend)new_text(required): New text to insert or replace withsearch_text: Text to search for (required for replace, insert_before, insert_after)line_number: Line number for insertion (alternative to search_text)
3. read_latex_file
Reads and returns the contents of a LaTeX file.
Parameters:
file_path(required): Path to the file to read
4. list_latex_files
Lists all LaTeX files in a directory.
Parameters:
directory_path: Directory to search (default: current directory)recursive: Whether to search subdirectories (default: false)
5. validate_latex
Performs basic LaTeX syntax validation.
Parameters:
file_path(required): Path to the file to validate
6. get_latex_structure
Extracts the structure of a LaTeX document (sections, subsections, etc.).
Parameters:
file_path(required): Path to the file to analyze
Troubleshooting
Common Issues
1. Server Won't Start
2. Claude Can't Connect to Server
Verify the file paths in your configuration are correct
Check that Python is in your system PATH
Restart Claude Desktop after configuration changes
Check Claude Desktop logs for error messages
3. Permission Errors
4. LaTeX Compilation Issues
Ensure LaTeX distribution is properly installed
Check that required packages are available
Use the validation tool to check syntax
Debug Mode
Run the server in debug mode for detailed logging:
Log Files
Check log files for troubleshooting:
Server logs: Available in console output
Claude Desktop logs: Check Claude's log directory
VS Code logs: Check VS Code's output panel
Advanced Configuration
Custom Templates
Create custom templates in the templates/ directory:
Security Considerations
The server only allows access to specified directories
File operations are limited to LaTeX-related extensions
Input validation prevents malicious LaTeX code execution
Performance Optimization
Use SSD storage for LaTeX files
Keep LaTeX distribution up to date
Use
uvinstead ofpipfor faster dependency management
Contributing
Contributions are welcome! Please follow these guidelines:
Fork the repository
Create a feature branch
Add tests for new functionality
Update documentation
Submit a pull request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Support
For support and questions:
Check the troubleshooting section above
Review GitHub issues
Create a new issue with detailed information about your problem
Changelog
Version 1.0.0
Initial release
Basic LaTeX file operations
MCP integration support
Template system