Skip to main content
Glama

nw-MCP — Unofficial MCP server for novelWriter

Status: phases 1–5 implemented — read core, story bible, analysis, opt-in safe edits and structural writes; the release packaging (v1.0: PyPI, registry listing) is still pending. See the roadmap for what lands in which phase.

IMPORTANT

This is an unofficial, independent tool. It is not affiliated with, endorsed by, or supported by the novelWriter project — please do not report issues with it to the novelWriter project.

novelWriter's maintainers keep generative AI out of the app itself: their AI Policy states plainly that they will not add features that generate text for you, while acknowledging that language models have a legitimate, pre-generative use in text analysis. nw-MCP is built for that analysis side, and we ask you to use it that way — as an AI-assisted helper for understanding, checking and integrating your novelWriter project, not as a content generator. The words should stay yours.

What it is

nw-MCP is a Model Context Protocol server that lets AI clients (Claude Desktop, Claude Code, VS Code, Cursor and others) read and analyze novelWriter projects. It works directly on novelWriter's documented file format — nwProject.nwx plus the content/*.md document files — and never modifies or bundles novelWriter.

It is an analysis and continuity assistant, not an AI co-writer. Reading and analysis are the core; writing tools are off by default and only work when you explicitly set NW_MCP_ALLOW_WRITE=1 (see Configuration).

Intended use

Treat nw-MCP as an AI-assisted integration layer for novelWriter, not an AI co-writer. The aim is to smooth novelWriter into the rest of your workflow: ask an AI client about your story bible, continuity and structure instead of paging through files yourself; wire project state into dashboards, checklists or other writing tools; automate the mechanical edits — synopses, metadata, placing text you have written. The creative work stays with you, which is also the stance of novelWriter's own AI Policy. If you are looking for a tool that generates prose for you, this is deliberately not it.

Capabilities

  • Project overview — title, author, word counts, project tree with statuses.

  • Outline-first reading — parts, chapters and scenes in order, with synopses and POV, so the AI's context stays small. Full text is loaded only on demand, paginated.

  • Story bible — all @char, @location, @plot, @object, @entity and other tags, where each is defined, and where it is referenced.

  • Continuity analysis — undefined and unused tags, headings without POV, missing synopses, character timelines, POV distribution, word-count targets.

  • Opt-in safe edits (v0.4) — with NW_MCP_ALLOW_WRITE=1: update_synopsis and update_metadata edit only %Synopsis: / @keyword: lines of one heading section. Every write is guarded by a lock-file check, backed up to a timestamped .mcp-backups/ folder, written atomically, and verified by re-parsing (auto-restored on any inconsistency). The novelWriter index is never written — rebuild it (F9) after edits.

  • Structural writes (v0.5) — with NW_MCP_ALLOW_WRITE=1: append_to_document appends prose paragraphs to one heading section (never reflowing existing lines), replace_document_text replaces one exact, unique match (refusing 0 or several matches, and any contact with headings or @/% metadata lines), and create_document adds a new document to the tree — a spec-conformant content/<handle>.md plus a minimal, style-preserving nwProject.nwx edit. Prose-only payloads: lines starting with #, @ or % are refused everywhere. Same safety pipeline as v0.4; Trash parents refused.

What it will not do

  • Modify, fork or patch novelWriter itself.

  • Generate prose for you — by design (see Intended use).

  • Sync with a running novelWriter instance — there is no API for this.

  • Touch the meta/ folder (novelWriter's own index cache).

Related MCP server: TypeWriter MCP

Install

nw-MCP is a local stdio MCP server: your MCP client launches it as a subprocess and communicates with it over stdin/stdout. You never start it by hand — you point a client config at it (see Configuration).

From PyPI (pending)

uvx mcp-server-for-novelwriter

From source (current)

Requires Python 3.11+. The easiest way is uv:

git clone <repo-url> nw-MCP
cd nw-MCP
uv tool install .

Or plain pip in a virtual environment:

git clone <repo-url> nw-MCP
cd nw-MCP
python -m venv .venv
.venv\Scripts\python -m pip install .    # Windows
# .venv/bin/python -m pip install .      # macOS / Linux

Either way you end up with a novelwriter-mcp command (also runnable as python -m nw_mcp from that environment). Give your client the absolute path to that command.

Configuration

The server is configured at launch through environment variables (or a --project PATH flag that overrides NW_PROJECT_PATH):

Variable

Default

Purpose

NW_PROJECT_PATH

(required)

Path to the novelWriter project folder — the folder containing nwProject.nwx

NW_MCP_ALLOW_WRITE

0

Registers the 5 write tools (update_synopsis, update_metadata, append_to_document, replace_document_text, create_document)

NW_MCP_INCLUDE_ARCHIVE

0

Includes Archive items in results

NW_MCP_MAX_CHARS

40000

Maximum characters per tool response

One server instance serves one project: the path is fixed at launch on purpose, so the AI cannot aim the server at arbitrary folders. To work on a different project, point the same entry at another folder, or register several server entries — one per project.

Most MCP clients take the same core shape — a command, optional args, and env. Claude Desktop style:

{
  "mcpServers": {
    "novelwriter": {
      "command": "C:/dev/nw-MCP/.venv/Scripts/novelwriter-mcp.exe",
      "args": [],
      "env": {
        "NW_PROJECT_PATH": "C:/Users/you/Documents/My Novel.nw",
        "NW_MCP_ALLOW_WRITE": "1"
      }
    }
  }
}

Ready-made configs live in examples/:

Leave NW_MCP_ALLOW_WRITE out (or at 0) for a read-only server with 13 tools; set it to 1 for all 18. Write tools are marked destructive, so MCP clients prompt before each call, and writes only succeed when novelWriter itself has the project closed (see Safety).

Trying it out

With MCP Inspector. Run these from the repo checkout so the relative .venv/... path resolves — from anywhere else, use the absolute path to the exe (D:\...\nw-MCP\.venv\Scripts\novelwriter-mcp.exe).

UI mode — set NW_PROJECT_PATH in the environment panel:

npx @modelcontextprotocol/inspector .venv/Scripts/novelwriter-mcp.exe

Headless (CLI mode) — the Inspector does not forward your shell environment to the server, so use --project (or env in a client config). Point it at a real novelWriter project folder (the folder containing nwProject.nwx):

npx @modelcontextprotocol/inspector --cli .venv/Scripts/novelwriter-mcp.exe --project C:/path/to/MyNovel.nw --method tools/call --tool-name get_project_info

Safety

  1. Read-only by default. Write tools are not even registered unless you enable them.

  2. Lock-file guard. If novelWriter has the project open (nwProject.lock present), writes are refused — a running novelWriter may overwrite files at any moment.

  3. Backups. Every write first copies affected files to .mcp-backups/.

  4. Atomic writes. Temp file, then rename, so a crash cannot leave half-written files.

  5. Input validation. Handles must match the documented 13-character hex pattern; paths must stay inside the project folder.

  6. Format version gate. Unknown nwProject.nwx versions get read-only mode or are refused.

  7. Hardened XML parsing and no shell or code execution of any kind.

See SECURITY.md for details and COMPATIBILITY.md for tested novelWriter / file-format versions.

Roadmap

Phase

Version

Scope

0. Research

—

File Format Spec study, fixture projects, name and license

1. Read core

v0.1

Storage layer; info, tree, outline, read, search tools

2. Story bible

v0.2

Tag index, get_tag, find_scenes, resources

3. Analysis

v0.3

Continuity report, timelines, POV and word-count reports, prompts

4. Safe edits

v0.4

Opt-in metadata and synopsis edits, lock guard, backups

5. Structural writes

v0.5

append, replace, create_document

6. Release

v1.0

PyPI package, docs, MCP Registry listing

The changelog documents what shipped in each release.

Development

uv sync            # create .venv and install dev dependencies
uv run pytest      # run the test suite
uv run ruff check .  # lint
uv run ruff format . # format

Layout (src layout, clean-room parser — no novelWriter code is imported):

src/nw_mcp/
├── storage/     # .nwx / document parsers, lock-file checks, safe writer (opt-in)
├── domain/      # outline, tag index, search, continuity analysis
└── mcp_layer/   # thin MCP tool/resource/prompt wrappers, output limits

License

MIT — see LICENSE. novelWriter itself is a separate project under GPL-3.0; this tool neither imports nor bundles its code.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers