docwriter
A Model Context Protocol (MCP) server for programmatic creation, modification, and compilation of structured LaTeX documents. Enables AI agents and automated workflows to generate reports, articles, and papers from templates, with secure, structured content updates and robust PDF compilation using LuaLaTeX and Biber.
claude mcp add --transport stdio cyanheads-docwriter-mcp-server node dist/server.js \ --env MCP_AUTH_MODE="Authentication mode for HTTP: 'jwt' or 'oauth' (default: jwt)." \ --env MCP_HTTP_PORT="Port for the HTTP server when transport is http (default: 3010)." \ --env MCP_LOG_LEVEL="Logging level: debug | info | warning | error (default: debug)." \ --env OAUTH_AUDIENCE="OAuth 2.1 audience (required for oauth mode)." \ --env OAUTH_ISSUER_URL="OAuth 2.1 issuer URL (required for oauth mode)." \ --env MCP_TRANSPORT_TYPE="Server transport: 'stdio' or 'http' (default: stdio)." \ --env DOCWRITER_DATA_PATH="Root directory for storing .tex files and PDFs (default: ./data)." \ --env MCP_AUTH_SECRET_KEY="Secret key for JWT signing (minimum 32 chars; required for jwt mode)."
How to use
docwriter provides a set of MCP tools to create, modify, and compile LaTeX documents on the local filesystem. You can bootstrap new documents from templates such as simple_report, ieee_article, or research_report; update specific content blocks safely; perform simple search-and-replace operations; compile LaTeX into a PDF with bibliographies; and list available documents. For example, you can call docwriter_create_latex_document to generate a new .tex file from a chosen template and populate metadata like title and author. To adjust content, use docwriter_update_document_block to atomically modify multiple sections (e.g., abstract or introduction) while preserving the document structure and sanitizing input. If you need to make quick textual tweaks, docwriter_search_and_replace offers a sanitized global text replacement. When you’re ready to produce a final document, docwriter_compile_latex_to_pdf runs luaLaTeX with multiple passes, automatically runs biber for bibliographies, and returns logs for debugging. Finally, you can retrieve an inventory of documents with docwriter_list_latex_documents which scans the data directory for .tex files. These tools enable AI agents or automated workflows to manage the entire lifecycle of LaTeX documents locally.
How to install
Prerequisites:
- Node.js (>= 20.0.0) and npm
- A full TeX Live distribution (or MiKTeX) with luaLaTeX and biber available on PATH
Install from source:
-
Clone the repository: git clone https://github.com/cyanheads/docwriter-mcp-server.git cd docwriter-mcp-server
-
Install dependencies: npm install
-
Build the project: npm run build
-
Run the server (example):
- Ensure environment variables are set (see mcp_config env guidance)
- Start the server (the exact command may depend on your build output): node dist/server.js
-
Optional: run tests or linters if provided in the repo as part of your workflow.
Additional notes
Environment and configuration tips:
- DOCWRITER_DATA_PATH is required for storing documents and PDFs; ensure the path is accessible and writable by the server process.
- If using HTTP transport, set MCP_HTTP_PORT and ensure your firewall allows access.
- For JWT authentication, MCP_AUTH_MODE should be set to jwt and MCP_AUTH_SECRET_KEY must be defined with a secure secret (min 32 chars).
- For OAuth mode, provide OAUTH_ISSUER_URL and OAUTH_AUDIENCE as part of the correct flow.
- The server compiles LaTeX documents via luaLaTeX and runs biber automatically; ensure these tools are in the system PATH and compatible with your templates.
- Template names supported: simple_report, ieee_article, research_report. Metadata population occurs during document creation.
- If you encounter template or path-related issues, verify file permissions and the data directory structure under DOCWRITER_DATA_PATH.
Related MCP Servers
drawio2go
A modern DrawIO editor application. AI-Powered, Human-AI Collaboration | AI 加持,人机共绘drawio
charlotte
Structured web browsing MCP server — some terrific, radiant, humble web pages.
mcp -js
MCP server that exposes YepCode processes as callable tools for AI platforms. Securely connect AI assistants to your YepCode workflows, APIs, and automations.
akyn-sdk
Turn any data source into an MCP server in 5 minutes. Build AI-agents-ready knowledge bases.
better-notion
Markdown-first MCP server for Notion API - composite tools optimized for AI agents
ensembl
A full-featured Model Context Protocol (MCP) server that exposes Ensembl’s REST API. Built using the TypeScript MCP SDK