Cognify MCP Server
Enables document ingestion and typed knowledge graph queries through Claude MCP tools, allowing agents to extract, store, and retrieve typed entities and relations from documents.
README
Cognify
A lightweight document-ingestion and typed knowledge-graph engine you can hand to an agent. Drop in raw documents, get back a queryable graph of typed entities and relations plus hybrid (vector + graph) retrieval.
Two interchangeable backends behind one API:
| backend | vectors | graph | needs | use |
|---|---|---|---|---|
local (default) |
ChromaDB (ONNX MiniLM) | networkx | nothing external, no torch | drop into an agent box |
neo4j |
TurboVec | Neo4j | a Neo4j instance | shared/server graph |
Same 384d embedding space on both, so retrieval behaves identically.
Why not plain RAG
Plain RAG embeds chunks and does similarity search. Cognify also asks a cheap LLM
to extract typed entities (Person, Project, Technology, ...) and typed
relations (USES, WORKS_AT, BUILT, ...) from every chunk, builds a graph,
and expands that graph around your search hits. You get the facts and how they
connect, which is what makes multi-hop questions work.
How it compares
| Cognify | Cognee | Mem0 | Graphiti / Zep | LightRAG | plain RAG | |
|---|---|---|---|---|---|---|
| Typed entity+relation graph | ✅ | ✅ | partial (dropped graph) | ✅ (temporal) | ✅ | ❌ |
| Runs with zero external services | ✅ (ChromaDB+networkx) | ❌ (Kuzu file-lock; Neo4j for multi-agent) | ❌ (hosted/Qdrant) | ❌ (Neo4j) | ⚠️ | ✅ |
| Torch-free local install | ✅ (ONNX embedder) | ❌ | ❌ | ❌ | ❌ | varies |
| Same API, swap local ↔ server | ✅ | ⚠️ | ❌ | ❌ | ❌ | n/a |
| Built-in multi-tenancy | ✅ (every node) | ⚠️ | ✅ | ✅ | ❌ | ❌ |
| MCP server for Claude | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Lines of core code | ~1k, readable | large | large | large | medium | tiny |
| Reconstruction spec for agents | ✅ BLUEPRINT.md |
❌ | ❌ | ❌ | ❌ | ❌ |
Where each wins, honestly. Graphiti/Zep is the choice if you need temporal fact-tracking and SOC2/HIPAA compliance. Cognee has more managed connectors and a cloud tier. Mem0 is simplest for pure conversational memory. Cognify wins when you want a real typed graph that an agent can run anywhere — a laptop, an isolated box, or a shared server — with one dependency-light install, one API across backends, and code small enough to read in a sitting. It is the embed-it-in-your-agent option, not the managed-platform option.
Why it's so lightweight
- Default backend needs nothing external — ChromaDB (embedded) + a networkx graph in a JSON file. No database server, no Docker, no cloud.
- No PyTorch — embeddings come from ChromaDB's bundled ONNX MiniLM. The whole default install is small and CPU-only.
- The LLM is the only heavy lift, and it's remote — entity/relation extraction is one cheap API call per chunk; nothing large runs locally.
- ~1k lines of pure-function code, src layout, one file per concern. The backend protocol is four methods; adding a store is one file.
- Scales by swapping a backend, not rewriting — move to TurboVec + Neo4j for a shared graph by changing one env var; the same embeddings and API carry over.
Pipeline (ECL)
ingest(doc) -> Extract: file/text -> heading-aware ~512-token chunks
Cognify: per chunk, cheap LLM -> typed entities + relations
Load: embed chunks (384d) -> vectors ; write graph
recall(q) -> vector search (tenant-scoped) -> expand graph -> chunks + subgraph
Quickstart
./setup.sh local # venv + deps + .env
source .venv/bin/activate
echo 'OPENROUTER_API_KEY=sk-or-...' >> .env
set -a && . ./.env && set +a
cognify ingest examples/sample_docs/acme.md --tenant demo
cognify recall "what does Pathfinder run on and who owns it?" --tenant demo
cognify stats --tenant demo
Python:
import cognify
be = cognify.get_backend("local")
cognify.ingest(be, "handbook.pdf", tenant="acme", namespace="hr")
res = cognify.recall(be, "who owns onboarding?", tenant="acme")
print(res.entities, res.relations)
Use with Claude
Claude as the extractor — just set the key (auto-detected):
pip install 'cognify-kg[local]'
export ANTHROPIC_API_KEY=sk-ant-...
cognify ingest notes.md --tenant demo && cognify recall "what connects to X?" --tenant demo
Cognify as MCP tools in Claude Code / Desktop:
pip install 'cognify-kg[local,claude]'
claude mcp add cognify -- cognify-mcp
Claude then has cognify_ingest, cognify_recall, cognify_stats. Details in
integrations/claude/.
Use with Hermes (and any agent runtime)
The cognify CLI works as-is — a Hermes agent shells out to it. Drop
integrations/hermes/SKILL.md into the agent's skills. Or run the HTTP server for
a shared/long-running graph:
pip install 'cognify-kg[serve]'
cognify-serve # 127.0.0.1:8799
curl -s localhost:8799/recall -d '{"query":"refund policy?","tenant":"acme"}' -H 'content-type: application/json'
Multi-tenancy
Every node carries a tenant (and namespace). Pass a different tenant per
client/agent and their data stays isolated: the local backend is a separate
store, the neo4j backend filters every query by tenant. This is what makes it
safe to run one engine across many agents.
Recommended models (extraction)
Extraction is one cheap LLM call per chunk; pick by cost vs throughput. Numbers below are from a real single-chunk extraction test, not vendor specs.
| Model | Via | Cost (rough) | Notes |
|---|---|---|---|
openai/gpt-4o-mini |
OpenRouter / OpenAI | ~$0.15/$0.60 per M | Recommended default. Fast (~6s/chunk), reliable JSON. A 40-doc KB cost ~$0.20. |
google/gemini-2.0-flash |
OpenRouter / Google | ~$0.10/$0.40 per M | Cheapest solid cloud option; big context. Google free tier rate-limits (429) — use a paid key for bulk. |
deepseek/deepseek-chat |
OpenRouter | ~$0.14/$0.28 per M | Same quality as gpt-4o-mini but ~3× slower (~17s/chunk). Fine for small batches. |
| local Qwen / Llama 3.3 / Gemma | Ollama / vLLM | free | The real free path for bulk. Run on your own GPU; point COGNIFY_LLM_BASE at it. |
| Claude Haiku | Anthropic (native) | cheap | Set ANTHROPIC_API_KEY; auto-detected. Highest extraction quality of the cheap tier. |
Avoid OpenRouter's :free model variants for bulk — they are heavily
rate-limited (429) or very slow (one free model measured ~77s/chunk). Free is
only practical on local inference.
Switch model with one env var, e.g. local Ollama:
export COGNIFY_LLM_BASE=http://localhost:11434/v1
export COGNIFY_LLM_MODEL=qwen2.5:14b
export COGNIFY_LLM_KEY=ollama # any non-empty string
Configuration
All via env (see .env.example): COGNIFY_BACKEND, COGNIFY_DATA_DIR,
COGNIFY_LLM_BASE/MODEL/KEY, COGNIFY_LLM_PROVIDER, NEO4J_URI/USER/PASSWORD.
The LLM endpoint is OpenAI-compatible (OpenRouter, OpenAI, vLLM, Ollama) or native
Anthropic (Claude). See the model table above.
For agents
CLAUDE.md is the operating guide. ARCHITECTURE.md explains the design.
BLUEPRINT.md is a from-scratch reconstruction spec: hand this repo to an agent
and it can rebuild or extend the whole thing.
MIT licensed.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。