cognee-mcp
This server lets MCP clients manage agent memory and inspect indexed code graphs.
Store permanent graph memory or fast session-cache memory with
remember, including text or base64 file uploads up to 10 MB, optional datasets/node sets/ontologies/custom prompts, background ingestion, and self-improvement controls.Search memory with
recallusing natural-language queries, auto-routing, session-first search, dataset scoping, top-k limits, search-type overrides, optional references for later deletion, and optional code-graph queries.Query indexed source-code structure with
code_searchusing operations such asquery_facts,explore,traverse,find_path,impact_analysis,architecture,delta,search, andask.Delete one data item, an entire dataset, or all owned memory with
forget, optionally clearing search/recall history.Discover and invoke additional tools dynamically through
search_toolsandcall_tool.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cognee-mcp ingest my project documentation from the docs folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cognee‑mcp - Run cognee’s memory engine as a Model Context Protocol server
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 workflowsIntegrated 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
remembertoolFocused recall – query memory through one
recalltool with optional session and search controlsCode graph search – inspect indexed symbols, dependencies, architecture, and change impact with
code_searchSimple deletion – remove one data item, a dataset, or all owned memory through one
forgettool
Please refer to our documentation here for further information.
Code graph search
Use code_search for deterministic queries against an indexed code dataset. Select an operation and pass its operation-specific filters in arguments:
{
"operation": "query_facts",
"arguments": {"kinds": ["module", "symbol"], "limit": 100},
"datasets": "sample-code-dataset"
}Supported operations are query_facts, explore, traverse, find_path, impact_analysis, insights, architecture and delta, plus the navigation operations capabilities, search, neighbors, subgraph, flows, hubs and ask. search and ask take a question in plain words as query.
Related MCP server: remembrallmcp
🚀 Quick Start
Clone cognee repo
git clone https://github.com/topoteretes/cognee.gitNavigate to cognee-mcp subdirectory
cd cognee/cognee-mcpInstall uv if you don't have one
pip install uvInstall all the dependencies you need for cognee mcp server with uv
uv sync --dev --all-extras --reinstallActivate the virtual environment in cognee mcp directory
source .venv/bin/activateSet 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)
python src/server.pyor stream responses over SSE
python src/server.py --transport sseor run with Streamable HTTP transport (recommended for web deployments)
python 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 processingtracing- OpenTelemetry tracingredis- Redis supportAnd 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:mainNote: 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:mainOn 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:mainEnvironment 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 RequestAn
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:mainConfigure your MCP client:
Claude CLI (Easiest)
claude mcp add cognee-sse -t sse http://localhost:8000/sseVerify the connection:
claude mcp listYou should see your server connected:
Checking MCP server health...
cognee-sse: http://localhost:8000/sse (SSE) - ✓ ConnectedManual 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:mainConfigure your MCP client:
Claude CLI (Easiest)
claude mcp add cognee-http -t http http://localhost:8000/mcpVerify the connection:
claude mcp listYou should see your server connected:
Checking MCP server health...
cognee-http: http://localhost:8000/mcp (HTTP) - ✓ ConnectedManual 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.pyCloud 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:mainCloud 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_TOKENAPI 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_TOKENAPI 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:mainCommand-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 (plus the cognify_status progress check).
In API mode these tools call the Cognee API server endpoints directly. Operational helpers such as
cognify, 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 four tools (three memory tools pinned in tools/list, plus cognify_status):
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 memoryrecall: Search memory with auto-routing. Searches session cache first when
session_idis provided, then falls through to the permanent graphforget: Delete memory by dataset name or id, a single data item by
data_id(paired with itsdataset_id, both shown byrecallwithinclude_references=True), or delete all owned memory witheverything=Truecognify_status: Check the progress of background ingestion started by
remember(background=True). Unadvertised by default; discoverable viasearch_toolsand callable by name
Recall result summaries
recall (the MCP memory-search tool) starts every successful response with a
summary, followed by the same result body as before:
3 memories found (2 from sessions, 1 from project docs)
[session] ...The count is the number of returned memory entries, not top_k, underlying
chunks used to synthesize an answer, or system status messages. Source and dataset
hints use metadata already present in the returned entries; no recency lookup or
extra LLM call is made.
Empty results distinguish an empty memory graph, indexing in progress, indexing
failure, and no match. When available, progress is displayed as, for example,
still indexing — 12/40 items processed, retry shortly. These are data items,
not an inferred chunk count. A graph with no recorded indexing run is reported
as not yet indexed. If the status check fails or exceeds its two-second budget,
the summary explicitly says memory status is unavailable. Successful hits do
not trigger status checks.
The MCP content remains a single TextContent block. Text consumers can separate
line one from the unchanged body with text.partition("\n"). Machine consumers
can read content[0]._meta["cognee/memory"], containing count and state.
state is one of four values, one per action a caller can take:
state | meaning |
| memory contributed; |
| ingestion is still running — retry shortly |
| ingestion failed — check |
| nothing to return |
indexing additionally carries completed/total when the pipeline reports
them. Tool errors retain their existing Error: response.
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 toolAlso 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?" |
|
"check the progress of a pipeline job" |
|
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.
remember and cognify_status route to the agent-scoped dataset when dataset_name is omitted (the internal cognify/improve helpers, which are not exposed as tools, do the same). 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=falseWhen 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 permanent memory without the automatic improve stage (add + cognify still run)
remember(data="A new fact", dataset_name="main_dataset", self_improvement=False)
# The opt-out also applies to file uploads and background=True ingestion
remember(data="A new fact", self_improvement=False, background=True)
# Store session memory without a background graph bridge in direct mode
remember(data="Temporary working note", session_id="agent-session-1", self_improvement=False)
# Recall from memory
recall(query="What changed in the MCP server?", session_id="agent-session-1")
# Delete one dataset
forget(dataset="main_dataset")
# Forget one item: recall it with references, then forget it by its ids
recall(query="What is the vault recovery phrase?", include_references=True)
# -> [graph] amber-falcon-42
#
# Evidence:
# - chunk 1 of document text_<hash> (data_id: <uuid>, chunk_id: <uuid>): "The vault recovery phrase is ..."
# dataset: main_dataset (dataset_id=<uuid>)
forget(data_id="<uuid>", dataset_id="<uuid>")include_references=True shows the ids forget needs; without it the output is
unchanged. The default answer cites its sources in an Evidence: block (best
match first) and gets a dataset: line. CHUNKS, SUMMARIES, RAG and
graph-completion hits get refs: data_id=..., dataset_id=..., document=...
lines instead (at most five per hit, best match first). A chunk hit names the
one item its text came from, while a graph-completion answer lists every item
in its context, so use the default type or search_type="CHUNKS" to find one
fact. Session hits are not stored data and carry no ids. With backend access
control off, ids are only shown when recall is scoped to a single dataset.
self_improvement defaults to True; only an explicit False is forwarded, so
True leaves the core default in charge. In permanent mode, False disables
automatic improvement without skipping ingestion or graph building.
In direct session mode, it disables the automatic session-to-graph bridge while
still storing the session entry. In API session mode, MCP uses typed QA entries,
which stay in the session cache for all flag values; the flag does not enable a
graph bridge there. It does not control separately requested skill improvement.
Select an uploaded ontology for a write
Pass ontology_key to remember to ground permanent-memory extraction with one
or more previously uploaded OWL ontologies:
remember(data="Alice works at Acme.", dataset_name="workspace_a", ontology_key="workspace_a_v2")
remember(
data="Acme develops software.",
ontology_key=["organizations", "software"],
background=True,
)In API mode, upload the ontologies first through POST /api/v1/ontologies using
the same authenticated user as the MCP server. Keys are sent as repeated
ontology_key form fields. In local mode, keys resolve through OntologyService
in the default user's ontology store under this instance's data root (a local
folder or an s3:// prefix); uploads to a remote instance are not copied into it.
Unknown or inaccessible keys fail the write. Background failures are reported by
cognify_status.
Omitting ontology_key (or passing an empty list) preserves the configured
server ontology, including ONTOLOGY_FILE_PATH. Ontology selection is only for
permanent writes: combining a nonempty key with session_id returns an error
because session-cache writes do not perform extraction.
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:mcpRun it against the MCP Inspector UI:
uv run fastmcp dev src/server.py:mcpOpen the inspector with a longer timeout — cognee's first call can be slow while the databases initialise:
http://localhost:5173?timeout=120000To 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.
Code of Conduct
We are committed to making open source an enjoyable and respectful experience for our community. See CODE_OF_CONDUCT for more information.
💫 Contributors
Star History
Available Tools
6 toolscall_toolA
Call a tool by name with the given arguments.
Use this to execute tools discovered via search_tools.
Inputs: name (required), arguments.
code_searchA
Search Cognee's indexed code graph with a structured operation.
This tool is for source-code structure, symbols, call/dependency paths,
impact, architecture, and index changes. It does not search conversational
memory. Choose an operation and pass its operation-specific fields in
arguments. For example, use operation="query_facts" with
arguments={"kinds": ["module", "symbol"], "limit": 100}, or
operation="impact_analysis" with arguments={"seeds": ["UserService"]}.
For a question in plain words ("how does checkout work?"), use
operation="ask" with the question as query: it returns matching
symbols, entry-point flows, their neighbourhood and file:line citations.
Inputs: operation (required), query, top_k, datasets, +1 more. Returns: result
forgetA
Delete data from memory.
Can target a single data item, a specific dataset (by name or id), or everything the user owns. Removes data from the relational DB, graph DB, and vector DB.
Inputs: data_id, dataset, dataset_id, everything, +1 more. Returns: result
recallA
Search memory with auto-routing and session awareness.
When session_id is provided without datasets or search_type, searches session cache first by keyword matching. Falls through to the permanent knowledge graph if no session results match.
Auto-routing picks the best search strategy when search_type is not specified.
Inputs: query (required), scope, top_k, datasets, +5 more. Returns: result
rememberA
Store data in memory.
Two modes depending on whether session_id is provided:
Without session_id (permanent memory): Runs the full add + cognify pipeline to ingest data and build the knowledge graph, then the self-improvement loop (improve) unless self_improvement=False.
With session_id (session memory): Stores the data in the session cache. Direct mode may also bridge it to the graph in the background; API mode uses typed cache entries and does not bridge to the graph. Omit session_id when the content should be stored as permanent graph memory.
Pass either data (text) or filename + content_base64 (a file
upload, up to 10 MB), not both. File uploads are permanent-memory
only and don't support session_id.
Inputs: data, filename, node_set, background, +6 more. Returns: result
search_toolsA
Search for tools using natural language.
Returns matching tool definitions ranked by relevance, in the same format as list_tools.
Inputs: query (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
The core memory verbs (remember/forget/recall) are cleanly separated by write/delete/read semantics, and the meta-pair search_tools/call_tool is unambiguous. The only mild overlap is recall vs code_search, since both are retrieval tools, but code_search explicitly scopes itself to the code graph and excludes conversational memory, which resolves most confusion.
All names are snake_case and fall into two coherent families: bare verbs for memory operations (remember, forget, recall) and verb_noun for infrastructure (call_tool, search_tools, code_search). This is a defensible grouping rather than chaos, though the bare-verb vs verb_noun split keeps it from being a fully uniform pattern.
Six tools is well within the sweet spot and each one covers a distinct responsibility: store, retrieve, delete, code-graph query, plus dynamic tool discovery and invocation. Nothing feels padded or missing at the surface-count level.
The lifecycle is largely covered: remember (create), recall (read), forget (delete), and a specialized code_search, with file upload and session modes handled via parameters. Gaps exist around explicitly updating existing memory and enumerating datasets/items (forget accepts a dataset name/id but nothing lists them), which agents can work around by re-storing or semantic recall.
Maintenance
Related MCP Connectors
Persistent memory for AI agents. Semantic search, memory graph, W3C DID identity.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Universal memory for AI agents and tools. Save, organize and search context anywhere.
Shared memory for AI agents, as a graph in your own Postgres. Writes never call an LLM.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to store, retrieve, and connect information in a Neo4j graph database as persistent memory, with semantic relationships, natural language search, and temporal tracking across conversations.9150 npm67MIT
- AlicenseNot gradedqualityCmaintenancePersistent knowledge memory layer for AI agents. Hybrid semantic + full-text search with pgvector, code dependency graph with blast-radius impact analysis, and incremental indexing for 7 languages. In-process ONNX embeddings, no external API required.34MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent knowledge graph memory for AI agents, enabling them to store, recall, and query facts about people, projects, and relationships across sessions.MIT
- AlicenseNot gradedqualityFmaintenanceEnables LLMs to store, search, and manage memories with hybrid semantic and keyword search using ChromaDB and Neo4j for persistent memory and knowledge graph capabilities.MIT