{
  "markdown": "<!-- mcp-name: io.github.zcsabbagh/knowledge-graph-mcp -->\n\n# Knowledge Graph MCP Server\n\nAn MCP (Model Context Protocol) server for tracking student learning via a knowledge graph. Built with FastMCP, it enables LLMs to build, query, and update a personalized knowledge map with spaced repetition scheduling.\n\n## Features\n\n- **Knowledge Graph Storage**: SQLite-backed graph with concepts as nodes and relationships as edges\n- **Multi-dimensional Mastery Tracking**: Track recall, application, and explanation abilities separately\n- **Spaced Repetition (SM-2)**: Automatic scheduling of review sessions based on performance\n- **Misconception Tracking**: Record and query common misconceptions for targeted remediation\n- **Intelligent Queries**: Find knowledge gaps, ready-to-learn concepts, struggling areas\n- **Mermaid Visualization**: Generate visual diagrams of the knowledge graph\n\n## Installation\n\n### Option 1: Install from Smithery (Recommended)\n\nInstall directly via [Smithery](https://smithery.ai):\n\n```bash\nnpx @smithery/cli install @zcsabbagh/knowledge-graph-mcp --client claude\n```\n\nOr use the hosted version at: **https://smithery.ai/server/@zcsabbagh/knowledge-graph-mcp**\n\n### Option 2: Install from source\n\nPrerequisites: Python 3.10+\n\n```bash\ngit clone https://github.com/zcsabbagh/knowledge-graph-mcp.git\ncd knowledge-graph-mcp\npip install -e .\n```\n\n## Usage\n\n### Running the Server\n\n```bash\n# From the project root\npython -m knowledge_graph_mcp.server\n```\n\n### Configure with Claude Code\n\nAdd to your Claude Code MCP settings (`~/.claude/settings.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"knowledge-graph\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"knowledge_graph_mcp.server\"],\n      \"cwd\": \"/path/to/knowledge-graph-mcp\"\n    }\n  }\n}\n```\n\n### Configure with Claude Desktop\n\nAdd to `~/Library/Application Support/Claude/claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"knowledge-graph\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"knowledge_graph_mcp.server\"],\n      \"cwd\": \"/path/to/knowledge-graph-mcp\"\n    }\n  }\n}\n```\n\n## MCP Tools\n\n### 1. `add_node`\nCreate a new concept node.\n\n```\nadd_node(\n  concept=\"Quadratic Formula\",\n  description=\"Formula for solving ax² + bx + c = 0\",\n  domain=\"mathematics\",\n  difficulty=0.7,\n  tags=[\"algebra\", \"formulas\"]\n)\n```\n\n### 2. `add_edge`\nCreate relationships between concepts.\n\n**Relation types:**\n- `prerequisite` - Must learn source before target\n- `builds_on` - Target extends source concept\n- `related_to` - Concepts are connected\n- `contradicts` - Common misconception\n- `applies_to` - Application domain\n- `parent_of` - Category hierarchy\n\n```\nadd_edge(\n  source_concept=\"Algebra\",\n  target_concept=\"Quadratic Formula\",\n  relation_type=\"prerequisite\"\n)\n```\n\n### 3. `update_node`\nUpdate mastery and record reviews. Providing a `quality` rating (0-5) triggers spaced repetition scheduling.\n\n```\nupdate_node(\n  node_id=\"quadratic_formula\",\n  quality=4,  # SM-2 rating: 0=blackout, 5=perfect\n  mastery_application=0.6,\n  misconception_detected=\"forgets ± sign\"\n)\n```\n\n### 4. `query_graph`\nIntelligent queries for learning insights.\n\n**Query types:**\n- `prerequisites` - All prerequisites for a concept\n- `ready_to_learn` - Concepts where prereqs are mastered\n- `due_for_review` - Needs review based on schedule\n- `struggling` - High difficulty + low mastery\n- `stalled` - Multiple reviews, no improvement\n- `misconceptions` - Concepts with detected misconceptions\n- `knowledge_gaps` - Low mastery blocking progress\n- `next_recommended` - Best concept to study next\n\n```\nquery_graph(query_type=\"next_recommended\", domain=\"mathematics\")\n```\n\n### 5. `read_subgraph`\nGet the neighborhood around a concept with Mermaid visualization.\n\n```\nread_subgraph(\n  center_node=\"calculus\",\n  depth=2,\n  direction=\"upstream\",  # or \"downstream\", \"both\"\n  output_format=\"both\"   # \"json\", \"mermaid\", or \"both\"\n)\n```\n\n### 6. `get_learning_path`\nGet ordered prerequisites for a target concept.\n\n```\nget_learning_path(target_concept=\"calculus\")\n```\n\n### 7. `get_statistics`\nGet learning progress metrics.\n\n```\nget_statistics(domain=\"mathematics\")\n```\n\n## How It Works\n\n### Data Model\n\n**Nodes** represent concepts with:\n- Mastery levels (overall, recall, application, explanation)\n- Spaced repetition data (ease factor, interval, next review date)\n- Difficulty rating and review history\n- Tags and detected misconceptions\n\n**Edges** represent relationships with:\n- Relation type (prerequisite, builds_on, etc.)\n- Strength/confidence rating\n- Optional reasoning\n\n### Spaced Repetition (SM-2)\n\nWhen you call `update_node` with a `quality` rating:\n- **5**: Perfect response → longer interval\n- **4**: Correct with hesitation\n- **3**: Correct with difficulty\n- **2-0**: Incorrect → reset interval\n\nThe algorithm calculates the next optimal review date based on performance history.\n\n### Mastery Calculation\n\nOverall mastery combines dimensional scores:\n```\nmastery_level = 0.3 × recall + 0.4 × application + 0.3 × explanation\n```\n\n### Storage\n\nData is stored in SQLite at `~/.knowledge_graph/knowledge.db` by default.\n\n## Example Workflow\n\n```\n1. LLM discovers student doesn't know \"quadratic formula\"\n   → add_node(concept=\"Quadratic Formula\", difficulty=0.7)\n\n2. LLM identifies prerequisites\n   → add_edge(\"Algebra\", \"Quadratic Formula\", \"prerequisite\")\n\n3. Student attempts problem, struggles\n   → update_node(\"quadratic_formula\", quality=2,\n                 misconception_detected=\"confuses ± with +\")\n\n4. LLM decides what to teach next\n   → query_graph(\"next_recommended\")\n\n5. Visualize the learning path\n   → get_learning_path(\"quadratic_formula\")\n```\n\n## License\n\nMIT\n",
  "bytes": 5643,
  "sha": "46fe10bd94d717499a1f51ea99bba007f42c45c58c48a78d6ea141bbd96dced8",
  "repo_slug": "zcsabbagh/knowledge-graph-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_zcsabbagh_knowledge_graph_mcp_a2b1c020/readme"
}