D3 · Claude Code › Cluster 8 · Automation, MCP & Integrations

8.5 · IDE Integrations & the SDK

VS Code · JetBrains · Agent SDK

CONCEPT VS Code & JetBrains put Claude Code inside the editor

Claude Code ships two first-party IDE integrations. Both give Claude editor-aware context and native diffs; they differ in how they're packaged.

VS Code extensionJetBrains plugin
WhereVS Code 1.98+, Cursor, and forks (via Open VSX). Extension id anthropic.claude-codeIntelliJ IDEA, PyCharm, WebStorm, PhpStorm, GoLand, Android Studio
CLI needed?Bundles its own CLI for the panel; standalone install needed to run claude in the terminalRuns claude in the integrated terminal — install the CLI separately
Quick launchSpark icon / Command Palette; Cmd+Esc (Mac) / Ctrl+Esc toggles focusCmd+Esc / Ctrl+Esc
Insert @-mentionOption+K (Mac) / Alt+K → @file.ts#5-10Cmd+Option+K / Alt+Ctrl+K → @src/auth.ts#L1-99

Shared feature set that makes the IDE version more than a terminal:

Selection and diagnostic sharing are governed by Read deny rules: add a deny rule for a sensitive path (e.g. .env) and neither its selected text nor the open-file notice reaches Claude. From an external terminal, run /ide to connect Claude Code to the running IDE.

CONCEPT The Agent SDK: Claude Code as a library

Beyond editors, you can build on top of Claude Code with the Claude Agent SDK (formerly the Claude Code SDK). It exposes the same tools, agent loop, and context management that power the CLI, programmable in two languages:

LanguagePackageEntry point
TypeScript@anthropic-ai/claude-agent-sdk (npm)query(...)
Pythonclaude-agent-sdk (pip, Python 3.10+)query(...)

The same claude -p headless mode (8.1) is the SDK via the CLI; the packages add structured outputs, tool-approval callbacks, hooks, subagents, and native message objects for full programmatic control. Reach for the SDK to build custom agents, CI/CD automation, and production apps; reach for the CLI for interactive and one-off work.

DIAGRAM One engine, many surfaces

flowchart TD ENGINE["Claude Code engine
tools · agent loop · context mgmt"] --> CLI["Interactive CLI"] ENGINE --> HL["Headless: claude -p (8.1)"] ENGINE --> IDE["IDE extensions"] ENGINE --> SDK["Agent SDK (library)"] IDE --> VSC["🔵 VS Code / Cursor
anthropic.claude-code"] IDE --> JB["🟠 JetBrains
IntelliJ · PyCharm · GoLand…"] SDK --> TS["🟢 @anthropic-ai/claude-agent-sdk (TS)"] SDK --> PY["🟢 claude-agent-sdk (Python 3.10+)"] HL -.->|"same loop, exposed via CLI"| SDK classDef info fill:#cfe2ff,stroke:#0d6efd,color:#084298; classDef warn fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; classDef ok fill:#d4edda,stroke:#28a745,color:#155724; class VSC info; class JB warn; class TS ok; class PY ok;

CODE Connecting an IDE, and a minimal SDK agent

Top: connect an external terminal session to the IDE and add an MCP server from within VS Code. Bottom: the Agent SDK's query() in both languages.

# From an external terminal, connect Claude Code to your running IDE
claude
# then inside the session:
/ide

# Add an MCP server from VS Code's integrated terminal (managed later with /mcp)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"
# Python — claude-agent-sdk (pip install claude-agent-sdk)
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions

async def main():
    async for message in query(
        prompt="Find and fix the bug in auth.py",
        options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"]),
    ):
        print(message)

asyncio.run(main())
// TypeScript — npm install @anthropic-ai/claude-agent-sdk
import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "Find and fix the bug in auth.ts",
  options: { allowedTools: ["Read", "Edit", "Bash"] }
})) {
  console.log(message);
}

TRADE-OFFS IDE extension vs. Agent SDK

✅ IDE extension

  • Native diffs, selection & diagnostic context for free
  • Human-in-the-loop: review edits before they apply
  • Best for day-to-day interactive development

✅ Agent SDK

  • Programmatic — build custom agents & automation
  • Same engine, callable from TS or Python
  • Best for CI/CD and production, not interactive coding
🔑 They're not competitors: the IDE is the human interface, the SDK is the programmatic one, and both wrap the identical Claude Code agent loop.

EXAM TRAPS

Trap: "Installing the VS Code extension puts claude on your PATH." → It bundles a private CLI copy for the panel only. To run claude in the terminal (for claude mcp add, claude --resume, etc.) you still need the standalone CLI install.
Trap: "The JetBrains plugin ships its own Claude binary." → It runs the claude command in the IDE's integrated terminal, so you must install the CLI too. VS Code bundles one; JetBrains does not.
Trap: "It's the Claude Code SDK." → It was renamed the Claude Agent SDK. Packages: @anthropic-ai/claude-agent-sdk (npm) and claude-agent-sdk (pip, Python 3.10+), both entering through query().
Trap: "IDE selection sharing can't be turned off for secrets." → A Read deny rule for a path blocks both its selected text and the open-file notice from reaching Claude.

PRACTICE

Q1 · You installed the VS Code extension but claude mcp add fails in the terminal. Why?

The extension bundles a private CLI for its chat panel but doesn't add claude to your PATH. Install the standalone CLI, after which terminal commands like claude mcp add and claude --resume work in any terminal.

Q2 · Name the Agent SDK packages and the function you call to run an agent.

TypeScript: @anthropic-ai/claude-agent-sdk (npm). Python: claude-agent-sdk (pip, Python 3.10+). Both drive the agent with query(...), passing a prompt and options (e.g. allowedTools). It was formerly the Claude Code SDK.

Q3 · You're in an external terminal, not the IDE's. How do you get diffs to show in the IDE?

Run /ide inside the Claude Code session to connect it to the running IDE; that activates native diff viewing, selection context, and diagnostic sharing. (In JetBrains you can also set the diff tool to auto via /config.)