-
Notifications
You must be signed in to change notification settings - Fork 79
feat: Add Dockerization Strategy and MCP SSE support #82
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM node:20-alpine | ||
|
|
||
| RUN apk add --no-cache git ripgrep jq bash | ||
|
|
||
| RUN npm install -g @colbymchenry/codegraph supergateway | ||
|
|
||
| WORKDIR /repo | ||
|
|
||
| ENV CODEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS=0 | ||
|
|
||
| EXPOSE 8045 | ||
|
|
||
| ENTRYPOINT ["supergateway", "--port", "8045", "--stdio", "codegraph serve --mcp"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Colby's CodeGraph Dockerized | ||
|
|
||
| This repository provides a frictionless, containerized setup for [Colby McHenry's CodeGraph](https://github.com/colbymchenry/codegraph). It packages the Node-based `codegraph` CLI together with `supergateway` to expose the MCP server over an HTTP Server-Sent Events (SSE) endpoint. | ||
|
|
||
| This means your AI agents (Claude Code, Cursor, Codex, etc.) can connect to a live-syncing CodeGraph without you having to install Node.js, Rust, or any local binaries on your machine. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. **Clone this repository** (or copy `docker-compose.yml` to your project). | ||
| 2. **Start the container**: | ||
| ```bash | ||
| # Run this from the root of the project you want to index | ||
| docker-compose up -d | ||
| ``` | ||
|
Comment on lines
+10
to
+14
|
||
| *Note: This will index the current directory `.` by mounting it to `/repo` inside the container.* | ||
|
Comment on lines
+12
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The documented command cannot deliver the promised mount: after cloning this repository, running Useful? React with 👍 / 👎. |
||
|
|
||
| 3. **Wire your agents**: | ||
| Use the included script to automatically inject the MCP server configuration into your agents' global settings. | ||
| ```bash | ||
| ./wire-clients.sh | ||
| ``` | ||
|
Comment on lines
+17
to
+21
|
||
|
|
||
| ## How It Works | ||
|
|
||
| - The `Dockerfile` installs `@colbymchenry/codegraph` and `supergateway`. | ||
| - The `ENTRYPOINT` starts `supergateway` on port `8045` and proxies traffic to `codegraph serve --mcp`. | ||
| - The `docker-compose.yml` mounts your code to `/repo` and persists the `.codegraph` index so it doesn't have to rebuild from scratch if you restart the container. | ||
|
|
||
| ## Supported Auto-Wired Agents | ||
|
|
||
| The `wire-clients.sh` script automatically configures: | ||
| - Cursor | ||
| - VSCode native MCP | ||
| - Codex | ||
| - Gemini | ||
| - Kimi | ||
| - OpenCode | ||
| - Cline (VSCode extension) | ||
| - Roo Code (VSCode extension) | ||
| - Claude Code (Project-scoped) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| services: | ||
| codegraph-mcp: | ||
| build: . | ||
| image: colbymchenry-codegraph-mcp:latest | ||
| container_name: codegraph-mcp | ||
| restart: unless-stopped | ||
| ports: | ||
| - "8045:8045" | ||
| volumes: | ||
| # Mount the current repository (or any target repository) into the container | ||
| - .:/repo | ||
| # Persist the CodeGraph index so it doesn't rebuild on container restart | ||
|
Comment on lines
+10
to
+12
|
||
| - codegraph-cache:/repo/.codegraph | ||
| environment: | ||
| - PORT=8045 | ||
| hostname: codegraph-mcp | ||
|
|
||
| volumes: | ||
| codegraph-cache: | ||
| driver: local | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # wire-clients.sh | ||
| # A utility script to automatically configure popular AI coding agents | ||
| # to use the local CodeGraph MCP SSE server provided by this container. | ||
| # | ||
| # Usage: ./wire-clients.sh [SSE_URL] [PROJECT_DIR] | ||
| # Example: ./wire-clients.sh http://localhost:8045/sse /path/to/my/project | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SSE_URL="${1:-http://localhost:8045/sse}" | ||
| REPO_ROOT="${2:-$PWD}" | ||
|
Comment on lines
+12
to
+13
|
||
|
|
||
| inject_sse() { | ||
| local target="$1" | ||
| local agent="$2" | ||
|
|
||
| if [ ! -f "$target" ]; then | ||
| mkdir -p "$(dirname "$target")" | ||
| echo '{"mcpServers": {}}' > "$target" | ||
| fi | ||
|
|
||
| if ! jq . "$target" >/dev/null 2>&1; then | ||
| echo "WARNING: $target is not valid JSON, skipping $agent wiring" >&2 | ||
| return | ||
| fi | ||
|
|
||
| jq --arg url "$SSE_URL" '.mcpServers.codegraph = {"type": "sse", "url": $url}' "$target" > "$target.tmp" && mv "$target.tmp" "$target" | ||
| echo "✅ Wired CodeGraph SSE for $agent -> $target" | ||
|
Comment on lines
+29
to
+30
|
||
| } | ||
|
|
||
| echo "Wiring Colby's CodeGraph MCP SSE URL: $SSE_URL" | ||
| echo "" | ||
|
|
||
| # 1. Claude Code (Project-scoped) | ||
| inject_sse "$REPO_ROOT/.claude.json" "Claude Code" | ||
|
|
||
| # 2. Codex (Global) | ||
| inject_sse "$HOME/.codex/mcp.json" "Codex" | ||
|
|
||
| # 3. Gemini (Global) | ||
| inject_sse "$HOME/.gemini/config/mcp.json" "Gemini" | ||
|
|
||
| # 4. Kimi (Global) | ||
| inject_sse "$HOME/.kimi-code/mcp.json" "Kimi" | ||
|
|
||
| # 5. OpenCode (Global) | ||
| inject_sse "$HOME/.opencode/mcp.json" "OpenCode" | ||
|
|
||
| # 6. Cursor (Global) | ||
| inject_sse "$HOME/.cursor/mcp.json" "Cursor" | ||
|
|
||
| # 7. VSCode native MCP (Global) | ||
| inject_sse "$HOME/.vscode/mcp.json" "VSCode" | ||
|
|
||
| # 8. Cline (VSCode extension) | ||
| CLINE_PATH="$HOME/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json" | ||
| [ "$(uname)" = "Darwin" ] && CLINE_PATH="$HOME/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json" | ||
| inject_sse "$CLINE_PATH" "Cline" | ||
|
|
||
| # 9. Roo (VSCode extension) | ||
| ROO_PATH="$HOME/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json" | ||
| [ "$(uname)" = "Darwin" ] && ROO_PATH="$HOME/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json" | ||
| inject_sse "$ROO_PATH" "Roo Code" | ||
|
|
||
| echo "" | ||
| echo "Done! Restart your agents to apply the new configuration." | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For every image built from this Dockerfile, the entrypoint delegates to
codegraph serve --mcp, but the tracked CLI definesstartas its MCP-server command and has noservesubcommand (repo-wide search of the Rust CLI finds onlycodegraph start stdio/http). Moreover, the image installs a separately published npm package rather than building this repository, so it cannot run the reviewed server revision; build the repository binary and invoke its supported stdio command, or pin and validate a package whose CLI actually provides this invocation.Useful? React with 👍 / 👎.