Логотип mcp-knowledge-graph

mcp-knowledge-graph

Спільнота
shaneholloman

MCP server enabling persistent memory for Claude through a local knowledge graph - fork focused on local development

Видавецьshaneholloman
Репозиторійmcp-knowledge-graph
МоваJavaScript
Форки
101
Зірки
889
Доступні інструменти
10
Тип транспортуstdio
Категорії
ЛіцензіяMIT
Посилання
  • Підключайте інструменти до робочих процесів із ШІ

    mcp-knowledge-graph надає можливості MCP, які можуть використовувати сумісні клієнтські ШІ-застосунки та агенти.

  • Доступні інструменти: 10

    Перегляньте нижче дії, які можна викликати, з назвами й описами, якщо сервер їх надає.

  • Готова конфігурація для копіювання

    Скористайтеся прикладами конфігурації, щоб налаштувати цей сервер у вибраному клієнті MCP.

  • Показники інтересу до відкритого коду

    Зірки: 889, форки: 101 — у пов’язаному репозиторії.

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
  • Location Override: Force operations to use project or global storage
  • Safe Operations: Built-in protection against overwriting unrelated files
  • Database Discovery: List all available databases in both locations

Quick Start

Global Memory (Recommended)

Add to your claude_desktop_config.json or .claude.json. Two common approaches:

Option 1: Default .aim directory (simple)

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

Option 2: Dropbox/cloud sync (portable)

For accessing memories across multiple machines, use a synced folder. This is how the author of this MCP server keeps his own memories:

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

This creates memory files in your specified directory:

  • memory.jsonl - Master Database (default for all operations)
  • memory-work.jsonl - Work database
  • memory-personal.jsonl - Personal database
  • etc.

Project-Local Memory

In any project, create a .aim directory:

bash
mkdir .aim

Now memory tools automatically use .aim/memory.jsonl (project-local master database) instead of global storage when run from this project.

How AI Uses Databases

Once configured, AI models use the master database by default or can specify named databases with a context parameter. New databases are created automatically - no setup required:

json
// Master Database (default - no context needed)
aim_memory_store({
  entities: [{
    name: "John_Doe",
    entityType: "person",
    observations: ["Met at conference"]
  }]
})

// Work database
aim_memory_store({
  context: "work",
  entities: [{
    name: "Q4_Project",
    entityType: "project",
    observations: ["Due December 2024"]
  }]
})

// Personal database
aim_memory_store({
  context: "personal",
  entities: [{
    name: "Mom",
    entityType: "person",
    observations: ["Birthday March 15th"]
  }]
})

// Master database in specific location
aim_memory_store({
  location: "global",
  entities: [{
    name: "Important_Info",
    entityType: "reference",
    observations: ["Stored in global master database"]
  }]
})

File Organization

Global Setup:

tree
/Users/yourusername/.aim/
├── memory.jsonl           # Master Database (default)
├── memory-work.jsonl      # Work database
├── memory-personal.jsonl  # Personal database
└── memory-health.jsonl    # Health database

Project Setup:

tree
my-project/
├── .aim/
│   ├── memory.jsonl       # Project Master Database (default)
│   └── memory-work.jsonl  # Project Work database
└── src/

Available Tools

  • aim_memory_store - Store new memories (people, projects, concepts)
  • aim_memory_add_facts - Add facts to existing memories
  • aim_memory_link - Link two memories together
  • aim_memory_search - Search memories by keyword
  • aim_memory_get - Retrieve specific memories by exact name
  • aim_memory_read_all - Read all memories in a database
  • aim_memory_list_stores - List available databases
  • aim_memory_forget - Forget memories
  • aim_memory_remove_facts - Remove specific facts from a memory
  • aim_memory_unlink - Remove links between memories

Parameters

  • context (optional) - Specify named database (work, personal, etc.). Defaults to master database
  • location (optional) - Force project or global storage location. Defaults to auto-detection

Database Discovery

Use aim_memory_list_stores to see all available databases:

json
{
  "project_databases": [
    "default",      // Master Database (project-local)
    "project-work"  // Named database
  ],
  "global_databases": [
    "default",      // Master Database (global)
    "work",
    "personal",
    "health"
  ],
  "current_location": "project (.aim directory detected)"
}

Key Points:

  • "default" = Master Database in both locations
  • Current location shows whether you're using project or global storage
  • Master database exists everywhere - it's your primary memory store
  • Named databases are optional additions for specific topics

Configuration Examples

Important: Always specify --memory-path to control where your memory files are stored.

Auto-approve read operations (recommended):

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

Troubleshooting

"File does not contain required _aim safety marker" error:

  • The file may not belong to this system
  • Manual JSONL files need {"type":"_aim","source":"mcp-knowledge-graph"} as first line
  • If you created the file manually, add the _aim marker or delete and let the system recreate it

Memories going to unexpected locations:

  • Check if you're in a project directory with .aim folder (uses project-local storage)
  • Otherwise uses the configured global --memory-path directory
  • Use aim_memory_list_stores to see all available databases and current location
  • Use ls .aim/ or ls /Users/yourusername/.aim/ to see your memory files

Too many similar databases:

  • AI models try to use consistent names, but may create variations
  • Manually delete unwanted database files if needed
  • Encourage AI to use simple, consistent database names
  • Remember: Master database is always available as the default - named databases are optional

Requirements

  • Node.js 22+
  • MCP-compatible AI platform

License

MIT

Встановлення

TypingMind
{
  "mcpServers": {
    "mcp-knowledge-graph": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-knowledge-graph",
        "--memory-path",
        "{{config.MEMORY_PATH}}"
      ]
    }
  }
}

Доступні інструменти

  • aim_memory_store

    Store new memories. Use this to remember people, projects, concepts, or any information worth persisting.

    AIM (AI Memory) provides persistent memory for AI assistants. The 'aim_memory_' prefix groups all memory tools together.

    WHAT'S STORED: Memories have a name, type (person/project/concept/etc.), and observations (facts about them).

    DATABASES: Use the 'context' parameter to organize memories into separate graphs:

    • Leave blank: Uses the master database (default for general information)
    • Any name: Creates/uses a named database ('work', 'personal', 'health', 'research', etc.)
    • New databases are created automatically - no setup required
    • IMPORTANT: Use consistent, simple names - prefer 'work' over 'work-stuff'

    STORAGE LOCATIONS: Files are stored as JSONL (e.g., memory.jsonl, memory-work.jsonl):

    • Project-local: .aim directory in project root (auto-detected if exists)
    • Global: User's configured --memory-path directory
    • Use 'location' parameter to override: 'project' or 'global'
  • aim_memory_link

    Link two memories together with a relationship. Use this to connect related information.

    RELATION STRUCTURE: Each link has 'from' (subject), 'relationType' (verb), and 'to' (object).

    • Use active voice verbs: "manages", "works_at", "knows", "attended", "created"
    • Read as: "from relationType to" (e.g., "Alice manages Q4_Project")
    • Avoid passive: use "manages" not "is_managed_by"

    IMPORTANT: Both 'from' and 'to' entities must already exist in the same database.

    RETURNS: Array of created relations (duplicates are ignored).

    DATABASE: Relations are created in the specified 'context' database, or master database if not specified.

    EXAMPLES:

    • aim_memory_link({relations: [{from: "John", to: "TechConf2024", relationType: "attended"}]})
    • aim_memory_link({context: "work", relations: [{from: "Alice", to: "Q4_Project", relationType: "manages"}]})
    • Multiple: aim_memory_link({relations: [{from: "John", to: "Alice", relationType: "knows"}, {from: "John", to: "Acme_Corp", relationType: "works_a
  • aim_memory_add_facts

    Add new facts to an existing memory. Use this to append information to something already stored.

    IMPORTANT: Memory must already exist - use aim_memory_store first. Throws error if not found.

    RETURNS: Array of {entityName, addedObservations} showing what was added (duplicates are ignored).

    DATABASE: Adds to entities in the specified 'context' database, or master database if not specified.

    EXAMPLES:

    • aim_memory_add_facts({observations: [{entityName: "John", contents: ["Lives in Seattle", "Works in tech"]}]})
    • aim_memory_add_facts({context: "work", observations: [{entityName: "Q4_Project", contents: ["Behind schedule", "Need more resources"]}]})
  • aim_memory_forget

    Forget memories. Removes memories and their associated links.

    DATABASE SELECTION: Entities are deleted from the specified database's knowledge graph.

    LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.

    EXAMPLES:

    • Master database (default): aim_memory_forget({entityNames: ["OldProject"]})
    • Work database: aim_memory_forget({context: "work", entityNames: ["CompletedTask", "CancelledMeeting"]})
    • Master database in global location: aim_memory_forget({location: "global", entityNames: ["OldProject"]})
    • Personal database in project location: aim_memory_forget({context: "personal", location: "project", entityNames: ["ExpiredReminder"]})
  • aim_memory_remove_facts

    Remove specific facts from a memory. Keeps the memory but removes selected observations.

    DATABASE SELECTION: Observations are deleted from entities within the specified database's knowledge graph.

    LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.

    EXAMPLES:

    • Master database (default): aim_memory_remove_facts({deletions: [{entityName: "John", observations: ["Outdated info"]}]})
    • Work database: aim_memory_remove_facts({context: "work", deletions: [{entityName: "Project", observations: ["Old deadline"]}]})
    • Master database in global location: aim_memory_remove_facts({location: "global", deletions: [{entityName: "John", observations: ["Outdated info"]}]})
    • Health database in project location: aim_memory_remove_facts({context: "health", location: "project", deletions: [{entityName: "Exercise", observations: ["Injured knee"]}]})
  • aim_memory_unlink

    Remove links between memories. Keeps the memories but removes their connections.

    DATABASE SELECTION: Relations are deleted from the specified database's knowledge graph.

    LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.

    EXAMPLES:

    • Master database (default): aim_memory_unlink({relations: [{from: "John", to: "OldCompany", relationType: "worked_at"}]})
    • Work database: aim_memory_unlink({context: "work", relations: [{from: "Alice", to: "CancelledProject", relationType: "manages"}]})
    • Master database in global location: aim_memory_unlink({location: "global", relations: [{from: "John", to: "OldCompany", relationType: "worked_at"}]})
    • Personal database in project location: aim_memory_unlink({context: "personal", location: "project", relations: [{from: "Me", to: "OldHobby", relationType: "enjoys"}]})
  • aim_memory_read_all

    Read all memories in a database. Returns every stored memory and their links.

    FORMAT OPTIONS:

    • "json" (default): Structured JSON for programmatic use
    • "pretty": Human-readable text format

    DATABASE: Reads from the specified 'context' database, or master database if not specified.

    EXAMPLES:

    • aim_memory_read_all({}) - JSON format
    • aim_memory_read_all({format: "pretty"}) - Human-readable
    • aim_memory_read_all({context: "work", format: "pretty"}) - Work database, pretty
  • aim_memory_search

    Search memories by keyword. Use this when you don't know the exact name of what you're looking for.

    WHAT IT SEARCHES: Matches query (case-insensitive) against:

    • Memory names (e.g., "John" matches "John_Smith")
    • Memory types (e.g., "person" matches all person memories)
    • Facts/observations (e.g., "Seattle" matches memories mentioning Seattle)

    VS aim_memory_get: Use aim_memory_search for fuzzy matching. Use aim_memory_get when you know exact names.

    FORMAT OPTIONS:

    • "json" (default): Structured JSON for programmatic use
    • "pretty": Human-readable text format

    EXAMPLES:

    • aim_memory_search({query: "John"}) - JSON format
    • aim_memory_search({query: "project", format: "pretty"}) - Human-readable
    • aim_memory_search({context: "work", query: "Shane", format: "pretty"})
  • aim_memory_get

    Retrieve specific memories by exact name. Use this when you know exactly what you're looking for.

    VS aim_memory_search: Use aim_memory_get for exact name lookup. Use aim_memory_search for fuzzy matching or when you don't know exact names.

    RETURNS: Requested entities and relations between them. Non-existent names are silently ignored.

    FORMAT OPTIONS:

    • "json" (default): Structured JSON for programmatic use
    • "pretty": Human-readable text format

    EXAMPLES:

    • aim_memory_get({names: ["John", "TechConf2024"]}) - JSON format
    • aim_memory_get({names: ["Shane"], format: "pretty"}) - Human-readable
    • aim_memory_get({context: "work", names: ["Q4_Project"], format: "pretty"})
  • aim_memory_list_stores

    List all available memory databases and show current storage location.

    DATABASE TYPES:

    • "default": The master database (memory.jsonl) - used when no context is specified
    • Named databases: Created via context parameter (e.g., "work" -> memory-work.jsonl)

    RETURNS: {project_databases: [...], global_databases: [...], current_location: "..."}

    • project_databases: Databases in .aim directory (if project detected)
    • global_databases: Databases in global --memory-path directory
    • current_location: Where operations will default to

    Use this to discover what databases exist before querying them.

    EXAMPLES:

    • aim_memory_list_stores() - Shows all available databases and current storage location

Використовуйте MCP mcp-knowledge-graph з різними моделями ШІ

TypingMind підключає інструменти MCP на рівні робочого простору, тож після підключення mcp-knowledge-graph ви можете використовувати їх із різними моделями ШІ в TypingMind, а не налаштовувати окремо для кожної моделі. Ця інтеграція MCP працює локально через конектор MCP TypingMind на вашому пристрої.

Інструкція з налаштування локального конектора

Виберіть цей варіант, якщо серверу MCP потрібен доступ до локальних файлів, програм або приватних ресурсів на вашому комп’ютері.

1

Відкрийте налаштування MCP

У TypingMind перейдіть до розділу «Налаштування», відкрийте «Розширені налаштування», потім «Протокол контексту моделі» й виберіть «Параметри конектора».

  1. Відкрийте TypingMind у браузері.
  2. Натисніть значок налаштувань.
  3. Перейдіть до розділу «Розширені налаштування».
  4. Відкрийте розділ «Протокол контексту моделі».
  5. Натисніть «Параметри конектора» й виберіть «Цей пристрій».
Екран налаштування конектора MCP у TypingMind з вибраним варіантом «Цей пристрій»
2

Виконайте команду конектора

Виберіть «Цей пристрій», скопіюйте команду з TypingMind і виконайте її в терміналі. Не зупиняйте процес, поки користуєтеся MCP.

  1. Скопіюйте команду налаштування, показану в TypingMind.
  2. Відкрийте «Термінал» у macOS або Windows Terminal у Windows.
  3. Вставте й виконайте команду.
  4. Підтвердьте встановлення пакета, якщо термінал запитає дозволу продовжити.
  5. Не закривайте вікно термінала й не зупиняйте процес, поки користуєтеся інструментами MCP.
3

Додайте mcp-knowledge-graph як сервер

Коли статус конектора зміниться на «Готово», натисніть «Змінити сервери» та вставте конфігурацію сервера MCP.

  1. Зачекайте, доки статус конектора зміниться на «Готово».
  2. Натисніть «Змінити сервери».
  3. Вставте конфігурацію сервера MCP mcp-knowledge-graph.
  4. Збережіть список серверів.
  5. Оновіть дані, щоб переконатися, що конектор досі готовий до роботи.
Налаштування MCP у TypingMind з активним сервером і кнопкою «Змінити сервери»
{
  "mcpServers": {
    "mcp-knowledge-graph": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-knowledge-graph"
      ]
    }
  }
}
4

Використовуйте підключення з різними моделями

Збережіть список серверів, відкрийте «Плагіни», увімкніть інструменти MCP для mcp-knowledge-graph, а потім виберіть будь-яку підтримувану модель ШІ в TypingMind і використовуйте інструменти в чаті або призначте їх агенту ШІ.

  1. Відкрийте сторінку «Плагіни» в TypingMind.
  2. Увімкніть інструменти MCP для mcp-knowledge-graph.
  3. Почніть чат і виберіть модель ШІ, яку хочете використовувати.
  4. Використовуйте інструменти MCP у чаті або призначте їх агенту ШІ.
  5. За потреби перемикайтеся на іншу модель ШІ без повторного підключення MCP.
Чат TypingMind із використанням увімкнених інструментів MCP і вибраної моделі ШІ
Допоможете з цим завданням через mcp-knowledge-graph?
mcp-knowledge-graph
Звісно. Я це прочитав.
Ось що я знайшов за допомогою mcp-knowledge-graph.

Поширені запитання

Для чого використовується сервер MCP mcp-knowledge-graph?

mcp-knowledge-graph — це сервер MCP, який дає змогу сумісним клієнтам ШІ підключатися до зовнішніх інструментів і контексту. У TypingMind ви можете додати цей сервер MCP один раз і зробити його інструменти доступними у своєму робочому просторі ШІ.

Чи можу я використовувати MCP mcp-knowledge-graph з кількома моделями ШІ в TypingMind?

Так. TypingMind підключає інструменти MCP на рівні робочого простору, тому ви можете використовувати mcp-knowledge-graph з різними моделями ШІ, як-от Claude, ChatGPT, Gemini або іншими моделями, які ви налаштували в TypingMind, без окремого налаштування сервера MCP для кожної моделі.

Навіщо використовувати MCP mcp-knowledge-graph із TypingMind?

TypingMind — один із найкращих інтерфейсів для чату з великими мовними моделями, адже він об’єднує різні моделі ШІ, промпти, плагіни, агентів ШІ, ключі API та інструменти MCP в одному робочому просторі. Підключивши mcp-knowledge-graph, ви зможете використовувати його інструменти MCP з вибраними моделями та впорядковано працювати з чатами в TypingMind.

Як підключити MCP mcp-knowledge-graph до TypingMind?

mcp-knowledge-graph працює через локальний конектор MCP TypingMind. Це найкращий варіант, коли серверу MCP потрібен доступ до локальних файлів, настільних застосунків, інструментів командного рядка або приватних ресурсів на вашому комп’ютері.

Які інструменти надає MCP mcp-knowledge-graph у TypingMind?

mcp-knowledge-graph надає інструменти MCP (10), які можна ввімкнути на сторінці «Плагіни» в TypingMind і використовувати в чаті або призначати агентам ШІ.

Чи потрібно передавати свої ключі API в TypingMind, щоб використовувати MCP mcp-knowledge-graph?

Ні. TypingMind орієнтований насамперед на локальну роботу й дає змогу зберігати контроль над постачальниками моделей, ключами API, промптами та конфігурацією MCP. Якщо mcp-knowledge-graph потребує автентифікації, під час створення підключення додайте потрібні заголовки, налаштування OAuth або локальну конфігурацію для цього сервера MCP.

Схожі сервери MCP

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇