Skip to content

feat(mcpx): codedb shared daemon + stdio MCP bridge — lift the #2220 park (#4120, #2225) - #4171

Merged
dezren39 merged 3 commits into
mainfrom
queue/6027-4120-codedb-bridge
Nov 2, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/6027-4120-codedb-bridge

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Implements the #2225 determination (task 5226) in the shape it chose: one shared codedb serve daemon per project root + a thin stdio MCP bridge, lifting the PR #2220 park. Closes #4120 and #2225 on merge.

What changed

  • bin/codedb-bridge.mjs — stateless stdio MCP shim (no index, no state) exposing the daemon-backed codedb tools and forwarding to http://127.0.0.1:7719. Per the Design: unknown means stop — one strict argument contract for the repo's operator scripts #3352 argument contract, arguments the daemon cannot honour (project, regex:true, scope:true, compact:true) are rejected by name, never silently ignored; max_results/limit are honoured by slicing.
  • bin/codedb-bridge.test.mjs — 6 node tests (URL parsing, route mapping, strict-argument rejection, handler, forwarding, error surfacing). All pass: node --test bin/codedb-bridge.test.mjs → 6/6.
  • .mcpx.json — codedb moves from disabledMcpServers to mcpServers (node /home/user/git/code/bin/codedb-bridge.mjs, CODEDB_NO_TELEMETRY=1 retained). The now-empty disabledMcpServers block is removed.

Daemon surface (verified live, codedb 0.2.2)

The daemon's routes are under /explore/ (the #2225 note's bare /tree etc. 404): GET /health, /explore/tree, /explore/outline?path=, /explore/symbol?name=, /explore/search?q=, /explore/word?q=, /explore/hot, /explore/deps?path=. No route exists for read/edit/changes/status/snapshot/bundle/projects/index, so the bridge does not advertise those tools. Stale-index behaviour: the daemon tracks the live tree — tree output changed between calls minutes apart with no restart, while back-to-back calls are identical.

Daemon unit (laptop, operational — not in this diff)

~/.config/systemd/user/codedb-code.service: ExecStart=/home/user/bin/codedb /home/user/git/code serve, CODEDB_NO_TELEMETRY=1, Restart=always, enabled + active; /health returns {"status":"ok"}.

Verification (laptop, ~/git/code, fixed query set)

  • Equivalence bridge vs direct codedb mcp stdio: search IdentityStore 45 = 45 results (same path:line set), word 45 = 45, symbol 2 = 2 (identity.rs:95 struct_def, :119 impl_block), outline of pkgs/id/src/web/mod.rs — all 50 daemon symbol names present in direct output, hot 10/10 files present. Tree bodies match modulo the direct server's header line and live-index drift between sequential runs.
  • Concurrency: 3 simultaneous bridge sessions each returned the full 45 search results while ps showed exactly one codedb process — the systemd daemon (~2.0 GB RSS cold-loaded for the code root, the single shared cost that replaces ~1.1 GB warm per session).

Known limit

codedb serve binds the fixed port 7719, so a second per-root daemon cannot coexist yet; this PR ships the code root only, per the issue scope ("add further primary roots only as needed"). Additional roots need codedb port configurability first.

Refs: task 6027, #2225 determination, PR #2220 (the park this lifts).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…park in the new shape (#4120)

One codedb serve daemon per project root (user systemd unit codedb-code.service for ~/git/code) replaces one index-holding codedb mcp process per session (~1.1 GB RSS warm each, #2225). bin/codedb-bridge.mjs is a stateless stdio MCP shim forwarding the daemon-backed tools (tree/outline/symbol/search/word/hot/deps) to http://127.0.0.1:7719/explore/*; arguments the daemon cannot honour are rejected by name per the #3352 contract. .mcpx.json moves codedb from disabledMcpServers to mcpServers via the bridge, CODEDB_NO_TELEMETRY=1 retained.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 04:39
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4b8e6bad-9cc9-4c65-b255-e8bdd6c505fd
Commits

Reviewing files that changed from the base of the PR and between 687ac07 and f482cb4.

Files selected for processing: 3
  • .mcpx.json
  • bin/codedb-bridge.mjs
  • bin/codedb-bridge.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T04:53:21.178198Z f482cb4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebcb0917be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/codedb-bridge.mjs Resolved
…ocking (PR #4171 Codex P2)

The stdio read loop awaited each daemon call, so one slow search blocked every later request in a bridge process that mcpx may share across sessions. Requests now dispatch independently and responses correlate by JSON-RPC id; the process exits only once stdin is closed and all pending calls settle. Regression test spawns the bridge against a delayed stub daemon and asserts a ping is answered before the slow search.
@dezren39

dezren39 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@codex review — follow-up commit 8fb94c2 fixes the P2 head-of-line blocking finding (concurrent dispatch + regression test). Please re-review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fb94c2a7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/codedb-bridge.mjs Resolved
… Codex P2)

process.exit(0) could discard pipe-queued stdout when stdin closed with a request pending, truncating the final (possibly multi-MB tree) response. Responses now settle in their write callbacks, and exit is queued behind an empty write that fires only after all prior output flushed. Regression test: stub daemon returns a ~2 MiB tree after a delay, client closes stdin immediately, full response must arrive and parse.
@dezren39

dezren39 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@codex review — commit f482cb4 fixes the second P2 (stdout flush before exit, with regression test). Please re-review.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: f482cb44d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codedb shared daemon + MCP bridge: one codedb serve per project root, lift the #2220 park in the new shape (#2225)

1 participant