Skip to content

MCP-T13 + T14: cgraph init-agent + Docker dual-mode#683

Draft
DvirDukhan wants to merge 2 commits into
dvirdukhan/mcp-t12-auto-initfrom
dvirdukhan/mcp-t13-t14-packaging
Draft

MCP-T13 + T14: cgraph init-agent + Docker dual-mode#683
DvirDukhan wants to merge 2 commits into
dvirdukhan/mcp-t12-auto-initfrom
dvirdukhan/mcp-t13-t14-packaging

Conversation

@DvirDukhan
Copy link
Copy Markdown

MCP-T13 + T14 — agent guidance bundle & Docker dual-mode

Stacked on #682 (T12 auto-init). Closes #661 and #662.

T13 — cgraph init-agent

Two canonical guidance files now ship as package data under
api/mcp/templates/:

  • claude_mcp_section.md — full 8-tool table + rules of thumb
    (start with search_code; prefer structural tools over ask;
    run impact_analysis before refactoring).
  • cursorrules.template — Cursor-flavoured tool-selection rules.

New Typer command drops them into the current directory:

cgraph init-agent          # refuses to overwrite
cgraph init-agent --force  # clobber

AGENTS.md updated with the MCP section pointing at this command and
the supported env vars (CODE_GRAPH_AUTO_INDEX, CGRAPH_MODE).

T14 — Dockerised dual-mode

Same image now runs either the FastAPI web app or the MCP stdio
server based on CGRAPH_MODE:

# web (default, unchanged behaviour)
docker compose up code-graph

# mcp stdio
docker compose --profile mcp run --rm -i code-graph-mcp

start.sh dispatches on CGRAPH_MODE=web|mcp. docker-compose.yml
gains an opt-in code-graph-mcp service guarded by the mcp
profile (no impact on the default up). README quickstart covers
both claude mcp add-json and the Docker path.

Tests

  • 4 new CliRunner tests in tests/mcp/test_init_agent.py (write,
    refuse-overwrite, force-overwrite, package-data sanity).
  • Full MCP suite green: 61 passed in 23.3s locally.
  • bash -n start.sh clean.

Followups

T13 — agent guidance bundle:
  - Add `api/mcp/templates/` shipped as package data (claude_mcp_section.md,
    cursorrules.template) with the canonical 8-tool MCP guidance.
  - Add `cgraph init-agent [--force]` Typer command that drops
    CLAUDE.md and .cursorrules into CWD.
  - Update AGENTS.md with the MCP tool table and env-var reference.

T14 — packaging / image dual-mode:
  - `start.sh` dispatches on `CGRAPH_MODE` env var (web|mcp). Default
    (web) preserves the existing FastAPI behaviour; mcp execs cgraph-mcp.
  - `docker-compose.yml` gains an opt-in `code-graph-mcp` service under
    the `mcp` profile for stdio attach.
  - README quickstart section for both `claude mcp add-json` registration
    and Docker compose profile usage.

Tests: 4 new (CliRunner against tmp_path); MCP suite green at 61 passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 140aa5f4-f7a4-4044-b493-d88f6022b57d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dvirdukhan/mcp-t13-t14-packaging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Added scripts/mcp_smoke.py — drives cgraph-mcp over real stdio (mcp
SDK ClientSession + StdioServerParameters) and exercises tool
listing, index_repo, search_code, get_callers, impact_analysis.

Findings folded back into claude_mcp_section.md:
- index_repo takes path_or_url (not path) and derives project name
  from the folder/URL — agents must read it back from the response.
- Collection-returning tools land their array in
  structuredContent.result, not under a {results: [...]} wrapper.

Smoke result on api/ subgraph: 8 tools listed, 6324 nodes / 6228
edges indexed, all calls returned expected payloads.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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