Skip to content

Commit ea4f7a9

Browse files
cxxxrclaude
authored andcommitted
Simplify MCP Server documentation
Focus on practical usage with Claude Code integration. Remove technical details (protocol specs, tool lists, security notes). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 67ba8ea commit ea4f7a9

2 files changed

Lines changed: 56 additions & 268 deletions

File tree

content/en/usage/mcp-server.md

Lines changed: 28 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -3,175 +3,69 @@ title: MCP Server - AI Agent Integration
33
weight: 26
44
---
55

6-
Lem includes an MCP (Model Context Protocol) server that allows AI agents like Claude Code to interact with the editor. Through this server, AI tools can read and edit buffers, execute commands, and access resources.
6+
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.
77

8-
## Overview
8+
## Using with Claude Code
99

10-
The MCP server exposes Lem's functionality via HTTP endpoints using the JSON-RPC protocol. This enables:
10+
### 1. Start the MCP Server
1111

12-
- **Buffer operations**: Create, read, edit, and delete buffers
13-
- **Text editing**: Insert, replace, and delete text at specific positions
14-
- **Command execution**: Run any Lem command programmatically
15-
- **Resource access**: Read files and buffer contents
16-
17-
## Getting Started
18-
19-
### Starting the Server
20-
21-
Start the MCP server in Lem:
12+
In Lem, run:
2213

2314
```
2415
M-x mcp-server-start
2516
```
2617

27-
You'll be prompted for hostname and port. Press Enter to use defaults:
28-
- **Hostname**: 127.0.0.1
29-
- **Port**: 7890
18+
Press Enter twice to use the default settings (localhost:7890).
3019

31-
### Registering with Claude Code
20+
### 2. Register with Claude Code
3221

33-
After starting the server, register it with Claude Code:
22+
In your terminal:
3423

3524
```bash
3625
claude mcp add --transport http lem http://localhost:7890/mcp
3726
```
3827

39-
Verify the connection:
28+
### 3. Start Using
4029

41-
```bash
42-
claude mcp list
43-
```
30+
Now when you use Claude Code, it can directly edit files open in Lem. For example:
4431

45-
### Testing the Connection
32+
- "Edit the function in my current buffer"
33+
- "Add error handling to this code"
34+
- "Refactor this file"
4635

47-
You can test the server with curl:
48-
49-
```bash
50-
curl -X POST http://localhost:7890/mcp \
51-
-H "Content-Type: application/json" \
52-
-H "Mcp-Protocol-Version: 2024-11-05" \
53-
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
54-
```
36+
Claude Code will use Lem's buffers instead of reading/writing files directly.
5537

5638
## Server Commands
5739

5840
| Command | Description |
5941
|---------|-------------|
60-
| `mcp-server-start` | Start the MCP server |
61-
| `mcp-server-stop` | Stop the running server |
62-
| `mcp-server-status` | Show server URL and active sessions |
63-
| `mcp-server-restart` | Restart with new configuration |
64-
| `mcp-server-toggle-logging` | Toggle debug logging to `*mcp-log*` buffer |
65-
66-
## Available Tools
67-
68-
### Buffer Operations
69-
70-
| Tool | Description |
71-
|------|-------------|
72-
| `buffer_list` | Get list of all buffers |
73-
| `buffer_get_content` | Get buffer content (with optional line range) |
74-
| `buffer_create` | Create new buffer with optional initial content |
75-
| `buffer_delete` | Delete a buffer |
76-
| `buffer_info` | Get buffer info (name, filename, line count, cursor) |
77-
78-
### Editing Operations
79-
80-
| Tool | Description |
81-
|------|-------------|
82-
| `buffer_insert` | Insert text at position (line, column) |
83-
| `buffer_replace` | Replace text in region |
84-
| `buffer_delete_region` | Delete text in region |
85-
| `buffer_set_content` | Replace entire buffer content |
86-
| `buffer_save` | Save buffer to file |
87-
88-
### Command Operations
89-
90-
| Tool | Description |
91-
|------|-------------|
92-
| `command_list` | List available commands (with optional prefix filter) |
93-
| `command_execute` | Execute a command with arguments |
94-
| `command_info` | Get command information |
95-
| `eval_expression` | Evaluate Lisp expression |
96-
97-
## Use Cases
98-
99-
### AI-Assisted Coding with Claude Code
100-
101-
Once connected, Claude Code can directly edit your code in Lem:
102-
103-
1. Start Lem and the MCP server
104-
2. Register the server with Claude Code
105-
3. Ask Claude to edit files - it will use Lem's buffers directly
106-
107-
### Remote Editor Control
42+
| `mcp-server-start` | Start the server |
43+
| `mcp-server-stop` | Stop the server |
44+
| `mcp-server-status` | Show server status |
45+
| `mcp-server-restart` | Restart the server |
10846

109-
The MCP server enables remote control of Lem for:
110-
- Automation scripts
111-
- IDE integrations
112-
- Custom tooling
47+
## Troubleshooting
11348

114-
### Collaborative Editing
115-
116-
Multiple AI agents or tools can connect to the same Lem instance, enabling collaborative workflows.
117-
118-
## Configuration
119-
120-
### Custom Port
121-
122-
Start the server on a different port:
123-
124-
```
125-
M-x mcp-server-start
126-
Hostname: 127.0.0.1
127-
Port: 8080
128-
```
129-
130-
### Listen on All Interfaces
131-
132-
To allow remote connections (use with caution):
49+
### Check Server Status
13350

13451
```
135-
M-x mcp-server-start
136-
Hostname: 0.0.0.0
137-
Port: 7890
52+
M-x mcp-server-status
13853
```
13954

140-
### Debugging
55+
This shows the server URL and number of connected sessions.
14156

142-
Enable logging to see MCP requests and responses:
57+
### Enable Debug Logging
14358

14459
```
14560
M-x mcp-server-toggle-logging
14661
```
14762

148-
View logs in the `*mcp-log*` buffer.
149-
150-
## Protocol Details
151-
152-
The server implements **MCP 2024-11-05** specification:
153-
154-
- **Transport**: HTTP with JSON-RPC 2.0
155-
- **Server Name**: lem-mcp-server
156-
- **Server Version**: 0.1.0
157-
158-
### Supported Methods
63+
View logs in the `*mcp-log*` buffer with `C-x b *mcp-log*`.
15964

160-
**Lifecycle**:
161-
- `initialize` / `notifications/initialized`
162-
- `shutdown` / `exit`
163-
- `ping`
65+
### Verify Claude Code Connection
16466

165-
**Tools**:
166-
- `tools/list`
167-
- `tools/call`
168-
169-
**Resources**:
170-
- `resources/list`
171-
- `resources/read`
172-
173-
## Security Considerations
67+
```bash
68+
claude mcp list
69+
```
17470

175-
- By default, the server only listens on localhost (127.0.0.1)
176-
- No authentication is required - ensure your firewall is configured appropriately
177-
- Avoid exposing the server to untrusted networks
71+
The `lem` server should appear in the list.

0 commit comments

Comments
 (0)