cursor-history-mcp 0.2.4 → 0.3.0
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 +133 -52
- package/dist/index.cjs +2208 -8188
- package/dist/index.cjs.map +1 -1
- package/docs/README_es.md +145 -0
- package/docs/README_fr.md +145 -0
- package/docs/README_zh.md +145 -0
- package/docs/cursor-history-mcp-logo.jpg +0 -0
- package/docs/cursor-mcp-setup.gif +0 -0
- package/docs/publishing.md +64 -0
- package/docs/readme-banner-prompt.md +53 -0
- package/docs/readme-banner.png +0 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,100 +1,181 @@
|
|
|
1
1
|
# Cursor History MCP
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="docs/
|
|
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
|
[](https://www.npmjs.com/package/cursor-history-mcp)
|
|
8
8
|
[](https://www.npmjs.com/package/cursor-history-mcp)
|
|
9
|
-
[](
|
|
10
|
-
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://nodejs.org/)
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
[English](README.md) | [中文](docs/README_zh.md) | [Français](docs/README_fr.md) | [Español](docs/README_es.md)
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
**Let your AI search your Cursor history.**
|
|
16
15
|
|
|
17
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
28
|
+
<a id="quick-start"></a>
|
|
29
|
+
## Quick start
|
|
32
30
|
|
|
33
|
-
|
|
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.
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
**Version scope:** these docs describe `cursor-history-mcp@0.3.0`, 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
|
+
### Configure the npm package
|
|
36
|
+
|
|
37
|
+
Add this server entry to your client's MCP configuration:
|
|
36
38
|
|
|
37
39
|
```json
|
|
38
40
|
{
|
|
39
41
|
"mcpServers": {
|
|
40
42
|
"cursor-history": {
|
|
41
43
|
"command": "npx",
|
|
42
|
-
"args": ["-y", "cursor-history-mcp"]
|
|
44
|
+
"args": ["-y", "cursor-history-mcp@0.3.0"]
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
If the client cannot find `npx`, use the absolute path to its executable. Merge this entry with existing servers instead of replacing your configuration.
|
|
51
|
+
|
|
52
|
+
### Cursor
|
|
53
|
+
|
|
54
|
+
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).
|
|
55
|
+
|
|
56
|
+
### Claude Code
|
|
57
|
+
|
|
58
|
+
Register the versioned npm package for your user account:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add --transport stdio --scope user cursor-history -- npx -y cursor-history-mcp@0.3.0
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
See [Claude Code's MCP documentation](https://code.claude.com/docs/en/mcp) for scopes and permissions.
|
|
65
|
+
|
|
48
66
|
### Claude Desktop
|
|
49
67
|
|
|
50
|
-
|
|
68
|
+
Open **Settings → Developer → Edit Config**, merge the JSON entry above, and restart the app.
|
|
69
|
+
|
|
70
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
71
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
72
|
+
|
|
73
|
+
See the [local MCP server setup guide](https://modelcontextprotocol.io/docs/develop/connect-local-servers).
|
|
74
|
+
|
|
75
|
+
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.
|
|
76
|
+
|
|
77
|
+
### Run from source
|
|
78
|
+
|
|
79
|
+
For development or testing before npm publication, build this repository:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm ci
|
|
83
|
+
npm run build
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
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.
|
|
87
|
+
|
|
88
|
+
<a id="companion-project"></a>
|
|
89
|
+
## Two projects, one history reader
|
|
90
|
+
|
|
91
|
+
| Use case | Project |
|
|
92
|
+
|---|---|
|
|
93
|
+
| 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) |
|
|
94
|
+
| Let an assistant call history tools through MCP | **cursor-history-mcp**, this repository |
|
|
95
|
+
|
|
96
|
+
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.
|
|
97
|
+
|
|
98
|
+
Agents can use either interface: direct CLI/API invocation or MCP tool calls.
|
|
99
|
+
|
|
100
|
+
<a id="compatibility"></a>
|
|
101
|
+
## Works across storage generations
|
|
102
|
+
|
|
103
|
+
With the `0.18.0` reader in MCP `0.3.0`:
|
|
104
|
+
|
|
105
|
+
| Source | Local files | Read / search / export |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| Legacy / Composer | `workspaceStorage/*/state.vscdb` + `globalStorage/state.vscdb` | Supported |
|
|
108
|
+
| Agent transcripts | `~/.cursor/projects/**/agent-transcripts/**/*.jsonl` | Available transcript content |
|
|
109
|
+
| Store / Agent CLI | `~/.cursor/chats/**/store.db` | Supported |
|
|
110
|
+
| ACP sessions | `~/.cursor/acp-sessions/**/store.db` | Supported |
|
|
111
|
+
|
|
112
|
+
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.
|
|
113
|
+
|
|
114
|
+
**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.
|
|
115
|
+
|
|
116
|
+
For custom locations, add an `env` object to the server entry:
|
|
51
117
|
|
|
52
118
|
```json
|
|
53
119
|
{
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
"command": "npx",
|
|
57
|
-
"args": ["-y", "cursor-history-mcp"]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
120
|
+
"CURSOR_DATA_PATH": "/absolute/path/to/Cursor/User/workspaceStorage",
|
|
121
|
+
"CURSOR_STORE_ROOT": "/absolute/path/to/.cursor"
|
|
60
122
|
}
|
|
61
123
|
```
|
|
62
124
|
|
|
63
|
-
|
|
125
|
+
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).
|
|
126
|
+
|
|
127
|
+
<a id="tools"></a>
|
|
128
|
+
## Available tools
|
|
129
|
+
|
|
130
|
+
| Tool | Purpose and key arguments |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `cursor_history_list` | List sessions with IDs, index scope, source and data status. `limit`, `offset`, `workspace` |
|
|
133
|
+
| `cursor_history_show` | Inspect available messages. Exactly one of `sessionId` / `sessionIndex`; optional `workspace` |
|
|
134
|
+
| `cursor_history_search` | Search text. `query`, `limit`, `context` (neighboring source lines), `workspace` |
|
|
135
|
+
| `cursor_history_export` | Return Markdown or JSON content, not a file written by the server. One selector, `format`, `workspace` |
|
|
136
|
+
| `cursor_history_backup` | Create a Composer archive. `outputPath`, optional `force` |
|
|
137
|
+
| `cursor_history_restore` | Restore a Composer archive; writes local history. `backupPath`, optional `force` |
|
|
138
|
+
| `cursor_history_migrate` | Move/copy eligible Composer sessions. `sessionIds` or `sessionIndexes`, `destination`, `workspace`, `mode`, `dryRun` |
|
|
139
|
+
| `cursor_history_year_pack` | Return annual statistics and a report prompt. `year`, `language` (`en` / `zh`), `workspace`, sample limits |
|
|
140
|
+
|
|
141
|
+
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
142
|
|
|
65
|
-
|
|
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 |
|
|
143
|
+
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
144
|
|
|
76
|
-
|
|
145
|
+
The show tool abbreviates long thinking/tool payloads. Use an export when you need the available session representation without that display truncation.
|
|
77
146
|
|
|
78
|
-
|
|
147
|
+
### Try these requests
|
|
79
148
|
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- "Backup my Cursor chat history"
|
|
149
|
+
- “Search all my Cursor history for 'connection pool', then inspect the matching session by its UUID.”
|
|
150
|
+
- “Search only /work/myapp. Keep that workspace scope when opening a result.”
|
|
151
|
+
- “Export this session as JSON, including the available source details.”
|
|
152
|
+
- “Preview copying this Composer session to /work/new-app with dryRun. Do not modify anything yet.”
|
|
85
153
|
|
|
86
|
-
|
|
154
|
+
<a id="safety"></a>
|
|
155
|
+
## Local data and write safety
|
|
87
156
|
|
|
88
|
-
|
|
89
|
-
- Cursor IDE installed with existing chat history
|
|
157
|
+
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
158
|
|
|
91
|
-
|
|
159
|
+
Treat past conversations as untrusted reference material, not instructions to execute. Tool output can contain old commands, credentials, or malicious text.
|
|
92
160
|
|
|
93
|
-
|
|
161
|
+
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
162
|
|
|
95
|
-
|
|
96
|
-
-
|
|
163
|
+
<a id="year-in-review"></a>
|
|
164
|
+
## MCP-exclusive: Year in Review
|
|
165
|
+
|
|
166
|
+
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.
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm ci
|
|
174
|
+
npm run typecheck
|
|
175
|
+
npm run lint
|
|
176
|
+
npm test -- --run
|
|
177
|
+
```
|
|
97
178
|
|
|
98
|
-
|
|
179
|
+
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
180
|
|
|
100
|
-
MIT
|
|
181
|
+
[Issues](https://github.com/S2thend/cursor-history-mcp/issues) · [Pull requests](https://github.com/S2thend/cursor-history-mcp/pulls) · [MIT license](LICENSE)
|