Giving AI Coding Agents IDE Superpowers: IDEA MCP Server Integration with Codex
This article explains how IntelliJ IDEA's built-in MCP Server (since 2025.2) enables AI coding agents like Codex to directly control the IDE via the Model Context Protocol, allowing them to run configurations, read diagnostics, format code, and debug Spring Boot applications instead of relying on blind command-line builds.
01 Where Current Vibe Coding Falls Short
You ask Codex to add an endpoint to a Spring Boot service. It writes the code, runs mvn package, and returns a compilation failure. When you ask what went wrong, it pastes a screen of errors. But it cannot show you the red squiggly line in the IDE, the missing bean injection in the Run window, or any real-time logs. The agent has no IDE — only a command line. It modifies your code but you cannot see how it actually runs.
The core problem: packaging verification is a black box. The agent relies on existing build scripts, but you never see how the script runs, what parameters it uses, or which step fails. It only reports "failed" and you have to trust the conclusion without the process.
02 IDEA MCP Server Fills This Gap
IDEA MCP Server does one thing: it lets external coding agents call your locally running IntelliJ IDEA through the MCP (Model Context Protocol). Since IntelliJ IDEA 2025.2, this server is built in — no extra plugin needed. By 2026.x, JetBrains streamlined auto-configuration for clients including Claude Code, Codex, Cursor, and VS Code.
Run and restart : Directly launch your configured Run Configuration (e.g., a Spring Boot main class), capturing exit codes and output without manually stitching Maven commands.
Code diagnostics : Invoke IDEA's inspectors to scan files, returning syntax errors, warnings, and type mismatches in one go. This is far richer than compiler output — effectively giving the agent the IDE's Problems view.
Code formatting : Call reformat_file to apply your project's formatting rules, which is more reliable than the agent guessing indentation.
03 Wiring It Up in Codex
Prerequisites: IntelliJ IDEA 2025.2 or newer, and an MCP-capable Codex.
Step 1: Enable the MCP Server
Open Settings | Tools | MCP Server, check Enable MCP Server. A dialog lists the permissions third-party apps will receive — review and confirm.
Step 2: Let IDEA Auto-Configure Codex
On the same page, find Clients Auto-Configuration, click Auto-Configure next to Codex. IDEA writes the connection details into Codex's config file (typically ~/.codex/config.toml). Avoid copying the port manually — let IDEA do it to prevent typos.
Step 3: Verify the Connection
Restart Codex, type /mcp, and confirm the idea service shows as connected.
Manual Configuration (Alternative)
If you prefer manual setup, add this block to ~/.codex/config.toml:
[mcp_servers.idea]
url = "http://127.0.0.1:64342/stream"04 Putting It to the Test
Return to the Spring Boot scenario. After Codex edits the code, it should no longer run mvn package blindly. Instead, it calls IDEA's execute_run_configuration to start the main class, streaming the raw Run window stack trace to you. You sit in front of the IDE with a two-column diff, real-time logs, and the ability to drop breakpoints at will.
You can codify this workflow in your project's AGENTS.md so Codex automatically invokes the IDEA MCP for deployment verification whenever it makes changes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
