FormaTeX

\usepackage{mcp}

Your AI can compile
LaTeX now.

FormaTeX speaks MCP. Give Claude, Cursor, VS Code, Codex or any MCP client direct access to a full LaTeX compilation stack. No context switching, no infrastructure.

Works with
  • Claude Desktop
  • Claude Code
  • Cursor
  • VS Code
  • OpenAI Codex
  • Windsurf
  • Zed
  • Gemini CLI
  • n8n
  • Cline

How it works

  1. You ask your AI

    Ask Claude, Cursor or any MCP client to write or compile a LaTeX document.

  2. MCP calls FormaTeX

    The assistant calls a FormaTeX tool with your LaTeX. We compile it for you, so there is no TeX Live to install.

  3. You get a download link

    The reply carries the compile details and an authenticated Download PDF link. When the agent needs the file itself, it calls fetch_pdf_bytes.

\begin{tools}

13 tools your AI can call

Compile, validate and inspect LaTeX, and manage your saved templates, from the conversation. Resources and a guided prompt for fixing errors come with them.

  • compile_smart
    Uses quota

    Compiles LaTeX with automatic engine detection and common error fixes, retrying with fallback engines. Has no engine parameter. Returns compilation metadata and an authenticated download URL for the PDF.

    Try asking

    Compile this LaTeX to PDF and give me the download link

  • compile_latex
    Uses quota

    Compiles LaTeX with the engine you choose (pdflatex, xelatex, lualatex or latexmk). Returns compilation metadata and an authenticated download URL for the PDF, not the file contents.

    Try asking

    Compile this document with xelatex

  • check_syntax
    No quota

    Validates LaTeX for syntax errors, forbidden commands and structural issues without compiling, and recommends an engine. Does not use quota.

    Try asking

    Check this LaTeX for syntax errors before compiling

  • list_engines
    No quota

    Lists the available compilation engines and when to use each one. Does not use quota.

    Try asking

    List the available LaTeX engines

  • get_usage
    No quota

    Shows this month's compilations, your plan limit and a breakdown by engine and status for the API key in use. Does not use quota.

    Try asking

    How many compilations do I have left this month?

  • compile_async
    Uses quota

    Submits a compilation job and returns a job ID immediately. Poll it with get_job. Best for large documents and batch work.

    Try asking

    Compile this document asynchronously

  • get_job
    No quota

    Returns the status of an async job. A completed job returns an authenticated download URL for the PDF, a failed one returns the error log. Does not use quota.

    Try asking

    Check the status of job abc123 and get the PDF if it is ready

  • list_templates
    No quotaPro and up

    Lists your saved templates with IDs, names and variables. Requires the Pro plan or higher. Does not use quota.

    Try asking

    List my saved LaTeX templates

  • get_template
    No quotaPro and up

    Returns one saved template by ID with its full LaTeX source and variable definitions. Use it before updating a template to edit the existing source. Requires the Pro plan or higher. Does not use quota.

    Try asking

    Show me the source of my invoice template

  • create_template
    No quotaPro and up

    Saves a new reusable template with variable placeholders, an engine and a category. Values are inserted as given, so they must already be valid LaTeX. Images and other asset files are added in the dashboard. Requires the Pro plan or higher, up to your plan's template limit. Does not use quota.

    Try asking

    Save this LaTeX as a template called Invoice with client and amount variables

  • update_template
    No quotaPro and up

    Changes a saved template. Only the fields you pass are changed; a new source or variable list replaces the old one, and the previous version cannot be recovered. Requires the Pro plan or higher. Does not use quota.

    Try asking

    Change the engine of my invoice template to xelatex and add a due date variable

  • compile_template
    Uses quotaPro and up

    Compiles a saved template by ID with optional variable substitutions. Returns compilation metadata and a download URL for the PDF. Requires the Pro plan or higher.

    Try asking

    Compile my invoice template with name=Acme Corp and amount=$500

  • fetch_pdf_bytes
    No quota

    Fetches a compiled PDF as raw bytes (base64) by job ID. The only tool that returns file contents: use it when the agent must save or inspect the file, otherwise the download URL is enough. Does not use quota.

    Try asking

    Fetch the PDF bytes for job abc123 so you can save it to disk

Resources

Clients that support MCP resources can read these directly.

  • formatex://engines

    Available LaTeX compilation engines with guidance on when to use each one.

  • formatex://usage

    Current month compilation usage and plan limits for the API key in use.

fix_latexPrompt

A guided prompt that analyzes a compilation error log, finds the root cause and proposes corrected LaTeX source.

Use the fix_latex prompt to help me fix this error: [paste error log]

\begin{setup}

Connect your client

Pick your client and a connection method, then copy the configuration. Remote needs nothing installed. Local runs the formatex-mcp binary on your machine.

Client

Claude Desktop and claude.ai custom connectors

Connection method

Your client connects to mcp.formatex.io over Streamable HTTP. Nothing to install. Claude Desktop and claude.ai add remote servers as custom connectors in the app, not in a configuration file.

Your API key

Create a key in your dashboard. It starts with fex_ and is shown in full only once, so copy it when you create it. MCP works on every plan, including Free.

Replace YOUR_FORMATEX_API_KEY in the snippets with your key.

Keep the key out of git

Project files such as .mcp.json, .cursor/mcp.json and .vscode/mcp.json are usually committed. Use the environment variable form, a user-level file, or add the file to .gitignore. If a key ever reaches a repository, revoke it and create a new one.

Follow these steps

  1. Open Customize > Connectors in Claude Desktop or at claude.ai. On Team and Enterprise plans, an owner adds it under Organization settings > Connectors.

  2. Choose Add custom connector and enter:

    Name
    FormaTeX
    URL
    https://mcp.formatex.io/mcp
  3. Authenticate with FormaTeX. Either option works:

    • Sign in. Claude opens a FormaTeX page where you paste your API key once. There is nothing else to copy.

    • Request headers. Add this header instead of signing in:

      Header
      Authorization: Bearer YOUR_FORMATEX_API_KEY
  4. Turn FormaTeX on for your conversation, then run the prompt below.

Good to know

  • Custom connectors are available on every plan. Free accounts can add one.

Try it

In Claude Desktop, run this prompt to verify the integration:

Use FormaTeX to compile a one-page LaTeX document that says Hello, FormaTeX, and give me the download link.

A working setup shows a tool call such as compile_smart and a Download PDF link in the answer.

Authentication

Send your API key (it starts with fex_) as an Authorization: Bearer or X-API-Key header. The Claude connector signs in with OAuth, and its authorization page asks for the key once.

Plans

MCP works on every plan, including Free, and compilations count toward the same monthly quota as REST calls. Free includes pdflatex and xelatex. Pro and up add lualatex, latexmk and saved templates.

Transport

Streamable HTTP at https://mcp.formatex.io/mcp. There is no SSE endpoint, so a client that only supports SSE should use the local binary. GET /health reports the server status.

\begin{document}

Ready to connect your AI?

Get an API key, drop in the config, and your assistant compiles LaTeX in the next message.