Logo de mcp-knowledge-graph

mcp-knowledge-graph

Communauté
shaneholloman

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

Éditeurshaneholloman
Dépôtmcp-knowledge-graph
LangueJavaScript
Forks
101
Étoiles
889
Outils disponibles
10
Type de transportstdio
Catégories
LicenceMIT
Liens
  • Connectez des outils à vos workflows IA

    mcp-knowledge-graph propose des fonctionnalités MCP utilisables par les clients et agents IA compatibles.

  • 10 outils disponibles

    Parcourez les actions invocables ci-dessous, avec leurs noms et descriptions lorsque le serveur les fournit.

  • Configuration prête à copier

    Utilisez les exemples de configuration pour configurer ce serveur dans votre client MCP préféré.

  • Indicateurs de popularité open source

    889 étoiles et 101 forks sur le dépôt associé.

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

Installation

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

Outils disponibles

  • 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

Utilisez le serveur MCP mcp-knowledge-graph avec plusieurs modèles IA

TypingMind connecte les outils MCP au niveau de l’espace de travail. Une fois mcp-knowledge-graph connecté, vous pouvez donc l’utiliser avec différents modèles IA dans TypingMind sans avoir à le configurer séparément pour chaque modèle. Cette intégration MCP s’exécute localement sur votre appareil via le connecteur MCP de TypingMind.

Guide de configuration du connecteur local

Choisissez cette méthode si le serveur MCP doit accéder à des fichiers locaux, à des applications ou à des ressources privées sur votre ordinateur.

1

Ouvrir les paramètres MCP

Dans TypingMind, accédez à « Paramètres », puis à « Paramètres avancés » et à « Model Context Protocol », et choisissez « Configurer connecteur ».

  1. Ouvrez TypingMind dans votre navigateur.
  2. Cliquez sur l’icône Paramètres.
  3. Accédez aux paramètres avancés.
  4. Ouvrez la section Model Context Protocol.
  5. Cliquez sur « Configurer connecteur » et choisissez « Cet appareil ».
Écran de configuration du connecteur MCP de TypingMind avec l’option « Cet appareil » sélectionnée
2

Exécuter la commande du connecteur

Choisissez « Cet appareil », copiez la commande depuis TypingMind et exécutez-la dans Terminal. Laissez le processus en cours d’exécution pendant que vous utilisez MCP.

  1. Copiez la commande de configuration affichée par TypingMind.
  2. Ouvrez Terminal sur macOS ou Windows Terminal sur Windows.
  3. Collez et exécutez la commande.
  4. Autorisez l’installation du paquet si Terminal vous demande de confirmer.
  5. Gardez la fenêtre de Terminal ouverte et le processus en cours d’exécution pendant que vous utilisez les outils MCP.
3

Ajoutez mcp-knowledge-graph en tant que serveur

Lorsque l’état du connecteur affiche « Prêt », cliquez sur « Éditer serveurs » et collez la configuration du serveur MCP.

  1. Attendez que l’état du connecteur affiche « Prêt ».
  2. Cliquez sur « Éditer serveurs ».
  3. Collez la configuration du serveur MCP mcp-knowledge-graph.
  4. Enregistrez la liste des serveurs.
  5. Actualisez pour vérifier que le connecteur est toujours prêt.
Paramètres MCP de TypingMind affichant un serveur actif et le bouton « Éditer serveurs »
{
  "mcpServers": {
    "mcp-knowledge-graph": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-knowledge-graph"
      ]
    }
  }
}
4

Utiliser la connexion avec différents modèles

Enregistrez la liste des serveurs, ouvrez « Plugins », activez les outils MCP de mcp-knowledge-graph, puis sélectionnez un modèle IA compatible dans TypingMind et utilisez les outils dans une discussion ou attribuez-les à un agent IA.

  1. Ouvrez la page Plugins dans TypingMind.
  2. Activez les outils MCP de mcp-knowledge-graph.
  3. Démarrez une discussion et choisissez le modèle IA que vous souhaitez utiliser.
  4. Utilisez les outils MCP dans le chat ou attribuez-les à un agent IA.
  5. Passez à un autre modèle IA selon vos besoins sans rétablir la connexion MCP.
Discussion TypingMind utilisant des outils MCP activés avec un modèle d’IA sélectionné
Pouvez-vous utiliser mcp-knowledge-graph pour m’aider dans cette tâche ?
mcp-knowledge-graph
Bien sûr. J’ai tout lu.
Voici ce que j’ai trouvé avec mcp-knowledge-graph.

Foire aux questions

À quoi sert le serveur MCP mcp-knowledge-graph ?

mcp-knowledge-graph est un serveur MCP qui permet aux applications IA compatibles d’accéder à des outils et à des informations contextuelles externes. Dans TypingMind, il vous suffit d’ajouter ce serveur MCP une seule fois pour rendre ses outils disponibles dans votre espace de travail IA.

Puis-je utiliser le serveur MCP mcp-knowledge-graph avec plusieurs modèles IA dans TypingMind ?

Oui. TypingMind connecte les outils MCP au niveau de l’espace de travail. Vous pouvez donc utiliser mcp-knowledge-graph avec différents modèles IA comme Claude, ChatGPT, Gemini ou d’autres modèles configurés dans TypingMind, sans avoir à configurer le serveur MCP séparément pour chaque modèle.

Pourquoi utiliser le connecteur MCP mcp-knowledge-graph avec TypingMind ?

TypingMind est l’une des meilleures interfaces de chat avec les LLM, car elle réunit plusieurs modèles IA, prompts, plugins, agents IA, clés API et outils MCP dans un seul espace de travail. Une fois mcp-knowledge-graph connecté, vous pouvez utiliser ses outils MCP avec vos modèles préférés tout en gardant vos discussions bien organisées dans TypingMind.

Comment connecter le serveur MCP mcp-knowledge-graph à TypingMind ?

mcp-knowledge-graph fonctionne via le connecteur MCP local de TypingMind. C’est l’option idéale lorsque le serveur MCP doit accéder à des fichiers locaux, des applications de bureau, des outils en ligne de commande ou des ressources privées sur votre ordinateur.

Quels outils le serveur MCP mcp-knowledge-graph propose-t-il dans TypingMind ?

mcp-knowledge-graph propose 10 outils MCP que vous pouvez activer depuis la page Plugins de TypingMind et utiliser dans les discussions ou attribuer à des agents IA.

Dois-je partager mes clés API avec TypingMind pour utiliser le serveur MCP mcp-knowledge-graph ?

Non. TypingMind privilégie le fonctionnement local et vous permet de garder le contrôle de vos fournisseurs de modèles, clés API, prompts et paramètres MCP. Si mcp-knowledge-graph nécessite une authentification, ajoutez les en-têtes, les paramètres OAuth ou la configuration locale requis pour ce serveur MCP lors de la création de la connexion.

Serveurs MCP similaires

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇