claude-code-emacs
by yuya373·★ 63·综合分 46
Emacs 包提供 Claude Code 的 MCP 集成,实现具有缓冲区和 LSP 操作的 AI 编程会话。
概述
Claude Code Emacs 通过模型上下文协议在 Emacs 和 Claude Code 之间提供无缝集成。它直接在 Emacs 内部启用 AI 编程会话,具有项目隔离、智能文件补全和自定义命令功能。该软件包深度集成了 Emacs 功能,包括缓冲区操作、LSP 诊断和 Git 工作流程,创建强大的编程助手环境。其模块化设计确保通过 WebSocket 连接在 Emacs 和 Claude Code 之间实现高效实时通信。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
如果您是 Emacs 用户,希望将 Claude Code 直接集成到编辑环境中而无需切换上下文,请选择此方案。
什么时候不要选它
如果您不使用 Emacs 或更喜欢具有 AI 功能的通用 IDE,则不太适合此方案,因为它与 Emacs 紧密耦合。
此 server 暴露的工具
从 README 抽取出 12 个工具list_buffersList open buffers in Emacs
read_bufferRead contents of an Emacs buffer
get_selected_textGet currently selected text in Emacs
get_diagnosticsGet LSP diagnostics for current buffer
find_definitionFind definition of symbol using LSP
find_referencesFind references to symbol using LSP
describe_symbolGet documentation for symbol using LSP
diff_filesCompare two files showing differences
view_git_changesView git changes for current file
apply_patchApply patch to file
commitCreate git commit
pushPush changes to remote git repository
说明:Tool names inferred from MCP integration section and key features, as README doesn't provide explicit MCP tool documentation
可对比工具
安装
# 全局安装 MCP 服务器
npm install -g claude-code-mcp-server
# 配置 Claude Code 使用 MCP
claude mcp add-json emacs '{
"type": "stdio",
"command": "claude-code-mcp"
}'
# 添加到 Emacs init.el
(add-to-list 'load-path "/path/to/claude-code")
(require 'claude-code)
(global-set-key (kbd "C-c c") 'claude-code-transient)FAQ
- 需要哪些 Emacs 版本?
- 需要 Emacs 28.1 或更高版本。还需要额外包如 projectile、vterm、transient 和 markdown-mode。LSP-mode (9.0.0+) 是可选的,但推荐用于完整功能。
- MCP 服务器如何与 Emacs 通信?
- 服务器使用 stdio 与 Claude Code 通信,并为每个项目维护单独的 WebSocket 连接。这实现了实时事件批处理和具有健康监控的自动重新连接。
claude-code-emacs 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。