MCP Server - AI Agent Integration
Lem includes an MCP (Model Context Protocol) server that allows AI agents like Claude Code to interact with the editor. Through this server, AI can read and edit your buffers directly within Lem.
In Lem, run:
M-x mcp-server-start
Press Enter twice to use the default settings (localhost:7890).
In your terminal:
claude mcp add --transport http lem http://localhost:7890/mcp
Now when you use Claude Code, it can directly edit files open in Lem. For example:
- “Edit the function in my current buffer”
- “Add error handling to this code”
- “Refactor this file”
Claude Code will use Lem’s buffers instead of reading/writing files directly.
| Command | Description |
|---|---|
mcp-server-start | Start the server |
mcp-server-stop | Stop the server |
mcp-server-status | Show server status |
mcp-server-restart | Restart the server |
M-x mcp-server-status
This shows the server URL and number of connected sessions.
M-x mcp-server-toggle-logging
View logs in the *mcp-log* buffer with C-x b *mcp-log*.
claude mcp list
The lem server should appear in the list.