docforge
Agent-grade document production powered by Typst: templates with JSON schemas, deterministic compile/lint/repair, PNG previews and visual QA
README
DocForge
Agent-grade document production MCP server powered by Typst, plus Forge — a Slack agent for document workflows.
Quick install (MCP)
Requires Node 20+ and Typst 0.14.2+ on PATH (brew install typst / other platforms).
{
"mcpServers": {
"docforge": {
"command": "npx",
"args": ["-y", "@precisionutilityguild/docforge"],
"env": {
"DOCFORGE_DATA_ROOT": "/absolute/path/for/your/documents"
}
}
}
}
Set DOCFORGE_DATA_ROOT when installing via npx — the default stores documents inside the installed package directory, which under npx lives in a cache that can be pruned.
| Doc | Purpose |
|---|---|
| DOCFORGE.md | DocForge engine specification |
| FORGE.md | Forge product spec (workflows, architecture, guardrails) |
| AUDIT.md | Security / correctness / deploy audit + resolution log |
Requirements
- Node.js 20+
- Typst 0.14.2+ (pinned —
typst --versionmust be ≥TYPST_VERSION_PINinsrc/config.ts)
Setup
npm install
npm run build
npm run check:typst # verify Typst pin (0.14.2)
npm run check:packages # verify vendored offline @preview packages
npm run lint # eslint
npm test # unit/integration tests
npm run release:qa # full local release gate
npm run test:visual # golden PNG regression (24 templates)
Run Forge (Slack agent)
Requires Slack CLI and a workspace.
cp .env.sample .env # fill SLACK_BOT_TOKEN + SLACK_APP_TOKEN
npm run slack # or: slack run
In Slack: @forge help lists Draft PDF plus the four curated document workflows (proposal, incident, board pack, status). Socket mode is default when SLACK_APP_TOKEN is set; HTTP mode uses SLACK_SIGNING_SECRET + PORT (includes GET /health).
- Socket-mode manifest (local dev):
slack/manifest.json - HTTP-mode manifest (deploy):
slack/manifest.http.json
The Slack agent drives DocForge over MCP, not in-process: producePdf spawns the
MCP server (dist/index.js) as a stdio child and calls docforge_* tools
(src/forge/mcp-client.ts). Set FORGE_MCP=off to force the in-process fallback.
Deploy (HTTP)
docker build -t forge .
docker run -p 3000:3000 \
-e SLACK_SOCKET_MODE=false \
-e SLACK_BOT_TOKEN \
-e SLACK_SIGNING_SECRET \
forge
The image ships Node 22, pinned Typst 0.14.2, the build, dist/index.js (the MCP
child), and vendor/typst-packages/ so compiles work with no network access.
Run MCP server (stdio)
npm start
Cursor / MCP config example
{
"mcpServers": {
"docforge": {
"command": "node",
"args": ["/absolute/path/to/typstmcp/dist/index.js"],
"env": {
"DOCFORGE_DATA_ROOT": "/absolute/path/to/typstmcp/.data/documents"
}
}
}
}
MCP tools (core workflow)
| Tool | Purpose |
|---|---|
docforge_list_templates |
Pick a template |
docforge_get_template_schema |
JSON Schema + README + sample |
docforge_create_document |
Create document handle (24h idle TTL) |
docforge_compile_document |
PDF + PNG previews (synchronous) |
docforge_compile_document_async |
Same, via MCP Tasks (large docs) |
docforge_repair_document |
Deterministic data fixes |
docforge_lint_document |
Quality gate before export |
docforge_preview_document |
Base64 PNG previews for visual QA |
docforge_visual_qa_document |
Layout heuristics beyond lint |
docforge_export_document |
Final artifacts |
docforge_destroy_document |
Cleanup |
Wave 6–7 also expose versioning, template upgrade, marketplace, custom template registration, brand extraction, and scaffold generation. See .cursor/skills/docforge/SKILL.md.
MCP resources
docforge://templates— built-in + marketplace catalogdocforge://marketplace— community templates onlydocforge://templates/{id}/readme— agent READMEdocforge://templates/{id}/sample— sample JSON
Template catalog (24)
Built-in (21): technical_note, executive_memo, sales_proposal, research_report, incident_report, kpi_report, monthly_metrics, survey_report, financial_snapshot, postmortem, project_status, decision_record, meeting_brief, invoice, contract_summary, cv, client_intake, risk_assessment, cohort_analysis, board_one_pager, compliance_memo
Marketplace (3): startup_pitch, nonprofit_report, tech_rfc
Forge Slack commands
@forge draft ...— infer a safe DocForge template from pasted notes or thread context, then generate a reviewed PDF@forge proposal for Northstar— sales proposal from discovery context + user-supplied pricing@forge incident report from #incident-api-gateway— incident report from Slack timeline@forge board pack for Q3 operating review— KPI board pack from CSV@forge status for #team-eng— weekly RAG status report from a channel's activity (workstreams, blockers, next steps — grounded, not invented)
PDF compliance options
options.pdf_standard: "ua-1"— PDF/UA accessibility export (defaultaccessibility: true)options.pdf_standard: "a-2a"— PDF/A archival (accessibility: falserequired; mutually exclusive with UA)
Environment variables
| Variable | Default | Purpose |
|---|---|---|
DOCFORGE_DATA_ROOT |
.data/documents |
Document workspaces + custom templates |
DOCFORGE_TYPST_PATH |
typst |
Typst CLI binary |
DOCFORGE_TYPST_PACKAGE_PATH |
vendor/... |
Offline Typst package source |
DOCFORGE_TYPST_PACKAGE_CACHE_PATH |
— | Typst package cache override |
DOCFORGE_COMPILE_TIMEOUT_MS |
30000 |
Compile timeout |
DOCFORGE_DOCUMENT_TTL_MS |
86400000 |
Idle document handle TTL (24h) |
DOCFORGE_TEMPLATE_SOURCE_DIRS |
— | Extra allowed dirs for custom template sources |
DOCFORGE_MAX_DATA_BYTES |
5242880 |
Max document JSON payload |
DOCFORGE_MAX_CSV_BYTES |
1048576 |
Max Slack CSV attachment |
DOCFORGE_MAX_ASSET_BYTES |
10485760 |
Max uploaded/brand asset |
FORGE_MCP |
on |
Set off to force in-process PDF generation |
FORGE_MCP_SERVER_ENTRY |
dist/index.js |
Override MCP child entry |
SLACK_LOG_LEVEL |
info |
Set debug for Slack agent diagnostics |
DOCFORGE_VISUAL_THRESHOLD |
0.02 |
Visual-regression diff threshold |
TYPST_VERSION_PIN |
0.14.2 |
Script-level Typst pin override |
POLL_*, SEED_* |
see .env.sample |
Local Slack poll/seed utility controls |
CI
GitHub Actions runs: checksum-verified Typst install → npm audit → Typst pin check →
template sync check → vendored-package check → lint + script syntax check → format
check → build → unit/integration tests → Forge smoke → visual regression → package
contents dry-run → Docker build. Golden drift fails CI; update with
npm run compile:golden.
For the full local release gate, run npm run release:qa. It executes the
offline CI-critical checks, verifies Slack manifest scopes/events, confirms the
npm package carries Slack setup/deploy assets, and scans tracked files for common
secret token patterns.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。