promptgarten ๐ŸŒฑ
๐ŸŒ ES

Add-ons & integrations ยท Obsidian

Graph Context for Claude Code

Young Obsidian plugin that plugs the vault into Claude Code's /ide selection: selecting text automatically sends along graph context (resolved links, backlinks, heading path).

This very young plugin (June 2026) makes Obsidian visible inside Claude Code's built-in IDE mechanism โ€” the same lock-file-plus-local-WebSocket approach also used by the official VS Code and JetBrains extensions. On load, the plugin starts a WebSocket server on 127.0.0.1 and writes a lock file with the port, vault path, and a session auth token to ~/.config/claude/ide/<port>.lock or ~/.claude/ide/<port>.lock. Claude Code finds this file automatically, connects, authenticates with the token, and then speaks MCP over JSON-RPC. The real value lies in the "Graph Context" layer: when you select text in a note, the plugin doesn't just send the raw markdown with opaque [[links]] โ€” it resolves them server-side using Obsidian's own metadataCache resolver and sends everything along in one payload: embedded ![[embeds]] in full, [[wikilinks]] as a short summary (frontmatter + first paragraph), the cursor's heading path, frontmatter, and backlinks. The difference from classic Obsidian MCP servers: there, Claude has to resolve every link individually via a tool call (N links = Nร—2 round trips); here, the resolved context automatically comes along with the selection, with no extra tool calls. The resolution is deliberately only one level deep (links within an already-linked link aren't expanded further) and size-limited (embeds 2000 characters, wikilink summaries 200, 8000 total, backlinks 20), with explicit truncated flags instead of silent cutoffs. Only runs on desktop Obsidian, since a Node WebSocket server is required.

๐Ÿ”ง SETUP

  1. Requires desktop Obsidian (the plugin is isDesktopOnly) and a working Claude Code installation in the terminal.
  2. Build it manually, since there's no community plugin listing yet: clone the repo, then `npm install && npm run build`.
  3. Copy `main.js` and `manifest.json` into your own vault: `<vault>/.obsidian/plugins/graph-context-for-claude-code/`.
  4. In Obsidian under Settings โ†’ Community plugins, disable Restricted Mode if needed and enable "Graph Context for Claude Code" โ€” a message "ready on port <PORT>" appears.
  5. In a separate terminal, start `claude`, enter `/ide`, and select "Obsidian"; then select text in a note and ask Claude about it right away.

โœ… WHEN TO USE IT?

Notes with many links as context for a question

Select a paragraph that links to several other notes and ask "Summarize what I selected and how it relates to the linked notes" โ€” Claude already has the linked content in the first payload, without loading each link separately.

Quick follow-up questions about a single note without API key setup

Anyone who only occasionally wants to access a single Obsidian note during a Claude Code coding session doesn't need the separate HTTPS server with API key that the Local REST API solution requires โ€” here `/ide` and selecting Obsidian is enough.

โ›” WHEN NOT TO?

Mobile use or automation without an open Obsidian app

The plugin is explicitly isDesktopOnly and needs a running desktop Obsidian instance with an active WebSocket server โ€” there's no headless mode.

Better: For automation without an open Obsidian app, use the Obsidian Local REST API with its standalone HTTPS server.

Deep multi-hop links should come along automatically

The graph expansion is deliberately limited to depth 1 โ€” links inside an already-expanded linked note aren't resolved any further.

Better: For deeper graph traversal, specifically use the Local REST API's MCP tools or a dedicated graph tool like Graphify with Obsidian export.

SOURCES