garrytan/gbrain

MCP `sources_add` silently discards `path` — `local_path` persists as null, so `sync --all` skips the source forever

クローズ

#3,645 opened on 2026/07/30

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (3,057 件のフォーク)github user discovery
fix-neededhelp wantedp1verified-real

Repository metrics

Stars
 (21,368 個のスター)
PR merge metrics
 (平均マージ 18d 10h) (30d で 162 merged PRs)

説明

Version: gbrain 0.42.67.0 · engine: postgres

The MCP sources_add tool accepts a path argument, reports success, and does not persist itlocal_path comes back null. Because sync --all only picks up sources with a local_path, every source registered over MCP silently syncs nothing.

Repro

// call
{ "id": "service-a",
  "path": "/home/user/workspace/monorepo/repos/service-a",
  "federated": true }

// response — note local_path
{ "id": "service-a", "name": "service-a",
  "local_path": null, "last_commit": null, "last_sync_at": null,
  "config": { "federated": true } }

sources_list confirms it persisted as null:

{ "id": "service-a", "local_path": null, "remote_url": null,
  "federated": true, "page_count": 0 }

The CLI equivalent persists correctly:

$ gbrain sources add service-a --path /home/user/workspace/monorepo/repos/service-a
$ gbrain sources list
  service-a   isolated   0 pages   never synced
              /home/user/workspace/monorepo/repos/service-a

Impact

Registering repos over MCP appears to succeed and produces a brain that never indexes anything. Discovered while onboarding a multi-repo workspace: every source registered "successfully" over MCP, and sync --all skipped all of them without a warning. Had to drop them and re-register via CLI.

Expected

Either persist path (matching CLI behaviour), or reject the call when path cannot be honoured. Silently accepting and discarding a required argument is the problem.

A secondary guard worth considering: sync --all could warn when it skips sources for a missing local_path, rather than skipping silently — that would have surfaced this in seconds instead of after a full sync cycle.

コントリビューターガイド