{"_id":"longform-memory-mcp","_rev":"2-fa19d98b468b7cbefed40237af074174","name":"longform-memory-mcp","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"longform-memory-mcp","version":"0.1.0","keywords":["mcp","modelcontextprotocol","mcp-server","claude","cursor","llm","long-context","context-window","token-budget","memory","ai-writing","continuity","novel","local-first"],"author":{"name":"Emberspun"},"license":"MIT","_id":"longform-memory-mcp@0.1.0","maintainers":[{"name":"leofenn","email":"baifugui1227@gmail.com"}],"homepage":"https://emberspun.com/open-source/longform-memory","bugs":{"url":"https://github.com/emberspun/longform-memory-mcp/issues"},"bin":{"longform-memory-mcp":"dist/bin.js"},"dist":{"shasum":"a88795457cb20e85a2559114480fabdd4dc06638","tarball":"https://registry.npmjs.org/longform-memory-mcp/-/longform-memory-mcp-0.1.0.tgz","fileCount":25,"integrity":"sha512-/9tidIZf4kPQ1OYqIgpBBQVGKYWwZKY3FRBvdCzmBU9Ab4RsMGsl9uJsx1T2309sL3ucDxEtHrPgAXmHMfmQMQ==","signatures":[{"sig":"MEUCIQDB/W5wf5xSc6zB/21bMAlaKl396/6SyvyuBpA7OL5CRAIgcLUv7gxP26AH0EbU08V2EiFwumVHmG7zudAV7bLGaUc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96527},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"a747c65ad997a37543d83209636d8d4878b29102","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json && node scripts/chmod-bin.mjs","start":"node dist/bin.js","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run typecheck && npm run test && npm run build"},"_npmUser":{"name":"leofenn","email":"baifugui1227@gmail.com"},"repository":{"url":"git+https://github.com/emberspun/longform-memory-mcp.git","type":"git"},"_npmVersion":"11.16.0","description":"MCP server that gives your AI writing assistant a constant-size memory of a long document. Chapter 1000 costs the same tokens as chapter 10. Local-only: no account, no API key, no network.","directories":{},"_nodeVersion":"24.18.1","dependencies":{"zod":"^4.4.3","longform-memory":"^0.1.0","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.9.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/longform-memory-mcp_0.1.0_1786789546962_0.11232571838933825","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"longform-memory-mcp","version":"0.1.1","description":"MCP server that gives your AI writing assistant a constant-size memory of a long document. Chapter 1000 costs the same tokens as chapter 10. Local-only: no account, no API key, no network.","keywords":["mcp","modelcontextprotocol","mcp-server","claude","cursor","llm","long-context","context-window","token-budget","memory","ai-writing","continuity","novel","local-first"],"homepage":"https://emberspun.com/open-source/longform-memory","repository":{"type":"git","url":"git+https://github.com/emberspun/longform-memory-mcp.git"},"bugs":{"url":"https://github.com/emberspun/longform-memory-mcp/issues"},"license":"MIT","author":{"name":"Emberspun"},"type":"module","bin":{"longform-memory-mcp":"dist/bin.js"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18"},"scripts":{"build":"tsc -p tsconfig.build.json && node scripts/chmod-bin.mjs","start":"node dist/bin.js","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","prepublishOnly":"npm run typecheck && npm run test && npm run build"},"dependencies":{"@modelcontextprotocol/sdk":"^1.30.0","longform-memory":"^0.1.0","zod":"^4.4.3"},"devDependencies":{"@types/node":"^22.10.0","typescript":"^5.9.2","vitest":"^3.2.4"},"gitHead":"eec38d1e6e14e8d4cbeab65800111c984f1e88f4","_id":"longform-memory-mcp@0.1.1","_nodeVersion":"24.19.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-1Yg/qAoQQxb++Qucug5whAQqNpn0lToBl0ndbe0yPOoOoHHAY85uV+C73yCVbVuqfJxB7hsYeBZzX3nS8gNhHA==","shasum":"2921f0f0fd6249811034969fba47e579600e3b71","tarball":"https://registry.npmjs.org/longform-memory-mcp/-/longform-memory-mcp-0.1.1.tgz","fileCount":25,"unpackedSize":97270,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/longform-memory-mcp@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHMk32aRAjLWBC/gyjWxj17uVwqGAzJBHzNDbVCWbcLfAiEA5Ve6K0K52lK6T9sqwOlPwOk5LCzxcOIG17cBW4gfAtM="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3906a415-63b1-4032-89da-89971f11335e"}},"directories":{},"maintainers":[{"name":"leofenn","email":"baifugui1227@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/longform-memory-mcp_0.1.1_1786797985759_0.2909451493243902"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-15T10:25:46.797Z","modified":"2026-08-15T12:46:26.210Z","0.1.0":"2026-08-15T10:25:47.112Z","0.1.1":"2026-08-15T12:46:25.891Z"},"bugs":{"url":"https://github.com/emberspun/longform-memory-mcp/issues"},"author":{"name":"Emberspun"},"license":"MIT","homepage":"https://emberspun.com/open-source/longform-memory","keywords":["mcp","modelcontextprotocol","mcp-server","claude","cursor","llm","long-context","context-window","token-budget","memory","ai-writing","continuity","novel","local-first"],"repository":{"type":"git","url":"git+https://github.com/emberspun/longform-memory-mcp.git"},"description":"MCP server that gives your AI writing assistant a constant-size memory of a long document. Chapter 1000 costs the same tokens as chapter 10. Local-only: no account, no API key, no network.","maintainers":[{"name":"leofenn","email":"baifugui1227@gmail.com"}],"readme":"<div align=\"center\">\n\n<img src=\"./assets/hero.webp\" alt=\"A long row of numbered archive cards receding into the distance, with only a dozen pulled out and set aside in focus\" width=\"100%\" />\n\n# longform-memory-mcp\n\n**Your AI writing assistant remembers chapter 3 when it writes chapter 300 — and the prompt never gets bigger.**\n\n[![CI](https://github.com/emberspun/longform-memory-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/emberspun/longform-memory-mcp/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/longform-memory-mcp?logo=npm&color=cb3837)](https://www.npmjs.com/package/longform-memory-mcp)\n[![downloads](https://img.shields.io/npm/dm/longform-memory-mcp?color=cb3837)](https://www.npmjs.com/package/longform-memory-mcp)\n\n[![MCP](https://img.shields.io/badge/MCP-server-6E56CF.svg)](https://modelcontextprotocol.io)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![no API key](https://img.shields.io/badge/API%20key-not%20required-brightgreen.svg)](#privacy)\n[![offline](https://img.shields.io/badge/network-never-brightgreen.svg)](#privacy)\n[![tests](https://img.shields.io/badge/tests-54%20passing-brightgreen.svg)](./test)\n\n**[Documentation and the numbers behind it →](https://emberspun.com/open-source/longform-memory)**\n\n</div>\n\n---\n\n## Install\n\nOne line in your MCP config. No account, no key, no sign-up.\n\n**Claude Desktop** — `claude_desktop_config.json`\n**Cursor** — `~/.cursor/mcp.json`\n**Windsurf, Cline, Zed, Continue** — same shape\n\n```json\n{\n  \"mcpServers\": {\n    \"longform-memory\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"longform-memory-mcp\"],\n      \"env\": { \"LONGFORM_MEMORY_PROJECT\": \"my-novel\" }\n    }\n  }\n}\n```\n\n**Claude Code**\n\n```bash\nclaude mcp add longform-memory -e LONGFORM_MEMORY_PROJECT=my-novel -- npx -y longform-memory-mcp\n```\n\nRestart your client. Then say: *\"remember this chapter\"* and *\"recall context for chapter 12\"*.\n\n---\n\n## The problem it solves\n\nWrite anything long with an LLM — a novel, a manual, a course, a serialised story — and you hit the same wall twice.\n\n**Withhold the past and it contradicts itself.** A character who died in chapter 12 speaks in chapter 30. The key planted in chapter 3 is never mentioned again.\n\n**Send the past and you cannot afford it.** Pasting every prior summary is O(n): tens of thousands of tokens by chapter 100, and by chapter 1000 it does not fit at all. Filling the window also makes things *worse* — models skip the middle.\n\nBoth are the same problem wearing two hats: **there is no budget ceiling.**\n\n```\n   memory in the prompt\n         │\n   61k  ─┤                                              ╭──── just paste it all\n         │                                        ╭─────╯\n   30k  ─┤                          ╭─────────────╯\n         │            ╭─────────────╯\n    4k  ─┤════════════╪═════════════╪═════════════╪════ longform-memory\n         └──────┬─────┴──────┬──────┴──────┬──────┴────\n               10           100           500        1000     chapter\n```\n\nMeasured on a real 1000-chapter book: **61,331 tokens → 4,396**, and going from chapter 500 to chapter 1000 grew the block by **2 tokens**.\n\n---\n\n## The six tools\n\n| tool | what it does |\n| --- | --- |\n| `recall_context` | **The main one.** One paste-ready block: entity states, recent chapters, a sampled skeleton of the whole arc, and older material retrieved as relevant — at a fixed token size, with per-section accounting. |\n| `remember_chapter` | Folds a finished chapter in: summary, entity state changes, thread moves. Optionally stores the prose locally. |\n| `list_open_threads` | What the document promised the reader and has not delivered, most urgent first, overdue flagged. |\n| `check_continuity` | Characters who left the story and act again; threads past their deadline. **Quotes the sentence it tripped on.** |\n| `entity_card` | One character/place/object: current state plus the chapter-by-chapter timeline of how it got there. |\n| `search_memory` | Find chapters by what happened in them, reaching past the recent window. BM25 offline; true semantic search if you configure your own embedding endpoint. |\n\n### The rhythm\n\n```\n   ┌─ recall_context(12) ──────► paste into your drafting context\n   │\n   ├─ list_open_threads(12) ───► what's still owed\n   │\n   ├─ …write chapter 12…\n   │\n   └─ remember_chapter(12, …) ─► summary · entity states · thread moves\n```\n\nStep four is where the value is made. **Your assistant is the model doing the extraction** — it just read the chapter, so it already knows what changed.\n\n---\n\n## It never calls a model\n\n<img src=\"./assets/constant.webp\" alt=\"A single slim card box on a desk, holding a small set of cards with room to spare, casting a long shadow\" align=\"right\" width=\"38%\" />\n\nThis server has **no LLM inside it**. The client calling it already is one.\n\nSo `remember_chapter` does not run an extraction pass over your prose — it asks your assistant to hand over what it understood while reading. That single decision is why there is:\n\n- **no API key** to obtain, paste, rotate or leak\n- **no account**, no sign-up, no rate limit\n- **no cost** to anyone, at any usage level\n- **no network call**, ever\n\n<br clear=\"right\" />\n\n## Privacy\n\nEverything lives in plain files under `~/.longform-memory/<project>/`:\n\n```\n~/.longform-memory/my-novel/\n├── events.jsonl        # append-only: summaries, entity states, threads\n└── chapters/\n    ├── 000001.txt      # your prose, only if you passed `text`\n    └── 000002.txt\n```\n\nReadable, greppable, `rm`-able, and yours. **No telemetry.** The only outbound request this package can ever make is to an embedding endpoint you configure yourself — and if you configure none, the code path never runs.\n\nWhy an append-only log rather than SQLite: this server is launched by `npx` inside someone else's editor, and a native module that fails to build there is not a degraded experience — it is a server that never starts, and you would never find out why.\n\n---\n\n## Configuration\n\n| variable | default | meaning |\n| --- | --- | --- |\n| `LONGFORM_MEMORY_PROJECT` | `default` | Which document. One entry per book, or pass `project` per call. |\n| `LONGFORM_MEMORY_HOME` | `~/.longform-memory` | Where memory is stored. |\n| `LONGFORM_MEMORY_EMBED_URL` | — | OpenAI-compatible `/embeddings` endpoint. **Optional.** |\n| `LONGFORM_MEMORY_EMBED_KEY` | — | Your key, for your endpoint. |\n| `LONGFORM_MEMORY_EMBED_MODEL` | — | e.g. `text-embedding-3-small`. |\n\nAll three embedding variables must be set together — a half-configured endpoint that quietly does nothing is worse than no feature. `search_memory` always states which mode actually ran.\n\n---\n\n## What it deliberately does not do\n\n- **No semantic contradiction detection.** \"Three towers in chapter 4, four in chapter 60\" needs a reader. A detector guessing at that produces a panel full of false alarms, and a panel that cries wolf is a panel nobody reads. `check_continuity` covers the part a model is bad at — remembering exactly, across a thousand chapters.\n- **No writing.** It does not generate, rewrite or critique prose.\n- **No cloud sync.** One machine, one directory.\n- **No automatic extraction.** If your client does not send entity states and threads, you get summary storage — and the reply tells you so rather than pretending.\n\n---\n\n## Use it as a library\n\nThe server is a thin adapter; everything is callable directly.\n\n```ts\nimport { recallContext, rememberChapter } from 'longform-memory-mcp';\n\nawait rememberChapter({\n  project: 'my-novel',\n  chapter: 12,\n  summary: 'Ines burns the letter and lies to her brother about it.',\n  entities: [{ name: 'Ines', state: 'lying to Tomas', note: 'first outright lie' }],\n  threads: [{ summary: 'what the letter actually said', deadlineChapter: 30 }],\n});\n\nconst { recall } = await recallContext({ project: 'my-novel', chapter: 13 });\nconsole.log(recall.text);       // paste-ready block\nconsole.log(recall.sections);   // { entity: { usedTokens, kept, dropped }, … }\n```\n\nThe budgeting core is published separately, with no dependencies at all:\n**[`longform-memory`](https://github.com/emberspun/longform-memory)** (npm) · **[`longform-memory`](https://github.com/emberspun/longform-memory-python)** (PyPI).\n\n---\n\n## Development\n\n```bash\nnpm install\nnpm test          # 54 tests, including a real stdio protocol round-trip\nnpm run build\n```\n\nThe test suite spawns the built binary and speaks JSON-RPC to it, because the failures that only appear there are the expensive ones — a non-executable bin, a schema the SDK rejects, a stray write to stdout corrupting the transport.\n\n## License\n\nMIT © Emberspun. Built for [Emberspun, an AI book writer for self-publishers](https://emberspun.com) — this memory layer runs there on every chapter.\n\n## Claude Skill\n\nTool descriptions tell a model what a call returns. They cannot tell it that\nrecalling *after* drafting is useless, or that a `[T3]` from one chapter must not\nbe quoted at another. That is sequencing and judgement, and it lives in a skill:\n\n**[emberspun/longform-memory-skill](https://github.com/emberspun/longform-memory-skill)**\n\n```bash\ngit clone https://github.com/emberspun/longform-memory-skill.git \\\n  ~/.claude/skills/longform-writing\n```\n\nKept in its own repository so there is exactly one copy — the same text in two\nplaces drifts, and the stale one is the one somebody reads.\n","readmeFilename":"README.md"}