iflow-mcp_jbdamask_cursor-db-mcp 0.1.0__tar.gz
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.
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/LICENSE +9 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/PKG-INFO +267 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/README.md +236 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/cursor_db_mcp/__init__.py +3 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/cursor_db_mcp/__main__.py +4 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/cursor_db_mcp/server.py +526 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/iflow_mcp_jbdamask_cursor_db_mcp.egg-info/PKG-INFO +267 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/iflow_mcp_jbdamask_cursor_db_mcp.egg-info/SOURCES.txt +12 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/iflow_mcp_jbdamask_cursor_db_mcp.egg-info/dependency_links.txt +1 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/iflow_mcp_jbdamask_cursor_db_mcp.egg-info/entry_points.txt +2 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/iflow_mcp_jbdamask_cursor_db_mcp.egg-info/requires.txt +8 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/iflow_mcp_jbdamask_cursor_db_mcp.egg-info/top_level.txt +1 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/pyproject.toml +52 -0
- iflow_mcp_jbdamask_cursor_db_mcp-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Released under MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 John Damask.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iflow-mcp_jbdamask_cursor-db-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Model Context Protocol (MCP) server for accessing Cursor IDE's SQLite databases
|
|
5
|
+
Author-email: jbdamask <jbdamask@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jbdamask/cursor-db-mcp
|
|
8
|
+
Project-URL: Repository, https://github.com/jbdamask/cursor-db-mcp
|
|
9
|
+
Project-URL: Issues, https://github.com/jbdamask/cursor-db-mcp/issues
|
|
10
|
+
Keywords: mcp,cursor,sqlite,database,ide
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Requires-Dist: pathlib>=1.0.1
|
|
25
|
+
Requires-Dist: typing>=3.7.4.3
|
|
26
|
+
Provides-Extra: cli
|
|
27
|
+
Requires-Dist: mcp[cli]; extra == "cli"
|
|
28
|
+
Requires-Dist: typer>=0.9.0; extra == "cli"
|
|
29
|
+
Requires-Dist: rich>=13.0.0; extra == "cli"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Cursor DB MCP Server
|
|
33
|
+
|
|
34
|
+
A Model Context Protocol (MCP) server for accessing Cursor IDE's SQLite databases. This server allows AI assistants to explore and interact with Cursor's project data, chat history, and composer information.
|
|
35
|
+
|
|
36
|
+
<!-- __Claude__
|
|
37
|
+
 -->
|
|
38
|
+
|
|
39
|
+
__Cursor__
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Prerequisites
|
|
44
|
+
|
|
45
|
+
Cursor IDE
|
|
46
|
+
<!-- Claude Desktop (if you want to use MCP in Claude) -->
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
### Easy Installation
|
|
51
|
+
|
|
52
|
+
Use the provided installation script to install all dependencies:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python install.py
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This script will install:
|
|
59
|
+
- Basic MCP server and dependencies
|
|
60
|
+
|
|
61
|
+
<!-- ### Manual Installation
|
|
62
|
+
|
|
63
|
+
1. Clone this repository:
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/yourusername/cursor-db-mcp.git
|
|
66
|
+
cd cursor-db-mcp
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. Install basic dependencies:
|
|
70
|
+
```bash
|
|
71
|
+
pip install -r requirements.txt
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
3. Install MCP CLI tools (optional, for testing):
|
|
75
|
+
```bash
|
|
76
|
+
pip install 'mcp[cli]' # Note the quotes around mcp[cli]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If the above command fails, you can install the CLI dependencies directly:
|
|
80
|
+
```bash
|
|
81
|
+
pip install typer rich
|
|
82
|
+
``` -->
|
|
83
|
+
|
|
84
|
+
<!-- ## Usage
|
|
85
|
+
|
|
86
|
+
### Using with Claude Desktop
|
|
87
|
+
|
|
88
|
+
1. Install the MCP server in Claude Desktop:
|
|
89
|
+
```bash
|
|
90
|
+
mcp install cursor-db-mcp-server.py
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
2. In Claude Desktop, you can now access your Cursor data by asking questions like:
|
|
94
|
+
- "Show me a list of my Cursor projects"
|
|
95
|
+
- "What's in my chat history for project X?"
|
|
96
|
+
- "Find composer data for composer ID Y"
|
|
97
|
+
|
|
98
|
+
See detailed examples below
|
|
99
|
+
|
|
100
|
+
Note: If Claude shows an error connecting to this MCP it's likely because it can't find uv. To fix this, change the command value to include the fully qualified path to uv. For example:
|
|
101
|
+
```
|
|
102
|
+
"Cursor DB Manager": {
|
|
103
|
+
"command": "/Users/johndamask/.local/bin/uv",
|
|
104
|
+
"args": [
|
|
105
|
+
"run",
|
|
106
|
+
"--with",
|
|
107
|
+
"mcp[cli]",
|
|
108
|
+
"mcp",
|
|
109
|
+
"run",
|
|
110
|
+
"/Users/johndamask/code/cursor-db-mcp/cursor-db-mcp-server.py"
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
``` -->
|
|
114
|
+
|
|
115
|
+
## Using with Cursor IDE
|
|
116
|
+
|
|
117
|
+
1. Open Cursor and navigate to Settings->Cursor Settings->MCP.
|
|
118
|
+
2. Click: Add new MCP server
|
|
119
|
+
3. Name: Cursor DB MCP; Type: Command
|
|
120
|
+
4. Command: \<fully qualified path to\>uv run --with mcp[cli] mcp run \<fully qualified path to\>/cursor-db-mcp-server.py
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+
|
|
124
|
+
Now you can ask questions about the database or retrieve info about historical chats.
|
|
125
|
+
|
|
126
|
+

|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
### Using with Claude Desktop
|
|
131
|
+
|
|
132
|
+
[Installing MCP servers for Claude Desktop](https://modelcontextprotocol.io/quickstart/user)
|
|
133
|
+
|
|
134
|
+
Add this to your claude_desktop_config.json file
|
|
135
|
+
```
|
|
136
|
+
"cursor-db-mcp": {
|
|
137
|
+
"command": "<fully qualified path to >/uv",
|
|
138
|
+
"args": [
|
|
139
|
+
"run",
|
|
140
|
+
"--with",
|
|
141
|
+
"mcp[cli]",
|
|
142
|
+
"mcp",
|
|
143
|
+
"run",
|
|
144
|
+
"<fully qualified path to >/cursor-db-mcp-server.py"
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+

|
|
151
|
+
|
|
152
|
+
## Available Resources
|
|
153
|
+
|
|
154
|
+
- `cursor://projects` - List all available Cursor projects
|
|
155
|
+
- `cursor://projects/detailed` - List projects with detailed information
|
|
156
|
+
- `cursor://projects/{project_name}/chat` - Get chat data for a specific project
|
|
157
|
+
- `cursor://projects/{project_name}/composers` - Get composer IDs for a specific project
|
|
158
|
+
- `cursor://composers/{composer_id}` - Get data for a specific composer
|
|
159
|
+
|
|
160
|
+
## Available Tools
|
|
161
|
+
|
|
162
|
+
- `query_table` - Query a specific table in a project's database
|
|
163
|
+
- `refresh_databases` - Refresh the list of database paths
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<!-- # Example Usage with Claude
|
|
167
|
+
|
|
168
|
+
## Listing Projects
|
|
169
|
+
|
|
170
|
+
**User**: "Can you show me a list of my Cursor projects?"
|
|
171
|
+
|
|
172
|
+
**Claude**:
|
|
173
|
+
```
|
|
174
|
+
I'll retrieve a list of your Cursor projects.
|
|
175
|
+
|
|
176
|
+
Here are the Cursor projects I found:
|
|
177
|
+
- project1 (path: /Users/username/Library/Application Support/Cursor/User/workspaceStorage/abc123/state.vscdb)
|
|
178
|
+
- project2 (path: /Users/username/Library/Application Support/Cursor/User/workspaceStorage/def456/state.vscdb)
|
|
179
|
+
- custom-project (path: /Users/username/code/custom-project/state.vscdb)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Viewing Chat History
|
|
183
|
+
|
|
184
|
+
**User**: "Show me the chat history from my 'project1' project."
|
|
185
|
+
|
|
186
|
+
**Claude**:
|
|
187
|
+
```
|
|
188
|
+
I'll retrieve the chat history from your 'project1' project.
|
|
189
|
+
|
|
190
|
+
Here's the chat history I found:
|
|
191
|
+
|
|
192
|
+
Chat: "Understanding React Hooks"
|
|
193
|
+
- You: "Can you explain how useEffect works in React?"
|
|
194
|
+
- Claude: "The useEffect hook in React is used for handling side effects in functional components..."
|
|
195
|
+
|
|
196
|
+
Chat: "Debugging API Connection"
|
|
197
|
+
- You: "I'm getting a 401 error when connecting to the API. Here's my code..."
|
|
198
|
+
- Claude: "It looks like you're missing the authorization header in your request..."
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Querying Database Tables
|
|
202
|
+
|
|
203
|
+
**User**: "Can you search for keys related to 'settings' in the ItemTable of my 'project1' project?"
|
|
204
|
+
|
|
205
|
+
**Claude**:
|
|
206
|
+
```
|
|
207
|
+
I'll search for keys related to 'settings' in the ItemTable of your 'project1' project.
|
|
208
|
+
|
|
209
|
+
Here are the results:
|
|
210
|
+
1. Key: "workbench.settings.editor"
|
|
211
|
+
Value: {"mode": "ui", "lastFocusedSettingId": "editor.fontSize"}
|
|
212
|
+
|
|
213
|
+
2. Key: "settings.language"
|
|
214
|
+
Value: "en"
|
|
215
|
+
|
|
216
|
+
3. Key: "settings.theme"
|
|
217
|
+
Value: "dark"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Analyzing Chat Data
|
|
221
|
+
|
|
222
|
+
**User**: "Can you analyze the chat data from my 'project1' project and tell me what topics I've been discussing most frequently?"
|
|
223
|
+
|
|
224
|
+
**Claude**:
|
|
225
|
+
```
|
|
226
|
+
I'll analyze the chat data from your 'project1' project.
|
|
227
|
+
|
|
228
|
+
Based on your chat history, here are the most frequent topics you've been discussing:
|
|
229
|
+
1. React Hooks and Components (5 conversations)
|
|
230
|
+
2. API Integration (3 conversations)
|
|
231
|
+
3. CSS Styling (2 conversations)
|
|
232
|
+
4. Performance Optimization (2 conversations)
|
|
233
|
+
5. Debugging (1 conversation)
|
|
234
|
+
|
|
235
|
+
The most common questions were about state management in React and handling API responses.
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
# Architecture
|
|
239
|
+
|
|
240
|
+
The server uses the Model Context Protocol (MCP) to expose Cursor's SQLite databases to AI assistants. Key components include:
|
|
241
|
+
|
|
242
|
+
1. **Lifespan Context Management**: The server uses MCP's lifespan API to efficiently manage resources throughout the server's lifecycle.
|
|
243
|
+
|
|
244
|
+
2. **CursorDBManager**: Handles the detection and management of Cursor projects and their databases.
|
|
245
|
+
|
|
246
|
+
3. **Resources**: Expose data from Cursor databases as MCP resources.
|
|
247
|
+
|
|
248
|
+
4. **Tools**: Provide functionality to query databases and manage projects.
|
|
249
|
+
|
|
250
|
+
5. **Prompts**: Define reusable templates for AI interactions. -->
|
|
251
|
+
|
|
252
|
+
# How It Works
|
|
253
|
+
|
|
254
|
+
The server scans your Cursor installation directory to find project databases (state.vscdb files). It then exposes these databases through MCP resources and tools, allowing AI assistants to query and analyze the data.
|
|
255
|
+
|
|
256
|
+
# Notes
|
|
257
|
+
1. Cursor stores AI conversations in different places. Increasingly, chats are stored as "composerData" under globalStorage/state.vscdb. If you don't get results when asking about chats for recent projects, try asking for composers.
|
|
258
|
+
2. This was written on a Mac. YMMV with other OS
|
|
259
|
+
|
|
260
|
+
# Shameless Plug
|
|
261
|
+
<img src="./img/cursor-journal-logo_thumbnail.jpg" width="150" />
|
|
262
|
+
|
|
263
|
+
Like this? Try [Cursor Journal](https://medium.com/@jbdamask/building-cursor-journal-with-cursor-77445026a08c) to create DevLogs directly from Cursor chat history!
|
|
264
|
+
|
|
265
|
+
# License
|
|
266
|
+
|
|
267
|
+
MIT
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Cursor DB MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server for accessing Cursor IDE's SQLite databases. This server allows AI assistants to explore and interact with Cursor's project data, chat history, and composer information.
|
|
4
|
+
|
|
5
|
+
<!-- __Claude__
|
|
6
|
+
 -->
|
|
7
|
+
|
|
8
|
+
__Cursor__
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
Cursor IDE
|
|
15
|
+
<!-- Claude Desktop (if you want to use MCP in Claude) -->
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### Easy Installation
|
|
20
|
+
|
|
21
|
+
Use the provided installation script to install all dependencies:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python install.py
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This script will install:
|
|
28
|
+
- Basic MCP server and dependencies
|
|
29
|
+
|
|
30
|
+
<!-- ### Manual Installation
|
|
31
|
+
|
|
32
|
+
1. Clone this repository:
|
|
33
|
+
```bash
|
|
34
|
+
git clone https://github.com/yourusername/cursor-db-mcp.git
|
|
35
|
+
cd cursor-db-mcp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Install basic dependencies:
|
|
39
|
+
```bash
|
|
40
|
+
pip install -r requirements.txt
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. Install MCP CLI tools (optional, for testing):
|
|
44
|
+
```bash
|
|
45
|
+
pip install 'mcp[cli]' # Note the quotes around mcp[cli]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If the above command fails, you can install the CLI dependencies directly:
|
|
49
|
+
```bash
|
|
50
|
+
pip install typer rich
|
|
51
|
+
``` -->
|
|
52
|
+
|
|
53
|
+
<!-- ## Usage
|
|
54
|
+
|
|
55
|
+
### Using with Claude Desktop
|
|
56
|
+
|
|
57
|
+
1. Install the MCP server in Claude Desktop:
|
|
58
|
+
```bash
|
|
59
|
+
mcp install cursor-db-mcp-server.py
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. In Claude Desktop, you can now access your Cursor data by asking questions like:
|
|
63
|
+
- "Show me a list of my Cursor projects"
|
|
64
|
+
- "What's in my chat history for project X?"
|
|
65
|
+
- "Find composer data for composer ID Y"
|
|
66
|
+
|
|
67
|
+
See detailed examples below
|
|
68
|
+
|
|
69
|
+
Note: If Claude shows an error connecting to this MCP it's likely because it can't find uv. To fix this, change the command value to include the fully qualified path to uv. For example:
|
|
70
|
+
```
|
|
71
|
+
"Cursor DB Manager": {
|
|
72
|
+
"command": "/Users/johndamask/.local/bin/uv",
|
|
73
|
+
"args": [
|
|
74
|
+
"run",
|
|
75
|
+
"--with",
|
|
76
|
+
"mcp[cli]",
|
|
77
|
+
"mcp",
|
|
78
|
+
"run",
|
|
79
|
+
"/Users/johndamask/code/cursor-db-mcp/cursor-db-mcp-server.py"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
``` -->
|
|
83
|
+
|
|
84
|
+
## Using with Cursor IDE
|
|
85
|
+
|
|
86
|
+
1. Open Cursor and navigate to Settings->Cursor Settings->MCP.
|
|
87
|
+
2. Click: Add new MCP server
|
|
88
|
+
3. Name: Cursor DB MCP; Type: Command
|
|
89
|
+
4. Command: \<fully qualified path to\>uv run --with mcp[cli] mcp run \<fully qualified path to\>/cursor-db-mcp-server.py
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
Now you can ask questions about the database or retrieve info about historical chats.
|
|
94
|
+
|
|
95
|
+

|
|
96
|
+
|
|
97
|
+

|
|
98
|
+
|
|
99
|
+
### Using with Claude Desktop
|
|
100
|
+
|
|
101
|
+
[Installing MCP servers for Claude Desktop](https://modelcontextprotocol.io/quickstart/user)
|
|
102
|
+
|
|
103
|
+
Add this to your claude_desktop_config.json file
|
|
104
|
+
```
|
|
105
|
+
"cursor-db-mcp": {
|
|
106
|
+
"command": "<fully qualified path to >/uv",
|
|
107
|
+
"args": [
|
|
108
|
+
"run",
|
|
109
|
+
"--with",
|
|
110
|
+
"mcp[cli]",
|
|
111
|
+
"mcp",
|
|
112
|
+
"run",
|
|
113
|
+
"<fully qualified path to >/cursor-db-mcp-server.py"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+

|
|
120
|
+
|
|
121
|
+
## Available Resources
|
|
122
|
+
|
|
123
|
+
- `cursor://projects` - List all available Cursor projects
|
|
124
|
+
- `cursor://projects/detailed` - List projects with detailed information
|
|
125
|
+
- `cursor://projects/{project_name}/chat` - Get chat data for a specific project
|
|
126
|
+
- `cursor://projects/{project_name}/composers` - Get composer IDs for a specific project
|
|
127
|
+
- `cursor://composers/{composer_id}` - Get data for a specific composer
|
|
128
|
+
|
|
129
|
+
## Available Tools
|
|
130
|
+
|
|
131
|
+
- `query_table` - Query a specific table in a project's database
|
|
132
|
+
- `refresh_databases` - Refresh the list of database paths
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
<!-- # Example Usage with Claude
|
|
136
|
+
|
|
137
|
+
## Listing Projects
|
|
138
|
+
|
|
139
|
+
**User**: "Can you show me a list of my Cursor projects?"
|
|
140
|
+
|
|
141
|
+
**Claude**:
|
|
142
|
+
```
|
|
143
|
+
I'll retrieve a list of your Cursor projects.
|
|
144
|
+
|
|
145
|
+
Here are the Cursor projects I found:
|
|
146
|
+
- project1 (path: /Users/username/Library/Application Support/Cursor/User/workspaceStorage/abc123/state.vscdb)
|
|
147
|
+
- project2 (path: /Users/username/Library/Application Support/Cursor/User/workspaceStorage/def456/state.vscdb)
|
|
148
|
+
- custom-project (path: /Users/username/code/custom-project/state.vscdb)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Viewing Chat History
|
|
152
|
+
|
|
153
|
+
**User**: "Show me the chat history from my 'project1' project."
|
|
154
|
+
|
|
155
|
+
**Claude**:
|
|
156
|
+
```
|
|
157
|
+
I'll retrieve the chat history from your 'project1' project.
|
|
158
|
+
|
|
159
|
+
Here's the chat history I found:
|
|
160
|
+
|
|
161
|
+
Chat: "Understanding React Hooks"
|
|
162
|
+
- You: "Can you explain how useEffect works in React?"
|
|
163
|
+
- Claude: "The useEffect hook in React is used for handling side effects in functional components..."
|
|
164
|
+
|
|
165
|
+
Chat: "Debugging API Connection"
|
|
166
|
+
- You: "I'm getting a 401 error when connecting to the API. Here's my code..."
|
|
167
|
+
- Claude: "It looks like you're missing the authorization header in your request..."
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Querying Database Tables
|
|
171
|
+
|
|
172
|
+
**User**: "Can you search for keys related to 'settings' in the ItemTable of my 'project1' project?"
|
|
173
|
+
|
|
174
|
+
**Claude**:
|
|
175
|
+
```
|
|
176
|
+
I'll search for keys related to 'settings' in the ItemTable of your 'project1' project.
|
|
177
|
+
|
|
178
|
+
Here are the results:
|
|
179
|
+
1. Key: "workbench.settings.editor"
|
|
180
|
+
Value: {"mode": "ui", "lastFocusedSettingId": "editor.fontSize"}
|
|
181
|
+
|
|
182
|
+
2. Key: "settings.language"
|
|
183
|
+
Value: "en"
|
|
184
|
+
|
|
185
|
+
3. Key: "settings.theme"
|
|
186
|
+
Value: "dark"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Analyzing Chat Data
|
|
190
|
+
|
|
191
|
+
**User**: "Can you analyze the chat data from my 'project1' project and tell me what topics I've been discussing most frequently?"
|
|
192
|
+
|
|
193
|
+
**Claude**:
|
|
194
|
+
```
|
|
195
|
+
I'll analyze the chat data from your 'project1' project.
|
|
196
|
+
|
|
197
|
+
Based on your chat history, here are the most frequent topics you've been discussing:
|
|
198
|
+
1. React Hooks and Components (5 conversations)
|
|
199
|
+
2. API Integration (3 conversations)
|
|
200
|
+
3. CSS Styling (2 conversations)
|
|
201
|
+
4. Performance Optimization (2 conversations)
|
|
202
|
+
5. Debugging (1 conversation)
|
|
203
|
+
|
|
204
|
+
The most common questions were about state management in React and handling API responses.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
# Architecture
|
|
208
|
+
|
|
209
|
+
The server uses the Model Context Protocol (MCP) to expose Cursor's SQLite databases to AI assistants. Key components include:
|
|
210
|
+
|
|
211
|
+
1. **Lifespan Context Management**: The server uses MCP's lifespan API to efficiently manage resources throughout the server's lifecycle.
|
|
212
|
+
|
|
213
|
+
2. **CursorDBManager**: Handles the detection and management of Cursor projects and their databases.
|
|
214
|
+
|
|
215
|
+
3. **Resources**: Expose data from Cursor databases as MCP resources.
|
|
216
|
+
|
|
217
|
+
4. **Tools**: Provide functionality to query databases and manage projects.
|
|
218
|
+
|
|
219
|
+
5. **Prompts**: Define reusable templates for AI interactions. -->
|
|
220
|
+
|
|
221
|
+
# How It Works
|
|
222
|
+
|
|
223
|
+
The server scans your Cursor installation directory to find project databases (state.vscdb files). It then exposes these databases through MCP resources and tools, allowing AI assistants to query and analyze the data.
|
|
224
|
+
|
|
225
|
+
# Notes
|
|
226
|
+
1. Cursor stores AI conversations in different places. Increasingly, chats are stored as "composerData" under globalStorage/state.vscdb. If you don't get results when asking about chats for recent projects, try asking for composers.
|
|
227
|
+
2. This was written on a Mac. YMMV with other OS
|
|
228
|
+
|
|
229
|
+
# Shameless Plug
|
|
230
|
+
<img src="./img/cursor-journal-logo_thumbnail.jpg" width="150" />
|
|
231
|
+
|
|
232
|
+
Like this? Try [Cursor Journal](https://medium.com/@jbdamask/building-cursor-journal-with-cursor-77445026a08c) to create DevLogs directly from Cursor chat history!
|
|
233
|
+
|
|
234
|
+
# License
|
|
235
|
+
|
|
236
|
+
MIT
|