{"_id":"@bimawa/emacsclient-mcp","name":"@bimawa/emacsclient-mcp","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bimawa/emacsclient-mcp","version":"1.0.0","description":"Emacs MCP server for Pi — 22 Emacs tools for LLM-assisted editing, search, buffer management, and PR review","keywords":["pi-package","emacs","mcp","model-context-protocol","llm","code-review"],"repository":{"type":"git","url":"git+https://github.com/bimawa/emacsclient-mcp.git"},"license":"MIT","pi":{"extensions":["./extension/index.ts"],"image":"https://raw.githubusercontent.com/bimawa/emacsclient-mcp/main/docs/preview.png"},"dependencies":{"typebox":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_id":"@bimawa/emacsclient-mcp@1.0.0","bugs":{"url":"https://github.com/bimawa/emacsclient-mcp/issues"},"homepage":"https://github.com/bimawa/emacsclient-mcp#readme","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-dJRwoRB5U16kGfTrKeuCFHDDP9f4oCjvTFmgFHQQC8bAnWVbnzuwN/D8fYrg5+dFtRQfeKMpOqodusR9Q+avrw==","shasum":"66f67d0b4a481b2387263f60ba3befc25aaf86b7","tarball":"https://registry.npmjs.org/@bimawa/emacsclient-mcp/-/emacsclient-mcp-1.0.0.tgz","fileCount":38,"unpackedSize":14070445,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFkzIJPMr1qRHmN9JdxvLyz5488+pKV732vrI29nJcUFAiEArjvlTM5w/P7DXvDWiPOmkNmh1sRnQHUATG/ZR+xzwQo="}]},"_npmUser":{"name":"bimawa","email":"bimawa@gmail.com"},"directories":{},"maintainers":[{"name":"bimawa","email":"bimawa@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emacsclient-mcp_1.0.0_1783981870518_0.5987688005419811"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-13T22:31:10.303Z","1.0.0":"2026-07-13T22:31:10.905Z","modified":"2026-07-13T22:31:11.151Z"},"maintainers":[{"name":"bimawa","email":"bimawa@gmail.com"}],"description":"Emacs MCP server for Pi — 22 Emacs tools for LLM-assisted editing, search, buffer management, and PR review","homepage":"https://github.com/bimawa/emacsclient-mcp#readme","keywords":["pi-package","emacs","mcp","model-context-protocol","llm","code-review"],"repository":{"type":"git","url":"git+https://github.com/bimawa/emacsclient-mcp.git"},"bugs":{"url":"https://github.com/bimawa/emacsclient-mcp/issues"},"license":"MIT","readme":"# emacsclient-mcp\n\n> Emacs MCP server + Pi extension — 22 Emacs tools for LLM-assisted editing, search, buffer management, and PR review.\n\n[![Crates.io](https://img.shields.io/crates/v/emacsclient-mcp)](https://crates.io/crates/emacsclient-mcp)\n[![npm](https://img.shields.io/npm/v/@bimawa/emacsclient-mcp)](https://www.npmjs.com/package/@bimawa/emacsclient-mcp)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n## What is this?\n\nA 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`.\n\nComes with:\n- **Rust MCP binary** — 22 tools over JSON-RPC stdio\n- **Pi extension** — auto-spawns the binary, registers all tools\n- **PR review agent** — 4-phase workflow (Setup → Analysis → Issues → Report)\n\n## Quick Start\n\n### 1. Install\n\n```bash\n# Option A: Pi package (recommended — gets extension + agent)\npi install npm:@bimawa/emacsclient-mcp\n\n# Option B: Rust binary only (for other MCP clients)\ncargo install emacsclient-mcp\n\n# Option C: Homebrew (macOS)\nbrew install bimawa/tap/emacsclient-mcp\n```\n\n### 2. Start Emacs server\n\n```elisp\nM-x server-start\n;; or:\nemacs --daemon\n```\n\n### 3. Reload Pi\n\n```\n/reload\n```\n\nPi picks up the extension, spawns the binary, discovers 22 Emacs tools, and registers the `emacs-pr-review` agent.\n\n## Tools\n\n| Category | Tools |\n|----------|-------|\n| **Eval** | `emacs_eval` — run arbitrary Elisp |\n| **Buffers** | `emacs_list_buffers`, `emacs_create_buffer`, `emacs_set_buffer_content`, `emacs_get_buffer_content`, `emacs_save_buffer`, `emacs_kill_buffer` |\n| **Navigation** | `emacs_find_file`, `emacs_switch_to_buffer`, `emacs_goto_line`, `emacs_get_cursor_position`, `emacs_get_line` |\n| **Search** | `emacs_search`, `emacs_replace` |\n| **Editing** | `emacs_insert_at_point`, `emacs_get_region`, `emacs_set_mark` |\n| **Windows** | `emacs_split_window_right`, `emacs_split_window_below`, `emacs_other_window`, `emacs_delete_other_windows`, `emacs_display_in_other_window` |\n\n## PR Review Agent\n\nActivate with `/agent emacs-pr-review` in Pi. The agent:\n\n1. **Setup** — gets the diff, opens review buffer in `org-mode`, splits Emacs windows\n2. **Analysis** — reads each changed file, applies review heuristics (R1–R4)\n3. **Findings** — documents issues by severity: BLOCKER / CRITICAL / WARNING / SUGGESTION\n4. **Report** — shows summary in Emacs, offers inline comments\n\n## Protocol\n\nImplements the exact Emacs server protocol from `server.el`:\n- **Client sends first** (no server greeting)\n- **Single-line commands**: `-auth KEY -eval EXPR\\n`\n- **`&`-quoting**: spaces → `&_`, newlines → `&n`, leading `-` → `&-`, `&` → `&&`\n- **Response**: `-emacs-pid PID\\n-print RESULT\\n`\n\n## Binary Resolution\n\nThe extension finds the binary in this order:\n1. `EMACS_MCP_BINARY` environment variable\n2. Pre-built binary alongside the extension (package distro)\n3. `~/.cargo/bin/emacsclient-mcp` (cargo install)\n4. `which emacsclient-mcp` (PATH / Homebrew)\n5. `cargo run --release` (dev mode)\n\n## Development\n\n```bash\n# Build the Rust binary\ncargo build --release\n\n# Run locally with Pi\npi -e ./extension/index.ts\n\n# Test the MCP binary directly\necho '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",...}' | ./target/release/emacsclient-mcp\n```\n\n## License\n\nMIT © [bimawa](https://github.com/bimawa)\n","readmeFilename":"README.md","_rev":"1-27832584bfc63bbfd2f88ac1f35aebf4"}