VE

vivekhaldar/emacs-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

37 stars 6 forks 质量 36 趋势 12

Emacs 模型上下文协议(MCP)服务器。支持在运行中的 Emacs 进程中生成和运行 ELISP 代码。

概览

Emacs 模型上下文协议(MCP)服务器。支持在运行中的 Emacs 进程中生成和运行 ELISP 代码。 服务器会提供两个工具:- generate_emacs_lisp_code:为给定任务生成 elisp - execute_emacs_lisp_code:通过 emacsclient 将 elisp 传递给正在运行的 Emacs 以进行评估和执行。 项目是用 uv 来管理的。首先,运行 uv sync 来安装所有依赖。然后从 .venv/bin/activate 获取源代码来激活生成的 venv。 安装MCP服务器以便Claude Desktop使用: 但你需要在claude_desktop_config.json中编辑最终的JSON配置,包含API密钥和完整的emacsclient路径。它应该是这样的:

概述(AI 翻译)

Emacs 模型上下文协议(MCP)服务器。支持在运行中的 Emacs 进程中生成和运行 ELISP 代码。

工具

服务器提供两个工具:

  • generate_emacs_lisp_code:为给定任务生成 elisp
  • execute_emacs_lisp_code:通过emacsclient将elisp传递给正在运行的Emacs,进行评估并执行。

祈祷

该项目由 uv 管理。首先,运行 uv sync 安装所有依赖。然后 source .venv/bin/activate 激活生成的 venv。

要在检查器中运行MCP服务器:

安装MCP服务器以便Claude Desktop使用:

但你需要在 claude_desktop_config.json 中编辑 JSON 配置,包含 API 密钥和通往 emacsclient 的完整路径。它应该大致是这样的:

本页由 AI 翻译,技术细节请以原文为准。

README

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"
      }
    }
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →