Cognee

by topoteretes

Community Data Science & ML 30k likes

Cognee's MCP server gives an agent a remember/recall/forget memory API backed by a real knowledge graph, with a fast session cache for anything that doesn't need to persist.

Run with Docker

docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main

Source: https://github.com/topoteretes/cognee

About

Cognee-mcp runs Cognee's memory engine (normally a self-hosted knowledge-graph platform) as an MCP server with a deliberately small core API: remember stores data, recall searches it with auto-routing, and forget deletes it by dataset (or everything a client owns). The routing detail matters: pass a session_id and remember/recall hit a fast in-memory session cache; leave it off and the same calls go into cognee's permanent graph memory instead, so an agent can mix short-lived scratch memory with long-term recall through the same three verbs.

Beyond the core memory API, it exposes workspace tools: visualize_graph_ui opens a UI rendering of the current knowledge graph, and upload_file_ui and cognify_file handle getting a file into the system and ingested, plus dataset-management helpers. It supports stdio, SSE, or Streamable HTTP transports, and ships a Docker image if you'd rather not run the Python server directly.

Key features

  • Minimal remember / recall / forget API instead of a large, granular tool surface
  • session_id routing: with it, fast in-memory cache; without it, permanent graph memory
  • visualize_graph_ui renders the current knowledge graph in a browsable workspace UI
  • File ingestion tools (upload_file_ui, cognify_file) for adding documents into memory
  • Supports stdio, SSE, and Streamable HTTP transports plus a ready-made Docker image
  • Session-aware logging built in for tracing what an agent stored or retrieved and when

Use cases

  • Giving an agent memory that survives across sessions instead of resetting with every new conversation
  • Mixing short-lived scratch memory (via session_id) with durable long-term facts in the same API
  • Ingesting a batch of documents and later recalling facts from them by natural-language query
  • Visually inspecting what an agent has actually learned and stored via the graph workspace UI

Available tools

remember

Stores data in memory: session cache if session_id is passed, permanent graph memory otherwise.

recall

Searches memory with auto-routing: checks the session cache first, then falls back to the permanent graph.

forget

Deletes memory by dataset name, or everything a client owns if everything=True.

cognify_file

Ingests an uploaded file into the knowledge graph.

visualize_graph_ui

Opens the workspace UI to render the current knowledge graph.

Frequently asked questions

What's the difference between session memory and permanent memory?

Passing a session_id to remember/recall routes through a fast in-memory cache for that session only. Omitting it stores or searches the permanent knowledge graph instead, so the same two tools cover both.

Do I need an LLM API key to run it?

Yes. Cognee's memory engine uses an LLM for extraction and querying, so an .env with LLM_API_KEY (OpenAI by default) is required before starting the server.