Skip to content

Conversation

@SimplyLiz
Copy link
Owner

Summary

  • MCP tools now auto-detect which repo a call is for based on file paths in the params
  • Eliminates the need for explicit switchRepo calls before querying a different repo
  • Engine cache manages up to 5 engines with LRU eviction

Changes

  • New: repo_resolver.goextractPathHint() scans params for file paths; resolveRepoForPath() resolves to git root
  • New: engine_cache.gogetOrCreateEngine() manages thread-safe engine pool; ensureActiveEngine() swaps active engine
  • Modified: handler.go — Hook auto-resolution into handleCallTool dispatch
  • Modified: server.go — Init engine cache in constructors; simplified switchToClientRoot
  • Modified: tool_impls_multirepo.go — Removed IsMultiRepoMode() gates; tools now work in all modes
  • Modified: mcp.go — Removed TODO skips

Test plan

  • go build passes
  • go test ./internal/mcp/... passes
  • go test ./internal/repos/... passes
  • golangci-lint run clean (non-test files)

🤖 Generated with Claude Code

MCP tools now auto-detect which repo a call is for based on file paths
in the params (filePath, path, targetPath, target, moduleId). This
eliminates the need for explicit switchRepo calls before querying a
different repo.

- Add repo_resolver.go with extractPathHint() and resolveRepoForPath()
- Add engine_cache.go with getOrCreateEngine() and ensureActiveEngine()
- Hook auto-resolution into handleCallTool dispatch
- Initialize engine cache in all server constructors
- Remove IsMultiRepoMode() gates from listRepos/switchRepo/getActiveRepo
- Remove TODO skips in cmd/ckb/mcp.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🟡 Change Impact Analysis

Metric Value
Risk Level MEDIUM 🟡
Files Changed 6
Symbols Changed 127
Directly Affected 1
Transitively Affected 64

Blast Radius: 0 modules, 1 files, 65 unique callers

📝 Changed Symbols (127)
Symbol File Type Confidence
MCPServer#ensureActiveEngine internal/mcp/engine_cache.go added 100%
MCPServer#getOrCreateEngine internal/mcp/engine_cache.go added 100%
MCPServer#resolveRepoForPath internal/mcp/handler.go modified 100%
_test internal/mcp/engine_cache.go added 100%
ch internal/mcp/engine_cache.go added 100%
config internal/mcp/tool_impls_multirepo.go modified 100%
data internal/mcp/engine_cache.go added 100%
delivery internal/mcp/engine_cache.go added 100%
delivery internal/mcp/tool_impls_multirepo.go modified 100%
err internal/mcp/engine_cache.go added 100%
err internal/mcp/engine_cache.go added 100%
event internal/mcp/engine_cache.go added 100%
extractPathHint internal/mcp/handler.go modified 100%
id internal/mcp/tool_impls_multirepo.go modified 100%
id internal/mcp/tool_impls_multirepo.go modified 100%
+112 more
🎯 Affected Downstream (20)
Symbol Module Distance Kind
unknown `` 1 type-dependency
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/cmd/ckb/listPresets(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkResourcesList(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolSchemaSize(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolsList(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolsListPaginated(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolsListSize(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#GetEngine(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#RegisterTools(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#enrichNotFoundError(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#getIndexStaleness(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#getTelemetryStorage(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#handleCallTool(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#handleCallToolRequest(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#requestRoots(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#resolveRepoForPath(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#streamFindReferences(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#streamSearchSymbols(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#switchToClientRoot(). `` 2 transitive-caller
scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/MCPServer#toolSwitchRepo(). `` 2 transitive-caller

Recommendations

  • ⚠️ test: Significant transitive impact (64 symbols). Run comprehensive test suite.
    • Action: Run full test suite before merging

⚠️ Index is 0 commit(s) behind HEAD. Results may be incomplete.


Generated by CKB

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🔐 Security Audit Results

⚠️ Security gate passed with warnings - 8 issue(s) found (review recommended)

Category Findings
🔑 Secrets ✅ 0
🛡️ SAST ✅ 0
📦 Dependencies ⚠️ 8
📜 Licenses ⚠️ 144 non-permissive

📦 Dependency Vulnerabilities

Found 8 vulnerability(ies) across 2 scanner(s)

Details

Trivy (4 findings)

  • CVE-2026-22036 (MEDIUM): undici - undici: Undici: Denial of Service via excessive de...
  • CVE-2025-54410 (LOW): github.com/docker/docker - github.com/moby/moby: Moby's Firewalld reload remo...
  • GHSA-vrw8-fxc6-2r93 (MEDIUM): github.com/go-chi/chi/v5 - chi Allows Host Header Injection which Leads to Op...
  • CVE-2025-47908 (MEDIUM): github.com/rs/cors - github.com/rs/cors: Denial of service via maliciou...

OSV-Scanner (4 findings)

  • github.com/docker/docker: 2 vulnerabilities
  • github.com/go-chi/chi/v5: 1 vulnerabilities
  • github.com/rs/cors: 2 vulnerabilities
  • stdlib: 1 vulnerabilities

📜 License Issues

Found 144 non-permissive license(s)

Details
  • github.com/BurntSushi/toml: MIT (notice)
  • github.com/google/uuid: BSD-3-Clause (notice)
  • github.com/klauspost/compress: Apache-2.0 (notice)
  • github.com/klauspost/compress: BSD-3-Clause (notice)
  • github.com/klauspost/compress: MIT (notice)
  • github.com/pelletier/go-toml/v2: MIT (notice)
  • github.com/smacker/go-tree-sitter: MIT (notice)
  • github.com/sourcegraph/go-diff: MIT (notice)
  • github.com/sourcegraph/scip: Apache-2.0 (notice)
  • github.com/spf13/cobra: Apache-2.0 (notice)
  • ... and 134 more

Generated by CKB Security Audit | View Details | Security Tab

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 14.07767% with 177 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/mcp/tool_impls_multirepo.go 0.0% 73 Missing ⚠️
internal/mcp/engine_cache.go 6.1% 60 Missing and 1 partial ⚠️
internal/mcp/server.go 34.2% 25 Missing ⚠️
internal/mcp/repo_resolver.go 44.0% 9 Missing and 5 partials ⚠️
cmd/ckb/mcp.go 0.0% 2 Missing ⚠️
internal/mcp/handler.go 33.3% 1 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (14.0%) 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    #131     +/-   ##
=========================================
- Coverage     45.5%   45.5%   -0.1%     
=========================================
  Files          365     367      +2     
  Lines        61829   61897     +68     
=========================================
+ Hits         28169   28198     +29     
- Misses       31758   31789     +31     
- Partials      1902    1910      +8     
Flag Coverage Δ
unit 45.5% <14.0%> (-0.1%) ⬇️

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

CKB Analysis

Risk Files +351 -213 Modules

🎯 127 changed → 64 affected · 🔥 4 hotspots · 📊 4 complex · 📚 143 stale

Risk factors: Moderate churn: 564 lines changed • Touches 4 hotspot(s)

Metric Value
Impact Analysis 127 symbols → 64 affected 🟡
Doc Coverage 9.090909090909092% ⚠️
Complexity 4 violations ⚠️
Coupling 0 gaps
Blast Radius 0 modules, 1 files
Index indexed (7s) 🆕
🎯 Change Impact Analysis · 🟡 MEDIUM · 127 changed → 20 affected
Metric Value
Symbols Changed 127
Directly Affected 1
Transitively Affected 64
Modules in Blast Radius 0
Files in Blast Radius 1

Symbols changed in this PR:

Downstream symbols affected:
Direct callers (1):

  • unknown
    Transitive callers (19):
  • scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/cmd/ckb/listPresets(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkResourcesList(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolSchemaSize(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolsList(). (depth 2)
  • scip-go gomod github.com/SimplyLiz/CodeMCP 76ff05c1b6be github.com/SimplyLiz/CodeMCP/internal/mcp/BenchmarkToolsListPaginated(). (depth 2)
  • … and 14 more transitive callers

Recommendations:

  • ⚠️ Significant transitive impact (64 symbols). Run comprehensive test suite.
    • Action: Run full test suite before merging

⚠️ Index is undefined commit(s) behind HEAD. Results may be incomplete. Run ckb index to refresh.

🔥 Hotspots · 4 volatile files
File Churn Score
cmd/ckb/mcp.go 8.33
internal/mcp/handler.go 7.79
internal/mcp/server.go 10.10
internal/mcp/tool_impls_multirepo.go 8.41
📊 Complexity · 4 violations
File Cyclomatic Cognitive
cmd/ckb/mcp.go ⚠️ 28 ⚠️ 65
internal/mcp/handler.go 12 ⚠️ 32
internal/mcp/server.go 12 ⚠️ 26
internal/mcp/tool_impls_multirepo.go 11 ⚠️ 21
💡 Quick wins · 10 suggestions
📚 Stale docs · 143 broken references

Generated by CKB · Run details

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.

1 participant