Summary
When CodeGraphContext is used as an MCP server, the AI assistant receives raw graph query results with no guidance on how to reason about them. This issue proposes adding a configurable AI role — a system-level prompt that shapes how the AI interprets and responds to code graph data.
Problem
Currently, the MCP server returns structured graph data (callers, callees, complexity scores, etc.) but provides no context to the AI about:
- What role it should take (e.g. "code reviewer", "architecture explainer", "dead code auditor")
- How to format or prioritize its responses
- What the graph data semantically means
This means the quality of AI responses depends entirely on the user's prompt engineering, and varies across AI clients (Claude, Cursor, Copilot, etc.).
Proposed Solution
Add a --role or --ai-role option to codegraphcontext mcp start (and optionally to mcp setup) that injects a system prompt prefix when the MCP server responds.
Example built-in roles:
reviewer — frame responses as a senior code reviewer
architect — explain structural relationships and suggest improvements
auditor — focus on dead code, complexity, and risk areas
explainer — describe code for onboarding/documentation purposes
custom — read from a ~/.codegraphcontext/role.md file
codegraphcontext mcp start --role reviewer
codegraphcontext mcp start --role custom
Why This Is Implementable
- The MCP server already constructs response payloads; this is an additive wrapper
- Role definitions can be stored as simple
.md or .txt files under ~/.codegraphcontext/roles/
- No changes to graph DB or parsers needed
- A default "neutral" role maintains backward compatibility
Expected Outcome
Users get more consistent, context-aware AI responses when querying their codebase through any MCP-compatible client, without needing to manually craft system prompts.
Interested in contributing?
Happy to work on this if the maintainer is open to it. Can start with a draft PR for the CLI flag + one built-in role.
Summary
When CodeGraphContext is used as an MCP server, the AI assistant receives raw graph query results with no guidance on how to reason about them. This issue proposes adding a configurable AI role — a system-level prompt that shapes how the AI interprets and responds to code graph data.
Problem
Currently, the MCP server returns structured graph data (callers, callees, complexity scores, etc.) but provides no context to the AI about:
This means the quality of AI responses depends entirely on the user's prompt engineering, and varies across AI clients (Claude, Cursor, Copilot, etc.).
Proposed Solution
Add a
--roleor--ai-roleoption tocodegraphcontext mcp start(and optionally tomcp setup) that injects a system prompt prefix when the MCP server responds.Example built-in roles:
reviewer— frame responses as a senior code reviewerarchitect— explain structural relationships and suggest improvementsauditor— focus on dead code, complexity, and risk areasexplainer— describe code for onboarding/documentation purposescustom— read from a~/.codegraphcontext/role.mdfileWhy This Is Implementable
.mdor.txtfiles under~/.codegraphcontext/roles/Expected Outcome
Users get more consistent, context-aware AI responses when querying their codebase through any MCP-compatible client, without needing to manually craft system prompts.
Interested in contributing?
Happy to work on this if the maintainer is open to it. Can start with a draft PR for the CLI flag + one built-in role.