Skip to main content
Glama
mcp-sqlite-graph-memory

mcp-sqlite-graph-memory

by Luiguard

mcp-sqlite-graph-memory

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

AIコーディングアシスタントと自律エージェント向けに、動的なSQLiteベースのコード知識グラフメモリを提供するユニバーサルModel Context Protocol(MCP)サーバー。

アクティブなワークスペースを自動検出し、複数言語のASTと構造的依存関係を解析して分離されたローカルSQLite知識グラフに格納し、シンボルの検査、最短の呼び出し/インポートパスの計算、コードトポロジーのナビゲーションのための高精度なMCPツールを公開します。


🌟 主な機能

  • ランタイム依存関係ゼロ: 完全にPython標準ライブラリ(ast、sqlite3、json、re、hashlib、threading)で記述。

  • 動的マルチワークスペース分離: ワークスペースルートごとに決定論的SHA-256ハッシュを生成し、分離されたSQLiteデータベースを ~/.mcp-graph-memory/storage/graph_<hash>.db に保存。

  • インクリメンタルstatキャッシュ: ファイルの mtime と size を検証し、再インデックス時に変更のないファイルをサブミリ秒でスキップ。

  • 多言語AST&構造パーサー:

    • Python: クラス、メソッド、関数、非同期関数、デコレータ、インポート(from x import y、import z)、継承階層、呼び出し箇所。

    • TypeScript / JavaScript: クラス、インターフェース、型、関数、アロー関数、ES6インポート/エクスポート、CommonJS require()。

    • Go: パッケージ、インポート、構造体、インターフェース、関数、メソッド。

    • Rust: モジュール、構造体、列挙型、トレイト、implブロック、fnシグネチャ。

    • C / C++ / Java / PHP / Ruby / Kotlin / Swift / Shell: 構造体、クラス、定義。

  • フリーズ&CPU枯渇保護:

    • ノンブロッキングな非同期デーモン初期化。

    • 非ビジーなstdioトランスポート(for raw_line in sys.stdin:)。

    • node_modules/、.git/、.venv/、バイナリ重み、キャッシュブロブに対する厳格な無視リスト。


Related MCP server: Synapse

🛠️ MCPツール仕様

ツール

パラメータ

説明

graph_reindex

force (bool)

ワークスペースのグラフメモリをインクリメンタルまたは強制的にスキャンして更新します。

graph_query_symbol

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

正確なファイルパス、行範囲、シグネチャ、および関連情報を持つシンボルを検索します。

graph_find_paths

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

2つのファイルまたはシンボル間の最短の依存関係/インポート/呼び出しパスを計算します。

graph_get_neighbors

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

直接の呼び出し元、呼び出し先、インポート、および包含エッジを検査します。

graph_structure_overview

depth (int), focus_path (str)

アーキテクチャメトリクス、ハブモジュール、ディレクトリツリーを返します。

graph_find_files

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

パスパターン、拡張子、または含まれるシンボルによってワークスペースのファイルを検索します。


🚀 インストール

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

🔌 統合ガイド

1. Google Antigravity統合

オプションA: グローバル設定(推奨)

graph-memory を、~/.gemini/config/mcp_config.json にあるグローバルなAntigravity MCP設定ファイルに追加します:

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

(/home/YOUR_USER を実際の $HOME ディレクトリパスに置き換えるか、絶対パスを使用してください)。

オプションB: ワークスペースレベル設定

プロジェクトごとの有効化には、ワークスペースルート内の .agents/mcp_config.json に mcp_config.json を配置します:

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

2. Claude Desktop統合

Claude設定ファイルを探します:

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

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

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

サーバー定義を追加します:

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

3. Cursor / VSCode / Windsurf統合

.cursor/mcp.json または .vscode/mcp.json に:

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

🔧 環境変数

変数

デフォルト

説明

MCP_GRAPH_STORAGE_DIR

~/.mcp-graph-memory/storage

SQLiteデータベース(graph_<hash>.db)用の永続ディレクトリ。

MCP_WORKSPACE_ROOT

os.getcwd()

クライアントが initialize で rootUri を省略した場合のフォールバックワークスペースパス。


🧪 検証とテスト

自動統合テストスイートを実行します:

python3 test_server.py

📄 ライセンス

MITライセンス - Copyright (c) 2026 Benjamin Leimer。詳細は LICENSE を参照してください。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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.
      9
      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.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI coding agents to query a local, continuously updated symbol graph of a codebase, providing ranked search, caller/callee exploration, dependency paths, and git-diff impact analysis through MCP tools.
      9 npm
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides AI agents with a local queryable graph of source code and Markdown, enabling symbol search, caller and dependency tracing, impact analysis, and task-focused context through MCP tools.
      12
      MIT