keegancsmith
MCP Serverkeegancsmithpublic

emacs mcp server

Interact with Emacs in Claude/etc via MCP

Repository Info

8
Stars
0
Forks
8
Watchers
0
Issues
JavaScript
Language
MIT License
License

About This Server

Interact with Emacs in Claude/etc via MCP

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

Emacs MCP Server

This is a simple MCP (Model Context Protocol) server that allows language models to interact with Emacs through emacsclient --eval commands and view the current state of Emacs.

Features

The server provides three tools:

  • emacs_eval: Evaluates an Emacs Lisp expression and returns the result
  • emacs_get_visible_text: Gets the text currently visible in the Emacs window
  • emacs_get_context: Gets contextual information about the current Emacs state (buffer, mode, point position, etc.)

Requirements

  • Node.js
  • Emacs with the server running (M-x server-start in Emacs)

Installation

No installation is needed if you use npx. Just make sure you have Node.js and npm installed.

Usage with Claude for Desktop

To use this MCP server with Claude for Desktop:

  1. Make sure Emacs is running with the server started (M-x server-start)

  2. Add the server to your Claude for Desktop configuration at:

    • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
    • Windows: %AppData%\Claude\claude_desktop_config.json

Example configuration:

{
  "mcpServers": {
    "emacs-mcp": {
      "command": "npx",
      "args": [
        "-y", "@keegancsmith/emacs-mcp-server"
      ]
    }
  }
}
  1. Restart Claude for Desktop

How It Works

The server uses emacsclient --eval to send Lisp expressions to a running Emacs instance. All operations are performed in the context of the currently visible buffer in the selected window. This allows language models to:

  • Query information from Emacs (buffers, modes, variables, etc.)
  • Execute commands in Emacs
  • Manipulate text and buffers
  • Access Emacs functionality
  • See what's currently visible in Emacs
  • Get cursor position and other buffer context

Example Usage

Once the server is set up, you can use it in Claude to interact with Emacs:

Can you show me the list of buffers in my Emacs?

Claude will use the emacs_eval tool with an expression like (buffer-list) to retrieve and display your buffers.

What's currently visible in my Emacs window?

Claude can use emacs_get_visible_text to see the text content that's currently displayed.

What file am I currently editing in Emacs?

Claude will use emacs_get_context to provide information about the current buffer.

Security Considerations

This server allows executing arbitrary Emacs Lisp code, which has full access to your Emacs environment and potentially your system. Use with trusted LLM providers and be cautious about the expressions that might be executed.

License

MIT

Quick Start

1

Clone the repository

git clone https://github.com/keegancsmith/emacs-mcp-server
2

Install dependencies

cd emacs-mcp-server
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerkeegancsmith
Repoemacs-mcp-server
LanguageJavaScript
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation