Threadkeep Memory (threadkeep-mcp)
Search and read the AI chats you saved with Threadkeep. Local, read-only, no network.
เอกสาร
threadkeep-mcp
A local MCP server that lets Claude Desktop, Cursor, VS Code and other MCP apps search and read the chats you saved with the Threadkeep browser extension. Made by SKILLMERC.
It reads the memory folder Threadkeep writes (Markdown files plus .threadkeep/index.json). It is read-only, talks only over stdio, and opens no network connection.
Status
0.3.0: adds threadkeep-mcp import, a separate command that copies the coding sessions Claude Code, Codex, Cursor and opencode keep on your computer into your Threadkeep folder (see "Import coding sessions"). The MCP server is unchanged: six read-only tools over one memory folder. 0.2.0 added the Threadkeep 3.0 projects: list_projects, get_project and get_note, and a project filter on search_chats and list_chats. It reads 2.x folders as before. What changed in each version: CHANGELOG.md in the GitHub repo.
Privacy
- The MCP server reads only the files listed in the folder's
.threadkeep/index.json(chats, and for projects each Brief.md and the notes listed there). It never changes, moves or deletes a file. It sends nothing to SKILLMERC or anyone else: no telemetry, no update check. - The import command (0.3.0) runs only when you type it. It reads the session files of the one tool you name, writes import files into your Threadkeep folder's inbox (or the folder you give with
--out), makes no network call and never reads sign-in files. Details under "Import coding sessions". - If you start it with
npx, npx downloads it from the npm registry (npmjs.com) the first time and may check there for a newer copy when it starts. The Claude Desktop bundle needs no download after you install it. - The AI app you connect it to decides what it does with the text it reads. That may include sending it to the app's AI provider under your account. Read that app's privacy policy.
Tools
All six are read-only (readOnlyHint: true, openWorldHint: false). Each tool description tells the AI app that chat and note text is quoted material, not instructions. A saved chat or note can still hold text that reads like instructions, so keep your AI app's tool approval prompts on.
search_chats { query, site?, tag?, folder?, project?, since?, until?, limit? }: every word must match (Chinese, Japanese and Korean text is matched by character pairs, as on the Threadkeep library page). Chats with the words in the title come first, then the best match, then the newest. Returns id, title, site, updated, folder, file and up to 3 snippets of about 300 characters per chat.limitdefault 10, max 25. No match gives a plain "No saved chats match ..." message.get_chat { id, offset?, max_chars? }: the chat's front matter fields (title, site, url, created, updated, messages, folder, tags, pinned) and its Markdown.max_charsdefault 20,000, max 50,000; when there is more,next_offsetsays where to go on.list_chats { site?, folder?, tag?, project?, since?, until?, limit?, cursor? }: newest first.limitdefault 25, max 100;next_cursorgives the next page.list_projects { limit? }: the Threadkeep 3.0 projects, newest first: id, name, chats, updated, brief_words, sites.limitdefault 25, max 100. A folder from Threadkeep 2.x has no projects: the answer is an empty list and "This folder has no projects yet. Update Threadkeep to 3.0."get_project { id_or_name, offset?, max_chars? }: the project's brief (Brief.md front matter fields and Markdown, sliced likeget_chatwithnext_offset), its chats (id, title, site, updated, file; read them withget_chat) and its notes (file and size). The name must match exactly, or in any case when only one project has it; when more than one project matches, the answer lists them and asks for the id.get_note { project, file, offset?, max_chars? }: one note from the project'snotes/folder, as plain text. Only.mdand.txtnotes that index.json lists for that project, each at most 5 MB.
folder matches that library folder and its subfolders ("" means Unfiled). project takes a project id or its name. since and until take a date (2026-11-21, UTC, until includes the whole day) or a full ISO time. No answer is longer than 60,000 characters.
Staying current
The search index is built in memory at start from the files listed in index.json. Before each call the server checks index.json; when the extension has written a new one, the index is rebuilt without a restart, and only chats whose file changed are read again. If index.json is caught half-written, the previous index keeps serving and the next call tries again.
Set up
The npx setups below need Node 20 or newer. The Claude Desktop bundle (below) needs no Node. It is not out yet: it will go on skillmerc.com.
Use your own memory folder in place of the example path: the folder you chose in Threadkeep, the one that holds .threadkeep/. In JSON on Windows, double each backslash: "C:\\Users\\you\\Documents\\Threadkeep Memory".
Claude Desktop: Settings, Developer, Edit Config opens claude_desktop_config.json. Add this, save, then quit and reopen Claude Desktop:
{ "mcpServers": { "threadkeep": { "command": "npx", "args": ["-y", "threadkeep-mcp@0.3", "--dir", "/Users/you/Documents/Threadkeep Memory"] } } }
Cursor: the same mcpServers block in ~/.cursor/mcp.json (every project) or .cursor/mcp.json (one project).
VS Code (GitHub Copilot): .mcp.json at the root of your project (one project) or ~/.copilot/mcp-config.json (every project), with "type": "stdio":
{ "mcpServers": { "threadkeep": { "type": "stdio", "command": "npx", "args": ["-y", "threadkeep-mcp@0.3", "--dir", "/Users/you/Documents/Threadkeep Memory"], "tools": ["*"] } } }
Then ask your AI app, for example: "Search my saved chats for sourdough." If the app says the server failed, its MCP log shows the reason this server gave, for example "no .threadkeep/index.json in ...".
To check the folder from a terminal: npx -y threadkeep-mcp@0.3 --dir "<folder>" prints how many chats it serves (on stderr), then waits for an AI app. Press Ctrl+C to stop.
Claude Desktop bundle (.mcpb)
manifest.json turns this package into an MCP Bundle: one file that Claude Desktop installs with a double click (or Settings, Extensions, Advanced settings, Install Extension). Claude Desktop ships its own Node, so the user needs no Node or npm. On install it asks for one setting, Threadkeep memory folder (a folder picker, user_config.memory_folder), and starts node bin/threadkeep-mcp.js --dir <that folder>. Display name "Threadkeep Memory", author SKILLMERC, icon icon.png (the Threadkeep store icon).
Build it:
node scripts/bundle.mjs # writes dist/threadkeep-mcp-<version>.mcpb and .mcpb.sha256
The script fails (exit 1) unless every check passes: manifest.json matches package.json and the tools the server registers, the bundle holds only production dependencies (no tests, fixtures or scripts), and the unpacked bundle starts with the command in manifest.json and lists the six read-only tools. It writes the SHA-256 of the bundle next to it.
Where it goes: skillmerc.com only (the Threadkeep help page), with the SHA-256 shown next to the link. The bundle is unsigned on purpose: today Claude Desktop refuses signed bundles (modelcontextprotocol/mcpb issue 278), so check the SHA-256 instead.
Import coding sessions (0.3.0)
threadkeep-mcp import is a separate command, not part of the MCP server. It reads the coding sessions a tool keeps on your computer and writes one import file per session into your Threadkeep folder's inbox (.threadkeep/inbox/). Then open the Threadkeep library and press Review and import.
npx threadkeep-mcp import <tool> --dir <Threadkeep folder> [--project "<name>"]
[--folder "<name>"|--no-folder] [--repo <path>|all]
[--since 7d|2026-11-01] [--session <id>] [--out <folder>]
[--dry-run] [--tool-notes] [--file <chat.md>]
- Tools:
claude-code,codex,cursor,opencode. Each reads only the files listed under its name below. Step by step: https://skillmerc.com/threadkeep/help/import-coding-sessions/ - By default it takes the sessions from the repo you are in, from the last 7 days, and puts them in a folder named after the tool inside the project you name.
- Where it writes:
<Threadkeep folder>/.threadkeep/inbox/, one file per session. The Threadkeep folder is~/Documents/Threadkeepunless you pass--dir <folder>, and it must hold.threadkeep/index.json(turn on the memory folder in Threadkeep first).--out <folder>writes the files to any folder instead. In Firefox, which has no folder access, use--outand pick the files on the library page with "Import coding sessions...". Files are written with mode 600 (only your user can read them, on Mac and Linux). --dry-runreads and counts but writes nothing: it prints the sessions found, the words kept, the secrets removed by kind, and one line per session (file name, title, messages, words), then where the files would go.--file <chat.md>(Cursor only): import a chat you saved with Cursor's own Export Chat. The file is read whatever its date or folder.--folder "<name>"puts the sessions in that folder of the project (--folder repouses the repo name);--no-folderputs them in the project itself.--since 30dor--since 2026-11-01goes further back,--repo alltakes every repo,--session <id>one session.--tool-notesends each answer with the names of the tools it used (off by default).- Node: Claude Code, Codex and Cursor need Node 20 or newer; opencode needs Node 22.13 or newer. Compressed Codex sessions need Node 22.15 or newer.
- Versions the readers were checked against: Claude Code 2.1.332, Codex 0.172.0, opencode 1.19.6 (
docs/FORMAT-CHECK-2026-12.md). opencode must be 1.2 or newer: older versions keep sessions as JSON files, which the command does not read. - It keeps your messages and the AI's answers only. Before anything is written it removes the secrets it recognises: API keys, tokens, private keys, auth headers, secret values in
.envlines and key-like assignments (the name stays:NAME=[secret removed]), passwords in links, and other values with a secret-looking name. Each becomes[secret removed], and the command prints how many of each kind it removed. The redaction is careful but not perfect: open a file before you share it with anyone. - It makes no network call, never reads credential files, and never changes the tools' own files. The MCP server never loads this command's code.
- Exit codes: 0 done (also after
--dry-runand--help), 2 nothing found (no sessions in the time window, or the tool's folder is not on this computer), 3 bad arguments (including a--dirthat is not a Threadkeep folder), 4 format changed (more than half of the sessions could not be read; with fewer, the rest is imported and the count of unreadable ones is printed), 5 cannot write (no Threadkeep folder found, or the write failed). Every line goes to stderr.
Claude Code
- Reads:
~/.claude/projects/<folder>/<session>.jsonl, one file per session, line by line. Nothing else under~/.claude. - Keeps: what you typed (pictures become
[Picture], a pasted block becomes[Pasted text, about N words, not imported]) and the text of Claude's answers, code blocks included. - Leaves out: tool calls and their results (file contents, command output), thinking, turns Claude Code adds itself (
<command-name>,<local-command-stdout>,<system-reminder>,<task-notification>and the like), meta and summary turns, helper (sidechain) transcripts, memory notes, and the request records that hold the system prompt and tool definitions. - Title: the title Claude Code gave the session (or the one you set), else your first line, cut to 80 characters.
- Never opened:
.credentials.json,settings.json,history.jsonl, or any file in a session's own subfolder. A session file over 200 MB is skipped. - Claude Code deletes its local transcripts after 30 days by default (
cleanupPeriodDays), so import before then.
Codex
- Reads:
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonland~/.codex/archived_sessions/, line by line;~/.codex/session_index.jsonl(session names only); and from~/.codex/external_agent_session_imports.jsononly the ids of sessions Codex copied in from other tools, which are skipped so nothing is imported twice. - Both rollout layouts are read: the current one (records with
timestamp,type,payload) and the older one without that wrapper. - Keeps: what you typed (pictures become
[Picture]) and the text of Codex's answers. Leaves out: the copies of the same text in event records, developer and system turns, reasoning, tool calls and their output, web searches, and turns Codex adds itself (<environment_context>,<user_instructions>, AGENTS.md instructions and the like). - Compressed rollouts (
.jsonl.zst) are read on Node 22.15 or newer; on older Node they are skipped and counted in one line. - Title: the session name Codex shows, else your first line, cut to 80 characters.
- Never opened:
auth.json,config.toml,installation_id, the SQLite and log files,memories/,shell_snapshots/. No Codex or OpenAI service is called.
Cursor (now Grok Build)
- Reads only two kinds of file. The agent transcripts Cursor itself hands to hooks:
~/.cursor/projects/<folder>/agent-transcripts/<id>/<id>.jsonl. And a chat you saved with Cursor's own Export Chat, given with--file <chat.md>(it is read whatever its date or folder). - Never opened: Cursor's internal chat database (
state.vscdb),mcp.json,cli-config.json, or anything else under~/.cursor. - Keeps: what you typed (the query only, not the time stamp or files Cursor attaches) and the text of the answers. Leaves out: tool calls and their inputs.
- The project folder comes from the transcript's folder name, matched against folders that exist on this computer (on Windows the name must start with the drive letter, as in
c-Users-you-code-app); when none matches, use--repo all. - A transcript or export in a layout this version does not know is not guessed at: it counts as unreadable, and the command says "Cursor changed its session format" (exit 4 when more than half could not be read).
opencode
- Reads:
~/.local/share/opencode/opencode.db, opened read-only, and only itsproject,session,messageandparttables. Neverauth.jsonor any account table. - Needs Node 22.13 or newer (it uses Node's built-in SQLite). Claude Code, Codex and Cursor work on Node 20.
- Keeps: the text parts of your messages and of the answers. Leaves out: reasoning, tool calls and output, patches, attached files, compaction summaries, and sub-sessions.
- Title: the session's title in opencode. The project folder: the session's folder, else the project's.
- Needs opencode 1.2 or newer, which keeps sessions in this database. Older versions keep them as JSON files, which the command does not read.
- If the database does not have the tables and columns this version knows, the command reads nothing and stops with "opencode changed its session format" (exit 4). A session whose messages sit only in opencode's newer
session_messagetable is counted as unreadable, not imported empty.
Names
Made by SKILLMERC. Threadkeep is an independent tool by SKILLMERC. It is not made by, endorsed by or affiliated with OpenAI, Anthropic, Google, DeepSeek, SpaceXSI, Anysphere, Anomaly or the maker of any other site or tool it works with. ChatGPT and Codex are trademarks of OpenAI. Claude and Claude Code are trademarks of Anthropic, PBC. Cursor is a trademark of Anysphere, Inc. Grok and Grok Build are trademarks of SpaceX Super Intelligence LLC (SpaceXSI). Gemini is a trademark of Google LLC. Use of these trademarks is subject to Google Permissions. opencode is a project of Anomaly.
What it refuses
- To start, unless
--diris a folder holding.threadkeep/index.jsonwith"format": "threadkeep-memory"and"version": 1. So it cannot be pointed at a home folder by mistake. The reason goes to stderr and the exit code is non-zero. - To serve any file not listed in the
chatsof index.json (or as a project's Brief.md or listed note), any chat or brief that is not.md, any note that is not.mdor.txt, any chat file over 25 MB, Brief.md over 1 MB or note over 5 MB, and any path that resolves outside the folder:..segments, absolute paths, drive letters, backslashes, and symlinks (file or folder) that lead out. The check isrealpathpluspath.relative, never a string prefix, so a sibling such as<folder>-oldis outside too. - To read a file without checking it again first. Every read runs the path check again (the folder can change while the server runs), then opens the file without following a final symlink and confirms the open file is the one that was checked.
- To write to stdout anything but JSON-RPC. Logs, warnings,
--helpand--versiongo to stderr, andconsole.*calls are routed to stderr.
Limits
- The index is built before the server answers the AI app: about 5 s for 2,000 chats of 40 KB on a Mac, roughly 25 s for 10,000. A very large folder can pass an app's start timeout.
- If
--diris a symlink and it is pointed at another folder while the server runs, the next reload serves the new folder (it still needs a valid index.json).
Development
Node 20 or newer. Runtime dependencies: @modelcontextprotocol/sdk and zod (the schema library the SDK uses for tool inputs), both pinned to exact versions.
npm install
npm test
The fixture lives in test/fixtures/memory (rebuild with node test/fixtures/make-fixture.mjs). Symlinks, the oversize file and the sibling folder are made at test time in a temp copy, so the repo checks out cleanly on Windows.
Tests
npm testrunstest/run.mjs: everytest/*.test.mjswithtest/no-network.mjsinNODE_OPTIONS, so the test runner, each test file and every server the tests start have the network blocked.test/preload.test.mjsfails if the suite is run any other way. Extra arguments go tonode --test:npm test -- --test-name-pattern=search.- What the suite covers: path safety, index loading, the command line, the SDK stdio client, raw stdout purity (only JSON-RPC on stdout, a stray
console.loggoes to stderr), the six tools (projects:test/projects.test.mjs), reload onindex.jsonchange, size caps, and that the site ids in the tool descriptions match the extension writer (../threadkeep/src/memory/format.js; skipped when that file is not next to this package). npm run smoke:inspectorcallstools/listand onesearch_chatsagainst the fixture through the MCP Inspector command line (pinned@modelcontextprotocol/inspector@2.17.0, fetched by npx, so it needs the network and Node 22.23.4 or newer). CI runs it on Node 22.- CI:
.github/workflows/ci.ymlrunsnpm ciandnpm teston every push tomainand every pull request, on Linux, macOS and Windows with Node 20, 22 and 24. It runs the tests withCIset to empty, because the extension source the contract test reads is not in this repo (the test skips without it, but fails whenCIis set).
Release
0.1.0 and 0.2.0 were published by hand from a clean clone of this repo: npm ci, npm test, npm publish --access public, with the package owner's second factor. So they have no provenance statement. Each published version has a tag v<version> on the commit it was built from.
.github/workflows/publish.yml is ready for later versions: when a GitHub release v<version> is published it runs npm ci, npm test, then npm publish --provenance --access public through npm trusted publishing, so no npm token is stored anywhere. It runs in the GitHub environment npm, which only main and v* tags may use. It is not connected on npm yet, so no version has come from it so far.
npm also documents staged publishing (https://docs.npmjs.com/staged-publishing): npm stage publish on a package that does not exist yet creates it with a public placeholder version 0.0.0-stage, and the real version goes live only after a maintainer approves it with the second factor. We do not use it. The first publish of this package still left a placeholder 0.0.0-stage on the package page, 76 seconds before 0.1.0. It holds no code and is deprecated with "Placeholder, use 0.1.0 or later". Install 0.1.0 or later.
Licence
MIT. Made by SKILLMERC.
ChatGPT, Codex, Claude, Claude Code, Gemini, NotebookLM, DeepSeek, Grok, Cursor and Visual Studio Code are trademarks of their owners. threadkeep-mcp is not made, endorsed or supported by any of them.