@zoulabo/doc-hive
v0.1.0
Published
MCP server for document generation — Excel, Word, and PowerPoint from structured data and Markdown.
Downloads
81
Maintainers
Readme
Why? AI agents generate data, but users need real documents — spreadsheets with charts, formatted Word reports, branded slide decks. Doc Hive bridges the gap.
Contents
- Features
- Companion: LINE Hive
- Quick Start
- How It Works
- Prerequisites
- Installation
- MCP Tools — XLSX · DOCX · PPTX · Templates · Inspect
- PPTX Theme System — Presets · Org Templates · Per-slide Directives
- Environment Variables
- Development
- Architecture
- Contributing
- License
Features
- 📊 Excel (XLSX) — multi-sheet workbooks from CSV with column styles, formulas, merges, frozen headers
- 📝 Word (DOCX) — documents from Markdown with headings, lists, tables, images, page setup
- 📽️ PowerPoint (PPTX) — presentations from Marp-style Markdown with auto-detected layouts and 4 built-in presets
- 🎨 Theme system — gradient backgrounds, title bars, logos, footers, slide numbers
- 🏢 Org templates — branded JSON configs for company-wide consistency
- 🐍 Python bridge — fill existing .pptx templates via python-pptx
- 📎 File output — all documents written to a configurable output directory with absolute paths
Companion: LINE Hive
Doc Hive generates documents — LINE Hive delivers them. Together, your agents can create polished spreadsheets and slide decks, then send them straight to your phone via LINE.
%%{init: {"theme": "default"}}%%
flowchart TB
subgraph Generate["📄 Doc Hive"]
direction LR
XLSX["create_xlsx"] ~~~ PPTX["create_pptx"]
end
subgraph Deliver["🐝 LINE Hive"]
direction LR
Ask["line_ask"] ~~~ Send["line_send_message"]
end
Agent["🤖 Agent"] --> Generate
Generate -.-> File["💾 Files"]
File -.-> Deliver
Agent --> Deliver
Deliver --> Phone["📱 LINE"]
style Generate fill:#e3f2fd,stroke:#1565c0
style Deliver fill:#f3e5f5,stroke:#7b1fa2
classDef output fill:#e8f5e9,stroke:#2e7d32
class Phone outputDoc Hive works standalone — no LINE Hive required. But pairing them lets agents generate and deliver in one workflow. See the LINE Hive README for full documentation.
Quick Start
npm install @zoulabo/doc-hive
npm install exceljs docx pptxgenjs # document libraries you need
npx doc-hive init # interactive setup
# Restart your editor — MCP server starts automaticallyOr set up for a specific editor directly:
npx doc-hive init --editor cursor # or: vscode, claude-code, claude-desktopTell your agent: "Create a spreadsheet with Q1 revenue data" — it handles the rest.
How It Works
Agents call MCP tools with structured data. Doc Hive generates polished files and returns the path.
sequenceDiagram
participant Agent as 🤖 Agent
participant Hive as 📄 Doc Hive
participant FS as 💾 File System
Agent->>Hive: create_xlsx({ title, csv, columns })
Hive->>FS: Write .xlsx
Hive-->>Agent: { filePath: "/out/Report.xlsx" }
Agent->>Hive: create_pptx({ markdown, theme: "dark" })
Hive->>FS: Write .pptx
Hive-->>Agent: { filePath: "/out/Deck.pptx" }
Agent->>Hive: inspect_template({ template: "corp.pptx" })
Hive-->>Agent: { slides, placeholders, layouts }
Agent->>Hive: fill_template({ template, data })
Hive->>FS: Write filled .pptx
Hive-->>Agent: { filePath: "/out/Filled.pptx" }Key concepts:
- Structured input — CSV for spreadsheets, Markdown for docs and slides, JSON for templates
- Zero config — sensible defaults; customize with themes, presets, or org templates
- Optional deps — only install the document libraries you actually use
Prerequisites
- Node.js ≥ 18
- At least one document library:
| Feature | Package | Install |
|---------|---------|---------|
| Excel (XLSX) | exceljs | npm install exceljs |
| Word (DOCX) | docx | npm install docx |
| PowerPoint (PPTX) | pptxgenjs | npm install pptxgenjs |
| PPTX templates | python-pptx | pip install python-pptx |
Python is only needed for
fill_templateandinspect_template. All other tools use pure Node.js.
Installation
npm install @zoulabo/doc-hive
npx doc-hive init # interactive setupThe wizard detects your editor and writes the right config. You can also specify the editor directly:
npx doc-hive init --editor cursor # or: vscode, claude-code, claude-desktopClaude Code as VS Code/Cursor extension? Use
--editor claude-code(not--editor vscode).
Manual Configuration
If you prefer manual setup:
Add to .vscode/mcp.json:
{
"servers": {
"doc-hive": {
"command": "node",
"args": ["node_modules/@zoulabo/doc-hive/bin/doc-hive.js"],
"env": {
"OUTPUT_DIR": ".doc-output"
}
}
}
}Add to .mcp.json:
{
"mcpServers": {
"doc-hive": {
"command": "node",
"args": ["node_modules/@zoulabo/doc-hive/bin/doc-hive.js"],
"env": {
"OUTPUT_DIR": ".doc-output",
"TEMPLATE_DIR": "templates"
}
}
}
}Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"doc-hive": {
"command": "node",
"args": ["/path/to/your/project/node_modules/@zoulabo/doc-hive/bin/doc-hive.js"],
"env": {
"OUTPUT_DIR": ".doc-output"
}
}
}
}The server uses stdio transport (stdin/stdout for MCP JSON-RPC). Configure your client to run:
node node_modules/@zoulabo/doc-hive/bin/doc-hive.jsWith these environment variables:
OUTPUT_DIR— output directory (default.doc-hive-out)TEMPLATE_DIR— template directory (defaulttemplates)PYTHON_PATH— Python 3 executable (defaultpython3)
MCP Tools
| Tool | Purpose | Requires |
|------|---------|----------|
| create_xlsx | Generate Excel workbook from CSV data | exceljs |
| create_docx | Generate Word document from Markdown | docx |
| create_pptx | Generate PowerPoint from Marp-style Markdown | pptxgenjs |
| fill_template | Fill .pptx template placeholders with data | python-pptx |
| inspect_template | List slide layouts, placeholders, and shapes | python-pptx |
| list_templates | List available .pptx templates | — |
| check_python | Verify Python 3 + python-pptx availability | — |
create_xlsx
Generate Excel workbooks from CSV data.
title: "Q1 Revenue Report"
csv: "Product,Revenue,Growth\nWidget A,$1200,12%\nWidget B,$3400,28%"
columns: [{ width: 20 }, { width: 15, style: "currency" }, { width: 12, style: "percent" }]Features: Multi-sheet, multi-table per sheet, column styles (currency/percent/date/number/text), formulas, cell merges, header styles (dark/light/accent), frozen headers, auto-filters, striped rows.
create_docx
Generate Word documents from Markdown.
title: "Status Report"
markdown: "# Project Status\n\n## Summary\n\nThe project is **on track**.\n\n- Task 1: Complete\n- Task 2: In progress"Features: H1–H6 headings, bold/italic/code, bullet & numbered lists, pipe-delimited tables, images with dimensions, page breaks (---), page setup (orientation, size, margins), headers & footers with page numbers.
create_pptx
Generate PowerPoint presentations from Marp-style Markdown.
title: "Q1 Review"
markdown: "# Q1 Review\nQuarterly Business Review\n\n---\n\n## Revenue\n\n- Total: $4.6M\n- Growth: 18% YoY"
theme: "dark"Features: Auto-detected layouts (# Title, ## Content, blank, two-column), 4 built-in presets, gradient backgrounds, gradient title bars, slide numbers, logos, footers, per-slide overrides, background images, tables, blockquotes.
See PPTX Theme System for full details.
fill_template
Fill an existing .pptx template with data using python-pptx. Use inspect_template first to discover placeholder indices.
template: "corporate.pptx"
title: "Q1 Report"
data: {
slides: [
{ slideIndex: 0, placeholders: { 0: "Q1 Report", 1: "January – March 2024" } },
{ slideIndex: 1, placeholders: { 0: "Revenue Summary" }, images: { 13: "chart.png" } }
],
globalReplacements: { "{{company}}": "ACME Corp", "{{year}}": "2024" }
}inspect_template
List slide layouts, placeholders, and shapes in a .pptx template. Run before fill_template to discover the template structure.
list_templates / check_python
Utility tools — list available .pptx files in the template directory, or verify that Python 3 and python-pptx are installed.
PPTX Theme System
Theme Presets
Pass theme: "dark" (string) or theme: { preset: "dark", ... } (object with overrides).
| Preset | Background | Text | Accent | Title Bar |
|--------|-----------|------|--------|-----------|
| dark | Gradient navy | White | Purple #6C63FF | Gradient |
| corporate | White | Dark | Blue #1a73e8 | Gradient |
| vibrant | Gradient warm | White | Orange #ff6b35 | Gradient |
| minimal | Light gray | Dark | Gray #666666 | Flat |
Theme Resolution Chain
Per-slide directives (<!-- bg: #hex -->)
→ Per-call overrides ({ theme: { primaryColor: "#ff0000" } })
→ Named org template (template: "corporate" → templates/corporate.json)
→ Workspace default (templates/default.json)
→ Built-in preset (theme: "dark")
→ Hardcoded defaults (purple accent, dark text, Calibri)Organization Templates
Create a JSON file in your template directory to enforce brand consistency:
// templates/corporate.json
{
"primaryColor": "#003366",
"fontColor": "#FFFFFF",
"fontFamily": "Noto Sans JP",
"background": { "gradient": ["#003366", "#001a33"] },
"titleBar": "gradient",
"slideNumbers": { "format": "{n} / {total}" },
"logo": {
"path": "assets/logo.png",
"position": "top-right",
"width": 1.2,
"height": 0.5
},
"footer": {
"text": "© 2024 ACME Corp",
"position": "bottom-left"
}
}Use it: create_pptx({ ..., template: "corporate" }) — Doc Hive reads templates/corporate.json and applies all settings.
Per-slide Directives
Override theme settings on individual slides using HTML comments in Markdown:
| Directive | Effect |
|-----------|--------|
| <!-- bg: #hex --> | Override slide background color |
| <!-- fontColor: #hex --> | Override text color |
| <!-- titleBar: none --> | Hide title bar on this slide |
| <!-- no-slide-number --> | Hide slide number on this slide |
| <!-- logo: none --> | Hide logo on this slide |
| <!-- layout: two-column --> | Force two-column layout |
Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| OUTPUT_DIR | .doc-hive-out | Directory for generated files |
| TEMPLATE_DIR | templates | Directory for .pptx templates and org template JSON configs |
| PYTHON_PATH | python3 | Path to Python 3 executable |
Output
Generated files are written to the output directory (default .doc-hive-out/). Each tool returns:
{
"success": true,
"filePath": "/absolute/path/to/.doc-hive-out/Q1-Revenue-Report.xlsx",
"fileName": "Q1-Revenue-Report.xlsx"
}Development
git clone https://github.com/zoulabo/doc-hive.git
cd doc-hive
npm install
npm install exceljs docx pptxgenjs # optional deps for testing
npm run build
npm test # 163 tests
cp .vscode/mcp.json.example .vscode/mcp.json # MCP dev config| Command | Purpose |
|---------|---------|
| npm run build | Compile TypeScript |
| npm run watch | Watch mode |
| npm test | Run tests (vitest) |
| npm start | Start standalone server |
Architecture
- Standalone MCP server — stdio transport, no webhook or HTTP server needed
- Optional dependencies — only loaded when tools are called; graceful error if missing
- Python bridge —
spawnwith stdin JSON pipe for template operations (no temp files) - Theme resolution — layered cascade: directives → call overrides → org template → preset → defaults
- File output — all documents written to a single configurable directory with absolute path responses
Contributing
Designed for AI-agent-driven development. The repo includes skill files (.github/skills/) that teach agents the codebase. Point your agent at the repo and let it work.
npm testmust pass (163 tests, <3s)npx tsc --noEmitmust be clean- Let the agents read skills first, then write the code
License
MIT
