Emacs MCP
A Model Context Protocol server that enables generating and executing Elisp code in a running Emacs process, allowing AI assistants to control and interact with Emacs.
What is Emacs MCP?
Emacs MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol server that enables generating and executing elisp code in a running emacs process, allowing ai assistants to control and interact with emacs.
A Model Context Protocol server that enables generating and executing Elisp code in a running Emacs process, allowing AI assistants to control and interact with Emacs.
This server falls under the Developer Tools and File Systems categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A Model Context Protocol server that enables generating and
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx emacs-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Emacs MCP
Emacs MCP Server is a Python-based MCP server that connects AI assistants to a running Emacs editor process by generating and executing Emacs Lisp (Elisp) code via emacsclient. It exposes two tools: one that generates Elisp code for a given task, and one that evaluates that code inside the live Emacs process. Emacs power users and developers use it to control Emacs through natural language — manipulating buffers, running commands, configuring packages, or automating repetitive editor operations — without writing Elisp manually.
Prerequisites
- Emacs installed with the emacsclient binary available (Emacs 26+ recommended)
- Emacs server mode enabled in your Emacs session (add '(server-start)' to your init.el, or run M-x server-start)
- Python 3.10 or higher and uv package manager installed
- An OpenAI API key (the server uses OpenAI for Elisp code generation)
- An MCP client such as Claude Desktop
Clone the repository and install dependencies
Download the server and use uv to install all Python dependencies into a local virtual environment.
git clone https://github.com/vivekhaldar/emacs-mcp-server.git
cd emacs-mcp-server
uv syncEnable Emacs server mode
The MCP server communicates with Emacs via emacsclient, which requires Emacs to be running in server mode. Add this line to your Emacs init.el (or run M-x server-start each session).
;; In your ~/.emacs or ~/.emacs.d/init.el
(server-start)Find the paths to uv and emacsclient
Note the full absolute paths to both binaries — they are required in the Claude Desktop config.
which uv
which emacsclientConfigure Claude Desktop
Edit claude_desktop_config.json and add the Emacs MCP Server entry. Use absolute paths for uv, the server script, and emacsclient. The OPENAI_API_KEY is used by the server to generate Elisp code.
{
"mcpServers": {
"Emacs-MCP-Server": {
"command": "/Users/yourname/.local/bin/uv",
"args": [
"run",
"--with", "mcp[cli]",
"--with", "smartfunc",
"mcp",
"run",
"/Users/yourname/repos/emacs-mcp-server/emacs_mcp_server.py"
],
"env": {
"OPENAI_API_KEY": "sk-your-openai-key",
"EMACSCLIENT": "/usr/local/bin/emacsclient"
}
}
}
}Restart Claude Desktop
Save the config, ensure Emacs is running with server mode active, and restart Claude Desktop. The generate_emacs_lisp_code and execute_emacs_lisp_code tools will be available.
Emacs MCP Examples
Client configuration
Full claude_desktop_config.json entry for Emacs MCP Server with uv and emacsclient paths.
{
"mcpServers": {
"Emacs-MCP-Server": {
"command": "/Users/haldar/.local/bin/uv",
"args": [
"run",
"--with", "mcp[cli]",
"--with", "smartfunc",
"mcp",
"run",
"/Users/haldar/repos/emacs-mcp-server/emacs_mcp_server.py"
],
"env": {
"OPENAI_API_KEY": "sk-your-openai-key-here",
"EMACSCLIENT": "/usr/local/bin/emacsclient"
}
}
}
}Prompts to try
Natural language commands you can give Claude to control your Emacs instance.
- "Open the file ~/projects/main.py in Emacs."
- "In Emacs, go to line 42 in the current buffer."
- "Install the magit package in Emacs using package-install."
- "Show me a list of all currently open Emacs buffers."
- "In Emacs, run M-x org-agenda to open the agenda view."
- "Replace all occurrences of 'foo' with 'bar' in the current Emacs buffer."Troubleshooting Emacs MCP
'Connection refused' or 'No such server' error from emacsclient
Emacs server mode is not running. In Emacs, run M-x server-start, or add (server-start) to your init.el and restart Emacs. Also verify the EMACSCLIENT path in the config points to the correct binary (run 'which emacsclient' to confirm).
Elisp execution returns unexpected results or errors
The generate_emacs_lisp_code tool uses OpenAI to write Elisp, which may produce incorrect code for unusual requests. Review the generated Elisp before allowing execution on critical buffers. For sensitive operations, ask Claude to show you the Elisp first before executing.
Server fails to start: 'module not found' or import errors
Run 'uv sync' in the repo directory to ensure all dependencies are installed. The config must use the same uv binary that has access to the project's virtual environment. Use the absolute path from 'which uv' in the command field.
Frequently Asked Questions about Emacs MCP
What is Emacs MCP?
Emacs MCP is a Model Context Protocol (MCP) server that model context protocol server that enables generating and executing elisp code in a running emacs process, allowing ai assistants to control and interact with emacs. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Emacs MCP?
Follow the installation instructions on the Emacs MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Emacs MCP?
Emacs MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Emacs MCP free to use?
Yes, Emacs MCP is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Emacs MCP Alternatives — Similar Developer Tools Servers
Looking for alternatives to Emacs MCP? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Emacs MCP in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Emacs MCP?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.