Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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.

DocPurpose
DOCFORGE.mdDocForge engine specification
FORGE.mdForge product spec (workflows, architecture, guardrails)
AUDIT.mdSecurity / correctness / deploy audit + resolution log

Requirements

  • Node.js 20+
  • Typst0.14.2+ (pinned — typst --version must be ≥ TYPST_VERSION_PIN in src/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).

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)

ToolPurpose
docforge_list_templatesPick a template
docforge_get_template_schemaJSON Schema + README + sample
docforge_create_documentCreate document handle (24h idle TTL)
docforge_compile_documentPDF + PNG previews (synchronous)
docforge_compile_document_asyncSame, via MCP Tasks (large docs)
docforge_repair_documentDeterministic data fixes
docforge_lint_documentQuality gate before export
docforge_preview_documentBase64 PNG previews for visual QA
docforge_visual_qa_documentLayout heuristics beyond lint
docforge_export_documentFinal artifacts
docforge_destroy_documentCleanup

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 catalog
  • docforge://marketplace — community templates only
  • docforge://templates/{id}/readme — agent README
  • docforge://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 (default accessibility: true)
  • options.pdf_standard: "a-2a" — PDF/A archival (accessibility: false required; mutually exclusive with UA)

Environment variables

VariableDefaultPurpose
DOCFORGE_DATA_ROOT.data/documentsDocument workspaces + custom templates
DOCFORGE_TYPST_PATHtypstTypst CLI binary
DOCFORGE_TYPST_PACKAGE_PATHvendor/...Offline Typst package source
DOCFORGE_TYPST_PACKAGE_CACHE_PATHTypst package cache override
DOCFORGE_COMPILE_TIMEOUT_MS30000Compile timeout
DOCFORGE_DOCUMENT_TTL_MS86400000Idle document handle TTL (24h)
DOCFORGE_TEMPLATE_SOURCE_DIRSExtra allowed dirs for custom template sources
DOCFORGE_MAX_DATA_BYTES5242880Max document JSON payload
DOCFORGE_MAX_CSV_BYTES1048576Max Slack CSV attachment
DOCFORGE_MAX_ASSET_BYTES10485760Max uploaded/brand asset
FORGE_MCPonSet off to force in-process PDF generation
FORGE_MCP_SERVER_ENTRYdist/index.jsOverride MCP child entry
SLACK_LOG_LEVELinfoSet debug for Slack agent diagnostics
DOCFORGE_VISUAL_THRESHOLD0.02Visual-regression diff threshold
TYPST_VERSION_PIN0.14.2Script-level Typst pin override
POLL_*, SEED_*see .env.sampleLocal 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.

About

Agent-grade document production MCP server powered by Typst, plus Forge, a Slack agent for document workflows

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages