emacs-mcp
Documentation
Emacs MCP - Model Context Protocol for Emacs
This package implements the Model Context Protocol (MCP) for Emacs, extending the capabilities of LLMs to access information about Emacs environment and configration. Emacs MCP provides tools with information about loaded packages, available functions, keybindings, documentation, and more. This enables LLMs to be used to extend Emacs configuration and author new packages without requiring user to manually specify contextually relevant files.
Installation
Clone this repository and include the following code in your user init file (e.g., ~/.emacs.d/init.el or equivalent):
(add-to-list 'load-path "/path/to/emacs-mcp")
(require 'emacs-mcp)Test your configuration using model context protocol inspector:
npx @modelcontextprotocol/inspector emacs --batch --load '' --eval '(emacs-mcp-run-stdio)'Doom Emacs Configuration
Doom Emacs does not have an init file. To load user configuration before running in batch mode, you need to create a doomscript file which bootstraps doom emacs environment and loads your configuration files.
You can create a file called `~/.config/doom/bin/emacs-mcp` with the following content:
#!/usr/bin/env doomscript
(defcli! emacs-mcp ()
(doom-modules-initialize) ; initialize the module system
(doom-initialize t) ; bootstrap Doom as if this were an interactive session
(doom-startup) ; load your modules and user config
(emacs-mcp-run-stdio)) ; run the MCP server
(run! "emacs-mcp")This will ensure that the emacs instance running MCP server will access the same environment and modules as your interactive Doom Emacs instance.
You can then test your configuration using the following command:
npx @modelcontextprotocol/inspector ~/.config/emacs/bin/doomscript ~/.config/doom/bin/emacs-mcpUsage
Configure MCP server for your LLM client, by changing the `mcp.json` file as prescribed by your LLM client's documentation, such as Claude Code or Amazon Q Developer CLI.
{
"mcpServers": {
"emacs": {
"command": "emacs",
"args": [
"--batch",
"--load",
"",
"--eval",
"(emacs-mcp-run-stdio)"
]
}
}
}Or if you are using Doom Emacs, you can use the following configuration:
{
"mcpServers": {
"emacs": {
"command": "~/.config/emacs/bin/doomscript",
"args": ["~/.config/doom/bin/emacs-mcp"]
}
}
}License
MIT
Frequently asked questions
What is emacs-mcp?
emacs-mcp is a Model Context Protocol (MCP) server listed in the TrackMCP directory.
How do I install emacs-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is emacs-mcp open source?
Yes — it is hosted on GitHub at https://github.com/mpontus/emacs-mcp and has 6 stars.
Related MCP tools
Model Context Protocol Servers
Cognee is the open-source AI memory platform for agents. Give your AI agents persistent long-term memory across sessions with a self-hosted knowledge graph engine.
Search infrastructure for AI
A MCP for Claude Desktop / Claude Code / Windsurf / Cursor to build n8n workflows for you
MCP server to provide Figma layout information to AI coding agents like Cursor
Python SQL Parser and Transpiler
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP