@prmichaelsen/acp-mcp 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.0] - 2026-02-22
9
+
10
+ ### Added
11
+ - `acp_remote_execute_command` tool for executing arbitrary shell commands on remote machines
12
+ - `acp_remote_read_file` tool for reading file contents from remote machines
13
+ - `acp_remote_write_file` tool for writing file contents to remote machines
14
+ - Timeout support for command execution (default: 30 seconds)
15
+ - File size limits for read operations (default: 1MB, configurable)
16
+ - Atomic file writes with temp file + rename pattern
17
+ - Optional backup functionality for file writes
18
+ - Optional parent directory creation for file writes
19
+ - Comprehensive error handling for all tools
20
+
21
+ ### Changed
22
+ - All tools now return structured JSON responses for better parsing
23
+ - Enhanced SSHConnectionManager with readFile and writeFile methods
24
+ - Updated README with complete tool documentation
25
+
26
+ ### Technical Details
27
+ - Added `execWithTimeout()` method to SSHConnectionManager
28
+ - Added `readFile()` method with size validation
29
+ - Added `writeFile()` method with atomic writes and backup support
30
+ - All 4 core tools now fully implemented and tested
31
+ - TypeScript compilation successful
32
+ - Build generates proper .d.ts files
33
+
8
34
  ## [0.2.0] - 2026-02-22
9
35
 
10
36
  ### Added
package/README.md CHANGED
@@ -60,6 +60,26 @@ const server = await createServer({
60
60
  - `path` (required): The directory path to list files from
61
61
  - `recursive` (optional): Whether to list files recursively (default: false)
62
62
 
63
+ - **acp_remote_execute_command** - Execute a shell command on the remote machine
64
+ - `command` (required): Shell command to execute
65
+ - `cwd` (optional): Working directory for command execution
66
+ - `timeout` (optional): Timeout in seconds (default: 30)
67
+ - Returns: `{ stdout, stderr, exitCode, timedOut }`
68
+
69
+ - **acp_remote_read_file** - Read file contents from the remote machine
70
+ - `path` (required): Absolute path to file
71
+ - `encoding` (optional): File encoding - utf-8, ascii, or base64 (default: utf-8)
72
+ - `maxSize` (optional): Max file size in bytes (default: 1MB)
73
+ - Returns: `{ content, size, encoding }`
74
+
75
+ - **acp_remote_write_file** - Write file contents to the remote machine
76
+ - `path` (required): Absolute path to file
77
+ - `content` (required): File contents to write
78
+ - `encoding` (optional): File encoding (default: utf-8)
79
+ - `createDirs` (optional): Create parent directories (default: false)
80
+ - `backup` (optional): Backup existing file before overwriting (default: false)
81
+ - Returns: `{ success, bytesWritten, backupPath }`
82
+
63
83
  ## Configuration
64
84
 
65
85
  ### Standalone Server Configuration
@@ -0,0 +1,382 @@
1
+ # Design: ACP MCP Core Tools
2
+
3
+ **Concept**: Core MCP tools for remote machine operations via SSH
4
+ **Created**: 2026-02-22
5
+ **Status**: Design Specification
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This design document specifies the core tools for the acp-mcp server, which provides remote machine access capabilities through SSH. These tools enable users to interact with remote development environments through the agentbase.me platform.
12
+
13
+ ## Problem Statement
14
+
15
+ Users need to perform common development operations on remote machines:
16
+ - Execute arbitrary shell commands
17
+ - Read and write files
18
+ - List directory contents
19
+ - Manage remote development environments
20
+
21
+ Currently, only file listing is implemented. We need a complete set of tools for full remote development capabilities.
22
+
23
+ ## Solution
24
+
25
+ Implement four core tools that cover the essential remote operations:
26
+
27
+ 1. **acp_remote_list_files** (✅ Implemented)
28
+ 2. **acp_remote_execute_command** (🔨 To Implement)
29
+ 3. **acp_remote_read_file** (🔨 To Implement)
30
+ 4. **acp_remote_write_file** (🔨 To Implement)
31
+
32
+ ---
33
+
34
+ ## Tool Specifications
35
+
36
+ ### 1. acp_remote_list_files
37
+
38
+ **Status**: ✅ Implemented (v0.2.0)
39
+
40
+ **Purpose**: List files and directories in a specified path on the remote machine
41
+
42
+ **Input Schema**:
43
+ ```typescript
44
+ {
45
+ path: string; // Required: Directory path to list
46
+ recursive: boolean; // Optional: List recursively (default: false)
47
+ }
48
+ ```
49
+
50
+ **Output**: Newline-separated list of files/directories
51
+ - Directories end with `/`
52
+ - Recursive listings show relative paths (e.g., `subdir/file.txt`)
53
+ - Sorted alphabetically
54
+
55
+ **Implementation**: Uses SSH SFTP to list directory contents
56
+
57
+ **Example**:
58
+ ```
59
+ Input: { path: "/home/user/project", recursive: false }
60
+ Output:
61
+ src/
62
+ package.json
63
+ README.md
64
+ tsconfig.json
65
+ ```
66
+
67
+ ---
68
+
69
+ ### 2. acp_remote_execute_command
70
+
71
+ **Status**: 🔨 To Implement
72
+
73
+ **Purpose**: Execute arbitrary shell commands on the remote machine
74
+
75
+ **Input Schema**:
76
+ ```typescript
77
+ {
78
+ command: string; // Required: Shell command to execute
79
+ cwd?: string; // Optional: Working directory (default: home directory)
80
+ timeout?: number; // Optional: Timeout in seconds (default: 30)
81
+ }
82
+ ```
83
+
84
+ **Output**:
85
+ ```typescript
86
+ {
87
+ stdout: string; // Standard output
88
+ stderr: string; // Standard error
89
+ exitCode: number; // Exit code (0 = success)
90
+ timedOut: boolean; // Whether command timed out
91
+ }
92
+ ```
93
+
94
+ **Implementation Details**:
95
+ - Use `SSHConnectionManager.exec()` method
96
+ - Set timeout to prevent hanging
97
+ - Capture both stdout and stderr
98
+ - Return exit code for error handling
99
+ - Support working directory changes
100
+
101
+ **Security Considerations**:
102
+ - Commands run with SSH user's permissions
103
+ - No shell injection protection needed (SSH handles this)
104
+ - Timeout prevents resource exhaustion
105
+ - Consider rate limiting in production
106
+
107
+ **Example**:
108
+ ```
109
+ Input: { command: "git status", cwd: "/home/user/project" }
110
+ Output: {
111
+ stdout: "On branch main\nnothing to commit, working tree clean",
112
+ stderr: "",
113
+ exitCode: 0,
114
+ timedOut: false
115
+ }
116
+ ```
117
+
118
+ **Use Cases**:
119
+ - `git status`, `git commit`, `git push`
120
+ - `npm install`, `npm run build`
121
+ - `ls -la`, `pwd`, `whoami`
122
+ - Any shell command the user needs
123
+
124
+ ---
125
+
126
+ ### 3. acp_remote_read_file
127
+
128
+ **Status**: 🔨 To Implement
129
+
130
+ **Purpose**: Read file contents from the remote machine
131
+
132
+ **Input Schema**:
133
+ ```typescript
134
+ {
135
+ path: string; // Required: Absolute path to file
136
+ encoding?: string; // Optional: File encoding (default: 'utf-8')
137
+ maxSize?: number; // Optional: Max file size in bytes (default: 1MB)
138
+ }
139
+ ```
140
+
141
+ **Output**:
142
+ ```typescript
143
+ {
144
+ content: string; // File contents
145
+ size: number; // File size in bytes
146
+ encoding: string; // Encoding used
147
+ }
148
+ ```
149
+
150
+ **Implementation Details**:
151
+ - Use SSH SFTP to read file
152
+ - Check file size before reading (prevent memory issues)
153
+ - Support different encodings (utf-8, ascii, base64)
154
+ - Return error if file doesn't exist or is too large
155
+ - Stream large files if needed
156
+
157
+ **Security Considerations**:
158
+ - Limit max file size (default 1MB, configurable)
159
+ - Only read files user has permission to access
160
+ - Don't read binary files as text (check extension or use base64)
161
+
162
+ **Error Handling**:
163
+ - File not found → Clear error message
164
+ - Permission denied → Clear error message
165
+ - File too large → Suggest using execute_command with `head` or `tail`
166
+
167
+ **Example**:
168
+ ```
169
+ Input: { path: "/home/user/project/package.json" }
170
+ Output: {
171
+ content: "{\n \"name\": \"my-project\",\n \"version\": \"1.0.0\"\n}",
172
+ size: 58,
173
+ encoding: "utf-8"
174
+ }
175
+ ```
176
+
177
+ ---
178
+
179
+ ### 4. acp_remote_write_file
180
+
181
+ **Status**: 🔨 To Implement
182
+
183
+ **Purpose**: Write file contents to the remote machine
184
+
185
+ **Input Schema**:
186
+ ```typescript
187
+ {
188
+ path: string; // Required: Absolute path to file
189
+ content: string; // Required: File contents to write
190
+ encoding?: string; // Optional: File encoding (default: 'utf-8')
191
+ createDirs?: boolean; // Optional: Create parent directories (default: false)
192
+ backup?: boolean; // Optional: Backup existing file (default: false)
193
+ }
194
+ ```
195
+
196
+ **Output**:
197
+ ```typescript
198
+ {
199
+ success: boolean; // Whether write succeeded
200
+ bytesWritten: number; // Number of bytes written
201
+ backupPath?: string; // Path to backup file (if created)
202
+ }
203
+ ```
204
+
205
+ **Implementation Details**:
206
+ - Use SSH SFTP to write file
207
+ - Optionally create parent directories (mkdir -p)
208
+ - Optionally backup existing file before overwriting
209
+ - Support different encodings
210
+ - Atomic write (write to temp file, then rename)
211
+
212
+ **Security Considerations**:
213
+ - Only write files user has permission to write
214
+ - Validate path (no directory traversal attacks)
215
+ - Limit file size (prevent disk exhaustion)
216
+ - Consider rate limiting writes
217
+
218
+ **Error Handling**:
219
+ - Permission denied → Clear error message
220
+ - Directory doesn't exist → Suggest using createDirs: true
221
+ - Disk full → Clear error message
222
+
223
+ **Example**:
224
+ ```
225
+ Input: {
226
+ path: "/home/user/project/.env",
227
+ content: "API_KEY=secret\nDEBUG=true",
228
+ backup: true
229
+ }
230
+ Output: {
231
+ success: true,
232
+ bytesWritten: 28,
233
+ backupPath: "/home/user/project/.env.backup"
234
+ }
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Implementation Plan
240
+
241
+ ### Phase 1: Execute Command (Highest Priority)
242
+ - Most versatile tool
243
+ - Enables git operations, npm commands, etc.
244
+ - Unblocks many use cases
245
+
246
+ ### Phase 2: Read File
247
+ - Essential for viewing remote files
248
+ - Needed for code review, debugging
249
+
250
+ ### Phase 3: Write File
251
+ - Completes CRUD operations
252
+ - Enables remote file editing
253
+
254
+ ---
255
+
256
+ ## Technical Architecture
257
+
258
+ ### SSH Connection Management
259
+
260
+ All tools use the existing `SSHConnectionManager`:
261
+
262
+ ```typescript
263
+ class SSHConnectionManager {
264
+ async exec(command: string): Promise<string>
265
+ async getSFTP(): Promise<SFTPWrapper>
266
+ async listFiles(path: string): Promise<FileEntry[]>
267
+ // Add new methods as needed
268
+ }
269
+ ```
270
+
271
+ ### Tool Registration
272
+
273
+ Tools are registered in `server.ts` and `server-factory.ts`:
274
+
275
+ ```typescript
276
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
277
+ tools: [
278
+ acpRemoteListFilesTool,
279
+ acpRemoteExecuteCommandTool,
280
+ acpRemoteReadFileTool,
281
+ acpRemoteWriteFileTool,
282
+ ],
283
+ }));
284
+
285
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
286
+ switch (request.params.name) {
287
+ case 'acp_remote_list_files':
288
+ return await handleAcpRemoteListFiles(args, sshConnection);
289
+ case 'acp_remote_execute_command':
290
+ return await handleAcpRemoteExecuteCommand(args, sshConnection);
291
+ case 'acp_remote_read_file':
292
+ return await handleAcpRemoteReadFile(args, sshConnection);
293
+ case 'acp_remote_write_file':
294
+ return await handleAcpRemoteWriteFile(args, sshConnection);
295
+ default:
296
+ throw new Error(`Unknown tool: ${request.params.name}`);
297
+ }
298
+ });
299
+ ```
300
+
301
+ ### File Organization
302
+
303
+ ```
304
+ src/tools/
305
+ ├── acp-remote-list-files.ts (✅ Exists)
306
+ ├── acp-remote-execute-command.ts (🔨 Create)
307
+ ├── acp-remote-read-file.ts (🔨 Create)
308
+ └── acp-remote-write-file.ts (🔨 Create)
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Benefits
314
+
315
+ 1. **Complete Remote Operations**: Users can perform all essential file and command operations
316
+ 2. **Flexible**: Execute command enables any shell operation
317
+ 3. **Safe**: Proper error handling and security considerations
318
+ 4. **Consistent**: All tools follow same patterns and conventions
319
+ 5. **Well-Documented**: Clear input/output schemas and examples
320
+
321
+ ---
322
+
323
+ ## Trade-offs
324
+
325
+ ### Execute Command vs Specialized Tools
326
+
327
+ **Decision**: Use `execute_command` for git operations instead of specialized git tools
328
+
329
+ **Rationale**:
330
+ - More flexible (handles any git command)
331
+ - Fewer tools to maintain
332
+ - Users may need other commands beyond git
333
+ - Simpler architecture
334
+
335
+ **Trade-off**: Less type safety for git operations, but more flexibility
336
+
337
+ ### File Size Limits
338
+
339
+ **Decision**: Limit file read/write to 1MB by default
340
+
341
+ **Rationale**:
342
+ - Prevents memory exhaustion
343
+ - Most source files are < 1MB
344
+ - Large files can use execute_command with streaming tools
345
+
346
+ **Trade-off**: Can't directly read/write very large files, but this is acceptable for typical use cases
347
+
348
+ ---
349
+
350
+ ## Future Enhancements
351
+
352
+ 1. **File Upload/Download**: Binary file transfer
353
+ 2. **Directory Operations**: Create, delete, move directories
354
+ 3. **File Permissions**: chmod, chown operations
355
+ 4. **Process Management**: Start/stop long-running processes
356
+ 5. **Port Forwarding**: Tunnel connections through SSH
357
+ 6. **SFTP Batch Operations**: Multiple file operations in one call
358
+
359
+ ---
360
+
361
+ ## Testing Strategy
362
+
363
+ ### Unit Tests
364
+ - Mock SSH connections
365
+ - Test each tool handler independently
366
+ - Test error conditions
367
+
368
+ ### Integration Tests
369
+ - Test against real SSH server
370
+ - Verify file operations work correctly
371
+ - Test timeout handling
372
+ - Test permission errors
373
+
374
+ ### End-to-End Tests
375
+ - Test through mcp-auth wrapper
376
+ - Test with agentbase.me platform
377
+ - Verify JWT authentication flow
378
+
379
+ ---
380
+
381
+ **Status**: Design Specification
382
+ **Recommendation**: Implement tools in order: execute_command → read_file → write_file
@@ -0,0 +1,50 @@
1
+ # Milestone 1: Core Tools Implementation
2
+
3
+ **Goal**: Implement the remaining core MCP tools for remote machine operations
4
+ **Duration**: 1-2 weeks
5
+ **Dependencies**: None (foundation already complete)
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ Complete the implementation of core acp-mcp tools to enable full remote development capabilities. The SSH infrastructure and first tool (`acp_remote_list_files`) are already implemented. This milestone focuses on adding the three remaining essential tools.
13
+
14
+ ## Deliverables
15
+
16
+ - ✅ `acp_remote_list_files` - Already implemented
17
+ - 🔨 `acp_remote_execute_command` - Execute shell commands remotely
18
+ - 🔨 `acp_remote_read_file` - Read file contents from remote machine
19
+ - 🔨 `acp_remote_write_file` - Write file contents to remote machine
20
+
21
+ ## Success Criteria
22
+
23
+ - [ ] All four core tools implemented and tested
24
+ - [ ] TypeScript compiles without errors
25
+ - [ ] Build completes successfully
26
+ - [ ] Tools work correctly with SSH connections
27
+ - [ ] Error handling implemented for all tools
28
+ - [ ] Documentation updated (README, CHANGELOG)
29
+ - [ ] Version bumped to 0.3.0
30
+ - [ ] Ready for deployment with mcp-auth wrapper
31
+
32
+ ## Key Files to Create
33
+
34
+ - `src/tools/acp-remote-execute-command.ts`
35
+ - `src/tools/acp-remote-read-file.ts`
36
+ - `src/tools/acp-remote-write-file.ts`
37
+
38
+ ## Key Files to Modify
39
+
40
+ - `src/server.ts` - Register new tools
41
+ - `src/server-factory.ts` - Register new tools
42
+ - `src/utils/ssh-connection.ts` - Add helper methods if needed
43
+ - `README.md` - Document new tools
44
+ - `CHANGELOG.md` - Document changes
45
+ - `package.json` - Version bump
46
+
47
+ ---
48
+
49
+ **Next Milestone**: Deployment and Integration (M2)
50
+ **Blockers**: None
@@ -1,33 +1,104 @@
1
1
  project:
2
2
  name: acp-mcp
3
- version: 0.1.0
3
+ version: 0.3.0
4
4
  started: 2026-02-22
5
5
  status: in_progress
6
+ current_milestone: M1
6
7
  description: |
7
- Support remote machine development using ACP methodology
8
+ MCP server for remote machine operations via SSH.
9
+ Provides core tools for executing commands, reading/writing files,
10
+ and listing directories on remote development environments.
8
11
 
9
- milestones: []
12
+ milestones:
13
+ - id: M1
14
+ name: Core Tools Implementation
15
+ status: in_progress
16
+ progress: 100%
17
+ started: 2026-02-22
18
+ completed: 2026-02-22
19
+ estimated_weeks: 1-2
20
+ tasks_completed: 3
21
+ tasks_total: 3
22
+ notes: |
23
+ SSH infrastructure and first tool (acp_remote_list_files) complete.
24
+ Three remaining tools to implement: execute_command, read_file, write_file.
10
25
 
11
- tasks: {}
26
+ tasks:
27
+ milestone_1:
28
+ - id: task-1
29
+ name: Implement acp_remote_execute_command Tool
30
+ status: completed
31
+ file: agent/tasks/milestone-1-core-tools-implementation/task-1-implement-acp-remote-execute-command.md
32
+ estimated_hours: 3-4
33
+ actual_hours: null
34
+ completed_date: 2026-02-22
35
+ priority: high
36
+ notes: |
37
+ Most versatile tool - enables git, npm, and any CLI operations.
38
+ Completed with timeout support and proper error handling.
39
+
40
+ - id: task-2
41
+ name: Implement acp_remote_read_file Tool
42
+ status: completed
43
+ file: agent/tasks/milestone-1-core-tools-implementation/task-2-implement-acp-remote-read-file.md
44
+ estimated_hours: 2-3
45
+ actual_hours: null
46
+ completed_date: 2026-02-22
47
+ priority: medium
48
+ notes: |
49
+ Essential for viewing remote files and debugging.
50
+ Completed with file size limits and encoding support.
51
+
52
+ - id: task-3
53
+ name: Implement acp_remote_write_file Tool
54
+ status: completed
55
+ file: agent/tasks/milestone-1-core-tools-implementation/task-3-implement-acp-remote-write-file.md
56
+ estimated_hours: 3-4
57
+ actual_hours: null
58
+ completed_date: 2026-02-22
59
+ priority: medium
60
+ notes: |
61
+ Completes CRUD operations for remote file management.
62
+ Completed with atomic writes, backup, and createDirs support.
12
63
 
13
64
  documentation:
14
- design_documents: 0
15
- milestone_documents: 0
65
+ design_documents: 1
66
+ milestone_documents: 1
16
67
  pattern_documents: 0
17
- task_documents: 0
68
+ task_documents: 3
18
69
 
19
70
  progress:
20
- planning: 0
21
- implementation: 0
22
- overall: 0
71
+ planning: 100%
72
+ implementation: 100%
73
+ overall: 100%
23
74
 
24
- recent_work: []
75
+ recent_work:
76
+ - date: 2026-02-22
77
+ description: Initial project setup and SSH infrastructure
78
+ items:
79
+ - ✅ Created MCP server scaffold with TypeScript and esbuild
80
+ - ✅ Integrated ssh2 library for SSH connectivity
81
+ - ✅ Implemented SSHConnectionManager utility class
82
+ - ✅ Implemented acp_remote_list_files tool (first core tool)
83
+ - ✅ Added TypeScript declaration file generation
84
+ - ✅ Created comprehensive design document for all core tools
85
+ - ✅ Planned milestone and tasks for remaining implementation
86
+ - ✅ Implemented acp_remote_execute_command tool with timeout support
87
+ - ✅ Implemented acp_remote_read_file tool with size limits
88
+ - ✅ Implemented acp_remote_write_file tool with atomic writes
89
+ - ✅ All 4 core tools complete
90
+ - 📋 Milestone 1 complete - ready for v0.3.0
25
91
 
26
92
  next_steps:
27
- - Define project requirements in agent/design/requirements.md
28
- - Plan milestones and tasks with @acp.plan
29
- - Start development with @acp.proceed
93
+ - Update CHANGELOG.md for v0.3.0 release
94
+ - Commit all changes with version bump
95
+ - Deploy with mcp-auth wrapper for agentbase.me integration
96
+ - Test end-to-end with agentbase.me platform
30
97
 
31
- notes: []
98
+ notes:
99
+ - Project designed for Task 128 (ACP Remote Development Integration)
100
+ - Will be wrapped by /home/prmichaelsen/mcp-auth for JWT authentication
101
+ - Consumed by agentbase.me platform for remote development features
102
+ - SSH credentials provided by mcp-auth wrapper from user configuration
32
103
 
33
104
  current_blockers: []