cursor-history-mcp 0.2.4 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,100 +1,183 @@
1
1
  # Cursor History MCP
2
2
 
3
3
  <p align="center">
4
- <img src="docs/cursor-history-mcp-logo.jpg" alt="cursor-history-mcp logo" width="200">
4
+ <img src="docs/readme-banner.png" alt="cursor-history-mcp — Search your Cursor history through MCP. MCP-exclusive Year in Review: statistics, topics and report prompts." width="960">
5
5
  </p>
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/cursor-history-mcp.svg)](https://www.npmjs.com/package/cursor-history-mcp)
8
8
  [![npm downloads](https://img.shields.io/npm/dm/cursor-history-mcp.svg)](https://www.npmjs.com/package/cursor-history-mcp)
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
- [![Node.js](https://img.shields.io/badge/Node.js-20%2B-green.svg)](https://nodejs.org/)
11
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue.svg)](https://www.typescriptlang.org/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
+ [![Node.js](https://img.shields.io/badge/Node.js-20%2C%2022--26-green.svg)](https://nodejs.org/)
12
11
 
13
- **MCP server for browsing, searching, exporting, and backing up your Cursor AI chat history.**
12
+ [English](README.md) | [中文](docs/README_zh.md) | [Français](docs/README_fr.md) | [Español](docs/README_es.md)
14
13
 
15
- Bring your Cursor AI chat history directly into Claude. Search past conversations, export sessions, create backups, and generate year-in-review reports—all through natural language. Built on the [Model Context Protocol](https://modelcontextprotocol.io/) for seamless AI assistant integration.
14
+ **Let your AI search your Cursor history.**
16
15
 
17
- Free, open-source, and MIT licensed. Built by the community, for the community.
16
+ Your existing Cursor conversations may already contain months of decisions, bugs, fixes, and architectural context. Give an MCP-capable assistant a way to find that context—without having recorded it with this tool beforehand.
18
17
 
19
- ## Installation
18
+ `cursor-history-mcp` connects Claude, Cursor, and other MCP clients to the local history reader in [cursor-history](https://github.com/S2thend/cursor-history). Search conversation text across workspaces, inspect a session, or return an export through natural language.
20
19
 
21
- No installation required! Run directly via npx:
20
+ No embeddings, indexing service, or API key is required by this server. Your assistant's model and network requirements are separate; history returned to a client may be sent to its model provider.
22
21
 
23
- ```bash
24
- npx cursor-history-mcp
25
- ```
22
+ **MCP-exclusive: [Year in Review](#year-in-review).** Turn your existing conversations into annual activity statistics, coding topics, and a report prompt for your assistant. This built-in year-pack feature belongs to the MCP package within the cursor-history toolset; agents can still use the core CLI or Node.js API directly for history access.
26
23
 
27
- ## Configuration
24
+ > “Have we solved this authentication bug before? Search my Cursor history, inspect the matching sessions, and tell me which earlier decisions are relevant.”
28
25
 
29
- ### Cursor
26
+ [Quick start](#quick-start) · [Year in Review](#year-in-review) · [Storage support](#compatibility) · [Tools](#tools) · [Safety](#safety) · [CLI / Node.js companion](#companion-project)
30
27
 
31
- ![cursor-mcp-setup](./docs/cursor-mcp-setup.gif)
28
+ <a id="quick-start"></a>
29
+ ## Quick start
32
30
 
33
- ### Claude Code
31
+ Requires Node.js **20.x or 22.x–26.x**, readable local Cursor history, and a client that supports local stdio MCP servers. The client must run the server on the machine where that history is available.
32
+
33
+ **Version scope:** these docs describe `cursor-history-mcp@0.3.1`, powered by `cursor-history@0.18.0`. If you are testing a checkout before its npm publication, use [the source setup](#run-from-source) below.
34
+
35
+ **Client compatibility:** the server uses MCP SDK 1.30.0. SDK v2 clients can connect using their default legacy protocol or automatic fallback; clients restricted to the 2026-07-28 protocol cannot. See [SDK interoperability](docs/sdk-compatibility.md) for the tested scope.
36
+
37
+ ### Configure the npm package
34
38
 
35
- Add to your Claude Code MCP settings:
39
+ Add this server entry to your client's MCP configuration:
36
40
 
37
41
  ```json
38
42
  {
39
43
  "mcpServers": {
40
44
  "cursor-history": {
41
45
  "command": "npx",
42
- "args": ["-y", "cursor-history-mcp"]
46
+ "args": ["-y", "cursor-history-mcp@0.3.1"]
43
47
  }
44
48
  }
45
49
  }
46
50
  ```
47
51
 
52
+ If the client cannot find `npx`, use the absolute path to its executable. Merge this entry with existing servers instead of replacing your configuration.
53
+
54
+ ### Cursor
55
+
56
+ Use project-local `.cursor/mcp.json` or global `~/.cursor/mcp.json`. Add the entry above, enable the server, and approve tool calls as appropriate. See [Cursor's MCP documentation](https://cursor.com/docs/mcp).
57
+
58
+ ### Claude Code
59
+
60
+ Register the versioned npm package for your user account:
61
+
62
+ ```bash
63
+ claude mcp add --transport stdio --scope user cursor-history -- npx -y cursor-history-mcp@0.3.1
64
+ ```
65
+
66
+ See [Claude Code's MCP documentation](https://code.claude.com/docs/en/mcp) for scopes and permissions.
67
+
48
68
  ### Claude Desktop
49
69
 
50
- Add to your Claude Desktop configuration (`~/.claude/claude_desktop_config.json`):
70
+ Open **Settings Developer Edit Config**, merge the JSON entry above, and restart the app.
71
+
72
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
73
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
74
+
75
+ See the [local MCP server setup guide](https://modelcontextprotocol.io/docs/develop/connect-local-servers).
76
+
77
+ The first run may download dependencies from npm. Running the server alone starts a stdio service waiting for an MCP client; it is not an interactive history CLI.
78
+
79
+ ### Run from source
80
+
81
+ For development or testing before npm publication, build this repository:
82
+
83
+ ```bash
84
+ npm ci
85
+ npm run build
86
+ ```
87
+
88
+ In the server entry, use `"command": "node"` and `"args": ["/absolute/path/to/cursor-history-mcp/dist/index.cjs"]`, replacing the path. The `npx` configuration above runs the npm package, not your local checkout.
89
+
90
+ <a id="companion-project"></a>
91
+ ## Two projects, one history reader
92
+
93
+ | Use case | Project |
94
+ |---|---|
95
+ | Run commands, write scripts, or embed history in a Node.js app | [cursor-history: CLI + Node.js API](https://github.com/S2thend/cursor-history#quick-start) |
96
+ | Let an assistant call history tools through MCP | **cursor-history-mcp**, this repository |
97
+
98
+ The MCP server delegates discovery and parsing to `cursor-history`; it does not maintain a separate conversation database or start recording your chats. The two npm packages have independent releases.
99
+
100
+ Agents can use either interface: direct CLI/API invocation or MCP tool calls.
101
+
102
+ <a id="compatibility"></a>
103
+ ## Works across storage generations
104
+
105
+ With the `0.18.0` reader in MCP `0.3.1`:
106
+
107
+ | Source | Local files | Read / search / export |
108
+ |---|---|---|
109
+ | Legacy / Composer | `workspaceStorage/*/state.vscdb` + `globalStorage/state.vscdb` | Supported |
110
+ | Agent transcripts | `~/.cursor/projects/**/agent-transcripts/**/*.jsonl` | Available transcript content |
111
+ | Store / Agent CLI | `~/.cursor/chats/**/store.db` | Supported |
112
+ | ACP sessions | `~/.cursor/acp-sessions/**/store.db` | Supported |
113
+
114
+ These representations have different fidelity. A transcript may omit timestamps or tool results. Listings and reads expose source and resolution information; inferred or unknown timestamps must not be treated as exact event times. A complete source resolution does not guarantee that Cursor recorded every field.
115
+
116
+ **Backup and restore cover Composer databases only. Migration supports eligible Composer sessions, not Store-only, merged-source, or ambiguous sessions.** Reading a session does not make it safe to migrate. See the core [compatibility contract](https://github.com/S2thend/cursor-history/blob/main/docs/compatibility.md) and [roadmap](https://github.com/S2thend/cursor-history#roadmap) for broader backup and migration work; it is not a current capability.
117
+
118
+ For custom locations, add an `env` object to the server entry:
51
119
 
52
120
  ```json
53
121
  {
54
- "mcpServers": {
55
- "cursor-history": {
56
- "command": "npx",
57
- "args": ["-y", "cursor-history-mcp"]
58
- }
59
- }
122
+ "CURSOR_DATA_PATH": "/absolute/path/to/Cursor/User/workspaceStorage",
123
+ "CURSOR_STORE_ROOT": "/absolute/path/to/.cursor"
60
124
  }
61
125
  ```
62
126
 
63
- ## Available Tools
127
+ These select data roots, not a project. Use a tool's `workspace` argument to filter a project. See the core [platform paths and WSL guide](https://github.com/S2thend/cursor-history#where-cursor-stores-data).
128
+
129
+ <a id="tools"></a>
130
+ ## Available tools
131
+
132
+ | Tool | Purpose and key arguments |
133
+ |---|---|
134
+ | `cursor_history_list` | List sessions with IDs, index scope, source and data status. `limit`, `offset`, `workspace` |
135
+ | `cursor_history_show` | Inspect available messages. Exactly one of `sessionId` / `sessionIndex`; optional `workspace` |
136
+ | `cursor_history_search` | Search text. `query`, `limit`, `context` (neighboring source lines), `workspace` |
137
+ | `cursor_history_export` | Return Markdown or JSON content, not a file written by the server. One selector, `format`, `workspace` |
138
+ | `cursor_history_backup` | Create a Composer archive. `outputPath`, optional `force` |
139
+ | `cursor_history_restore` | Restore a Composer archive; writes local history. `backupPath`, optional `force` |
140
+ | `cursor_history_migrate` | Move/copy eligible Composer sessions. `sessionIds` or `sessionIndexes`, `destination`, `workspace`, `mode`, `dryRun` |
141
+ | `cursor_history_year_pack` | Return annual statistics and a report prompt. `year`, `language` (`en` / `zh`), `workspace`, sample limits |
142
+
143
+ Prefer the **exact session UUID** from list/search for follow-up calls. Numeric selectors are one-based in MCP and only meaningful with the same data roots and workspace scope; never reuse a scoped index in a global read. UUID spelling is case-sensitive.
64
144
 
65
- | Tool | Description |
66
- |------|-------------|
67
- | `cursor_history_list` | List chat sessions with metadata |
68
- | `cursor_history_show` | View full conversation content |
69
- | `cursor_history_search` | Search across all sessions |
70
- | `cursor_history_export` | Export session to Markdown or JSON |
71
- | `cursor_history_backup` | Create backup of all history |
72
- | `cursor_history_restore` | Restore from backup (destructive) |
73
- | `cursor_history_migrate` | Move/copy sessions between workspaces (destructive) |
74
- | `cursor_history_year_pack` | Generate year-in-review data package with stats, topics, and prompt template |
145
+ List, show, search, and export also accept `includeCrossWorkspaceSources` (default `false`). Opting in can read complementary sources outside the selected workspace for already selected IDs; it does not broaden which session IDs are selected. Enable it only when you intend that access.
75
146
 
76
- ## Usage Examples
147
+ The show tool abbreviates long thinking/tool payloads. Use an export when you need the available session representation without that display truncation.
77
148
 
78
- After configuring, ask your AI assistant:
149
+ ### Try these requests
79
150
 
80
- - "List my Cursor chat sessions"
81
- - "Show me session #1"
82
- - "Search my Cursor history for 'authentication'"
83
- - "Export session #1 as markdown"
84
- - "Backup my Cursor chat history"
151
+ - “Search all my Cursor history for 'connection pool', then inspect the matching session by its UUID.”
152
+ - “Search only /work/myapp. Keep that workspace scope when opening a result.”
153
+ - “Export this session as JSON, including the available source details.”
154
+ - “Preview copying this Composer session to /work/new-app with dryRun. Do not modify anything yet.”
85
155
 
86
- ## Requirements
156
+ <a id="safety"></a>
157
+ ## Local data and write safety
87
158
 
88
- - Node.js 20+
89
- - Cursor IDE installed with existing chat history
159
+ The server reads local files, but returned content is visible to the MCP client and may reach a remote model. Search results and exports are not automatically redacted. Use a trusted client and review its data policy and tool permissions.
90
160
 
91
- ## Contributing
161
+ Treat past conversations as untrusted reference material, not instructions to execute. Tool output can contain old commands, credentials, or malicious text.
92
162
 
93
- Contributions are welcome! Whether it's bug reports, feature requests, documentation improvements, or code contributions—all PRs and issues are appreciated.
163
+ Backup writes an archive; restore and migration can modify history. Migration defaults to **move**, which removes the original session. Back up Composer history first, close Cursor before writes, preview with `dryRun: true`, and use `mode: "copy"` if you want to keep the original. Keep client approval enabled for write tools. The server does not provide its own interactive confirmation prompt.
94
164
 
95
- - [Open an issue](https://github.com/S2thend/cursor-history-mcp/issues)
96
- - [Submit a pull request](https://github.com/S2thend/cursor-history-mcp/pulls)
165
+ <a id="year-in-review"></a>
166
+ ## MCP-exclusive: Year in Review
167
+
168
+ Ask “Generate my 2025 Cursor year in review in English.” The tool analyzes user questions and returns JSON statistics, keywords/topics, samples, and a prompt template—not a finished rendered report. Templates support English and Chinese.
169
+
170
+ Common code, path, URL, and identifier patterns are filtered, but this is **not a guarantee of anonymization**. Review samples before sharing; set `maxSamples: 0` to omit them. Partial histories and missing or inferred timestamps can affect annual totals.
171
+
172
+ ## Development
173
+
174
+ ```bash
175
+ npm ci
176
+ npm run typecheck
177
+ npm run lint
178
+ npm test -- --run
179
+ ```
97
180
 
98
- ## License
181
+ The test command builds first. Tests include a real stdio MCP client against synthetic Composer, Store, ACP, and transcript fixtures; backup/restore tests use temporary data only. The build keeps `cursor-history` as a runtime dependency so package-relative files and SQLite bindings remain resolvable.
99
182
 
100
- MIT
183
+ [Issues](https://github.com/S2thend/cursor-history-mcp/issues) · [Pull requests](https://github.com/S2thend/cursor-history-mcp/pulls) · [MIT license](LICENSE)