Logo de mcp-knowledge-graph

mcp-knowledge-graph

Comunidade
shaneholloman

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

Publicado porshaneholloman
Repositóriomcp-knowledge-graph
IdiomaJavaScript
Forks
101
Estrelas
889
Ferramentas disponíveis
10
Tipo de transportestdio
Categorias
LicençaMIT
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    mcp-knowledge-graph disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 10 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    889 estrelas e 101 forks no repositório vinculado.

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

Instalação

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

Ferramentas disponíveis

  • 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

Use o MCP de mcp-knowledge-graph com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar mcp-knowledge-graph, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione mcp-knowledge-graph como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de mcp-knowledge-graph.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "mcp-knowledge-graph": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-knowledge-graph"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de mcp-knowledge-graph, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de mcp-knowledge-graph.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar mcp-knowledge-graph para me ajudar nesta tarefa?
mcp-knowledge-graph
Claro. Já li.
Veja o que encontrei usando mcp-knowledge-graph.

Perguntas frequentes

Para que serve o servidor MCP mcp-knowledge-graph?

mcp-knowledge-graph é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP mcp-knowledge-graph com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar mcp-knowledge-graph com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP mcp-knowledge-graph com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com mcp-knowledge-graph conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP mcp-knowledge-graph ao TypingMind?

mcp-knowledge-graph funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP mcp-knowledge-graph oferece no TypingMind?

mcp-knowledge-graph disponibiliza 10 ferramentas MCP que podem ser ativadas na página Plugins do TypingMind e usadas no chat ou atribuídas a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP mcp-knowledge-graph?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se mcp-knowledge-graph exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇