feat(codecontext): upgrade sidecar to boocontext MCP aggregator
- Multi-stage Dockerfile builds boocontext (Node) + HTTP shim (Go) - shim.go supports CODECONTEXT_CHILD env var for configurable MCP child - Adds routes for get_symbol_details, get_call_graph, get_blast_radius - docker-compose.yml adds env vars for child MCP paths
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
@@ -185,13 +186,14 @@ func notify(method string, params any) error {
|
||||
// ---- Child lifecycle ----
|
||||
|
||||
func startChild() error {
|
||||
// `codecontext mcp` with --watch=true (the default) keeps fsnotify
|
||||
// running on the indexed directory; the per-call target_dir swap
|
||||
// invalidates and re-indexes on demand. `--target=/opt/projects` is the
|
||||
// initial scan target — codecontext rebuilds the graph against whatever
|
||||
// target_dir each call carries, so this is just a valid bootstrap path
|
||||
// (the default "." is the alpine root and trips on transient /proc fds).
|
||||
child = exec.Command("codecontext", "mcp", "--target=/opt/projects", "--watch=true", "--respect-gitignore")
|
||||
// Support CODECONTEXT_CHILD env var for overriding the MCP child command.
|
||||
// Default to boocontext (Node.js MCP aggregator). Set in docker-compose.
|
||||
childCmd := os.Getenv("CODECONTEXT_CHILD")
|
||||
if childCmd == "" {
|
||||
childCmd = "node /usr/local/lib/boocontext/dist/index.js"
|
||||
}
|
||||
parts := strings.Split(childCmd, " ")
|
||||
child = exec.Command(parts[0], parts[1:]...)
|
||||
var err error
|
||||
childStdin, err = child.StdinPipe()
|
||||
if err != nil {
|
||||
@@ -417,6 +419,9 @@ func main() {
|
||||
mux.HandleFunc("POST /v1/watch_changes", makeToolHandler("watch_changes"))
|
||||
mux.HandleFunc("POST /v1/get_semantic_neighborhoods", makeToolHandler("get_semantic_neighborhoods"))
|
||||
mux.HandleFunc("POST /v1/get_framework_analysis", makeToolHandler("get_framework_analysis"))
|
||||
mux.HandleFunc("POST /v1/get_symbol_details", makeToolHandler("get_symbol_details"))
|
||||
mux.HandleFunc("POST /v1/get_call_graph", makeToolHandler("get_call_graph"))
|
||||
mux.HandleFunc("POST /v1/get_blast_radius", makeToolHandler("get_blast_radius"))
|
||||
|
||||
server := &http.Server{
|
||||
Addr: ":8080",
|
||||
|
||||
Reference in New Issue
Block a user