TeXFlow
STDIODocument authoring MCP server with LaTeX, Markdown processing and collaborative editing capabilities
Document authoring MCP server with LaTeX, Markdown processing and collaborative editing capabilities

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.
This server introduces collaborative editing capabilities that prevent conflicts when multiple agents (human or AI) work on the same documents:
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 a new document project create_project("my-paper", "article") # Created project 'my-paper' at ~/Documents/TeXFlow/my-paper # Write content (automatically saved to project) save_markdown("# Introduction\n\nThis is my paper.", "intro.md") # Markdown saved to project 'my-paper': content/intro.md # Generate PDF (automatically saved to project/output/pdf/) markdown_to_pdf(file_path="intro.md", output_path="intro.pdf") # PDF saved to project 'my-paper': output/pdf/intro.pdf # Switch between projects use_project("thesis-2024") list_projects() # See all your document projects
TeXFlow's tools are organized into 9 semantic operations for easier discovery and use:
See Tool Reference for detailed documentation of all tools.
pandoc - For markdown to PDF conversion
apt install pandocdnf install pandocpacman -S pandocweasyprint - For HTML to PDF conversion
apt install weasyprintdnf install weasyprintpacman -S python-weasyprintrsvg-convert - For SVG to PDF conversion
apt install librsvg2-bindnf install librsvg2-toolspacman -S librsvgLaTeX/XeLaTeX - For PDF generation from markdown and LaTeX documents
Core Requirements:
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 chktex
Fedora:
# 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-chktex
Arch:
# 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 syntaxThe server checks for these dependencies at startup and enables features that have their requirements met. Missing dependencies are reported with installation instructions.
# Install system dependencies (choose your distribution) # Debian/Ubuntu - Full installation with all features sudo apt-get install cups pandoc texlive-xetex texlive-fonts-recommended \ texlive-latex-recommended texlive-pictures chktex \ weasyprint librsvg2-bin # Fedora - Full installation with all features sudo dnf install cups pandoc texlive-xetex texlive-collection-fontsrecommended \ texlive-collection-pictures texlive-chktex \ weasyprint librsvg2-tools # Arch - Full installation with all features sudo pacman -S cups pandoc texlive-xetex texlive-fontsrecommended \ texlive-pictures texlive-binextra \ python-weasyprint librsvg # Clone and install git clone https://github.com/aaronsb/texflow-mcp cd texflow-mcp uv sync
No installation needed! Just ensure you have uv installed and run:
# Install uv if you haven't already curl -LsSf https://astral.sh/uv/install.sh | sh # Run TeXFlow directly from GitHub uvx --from git+https://github.com/aaronsb/texflow-mcp.git texflow
# Clone the repository git clone https://github.com/aaronsb/texflow-mcp cd texflow-mcp # Run the server uv run texflow
TeXFlow provides 9 semantic tools that intelligently guide your document workflow:
document - Create, edit, and transform documents# Create with auto-format detection document(action="create", content="# My Paper", intent="research") # Convert existing files (don't recreate!) document(action="convert", source="notes.md", target_format="latex") # Edit with conflict detection document(action="edit", path="paper.tex", old_string="draft", new_string="final")
output - Print or export documents# Print existing file (preferred) output(action="print", source="report.pdf") # Export to PDF output(action="export", source="notes.md", output_path="notes.pdf")
project - Organize your work# Create project with AI-guided structure project(action="create", name="thesis", description="PhD thesis on quantum computing") # Switch projects project(action="switch", name="thesis")
printer - Manage printing hardwareprinter(action="list") # Show all printers printer(action="set_default", name="Office_Laser")
discover - Find resourcesdiscover(action="documents", folder="drafts") # Find documents discover(action="fonts", style="serif") # Browse fonts
archive - Manage versionsarchive(action="versions", filename="paper.tex") # Find all versions archive(action="cleanup", pattern="*_old*") # Clean old files
workflow - Get intelligent guidanceworkflow(action="suggest", task="write paper with citations") workflow(action="next_steps") # What to do next
Each tool provides hints for next steps, guiding you through complex workflows.
For detailed documentation of all 9 tools, see Tool Reference.
For users still using individual tools, the original tool documentation follows below. Note that the unified semantic tools above are the recommended approach.
print_textPrints plain text content.
{ "name": "print_text", "arguments": { "content": "Hello, World!", "printer": "Brother_HL_L2350DW" // optional } }
print_markdownPrints Markdown content rendered as PDF via pandoc and XeLaTeX.
Supports:
$, display with $$)Limited support for:
{ "name": "print_markdown", "arguments": { "content": "# My Document\n\nThis is **bold** text.\n\nMath: $E = mc^2$", "printer": "HP_LaserJet", // optional "title": "My Document" // optional } }
print_filePrints a file from the filesystem.
{ "name": "print_file", "arguments": { "path": "/path/to/document.pdf", "printer": "Canon_PIXMA" // optional } }
get_printer_infoGet detailed information about a specific printer including status, make/model, location, and URI.
{ "name": "get_printer_info", "arguments": { "printer_name": "My_Printer" } }
set_default_printerChange the default printer.
{ "name": "set_default_printer", "arguments": { "printer_name": "CanonG3260" } }
enable_printer / disable_printerControl printer availability for accepting jobs.
{ "name": "enable_printer", "arguments": { "printer_name": "My_Printer" } }
update_printer_infoUpdate printer description and/or location.
{ "name": "update_printer_info", "arguments": { "printer_name": "My_Printer", "description": "Office Color Laser", "location": "Room 201" } }
markdown_to_pdfConvert markdown to PDF and save to a file (without printing).
Supports:
print_markdown{ "name": "markdown_to_pdf", "arguments": { "content": "# My Document\n\nSave this as PDF.", "output_path": "report.pdf", // Saves to ~/Documents/report.pdf by default "title": "My Document" } }
print_latexPrint LaTeX content (compiled to PDF via XeLaTeX).
Supports:
{ "name": "print_latex", "arguments": { "content": "\\documentclass{article}\n\\begin{document}\nHello LaTeX!\n\\end{document}", "printer": "My_Printer", // optional "title": "My LaTeX Doc" // optional } }
save_markdownSave markdown content to a .md file.
{ "name": "save_markdown", "arguments": { "content": "# My Document\n\nThis is my markdown content.", "filename": "notes.md" // Saves to ~/Documents/notes.md by default } }
save_latexSave LaTeX content to a .tex file.
{ "name": "save_latex", "arguments": { "content": "\\documentclass{article}\n\\begin{document}\nHello LaTeX!\n\\end{document}", "filename": "document.tex" // Saves to ~/Documents/document.tex by default } }
list_documentsList PDF and Markdown files in the Documents folder.
{ "name": "list_documents", "arguments": { "folder": "reports" // Optional: list files in ~/Documents/reports } }
print_from_documentsPrint a PDF or Markdown file from the Documents folder.
{ "name": "print_from_documents", "arguments": { "filename": "report.pdf", // or just "report" - will find .pdf or .md "printer": "My_Printer", // optional "folder": "reports" // optional subfolder } }
Features:
markdown_to_latexConvert a Markdown file to LaTeX format for further customization.
{ "name": "markdown_to_latex", "arguments": { "file_path": "research_notes.md", // Path to markdown file "output_path": "research_paper.tex", // Optional: output path "title": "My Research Paper", // Optional: document title "standalone": true // Optional: create complete document (default: true) } }
Features:
Workflow example:
1. save_markdown(content="...", filename="notes.md") 2. markdown_to_latex(file_path="notes.md") # Creates notes.tex 3. edit_document(file_path="notes.tex", ...) # Optional: customize 4. latex_to_pdf(file_path="notes.tex", output_path="final.pdf")
list_available_fontsList fonts available for use with XeLaTeX documents.
{ "name": "list_available_fonts", "arguments": { "style": "serif" // Optional: filter by 'serif', 'sans', 'mono', or None for all } }
Features:
validate_latexValidate LaTeX content for syntax errors before compilation.
{ "name": "validate_latex", "arguments": { "content": "\\documentclass{article}\n\\begin{document}\nHello!\n\\end{document}" } }
Features:
lacheck and chktex for syntax checking (if available)read_documentRead a document file with line numbers for editing.
{ "name": "read_document", "arguments": { "file_path": "proposal.tex", // or full path "offset": 1, // starting line (optional, default: 1) "limit": 50 // number of lines (optional, default: 50) } }
Features:
cat -n formatedit_documentEdit a document file by replacing exact string matches.
{ "name": "edit_document", "arguments": { "file_path": "proposal.tex", "old_string": "Hello World", "new_string": "Hello CUPS MCP", "expected_replacements": 1 // optional, default: 1 } }
Features:
check_document_statusCheck if a document has been modified externally and show changes.
{ "name": "check_document_status", "arguments": { "file_path": "proposal.tex" // or full path } }
Features:
Path handling for save tools:
report.pdf) → Saves to ~/Documents//home/user/Documents/report.pdf) → Uses exact path~ (e.g., ~/Downloads/report.pdf) → Expands to home directoryAutomatic features:
When using the printing tools, AI agents should follow this logic:
First print request:
Subsequent requests:
When saving PDFs with markdown_to_pdf:
report.pdf) which save to ~/Documents/This ensures users aren't repeatedly asked about printer selection and files are saved to predictable locations.
TeXFlow requires a workspace path where all your document projects will be stored. This is passed as the last argument to the texflow command.
Claude Desktop uses a JSON configuration file to manage MCP servers. The location depends on your operating system:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonAdd this to your claude_desktop_config.json:
{ "mcpServers": { "texflow": { "command": "uvx", "args": ["--from", "git+https://github.com/aaronsb/texflow-mcp.git", "texflow", "/home/aaron/Documents/TeXFlow"] } } }
Note: Replace /home/aaron/Documents/TeXFlow with your desired workspace path.
If you've cloned the repository locally:
{ "mcpServers": { "texflow": { "command": "uv", "args": ["--directory", "/path/to/texflow-mcp", "run", "texflow", "/home/aaron/Documents/TeXFlow"] } } }
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.
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# Add with user scope (available in all projects) claude mcp add --scope user texflow uvx -- --from git+https://github.com/aaronsb/texflow-mcp.git texflow ~/Documents/TeXFlow # Or with project scope (current project only) claude mcp add --scope project texflow uvx -- --from git+https://github.com/aaronsb/texflow-mcp.git texflow ~/Documents/TeXFlow
If you've cloned the repository:
# Add with user scope claude mcp add --scope user texflow uv -- --directory /path/to/texflow-mcp run texflow ~/Documents/TeXFlow # Or with project scope claude mcp add --scope project texflow uv -- --directory /path/to/texflow-mcp run texflow ~/Documents/TeXFlow
Note: The -- after the scope is required to separate Claude Code options from the command arguments.
You can specify the workspace path in three ways:
~/Documents/TeXFlow as shown in the examples aboveTEXFLOW_WORKSPACE=~/Documents/TeXFlow in your shell or system environment~/Documents/TeXFlowAll TeXFlow projects and documents will be created within this workspace directory.
After installation, you can verify TeXFlow is working by asking Claude to:
The collaborative editing features enable fascinating multi-agent workflows:
# Agent 1 (Technical Writer AI) - Creates initial documentation structure - Writes API reference sections # Agent 2 (Code Examples AI) - Detects Agent 1's additions - Adds code examples to each API section - Preserves Agent 1's documentation # Agent 3 (Review AI) - Sees combined work from both agents - Fixes inconsistencies - Adds cross-references
This opens up entirely new possibilities for AI collaboration on complex documentation and content creation tasks.
# Create project structure project(action="create", name="ml-paper", description="Machine learning research paper") # Create bibliography document(action="create", content="@article{smith2023,...}", path="refs.bib") # Create main document document(action="create", content="\\documentclass{article}...", path="paper.tex") # Export to PDF output(action="export", source="paper.tex", output_path="paper.pdf")
# Convert existing Markdown notes to LaTeX document(action="convert", source="notes.md", target_format="latex") # Edit the converted file document(action="edit", path="notes.tex", old_string="TODO", new_string="Introduction") # Generate PDF output(action="export", source="notes.tex")
The system prevents common AI workflow issues:
Example of the improved workflow:
# Step 1: Save LaTeX content save_latex(content="...", filename="paper.tex") # Returns: "LaTeX saved successfully to: /home/user/Documents/paper.tex" # Step 2: Convert to PDF using file path (not content!) latex_to_pdf(file_path="/home/user/Documents/paper.tex", output_path="paper.pdf") # Efficient: Uses saved file instead of regenerating content
MIT