claude-code-mcp-server
v0.10.1MCP server for Claude Code Emacs integration
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
getOpenBuffers
List Emacs buffers that visit files under the current project root. Each entry has the absolute file path, the buffer name, whether it is the current buffer in Emacs (active), and whether it has unsaved changes (modified). Buffers without a file (vterm, dired, *scratch*, etc.) and files outside the project are not included. The buffer name is what getDiagnostics takes as its buffer argument.
| Parameter | Type | Description |
|---|---|---|
includeHidden | boolean | Include hidden buffers (starting with space) |
getCurrentSelection
Get the text of the active region (selection) in the current Emacs buffer (normally the one the user is working in), with its file path and start/end line and column. When no region is active it returns "No text is currently selected" and empty fields; the file path is empty when the buffer is not visiting a file. It returns only the selected text, not the rest of the buffer.
getDiagnostics
Get lsp-mode diagnostics (errors, warnings, hints) for every file in the LSP workspace that the given buffer belongs to, grouped by file. The buffer argument is an Emacs buffer name (the name field from getOpenBuffers), not a file path; the buffer must be open with lsp-mode active, because its workspace decides which diagnostics come back. Returns an empty list when lsp-mode is not installed or the server reports nothing. Structured output uses 0-based lines and a single start position per range; the text output shows 1-based lines.
| Parameter | Type | Description |
|---|---|---|
buffer * | string | Name of an open Emacs buffer with lsp-mode active (e.g. the name field from getOpenBuffers), not a file path |
getDefinition
Find where a symbol is defined, using lsp-mode (textDocument/definition). The file is opened in Emacs, point moves to the first occurrence of symbol on the given line, and the language server is asked for its definition; if symbol does not appear on that line, the request is made from the start of the line and may resolve a different symbol. Requires lsp-mode to be active for that file. Returns each definition location with a few lines of preview, or an error when none is found.
| Parameter | Type | Description |
|---|---|---|
file * | string | File path, absolute or relative to the project root |
line * | number | 1-based line number where symbol appears |
symbol * | string | Symbol name exactly as written on that line |
findReferences
Find all references to a symbol, using lsp-mode (textDocument/references). The file is opened in Emacs, point moves to the first occurrence of symbol on the given line, and the language server is asked for references; if symbol does not appear on that line, the request is made from the start of the line. Requires lsp-mode to be active for that file. Returns each reference with its path relative to the project root, absolute path, range and a few lines of preview.
| Parameter | Type | Description |
|---|---|---|
file * | string | File path, absolute or relative to the project root |
line * | number | 1-based line number where symbol appears |
symbol * | string | Symbol name exactly as written on that line |
includeDeclaration | boolean | Include the declaration in results (default: true) |
describeSymbol
Get the hover documentation (signature, type, docstring) for a symbol, using lsp-mode (textDocument/hover). The file is opened in Emacs, point moves to the first occurrence of symbol on the given line, and the language server is asked for hover information; if symbol does not appear on that line, the request is made from the start of the line. Requires lsp-mode to be active for that file. Content depends entirely on what the language server returns for hover.
| Parameter | Type | Description |
|---|---|---|
file * | string | File path, absolute or relative to the project root |
line * | number | 1-based line number where symbol appears |
symbol * | string | Symbol name exactly as written on that line |
sendNotification
Show a notification to the user in Emacs, for example when a task completes or needs their attention. Uses the alert package when it is installed (which may produce a desktop notification, depending on the user's alert style) and otherwise falls back to a message in the Emacs echo area. It does not wait for or return any user response.
| Parameter | Type | Description |
|---|---|---|
message * | string | Message content of the notification |
title * | string | Title of the notification |
openDiffFile
Compare two files side-by-side in an Emacs ediff session. Paths may be absolute or relative to the project root, and both files must exist. For comparing a file with its git history, use openRevisionDiff instead.
| Parameter | Type | Description |
|---|---|---|
fileA * | string | First file, absolute or relative to the project root |
fileB * | string | Second file, absolute or relative to the project root |
openRevisionDiff
Compare a file with its previous version from git history. Use this when you want to see what changed in a file over time, not for comparing two different files.
| Parameter | Type | Description |
|---|---|---|
file * | string | File to compare with its git history |
revision | string | Git revision to compare against (e.g., HEAD, HEAD~1, branch-name, commit-hash) |
openCurrentChanges
Show the uncommitted changes of a file as a unified diff in an Emacs *vc-diff* buffer, comparing the working copy with the last committed version (like git diff). Without file it uses the file of the current Emacs buffer. For a side-by-side comparison against a specific revision, use openRevisionDiff.
| Parameter | Type | Description |
|---|---|---|
file | string | File, absolute or relative to the project root; defaults to the file of the current Emacs buffer |
openDiffContent
Compare two text snippets side-by-side in an Emacs ediff session. Use this for content that is not saved in files, such as alternative versions of a code snippet, API responses, or generated content. Each content goes into a dedicated buffer named "*claude-code-diff: <title>*"; an earlier buffer with the same title is reused only if it is unedited and no longer in an ediff session, and no other buffer is ever modified.
| Parameter | Type | Description |
|---|---|---|
contentA * | string | First text content to compare |
contentB * | string | Second text content to compare |
titleA * | string | Descriptive title for the first content (e.g., "Original Code"), shown in its buffer name |
titleB * | string | Descriptive title for the second content (e.g., "Modified Code"), shown in its buffer name |