Skip to main content
Glama
skylarng89

CogMemory MCP Server

by skylarng89

CogMemory MCP サーバー

AI コーディングエージェント向けに4つのコンテキストサブシステムを提供する統合 Model Context Protocol サーバー:

  1. メモリ — 決定、規約、エラー、アクティブコンテキスト、変更ログ、計画、タスク、セッション

  2. ナレッジグラフ — エンティティ、リレーション、オブザベーション

  3. スペック — 長文ドキュメント(PRD/SRS)、KGエンティティへのオプションリンク付き

  4. コードグラフ — 静的構造グラフ(シンボル/エッジ)+ 名前付き実行トレース + AI生成アノテーション

ストレージ:SQLitebetter-sqlite3 使用)。スコープごとに1つの .db ファイル。


クイックスタート

インストール

git clone <repo> && cd cogmemory-mcp
pnpm install
pnpm run build

VS Code での設定

.vscode/mcp.json(ワークスペーススコープ)に追加:

{
  "servers": {
    "cogmemory": {
      "command": "node",
      "args": ["/absolute/path/to/cogmemory-mcp/dist/index.js"]
    }
  }
}

または、グローバルで利用するにはユーザー mcp.json に追加します。

MCP Inspector での実行(開発用)

pnpm run inspect

Related MCP server: LumenCore

スコープ設定

CogMemory は以下の優先順位でスコープを解決します:

  1. ワークスペースルートの .cogmemory/config.json

    { "scope": "global" }
  2. 環境変数COGMEMORY_SCOPE=global

  3. デフォルトworkspace

パス

スコープ

データベースパス

workspace

<workspace_root>/.cogmemory/memory.db

global

~/.cogmemory/global.db


ワークスペース解決とマルチルートサポート

CogMemory はワークスペースルート(.cogmemory/memory.db が配置される場所)を以下の優先順位で解決します:

  1. --workspace <path> CLI 引数(最優先)

  2. COGMEMORY_WORKSPACE 環境変数

  3. CWD からの遡及検索.cogmemory/ ディレクトリを含む最も近い親ディレクトリを検索

  4. CWD へのフォールバック

マルチルート VS Code ワークスペース

VS Code のマルチルートワークスペースでは、各フォルダが独立したワークスペースルートとなります。CogMemory はこれを次のように処理します:

  • シングルルート — 自動的に動作。VS Code は CWD をワークスペースフォルダに設定し、--workspacemcp.json を介して渡されます。

  • マルチルート — 各ワークスペースフォルダは独自の .cogmemory/ を持つことができます。それぞれ異なる --workspace パスで CogMemory を指定するか、親ディレクトリに共有の .cogmemory/ を配置します。

推奨されるマルチルート mcp.json(フォルダごと):

{
  "servers": {
    "cogmemory-frontend": {
      "command": "node",
      "args": [
        "/path/to/cogmemory-mcp/dist/index.js",
        "--workspace",
        "/path/to/frontend"
      ]
    },
    "cogmemory-backend": {
      "command": "node",
      "args": [
        "/path/to/cogmemory-mcp/dist/index.js",
        "--workspace",
        "/path/to/backend"
      ]
    }
  }
}

または共有データベースを使用(すべてのルートを1か所に):

{
  "servers": {
    "cogmemory": {
      "command": "node",
      "args": [
        "/path/to/cogmemory-mcp/dist/index.js",
        "--workspace",
        "/shared/root"
      ]
    }
  }
}

またはグローバルスコープを使用して、すべてのワークスペース間で共有:

{
  "servers": {
    "cogmemory": {
      "command": "node",
      "args": ["/path/to/cogmemory-mcp/dist/index.js"]
    }
  }
}
export COGMEMORY_SCOPE=global

ツールリファレンス

メモリツール

ツール

説明

start_session

ワークセッションを開始(セッションIDを返す)

end_session

セッションを終了し、サマリーを保存

get_session_summary

決定、エラー、変更ログを含むセッション詳細を呼び出す

remember_decision

根拠とタグ付きで決定を記録

remember_convention

規約を記録/更新(デザイントークン、パターン、命名規則など)

log_error

シグネチャと解決策付きでエラーを記録

set_active_context

現在のフォーカス/タスクをキーでアップサート

get_active_context

現在のフォーカスをキーで読み取り

log_change

変更ログエントリを追加

add_plan_item

ロードマップ項目を追加

update_plan_status

プラン項目のステータスを変更

create_task

タスクを作成(プランへのオプションリンク付き)

update_task_status

タスクのステータスを変更

recall

決定/規約/エラー/変更ログを横断した統合検索

ナレッジグラフツール

ツール

説明

create_entity

エンティティを追加(name+type で重複排除)

create_relation

2つのエンティティを型付きリレーションでリンク

add_observation

エンティティにファクトを添付

search_knowledge

エンティティ、リレーション、オブザベーションを検索

スペックツール

ツール

説明

create_spec

長文ドキュメントを保存

get_spec

IDまたは完全なタイトルで取得

update_spec

コンテンツ/タイトルを更新(バージョン自動更新)

コードグラフツール

ツール

説明

index_codebase

ワークスペースを走査し、ts-morph でシンボル+エッジを抽出(JS/TS)

query_code_graph

シンボルの呼び出し元/呼び出し先(1ホップ)を検索

generate_codemap

エントリシンボルから BFS、オプションのトレース+アノテーション付きで有界サブグラフを生成

annotate_symbol

シンボルまたはトレースにナラティブテキストを添付


アーキテクチャ

cogmemory-mcp/
├── src/
│   ├── index.ts                 # entry point, server bootstrap
│   ├── config.ts                # scope resolution, path resolution
│   ├── types.ts                 # shared TS types mirroring schema
│   ├── db/
│   │   ├── connection.ts        # DB open/close, pragma setup
│   │   ├── schema.sql           # full schema (reference)
│   │   └── migrate.ts           # idempotent schema application
│   ├── tools/
│   │   ├── memory.ts            # decisions/conventions/errors/context/changelog/recall
│   │   ├── plan-tasks.ts        # plan + tasks tools
│   │   ├── sessions.ts          # start/end session, summary
│   │   ├── knowledge-graph.ts   # entities/relations/observations
│   │   ├── specs.ts             # spec CRUD
│   │   ├── code-graph.ts        # index_codebase, query_code_graph
│   │   └── codemap.ts           # generate_codemap, annotate_symbol
│   └── indexing/
│       ├── ts-analyzer.ts       # ts-morph symbol/edge extraction
│       └── walker.ts            # file discovery, gitignore respect
├── schema.sql                   # reference copy
├── package.json
├── tsconfig.json
└── README.md

スキーマ(15テーブル)

  • メモリ(8): sessionsdecisionsconventionserrorscontextchangelogplantasks

  • ナレッジグラフ(3): entitiesrelationsobservations

  • スペック(1): specs

  • コードグラフ(4): symbolsedgesexecution_tracescodemap_annotations


プラグマ

接続を開くたびに設定:

PRAGMA journal_mode = WAL;
PRAGMA foreign_keys = ON;

開発

pnpm run dev        # Run with tsx (no build step)
pnpm run build      # Compile TypeScript
pnpm run start      # Run compiled output
pnpm run inspect    # Launch MCP Inspector
pnpm run smoke-test # Run smoke test script

ライセンス

MIT

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides AI coding assistants with persistent project memory to retain architectural decisions, code patterns, and domain knowledge across sessions. It stores data locally in a SQLite database, allowing agents to remember, recall, and manage project-specific context using full-text search.
    8
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI coding agents to maintain persistent, cross-session memory of codebase architecture, naming conventions, and decisions through MCP tools. Eliminates repetitive project re-explanation by automatically injecting stored context into every session with local-first SQLite storage and optional team sharing capabilities.
    4
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Provides persistent cross-session memory and full-text search for AI coding assistants, storing project context, decisions, and preferences while enabling searchable access to conversation history via local SQLite.
    8
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.

  • Universal memory for AI agents and tools. Save, organize and search context anywhere.

  • Give your AI agent a persistent map of your project's structure, dependencies, and bugs.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/skylarng89/cogmemory-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server