An open API service indexing awesome lists of open source software.

https://github.com/josedacosta/mcp-jetbrains-code-inspections

MCP server for JetBrains IDE code inspections with automatic IDE detection and unified inspection profile
https://github.com/josedacosta/mcp-jetbrains-code-inspections

code-inspection code-quality developer-tools ide-integration intellij jetbrains linting mcp mcp-server static-analysis typescript webstorm

Last synced: about 1 month ago
JSON representation

MCP server for JetBrains IDE code inspections with automatic IDE detection and unified inspection profile

Awesome Lists containing this project

README

          


MCP JetBrains Code Inspections

# ๐Ÿ” MCP JetBrains Code Inspections

[![License: OSL-3.0](https://img.shields.io/badge/License-OSL--3.0-yellow.svg)](https://opensource.org/licenses/OSL-3.0)
[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-brightgreen)](https://nodejs.org)
[![TypeScript](https://img.shields.io/badge/TypeScript-%5E5.0-blue)](https://www.typescriptlang.org/)
[![Documentation](https://img.shields.io/badge/docs-available-brightgreen)](https://josedacosta.github.io/mcp-jetbrains-code-inspections/)
[![MCP SDK](https://img.shields.io/badge/MCP-SDK-green)](https://github.com/modelcontextprotocol/sdk)
[![JetBrains](https://img.shields.io/badge/JetBrains-Compatible-orange)](https://www.jetbrains.com)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)

> [!CAUTION]
>
> ## โš ๏ธ Deprecated Notice
>
> [![Status: Deprecated](https://img.shields.io/badge/Status-Deprecated-red.svg)](https://github.com/josedacosta/mcp-jetbrains-code-inspections#deprecated-notice)
>
> **This project is deprecated but still functional.** Starting from version 2025.2, JetBrains IDEs (WebStorm, IntelliJ IDEA, PyCharm, etc.) now include a built-in MCP server that provides native integration with external clients like Claude Desktop, Cursor, VS Code, and others.
>
> ### ๐Ÿ”„ Migration Options
>
> | IDE Version | Recommended Solution | Link |
> | -------------------- | -------------------- | --------------------------------------------------------------------------------- |
> | **2025.2+** | Built-in MCP server | [Official Documentation](https://www.jetbrains.com/help/webstorm/mcp-server.html) |
> | **Earlier versions** | JetBrains MCP plugin | [Plugin Marketplace](https://plugins.jetbrains.com/plugin/26071-mcp-server) |
>
> ### โœ… Native Integration Benefits
>
> - **Direct IDE control** without external tools
> - **25+ tools** comprehensive tool set
> - **Better performance** and reliability
> - **Official support** from JetBrains
>
> > [!IMPORTANT]
> > The native `get_file_problems` tool requires setting `errorsOnly: false` for similar functionality to this project. The `get_project_problems` tool only returns critical errors.
>
> ๐Ÿ“š **[View Migration Guide & Comparison โ†’](https://josedacosta.github.io/mcp-jetbrains-code-inspections/deprecated/jetbrains-native-mcp)**

A **Model Context Protocol (MCP)** server that provides JetBrains IDE code inspections with automatic IDE selection and a unified inspection profile that works across all file types.

> [!TIP]
> ๐Ÿ“š **Full Documentation Available**: Visit our comprehensive docs at [josedacosta.github.io/mcp-jetbrains-code-inspections](https://josedacosta.github.io/mcp-jetbrains-code-inspections/)

## ๐ŸŽฏ Quick Start

> [!NOTE]
> Get started in under 2 minutes!

```bash
# Clone the repository
git clone https://github.com/josedacosta/mcp-jetbrains-code-inspections.git
cd mcp-jetbrains-code-inspections

# Install and build
yarn install && yarn build

# Test with MCP Inspector
yarn inspect
```

Then configure your MCP client (Claude Desktop, Cursor, etc.) with the [configuration below](#๏ธ-configuration).

## โœจ Features

### ๐Ÿš€ Core Features

- ๐Ÿ” **Automatic IDE Detection**

Intelligently selects the best JetBrains IDE
- โšก **Configurable Timeout**

Default 120s, adjustable for large projects
- ๐Ÿ”„ **Cross-IDE Compatible**

Works with all JetBrains IDEs

### ๐Ÿ”ง Advanced Capabilities

- ๐Ÿ“Š **Smart Output Formats**

Markdown for LLMs, JSON for tools
- ๐ŸŽฏ **Concurrent Execution**

Run even when IDE is open
- ๐ŸŒ **Universal Profiles**

One profile for all languages
- ๐Ÿ’ฌ **Built-in Prompts**

Pre-configured prompts for common tasks
- ๐Ÿ“š **Server Resources**

Access profiles, config, and IDE info

## ๐Ÿ“ฆ Installation

> [!NOTE]
> **Prerequisites**: Node.js โ‰ฅ20 and a JetBrains IDE installed

### Step-by-step Installation

1. **Install dependencies**:

```bash
yarn install
```

2. **Build the server**:

```bash
yarn build
```

3. **Configure MCP** (see [โš™๏ธ Configuration](#๏ธ-configuration) section below)

> [!TIP]
> Use `yarn inspect` after installation to test the server with the MCP Inspector

## ๐Ÿš€ Usage

### ๐Ÿ“š MCP Features

The server provides three types of MCP features:

#### ๐Ÿ”จ Tools

- **get_jetbrains_code_inspections**: Runs code inspections on specified files or directories

#### ๐Ÿ’ฌ Prompts

- **analyze-project**: Analyze a project for code quality issues
- **check-file**: Check a specific file for issues
- **fix-issues**: Get suggestions to fix detected issues

#### ๐Ÿ“š Resources

- **inspection://profiles**: List of available inspection profiles
- **inspection://config**: Current MCP server configuration
- **inspection://ides**: List of detected JetBrains IDEs on the system

### ๐Ÿƒ Running the Server

> [!TIP]
> For development, use `yarn dev` which includes hot-reload for faster iteration.

```bash
# ๐Ÿ”„ Run in development mode (with hot-reload)
yarn dev

# ๐Ÿ“ฆ Run the built server (production)
yarn start

# ๐Ÿงช Use MCP Inspector for interactive testing
yarn inspect
```

### โš™๏ธ Configuration

The code inspections server can be configured through environment variables in `.mcp.json`:

```json
{
"mcpServers": {
"mcp-jetbrains-code-inspections": {
"command": "node",
"args": ["./dist/index.js"],
"env": {
"EXCLUDE_INSPECTIONS": "SpellCheckingInspection"
}
}
}
}
```

### ๐Ÿ“ Available Parameters

#### ๐Ÿ”ง Tool Parameter (Required)

> [!IMPORTANT]
> The tool accepts only one parameter from the LLM:

| Parameter | Type | Description | Required | Example |
| --------- | -------- | --------------------------------- | -------- | ----------------------------- |
| `path` | `string` | File or directory path to inspect | โœ… Yes | `"src/index.ts"` or `"./src"` |

#### ๐ŸŒ Configuration via Environment Variables

> [!NOTE]
> All configurations are managed through environment variables in `.mcp.json`. These settings control how the inspection server operates.

๐Ÿ“‘ Available Environment Variables (click to expand)

| Environment Variable | Type | Description | Default |
| --------------------- | -------------------- | --------------------------------------------------------- | ------------------------- |
| `FORCE_INSPECT_PATH` | `string` | Force specific IDE inspect tool (disables auto-detection) | Auto-detected |
| `FORCE_PROJECT_ROOT` | `string` | Force project root directory (disables auto-detection) | Auto-detected |
| `FORCE_PROFILE_PATH` | `string` | Force inspection profile path (disables defaults) | Project defaults |
| `INSPECTION_TIMEOUT` | `number` | Maximum analysis time (ms) | `120000` |
| `EXCLUDE_INSPECTIONS` | `string` | Comma-separated inspection codes to exclude | `SpellCheckingInspection` |
| `ONLY_INSPECTIONS` | `string` | Only include these inspection codes | - |
| `RESPONSE_FORMAT` | `'markdown'\|'json'` | Output format for diagnostics | `'markdown'` |
| `DEBUG` | `boolean` | Enable debug logging | `false` |

> [!TIP]
> ๐Ÿ“š For detailed configuration options, see [Configuration Documentation](docs/configuration/).

## ๐Ÿงช Testing

### 1๏ธโƒฃ Interactive MCP Test

```bash
yarn test:mcp
```

This runs an interactive test that allows you to test the MCP server functionality directly.

### 2๏ธโƒฃ Test with MCP Inspector (recommended)

```bash
# Launch the inspector (no installation needed)
yarn inspect

# Or for development mode with hot reload
yarn inspect:dev
```

The inspector opens a web interface where you can:

- View available tools, prompts, and resources
- Test get_jetbrains_code_inspections tool interactively
- Use pre-configured prompts for common tasks
- Access server resources (profiles, config, detected IDEs)
- See requests/responses in real-time

## โš™๏ธ How It Works

### ๐ŸŽฏ Automatic IDE Selection

> [!NOTE]
> The server intelligently detects and selects the most appropriate JetBrains IDE for your project.

**Priority order:**

1. **IntelliJ IDEA** - Ultimate Java/Kotlin IDE
2. **WebStorm** - JavaScript/TypeScript specialist
3. **PyCharm** - Python development
4. **PhpStorm** - PHP development
5. **GoLand** - Go programming
6. **Rider** - .NET development
7. **CLion** - C/C++ development
8. **RubyMine** - Ruby/Rails
9. **DataGrip** - Database management
10. **DataSpell** - Data science
11. **AppCode** - iOS/macOS development

> [!TIP]
> Use `FORCE_INSPECT_PATH` to override auto-detection and specify a particular IDE.

### ๐Ÿ”’ Isolated Configuration

> [!IMPORTANT]
> **Key Innovation**: The server uses temporary isolated configuration directories with `-Didea.config.path` and `-Didea.system.path` JVM properties. This allows inspections to run even when the IDE is already open!

**Benefits:**

- โœ… No IDE conflicts
- โœ… Parallel execution support
- โœ… Clean, isolated analysis
- โœ… No interference with your active IDE sessions

### ๐Ÿ’ป Example Output

๐Ÿ”Ž View Example Output (click to expand)

```console
๐Ÿ” Searching for available JetBrains IDE inspect tools...
Following priority order: IntelliJ IDEA > WebStorm > PyCharm > PhpStorm > GoLand > ...

โœ… WebStorm - Found and selected!
Path: /Applications/WebStorm.app/Contents/bin/inspect.sh
Note: Using isolated configuration - works even if IDE is already running

๐Ÿ“Š Analysis Results:
โš ๏ธ Warning: Unused variable 'config' at line 42
โŒ Error: Missing semicolon at line 156
๐Ÿ’ก Info: Consider using const instead of let at line 78
```

## ๐Ÿ› ๏ธ Troubleshooting

### โŒ "JetBrains IDE inspect tool not found"

> [!WARNING]
> This error occurs when no JetBrains IDE can be found in standard installation locations.

**Solutions:**

- โœ… Verify that a JetBrains IDE is installed in `/Applications/` or `~/Applications/`
- โœ… Ensure the `inspect.sh` file is executable
- โœ… Use `FORCE_INSPECT_PATH` environment variable to specify the exact path

### โš ๏ธ "No inspection profile found"

> [!CAUTION]
> Without an inspection profile, the tool cannot analyze your code properly.

**Steps to fix:**

1. Open the project in a JetBrains IDE
2. Go to **Settings** โ†’ **Inspections**
3. Configure and save an inspection profile
4. Alternatively, use `FORCE_PROFILE_PATH` to specify a custom profile

### โฑ๏ธ Timeout Issues

> [!TIP]
> Default timeout is 120 seconds. Large projects may need more time.

**Solutions:**

- ๐Ÿ”„ Increase timeout: Set `INSPECTION_TIMEOUT=300000` (5 minutes)
- ๐Ÿ“Š Check that the IDE is not currently indexing
- ๐Ÿ“ฆ For very large projects, consider inspecting specific directories

### ๐Ÿšซ "Only one instance can be run at a time"

> [!NOTE]
> โœ… **This is no longer an issue!** The server automatically handles this by using isolated configuration directories, allowing inspections to run even when the IDE is already open.

## ๐Ÿ“š Documentation

> [!TIP]
> ๐ŸŒ Visit our comprehensive documentation at [josedacosta.github.io/mcp-jetbrains-code-inspections](https://josedacosta.github.io/mcp-jetbrains-code-inspections/)

**Available sections:**

| Section | Description |
| ------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| ๐Ÿ **[Getting Started](https://josedacosta.github.io/mcp-jetbrains-code-inspections/getting-started/)** | Installation and prerequisites |
| โš™๏ธ **[Configuration](https://josedacosta.github.io/mcp-jetbrains-code-inspections/configuration/)** | Environment variables and profiles |
| ๐Ÿ“– **[Usage Guide](https://josedacosta.github.io/mcp-jetbrains-code-inspections/usage/)** | Basic and advanced usage |
| ๐Ÿ”ฌ **[Technical Details](https://josedacosta.github.io/mcp-jetbrains-code-inspections/technical/)** | Architecture and IDE detection |
| ๐Ÿ’ก **[Guides](https://josedacosta.github.io/mcp-jetbrains-code-inspections/guides/)** | Best practices and troubleshooting |

## ๐Ÿ“– JetBrains Documentation

> [!TIP]
> Learn more about JetBrains code inspections and the command-line inspector:

| Resource | Description |
| -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| ๐Ÿ“˜ **[Code Inspection Overview](https://www.jetbrains.com/help/webstorm/code-inspection.html)** | Learn about code inspections, severity levels, and inspection profiles |
| ๐Ÿ”ง **[Command-Line Code Inspector](https://www.jetbrains.com/help/webstorm/command-line-code-inspector.html)** | Detailed documentation on using the inspect.sh/inspect.bat tool |

## ๐Ÿค Contributing

> [!NOTE]
> We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for full details.

**What we're looking for:**

- ๐Ÿ› Bug fixes and issue reports
- โœจ New features and enhancements
- ๐Ÿ“ Documentation improvements
- ๐Ÿงช Test coverage expansion
- ๐ŸŒ Language/IDE support

### ๐Ÿš€ Quick Start for Contributors

> [!IMPORTANT]
> We follow [Conventional Commits](https://www.conventionalcommits.org/) and use GitHub Flow.

```bash
# 1. Fork and clone the repository
git clone https://github.com/YOUR-USERNAME/mcp-jetbrains-code-inspections.git

# 2. Create a feature branch
git checkout -b feat/amazing-feature

# 3. Make your changes and commit
git commit -m 'feat(scope): add amazing feature'

# 4. Push to your fork
git push origin feat/amazing-feature

# 5. Open a Pull Request
```

> [!TIP]
> See [CONTRIBUTING.md](CONTRIBUTING.md) for branch naming, commit message standards, and PR guidelines.

## ๐Ÿท๏ธ Keywords

๐Ÿ” SEO Keywords (click to expand)

**MCP & AI Integration:**
`MCP server` โ€ข `Model Context Protocol` โ€ข `Claude Code integration` โ€ข `MCP JetBrains` โ€ข `Claude AI code inspection` โ€ข `MCP tools` โ€ข `Claude Code extensions` โ€ข `MCP inspector` โ€ข `Anthropic MCP` โ€ข `Claude.ai code analysis` โ€ข `LLM code analysis` โ€ข `AI code review`

**JetBrains IDEs:**
`JetBrains code inspection` โ€ข `WebStorm MCP` โ€ข `IntelliJ IDEA MCP integration` โ€ข `PyCharm MCP server` โ€ข `PhpStorm code inspection` โ€ข `GoLand analysis` โ€ข `Rider code quality` โ€ข `CLion inspection` โ€ข `RubyMine linter` โ€ข `DataGrip SQL analysis` โ€ข `Android Studio inspection` โ€ข `RustRover analysis`

**Technical Terms:**
`JetBrains command line inspector` โ€ข `inspect.sh` โ€ข `automated code inspection` โ€ข `JetBrains unified profile` โ€ข `IDE code diagnostics` โ€ข `static code analysis` โ€ข `inspection severity levels` โ€ข `inspection profiles` โ€ข `Node.js MCP server` โ€ข `MCP environment variables` โ€ข `code problems detection`

---

**Made with โค๏ธ by the Runtima Team**

[![Star on GitHub](https://img.shields.io/github/stars/josedacosta/mcp-jetbrains-code-inspections.svg?style=social)](https://github.com/josedacosta/mcp-jetbrains-code-inspections)
[![Follow on GitHub](https://img.shields.io/github/followers/josedacosta.svg?style=social&label=Follow)](https://github.com/josedacosta)