emacsclient-mcp
An MCP server that provides LLMs with direct access to Emacs via its server protocol, offering 22 tools for editing, search, buffer management, and a PR review agent.
README
emacsclient-mcp
Emacs MCP server + Pi extension — 22 Emacs tools for LLM-assisted editing, search, buffer management, and PR review.
What is this?
A Model Context Protocol (MCP) server that gives LLMs direct access to Emacs — no emacsclient binary needed. It communicates via Unix socket using the Emacs server protocol, implementing &-quoting as defined in emacsclient.c and server.el.
Comes with:
- Rust MCP binary — 22 tools over JSON-RPC stdio
- Pi extension — auto-spawns the binary, registers all tools
- PR review agent — 4-phase workflow (Setup → Analysis → Issues → Report)
Quick Start
1. Install
# Option A: Pi package (recommended — gets extension + agent)
pi install npm:@bimawa/emacsclient-mcp
# Option B: Rust binary only (for other MCP clients)
cargo install emacsclient-mcp
# Option C: Homebrew (macOS)
brew install bimawa/tap/emacsclient-mcp
2. Start Emacs server
M-x server-start
;; or:
emacs --daemon
3. Reload Pi
/reload
Pi picks up the extension, spawns the binary, discovers 22 Emacs tools, and registers the emacs-pr-review agent.
Tools
| Category | Tools |
|---|---|
| Eval | emacs_eval — run arbitrary Elisp |
| Buffers | emacs_list_buffers, emacs_create_buffer, emacs_set_buffer_content, emacs_get_buffer_content, emacs_save_buffer, emacs_kill_buffer |
| Navigation | emacs_find_file, emacs_switch_to_buffer, emacs_goto_line, emacs_get_cursor_position, emacs_get_line |
| Search | emacs_search, emacs_replace |
| Editing | emacs_insert_at_point, emacs_get_region, emacs_set_mark |
| Windows | emacs_split_window_right, emacs_split_window_below, emacs_other_window, emacs_delete_other_windows, emacs_display_in_other_window |
PR Review Agent
Activate with /agent emacs-pr-review in Pi. The agent:
- Setup — gets the diff, opens review buffer in
org-mode, splits Emacs windows - Analysis — reads each changed file, applies review heuristics (R1–R4)
- Findings — documents issues by severity: BLOCKER / CRITICAL / WARNING / SUGGESTION
- Report — shows summary in Emacs, offers inline comments
Protocol
Implements the exact Emacs server protocol from server.el:
- Client sends first (no server greeting)
- Single-line commands:
-auth KEY -eval EXPR\n &-quoting: spaces →&_, newlines →&n, leading-→&-,&→&&- Response:
-emacs-pid PID\n-print RESULT\n
Binary Resolution
The extension finds the binary in this order:
EMACS_MCP_BINARYenvironment variable- Pre-built binary alongside the extension (package distro)
~/.cargo/bin/emacsclient-mcp(cargo install)which emacsclient-mcp(PATH / Homebrew)cargo run --release(dev mode)
Development
# Build the Rust binary
cargo build --release
# Run locally with Pi
pi -e ./extension/index.ts
# Test the MCP binary directly
echo '{"jsonrpc":"2.0","id":1,"method":"initialize",...}' | ./target/release/emacsclient-mcp
License
MIT © bimawa
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。