garrytan/gbrain

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

Aperta

#3645 aperta il 30 lug 2026

 (2 commenti) (0 reazioni) (0 assegnatari)TypeScript (3057 fork)github user discovery
fix-neededhelp wantedp1verified-real

Metriche repository

Star
 (21.368 stelle)
Metriche merge PR
 (Merge medio 18g 10h) (162 PR mergiate in 30 g)

Descrizione

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.

Guida contributor