@morphllm/morphmcp 0.8.10 → 0.8.13

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.
Files changed (3) hide show
  1. package/README.md +83 -36
  2. package/dist/index.js +33 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Morph MCP
2
2
 
3
- Unified Model Context Protocol (MCP) server providing AI-powered file editing and intelligent code search capabilities.
3
+ Unified Model Context Protocol (MCP) server providing AI-powered file editing and intelligent code search capabilities. Built on Morph's SDK for fast, accurate code operations.
4
4
 
5
5
  ## Features
6
6
 
7
7
  ### AI-Powered Tools
8
- - **Fast Apply (edit_file)** - Morph's lightning-fast code editing at 4500+ tokens/sec with 99.2% accuracy
9
- - **Fast Context Search (fast_context_search)** - AI-powered code search that intelligently explores repositories to find relevant code
8
+ - **Fast Apply (edit_file)** - Morph's lightning-fast code editing at 10,500+ tokens/sec with 98% accuracy
9
+ - **Fast Context Search (fast_context_search)** - AI-powered code search using WarpGrep that intelligently explores repositories to find relevant code
10
10
 
11
11
  ### Filesystem Operations
12
12
  - Read/write files with memory-efficient head/tail operations
@@ -18,8 +18,9 @@ Unified Model Context Protocol (MCP) server providing AI-powered file editing an
18
18
  ### Security & Access Control
19
19
  - Dynamic directory access control via [MCP Roots](https://modelcontextprotocol.io/docs/concepts/roots)
20
20
  - Workspace-aware path resolution
21
- - Automatic workspace detection
21
+ - Automatic workspace detection (enabled by default)
22
22
  - Atomic file operations with temp files for safety
23
+ - Symlink protection and path validation
23
24
 
24
25
  ## Configuration
25
26
 
@@ -28,20 +29,23 @@ Unified Model Context Protocol (MCP) server providing AI-powered file editing an
28
29
  | Variable | Description | Default |
29
30
  |----------|-------------|---------|
30
31
  | `MORPH_API_KEY` | Your Morph API key (required for AI tools) | - |
31
- | `ENABLED_TOOLS` | Comma-separated list of enabled tools, or `all` | `all` |
32
+ | `ENABLED_TOOLS` | Comma-separated list of enabled tools, or `all` | `edit_file,fast_context_search` |
32
33
  | `MORPH_DEBUG` | Enable debug logging for grep agent (`true`/`false`) | `false` |
33
34
  | `ENABLE_WORKSPACE_MODE` | Auto-detect workspace root (`true`/`false`) | `true` |
34
35
  | `WORKSPACE_ROOT` | Override workspace root directory | `$PWD` |
35
36
 
36
37
  ### Tool Configuration
37
38
 
38
- Control which tools are available using `ENABLED_TOOLS`:
39
+ Control which tools are available using `ENABLED_TOOLS`. **By default, only AI-powered tools (`edit_file` and `fast_context_search`) are enabled** to keep the interface clean. Enable additional filesystem tools as needed:
39
40
 
40
41
  ```bash
41
- # Enable all tools (default)
42
+ # Default: Only AI-powered tools
43
+ # (No ENABLED_TOOLS needed - edit_file and fast_context_search are enabled by default)
44
+
45
+ # Enable all tools including filesystem operations
42
46
  ENABLED_TOOLS=all
43
47
 
44
- # Only AI-powered tools
48
+ # Only AI-powered tools (explicit, same as default)
45
49
  ENABLED_TOOLS=edit_file,fast_context_search
46
50
 
47
51
  # Only fast apply
@@ -59,18 +63,28 @@ ENABLED_TOOLS=read_file,write_file,edit_file,fast_context_search
59
63
  ### AI-Powered Tools
60
64
 
61
65
  #### `edit_file`
62
- **PRIMARY TOOL FOR EDITING FILES** - Efficiently edit existing files by smartly showing only changed lines. Uses Morph's fast apply model for intelligent code merging.
66
+ **PRIMARY TOOL FOR EDITING FILES** - Efficiently edit existing files by smartly showing only changed lines. Uses Morph's Fast Apply model (via `@morphllm/morphsdk`) for intelligent code merging.
63
67
 
64
68
  **Key features:**
65
- - 4500+ tokens/sec with 99.2% accuracy
69
+ - 10,500+ tokens/sec with 98% accuracy
70
+ - Prevents context pollution by only showing changed lines
66
71
  - Smart context preservation with `// ... existing code ...`
67
72
  - Batch multiple edits to the same file
68
- - Git-style diff output
73
+ - Git-style unified diff output
74
+ - Automatic error reporting to Morph for continuous improvement
69
75
 
70
76
  **Requires:** `MORPH_API_KEY`
71
77
 
78
+ **Note for Cursor users:** If you're using this tool within Cursor, you may need to first use another tool (like `search_replace`) to add exactly one empty newline somewhere in the file before using `edit_file`. This ensures the file is in an editable state.
79
+
72
80
  #### `fast_context_search`
73
- Intelligently search and gather relevant code context from a repository using an AI-powered search agent. Automatically explores the codebase with grep, file reading, and directory analysis.
81
+ Intelligently search and gather relevant code context from a repository using Morph's WarpGrep AI-powered search agent. Automatically explores the codebase with grep, file reading, and directory analysis to find exactly what you need.
82
+
83
+ **Key features:**
84
+ - AI-powered multi-round exploration
85
+ - Returns precise line ranges, not entire files
86
+ - Prevents context pollution by finding only relevant code
87
+ - Formatted XML output with line numbers
74
88
 
75
89
  **Example queries:**
76
90
  - "Where is JWT token validation implemented?"
@@ -80,12 +94,16 @@ Intelligently search and gather relevant code context from a repository using an
80
94
  **Requires:** `MORPH_API_KEY`
81
95
 
82
96
  ### File Operations
83
- - `read_file` - Read complete file contents with optional head/tail
97
+ *Note: These tools are available but disabled by default. Set `ENABLED_TOOLS=all` to enable.*
98
+
99
+ - `read_file` - Read complete file contents with optional head/tail (memory-efficient for large files)
84
100
  - `read_multiple_files` - Read multiple files simultaneously
85
- - `write_file` - Create or overwrite files
101
+ - `write_file` - Create or overwrite files with atomic writes
86
102
  - `tiny_edit_file` - Make small line-based edits with diff output
87
103
 
88
104
  ### Directory Operations
105
+ *Note: These tools are available but disabled by default. Set `ENABLED_TOOLS=all` to enable.*
106
+
89
107
  - `create_directory` - Create directories recursively
90
108
  - `list_directory` - List directory contents
91
109
  - `list_directory_with_sizes` - List with file sizes and sorting
@@ -93,6 +111,8 @@ Intelligently search and gather relevant code context from a repository using an
93
111
  - `move_file` - Move/rename files and directories
94
112
 
95
113
  ### Search & Info
114
+ *Note: These tools are available but disabled by default. Set `ENABLED_TOOLS=all` to enable.*
115
+
96
116
  - `search_files` - Recursively search with exclude patterns
97
117
  - `get_file_info` - Get detailed file metadata
98
118
  - `list_allowed_directories` - Show accessible directories
@@ -218,7 +238,7 @@ Or manually add to `.vscode/mcp.json`:
218
238
  }
219
239
  ```
220
240
 
221
- **For everything (recommended):**
241
+ **For everything (including all filesystem tools):**
222
242
  ```json
223
243
  {
224
244
  "env": {
@@ -228,6 +248,16 @@ Or manually add to `.vscode/mcp.json`:
228
248
  }
229
249
  ```
230
250
 
251
+ **Default (AI tools only - recommended for most use cases):**
252
+ ```json
253
+ {
254
+ "env": {
255
+ "MORPH_API_KEY": "sk-..."
256
+ // ENABLED_TOOLS defaults to edit_file,fast_context_search
257
+ }
258
+ }
259
+ ```
260
+
231
261
  ### 3. Test Your Setup
232
262
 
233
263
  In your AI assistant, try:
@@ -242,10 +272,11 @@ In your AI assistant, try:
242
272
  Ask AI: "Use the edit_file tool to add error handling to this function"
243
273
 
244
274
  The AI will:
245
- 1. Read the current code
275
+ 1. Read the current code (or use existing context)
246
276
  2. Generate smart edit instructions with "// ... existing code ..."
247
- 3. Apply changes at 4500+ tokens/sec
248
- 4. Show you a git-style diff
277
+ 3. Apply changes at 10,500+ tokens/sec using Morph's Fast Apply
278
+ 4. Show you a git-style unified diff
279
+ 5. Report errors (if any) to Morph for continuous improvement
249
280
  ```
250
281
 
251
282
  ### Fast Context Search
@@ -253,11 +284,13 @@ The AI will:
253
284
  ```
254
285
  Ask AI: "Use fast_context_search to find where JWT tokens are validated"
255
286
 
256
- The agent will:
287
+ The WarpGrep agent will:
257
288
  1. Explore the repository using grep, read, and analyse tools
258
- 2. Find relevant code across multiple files
259
- 3. Return precise line ranges with full context
260
- 4. Display formatted XML output with line numbers
289
+ 2. Perform multi-round intelligent exploration
290
+ 3. Find relevant code across multiple files
291
+ 4. Return precise line ranges with full context (not entire files)
292
+ 5. Display formatted XML output with line numbers
293
+ 6. Show summary of tool calls made during search
261
294
  ```
262
295
 
263
296
  ## Migration Guide
@@ -312,37 +345,49 @@ The agent will:
312
345
  ```
313
346
  morph-mcp/
314
347
  ├── index.ts # Main server & tool registry
315
- ├── grep/ # Fast context search agent
348
+ ├── grep/ # Fast context search agent (WarpGrep)
316
349
  │ ├── agent/ # Multi-round exploration logic
317
350
  │ ├── tools/ # Grep, read, analyse, finish
318
351
  │ └── utils/ # Ripgrep, file finder, logger
319
- ├── morph-client.ts # Morph API integration
320
- └── path-*.ts # Security & validation
352
+ ├── path-utils.ts # Path normalization & Windows/WSL support
353
+ ├── path-validation.ts # Security validation
354
+ ├── roots-utils.ts # MCP Roots protocol handling
355
+ └── @morphllm/morphsdk # Morph SDK integration (Fast Apply & WarpGrep)
321
356
  ```
322
357
 
358
+ ### Dependencies
359
+
360
+ - **@morphllm/morphsdk** (v0.2.22) - Core Fast Apply and WarpGrep functionality
361
+ - **@modelcontextprotocol/sdk** (v1.12.3) - MCP protocol implementation
362
+ - **@vscode/ripgrep** - Fast text search engine
363
+
323
364
  ### Security
324
365
 
325
366
  - Path validation for all filesystem operations
326
- - Atomic file writes with temp files
327
- - Symlink protection
328
- - Dynamic directory access via MCP roots
367
+ - Atomic file writes with temp files and rename operations
368
+ - Symlink protection (resolves symlinks before validation)
369
+ - Dynamic directory access via MCP Roots protocol
370
+ - Workspace-aware path resolution
329
371
  - API key validation at startup
372
+ - Error reporting to Morph API (anonymized, for service improvement)
330
373
 
331
374
  ## Troubleshooting
332
375
 
333
376
  ### Tools Not Showing Up
334
377
 
335
378
  1. Check API key is set: `MORPH_API_KEY=sk-...`
336
- 2. Verify tools are enabled: `ENABLED_TOOLS=all`
337
- 3. Restart your AI assistant completely
338
- 4. Check logs: `tail -f ~/Library/Logs/Claude/mcp*.log`
379
+ 2. **By default, only `edit_file` and `fast_context_search` are enabled.** To enable all filesystem tools, set `ENABLED_TOOLS=all`
380
+ 3. Verify the tool name is in your `ENABLED_TOOLS` list
381
+ 4. Restart your AI assistant completely
382
+ 5. Check logs: `tail -f ~/Library/Logs/Claude/mcp*.log` (Claude Desktop) or check stderr output
339
383
 
340
384
  ### Fast Context Search Not Finding Code
341
385
 
342
- 1. Ensure you're passing the correct repository path
343
- 2. Try more specific queries
386
+ 1. Ensure you're passing the correct repository path (absolute or relative to workspace)
387
+ 2. Try more specific queries - WarpGrep works best with clear, descriptive queries
344
388
  3. Enable debug logging: `MORPH_DEBUG=true`
345
- 4. Check debug logs in `${TMPDIR}/morph-codeseek-debug/`
389
+ 4. Check that `MORPH_API_KEY` is correctly set
390
+ 5. Verify the repository path is within allowed directories (use `list_allowed_directories` tool)
346
391
 
347
392
  ### Permission Errors
348
393
 
@@ -354,10 +399,12 @@ morph-mcp/
354
399
 
355
400
  | Feature | Speed | Accuracy |
356
401
  |---------|-------|----------|
357
- | Fast Apply (edit_file) | 4500+ tok/sec | 99.2% |
358
- | Context Search | 4 rounds, <30s | High relevance |
402
+ | Fast Apply (edit_file) | 10,500+ tok/sec | 98% |
403
+ | Context Search (WarpGrep) | Multi-round, <30s | High relevance |
359
404
  | File Operations | Native speed | 100% |
360
405
 
406
+ **Note:** Performance metrics are based on Morph's production models. Actual performance may vary based on file size, complexity, and network conditions.
407
+
361
408
  ## Support
362
409
 
363
410
  - **Documentation:** [https://docs.morphllm.com](https://docs.morphllm.com)
package/dist/index.js CHANGED
@@ -1105,7 +1105,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1105
1105
  }
1106
1106
  else if (result.terminationReason === "terminated" &&
1107
1107
  result.errors.length > 0) {
1108
- responseText = `Error: ${result.errors.map((e) => e.message).join("; ")}`;
1108
+ const errorMessages = result.errors.map((e) => e.message).join("; ");
1109
+ responseText = `Error: ${errorMessages}`;
1110
+ // Report errors from WarpGrep agent
1111
+ const firstError = result.errors[0];
1112
+ reportMorphError({
1113
+ error_message: errorMessages,
1114
+ error_type: firstError?.constructor?.name || 'WarpGrepError',
1115
+ context: {
1116
+ tool: 'fast_context_search',
1117
+ repo_path: parsed.data.repoPath,
1118
+ query: parsed.data.query,
1119
+ model: 'morph-warp-grep',
1120
+ termination_reason: result.terminationReason,
1121
+ error_count: result.errors.length
1122
+ },
1123
+ stack_trace: firstError?.stack || undefined,
1124
+ source: 'mcp-filesystem'
1125
+ }).catch(() => { }); // Silently ignore reporting failures
1109
1126
  }
1110
1127
  else {
1111
1128
  responseText = `Agent completed but did not call finish tool.`;
@@ -1115,9 +1132,22 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1115
1132
  };
1116
1133
  }
1117
1134
  catch (error) {
1118
- const message = error instanceof Error ? error.message : String(error);
1135
+ const errorMessage = error instanceof Error ? error.message : String(error);
1136
+ // Report error to Morph API (fire-and-forget)
1137
+ reportMorphError({
1138
+ error_message: errorMessage,
1139
+ error_type: error instanceof Error ? error.constructor.name : 'UnknownError',
1140
+ context: {
1141
+ tool: 'fast_context_search',
1142
+ repo_path: parsed.data.repoPath,
1143
+ query: parsed.data.query,
1144
+ model: 'morph-warp-grep'
1145
+ },
1146
+ stack_trace: error instanceof Error ? error.stack : undefined,
1147
+ source: 'mcp-filesystem'
1148
+ }).catch(() => { }); // Silently ignore reporting failures
1119
1149
  return {
1120
- content: [{ type: "text", text: `Error running fast context search: ${message}` }],
1150
+ content: [{ type: "text", text: `Error running fast context search: ${errorMessage}` }],
1121
1151
  isError: true,
1122
1152
  };
1123
1153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.10",
3
+ "version": "0.8.13",
4
4
  "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",