claude-code-emacs
This package provides seamless integration with Claude Code, allowing you to run AI-powered coding sessions directly in your Emacs environment.
claude mcp add --transport stdio yuya373-claude-code-emacs claude-code-mcp
How to use
Claude Code Emacs integrates Claude Code into your Emacs workflow via MCP. The server exposes an MCP interface that lets Emacs communicate with Claude Code for buffer operations, LSP diagnostics, diffs, and real-time events. With the provided MCP setup, Emacs can start a session, send prompts, read diagnostics, and apply actions within a per-project context. The workflow centers on launching the MCP server (claude-code-mcp) and connecting Emacs through the stdio MCP channel, enabling seamless command and control from within your editor.
How to install
Prerequisites:
- Node.js 16+ (for MCP)
- npm (or any Node.js package manager)
- Optional: Emacs 28.1+ with required packages (projectile, vterm, transient, markdown-mode)
Installation steps:
-
Install the MCP server globally: npm install -g claude-code-mcp-server
-
Configure Claude Code to use MCP (Emacs side): claude mcp add-json emacs '{ "type": "stdio", "command": "claude-code-mcp" }'
-
Start a Claude Code MCP session from Emacs (via M-x claude-code-run) or use the provided transient menu to initiate chats and commands. If you prefer to run without installation, you can also use NPX: claude mcp add-json emacs '{ "type": "stdio", "command": "npx", "args": ["claude-code-mcp-server"] }'
-
Optional: Build from source and point the MCP config to the built index.js as described in the MCP setup docs.
Note: The MCP server communicates over stdio; ensure the command configured matches the installation method you choose (global npm install, npx, or built from source).
Additional notes
Tips:
- The server provides per-project WebSocket connections and automatic reconnection logic for robustness.
- Ensure Node.js is available in your environment if using the Node-based MCP server. If you run into WebSocket-related issues, verify optional dependencies like lsp-mode and websocket are installed as needed.
- The Emacs integration expects the Claude Code CLI to be installed (or accessible via NPX) for full functionality.
- When updating versions, follow the release notes to adjust MCP configuration as necessary (e.g., path changes or new flags).
- If you encounter environment variable needs, common ones include paths to the Claude Code CLI, project root, and per-project prompt files.
Related MCP Servers
claude-talk-to-figma
A Model Context Protocol (MCP) that allows Claude Desktop and other AI tools (Claude Code, Cursor, Antigravity, etc.) to read, analyze, and modify Figma designs
ollama
An MCP Server for Ollama
ask-user-questions
Better 'AskUserQuestion' - A lightweight MCP server/OpenCode plugin/Agent Skills + CLI tool that allows your LLMs ask questions to you. Be the human in the human-in-the-loop!
create -kit
Scaffold a production-ready Model Context Protocol (MCP) server in seconds.
bindly-claude-code
Knowledge completion layer for Claude Code - finish your thoughts and make them reusable across sessions and agents
mcp-tidy
CLI tool to visualize and manage MCP server configurations in Claude Code. List servers, analyze usage statistics, and clean up unused servers