Enables creation, editing, and compilation of LaTeX documents to PDF, with support for mathematical formulas, TikZ diagrams, bibliography management, and LaTeX syntax validation.
Provides tools for creating, editing, and converting Markdown documents to PDF or LaTeX format, with support for standard formatting, tables, code blocks, and math expressions.
TeXFlow

A document authoring and composition MCP server that provides a pipeline for document creation: Content → Processing → Output. TeXFlow transforms your ideas into typeset documents using LaTeX, Markdown, and modern document processing tools.
🚀 Key Innovation: Collaborative Document Editing
This server introduces collaborative editing capabilities that prevent conflicts when multiple agents (human or AI) work on the same documents:
Change Detection: Automatically detects when documents are modified externally
Diff Visualization: Shows unified diffs of what changed between edits
Conflict Prevention: Refuses to overwrite external changes, protecting everyone's work
AI-to-AI Collaboration: Enables multiple AI agents to work together on documents without conflicts
Core Value Proposition
TeXFlow enables MCP-compatible AI clients (Claude Desktop, Dive AI, or custom implementations) to have document workflow capabilities with project-based organization. Your AI assistant becomes a document authoring companion that can:
Create and manage document projects with organized structure
Author content in Markdown or LaTeX with proper project context
Transform documents through a sophisticated processing pipeline
Generate beautiful PDFs with professional typography
Print or export documents in various formats
🚀 Quick Start with Projects
🎯 Semantic Tool Organization
TeXFlow's tools are organized into 9 semantic operations for easier discovery and use:
📄 Document - Create, edit, convert, and validate documents
🖨️ Output - Print and export to various formats
📁 Project - Organize work into logical units
🔍 Discover - Find documents, fonts, and resources
📦 Organizer - Archive, move, clean documents and auxiliary files
🖨️ Printer - Manage printing hardware
💡 Workflow - Get guidance and automation
📋 Templates - Start from pre-built document templates
📚 Reference - LaTeX documentation search and help
See Tool Reference for detailed documentation of all tools.
Features
📁 Project-Based Document Management
Create organized document projects with templates (article, thesis, letter)
Automatic project structure with content/, output/, and assets/ directories
Switch between projects seamlessly
Project-aware file paths for better organization
All documents in one project stay together
Printing
List available CUPS printers with status information
Print plain text directly
Print Markdown documents (rendered to PDF via pandoc)
Print files from the filesystem
Automatic file type detection
Document Creation & Saving
Convert Markdown to PDF without printing
Save Markdown content to .md files
Save LaTeX content to .tex files
Print LaTeX documents with full XeLaTeX compilation
Smart path handling with Documents folder default
Automatic file renaming to avoid overwrites
Printer Management
Get detailed printer information
Set default printer
Enable/disable printers
Update printer descriptions and locations
Collaborative Document Editing 🤝
Read documents with line numbers for precise editing
Make targeted edits with string replacement and validation
Track external changes with modification time and content hashing
Show diffs when documents are edited outside the AI session
Prevent conflicts between multiple editors (human or AI)
Check document status to see what changed since last read
Enable safe concurrent editing workflows
Document Archiving & Version Management 📦
Archive (soft delete) documents to hidden .texflow_archive folder
List and browse archived documents
Restore archived documents to original or new location
Find versions of a document (current and archived)
Bulk cleanup with pattern matching (e.g., archive _old files)
Preserves document history with timestamps
Smart Features
Dependency checking at startup
Conditional tool registration based on available dependencies
Clear feedback when dependencies are missing
Automatic file type detection and appropriate handling
Prerequisites
Required
Linux system with CUPS installed
Python 3.10+
Optional (for additional features)
pandoc- For markdown to PDF conversionDebian/Ubuntu:
apt install pandocFedora:
dnf install pandocArch:
pacman -S pandoc
weasyprint- For HTML to PDF conversionDebian/Ubuntu:
apt install weasyprintFedora:
dnf install weasyprintArch:
pacman -S python-weasyprint
rsvg-convert- For SVG to PDF conversionDebian/Ubuntu:
apt install librsvg2-binFedora:
dnf install librsvg2-toolsArch:
pacman -S librsvg
LaTeX/XeLaTeX - For PDF generation from markdown and LaTeX documents
Core Requirements:
XeLaTeX engine for PDF compilation
Latin Modern fonts for proper text rendering
Standard LaTeX packages for document formatting
Installation by Distribution:
Debian/Ubuntu:
# Essential packages apt install texlive-xetex texlive-fonts-recommended texlive-latex-recommended # For TikZ diagrams and graphics (if needed) apt install texlive-pictures # For LaTeX validation (chktex) apt install chktexFedora:
# Essential packages dnf install texlive-xetex texlive-collection-fontsrecommended # For TikZ diagrams and graphics (if needed) dnf install texlive-collection-pictures # For LaTeX validation (chktex) dnf install texlive-chktexArch:
# Essential packages pacman -S texlive-xetex texlive-fontsrecommended # For TikZ diagrams and graphics (if needed) pacman -S texlive-pictures # For LaTeX validation (chktex) pacman -S texlive-binextra
What Each Package Provides:
texlive-xetex: XeLaTeX engine and fontspec packagetexlive-fonts-recommended: Latin Modern, Computer Modern, and other standard fontstexlive-latex-recommended: Essential LaTeX packages (geometry, etc.)texlive-pictures: TikZ package for creating diagrams and graphicschktex/texlive-binextra: LaTeX validation tools for checking syntax
The server checks for these dependencies at startup and enables features that have their requirements met. Missing dependencies are reported with installation instructions.
Installation
Quick Start
Option 1: Run directly from GitHub (Recommended)
No installation needed! Just ensure you have uv installed and run:
Option 2: Clone and run locally
Usage
Quick Start - 9 Unified Tools
TeXFlow provides 9 semantic tools that intelligently guide your document workflow:
1. document - Create, edit, and transform documents
2. output - Print or export documents
3. project - Organize your work
4. printer - Manage printing hardware
5. discover - Find resources
6. archive - Manage versions
7. workflow - Get intelligent guidance
Each tool provides hints for next steps, guiding you through complex workflows.
Complete Tool Reference
For detailed documentation of all 9 tools, see Tool Reference.
Legacy Tool Documentation
For users still using individual tools, the original tool documentation follows below. Note that the unified semantic tools above are the recommended approach.
print_text
Prints plain text content.
print_markdown
Prints Markdown content rendered as PDF via pandoc and XeLaTeX.
Supports:
Standard markdown formatting (headers, lists, tables, code blocks)
LaTeX math expressions (inline with
$, display with$$)Latin scripts including European languages
Greek and Cyrillic alphabets
Basic symbols and punctuation
Limited support for:
Complex Unicode (emoji, box drawing characters)
Right-to-left scripts (Arabic, Hebrew)
CJK characters (Chinese, Japanese, Korean)
print_file
Prints a file from the filesystem.
get_printer_info
Get detailed information about a specific printer including status, make/model, location, and URI.
set_default_printer
Change the default printer.
enable_printer / disable_printer
Control printer availability for accepting jobs.
update_printer_info
Update printer description and/or location.
markdown_to_pdf
Convert markdown to PDF and save to a file (without printing).
Supports:
Same markdown features as
print_markdownSaves PDF to specified path instead of printing
print_latex
Print LaTeX content (compiled to PDF via XeLaTeX).
Supports:
Full LaTeX syntax and packages
Mathematical formulas and equations
TikZ diagrams and graphics
Bibliography and citations
Custom document classes
save_markdown
Save markdown content to a .md file.
save_latex
Save LaTeX content to a .tex file.
list_documents
List PDF and Markdown files in the Documents folder.
print_from_documents
Print a PDF or Markdown file from the Documents folder.
Features:
Automatically finds .pdf or .md extension if not specified
Converts Markdown files to PDF before printing
Works with subfolders in Documents
markdown_to_latex
Convert a Markdown file to LaTeX format for further customization.
Features:
Converts Markdown to editable LaTeX format
Preserves math expressions, tables, and formatting
Adds conversion metadata as comments
Allows fine-tuning before final PDF compilation
Part of the markdown → LaTeX → PDF workflow
Workflow example:
list_available_fonts
List fonts available for use with XeLaTeX documents.
Features:
Lists all system fonts compatible with XeLaTeX
Filter by font style (serif, sans-serif, monospace)
Groups fonts alphabetically for easy browsing
Provides usage examples for LaTeX documents
Shows popular font recommendations
validate_latex
Validate LaTeX content for syntax errors before compilation.
Features:
Uses
lacheckandchktexfor syntax checking (if available)Performs test compilation with XeLaTeX
Returns detailed error reports and warnings
Helps catch errors before printing
read_document
Read a document file with line numbers for editing.
Features:
Returns content with line numbers in
cat -nformatWorks with any text file in Documents folder
Smart path handling (defaults to ~/Documents/)
Supports reading portions of large files
edit_document
Edit a document file by replacing exact string matches.
Features:
Exact string replacement with occurrence validation
Returns context snippet showing changes
Prevents accidental replacements with count validation
Same smart path handling as read_document
Collaborative editing support: Detects external file changes and shows diffs
Prevents overwrites when user has edited file externally
Automatically tracks file modifications for safe concurrent editing
check_document_status
Check if a document has been modified externally and show changes.
Features:
Tracks document modification times and content hashes
Detects external changes made by users or other programs
Shows unified diff of what changed since last read
Helps coordinate collaborative editing between AI and users
Essential for preventing conflicting edits in shared documents
Path handling for save tools:
Simple filename (e.g.,
report.pdf) → Saves to~/Documents/Full path (e.g.,
/home/user/Documents/report.pdf) → Uses exact pathPath with
~(e.g.,~/Downloads/report.pdf) → Expands to home directory
Automatic features:
Creates Documents directory if it doesn't exist
Generates unique filename if file already exists (adds _1, _2, etc.)
Returns clear error messages for permission issues or other failures
AI Agent Guidelines
Printer Selection Logic
When using the printing tools, AI agents should follow this logic:
First print request:
If user doesn't specify, ask: "Would you like to print or save as PDF?"
If printing and no default printer exists, ask which printer to use
Remember the chosen printer for the session
Subsequent requests:
Use the remembered printer from the first request
Only change if user explicitly specifies a different printer
File Paths
When saving PDFs with markdown_to_pdf:
Use simple filenames (e.g.,
report.pdf) which save to~/Documents/Don't assume the user's home directory path
Let the tool handle path expansion
This ensures users aren't repeatedly asked about printer selection and files are saved to predictable locations.
Configuration for Claude Desktop and Claude Code
Important: Workspace Path
TeXFlow requires a workspace path where all your document projects will be stored. This is passed as the last argument to the texflow command.
For Claude Desktop
Claude Desktop uses a JSON configuration file to manage MCP servers. The location depends on your operating system:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Method 1: Run from GitHub (Recommended)
Add this to your claude_desktop_config.json:
Note: Replace /home/aaron/Documents/TeXFlow with your desired workspace path.
Method 2: Run from local directory
If you've cloned the repository locally:
Note: Replace /path/to/texflow-mcp with the actual path to your cloned repository.
After editing the config file, restart Claude Desktop for the changes to take effect.
For Claude Code
Claude Code provides a CLI command to add MCP servers. You can choose between different scopes:
--scope user: Available across all your projects (recommended)--scope project: Only available in the current project--scope local: Available only on this machine
Method 1: Run from GitHub (Recommended)
Method 2: Run from local directory
If you've cloned the repository:
Note: The -- after the scope is required to separate Claude Code options from the command arguments.
Workspace Path Options
You can specify the workspace path in three ways:
Command line argument:
~/Documents/TeXFlowas shown in the examples aboveEnvironment variable: Set
TEXFLOW_WORKSPACE=~/Documents/TeXFlowin your shell or system environmentDefault: If neither is provided, defaults to
~/Documents/TeXFlow
All TeXFlow projects and documents will be created within this workspace directory.
Verifying Installation
After installation, you can verify TeXFlow is working by asking Claude to:
List available TeXFlow projects: "Use texflow to list my projects"
Check system dependencies: "Check texflow system dependencies"
Create a test project: "Create a new texflow project called 'test'"
AI-to-AI Collaboration 🤖🤝🤖
The collaborative editing features enable fascinating multi-agent workflows:
Use Cases
Parallel Document Development: Multiple AI agents can work on different sections simultaneously
Review Workflows: One AI drafts, another reviews and edits
Specialized Collaboration: Domain-specific AIs (e.g., technical writer + code reviewer) working together
Iterative Refinement: AIs can build upon each other's contributions with full visibility
How It Works
Agent A reads and edits a document, establishing a baseline
Agent B detects Agent A's changes through the diff system
Agent B reviews the changes before making its own contributions
Each agent maintains awareness of others' modifications through the tracking system
Example Workflow
This opens up entirely new possibilities for AI collaboration on complex documentation and content creation tasks.
Examples
Common Workflows
Academic Paper with Citations
Convert and Edit Workflow
Workflow Features
The system prevents common AI workflow issues:
Smart Content Detection: The server detects when LaTeX content has already been saved and warns against regenerating it
Clear Tool Guidance: Tool descriptions guide the preferred workflow (save → use file path)
Better Error Handling: LaTeX error parser provides specific package installation instructions
Example of the improved workflow:
Documentation
📖 Tool Reference - Complete guide to all 9 semantic tools
🤝 Collaborative Editing Guide - Deep dive into collaboration features
🎯 LaTeX Reference Design - Design of the LaTeX documentation tool
📄 System Dependencies - System requirements and dependency management
👨🍳 Recipe Book Example - Practical example creating a recipe book
🚀 Complete Workflow Example - End-to-end workflow examples
Future Enhancements
HTML to PDF printing (via weasyprint)
SVG to PDF printing (via rsvg-convert)
Image format handling and scaling
Print job status tracking
Print job cancellation
Printer options (paper size, orientation, etc.)
Base64 encoded content support
License
MIT