docwriter-mcp-server
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., "@docwriter-mcp-serverCreate a simple report titled 'Meeting Notes' by 'Jane'"
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.
docwriter-mcp-server πβοΈ
A Model Context Protocol (MCP) server for programmatic creation, modification, and compilation of structured LaTeX documents.
This server provides a suite of tools for an AI agent or other MCP client to manage the lifecycle of a document on the local filesystem, from bootstrapping from a template to applying structured updates and compiling the final PDF output. It is built on the robust cyanheads/mcp-ts-template.
This project is in beta - some things may be broken. Please report any issues or feature requests on GitHub.
π Core Capabilities: Document Tools π οΈ
This server equips your AI with specialized tools to create and manage LaTeX documents:
Tool Name | Description | Key Features |
Creates a new | - Bootstrap from - Populates title and author metadata. | |
Updates one or more named content blocks within a document. | - Atomically updates multiple sections (e.g., - Preserves document structure. - Securely sanitizes all input content. | |
Performs a simple, global search and replace for text. | - Useful for quick, non-structural text changes. - Sanitizes replacement text. | |
Compiles a | - Uses - Automatically runs - Returns compilation logs for debugging. | |
Retrieves a list of all available documents. | - Scans the data directory for all |
Table of Contents
Overview
The docwriter-mcp-server acts as a specialized backend, allowing MCP-compatible clientsβsuch as AI agents, IDE extensions, or automated workflowsβto programmatically generate and manage professional-quality LaTeX documents.
Instead of manual document preparation, your tools can leverage this server to:
Automate Report Generation: Create consistent, templated reports, articles, or papers.
Dynamically Insert Content: Populate documents with data, analysis, or text generated by an AI.
Ensure Document Quality: Compile and verify documents as part of a CI/CD pipeline.
Integrate with AI Workflows: Enable LLMs to create and edit complex documents as part of a larger task.
Developer Note: This repository includes a .clinerules file that serves as a developer cheat sheet for your LLM coding agent with quick reference for the codebase patterns, file locations, and code snippets.
Features
Core Utilities
Leverages the robust utilities provided by the mcp-ts-template:
Logging: Structured, configurable logging with sensitive data redaction.
Error Handling: Centralized error processing and standardized error types (
McpError).Configuration: Type-safe environment variable loading with Zod validation.
Input Sanitization: Strong security focus with utilities for sanitizing LaTeX, HTML, and file paths.
HTTP Transport: High-performance HTTP server using Hono, featuring session management, CORS, and rate limiting.
Authentication: Robust authentication layer supporting JWT and OAuth 2.1.
Document Generation
Template-Based Creation: Start documents from
simple_report,ieee_article, orresearch_reporttemplates.Structured Updates: Safely modify content within
%% -- BLOCK: ... -- %%markers.Secure Compilation: Executes
lualatexwith multiple passes, automatically runningbiberfor bibliographies and cleaning up auxiliary files.Filesystem Backend: All documents and outputs are stored and managed on the local filesystem in a configurable data directory.
Installation
Prerequisites
npm (comes with Node.js)
A full TeX Live distribution (or equivalent like MiKTeX). The
lualatexandbibercommands must be in the system'sPATH.
Install from Source
Clone the repository:
git clone https://github.com/cyanheads/docwriter-mcp-server.git cd docwriter-mcp-serverInstall dependencies:
npm installBuild the project:
npm run build
Configuration
Configure the server using environment variables in a .env file.
Variable | Description | Default |
| Required. The root directory for storing |
|
| Server transport: |
|
| Logging level ( |
|
| Port for the HTTP server. |
|
| Authentication mode for HTTP: |
|
| Required for | (none) |
| Required for | (none) |
| Required for | (none) |
Project Structure
The codebase follows a modular structure within the src/ directory:
src/
βββ index.ts # Entry point: Initializes and starts the server
βββ config/ # Configuration loading (env vars, package info)
β βββ index.ts
βββ mcp-server/ # Core MCP server logic and capability registration
β βββ server.ts # Server setup, tool registration
β βββ transports/ # Transport handling (stdio, http)
β βββ tools/ # MCP Tool implementations (subdirs per tool)
βββ types-global/ # Shared TypeScript type definitions
βββ utils/ # Common utility functions (logger, error handler, etc.)For a detailed file tree, run npm run tree.
Development
Build and Test
# Build the project (compile TS to JS and make executable)
npm run build
# Test the server locally using the MCP inspector tool (stdio transport)
npm run inspector
# Clean build artifacts
npm run clean
# Clean build artifacts and then rebuild the project
npm run rebuild
# Format code with Prettier
npm run format
# Start the server using stdio (default)
npm start
# Start the server using HTTP transport
npm run start:httpLicense
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/docwriter-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server