cursor-db-mcp
Language:
Python
Stars:
11
Forks:
0
Cursor DB MCP Server
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.
Cursor
Prerequisites
Cursor IDE
Installation
Easy Installation
Use the provided installation script to install all dependencies:
python install.py
This script will install:
- Basic MCP server and dependencies
Using with Cursor IDE
1. Open Cursor and navigate to Settings->Cursor Settings->MCP.
2. Click: Add new MCP server 3. Name: Cursor DB MCP; Type: Command 4. Command: \uv run --with mcp[cli] mcp run /cursor-db-mcp-server.py
Now you can ask questions about the database or retrieve info about historical chats.
Available Resources
cursor://projects
- List all available Cursor projectscursor://projects/detailed
- List projects with detailed informationcursor://projects/{project_name}/chat
- Get chat data for a specific projectcursor://projects/{project_name}/composers
- Get composer IDs for a specific projectcursor://composers/{composer_id}
- Get data for a specific composer
Available Tools
-
query_table
- Query a specific table in a project's database -
refresh_databases
- Refresh the list of database paths- You: "I'm getting a 401 error when connecting to the API. Here's my code..."
-
Claude: "It looks like you're missing the authorization header in your request..."
## Querying Database Tables
**User**: "Can you search for keys related to 'settings' in the ItemTable of my 'project1' project?"
**Claude**:
I'll search for keys related to 'settings' in the ItemTable of your 'project1' project.
Here are the results:
-
Key: "workbench.settings.editor" Value: {"mode": "ui", "lastFocusedSettingId": "editor.fontSize"}
-
Key: "settings.language" Value: "en"
-
Key: "settings.theme" Value: "dark"
## Analyzing Chat Data
**User**: "Can you analyze the chat data from my 'project1' project and tell me what topics I've been discussing most frequently?"
**Claude**:
I'll analyze the chat data from your 'project1' project.
Based on your chat history, here are the most frequent topics you've been discussing:
- React Hooks and Components (5 conversations)
- API Integration (3 conversations)
- CSS Styling (2 conversations)
- Performance Optimization (2 conversations)
- Debugging (1 conversation)
The most common questions were about state management in React and handling API responses.
# Architecture
The server uses the Model Context Protocol (MCP) to expose Cursor's SQLite databases to AI assistants. Key components include:
1. **Lifespan Context Management**: The server uses MCP's lifespan API to efficiently manage resources throughout the server's lifecycle.
2. **CursorDBManager**: Handles the detection and management of Cursor projects and their databases.
3. **Resources**: Expose data from Cursor databases as MCP resources.
4. **Tools**: Provide functionality to query databases and manage projects.
5. **Prompts**: Define reusable templates for AI interactions. -->
# How It Works
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.
# Notes
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.
2. This was written on a Mac. YMMV with other OS
# Shameless Plug
Like this? Try [Cursor Journal](https://medium.com/@jbdamask/building-cursor-journal-with-cursor-77445026a08c) to create DevLogs directly from Cursor chat history!
# License
MIT
Publisher info
More MCP servers built with Python
This MCP server provides access to real-time water data from the USGS Water Services API. It allows you to fetch instantaneous water measurements including stream flow, gage height, temperature, and other water quality parameters from thousands of monitoring stations across the United States.
Freepik MCP allows LLMs to access everything available through the Freepik API — including searching and retrieving images, icons, illustrations, and using tools for image generation, video creation, and image enhancement — all in an LLM-friendly format.