-
-
Notifications
You must be signed in to change notification settings - Fork 4
fix: lazy engine loading for fast MCP startup #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
🟡 Change Impact Analysis
Blast Radius: 0 modules, 1 files, 127 unique callers 📝 Changed Symbols (224)
🎯 Affected Downstream (20)
Recommendations
Generated by CKB |
🔐 Security Audit Results
📦 Dependency VulnerabilitiesFound 7 vulnerability(ies) across 2 scanner(s) DetailsTrivy (4 findings)
OSV-Scanner (3 findings)
📜 License IssuesFound 144 non-permissive license(s) Details
Generated by CKB Security Audit | View Details | Security Tab |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (8.1%) is below the target coverage (30.0%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #123 +/- ##
=========================================
- Coverage 45.1% 45.0% -0.2%
=========================================
Files 350 350
Lines 59773 59968 +195
=========================================
+ Hits 26978 26988 +10
- Misses 30970 31144 +174
- Partials 1825 1836 +11
Flags with carried forward coverage won't be shown. Click here to find out more. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
CKB Analysis
Risk factors: Touches 4 hotspot(s)
🎯 Change Impact Analysis · 🟡 MEDIUM · 224 changed → 20 affected
Symbols changed in this PR:
Downstream symbols affected:
Recommendations:
🔥 Hotspots · 4 volatile files
📊 Complexity · 4 violations
💡 Quick wins · 10 suggestions
📚 Stale docs · 143 broken references
Generated by CKB · Run details |
MCP server was taking 43+ seconds to respond to initialize handshake because it loaded the entire SCIP index synchronously before starting. Changes: - Add NewMCPServerLazy() that accepts an engine loader function - Engine is now loaded on first tool call, not during startup - MCP handshake completes in ~0.6s instead of 43s - Temporarily disable multi-repo mode to use lazy path everywhere Also improves `ckb setup` for Claude Code: - Detect if CKB is already configured correctly (no action needed) - Warn when configured path differs from current binary - Show note when switching between npx and local binary - Automatically update config instead of failing with "already exists" Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
9781ed9 to
24c7f34
Compare
…ots support When an MCP client (e.g. Cursor) doesn't support roots/list, tool errors like SYMBOL_NOT_FOUND give no indication that the index might be for a different project. This adds repo path context to those errors so the AI agent can understand the mismatch. Also switches compound tools to GetEngine() to prevent nil panics with lazy loading. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
db8fa49 to
3d702d1
Compare
configureGrokGlobal and configureVSCodeGlobal now check for existing config before calling their respective CLIs, matching the pattern already used by configureClaudeCodeGlobal via claudeMcpAdd. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
ckb setupUX for Claude Code, Grok, and VS Code configurationroots/listProblem
The MCP server was loading the entire SCIP index synchronously before responding to the initialize handshake. For large codebases (e.g., 48MB index), this took 43+ seconds, causing Claude Code's health check to timeout and report "Failed to connect".
Additionally, when a client like Cursor doesn't support
roots/list, CKB can't auto-switch to the correct project. Tool errors likeSYMBOL_NOT_FOUNDgave no indication that the index might be for a different repo, causing AI agents to hallucinate explanations instead of understanding the mismatch.Changes
Lazy Engine Loading (
internal/mcp/server.go)NewMCPServerLazy()that accepts an engine loader functionRepo-Mismatch Detection (
internal/mcp/server.go,internal/mcp/tool_impls_compound.go)enrichNotFoundError()— when a not-found error occurs and the client didn't provide roots, append the indexed repo path to the error messages.engine()tos.GetEngine()to prevent nil panics with lazy loadingMCP Command (
cmd/ckb/mcp.go)Setup Command (
cmd/ckb/setup.go)getGrokMcpConfig()to read existing config from~/.grok/user-settings.json; skip CLI call when already configured, remove+re-add when config differsgetVSCodeGlobalMcpConfig()to read existing config from VS Code's platform-specificsettings.json; skip CLI call when already configured, warn and update when config differsTest plan
ckb setup --tool claude-code --globalworks when not configuredckb setup --tool claude-code --globalshows "already configured" when same pathckb setup --tool claude-code --globalwarns and updates when path differsckb setup --tool grok --globaldeduplicates existing entriesckb setup --tool vscode --globaldeduplicates existing entriesclaude mcp listshows CKB as connected (was failing before)go test ./cmd/ckb/...)go build -o ckb ./cmd/ckb)🤖 Generated with Claude Code