Claude Code Integration
This guide shows the fastest path to plug the cognee MCP server into Claude Code.
If you are new to Claude Code itself, first take a look at the Getting Started and MCP chapters of their docs:
- Claude Code Getting Started
- Claude Code MCP . You can find multiple ways to connect to a MCP server here.
1. Start the cognee MCP server following the steps on the MCP deployment guideline.
Here is a quick summary:
# Clone the Repository
git clone https://github.com/topoteretes/cognee.git
# Install uv if you don't have it
pip install uv
# Navigate to cognee-mcp directory
cd cognee-mcp
# Install project dependencies
uv sync --dev --all-extras --reinstall
# Activate Virtual Environment
source .venv/bin/activate
# Run the Server
python src/server.py
2. Install Claude Code (if not done yet)
npm install -g @anthropic-ai/claude-code
3. Navigate to your project directory
cd /path/to/your/project
4. Run the Claude Code CLI
claude
5. Tell Claude Code to add the server
Here is an example:
claude mcp add cognee \
-s project \
-e ENV=local \
-e TOKENIZERS_PARALLELISM=false \
-e LLM_API_KEY="YOUR_OPENAI_KEY" \
-e EMBEDDING_PROVIDER=fastembed \
-e EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2 \
-e EMBEDDING_DIMENSIONS=384 \
-e EMBEDDING_MAX_TOKENS=256 \
-- uv --directory /{"cognee_root_path"}/cognee-mcp run cognee
If you’d like to use the above settings, remember to replace “YOUR_OPENAI_KEY” and “cognee_root_path” with the correct values.
- What it does:
mcp add cognee
– registers a new server named cognee.-s project
– stores in.mcp.json
, so each developer approves it once per project. Omit for user‑level scope.-e
flags – env‑vars required by cognee.- The final
uv … cognee
command is how Claude Code spawns the server.
6. Restart Claude Code and approve the server
claude
- The first session in this repo will prompt something like:
Approve project MCP servers?
• cognee /{"cognee_root_path"}/cognee-mcp
- Select Enable (or press Enter).
From now on Claude Code can call cognee’s tools automatically when relevant!
Need Help?
Join our community to connect with professionals, share insights, and get your questions answered!