MCP Server
Usage and MCP tools
What to ask your assistant once the CppDepend MCP Server is registered, and the 14 MCP tools it calls to answer: initialization, analysis, metrics, dependencies, issues, rules, quality gates, sources and code queries.
Usage
Once the server is registered, ask your assistant questions like these.
Initialize, run the analysis, build the web report
run cppdepend analysis
give me analysis details
build a cppdepend web report
Generate a code query or a rule to answer a complex request
list pairs of classes that use each other
check for the SOLID open/closed principle
list methods that are both poorly maintainable and insufficiently tested
find Clean Architecture violations
Dependencies
which callers and callees for this class
show a call graph of this method
Issue list and fix
which new issues in files named like Period
fix the first one
which code sprawl related issues
Metrics
which complex methods are poorly covered by tests
list less maintainable methods
Quality gates
which quality gates fail
which quality gates got fixed since the baseline
Rules
which cppdepend rules fail with more than 5 issues
Code search
which class is related to authentication
Source files
which source files changed since the baseline
describe changes in the third one
show diff for the last 5
The 14 MCP tools
The server exposes 14 MCP tools, grouped below by purpose.
Initialization
cppdepend-initialize-from-solution
Initialize the CppDepend analysis session with a solution file. If a CppDepend project (.cdproj) is attached to the solution, use it. Otherwise create a CppDepend project side by side with the solution and analyze it.
Use when:
- Required first step before using any other CppDepend MCP tool
- Switching to a different solution
Analysis
cppdepend-run-analysis
Run the CppDepend analysis on the initialized workspace and update all session data (dependencies, issues, metrics...). Returns the analysis data loaded (snapshot date, baseline snapshot date, analysis result file...).
Use when:
- You ask explicitly: "run analysis", "analyze the code", "refresh results"
- Post-fix verification: "I fixed the issues, check again"
- After code changes or recompilation
cppdepend-run-analysis-build-report
Run the CppDepend analysis, update all session data, build a web report and open it in the browser.
Use when:
- You ask: "show me a web report", "generate HTML report", "visualize the analysis"
- You want interactive exploration
- You ask for visual or graphical output
Code metrics
cppdepend-search-code-metrics
Collect and analyze code metrics for quality assessment.
Use when:
- Refactoring candidates: "Which code is poorly maintainable?"
- Quality assessment: "How complex is the UserService class?"
- Test coverage analysis: "Which methods need more tests?"
- Size and complexity: "How many lines of code in this class?"
- Comparison and prioritization: "Compare metrics across modules"
Also used for code search:
- Discovery and navigation: "Which classes are related to authentication?"
- Patterns and conventions: "Which classes follow the *Manager pattern?"
- File-based: "What's in the UserService.cpp file?"
- Change tracking: "Which methods were added since the baseline?"
Dependency analysis
cppdepend-list-dependencies
Collect and present dependencies for code elements with comprehensive context. Also generate an HTML SVG diagram of the requested dependencies.
Use when:
- Understanding usage (callers): "What calls this method?"
- Understanding dependencies (callees): "What does this method call?"
- Impact analysis: "If I change this method, what breaks?"
- Call chain exploration: "Show me the full call chain"
- Refactoring planning: "Can I safely delete this method?"
- Architectural analysis: "Does the UI layer call the database directly?"
- Debugging: "How is this method being invoked?"
- Code review: "What's affected by this new method?"
Issue management
cppdepend-list-issues
List the issues scoped by your request, with comprehensive details.
Use when:
- Code quality and review: "List issues in this source file"
- Technical debt management: "Show me all technical debt items"
- Compliance and standards: "List all coding standard violations"
- Reporting: "Generate a report of all issues by severity"
cppdepend-get-issue-details-to-fix-it
Retrieve comprehensive diagnostic information for a specific issue.
Use when:
- You ask: "How do I fix issue #X?"
- You want detailed information about an issue
- You want the assistant to fix the issue
Rule management
cppdepend-list-all-rules-summary
Return a hierarchical, categorized summary of all rules in the current project, each with the number of issues found.
Use when:
- Discover the available rules before calling
cppdepend-list-rules-detailedorcppdepend-list-issues - Find the valid values for
filterRuleCategoriesandfilterRuleIdsbefore callingcppdepend-list-rules-detailedorcppdepend-list-issues - Audit and governance
cppdepend-list-rules-detailed
Return a paginated list of rules with descriptions and fix guidance.
Use when:
- Understanding what a specific rule checks
- Learning how to fix violations
- Exploring rule documentation
- After calling
cppdepend-list-all-rules-summaryto get detailed information
Quality gates
cppdepend-list-quality-gates-status
Return the status of each quality gate to assess code quality standards.
Use when:
- Status checks: "Did the code pass the quality gates?"
- Failure investigation: "Which quality gates are failing?"
- Specific gates: "Did we pass the test coverage gate?"
- Pre-merge validation: "Can I merge this PR?"
- Thresholds: "What are the quality gate thresholds?"
- Comparison and trends: "How does this compare to the baseline?"
- Team standards: "What quality gates do we have?"
- Build issues: "Why is the build blocked?"
Source code
cppdepend-get-sources
Retrieve source code as raw text from CppDepend.
Use when:
- Viewing code: "Show me the code for UserService::Authenticate"
- Understanding implementation: "How is this method implemented?"
- Code review: "Review the code for this method"
- Debugging: "Show me where the error occurs"
- Refactoring analysis: "Show me the code before I refactor it"
- Following up on other tools: "Show me the code with low maintainability"
cppdepend-diff-sources
Use CppDepend's diff action to compare a source file's current content with its baseline, using the configured source compare tool.
Use when:
- "Show me the before and after"
- "Compare with the old version"
- "What's changed in this method?"
- "Show differences since the baseline"
Code queries
cppdepend-gen-code-query-and-rule
Provide prompts that make the LLM an expert in CQLinq code queries and rule generation. The LLM first identifies the code querying features it needs for your request, then calls this tool to get a prompt for each feature it chose.
Use when:
- Always when you ask for a CppDepend code query or code rule
- Complex code base analysis that the other tools can't handle
Available code query kinds:
| Kind | Returns |
|---|---|
code-query-list | A collection of code elements with properties |
code-rule | A quality rule that identifies violations |
quality-gate | A quality criterion with WARN/FAIL thresholds |
querying-issue-rule | Selected issues and rules |
trend-metric | A scalar value stored over time to plot a chart |
code-query-scalar | A single numeric value |
Available feature prompts:
code-query-essential(always required)line-of-code,maintainability,complexity,coverage,commentusage-dependency,parent-children-relationship,inheritance-and-base-class,interfacesolid-principles,clean-architecture,encapsulation-and-visibility,state-mutabilitydiff-since-baseline,naming,source-file-declaration,constructor-instantiation
cppdepend-run-code-query-or-rule
Compile and run a code query or rule against the session's analysis result and baseline.
Use when:
- After generating a query
- You ask to run it
- Complex code base analysis that needs custom queries
Also used to check that a generated query compiles (parameter compileOnly set to True). If the query does not compile, an McpException is thrown with the compilation errors in its message, so the LLM can correct them.
