knowledgeGraph MCP server
2026년 10월 16일 커밋시맨틱 임베딩과 자동 메모리 감쇠 및 성장 기능을 갖춘 지식 그래프를 통해 AI agent를 위한 장기 메모리 시스템을 제공합니다.
다른 이름 ChenLiangChong/knowledgeGraph
- 스타
- 6
- Tools
- 12
- 다운로드, 30일
- —
- 최신 버전
- —
- 마지막 커밋
- 2026년 10월 16일
- 라이선스
- MIT
knowledgeGraph MCP란?
knowledgeGraph은(는) MCP server입니다. 시맨틱 임베딩과 자동 메모리 감쇠 및 성장 기능을 갖춘 지식 그래프를 통해 AI agent를 위한 장기 메모리 시스템을 제공합니다. 12개 도구를 제공합니다. 예: store_knowledge, connect_knowledge, update_knowledge.
프로젝트 README에서 생성된 요약
knowledgeGraph MCP server 정보
이 MCP server는 구조화된 지식 그래프를 통해 AI agent에게 장기 메모리를 제공합니다. agent는 지속적인 학습과 지식 진화를 통해 소프트웨어 엔지니어링이나 의료 진단과 같은 도메인 전문 지식을 축적함으로써 수습 단계에서 전문가 단계로 나아갈 수 있습니다. 시스템은 로컬 Qwen3-Embedding-0.6B ONNX 모델을 통한 시맨틱 임베딩을 사용하여 외부 API 의존성 없이 개인정보 보호와 오프라인 기능을 보장합니다.
개발자는 로컬 Node.js 설정을 사용하여 이를 워크플로우에 통합하고 MCP 설정 파일 내에서 구성할 수 있습니다. 아키텍처는 SQLite와 sqlite-vec 및 FTS5를 활용하여 벡터, 키워드, 그래프 기반 검색을 결합한 하이브리드 검색 시스템을 관리합니다. FSRS 및 Benna-Fusi에서 영감을 받은 정교한 메모리 감쇠 및 성장 메커니즘을 특징으로 하여, 기본 원칙은 안정적으로 유지하면서도 창의적이거나 추론된 지식은 사용 및 검증에 따라 진화하거나 감쇠할 수 있도록 합니다. 자동화는 auto-recall, 수정 감지, 메모리 통합과 같은 작업을 관리하는 6개의 라이프사이클 훅을 통해 이루어집니다.
활용 사례
- 1도메인 전문 지식 축적AI agent는 멘토링을 통해 전문적인 관행을 학습하고 이를 지속 가능한 지식으로 점진적으로 내재화할 수 있습니다.
- 2AI 환각 방지원칙에 대해 정확한 인용을 요구하고 추론이 인과 관계 엣지를 생성하는 것을 방지하여 환각 현상으로부터 시스템을 보호합니다.
- 3메모리 관리 자동화개발자는 훅을 사용하여 지식 검색을 자동으로 트리거하거나 응답 종료 시 새로운 학습 내용을 캡처할 수 있습니다.
- 4하이브리드 지식 검색 수행사용자는 시맨틱 의미, 정확한 키워드, 인과 관계를 조합하여 정보를 검색할 수 있습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
knowledgeGraph MCP 도구 12
README에서 감지됨store_knowledgeconnect_knowledgeupdate_knowledgeforget_knowledgesearch_memorytraverse_graphlist_knowledgerecord_experiencerecall_experiencemaintain_graphcrystallize_skillmemory_stats
| store_knowledge | — | |
| connect_knowledge | — | |
| update_knowledge | — | |
| forget_knowledge | — | |
| search_memory | — | |
| traverse_graph | — | |
| list_knowledge | — | |
| record_experience | — | |
| recall_experience | — | |
| maintain_graph | — | |
| crystallize_skill | — | |
| memory_stats | — |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능chenliangchong/knowledgegraph is public and reachablegithub.com/chenliangchong/knowledgegraph ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)검사되지 않음
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-10-16github.com/chenliangchong/knowledgegraph ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음검사되지 않음
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
- 모델에 대한 숨겨진 지침 없음12 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨No tool named like delete, drop or exec통과
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기Knowledge Graph MCP Server
繁體中文 | English
Long-term memory system for AI agents. Enables agents to accumulate domain expertise through mentorship or professional practice, automatically recall relevant knowledge, and grow from apprentice to independent expert.
Works with any domain requiring continuous learning + knowledge evolution: software engineering, music production, design, medical diagnosis, legal analysis, etc. Any scenario with an "expert teaches → student practices → gradual internalization" knowledge transfer pattern.
Why This Exists
Claude starts every conversation from zero. In professional apprenticeship-style teaching:
- Expert lessons are forgotten — context compaction drops critical lessons, same mistakes repeat
- AI fabricates terminology — without ground truth, it over-generalizes from single demonstrations
- Knowledge can't evolve — new teachings can't replace contradicted old knowledge
- Search is path-dependent — rephrasing a question yields no results
- Forever a student — no mechanism for the AI's own discoveries to become durable knowledge
Installation
cd mcp/knowledge-graph
npm install
On first startup, the Qwen3-Embedding-0.6B ONNX model (~560MB) is automatically downloaded (one-time only).
MCP Configuration
In your project's .mcp.json:
{
"mcpServers": {
"knowledge-graph": {
"command": "node",
"args": ["/absolute/path/to/mcp/knowledge-graph/main.js"]
}
}
}
Hook Configuration
Add hooks to ~/.claude/settings.json (see Hooks section for full configuration).
Import Existing Knowledge (Optional)
node scripts/import-skills.js <skills-directory> # Import markdown files as KG nodes
node scripts/backfill-embeddings.js # Add vector indexes + structural edges
node scripts/backfill-decay.js # Add stability + memory_level + category
Core Design
Why Build From Scratch
After researching 25+ Claude Code memory systems (Claude-Recall, A-MEM, Mnemon, Graphiti, memsearch, etc.), none simultaneously satisfied:
| Requirement | Existing Solutions | This System |
|---|---|---|
| Domain-specific edge types | Generic edges only | 10 semantic edge types (must_precede, aligns_to, etc.) |
| Trust level distinction | No source differentiation | principle (expert-taught) > pattern (observed) > inference (AI-guessed) |
| Anti-fabrication | No protection | principle requires expert's exact quote |
| Fundamentals vs creative space | Treated equally | fundamental never decays, creative is challengeable |
| Memory decay + growth path | Decay exists but no growth | FSRS desirable difficulty + Benna-Fusi 4-level cascade |
| Automation | Depends on user action | 6 hooks covering full lifecycle |
Inspiration Sources
| Source | What We Borrowed |
|---|---|
| Claude-Recall | Hook architecture (search enforcer, correction detector) |
| A-MEM | Edge data model (relation_type + reasoning + weight) |
| CortexGraph | Two-component decay (fast + slow exponential, more realistic than single decay) |
| FSRS (Anki) | Desirable difficulty (fading memories gain MORE stability when recalled) |
| Benna-Fusi | Memory cascade (4-level durability, independent of knowledge source) |
| Stanford Generative Agents | Three-signal retrieval (recency + importance + relevance) |
| Graphiti/Zep | Temporal awareness (valid_from / valid_until) |
Three-Layer Architecture
┌──────────────────────────────────────────────────┐
│ Layer 1: Persona (CLAUDE.md) │
│ Agent identity + behavioral rules │
│ → Loaded every turn for consistent behavior │
├──────────────────────────────────────────────────┤
│ Layer 2: Memory (Knowledge Graph MCP) │
│ SQLite + sqlite-vec + FTS5 │
│ 12 MCP tools + hybrid search │
│ → On-demand, doesn't consume context │
├──────────────────────────────────────────────────┤
│ Layer 3: Automation (Hooks) │
│ 6 hooks covering full lifecycle │
│ → Expert doesn't need to remind, fully automatic │
└──────────────────────────────────────────────────┘
Memory Decay & Growth System
Design Philosophy
Apprentice phase: Expert's words carry highest weight → learn fundamentals
Growth phase: Own observations get validated → develop judgment
Expert phase: Own inferences confirmed by practice → form independent views
Trust is a source label (who said it), not a permanent rank. AI's own validated knowledge can become equally durable.
Decay: CortexGraph Two-Component × FSRS Stability
R = W_fast × e^(-λ_fast × t) + W_slow × e^(-λ_slow × t)
- Fast decay (half-life = S days): "newly learned things are easily forgotten"
- Slow decay (half-life = S×10 days): "what survives is remembered for a long time"
- S (stability): initialized by trust + category, grows on access via FSRS
Why not pure exponential or pure power-law: pure exponential forgets too fast, pure power-law retains too much. Two-component blend best fits human forgetting data.
| Knowledge Type | Initial S | Fast Half-Life | Slow Half-Life |
|---|---|---|---|
| Fundamental (has right/wrong) | 365 days | — | — |
| Expert's creative choice | 30 days | 30d | 300d |
| Observed pattern | 7 days | 7d | 70d |
| AI inference | 3 days | 3d | 30d |
Reinforcement: FSRS Desirable Difficulty
stabilityGain = e^(1 - R) × gradeMultiplier
Core insight (from FSRS analysis of millions of Anki reviews): A fading memory that gets recalled gains MORE stability than a fresh one.
- R = 0.9 (just accessed) → 1.11× growth
- R = 0.3 (almost forgotten) → 2.01× growth
Grade sources:
- 4 = Successfully applied (Auto-Capture detects no correction)
- 3 = Normal access
- 1 = Corrected by expert
Growth Path: Benna-Fusi Memory Cascade
Trust (source label) stays unchanged; memory_level (durability) grows independently:
| Level | Condition | Auto-expire? |
|---|---|---|
| 1 New | Default | ✅ when R < 0.02 |
| 2 Verifying | Accessed across 3+ sessions | ✅ when R < 0.02 |
| 3 Consolidated | 14 days + access ≥ 5 | ❌ Never |
| 4 Core | Fundamental, or access ≥ 50 | ❌ Never |
An inference node accessed 50 times reaches level 4 — as durable as a fundamental principle.
Fundamentals vs Creative Space
| Type | metadata.category | Behavior |
|---|---|---|
| Fundamental | "fundamental" |
R = 1.0, never decays. Has right/wrong answers |
| Creative | "creative" |
Can decay, can be challenged. No right/wrong, only fit |
Search System
Hybrid Three-in-One Search
score = 0.4 × vector + 0.2 × keyword + 0.3 × graph + memoryScore
| Layer | Mechanism | Strength |
|---|---|---|
| Vector | sqlite-vec cosine KNN (Qwen3 1024d) | Same meaning, different words |
| Keyword | FTS5 BM25 (unicode61) | Exact match, multilingual |
| Graph | Recursive CTE, 1-hop expansion | Causal relationships |
| memoryScore | R × 0.1 + levelBonus | More used = more important |
Embedding Design
- Model: Qwen3-Embedding-0.6B (ONNX quantized, ~560MB)
- Runs locally: Zero API dependency, works offline
- Why Qwen3: #1 on MTEB multilingual leaderboard, #1 on C-MTEB (Chinese)
- Embeds:
name + content(full text) — vector handles semantic matching, keyword handles exact matching, clear separation of concerns
Anti-Fabrication
AI tends to treat its own guesses as facts. Protection rules:
| Rule | Mechanism |
|---|---|
| Principle requires quote | No expert's exact words → rejected |
| Inference can't create causal edges | must_precede / reason_for reject inference nodes |
| Trust never auto-upgrades | Inference won't become principle (needs expert confirmation + quote) |
| Level is independent of trust | Inference can consolidate to level 4 but still labeled "AI's idea" |
Tools (12)
Knowledge Management
| Tool | Purpose |
|---|---|
store_knowledge |
Store a knowledge node. Auto embedding/FTS + suggests edges + initializes decay params |
connect_knowledge |
Create a causal edge. Includes anti-fabrication validation |
update_knowledge |
Update node in-place. Preserves ID and all edges, auto-updates indexes |
forget_knowledge |
Mark as expired. Auto-expires edges + cleans indexes |
Search
| Tool | Purpose |
|---|---|
search_memory |
Hybrid search (vector + keyword + graph + memoryScore) |
traverse_graph |
Walk causal edges (supports direction/depth/edge type filtering) |
list_knowledge |
List by filters (trust/type/element/source, sort by time/access/strength) |
Experience
| Tool | Purpose |
|---|---|
record_experience |
Record workflow trace (steps + decisions + outcomes) |
recall_experience |
Find similar past experiences by context |
Maintenance
| Tool | Purpose |
|---|---|
maintain_graph |
Memory Enzyme — prune / merge / validate / orphan |
crystallize_skill |
Check KG-to-skill-file sync status |
memory_stats |
Graph statistics |
Hooks (Automation)
Lifecycle Coverage
[New Session]
└─ session-start → auto-repair + memory decay + consolidation detection + edge review
[User Sends Message]
└─ auto-recall → query KG → inject relevant knowledge
→ correction detector → detect corrections
[AI About to Act]
└─ search-enforcer → block operations without prior memory search (in specific modes)
[AI Finishes Response]
└─ auto-capture → analyze learning signals → block → main Claude stores via MCP
[Context Compaction]
└─ post-compact → re-inject core knowledge
settings.json Example
{
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [{
"type": "command",
"command": "node /path/to/hooks/session-start.js",
"timeout": 10
}]
},
{
"matcher": "compact",
"hooks": [{
"type": "command",
"command": "node /path/to/hooks/post-compact.js",
"timeout": 10
}]
}
],
"UserPromptSubmit": [{
"hooks": [{
"type": "command",
"command": "node /path/to/hooks/auto-recall.js",
"timeout": 10
}]
}],
"Stop": [{
"hooks": [{
"type": "agent",
"model": "claude-opus-4-6",
"prompt": "See auto-capture prompt in settings.json",
"timeout": 60
}]
}],
"PreToolUse": [{
"hooks": [{
"type": "command",
"command": "node /path/to/hooks/search-enforcer.js",
"timeout": 5
}]
}]
}
}
Auto-Capture Design
Agent hooks cannot call MCP tools. Solution: the agent analyzes the conversation → outputs <auto-capture> instructions → blocks the main Claude → main Claude uses MCP tools to store knowledge → Stop fires again → stop_hook_active=true → allows stop.
User experience: the main AI naturally "remembers" to save knowledge, seamlessly using MCP tools.
Session-Start Auto-Maintenance
Automatically runs on every new session:
- Repair dangling edges — edges pointing to expired nodes
- Clean residual indexes — FTS5/vec entries for expired nodes
- Report orphan nodes — nodes with no edges (>5 triggers warning)
- Memory decay — R < 0.02 and level < 3 → expire
- Decay report — show nodes with R < 0.3 (actively decaying)
- Consolidation detection — vector similarity < 0.25 node pairs
- Weak edge cleanup — weight < 0.3 → expire
- Recent edge review — edges created in last 24 hours
Data Model
Nodes
| Field | Description |
|---|---|
| type | rule / procedure / observation / insight / core / preference |
| trust | principle (expert-taught) / pattern (observed) / inference (AI-guessed) |
| stability | FSRS S (days), controls decay speed |
| memory_level | Benna-Fusi level 1-4, controls durability |
| metadata.category | fundamental (has right/wrong) / creative (no right/wrong) |
| source | session ID / "teacher" / "auto-capture" |
| quote | Expert's exact words (required for principle) |
Edges
| Edge | Meaning |
|---|---|
must_precede |
A must come before B |
requires_reading |
Must read B before operating on A |
refines |
A refines/extends B |
contradicts |
A contradicts B |
reason_for |
A is the reason for B |
causes / implies / aligns_to / tends_to / observed_in |
Other semantic relations |
Security
| Risk | Protection |
|---|---|
| SQL injection | Parameterized queries + whitelist validation |
| FTS5 special characters | Sanitize + double-quote wrapping |
| Non-atomic store | Node + FTS wrapped in transaction |
| Invalid ID timeout | try/except returns clear error |
| Stability overflow | Capped at 365 days |
| Single-session level inflation | metadata.sessions tracks cross-session usage |
Integration
Recommended Skill Structure
Knowledge Graph stores "knowledge"; Skill files define "behavior". They complement each other:
- KG: What the expert taught, what was observed, what the AI inferred (storage & retrieval)
- Skill: What to do with that knowledge (executable workflows & checklists)
Recommended skill directory structure:
skills/
├── <domain>/ # Domain knowledge (e.g., coding/, design/, medical/)
│ ├── principles.md # Core principles
│ ├── elements/ # Operation workflows per element/module
│ │ ├── <element>/
│ │ │ └── workflow.md # Executable tool operation steps
│ │ └── checklist.md # Element list + dependency graph + standard flow
│ └── evaluation/ # Quality evaluation criteria
├── specialty/ # Specialty overrides (if applicable)
│ └── <specialty>/
│ └── <domain>/ # Specialty-specific knowledge overrides
├── tools/ # Tool usage knowledge
│ ├── gotchas/ # Dangerous operations / pitfalls
│ └── batch/ # Batch tool reference
└── preflight.md # Pre-work required reading checklist
Skill File Writing Principles
# Element Name — Tool Operation Workflow
## Related Elements
| Dependency | Reason | Must Read |
|------------|--------|-----------|
| X | Why X is needed | `path/to/x.md` |
## Operation Steps
1. Specific enough to execute directly
2. Include tool call examples (tool_name + parameters)
3. No abstract descriptions ("do it well" → "use tool X to set param Y to Z")
## Quality Criteria
Concrete values or qualitative descriptions the agent can use to judge.
Key: Skill files must be "executable" — an agent (or subagent) should be able to operate directly after reading, without guessing.
KG-Skill Synchronization
Use crystallize_skill to check if KG contains knowledge not yet reflected in skill files:
crystallize_skill(topic="authentication", skill_paths=["skills/coding/elements/auth/workflow.md"])
Returns unsynced knowledge list → manually update skill files.
Pairing With Other MCP Servers
Knowledge Graph is the memory layer. It typically pairs with a domain-specific MCP for actual operations:
| Combination | Knowledge Graph Handles | Domain MCP Handles |
|---|---|---|
| Software Development | Architecture decisions, code review lessons, bug patterns | IDE / Git / CI operations |
| Design | Design principles, brand guidelines, user feedback | Figma / design tool operations |
| Data Analysis | Analysis methodology, domain knowledge, past analyses | DB / BI tool operations |
| Any Professional Domain | Domain knowledge, workflow experience, expert teaching | Corresponding operation tools |
Knowledge Graph doesn't perform domain operations — it only remembers "how to do it" and "why it's done this way", then automatically recalls relevant knowledge when needed.
Pairing With Session Readers
Knowledge extraction requires reading historical conversations. Recommended to pair with MCP servers that can read Claude Code CLI or other session transcripts, enabling review of teaching processes and knowledge extraction.
References
Academic Papers
| Paper | Contribution |
|---|---|
| FSRS Algorithm | Power-law forgetting curve + desirable difficulty. 19 ML parameters trained on millions of Anki reviews |
| MemoryBank (AAAI 2024) | LLM long-term memory + Ebbinghaus forgetting curve implementation |
| Benna & Fusi (Nature Neuroscience 2016) | Synaptic cascade model. Multi-timescale storage, memory lifetime scales linearly with synapse count |
| Generative Agents (Stanford, UIST 2023) | Recency + importance + relevance three-signal retrieval. Reflection mechanism compresses observations into higher-order insights |
| Zep: Temporal KG Architecture | Bi-temporal model (event time + ingestion time). Edge temporal validity intervals |
| Theories of Synaptic Memory Consolidation | Elastic Weight Consolidation + Synaptic Intelligence. Critical parameter protection |
| Mem0: AI Agent Memory | Production-ready agent memory architecture. Graph + vector hybrid |
Open Source Implementations
| Project | What We Borrowed |
|---|---|
| CortexGraph | Two-component decay (power-law + exponential blend), consolidation threshold, sub-linear frequency n^0.6 |
| Claude-Recall | Search enforcer hook, correction detector, skill crystallization |
| A-MEM | Typed edges (relation_type + reasoning + weight), memory enzyme maintenance |
| Mnemon | 4-graph architecture, intent-aware traversal, importance decay + access-count boosting |
| memsearch (Zilliz) | Standalone memory library extracted from OpenClaw. Hybrid dense+BM25+RRF, SHA-256 dedup |
| second-brain (jugaad-lab) | Category-weighted decay, auto-consolidation (7-day window), entity graph weekly rebuild |
| Graphiti (Zep) | Temporal knowledge graph, bi-temporal model, edge invalidation |
| Hippocampus Memory Skill | Salience formula (0.5×semantic + 0.2×reinforcement + 0.2×recency + 0.1×frequency), 4-tier memory |
| YourMemory | Simplest implementation: strength = importance × e^(-λ × days) × (1 + recall_count × 0.2) |
Cognitive Science
| Concept | Application |
|---|---|
| Ebbinghaus Forgetting Curve | Foundation model for memory strength decaying over time |
| SM-2 Algorithm (SuperMemo) | Classic spaced repetition algorithm. EF (easiness factor) + interval growth |
| Desirable Difficulty | Robert Bjork: appropriate difficulty enhances long-term memory. Core theoretical basis of FSRS |
| Synaptic Tagging and Capture | Synaptic tag + protein synthesis = memory consolidation. Maps to our level promotion mechanism |
Acknowledgments
This system's design integrates wisdom from multiple open-source communities and academic research. Special thanks to:
- open-spaced-repetition for the FSRS algorithm, providing a desirable difficulty model validated on millions of data points
- prefrontal-systems for CortexGraph, whose two-component decay model forms the core of our memory decay engine
- Anthropic for Claude-Recall, whose hook architecture and search enforcer patterns directly inspired our automation layer
- Stanford HCI Group for the Generative Agents paper (Park et al., 2023), whose three-signal retrieval and reflection mechanisms influenced our search scoring and consolidation design
- Benna & Fusi for their synaptic cascade model published in Nature Neuroscience, providing the neuroscience foundation for our memory level growth path
- Zilliz (memsearch), jugaad-lab (second-brain), Zep (Graphiti), and other open-source projects that each contributed valuable implementation experience
Deployment
Included in the Repository
- All
lib/,tools/,hooks/,scripts/source code - Hook configuration examples
Generated by User
knowledge.db— automatically created on first startup- Qwen3 ONNX model — automatically downloaded on first embed
node_modules/—npm install
First-Time Setup
npm install- Configure
.mcp.json+~/.claude/settings.jsonhooks - Start Claude Code → MCP auto-starts → model auto-downloads
- Begin conversation → hooks auto-run → knowledge auto-accumulates
License
MIT
knowledgeGraph MCP 질문
knowledgeGraph MCP는 어떤 도구를 제공하나요?
12개 도구를 제공합니다. 예: store_knowledge, connect_knowledge, update_knowledge, forget_knowledge, search_memory.
시스템은 메모리 감쇠를 어떻게 처리하나요?
인간과 유사한 망각 과정을 시뮬레이션하기 위해 FSRS 안정성과 결합된 2요소 감쇠 모델(빠른 지수 및 느린 지수 감쇠)을 사용합니다.
기존 지식을 그래프로 가져올 수 있나요?
네, 제공된 스크립트를 사용하여 markdown 파일을 지식 그래프 노드로 가져올 수 있습니다.
AI가 새로운 세션을 시작하면 어떻게 되나요?
시스템은 끊어진 엣지 복구, 인덱스 정리, 메모리 감쇠 계산과 같은 유지 관리 작업을 자동으로 실행할 수 있습니다.