Claude Code Emacs plugin
An Emacs package for Claude Code: per-project sessions and an MCP server exposing buffers, LSP and diffs to the agent.
- 67 ★ on the repository
- Last commit
- GPL-3.0
Extended access
Why this level
- The MCP server exposes buffer contents, diagnostics and patch application in your Emacs to the agent.
- Key bindings forward Claude Code control keys into the terminal buffer.
Install
- Works in
Manual install
npm install -g claude-code-mcp-serverMCP server for Emacs. Then `claude mcp add-json emacs` with the stdio command `claude-code-mcp`.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The MCP server exposes buffer contents, diagnostics and patch application in your Emacs to the agent.
- Key bindings forward Claude Code control keys into the terminal buffer.
This is third-party code. Review the repository files before installing.
What it does
Claude Code Emacs runs Claude Code sessions inside Emacs: every project gets its own buffer and `@` in a prompt opens completion over project files. The main menu opens with `C-c c` through transient, custom commands live in `.claude/commands/*.md` and persistent project context lives in `.claude-code.prompt.md`. Sessions run in vterm mode with a key set for control and a separate agents view mode. The `claude-code-mcp-server` MCP server links Claude Code to the Emacs environment: listing and reading open buffers, selected text, LSP diagnostics, definition and reference lookups, file comparison, git change viewing and patch application. Buffer events and diagnostics reach the agent in real time, and when Emacs restarts running sessions, including background agents, re-register automatically.
Who it is for. Emacs users who want to run Claude Code inside the editor and give the agent access to buffers and diagnostics.
Good fit when
- Separate Claude Code sessions per project are needed in Emacs buffers.
- The agent must read open buffers and the selection with no copied text.
- LSP diagnostics and definition lookups must reach the agent from the editor.
- Custom commands and persistent project prompts live in `.claude/commands` and `.claude-code.prompt.md`.
Not a fit when
- You do not use Emacs; the package targets only that editor.
- You cannot install the MCP server globally through `npm install -g`.
- You need a standalone GUI with no vterm.
Example request
Run M-x claude-code-run in this project and show LSP diagnostics for the open buffer.Limitations
The package is licensed under GPL-3.0 and targets Emacs with vterm mode. MCP integration needs the `claude-code-mcp-server` package installed separately with `npm install -g` and registered in Claude Code through `claude mcp add-json emacs`. The agent gets buffer reading, diagnostics and patch application, so check permissions before connecting for third-party projects. Some key bindings forward Claude Code control keys and depend on its version.
How to disable. Remove `(require 'claude-code)` from `init.el`, uninstall the server with `npm uninstall -g claude-code-mcp-server` and delete the `emacs` entry from Claude Code MCP configuration.
FAQ
How do I install the package?
Add the package path to `load-path`, evaluate `(require 'claude-code)` and bind `C-c c` to `claude-code-transient`. Then `M-x claude-code-run` starts a session.
How do I connect the MCP server?
Run `npm install -g claude-code-mcp-server`, then `claude mcp add-json emacs` with a stdio server entry and the command `claude-code-mcp`.
What does the agent get from Emacs?
The list and contents of open buffers, selected text, LSP diagnostics, definitions and references, file comparison, git changes and patch application.
How do I start with options?
Run `C-u M-x claude-code-run`; the package lets you choose model, session resume and other options.
What happens when Emacs restarts?
Running sessions, including background agents, re-register themselves and reconnect automatically.
Discussion
No questions or reviews yet.
Related
PluginsAn MCP server that gives Claude Desktop and other clients file tools, a shell and sub-agents in the style of Claude Code
Streams Claude Code hidden thinking, tool calls and subagents to a separate terminal with a live session tree
A terminal explorer for Claude Code configuration: CLAUDE.md, commands, subagents and settings.json with a preview
Persistent memory for Claude Code on your own database: capture of decisions and context plus a code graph, injected into every prompt
A Claude Code plugin that generates and maintains CLAUDE.md: a 0 to 100 quality score, a 150-line cap and stale reference checks
An MCP server that gives an agent search over a large Claude Code guide, official docs, releases and ready-made templates
README in short
The package adds a transient menu, per-project sessions, an agents view mode and MCP integration with buffers and LSP to Emacs. A Japanese README and a test suite are included.