https://github.com/j-plugins/ide-introspector-plugin
Intellij IDEA Plugin Exposes IDE internal stuctures via MCP and ToolWindow
https://github.com/j-plugins/ide-introspector-plugin
idea-plugin intellij intellij-platform intellij-plugin phpstorm-plugin
Last synced: 18 days ago
JSON representation
Intellij IDEA Plugin Exposes IDE internal stuctures via MCP and ToolWindow
- Host: GitHub
- URL: https://github.com/j-plugins/ide-introspector-plugin
- Owner: j-plugins
- Created: 2026-05-20T19:48:14.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-21T17:21:40.000Z (about 1 month ago)
- Last Synced: 2026-05-21T22:26:19.974Z (30 days ago)
- Topics: idea-plugin, intellij, intellij-platform, intellij-plugin, phpstorm-plugin
- Language: Kotlin
- Homepage: https://plugins.jetbrains.com/plugin/31891-ide-introspect
- Size: 2.45 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# IDE Introspector

Exposes the running IntelliJ-based IDE to MCP clients (Claude, Cursor, Codex, ...) as a
set of tools for UI introspection, plugin-architecture exploration, and on-demand
Kotlin code execution. Ships with a **Platform Explorer** tool window for browsing the
live extension-point / plugin graph without an MCP client attached.
## Architecture
Two tiers:
| Tier | Coverage | Latency | Safety |
|------|----------|---------|--------|
| Tier 1: pre-built MCP tools | ~80% of routine introspection | 1–50 ms | whitelist of read-only operations |
| Tier 2: `exec.execute_kotlin_in_ide` | the remaining 20% | 1–5 s (compile) | opt-in + per-call confirmation + textual blacklist |
### Tier 1 — pre-built MCP tools
Registered via the `com.intellij.mcpServer.mcpToolset` extension point. All become visible
to MCP clients once the bundled MCP Server plugin is enabled. There are 13 tools across
four groups: `ui.*` (5), `screenshot.*` (2), `arch.*` (5), `exec.*` (1, opt-in).
**Full tool reference with every parameter and example:** [`docs/MCP_TOOLS.md`](docs/MCP_TOOLS.md)
— generated from the source-level `@McpDescription` annotations at build time
(`./gradlew generateToolsDoc`), so there's only one place to edit.
Component ids returned by `ui.*` tools are stable for the duration of the IDE session and
can be passed back into `ui.get_properties` / `screenshot.capture`.
### Tier 1 — Platform Explorer tool window
Right-side tool window with three view modes:
1. **By Plugin** — each plugin with declared EPs and registered extensions.
2. **By Extension Point** — each EP with the list of registered implementations.
3. **By Plugin Dependencies** — declared `` graph.
Features: SpeedSearch, live filter input (200 ms debounce), HTML details panel,
right-click "Copy plugin id / EP name / class name", refresh button.
### Tier 2 — `exec.execute_kotlin_in_ide` (Phase 2 demo)
Compiles and executes arbitrary Kotlin in the IDE JVM. **Disabled by default**;
toggle in Settings → Tools → IDE Introspector.
User code is wrapped with three implicit helpers (`read`, `write`, `onEdt`) and runs
inside an auto-disposed `Disposable` scope so subscriptions are cleaned up between calls.
**Security**:
1. Off by default (`enabled = false` in `ExecSettings`).
2. Per-call confirmation dialog inside the IDE (with session-only bypass).
3. Textual blacklist: `Runtime.exec`, `ProcessBuilder`, `setAccessible(true)`,
`System.exit`, `Class.forName("sun.*")`.
4. Audit log to `idea.log` (category `ide-introspector-audit`).
5. Hard execution timeout (default 30 s, capped at the configured `maxTimeoutMs`).
**Demo implementation note**: the spec calls for forking LivePlugin's compiler bootstrap.
This demo takes a smaller shortcut and uses `kotlin-scripting-jsr223` (which internally
wraps `kotlin-compiler-embeddable`). This keeps the diff small and gives us a fresh
classloader per call out of the box, but bundles ~50 MB of compiler classes into the
plugin zip. A future iteration should either:
- Switch to the LivePlugin fork once measured cold-start latency justifies the operational
cost of pinning Kotlin compiler versions, or
- Reuse a single compiler daemon across calls to cut compilation overhead.
## Manual verification
After running `./gradlew runIde`:
1. **Tool window**: open the *Platform Explorer* tool window on the right. Switch
between view modes; type in the filter to narrow the tree.
2. **MCP tools (with MCP Inspector or Claude Desktop)**:
- `arch.list_extension_points` — should return ≥ 1000 EPs on a vanilla IDEA.
- `ui.get_tree` with default args — should return ≥ 50 nodes.
- `ui.find_by_xpath` with `//div[@class='ActionButton' and @text='Run']` — should find
the Run button on the main toolbar.
- `arch.find_extenders_of` with target `com.intellij.toolWindow` — should list every
`ToolWindowFactory` implementation.
3. **Kotlin execution**: enable in Settings, then call `exec.execute_kotlin_in_ide` with
code like `1 + 1` or `project?.name`. A confirmation dialog should pop up; on accept,
the result should round-trip as JSON.
## Project layout
```
src/main/kotlin/com/github/xepozz/introspector/
├── core/ — ComponentRegistry, ComponentTreeWalker, PluginInventory, ExtensionPointInspector, XPathMatcher, ScreenshotCapture
├── model/ — Serializable data classes (ComponentInfo, PluginInfo, …) + tool args
├── tools/
│ ├── ui/ — get_tree, find_by_*, get_properties
│ ├── screenshot/ — capture, crop
│ ├── arch/ — list_extension_points, list_extensions_for_ep, list_plugins, get_plugin_details, find_extenders_of
│ └── exec/ — execute_kotlin_in_ide
├── toolwindow/ — Platform Explorer (panel, tree model, cell renderer, details panel)
├── exec/ — Settings, ConfirmationManager, AstSafetyChecker, AuditLogger, KotlinExecutor, ResultSerializer, CodeWrapper
└── util/ — EdtHelpers, ImageEncoding
```
## Build
```bash
./gradlew buildPlugin
# produces build/distributions/ide-introspector-.zip
```