Skip to content

fix: use a dedicated daemon connection for background MCP indexing#98

Merged
georgeh0 merged 1 commit intococoindex-io:mainfrom
ScavengerCoA:fix/mcp-bg-index-isolation
Mar 19, 2026
Merged

fix: use a dedicated daemon connection for background MCP indexing#98
georgeh0 merged 1 commit intococoindex-io:mainfrom
ScavengerCoA:fix/mcp-bg-index-isolation

Conversation

@ScavengerCoA
Copy link
Contributor

Background indexing during MCP startup shared the same DaemonClient (multiprocessing connection) as foreground search requests. Concurrent sends/recvs on the single pipe corrupted data, causing:

Query failed: Input data was truncated

_bg_index() now acquires a fresh DaemonClient via ensure_daemon(), uses it for indexing, and always closes it in finally. Both MCP startup paths are fixed (cli.py ccc mcp and server.py cocoindex-code).

Background indexing during MCP startup shared the same DaemonClient
(multiprocessing connection) as foreground search requests. Concurrent
sends/recvs on the single pipe corrupted data, causing:

    Query failed: Input data was truncated

_bg_index() now acquires a fresh DaemonClient via ensure_daemon(),
uses it for indexing, and always closes it in finally. Both MCP
startup paths are fixed (cli.py `ccc mcp` and server.py `cocoindex-code`).
@georgeh0
Copy link
Member

Thanks for the fix!

@georgeh0 georgeh0 merged commit a43cbbb into cocoindex-io:main Mar 19, 2026
5 checks passed
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.

2 participants