Skip to main content
Glama
Luiguard

mcp-sqlite-graph-memory

by Luiguard

mcp-sqlite-graph-memory

License: MIT Python: 3.10+ MCP: 2024-11-05

Universeller Model Context Protocol (MCP)-Server, der dynamisches SQLite-gestütztes Code-Wissensgraph-Gedächtnis für KI-Codierungsassistenten und autonome Agenten bereitstellt.

Erkennt automatisch aktive Workspaces, parst mehrsprachige ASTs und strukturelle Abhängigkeiten in einen isolierten lokalen SQLite-Wissensgraphen und stellt präzise MCP-Tools bereit, um Symbole zu untersuchen, kürzeste Aufruf-/Importpfade zu berechnen und Code-Topologien zu navigieren.


🌟 Hauptfunktionen

  • Null Laufzeitabhängigkeiten: Vollständig in der Python-Standardbibliothek geschrieben (ast, sqlite3, json, re, hashlib, threading).

  • Dynamische Multi-Workspace-Isolation: Generiert deterministische SHA-256-Hashes pro Workspace-Root; speichert isolierte SQLite-Datenbanken in ~/.mcp-graph-memory/storage/graph_<hash>.db.

  • Inkrementelles Stat-Caching: Überprüft mtime und size von Dateien, um bei unveränderten Dateien während der Neuindizierung Überspringungen im Sub-Millisekunden-Bereich zu erreichen.

  • Mehrsprachiger AST- & Strukturparser:

    • Python: Klassen, Methoden, Funktionen, asynchrone Funktionen, Dekorateure, Importe (from x import y, import z), Vererbungshierarchien, Aufrufstellen.

    • TypeScript / JavaScript: Klassen, Interfaces, Typen, Funktionen, Pfeilfunktionen, ES6-Importe/-Exporte, CommonJS require().

    • Go: Pakete, Importe, Structs, Interfaces, Funktionen, Methoden.

    • Rust: Module, Structs, Enums, Traits, impl-Blöcke, fn-Signaturen.

    • C / C++ / Java / PHP / Ruby / Kotlin / Swift / Shell: Structs, Klassen, Definitionen.

  • Schutz vor Einfrieren & CPU-Verhungern:

    • Nicht blockierende asynchrone Daemon-Initialisierung.

    • Nicht ausgelasteter Stdio-Transport (for raw_line in sys.stdin:).

    • Strikte Ignorierliste für node_modules/, .git/, .venv/, binäre Gewichte und Cache-Blobs.


Related MCP server: Synapse

🛠️ MCP-Tools-Spezifikation

Tool

Parameter

Beschreibung

graph_reindex

force (bool)

Scannt und aktualisiert den Workspace-Graphspeicher inkrementell oder erzwungen.

graph_query_symbol

query (str), type (str), exact (bool)

Findet Symbole mit exakten Dateipfaden, Zeilenbereichen, Signaturen und Beziehungen.

graph_find_paths

source (str), target (str), max_depth (int)

Berechnet kürzeste Abhängigkeits-/Import-/Aufrufpfade zwischen zwei Dateien oder Symbolen.

graph_get_neighbors

node_id_or_path (str), direction (in/out/both), relation (all/imports/calls/contains/inherits)

Untersucht direkte Aufrufer, Aufgerufene, Importe und Enthaltenseins-Kanten.

graph_structure_overview

depth (int), focus_path (str)

Gibt Architekturmetriken, Hub-Module und Verzeichnisbaum zurück.

graph_find_files

pattern (str), extension (str), contains_symbol (str)

Findet Workspace-Dateien nach Pfadmuster, Erweiterung oder enthaltenen Symbolen.


🚀 Installation

git clone https://github.com/Luiguard/mcp-sqlite-graph-memory.git ~/.mcp-graph-memory
chmod +x ~/.mcp-graph-memory/server.py

🔌 Integrationsanleitungen

1. Google-Antigravity-Integration

Option A: Globale Konfiguration (Empfohlen)

Fügen Sie graph-memory zu Ihrer globalen Antigravity-MCP-Konfigurationsdatei unter ~/.gemini/config/mcp_config.json hinzu:

{
  "mcpServers": {
    "graph-memory": {
      "command": "python3",
      "args": [
        "/home/YOUR_USER/.mcp-graph-memory/server.py"
      ]
    }
  }
}

(Ersetzen Sie /home/YOUR_USER durch Ihren tatsächlichen $HOME-Verzeichnispfad oder verwenden Sie einen absoluten Pfad).

Option B: Konfiguration auf Workspace-Ebene

Für die Aktivierung pro Projekt platzieren Sie mcp_config.json im Workspace-Root unter .agents/mcp_config.json:

{
  "mcpServers": {
    "graph-memory": {
      "command": "python3",
      "args": [
        "${workspaceFolder}/.mcp-graph-memory/server.py"
      ]
    }
  }
}

2. Claude-Desktop-Integration

Suchen Sie Ihre Claude-Konfiguration:

  • Linux: ~/.config/Claude/claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Fügen Sie die Serverdefinition hinzu:

{
  "mcpServers": {
    "graph-memory": {
      "command": "python3",
      "args": [
        "/path/to/mcp-sqlite-graph-memory/server.py"
      ]
    }
  }
}

3. Cursor-/VSCode-/Windsurf-Integration

In .cursor/mcp.json oder .vscode/mcp.json:

{
  "mcpServers": {
    "graph-memory": {
      "command": "python3",
      "args": [
        "/path/to/mcp-sqlite-graph-memory/server.py"
      ]
    }
  }
}

🔧 Umgebungsvariablen

Variable

Standard

Beschreibung

MCP_GRAPH_STORAGE_DIR

~/.mcp-graph-memory/storage

Persistentes Verzeichnis für SQLite-Datenbanken (graph_<hash>.db).

MCP_WORKSPACE_ROOT

os.getcwd()

Fallback-Workspace-Pfad, wenn der Client rootUri in initialize weglässt.


🧪 Verifizierung & Tests

Führen Sie die automatisierte Integrationssuite aus:

python3 test_server.py

📄 Lizenz

MIT-Lizenz - Copyright (c) 2026 Benjamin Leimer. Siehe LICENSE für Details.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI assistants with a structured, token-efficient map of a codebase's symbols, dependencies, and relationships via MCP tools like overview, query, and impact analysis.
    8
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides structural code intelligence via 26 MCP tools, enabling AI assistants to query code symbols, dependencies, and call graphs accurately without file-pasting.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides code intelligence by indexing source code into SQLite and offering MCP tools for symbol search, flow tracing, and context retrieval to assist with code navigation and understanding.
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    A persistent code-intelligence MCP server that builds a queryable knowledge graph of your codebase, enabling AI assistants to perform cross-file structural reasoning, dependency analysis, and blast radius detection.
    9
    MIT