Enable Persistent Memory for AI Agents
An MCP server running cognee's memory engine, giving agents remember/recall/forget tools over a local or cloud knowledge graph.
1.5.4Add to Favorites
Why it matters
Integrate persistent memory capabilities into your AI agents using a knowledge graph. This asset provides a GraphRAG memory server that enhances AI agent functionality with robust data storage and retrieval.
Outcomes
What it gets done
Provide persistent memory for AI agents via knowledge graph storage.
Enable efficient data retrieval for AI agent applications.
Support multiple transport modes including HTTP and SSE.
Facilitate local file imports for memory enrichment.
Install
Add it to your toolbox
Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-cognee-mcp | bash After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.
Reports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Add data to the knowledge graph for memory storage and retrieval.
Process and structure data into knowledge graph nodes and relationships.
Generate code based on knowledge graph context and developer rules.
Query the knowledge graph to retrieve relevant memory and context.
Clear and reset the entire memory and knowledge graph.
Import local files (.md, source code, rules) into the knowledge graph.
Check the status of running cognify and codify background tasks.
Overview
cognee-mcp server
An MCP server that runs cognee's memory engine, exposing a minimal remember/recall/forget API for agent memory. It supports local, cloud, and shared-API backends, with per-client dataset scoping and configurable per-dataset storage isolation. Use it when agents across different MCP clients need shared, persistent memory instead of re-deriving context each session; not for exposing cognee's full operational tool surface while running in API Mode.
What it does
This server runs cognee's memory engine as a Model Context Protocol server, so any MCP client can give an agent persistent, queryable memory. It intentionally exposes a minimal API: remember (store data - plain text, or a file via filename + content_base64, up to 10MB; pass session_id for a fast session cache, omit it for permanent graph memory), recall (auto-routing search - checks the session cache first when session_id is given, then falls through to the permanent graph), and forget (delete a dataset by name or id, a single item by data_id, or everything the caller owns with everything=True). A fourth tool, cognify_status, checks the progress of background ingestion started with remember(background=True); it is unadvertised by default but stays discoverable via search_tools and callable by name. All actions are logged to a rotating file and mirrored to console in dev.
The server supports three transports (Streamable HTTP, recommended for web deployments; SSE; and stdio, the default) and three connection modes. Direct Mode (default) imports the cognee library directly and stores locally (SQLite, LanceDB, Ladybug), with full feature support. Cloud Mode calls cognee.serve() at startup and routes all operations to Cognee Cloud or a remote instance, configured via --serve-url/--serve-api-key or the COGNEE_SERVICE_URL/COGNEE_API_KEY environment variables, needing no local databases; migrations are skipped automatically. API Mode instead connects to an already-running Cognee FastAPI server over HTTP - useful for a centralized server, for separating the MCP process from the knowledge-graph backend, or for letting several MCP servers share one graph; in this mode only remember, recall, and forget are exposed as MCP tools, while operational helpers such as cognify, search, list_data, delete, prune, and improve stay internal.
Tool visibility is controlled by COGNEE_MCP_TOOL_MODE: default/minimal pin only remember/recall/forget in tools/list and make the rest discoverable through FastMCP's lexical search_tools (BM25, no stemming, up to 10 results), while all advertises every tool with no search transform. Agent scoping gives each MCP client its own auto-named default dataset on first write (for example Cursor gets cursor_vscode_memory, Claude Code gets claude_code_memory); set COGNEE_MCP_AGENT_SCOPED=false to disable this and have every client share one main_dataset. Separately, ENABLE_BACKEND_ACCESS_CONTROL governs storage-level isolation: true (default) gives each (user, dataset) pair its own Kuzu graph DB and LanceDB, searched strictly per dataset; false shares one Kuzu/LanceDB store where GRAPH_COMPLETION traversal can reach nodes from other datasets, intended for single-user local dev, and also disables the API auth requirement unless REQUIRE_AUTHENTICATION=true is set explicitly. Switching either flag does not migrate existing data between the two on-disk layouts.
When to use - and when NOT to
Use it when agents across different MCP clients (Cursor, Claude Desktop, Claude Code/CLI, Cline, Roo) need a shared, persistent, queryable memory instead of re-deriving context every session. Direct Mode fits a single local full-featured instance; Cloud Mode fits offloading storage to Cognee Cloud without running local databases; API Mode fits centralizing one knowledge graph behind several MCP servers. It is not the tool to reach for if you need cognee's full operational surface (cognify, search, list_data, delete, prune, improve) exposed directly as MCP tools while running in API Mode - only the memory-API trio is exposed there. Without an LLM_API_KEY, the server can still run if the MCP host grants the sampling capability (LLM_PROVIDER="mcp-sampling" delegates completions to the host's own model, though embeddings still need a provider) - as of early 2026 Claude Code does not yet grant that capability.
Capabilities
Both the HTTP and SSE transports validate Host and Origin headers against DNS-rebinding attacks on every bind address, including loopback: an unrecognized Host returns 421 Misdirected Request, an unrecognized Origin returns 403 Forbidden. Binding a non-loopback address (as Docker's entrypoint does by default) only accepts localhost/127.0.0.1/[::1] unless specific hosts are allow-listed with MCP_ALLOWED_HOSTS="host:*,...", or the guard is disabled entirely with MCP_DISABLE_DNS_REBINDING_PROTECTION=true on a trusted network. The Docker image supports runtime-selectable optional dependency groups via an EXTRAS variable (aws, postgres/postgres-binary, neo4j, neptune, turso, scraping, langchain, llama-index, anthropic, groq, mistral, ollama/huggingface, docs, codegraph, tracing, redis, and more). When pointing a containerized MCP server at a Cognee API server running on the host (API Mode), the container automatically converts a localhost API URL to host.docker.internal on Mac/Windows/Docker Desktop; on Linux, use --network host or the host's IP address instead. Since the FastMCP 3 migration, debugging goes through the fastmcp CLI rather than mcp (which no longer recognises the server object): fastmcp inspect gives a fast sanity check of name/version/tool count, fastmcp dev runs it against the MCP Inspector UI.
How to install
# Pull the prebuilt image
docker pull cognee/cognee-mcp:main
# Create a minimal .env in the current directory (no repo checkout required)
echo 'LLM_API_KEY="YOUR_OPENAI_API_KEY"' > .env
Then run it with docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main (or TRANSPORT_MODE=sse/stdio). Alternatively, clone the cognee repo, cd cognee/cognee-mcp, install uv, run uv sync --dev --all-extras --reinstall, activate the virtual environment, set LLM_API_KEY in .env, and run python src/server.py (stdio by default, or with --transport sse / --transport http --host 127.0.0.1 --port 8000 --path /mcp). To connect a client, add an MCP server entry pointing at http://localhost:8000/mcp (HTTP) or http://localhost:8000/sse (SSE) - the Claude CLI can do this with claude mcp add cognee-http -t http http://localhost:8000/mcp.
Who it's for
Developers building agents across multiple MCP clients who want a persistent, shared memory or knowledge-graph layer instead of re-deriving context each session, and teams that need to centralize, scope, or isolate that memory per agent or per user. See the LICENSE file in the repository for the project's exact license terms.
Source README
cognee‑mcp - Run cognee’s memory engine as a Model Context Protocol server
Demo . Learn more · Join Discord · Join r/AIMemory
Build memory for Agents and query from any client that speaks MCP - in your terminal or IDE.
✨ Features
- Multiple transports - choose Streamable HTTP --transport http (recommended for web deployments), SSE --transport sse (real‑time streaming), or stdio (classic pipe, default)
- Cloud Mode - connect to Cognee Cloud via
--serve-urlorCOGNEE_SERVICE_URLenv var (see Connection Modes) - API Mode - connect to an already running Cognee FastAPI server (see Connection Modes)
- Minimal Memory API - exposes only
remember,recall, andforgetfor agent memory workflows - Integrated logging - all actions written to a rotating file (see get_log_file_location()) and mirrored to console in dev
- Session-aware memory - store fast session cache entries or permanent graph memory through one
remembertool - Focused recall - query memory through one
recalltool with optional session and search controls - Simple deletion - remove a dataset or all owned memory through one
forgettool
Please refer to our documentation here for further information.
🚀 Quick Start
- Clone cognee repo
git clone https://github.com/topoteretes/cognee.git - Navigate to cognee-mcp subdirectory
cd cognee/cognee-mcp - Install uv if you don't have one
pip install uv - Install all the dependencies you need for cognee mcp server with uv
uv sync --dev --all-extras --reinstall - Activate the virtual environment in cognee mcp directory
source .venv/bin/activate - Set up your OpenAI API key in .env for a quick setup with the default cognee configurations
LLM_API_KEY="YOUR_OPENAI_API_KEY" - Run cognee mcp server with stdio (default)
or stream responses over SSEpython src/server.py
or run with Streamable HTTP transport (recommended for web deployments)python src/server.py --transport ssepython src/server.py --transport http --host 127.0.0.1 --port 8000 --path /mcp
You can do more advanced configurations by creating .env file using our template.
To use different LLM providers / database configurations, and for more info check out our documentation.
No API key? If your MCP host grants the
samplingcapability,LLM_PROVIDER="mcp-sampling"
delegates completions to the host's own model, so noLLM_API_KEYis needed (embeddings still
need a provider). Host support varies - as of early 2026 Claude Code does not yet grant sampling
(anthropics/claude-code#1785). See the
"MCP sampling" section of the .env template.
🐳 Docker Usage
If you'd rather run cognee-mcp in a container, you have two options:
Build locally
Make sure you are in /cognee root directory and have a fresh
.envcontaining only yourLLM_API_KEY(and your chosen settings).Remove any old image and rebuild:
docker rmi cognee/cognee-mcp:main || true docker build --no-cache -f cognee-mcp/Dockerfile -t cognee/cognee-mcp:main .Run it:
# For HTTP transport (recommended for web deployments) docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # For SSE transport docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # For stdio transport (default) docker run -e TRANSPORT_MODE=stdio --env-file ./.env --rm -it cognee/cognee-mcp:mainInstalling optional dependencies at runtime:
You can install optional dependencies when running the container by setting the
EXTRASenvironment variable:# Install a single optional dependency group at runtime docker run \ -e TRANSPORT_MODE=http \ -e EXTRAS=aws \ --env-file ./.env \ -p 8000:8000 \ --rm -it cognee/cognee-mcp:main # Install multiple optional dependency groups at runtime (comma-separated) docker run \ -e TRANSPORT_MODE=sse \ -e EXTRAS=aws,postgres,neo4j \ --env-file ./.env \ -p 8000:8000 \ --rm -it cognee/cognee-mcp:mainAvailable optional dependency groups:
aws- S3 storage supportpostgres/postgres-binary- PostgreSQL database supportneo4j- Neo4j graph database supportneptune- AWS Neptune supportturso- Turso vector/graph store supportscraping- Web scraping capabilitieslangchain- LangChain integrationllama-index- LlamaIndex integrationanthropic- Anthropic modelsgroq- Groq modelsmistral- Mistral modelsollama/huggingface- Local model supportdocs- Document processingcodegraph- Code analysistracing- OpenTelemetry tracingredis- Redis support- And more (see pyproject.toml for full list)
Pull from Docker Hub (no build required):
The image is published to Docker Hub on every push to
main. If you have not cloned the
repo, create the.envfile the run commands expect first - it needs at least your LLM key:# Pull the prebuilt image docker pull cognee/cognee-mcp:main # Create a minimal .env in the current directory (no repo checkout required) echo 'LLM_API_KEY="YOUR_OPENAI_API_KEY"' > .env# With HTTP transport (recommended for web deployments) docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # With SSE transport docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main # With stdio transport (default) docker run -e TRANSPORT_MODE=stdio --env-file ./.env --rm -it cognee/cognee-mcp:mainWith runtime installation of optional dependencies:
# Install optional dependencies from Docker Hub image docker run \ -e TRANSPORT_MODE=http \ -e EXTRAS=aws,postgres \ --env-file ./.env \ -p 8000:8000 \ --rm -it cognee/cognee-mcp:main
Important: Docker vs Direct Usage
Docker uses environment variables, not command line arguments:
- ✅ Docker:
-e TRANSPORT_MODE=http - ❌ Docker:
--transport http(won't work)
Direct Python usage uses command line arguments:
- ✅ Direct:
python src/server.py --transport http - ❌ Direct:
-e TRANSPORT_MODE=http(won't work)
Docker API Mode
To connect the MCP Docker container to a Cognee API server running on your host machine:
Simple Usage (Automatic localhost handling):
# Start your Cognee API server on the host
python -m cognee.api.client
# Run MCP container in API mode - localhost is automatically converted!
docker run \
-e TRANSPORT_MODE=sse \
-e API_URL=http://localhost:8000 \
-e API_TOKEN=your_auth_token \
-p 8001:8000 \
--rm -it cognee/cognee-mcp:main
Note: The container will automatically convert localhost to host.docker.internal on Mac/Windows/Docker Desktop. You'll see a message in the logs showing the conversion.
Explicit host.docker.internal (Mac/Windows):
# Or explicitly use host.docker.internal
docker run \
-e TRANSPORT_MODE=sse \
-e API_URL=http://host.docker.internal:8000 \
-e API_TOKEN=your_auth_token \
-p 8001:8000 \
--rm -it cognee/cognee-mcp:main
On Linux (use host network or container IP):
# Option 1: Use host network (simplest)
docker run \
--network host \
-e TRANSPORT_MODE=sse \
-e API_URL=http://localhost:8000 \
-e API_TOKEN=your_auth_token \
--rm -it cognee/cognee-mcp:main
# Option 2: Use host IP address
# First, get your host IP: ip addr show docker0
docker run \
-e TRANSPORT_MODE=sse \
-e API_URL=http://172.17.0.1:8000 \
-e API_TOKEN=your_auth_token \
-p 8001:8000 \
--rm -it cognee/cognee-mcp:main
Environment variables for API mode:
API_URL: URL of the running Cognee API serverAPI_TOKEN: Authentication token (optional, required if API has authentication enabled)
Note: When running in API mode:
- Database migrations are automatically skipped (API server handles its own DB)
- Some features are limited (see API Mode Limitations)
🔗 MCP Client Configuration
After starting your Cognee MCP server with Docker, you need to configure your MCP client to connect to it.
⚠️ Host/Origin protection (why you might get HTTP 421 or 403)
Both the http and sse transports validate the
HostandOriginheaders to
block DNS-rebinding attacks, on every bind address including loopback - rebinding
targets loopback services specifically, so127.0.0.1is not a mitigation.
- A
Hostthe server does not recognise returns421 Misdirected Request- An
Originit does not recognise returns403 ForbiddenWhen you bind a non-loopback address (
--host 0.0.0.0, which is what the Docker
entrypoint does), onlylocalhost/127.0.0.1/[::1]are accepted by default, so
reaching the server by LAN IP or a custom hostname returns 421 - the guard working,
not a bug.Allow specific hosts (the
:*port glob is required):-e MCP_ALLOWED_HOSTS="192.168.1.50:*,myserver.local:*"Or turn the guard off entirely (only on a trusted network):
-e MCP_DISABLE_DNS_REBINDING_PROTECTION=trueImplementation note. FastMCP installs this guard on its streamable-http app only -
create_sse_app()accepts no such option, so the allow-lists were silently dropped for
SSE. cognee-mcp mounts the same middleware on the SSE app itself, with the same
allow-lists, so both transports behave identically.
SSE Transport Configuration (Legacy - prefer HTTP below; both are guarded)
Start the server with SSE transport:
docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main
Configure your MCP client:
Claude CLI (Easiest)
claude mcp add cognee-sse -t sse http://localhost:8000/sse
Verify the connection:
claude mcp list
You should see your server connected:
Checking MCP server health...
cognee-sse: http://localhost:8000/sse (SSE) - ✓ Connected
Manual Configuration
Claude (~/.claude.json)
{
"mcpServers": {
"cognee": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}
Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"cognee-sse": {
"url": "http://localhost:8000/sse"
}
}
}
HTTP Transport Configuration (Recommended)
Start the server with HTTP transport:
docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main
Configure your MCP client:
Claude CLI (Easiest)
claude mcp add cognee-http -t http http://localhost:8000/mcp
Verify the connection:
claude mcp list
You should see your server connected:
Checking MCP server health...
cognee-http: http://localhost:8000/mcp (HTTP) - ✓ Connected
Manual Configuration
Claude (~/.claude.json)
{
"mcpServers": {
"cognee": {
"type": "http",
"url": "http://localhost:8000/mcp"
}
}
}
Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"cognee-http": {
"url": "http://localhost:8000/mcp"
}
}
}
Dual Configuration Example
You can configure both transports simultaneously for testing:
{
"mcpServers": {
"cognee-sse": {
"type": "sse",
"url": "http://localhost:8000/sse"
},
"cognee-http": {
"type": "http",
"url": "http://localhost:8000/mcp"
}
}
}
Note: Only enable the server you're actually running to avoid connection errors.
🌐 Connection Modes
The MCP server supports three connection modes:
Direct Mode (Default)
The MCP server directly imports and uses the cognee library with local databases (SQLite, LanceDB, Ladybug). This is the default mode with full feature support.
Cloud Mode
Connect to Cognee Cloud or a remote Cognee instance. The server calls cognee.serve() at startup, and all SDK operations transparently route to the cloud. No local databases needed.
Via CLI flags:
python src/server.py --serve-url https://your-instance.cognee.ai --serve-api-key ck_...
Via environment variables (zero-config):
export COGNEE_SERVICE_URL="https://your-instance.cognee.ai"
export COGNEE_API_KEY="ck_..."
python src/server.py
Cloud Mode with Docker:
docker run \
-e TRANSPORT_MODE=sse \
-e COGNEE_SERVICE_URL=https://your-instance.cognee.ai \
-e COGNEE_API_KEY=ck_... \
-p 8000:8000 \
--rm -it cognee/cognee-mcp:main
Cloud Mode arguments / environment variables:
--serve-url/COGNEE_SERVICE_URL: Cognee Cloud or remote instance URL--serve-api-key/COGNEE_API_KEY: API key for the instance
Database migrations are automatically skipped in Cloud mode.
API Mode
The MCP server connects to an already running Cognee FastAPI server via HTTP requests. This is useful when:
- You have a centralized Cognee API server running
- You want to separate the MCP server from the knowledge graph backend
- You need multiple MCP servers to share the same knowledge graph
Starting the MCP server in API mode:
# Start your Cognee FastAPI server first (default port 8000)
cd /path/to/cognee
python -m cognee.api.client
# Then start the MCP server in API mode
cd cognee-mcp
python src/server.py --api-url http://localhost:8000 --api-token YOUR_AUTH_TOKEN
API Mode with different transports:
# With SSE transport
python src/server.py --transport sse --api-url http://localhost:8000 --api-token YOUR_TOKEN
# With HTTP transport
python src/server.py --transport http --api-url http://localhost:8000 --api-token YOUR_TOKEN
API Mode with Docker:
# On Mac/Windows (use host.docker.internal to access host)
docker run \
-e TRANSPORT_MODE=sse \
-e API_URL=http://host.docker.internal:8000 \
-e API_TOKEN=YOUR_TOKEN \
-p 8001:8000 \
--rm -it cognee/cognee-mcp:main
# On Linux (use host network)
docker run \
--network host \
-e TRANSPORT_MODE=sse \
-e API_URL=http://localhost:8000 \
-e API_TOKEN=YOUR_TOKEN \
--rm -it cognee/cognee-mcp:main
Command-line arguments for API mode:
--api-url: Base URL of the running Cognee FastAPI server (e.g.,http://localhost:8000)--api-token: Authentication token for the API (optional, required if API has authentication enabled)
Docker environment variables for API mode:
API_URL: Base URL of the running Cognee FastAPI serverAPI_TOKEN: Authentication token (optional, required if API has authentication enabled)
API Mode behavior:
The MCP server intentionally exposes only the memory API: remember, recall, and forget.
In API mode these tools call the Cognee API server endpoints directly. Operational helpers such ascognify, search, list_data, delete, prune, improve, and document retrieval helpers are
kept internal and are not exposed as MCP tools.
💻 Basic Usage
The MCP server exposes its functionality through tools. Call them from any MCP client (Cursor, Claude Desktop, Cline, Roo and more).
Available Tools
The MCP server exposes three tools:
- remember: Store data in memory. Pass
datafor text, orfilename+content_base64to ingest an uploaded file (up to 10 MB). Withsession_id: fast session cache (text only). Withoutsession_id: permanent graph memory - recall: Search memory with auto-routing. Searches session cache first when
session_idis provided, then falls through to the permanent graph - forget: Delete memory by dataset name or id, a single data item by
data_id, or delete all owned memory witheverything=True - cognify_status: Check the progress of background ingestion started by
remember(background=True). Unadvertised by default; discoverable viasearch_toolsand callable by name
Tool surface (COGNEE_MCP_TOOL_MODE)
Advertising every tool up front costs agent context and hurts tool-selection accuracy, so by default the server pins a small set in tools/list and makes the rest discoverable through FastMCP's built-in search_tools. Unadvertised tools stay callable by name.
COGNEE_MCP_TOOL_MODE=default # pinned: remember, recall, forget
COGNEE_MCP_TOOL_MODE=minimal # pinned: remember, recall, forget
COGNEE_MCP_TOOL_MODE=all # no search transform; advertise every tool
Also settable per-process with --tool-mode. In default/minimal an agent calls search_tools(query=...) to find a tool and either calls it by name or goes through the call_tool proxy. Tiers are declared per tool via @registry.tool(tags={...}) in src/server.py, so the pinned set is derived from the decorators rather than a separate list.
search_tools returns up to TOOL_SEARCH_MAX_RESULTS (10) tools, sized for a catalog that will grow. The window only costs context on turns that actually call search; tools/list stays constant either way. See tests/test_tool_search_benchmark.py for the recall sweep behind the number.
Writing a tool so search can find it
Search works well on natural-language queries. Every phrasing below returns its target ranked first (covered by tests/test_tool_search.py):
| query | returns |
|---|---|
| "is my background ingestion finished?" | cognify_status |
| "check the progress of a pipeline job" | cognify_status |
The one thing to know when adding a tool: matching is purely lexical. FastMCP's BM25 tokenizer does no stemming and drops tools that score zero, so a query shares no credit with a word it doesn't literally contain. Multi-word queries paper over this (they usually contain some matching token), which is why the table above passes, but terse queries won't.
So: write descriptions in the words an agent would use, including both singular and plural. Recall is bounded by vocabulary, not by TOOL_SEARCH_MAX_RESULTS. If lexical matching ever stops being enough, BaseSearchTransform leaves _search() abstract - a semantic ranker over cognee's own embeddings can be dropped in without touching the rest of the plumbing.
Agent Scoping (per-client default datasets)
By default, each MCP client gets its own auto-named dataset (e.g. Cursor → cursor_vscode_memory, Claude Code → claude_code_memory) so different agents don't share memory unintentionally. The dataset is created on demand the first time a client writes to it.
LLM-direct calls to cognify, remember, improve, and cognify_status route to the agent-scoped dataset when dataset_name is omitted. Pass dataset_name explicitly to override (e.g. dataset_name="main_dataset" still works).
To disable agent scoping and have all clients share main_dataset as the default, set in .env:
COGNEE_MCP_AGENT_SCOPED=false
When disabled, no per-client datasets are autocreated.
Per-dataset isolation (ENABLE_BACKEND_ACCESS_CONTROL)
Agent scoping decides which dataset name a tool defaults to. Whether two datasets are actually isolated at the storage layer is governed by cognee's ENABLE_BACKEND_ACCESS_CONTROL flag:
true(default) - each(user, dataset)pair gets its own per-dataset Kuzu + LanceDB under.cognee_system/databases/<dataset_uuid>/, and search is strictly per-dataset.false- all datasets share one Kuzu graph DB and one LanceDB. The dataset filter is honored for top-level data points, butGRAPH_COMPLETIONtraversal can pull connected nodes from any dataset. Use for single-user local dev; also disables the API auth requirement unlessREQUIRE_AUTHENTICATION=trueis set explicitly.
Switching modes wipes nothing automatically - but data does not migrate. Data ingested in one mode lives at a different on-disk path than the other and won't be visible after the flip. Clean-slate when changing the flag:
# Stop server, then:
DATA_ROOT="/absolute/path/to/data-root"
rm -rf "$DATA_ROOT/.cognee_system" "$DATA_ROOT/.data_storage"
# Edit .env to flip ENABLE_BACKEND_ACCESS_CONTROL, restart, re-cognify.
(Set DATA_ROOT to whatever you used for DATA_ROOT_DIRECTORY / SYSTEM_ROOT_DIRECTORY, or your cognee install dir if you didn't set those.)
Examples:
# Store permanent memory
remember(data="Cognee MCP now exposes a focused memory API.", dataset_name="main_dataset")
# Store session memory
remember(data="Temporary working note", session_id="agent-session-1")
# Recall from memory
recall(query="What changed in the MCP server?", session_id="agent-session-1")
# Delete one dataset
forget(dataset="main_dataset")
Development and Debugging
Debugging
Use the fastmcp CLI, not mcp. Since the FastMCP 3 migration this server is a
standalone fastmcp.FastMCP instance, which the mcp CLI does not recognise -mcp dev src/server.py fails with "Ignoring object 'src/server.py:mcp' as it's not a
valid server object".
Inspect the server without launching anything (fast sanity check - name, version, tool count):
uv run fastmcp inspect src/server.py:mcp
Run it against the MCP Inspector UI:
uv run fastmcp dev src/server.py:mcp
Open the inspector with a longer timeout - cognee's first call can be slow while the
databases initialise:
http://localhost:5173?timeout=120000
To apply new changes while developing cognee:
- Update dependencies in the cognee folder if needed
uv sync --group dev --reinstalluv run fastmcp dev src/server.py:mcp
The
:mcpsuffix names the server object in the file. Without it the CLI has to guess,
and the guess is not reliable across FastMCP versions.
Development
In order to use local cognee:
Uncomment the following line in the cognee-mcp
pyproject.tomlfile and set the cognee root path.#"cognee[postgres-binary,docs,neo4j] @ file:/path/to/your/cognee"Replace
/path/to/your/cogneewith the absolute path to your cognee checkout, and
comment out the released"cognee[...]>=1.5.0,<2.0.0"line directly below it -
otherwise both requirements apply and uv resolves the published package instead.Install dependencies with uv in the mcp folder
uv sync --reinstallRe-run this after every change to the local cognee checkout.
Note: editing that line modifies the tracked
pyproject.tomland rewritesuv.lockwith a machine-local absolute path. Revert both before committing -git checkout -- pyproject.toml uv.lock- or the path leaks into the repo.
💫 Contributors
Star History
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.