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
Connect an MCP Client that only supports local (stdio) servers to a Remote MCP Server, with auth support: TypeScript-based implementation.
Clojure MCP Trusted by 600+ developers. Trusted by 600+ developers. Trusted by 600+ developers.
5. Update .env file in the root directory with your mem0 API key: for the Model Context Protocol. Enhance AI assistants with powerful integrations.
- Discover available MCP servers from our curated registry TypeScript-based implementation.
Model Context Protocol integration for Python. Enhance AI assistants with powerful Python-based capabilities and integration support.
This repository contains Model Context Protocol (MCP) servers that enable MCP clients (like Claude Desktop or the cline.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP