Markdown-driven MCP server that generates Word (.docx), Excel (.xlsx) and PowerPoint (.pptx) documents — by the Touka project.
Project description
mcp-docgen
A Markdown-driven Model Context Protocol (MCP) server
that turns Markdown — and structured data — into Word (.docx),
PowerPoint (.pptx), and Excel (.xlsx) files.
Built entirely on mature, permissively-licensed Python libraries
(python-docx,
python-pptx,
openpyxl,
XlsxWriter,
markdown-it-py) — no proprietary
dependencies. MIT licensed.
Part of the Touka project: giving AI agents the ability to produce real Office documents using only open-source building blocks.
Why
LLMs are great at producing Markdown. mcp-docgen exposes three tools that convert that
Markdown into polished Office documents, so any MCP-capable assistant (Claude Desktop,
Touka, …) can hand a user a finished .docx / .pptx / .xlsx.
Install & run
Once published to PyPI:
uvx mcp-docgen
From a local checkout (before publishing):
uv sync
uv run mcp-docgen
The server speaks MCP over stdio.
MCP client configuration
{
"mcpServers": {
"docgen": {
"command": "uvx",
"args": ["mcp-docgen"],
"env": { "MCP_DOCGEN_OUTPUT_DIR": "/absolute/path/to/output" }
}
}
}
From a local checkout, swap the command for:
{ "command": "uv", "args": ["run", "--directory", "/path/to/mcp-docgen", "mcp-docgen"] }
Tools
Each tool returns {"path": "<absolute path of the written file>"}.
create_docx(markdown, output_path, title?)
Markdown → Word. Supports headings, bold / italic / inline code, bullet and
numbered lists (nested), tables, block quotes, fenced code blocks, and horizontal rules.
create_pptx(markdown, output_path, title?)
Markdown → PowerPoint, using this slide convention:
| Markdown | Result |
|---|---|
# Heading |
starts a new slide (the heading becomes its title) |
| content below a heading | bullet points (nested lists indent) |
--- (horizontal rule) |
an explicit slide break |
title adds a leading title slide.
create_xlsx(sheets, output_path)
Structured data → Excel. sheets is a list of worksheets:
[
{
"name": "Sales",
"rows": [["Region", "Revenue"], ["APAC", 1200000], ["EMEA", 900000]],
"header": true
}
]
Cells may be strings, numbers, booleans, or null. The first row is a bold, frozen
header unless the sheet sets "header": false.
Output directory & safety
All files are written inside one base directory — MCP_DOCGEN_OUTPUT_DIR, or ./out
relative to the working directory by default. output_path is always interpreted
relative to that base, and any path that tries to escape it (via .. or an absolute
path) is rejected. The server makes no network calls and spawns no subprocesses.
Examples
uv run python examples/generate_samples.py
# writes report.docx, review.pptx and sales.xlsx into examples/output/
Development
uv sync
uv run pytest
uv run ruff check .
License
MIT © 2026 Touka Project — see LICENSE.
Document generation is powered by python-docx, python-pptx, openpyxl, and XlsxWriter; Markdown parsing by markdown-it-py. All MIT/BSD licensed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_docgen-0.1.0.tar.gz.
File metadata
- Download URL: mcp_docgen-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ac2ef7133ec5e7568c424212915a72a4a504cd1e2ced39a680e1bd69292db79
|
|
| MD5 |
72031fe344bb7df5345fb73f31259470
|
|
| BLAKE2b-256 |
a6ad572b0fc0f735149f245cfd05d576fecf2cab8b2a2727901651efae62cbae
|
File details
Details for the file mcp_docgen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_docgen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79f6de87c12c8eaed4ac212466544b759f213fc7f21fb66246c47b91a0ea20b0
|
|
| MD5 |
47889cc0fb284890b41bd3ef2438c0a5
|
|
| BLAKE2b-256 |
585434f150ad3c469243defa653e0880d0737be5cdd73d1aced491cf39f3e069
|