Usage Overview
MCP JetBrains Code Inspections provides a single MCP tool called get_jetbrains_code_inspections
that analyzes code quality using JetBrains IDE
inspections.
Tool Overview
Tool Name
get_jetbrains_code_inspections
Description
Run JetBrains IDE code inspections on files or directories with automatic IDE selection and profile detection.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
path | string | Yes | File or directory path to inspect (absolute or relative) |
Quick Examples
Analyze a Single File
await get_jetbrains_code_inspections({
path: 'src/components/Button.tsx',
});
Analyze a Directory
await get_jetbrains_code_inspections({
path: 'src/utils/',
});
Analyze Current Directory
await get_jetbrains_code_inspections({
path: '.',
});
How It Works
- IDE Detection: Automatically finds and selects the best available JetBrains IDE
- Profile Selection: Uses appropriate inspection profile for the project
- Execution: Runs the IDE's command-line inspector
- Processing: Parses and formats the results
- Response: Returns structured diagnostic information
Response Format
Markdown Format (Default)
## Code Inspection Results
### File: src/app.ts
**WEAK WARNING** at line 15:
- **Issue**: Variable 'unused' is never used
- **Inspection**: UnusedDeclaration
**INFO** at line 23:
- **Issue**: TODO comment found
- **Inspection**: TodoComment
JSON Format
{
"results": [
{
"file": "src/app.ts",
"line": 15,
"column": 5,
"severity": "WEAK WARNING",
"message": "Variable 'unused' is never used",
"inspection": "UnusedDeclaration"
}
],
"summary": {
"totalFiles": 1,
"totalIssues": 1,
"errors": 0,
"warnings": 1
}
}
Supported File Types
The tool supports all file types that JetBrains IDEs can analyze:
Web Development
- JavaScript (.js)
- TypeScript (.ts, .tsx)
- HTML (.html)
- CSS (.css, .scss, .less)
- Vue (.vue)
- React (.jsx, .tsx)
Backend Languages
- Java (.java)
- Kotlin (.kt)
- Python (.py)
- PHP (.php)
- Go (.go)
- Ruby (.rb)
- C/C++ (.c, .cpp, .h)
- C# (.cs)
Configuration Files
- JSON (.json)
- YAML (.yml, .yaml)
- XML (.xml)
- Properties files
- Dockerfile
- Package configuration files
Automatic Features
IDE Selection Priority
- IntelliJ IDEA (Universal support)
- WebStorm (Web development)
- PyCharm (Python)
- PhpStorm (PHP)
- GoLand (Go)
- Other JetBrains IDEs
Project Detection
Automatically detects:
- Project root directory
- Appropriate inspection profiles
- Language-specific configurations
- Framework settings
Profile Selection
Uses profiles in this order:
- Custom profile specified via
FORCE_PROFILE_PATH
- Project-specific profiles in
.idea/inspectionProfiles/
- IDE default profiles
- Built-in unified profile
Configuration Through Environment Variables
Control behavior without changing code:
{
"env": {
"INSPECTION_TIMEOUT": "300000",
"EXCLUDE_INSPECTIONS": "SpellCheckingInspection,TodoComment",
"RESPONSE_FORMAT": "json"
}
}
See Environment Variables for complete details.
Usage Patterns
Development Workflow
- Make code changes
- Run inspection on modified files
- Review and fix issues
- Commit clean code
CI/CD Integration
- Run inspections on entire codebase
- Parse JSON output for automated processing
- Fail builds on critical issues
- Generate quality reports
Code Review
- Inspect pull request files
- Identify potential issues before review
- Maintain code quality standards
- Provide automated feedback
Next Steps
- Basic Usage - Simple examples and common patterns
- Advanced Usage - Complex scenarios and optimization
- API Reference - Complete tool documentation