SM

shaneholloman/mcp-knowledge-graph

效率工作流

本页由 AI 翻译,技术细节请以原文为准。 查看原文

886 stars 103 forks 质量 69 趋势 26MIT

MCP 服务器通过本地知识图谱支持 Claude 的持久内存——专注于本地开发的分支

概览

通过实体、关系和观察值存储和检索对话信息。支持Claude Code/Desktop及任何兼容MCP的AI平台。 AIM代表——该系统的核心概念。三个AIM元素提供清晰的组织和安全性: - : 保持AI内存文件有序且易于识别- :将相关内存功能在多工具设置中组合 - : 每个内存文件以{“type”:“_aim”,“source”:“mcp-knowledge-graph”}开头,以防止无关JSONL文件的意外覆盖 这种一致的AIM命名使得哪些目录、工具和文件属于AI内存系统。 - .aim = (必须精确命名为 .aim 才能实现项目检测)- _aim = (出现在 JSONL 文件中:{“type”:“_aim”,“source”:“mcp-knowledge-graph”}) - 目录必须在项目根中命名为.aim- 例如:my-project/.aim/memory。

概述(AI 翻译)

通过本地知识图谱实现AI模型的持久记忆。

通过实体、关系和观察值存储和检索对话信息。支持Claude Code/Desktop及任何兼容MCP的AI平台。

为什么用“.aim”和“aim_”前缀?

AIM代表AI内存——该系统的核心概念。三个AIM元素提供清晰的组织和安全性:

  • .aim 目录:保持 AI 内存文件有序且易于识别
  • aim_ 工具前缀:在多工具设置中将相关内存功能组合在一起
  • _aim 安全标记:每个内存文件以 {"type":"_aim","source":"mcp-knowledge-graph"} 开头,以防止意外覆盖无关的 JSONL 文件

这种一致的AIM命名使得哪些目录、工具和文件属于AI内存系统。

关键:理解 .aim dir 与 _aim 文件标记

两个名字相似的不同东西:

  • .aim = 项目本地目录名称(项目检测必须精确命名为.aim)
  • _aim = 文件安全标记(出现在JSONL文件中:{"type":"_aim","source":"mcp-knowledge-graph"})

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Knowledge Graph

Persistent memory for AI models through a local knowledge graph.

Store and retrieve information across conversations using entities, relations, and observations. Works with Claude Code/Desktop and any MCP-compatible AI platform.

Why “.aim” and “aim_” prefixes?

AIM stands for AI Memory - the core concept of this system. The three AIM elements provide clear organization and safety:

  • .aim directories: Keep AI memory files organized and easily identifiable
  • aim_ tool prefixes: Group related memory functions together in multi-tool setups
  • _aim safety markers: Each memory file starts with {"type":"_aim","source":"mcp-knowledge-graph"} to prevent accidental overwrites of unrelated JSONL files

This consistent AIM naming makes it obvious which directories, tools, and files belong to the AI memory system.

CRITICAL: Understanding .aim dir vs _aim file marker

Two different things with similar names:

  • .aim = Project-local directory name (MUST be named exactly .aim for project detection to work)
  • _aim = File safety marker (appears inside JSONL files: {"type":"_aim","source":"mcp-knowledge-graph"})

For project-local storage:

  • Directory MUST be named .aim in your project root
  • Example: my-project/.aim/memory.jsonl
  • The system specifically looks for this exact name

For global storage (–memory-path):

  • Can be ANY directory you want
  • Examples: ~/yourusername/.aim/, ~/memories/, ~/Dropbox/ai-memory/, ~/Documents/ai-data/
  • Complete flexibility - choose whatever location works for you

Storage Logic

File Location Priority:

  1. Project with .aim - Uses .aim/memory.jsonl (project-local)
  2. No project/no .aim - Uses configured global directory
  3. Contexts - Adds suffix: memory-work.jsonl, memory-personal.jsonl

Safety System:

  • Every memory file starts with {"type":"_aim","source":"mcp-knowledge-graph"}
  • System refuses to write to files without this marker
  • Prevents accidental overwrite of unrelated JSONL files

Master Database Concept

The master database is your primary memory store - used by default when no specific database is requested. It’s always named default in listings and stored as memory.jsonl.

  • Default Behavior: All memory operations use the master database unless you specify a different one
  • Always Available: Exists in both project-local and global locations
  • Primary Storage: Your main knowledge graph that persists across all conversations
  • Named Databases: Optional additional databases (work, personal, health) for organizing specific topics

Key Features

  • Master Database: Primary memory store used by default for all operations
  • Multiple Databases: Optional named databases for organizing memories by topic
  • Project Detection: Automatic project-local memory using .aim directories
在 GitHub 查看完整 README

安装

npx -y mcp-knowledge-graph --memory-path /Users/yourusername/.aim
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "Aim-Memory-Bank": { "command": "npx", "args": [ "-y", "mcp-knowledge-graph", "--memory-path", "/Users/yourusername/.aim" ] } } }