Add vitest.config.ts to both packages with 80/65/90/80 thresholds for statements/branches/functions/lines. Add @vitest/coverage-v8 devDep and test:coverage npm script. New test files: - mcp-ts: registry (19 tests), docstore (11 tests) - vscode-ext: merge-extended (14), merge-mocked (12), workspace-extended (10), format-on-save edge cases (+10) Combined coverage: mcp-ts 89/75/94/91, vscode-ext 94/83/98/94. |
||
|---|---|---|
| .github | ||
| .vscode | ||
| mcp-ts | ||
| mcpb | ||
| scripts | ||
| vscode-ext | ||
| .gitignore | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| README.md | ||
Bindery
Markdown book authoring toolkit: a VS Code extension for typography formatting and multi-format export, paired with an MCP server for full-text search and AI assistant integration.
Origin
This project started as a personal writing tool, born out of frustration with the copy-paste loop that most AI-assisted writing ends up as.
It started with Word and ChatGPT: writing a chapter, copying it into the browser, getting feedback, pasting it back. Versioning was an issue and keeping the ChatGPT project up to date with recent .docx files was a lot of work. Moving to VS Code and Markdown files seemed like the natural next step: plain text, version control, and the ability to plug in an MCP server so an agent like Codex could read the book directly.
In practice though, I still fell back to copy-pasting for feedback and only really used the tooling for typography formatting. Most VS Code extensions are built for coding: short iterations where the code is the truth, rather than the longer-running, chat-based sessions you get in web tools. That frustration is what pushed the VS Code extension into existence. At minimum, the formatting and exporting should just work without any ceremony.
The bigger shift came with Claude Cowork, which combines the session memory of a long-running agent with direct file access. That made the MCP server genuinely useful: the agent could navigate chapters, search for context, and keep track of the story across a session without being handed everything manually. The extension and MCP server now support both workflows: VS Code agents (Copilot, Codex, Claude for VS Code) and standalone Claude Desktop / Cowork.
Components
vscode-ext/ — VS Code Extension
The Bindery extension provides:
- Typography formatting — curly quotes, em-dashes, ellipses, smart apostrophes
- Chapter merge & export — Markdown, DOCX, EPUB, PDF output via Pandoc + LibreOffice
- Dialect conversion — US→UK spelling with extensible substitution rules (
.bindery/translations.json) - Multi-language support — configurable per-language chapter labelling and folder structure
- Workspace config —
.bindery/settings.jsonfor project-level settings - MCP integration — registers Bindery tools for GitHub Copilot Chat and writes
.vscode/mcp.jsonfor Claude / Codex
Install from the VS Code Marketplace or:
cd vscode-ext
npm install
npm run compile
npx @vscode/vsce package
See vscode-ext/README.md for full documentation.
mcp-ts/ — MCP Server (Node.js / TypeScript)
A Model Context Protocol server that exposes your book project to AI assistants. Pure Node.js.
- BM25 full-text search — fast lexical search across all chapters and notes via MiniSearch
- Optional semantic search — set
BINDERY_OLLAMA_URLfor semantic reranking, or enable a full semantic index for precomputed embedding search - Version tracking —
get_review_textshows uncommitted changes as a structured diff;git_snapshotsaves progress as a git commit scoped to story/notes/arc folders. Git is auto-initialized during workspace setup if available - Multi-book support — configure one or more books via
--book Name=pathCLI args orBINDERY_BOOKSenv var; every tool call specifies which book to use by name (agents never see raw paths) - Container/mount aware — agents in sandboxed environments (e.g. Cowork) can call
identify_bookwith their working directory to discover their book name, even when mount paths differ from the configured paths
See mcpb/README.md for full documentation and tool list.
mcpb/ — Claude Desktop Extension
Packages the MCP server as a .mcpb file for one-click installation in Claude Desktop or Cowork.
Download the latest release from Releases — no build step needed.
Quick Start
VS Code (Copilot / Claude / Codex)
- Install the Bindery extension from the Marketplace
- Open your book folder in VS Code
- Run
Bindery: Initialize Workspaceto create.bindery/settings.json(also initializes a git repo if not present) - Run
Bindery: Register MCP Serverto create.vscode/mcp.json(primarily for Claude/Codex discovery; not needed for GitHub Copilot Chat because the extension registers the tools automatically) - Tools are now available in GitHub Copilot Chat, Claude for VS Code, and Codex
Claude Desktop / Cowork
- Download
bindery-mcp-*.mcpbfrom the latest release - Open Claude Desktop → Settings → Extensions → Install from file
- Fill in the Books field with semicolon-separated
Name=pathpairs:ScaryBook=C:\Users\My\Projects\ScaryBook;MyNovel=D:\Writing\MyNovel - Optionally set the Ollama URL if you want semantic reranking
- Optionally enable the semantic index and choose a default search mode if you want
full_semanticsearch with rebuild warnings when the embedding index becomes stale.- Note: full embedding can be a heavy operation, depending on your hardware, when running a local Ollama instance.
- Tools are now available — the agent calls
list_booksto discover book names
Formatting & Export only (no MCP)
The VS Code extension works standalone — no server setup needed for typography formatting and export.
Project Structure
├── vscode-ext/ VS Code extension (TypeScript)
│ ├── src/ Extension source
│ ├── package.json Extension manifest
│ └── README.md Extension docs
├── mcp-ts/ MCP server (Node.js / TypeScript)
│ ├── src/ Server source
│ └── package.json Package manifest
├── mcpb/ Claude Desktop extension package (.mcpb)
│ ├── manifest.json Extension metadata and tool list
│ └── server/ Populated by CI (mcp-ts build output)
└── LICENSE MIT
Prerequisites
- VS Code 1.85+
- Git (recommended) — needed for version tracking,
get_review_text, andgit_snapshot. Auto-initialized during workspace setup.- Install via package manager or from https://git-scm.com
- Pandoc (optional) — needed for DOCX/EPUB/PDF export.
- Install via package manager or from https://pandoc.org/installing.html
- LibreOffice (optional) — needed for PDF export only.
- Install via package manager or from https://www.libreoffice.org
- Ollama (optional) — needed for semantic reranking and search.
- Install via package manager or from https://ollama.com/
Privacy
Bindery stays within your workspace, only if the optional Ollama URL is filled for the MCP server will texts be sent to Ollama for embedding / semantic search. The full privacy policy can be viewed at https://evdboom.nl/projects/bindery/privacy
License
MIT — see LICENSE.
Contributing — template source of truth
The AI instruction file templates are maintained in one place only:
mcp-ts/src/templates.ts ← SINGLE SOURCE OF TRUTH
vscode-ext/src/ai-setup-templates.ts is a generated copy and must never be edited directly.
CI syncs it automatically before every publish step.
Syncing locally
After changing mcp-ts/src/templates.ts, copy it to the VS Code extension:
cp mcp-ts/src/templates.ts vscode-ext/src/ai-setup-templates.ts
Running tests
# MCP server (includes template contract tests + copy-parity check)
cd mcp-ts && npm test
# VS Code extension
cd vscode-ext && npm test
The copy-parity test (mcp-ts/test/templates-parity.test.ts) skips gracefully when
ai-setup-templates.ts is absent (normal in fresh checkouts) and fails when it exists
but differs from the source — this is what CI catches.
What CI does
The CI workflow (.github/workflows/ci.yml) runs on every push and pull request:
- Builds and tests the MCP server.
- Copies
mcp-ts/src/templates.ts→vscode-ext/src/ai-setup-templates.ts. - Verifies the copy is identical to the source (fails with a clear remediation message if not).
- Builds and tests the VS Code extension.
If CI fails on the sync check, fix it by running the copy command above and committing the result.