AI Coding Tools

Claude Code PyCharm Setup: Using the Agent Inside JetBrains

Claude Code PyCharm Setup: Using the Agent Inside JetBrains

Claude Code is a command line tool from Anthropic, and PyCharm only gets involved once you add a JetBrains plugin. With both in place, the CLI runs in the IDE’s integrated terminal, edits open in the diff viewer and your current selection travels with each prompt.

The plugin does not bundle the CLI, so you install them separately.

The login is covered by any paid Claude subscription or a Claude Console account. The Claude Code documentation (as of October 2026) lists neither a JetBrains AI subscription nor an API key as a requirement.

The same plugin also runs in IntelliJ IDEA, WebStorm, PhpStorm, GoLand and Android Studio.

What Claude Code in PyCharm is and which JetBrains IDEs support it

YouTube player

The terminal handles the agent work, like reading and editing files and running commands. The plugin’s only job is to carry IDE state back and forth.

You need the Claude Code CLI from Anthropic and the Claude Code [Beta] plugin from the JetBrains Marketplace. The Marketplace listing says Claude Code has to be installed separately, and the Claude Code documentation adds that the plugin shows a “Cannot launch Claude Code” notification when claude is missing from your PATH.

Skip the plugin and Claude Code still runs in PyCharm. It just behaves like a terminal tool parked next to the editor.

PyCharm is not the only target. As of October 2026 the documentation lists IntelliJ IDEA, PyCharm, Android Studio, WebStorm, PhpStorm and GoLand, and says the plugin works with most JetBrains IDEs.

Under the hood, the plugin runs a local MCP server named ide that the CLI connects to on its own. That link lets Claude Code open diffs in PyCharm and read your current selection. It also pulls in the errors and warnings the editor shows.

Which setup fits you: terminal only, the Claude Code plugin, or Claude Agent

Most people end up on the Claude Code plugin, because it gives you edits in PyCharm’s diff viewer. Terminal only makes sense if you want zero extra installs, and Claude Agent in AI Chat suits anyone who would rather have a chat panel inside the IDE.

OptionBest forMain limitLogin
Terminal onlyA first afternoon with Claude CodeNo IDE diffs, selection sharing or diagnosticsClaude plan or Console account
Claude Code pluginFull PyCharm integrationNeeds the CLI and a restart, still labeled BetaSame Claude login, no API key required
Claude Agent in AI ChatA chat panel inside PyCharmA separate product from the Claude Code CLIJetBrains AI subscription, your own Anthropic API key or an Anthropic Console login

JetBrains introduced Claude Agent in September 2025 as the first third-party agent natively integrated into its IDEs, and AI Assistant 2025.3 added bring-your-own-key support for it (JetBrains AI blog and AI Assistant release notes).

Where the sources seem to disagree

Novita AI’s PyCharm guide claims no separate plugin is needed, since the built-in terminal is enough. Meanwhile the official JetBrains page in the Claude Code documentation credits the plugin with diff viewing, selection context, file reference shortcuts and diagnostic sharing.

They describe different layers. The terminal runs Claude Code, and whether PyCharm takes part depends on the plugin.

A third source mixes the two products up more easily. One set of personal setup notes (Purdue, last updated February 2026) lists a JetBrains AI subscription or an Anthropic API key as requirements, but it attaches them to the Claude Agent entry in AI Chat and describes the Claude Code plugin as a separate thing.

That matches JetBrains’ own documentation, which says Claude Agent in AI Assistant is not related to the Claude Code [Beta] plugin. The Claude Code documentation lists no JetBrains or API-key requirement for the plugin and says any paid Claude subscription or a Claude Console account is enough. The similar names cause the confusion.

A quick decision rule

If you are only testing Claude Code and do not want to touch IDE settings, stay in the terminal. If you already review changes in PyCharm’s diff viewer, install the plugin so Claude Code can see your selection and open file. Claude Agent is the pick when you already pay for JetBrains AI, or when you would rather authorize it with your own Anthropic API key or Console account.

For a Python project, the plugin is the default pick. It costs one install and one restart.

How to install Claude Code and connect it to PyCharm

Install the CLI first, then the plugin. After a restart of PyCharm, run claude from the integrated terminal and log in.

  1. Install the CLI. On macOS, Linux or WSL run curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell run irm https://claude.ai/install.ps1 | iex. Then open a new terminal and run claude --version to confirm a version number prints.
  2. Install the plugin. Search for Claude Code in the JetBrains Marketplace from PyCharm’s plugin settings and install it.
  3. Restart PyCharm completely. The docs say you may need to do this more than once.
  4. Open your project, open the Terminal tool window and run claude from the project root.
  5. Log in when the browser prompt appears. Once the session starts in the integrated terminal, the integration features are active.

The native installer updates itself in the background. Homebrew and WinGet installs do not, so run brew upgrade claude-code or winget upgrade Anthropic.ClaudeCode now and then.

Plenty of older guides still show an npm install. The current Claude Code quickstart marks the native install as the recommended route.

Prefer an external terminal? Start claude there and run /ide. Claude Code confirms with a message such as “Connected to IntelliJ IDEA”, and if it finds a running IDE without the plugin, it installs the plugin and asks for a restart.

Which Claude accounts work

  • Claude Pro or Max, through your claude.ai login
  • Claude Team or Enterprise, through the account your admin invited
  • Claude Console, with credentials from an admin invite
  • Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry if you run through a cloud provider

A free claude.ai plan does not appear on the quickstart’s list. No API key is needed for the plugin itself, according to the Claude Code documentation.

Older shell profiles can cause one odd failure. If ANTHROPIC_API_KEY is set and you approve it, Claude Code uses the key instead of your subscription, and requests fail when the key belongs to a disabled organization.

Run unset ANTHROPIC_API_KEY to fall back to the subscription, then check /status to see which method is active. To switch accounts later, use /login inside the session.

What the plugin adds inside PyCharm

On its own, a terminal session has no idea what PyCharm is showing. The plugin fixes that with diffs in the IDE, selection context, file reference shortcuts and diagnostic sharing.

Proposed code changes open in PyCharm’s diff viewer instead of the terminal. The Diff tool setting in /config flips between auto and terminal.

Your current selection and the active file path travel with each prompt, and the transcript shows a “Selected N lines” line whenever that happens.

A shortcut inserts a file reference with a line range, for example @src/auth.py#L1-99. Claude can also read the errors and warnings PyCharm shows in the editor through the getDiagnostics tool, one file per call.

Claude Code does not ask for diagnostics on its own after edits. Ask for a check when you want one.

Selection sharing has a limit you control. A Read deny rule for a path such as .env stops both the selected text and the open-file notice for that file from reaching Claude.

Keyboard shortcuts

The first two shortcuts get daily use. The newline one only exists on macOS.

ActionmacOSWindows and Linux
Open Claude Code from the editorCmd+EscCtrl+Esc
Insert a file referenceCmd+Option+KAlt+Ctrl+K
New line in a promptOption+Enter (plugin setting)Not applicable, macOS-only setting

The Claude Code button in the UI does the same job as the quick launch shortcut. Option+Enter needs a terminal restart after you turn it on.

How to configure the diff tool, plugin settings and Escape key

The diff tool lives in /config inside Claude Code. Plugin settings sit under Settings, Tools, Claude Code [Beta], and the Escape key fix is under Settings, Tools, Terminal.

The diff tool entry shows up in /config only while Claude Code is connected to the IDE. If it is missing, the connection is down. The setting itself did not go anywhere.

The reporter in Claude Code GitHub issue 1232 hit exactly this, with no Diff tool entry while the IDE went undetected. Run claude from the PyCharm terminal, or run /ide first from an external terminal, and the entry appears.

  • The Claude command setting holds whatever the plugin runs, for example claude, /usr/local/bin/claude or npx @anthropic-ai/claude-code.
  • On WSL the command looks like wsl -d Ubuntu -- bash -lic "claude", with your own distribution name in place of Ubuntu.
  • One option hides the not-found notification when the command cannot be located.
  • Automatic updates make the plugin check for new versions and apply them on restart.

Fix the Escape key so it interrupts Claude Code

PyCharm sends Escape to the editor by default, so the keypress never reaches Claude Code. Under Settings, Tools, Terminal you can uncheck the focus-to-editor option, or open “Configure terminal keybindings” and delete the “Switch Focus to Editor” shortcut.

The label depends on your version. PyCharm 2026.2 Help calls the option “Move focus to the Editor with” and lets you pick a different shortcut, while the Claude Code docs use the wording “Move focus to the editor with Escape”.

One commenter in the GitHub thread found that an older Android Studio build had no checkbox at all, so deleting the keybinding is the fallback there.

Start a session from the AI Agents menu

PyCharm’s terminal toolbar has an AI Agents dropdown that lists Junie, Claude Code and Codex (documented in PyCharm 2026.1 and 2026.2 Help). Claude Code appears only when it is installed, and the JetBrains help page says the feature is not supported in non-local environments such as Docker or WSL.

The page does not say whether a session started this way connects to the plugin. Run /ide in that session to find out.

How to prepare a Python project for Claude Code in PyCharm

YouTube player

Start the session at the project root and confirm the terminal’s virtual environment is active. After that, a short CLAUDE.md with your test and lint commands does most of the work.

PyCharm’s terminal opens in the project root by default, controlled by the Start directory option under Settings, Tools, Terminal (PyCharm 2026.2 Help). Leave it alone so Claude Code and the IDE see the same files.

When the project interpreter is a virtual environment, the Activate virtualenv option activates it automatically in new terminal tabs. The option requires the Python plugin.

Verify it once. Ask Claude to print the path of the Python it will run, and if that path points outside your project’s environment, activate the right one and restart the session.

Run /init to generate a starter CLAUDE.md. Claude Code scans the codebase and writes down the build commands, test instructions and conventions it finds, according to the Claude Code memory documentation.

The entries worth keeping are the ones Claude could never guess from the code.

  • The pytest command with the flags your project uses
  • Lint and format commands
  • Conventions that differ from tool defaults
  • Pitfalls, such as integration tests that need a local database

Keep each file under 200 lines, because longer files use more context and reduce adherence (Claude Code documentation). CLAUDE.md is guidance, not enforcement, so a vague line like “write good tests” does less than “run pytest -q before committing”.

Run /context and look under Memory files to confirm the file loaded. Personal preferences go in CLAUDE.local.md, which belongs in .gitignore.

Repos that already carry an AGENTS.md for other tools have a gotcha. Since Claude Code v2.1.277 it reads that file directly, but only when no CLAUDE.md or CLAUDE.local.md exists in the working directory or above, so adding a CLAUDE.local.md quietly stops it from reading AGENTS.md.

Rules that matter for one part of the codebase belong in .claude/rules/ with a paths entry in the frontmatter. A rule scoped to tests/*/.py loads only when Claude works with matching files.

Claude Code in PyCharm not working: causes and fixes

Most failures come down to claude missing from the PATH the IDE sees, a plugin that is installed but not active, a launch directory that differs from the IDE project, or WSL2 networking.

SymptomLikely causeFix
“Cannot launch Claude Code” or “command not found” from the toolbar iconclaude is not on the PATH PyCharm usesAdd ~/.local/bin (macOS, Linux) or %USERPROFILE%\.local\bin (Windows) to PATH, then restart PyCharm, or set the full path in the Claude command setting
Plugin installed, no features visiblePlugin disabled, wrong launch directory, incomplete restartCheck the plugin is enabled, launch from the project root, restart the IDE completely (the docs say it may take several restarts)
/ide reports “No available IDEs detected”Plugin missing or disabled, or claude not started from the integrated terminalVerify the plugin, restart the IDE, relaunch from the PyCharm terminal
IDE found, but its project directories “do not match” the current directoryThe session started outside the IDE project rootChange to the project root and restart claude
Ctrl+Esc opens the Windows Start menuWindows intercepts the shortcut (reported by a commenter in the GitHub thread)Add another binding under Settings, Keymap, searching for Claude Code

Reference date for the fixes above: the Claude Code documentation as of October 2026. Terminals inside editors take their PATH from the editor, so quit and reopen PyCharm after changing PATH.

WSL2

“No available IDEs detected” on WSL2 is usually NAT networking or Windows Firewall blocking the link between WSL2 and the IDE on the Windows host. WSL1 uses the host network directly and is not affected.

The recommended fix is a firewall rule. Run hostname -I in WSL, take the first two segments plus .0.0/16 (172.21.123.45 becomes 172.21.0.0/16), create an inbound TCP allow rule for that range in an administrator PowerShell, then restart the IDE and Claude Code.

Mirrored networking is the other route. Add networkingMode=mirrored under [wsl2] in .wslconfig in your Windows user directory, then run wsl --shutdown. It requires Windows 11 22H2 or later.

It has a cost, though. Two commenters in the issue thread reported side effects after switching to mirrored mode, namely slower containers and port binding errors.

The same thread shows how this played out. The reporter ran CLI 1.0.0 with plugin 0.1.3-beta on Windows 10 with WSL2 and saw no detection. Commenters later confirmed that plugin 0.1.8-beta with CLI 1.0.18 fixed detection for them, while others still needed the firewall rule.

When closing the issue, an Anthropic maintainer recommended the native Windows build for IDE use because it is more reliable.

JetBrains Remote Development

Install the plugin on the remote host through Settings, Plugin (Host), not on the local client. A plugin installed only on the client never sees the project, which is the usual reason features stay missing in this setup.

What are the security risks of running Claude Code in a JetBrains IDE?

Edit approval matters most for most people, since it can reach IDE configuration files. The plugin’s local network port is the other documented risk, and it stays on loopback unless you change a setting.

The JetBrains page warns that in acceptEdits mode Claude Code may be able to modify IDE configuration files that the IDE runs automatically, which can bypass the permission prompts for Bash. It recommends Manual mode for edits, because acceptEdits and auto mode both approve edits inside the working directory without asking.

That matters because of the default. With Claude Code v2.1.283 or later, auto mode is the built-in starting permission mode for interactive terminal sessions, and the permission modes page says the JetBrains plugin switches modes the same way as the CLI.

Press Shift+Tab to cycle modes, where the status bar shows “manual mode on” for Manual. To start every session in Manual, set "defaultMode": "default" under permissions in ~/.claude/settings.json.

The permission modes page also lists protected paths that never get auto-approved writes, including the .idea and .git folders and files such as .envrc, .mcp.json and pyrightconfig.json. Treat that list as a backstop, not the plan, because it is a fixed list and the JetBrains page still recommends Manual mode.

Stick to trusted prompts and review edits in Manual mode when the code is not yours, and know which files Claude Code can modify. Leaving acceptEdits or auto on in an unfamiliar repository is the riskier habit. So is turning on all-interface listening without a reason.

When the plugin is active it runs a local MCP server that the CLI connects to. The Claude Code documentation describes its limits.

The OS assigns the port, so it is not configurable, and the transport is unencrypted ws://. A fresh random token is generated on each IDE start and written to a lock file at ~/.claude/ide/<port>.lock. By default the server binds to 127.0.0.1 only.

The docs note that on loopback any process able to capture the traffic can also read the token from the lock file, so TLS would add nothing against a local attacker. The plugin exposes no code-execution tool to the model.

The exposure comes from one switch, “Accept connections from all network interfaces” under Settings, Tools, Claude Code [Beta], Networking (Advanced). With it on, the port is reachable from your local network, and both the session traffic and the token cross it in cleartext.

Leave it off unless loopback cannot work. For WSL2, the docs prefer mirrored networking, which keeps the socket on loopback.

Claude Code in PyCharm FAQ

Is the Claude Code plugin for PyCharm still in beta?

Yes. The Marketplace listing is titled Claude Code [Beta], and the plugin settings page carries the same label as of October 2026.

The suffix also shows up in bug reports, such as plugin 0.1.8-beta in GitHub issue 1232.

How does Claude Code compare to Junie in PyCharm?

Junie comes from JetBrains itself and has lived in AI Chat since 2025.3, available through a JetBrains AI subscription or your own API key. Claude Code, from Anthropic, logs in with a Claude plan or Console account instead.

Both appear in the terminal’s AI Agents menu, so you can try each on the same project.

Can Claude Code connect to PyCharm through the Agent Client Protocol?

The ACP route is separate from the plugin. JetBrains’ ACP Agent Registry lists Claude Agent, an ACP wrapper around Anthropic’s Claude, not the Claude Code plugin. ACP agents install in one click and need no JetBrains AI subscription, according to JetBrains’ ACP Agent Registry announcement, although each agent usually brings its own subscription.

Treat the two as separate routes with separate logins.

How do I resume a previous Claude Code session in PyCharm?

Run claude -c in the PyCharm terminal, from the project root, to continue the most recent conversation in that directory.

Use claude -r to pick an earlier conversation, or type /resume inside a running session.

Does Claude Code work with the free version of PyCharm?

Yes, no edition restriction appears in the documentation. The Claude Code docs list PyCharm without naming an edition, and since 2025.3 JetBrains ships one unified PyCharm that Community users keep using for free.

The login still needs a paid Claude plan or a Console account.

Verifying Claude Code in PyCharm Before Larger Edits

Before Claude Code touches more than one file in a real repository, check the environment, then the memory file, and only then make an edit.

Start with the interpreter path Claude will use, and confirm the memory file loaded with /context. After that, make one small edit in Manual mode and review it in PyCharm’s diff viewer.

The two read-only checks come first because they cost nothing and change no files. An edit comes last, so a plausible diff cannot hide a wrong interpreter or a missing CLAUDE.md.

Manual mode costs speed, because every edit waits for approval. Accept that cost until one reviewed diff has landed cleanly.

The order was verified against the Claude Code and JetBrains documentation in October 2026. A plugin leaving Beta, or a new default permission mode, would change it.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.