Emacs MCP Server

by vivekhaldar

36 stars
295 downloads
Not rated
GitHub

Description

# Emacs MCP Server Model Context Protocol (MCP) server for Emacs. Enables generating and running elisp code in a running Emacs process. ## Tools The server exposes two tools: - `generate_emacs_lisp_code`: generates elisp for a given task - `execute_emacs_lisp_code`: passes elisp…

About

# Emacs MCP Server Model Context Protocol (MCP) server for Emacs. Enables generating and running elisp code in a running Emacs process. ## Tools The server exposes two tools: - `generate_emacs_lisp_code`: generates elisp for a given task - `execute_emacs_lisp_code`: passes elisp to a running Emacs (via `emacsclient`)…

Details

Author
vivekhaldar
GitHub stars
36
Downloads
295
Categories
Other

- Generates Emacs Lisp code for a given task.
- Executes generated elisp in a running Emacs via emacsclient.
- Exposes two tools: generate_emacs_lisp_code and execute_emacs_lisp_code.
- Requires an OpenAI API key and a configured emacsclient path.
- Can be integrated with Claude Desktop or other MCP-compatible clients.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Emacs MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

The project is managed with uv. Run uv sync to install dependencies and source .venv/bin/activate to activate the virtual environment. To run the server in the MCP inspector, use mcp dev emacs_mcp_server.py. For integration with Claude Desktop, run mcp install emacs_mcp_server.py and then edit claude_desktop_config.json to include your OPENAI_API_KEY and the full path to emacsclient.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "emacs mcp server": {
            "Emacs-MCP-Server": {
                "command": "uv",
                "args": [
                    "run",
                    "--with",
                    "mcp[cli]",
                    "--with",
                    "smartfunc",
                    "mcp",
                    "run",
                    "/Users/haldar/repos/gh/emacs-mcp-server/emacs_mcp_server.py"
                ],
                "env": {
                    "OPENAI_API_KEY": "",
                    "EMACSCLIENT": ""
                }
            }
        }
    }
}

McpServers

{
    "Emacs-MCP-Server": {
        "command": "uv",
        "args": [
            "run",
            "--with",
            "mcp[cli]",
            "--with",
            "smartfunc",
            "mcp",
            "run",
            "/Users/haldar/repos/gh/emacs-mcp-server/emacs_mcp_server.py"
        ],
        "env": {
            "OPENAI_API_KEY": "",
            "EMACSCLIENT": ""
        }
    }
}

Emacs MCP Server

Model Context Protocol (MCP) server for Emacs. Enables generating and running elisp code in a running Emacs process.

Tools

The server exposes two tools:
- generate_emacs_lisp_code: generates elisp for a given task
- execute_emacs_lisp_code: passes elisp to a running Emacs (via emacsclient) to eval and execute it.

Invocation

The project is managed with uv. First, run uv sync to install all dependencies. Then source .venv/bin/activate to activate the resulting venv.

To run the MCP server in the inspector:

mcp dev emacs_mcp_server.py

To install the MCP server so that Claude Desktop can use it:

mcp install emacs_mcp_server.py

But you will have to edit the resulting JSON config in claude_desktop_config.json to include API keys and the full path to emacsclient. It should look something like this:

    "Emacs-MCP-Server": {
      "command": "/Users/haldar/.local/bin/uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "smartfunc",
        "mcp",
        "run",
        "/Users/haldar/repos/gh/emacs-mcp-server/emacs_mcp_server.py"
      ],
      "env": {
          "OPENAI_API_KEY": "sk-xxxx",
          "EMACSCLIENT": "/your/path/to/emacsclient"
      }
    }
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.