Cursor Integration
If you’re looking to unify your code exploration in Python repositories, Cursor provides an intuitive interface to interact with cognee’s MCP server directly.If you are using Visual Studio Code, you can explore our Roo or Cline integration guides instead.By integrating Cursor and cognee, you can effortlessly:
- Generate knowledge graphs from your codebase
- Access code search capabilities
- Explore advanced analysis tools without leaving your IDE
Why Use Cognee with Cursor?
Cognee specializes in building detailed knowledge graphs and retrieve accurate data based on user queries. Together with Cursor, you get:- Streamlined Development Experience: Interact with cognee’s code analysis directly from Cursor’s Composer.
- Enhanced Code Understanding: Find out dependencies and relationships in your code base easily, and quickly search across large codebases.
- Efficiency Gains: No need to switch between terminals or external apps—simply invoke cognee’s powerful tools from within your IDE.
Prerequisites
Before proceeding, ensure you have the following:- Cursor installed on your machine.
- A local copy of the cognee repository.
- An LLM API key (default setup uses OpenAI, e.g.,
sk-...).
Integration Steps
1. Install Cursor
- Visit the official Cursor website to download Cursor.
- Follow the on-screen instructions to install Cursor on your operating system.
- Once installed, open Cursor to verify everything is functioning properly.
2. Run cognee MCP server
If you haven’t done yet, follow the installation and deployment steps here.3. Add a New MCP Server in Cursor
- Launch Cursor, and click the Gear Icon to open Settings.
- Navigate to Tools & Integration > MCP Tools.
- Click on + Add MCP Server.
-
The easiest setup is to have the Cognee MCP server running in http transport mode (e.g. by following the quickstart guide).
In this case, add the following to your mcp.json:
-
On the other hand, if you cloned the Cognee github repository, and want to run the MCP server in stdio transport mode,
you can add the following configuration to your mcp.json, which will run the mcp server and Cursor will connect to it:
4. Refresh and Verify Cognee in Cursor
You can use the toggle to refresh the connection. If all goes well, you should see a list of available tools from cognee. This indicates cognee’s MCP server is running correctly, and Cursor has successfully loaded the server’s capabilities.5. Use Cognee in Cursor Chat
- Open the Chat in Cursor.
- Make sure Agent is selected.
- Issue a prompt referencing cognee tools. Cursor will pass your request to the cognee MCP server, and results will be displayed directly in the Chat interface.
Remember: Use the CODE search type to query only after codify tool has been used.
Tip: For larger codebases, consider incremental indexing or caching to speed up analysis.
You’ve now set up cognee’s MCP server with Cursor! Enjoy a richer, more powerful code exploration experience right inside your IDE.