@morphllm/morphmcp 0.8.46 → 0.8.51
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/README.md +63 -270
- package/dist/index.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,121 +1,26 @@
|
|
|
1
1
|
# Morph MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Supercharge your coding agent. One MCP with two specialized tools for faster edits and smarter retrieval.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Tools
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
| Tool | What it does |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| `edit_file` | Apply code changes at 10,500+ tokens/sec with 98% accuracy |
|
|
10
|
+
| `warpgrep_codebase_search` | Sub-agent that runs parallel grep/read operations to find relevant code |
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
- Read/write files with memory-efficient head/tail operations
|
|
12
|
-
- Create/list/delete directories with detailed metadata
|
|
13
|
-
- Move files/directories
|
|
14
|
-
- Search files with exclude patterns
|
|
15
|
-
- Get comprehensive file metadata
|
|
12
|
+
Both tools are enabled by default.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
- Dynamic directory access control via [MCP Roots](https://modelcontextprotocol.io/docs/concepts/roots)
|
|
19
|
-
- Workspace-aware path resolution
|
|
20
|
-
- Automatic workspace detection (enabled by default)
|
|
21
|
-
- Atomic file operations with temp files for safety
|
|
22
|
-
- Symlink protection and path validation
|
|
14
|
+
## Quick Start
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Environment Variables
|
|
27
|
-
|
|
28
|
-
| Variable | Description | Default |
|
|
29
|
-
|----------|-------------|---------|
|
|
30
|
-
| `MORPH_API_KEY` | Your Morph API key (required for AI tools) | - |
|
|
31
|
-
| `ENABLED_TOOLS` | Comma-separated list of enabled tools, or `all` | `edit_file` |
|
|
32
|
-
| `ENABLE_WORKSPACE_MODE` | Auto-detect workspace root (`true`/`false`) | `true` |
|
|
33
|
-
| `WORKSPACE_ROOT` | Override workspace root directory | `$PWD` |
|
|
34
|
-
|
|
35
|
-
### Tool Configuration
|
|
36
|
-
|
|
37
|
-
Control which tools are available using `ENABLED_TOOLS`. **By default, only the AI-powered tool (`edit_file`) is enabled** to keep the interface clean. Enable additional filesystem tools as needed:
|
|
16
|
+
### Claude Code
|
|
38
17
|
|
|
39
18
|
```bash
|
|
40
|
-
|
|
41
|
-
# (No ENABLED_TOOLS needed - edit_file is enabled by default)
|
|
42
|
-
|
|
43
|
-
# Enable all tools including filesystem operations
|
|
44
|
-
ENABLED_TOOLS=all
|
|
45
|
-
|
|
46
|
-
# Only fast apply (explicit, same as default)
|
|
47
|
-
ENABLED_TOOLS=edit_file
|
|
48
|
-
|
|
49
|
-
# Custom selection
|
|
50
|
-
ENABLED_TOOLS=read_file,write_file,edit_file
|
|
19
|
+
claude mcp add morph-mcp -e MORPH_API_KEY=sk-xxx -- npx -y @morphllm/morphmcp
|
|
51
20
|
```
|
|
52
21
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### AI-Powered Tools
|
|
56
|
-
|
|
57
|
-
#### `edit_file`
|
|
58
|
-
**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.
|
|
59
|
-
|
|
60
|
-
**Key features:**
|
|
61
|
-
- 10,500+ tokens/sec with 98% accuracy
|
|
62
|
-
- Prevents context pollution by only showing changed lines
|
|
63
|
-
- Smart context preservation with `// ... existing code ...`
|
|
64
|
-
- Batch multiple edits to the same file
|
|
65
|
-
- Git-style unified diff output
|
|
66
|
-
- Automatic error reporting to Morph for continuous improvement
|
|
67
|
-
|
|
68
|
-
**Requires:** `MORPH_API_KEY`
|
|
69
|
-
|
|
70
|
-
**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.
|
|
71
|
-
|
|
72
|
-
### File Operations
|
|
73
|
-
*Note: These tools are available but disabled by default. Set `ENABLED_TOOLS=all` to enable.*
|
|
74
|
-
|
|
75
|
-
- `read_file` - Read complete file contents with optional head/tail (memory-efficient for large files)
|
|
76
|
-
- `read_multiple_files` - Read multiple files simultaneously
|
|
77
|
-
- `write_file` - Create or overwrite files with atomic writes
|
|
78
|
-
- `tiny_edit_file` - Make small line-based edits with diff output
|
|
79
|
-
|
|
80
|
-
### Directory Operations
|
|
81
|
-
*Note: These tools are available but disabled by default. Set `ENABLED_TOOLS=all` to enable.*
|
|
82
|
-
|
|
83
|
-
- `create_directory` - Create directories recursively
|
|
84
|
-
- `list_directory` - List directory contents
|
|
85
|
-
- `list_directory_with_sizes` - List with file sizes and sorting
|
|
86
|
-
- `directory_tree` - Get recursive JSON tree structure
|
|
87
|
-
- `move_file` - Move/rename files and directories
|
|
88
|
-
|
|
89
|
-
### Search & Info
|
|
90
|
-
*Note: These tools are available but disabled by default. Set `ENABLED_TOOLS=all` to enable.*
|
|
91
|
-
|
|
92
|
-
- `search_files` - Recursively search with exclude patterns
|
|
93
|
-
- `get_file_info` - Get detailed file metadata
|
|
94
|
-
- `list_allowed_directories` - Show accessible directories
|
|
95
|
-
|
|
96
|
-
## Installation
|
|
97
|
-
|
|
98
|
-
### Quick Start (NPX - Recommended)
|
|
99
|
-
|
|
100
|
-
#### For Claude Desktop
|
|
101
|
-
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
102
|
-
|
|
103
|
-
```json
|
|
104
|
-
{
|
|
105
|
-
"mcpServers": {
|
|
106
|
-
"morph-mcp": {
|
|
107
|
-
"command": "npx",
|
|
108
|
-
"args": ["-y", "morph-mcp"],
|
|
109
|
-
"env": {
|
|
110
|
-
"MORPH_API_KEY": "sk-your-morph-api-key-here",
|
|
111
|
-
"ENABLED_TOOLS": "all"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
22
|
+
### Cursor
|
|
117
23
|
|
|
118
|
-
#### For Cursor
|
|
119
24
|
Add to `.cursor/mcp.json`:
|
|
120
25
|
|
|
121
26
|
```json
|
|
@@ -123,36 +28,10 @@ Add to `.cursor/mcp.json`:
|
|
|
123
28
|
"mcpServers": {
|
|
124
29
|
"morph-mcp": {
|
|
125
30
|
"command": "npx",
|
|
126
|
-
"args": ["-y", "
|
|
127
|
-
"env": {
|
|
128
|
-
"MORPH_API_KEY": "sk-your-morph-api-key-here",
|
|
129
|
-
"ENABLED_TOOLS": "all"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
One-liner installation:
|
|
137
|
-
```bash
|
|
138
|
-
claude mcp add morph-mcp -e MORPH_API_KEY=sk-your-morph-api-key-here -e ENABLED_TOOLS=all -- npx morph-mcp
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Docker
|
|
142
|
-
|
|
143
|
-
```json
|
|
144
|
-
{
|
|
145
|
-
"mcpServers": {
|
|
146
|
-
"morph-mcp": {
|
|
147
|
-
"command": "docker",
|
|
148
|
-
"args": [
|
|
149
|
-
"run", "-i", "--rm",
|
|
150
|
-
"--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
|
|
151
|
-
"morph-llm/morph-mcp", "/projects"
|
|
152
|
-
],
|
|
31
|
+
"args": ["-y", "@morphllm/morphmcp"],
|
|
153
32
|
"env": {
|
|
154
|
-
"MORPH_API_KEY": "sk-
|
|
155
|
-
"ENABLED_TOOLS": "
|
|
33
|
+
"MORPH_API_KEY": "sk-xxx",
|
|
34
|
+
"ENABLED_TOOLS": "warpgrep_codebase_search"
|
|
156
35
|
}
|
|
157
36
|
}
|
|
158
37
|
}
|
|
@@ -161,11 +40,7 @@ claude mcp add morph-mcp -e MORPH_API_KEY=sk-your-morph-api-key-here -e ENABLED_
|
|
|
161
40
|
|
|
162
41
|
### VS Code
|
|
163
42
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
[](https://insiders.vscode.dev/redirect/mcp/install?name=morph-mcp&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22morph-mcp%22%2C%22%24%7BworkspaceFolder%7D%22%5D%7D)
|
|
167
|
-
|
|
168
|
-
Or manually add to `.vscode/mcp.json`:
|
|
43
|
+
Add to `.vscode/mcp.json`:
|
|
169
44
|
|
|
170
45
|
```json
|
|
171
46
|
{
|
|
@@ -173,10 +48,10 @@ Or manually add to `.vscode/mcp.json`:
|
|
|
173
48
|
"servers": {
|
|
174
49
|
"morph-mcp": {
|
|
175
50
|
"command": "npx",
|
|
176
|
-
"args": ["-y", "
|
|
51
|
+
"args": ["-y", "@morphllm/morphmcp"],
|
|
177
52
|
"env": {
|
|
178
|
-
"MORPH_API_KEY": "sk-
|
|
179
|
-
"ENABLED_TOOLS": "
|
|
53
|
+
"MORPH_API_KEY": "sk-xxx",
|
|
54
|
+
"ENABLED_TOOLS": "edit_file,warpgrep_codebase_search"
|
|
180
55
|
}
|
|
181
56
|
}
|
|
182
57
|
}
|
|
@@ -184,156 +59,74 @@ Or manually add to `.vscode/mcp.json`:
|
|
|
184
59
|
}
|
|
185
60
|
```
|
|
186
61
|
|
|
187
|
-
##
|
|
62
|
+
## How the Tools Work
|
|
188
63
|
|
|
189
|
-
###
|
|
64
|
+
### edit_file
|
|
190
65
|
|
|
191
|
-
|
|
192
|
-
2. Get your API key from the dashboard
|
|
193
|
-
3. API keys typically start with `sk-` or `morph-`
|
|
66
|
+
Applies code edits using Morph's Fast Apply model. The agent sends partial code with `// ... existing code ...` placeholders, and Fast Apply merges it into the full file.
|
|
194
67
|
|
|
195
|
-
### 2. Choose Your Configuration
|
|
196
|
-
|
|
197
|
-
**For fast editing only:**
|
|
198
|
-
```json
|
|
199
|
-
{
|
|
200
|
-
"env": {
|
|
201
|
-
"MORPH_API_KEY": "sk-...",
|
|
202
|
-
"ENABLED_TOOLS": "edit_file"
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
**For everything (including all filesystem tools):**
|
|
208
|
-
```json
|
|
209
|
-
{
|
|
210
|
-
"env": {
|
|
211
|
-
"MORPH_API_KEY": "sk-...",
|
|
212
|
-
"ENABLED_TOOLS": "all"
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
68
|
```
|
|
69
|
+
Input:
|
|
70
|
+
path: "src/api.ts"
|
|
71
|
+
code_edit: |
|
|
72
|
+
export async function fetchData(endpoint: string) {
|
|
73
|
+
// ... existing code ...
|
|
74
|
+
const response = await fetch(endpoint, {
|
|
75
|
+
headers,
|
|
76
|
+
timeout: 5000 // added timeout
|
|
77
|
+
});
|
|
78
|
+
// ... existing code ...
|
|
79
|
+
}
|
|
80
|
+
instruction: "Add 5 second timeout to fetch call"
|
|
216
81
|
|
|
217
|
-
|
|
218
|
-
```json
|
|
219
|
-
{
|
|
220
|
-
"env": {
|
|
221
|
-
"MORPH_API_KEY": "sk-..."
|
|
222
|
-
// ENABLED_TOOLS defaults to edit_file
|
|
223
|
-
}
|
|
224
|
-
}
|
|
82
|
+
Output: Git-style unified diff showing exactly what changed
|
|
225
83
|
```
|
|
226
84
|
|
|
227
|
-
###
|
|
228
|
-
|
|
229
|
-
In your AI assistant, try:
|
|
230
|
-
- **Edit test:** "Use the edit_file tool to add a comment to the main function"
|
|
231
|
-
|
|
232
|
-
## Usage Examples
|
|
85
|
+
### warpgrep_codebase_search
|
|
233
86
|
|
|
234
|
-
|
|
87
|
+
A search sub-agent that explores your codebase autonomously. Give it a problem and it runs multiple grep/read operations to locate relevant files and line ranges.
|
|
235
88
|
|
|
236
89
|
```
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
1. Read the current code (or use existing context)
|
|
241
|
-
2. Generate smart edit instructions with "// ... existing code ..."
|
|
242
|
-
3. Apply changes at 10,500+ tokens/sec using Morph's Fast Apply
|
|
243
|
-
4. Show you a git-style unified diff
|
|
244
|
-
5. Report errors (if any) to Morph for continuous improvement
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
## Migration Guide
|
|
90
|
+
Input:
|
|
91
|
+
search_string: "Find where authentication tokens are validated"
|
|
92
|
+
repo_path: "/Users/me/project"
|
|
249
93
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
**Old config:**
|
|
253
|
-
```json
|
|
254
|
-
{
|
|
255
|
-
"env": {
|
|
256
|
-
"MORPH_API_KEY": "sk-...",
|
|
257
|
-
"ALL_TOOLS": "false"
|
|
258
|
-
}
|
|
259
|
-
}
|
|
94
|
+
Output: List of files with specific line ranges + actual code content
|
|
260
95
|
```
|
|
261
96
|
|
|
262
|
-
|
|
263
|
-
```json
|
|
264
|
-
{
|
|
265
|
-
"env": {
|
|
266
|
-
"MORPH_API_KEY": "sk-...",
|
|
267
|
-
"ENABLED_TOOLS": "edit_file"
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
## Architecture
|
|
274
|
-
|
|
275
|
-
### Modular Design
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
morph-mcp/
|
|
279
|
-
├── index.ts # Main server & tool registry
|
|
280
|
-
├── path-utils.ts # Path normalization & Windows/WSL support
|
|
281
|
-
├── path-validation.ts # Security validation
|
|
282
|
-
├── roots-utils.ts # MCP Roots protocol handling
|
|
283
|
-
└── @morphllm/morphsdk # Morph SDK integration (Fast Apply)
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Dependencies
|
|
287
|
-
|
|
288
|
-
- **@morphllm/morphsdk** (v0.2.22) - Core Fast Apply functionality
|
|
289
|
-
- **@modelcontextprotocol/sdk** (v1.12.3) - MCP protocol implementation
|
|
290
|
-
- **@vscode/ripgrep** - Fast text search engine
|
|
291
|
-
|
|
292
|
-
### Security
|
|
293
|
-
|
|
294
|
-
- Path validation for all filesystem operations
|
|
295
|
-
- Atomic file writes with temp files and rename operations
|
|
296
|
-
- Symlink protection (resolves symlinks before validation)
|
|
297
|
-
- Dynamic directory access via MCP Roots protocol
|
|
298
|
-
- Workspace-aware path resolution
|
|
299
|
-
- API key validation at startup
|
|
300
|
-
- Error reporting to Morph API (anonymized, for service improvement)
|
|
301
|
-
|
|
302
|
-
## Troubleshooting
|
|
97
|
+
## Configuration
|
|
303
98
|
|
|
304
|
-
|
|
99
|
+
| Variable | Description | Default |
|
|
100
|
+
|----------|-------------|---------|
|
|
101
|
+
| `MORPH_API_KEY` | Your API key from [morphllm.com](https://morphllm.com) | Required |
|
|
102
|
+
| `ENABLED_TOOLS` | Comma-separated list or `all` | `edit_file,warpgrep_codebase_search` |
|
|
305
103
|
|
|
306
|
-
|
|
307
|
-
2. **By default, only `edit_file` is enabled.** To enable all filesystem tools, set `ENABLED_TOOLS=all`
|
|
308
|
-
3. Verify the tool name is in your `ENABLED_TOOLS` list
|
|
309
|
-
4. Restart your AI assistant completely
|
|
310
|
-
5. Check logs: `tail -f ~/Library/Logs/Claude/mcp*.log` (Claude Desktop) or check stderr output
|
|
104
|
+
### Customize enabled tools
|
|
311
105
|
|
|
312
|
-
|
|
106
|
+
```bash
|
|
107
|
+
# Default (both tools)
|
|
108
|
+
ENABLED_TOOLS=edit_file,warpgrep_codebase_search
|
|
313
109
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
3. Pass directory explicitly via command-line args
|
|
110
|
+
# Only fast editing
|
|
111
|
+
ENABLED_TOOLS=edit_file
|
|
317
112
|
|
|
318
|
-
|
|
113
|
+
# Only search
|
|
114
|
+
ENABLED_TOOLS=warpgrep_codebase_search
|
|
115
|
+
```
|
|
319
116
|
|
|
320
|
-
|
|
321
|
-
|---------|-------|----------|
|
|
322
|
-
| Fast Apply (edit_file) | 10,500+ tok/sec | 98% |
|
|
323
|
-
| File Operations | Native speed | 100% |
|
|
117
|
+
## Get an API Key
|
|
324
118
|
|
|
325
|
-
|
|
119
|
+
1. Sign up at [morphllm.com](https://morphllm.com)
|
|
120
|
+
2. Go to dashboard → API Keys
|
|
121
|
+
3. Keys start with `sk-` or `morph-`
|
|
326
122
|
|
|
327
|
-
##
|
|
123
|
+
## Links
|
|
328
124
|
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
- **Issues:** [GitHub Issues](https://github.com/modelcontextprotocol/servers/issues)
|
|
125
|
+
- [Documentation](https://docs.morphllm.com)
|
|
126
|
+
- [MCP Quickstart](https://docs.morphllm.com/mcpquickstart)
|
|
332
127
|
|
|
333
128
|
## License
|
|
334
129
|
|
|
335
|
-
MIT
|
|
336
|
-
|
|
337
|
-
## Credits
|
|
130
|
+
MIT
|
|
338
131
|
|
|
339
|
-
|
|
132
|
+
<!-- Published with npm Trusted Publishing -->
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x4b6731=a0_0x6f80;(function(_0x42f660,_0x24fb6e){const _0x5ab418=a0_0x6f80,_0x197205=_0x42f660();while(!![]){try{const _0x4a325c=-parseInt(_0x5ab418(0x1da))/0x1*(-parseInt(_0x5ab418(0x1d4))/0x2)+parseInt(_0x5ab418(0x14d))/0x3*(-parseInt(_0x5ab418(0x23f))/0x4)+parseInt(_0x5ab418(0x1ce))/0x5+parseInt(_0x5ab418(0x22f))/0x6*(parseInt(_0x5ab418(0x1f6))/0x7)+parseInt(_0x5ab418(0x1d6))/0x8*(-parseInt(_0x5ab418(0x158))/0x9)+-parseInt(_0x5ab418(0x228))/0xa+parseInt(_0x5ab418(0x253))/0xb*(parseInt(_0x5ab418(0x1be))/0xc);if(_0x4a325c===_0x24fb6e)break;else _0x197205['push'](_0x197205['shift']());}catch(_0x5d5416){_0x197205['push'](_0x197205['shift']());}}}(a0_0xcb90,0x50ffd));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0xcb90(){const _0x3acf4b=['mcp-filesystem','ENABLED_TOOLS','role','commitHash','morph-','shift','Morph\x20FastApply\x20failed\x20without\x20error\x20message','morph-v3-fast','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','map','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','exit','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','dryRun','Enabled\x20tools:\x20','Created\x20File','success','error','array','File\x20read\x20error:','setNotificationHandler','mode','all','10356Wefcan','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','<file\x20path=\x22','open','unshift','errors','apply\x20these\x20changes','\x20as\x20allowed\x20directory','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','catch','startsWith','post','Parent\x20directory\x20does\x20not\x20exist:\x20','Bearer\x20','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','986260VorExh','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','created','\x20-\x20','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','newText','2HCzYRT','unknown','1032cTJWPl','toISOString','match','list_directory\x20','187547vaDVKf','floor','requiresApiKey','Preview\x20changes\x20without\x20applying\x20them.','read','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Error\x20running\x20fast\x20context\x20search:\x20','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','connect','Failed\x20to\x20read\x20file:\x20','stack','hex','roots','trimStart','readFile','\x20\x20\x20','mtime','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','assistant','oninitialized','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','normalize','ENABLE_WORKSPACE_MODE','listRoots','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','Rules:\x0a','cwd','22323okZyaQ','pow','safeParse','split','instruction','describe','-\x20Read\x20file\x20`','modified','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','file','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Text\x20to\x20replace\x20with','finish','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','rerankScore','Max\x20results\x20to\x20return','UnknownError','sk-','toString','slice','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','\x20(new\x20file)','files','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','Workspace\x20mode\x20enabled:\x20Using\x20','warpgrep_codebase_search','morph-warp-grep-v1-1111v0','.tmp','isDirectory','</file>','pyproject.toml','runWarpGrep_call','push','For\x20deletions:\x0a','name','codebase_search','unknown\x20error','isFile','substring','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','Invalid\x20arguments:\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','composer.json','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','some','homedir','\x27\x20in\x20`','5036550djqRZa','**/','Fatal\x20error\x20running\x20server:','object','description','MORPH_API_KEY','-\x20Grepped\x20\x27','816kOXgOT','morph-mcp','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','readdir','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','lines','searchTimeMs','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','content','Could\x20not\x20find\x20exact\x20match\x20for\x20edit:\x0a','Cargo.toml','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','realpath','41656wZuWkI','search_string','package.json','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','If\x20provided,\x20returns\x20only\x20the\x20last\x20N\x20lines\x20of\x20the\x20file','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','stringify','Benefits:\x0a','code_edit','terminationReason','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Morph\x20Edit\x20','data','Successfully\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','log','messages','filepath','🔍\x20Morph\x20Edit\x20Preview','2134xgNegD','timed\x20out','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','replace','0\x20B','dirname','optional','branch','default','close','15iEkYgB','limit','Found\x20','access','every','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','completed_with_file_errors','FileReadError','%\x20match)\x0a','resolve','filter','6867yJIwta','Here\x20is\x20the\x20content\x20of\x20files:\x0a','stat','code','Preview\x20changes\x20using\x20git-style\x20diff\x20format','repo_path','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','WarpGrepError','alloc','argv','length','rename','setRequestHandler','trim','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','path','metadata','timeout','env','oldText','toFixed','size','query','-\x20Listed\x20directory\x20`','number','Relevant\x20context\x20found:','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','bytesRead','\x0a</file>','constructor','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','edit_file','Unknown\x20tool:\x20','utf-8','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','endLine','Error:\x20','Natural\x20language\x20query\x20to\x20search\x20for\x20code','basename','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','stats','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','\x0a...\x20(truncated,\x20total:\x20','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','...','go.mod','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','atime','toLowerCase','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','string','includes','[could\x20not\x20read\x20file:\x20','TimeoutError','PWD','Sort\x20entries\x20by\x20name\x20or\x20size','.cursor','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','repeat','original','read\x20','writeFile','results','repoId','splice','getClientCapabilities','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Warning:\x20','ENOENT','join','message','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','text','etimedout'];a0_0xcb90=function(){return _0x3acf4b;};return a0_0xcb90();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x8f0e46 from'fs/promises';import a0_0x1a8ed3 from'path';import a0_0x150bcd from'os';import{randomBytes}from'crypto';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{createTwoFilesPatch}from'diff';import{minimatch}from'minimatch';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x14c8c9 from'axios';const args=process[a0_0x4b6731(0x161)][a0_0x4b6731(0x209)](0x2),ALL_TOOLS=[a0_0x4b6731(0x177),a0_0x4b6731(0x210),a0_0x4b6731(0x21a)],DEFAULT_TOOLS=[a0_0x4b6731(0x177),a0_0x4b6731(0x210)],ENABLED_TOOLS=process[a0_0x4b6731(0x16a)]['ENABLED_TOOLS']?process['env'][a0_0x4b6731(0x1a6)]===a0_0x4b6731(0x1bd)?ALL_TOOLS:process[a0_0x4b6731(0x16a)][a0_0x4b6731(0x1a6)]['split'](',')[a0_0x4b6731(0x1ae)](_0x8dd2d1=>_0x8dd2d1['trim']()):DEFAULT_TOOLS;console[a0_0x4b6731(0x1b8)](a0_0x4b6731(0x1b5)+ENABLED_TOOLS[a0_0x4b6731(0x1a0)](',\x20'));const WORKSPACE_ROOT=process[a0_0x4b6731(0x16a)]['WORKSPACE_ROOT']||process[a0_0x4b6731(0x16a)][a0_0x4b6731(0x191)]||process[a0_0x4b6731(0x1f5)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x4b6731(0x1f1)]!=='false',MORPH_API_KEY=process[a0_0x4b6731(0x16a)][a0_0x4b6731(0x22d)];MORPH_API_KEY&&!MORPH_API_KEY[a0_0x4b6731(0x1c8)](a0_0x4b6731(0x207))&&!MORPH_API_KEY[a0_0x4b6731(0x1c8)](a0_0x4b6731(0x1a9))&&console[a0_0x4b6731(0x1b8)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x358e62){const _0x5436fc=a0_0x4b6731;try{await a0_0x14c8c9[_0x5436fc(0x1c9)]('https://morphllm.com/api/error-report',{..._0x358e62,'timestamp':new Date()[_0x5436fc(0x1d7)](),'source':_0x358e62['source']||'mcp-filesystem'},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x5436fc(0x1cb)+MORPH_API_KEY}});}catch{}}args[a0_0x4b6731(0x162)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console['error'](a0_0x4b6731(0x220)),console['error'](a0_0x4b6731(0x255)),console[a0_0x4b6731(0x1b8)](a0_0x4b6731(0x1b2)),console[a0_0x4b6731(0x1b8)](a0_0x4b6731(0x242)),console[a0_0x4b6731(0x1b8)](a0_0x4b6731(0x187)),console[a0_0x4b6731(0x1b8)](a0_0x4b6731(0x18c)));function normalizePath(_0xffd8cd){const _0x3c18b7=a0_0x4b6731;return a0_0x1a8ed3[_0x3c18b7(0x1f0)](_0xffd8cd);}function expandHome(_0x2d2da1){const _0x5dd705=a0_0x4b6731;if(_0x2d2da1[_0x5dd705(0x1c8)]('~/')||_0x2d2da1==='~')return a0_0x1a8ed3[_0x5dd705(0x1a0)](a0_0x150bcd[_0x5dd705(0x226)](),_0x2d2da1[_0x5dd705(0x209)](0x1));return _0x2d2da1;}let allowedDirectories=await Promise['all'](args[a0_0x4b6731(0x1ae)](async _0x5c830d=>{const _0x4aa528=a0_0x4b6731,_0x3e9baa=expandHome(_0x5c830d),_0x3d9326=a0_0x1a8ed3[_0x4aa528(0x156)](_0x3e9baa);try{const _0x30677a=await a0_0x8f0e46['realpath'](_0x3d9326);return normalizePath(_0x30677a);}catch(_0x317da0){return normalizePath(_0x3d9326);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4b6731(0x162)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4b6731(0x217)](workspaceDir),console['error'](a0_0x4b6731(0x20f)+workspaceDir+a0_0x4b6731(0x1c5)));}catch(a0_0x565987){console[a0_0x4b6731(0x1b8)]('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x565987);}async function detectWorkspaceRoot(_0x347844){const _0x186ab3=a0_0x4b6731;let _0x4d6623=a0_0x1a8ed3[_0x186ab3(0x156)](_0x347844);const _0x2c77a2=['.git','.vscode',_0x186ab3(0x241),_0x186ab3(0x23a),_0x186ab3(0x215),_0x186ab3(0x186),_0x186ab3(0x193),'tsconfig.json',_0x186ab3(0x221)];while(_0x4d6623!==a0_0x1a8ed3['dirname'](_0x4d6623)){for(const _0x4c8555 of _0x2c77a2){const _0x5ec40a=a0_0x1a8ed3[_0x186ab3(0x1a0)](_0x4d6623,_0x4c8555);try{return await a0_0x8f0e46[_0x186ab3(0x150)](_0x5ec40a),normalizePath(_0x4d6623);}catch{}}_0x4d6623=a0_0x1a8ed3['dirname'](_0x4d6623);}return normalizePath(_0x347844);}await Promise[a0_0x4b6731(0x1bd)](args[a0_0x4b6731(0x1ae)](async _0x2fbf3a=>{const _0x3b2279=a0_0x4b6731;try{const _0x46eece=await a0_0x8f0e46[_0x3b2279(0x15a)](expandHome(_0x2fbf3a));!_0x46eece[_0x3b2279(0x213)]()&&(console[_0x3b2279(0x1b8)](_0x3b2279(0x17d)+_0x2fbf3a+'\x20is\x20not\x20a\x20directory'),process[_0x3b2279(0x1b1)](0x1));}catch(_0x3d7d11){console[_0x3b2279(0x1b8)]('Error\x20accessing\x20directory\x20'+_0x2fbf3a+':',_0x3d7d11),process[_0x3b2279(0x1b1)](0x1);}}));async function validatePath(_0x577b29){const _0x5685d4=a0_0x4b6731,_0x50673d=expandHome(_0x577b29),_0x54ced3=a0_0x1a8ed3[_0x5685d4(0x156)](_0x50673d);try{const _0x948144=await a0_0x8f0e46[_0x5685d4(0x23e)](_0x54ced3);return _0x948144;}catch(_0xc48d2){if(_0xc48d2['code']===_0x5685d4(0x19f)){const _0x48dfb5=a0_0x1a8ed3[_0x5685d4(0x258)](_0x54ced3);try{const _0x360eac=await a0_0x8f0e46[_0x5685d4(0x23e)](_0x48dfb5);return a0_0x1a8ed3[_0x5685d4(0x1a0)](_0x360eac,a0_0x1a8ed3[_0x5685d4(0x17f)](_0x54ced3));}catch{throw new Error(_0x5685d4(0x1ca)+_0x48dfb5);}}throw _0xc48d2;}}const ReadFileArgsSchema=z['object']({'path':z[a0_0x4b6731(0x18d)](),'tail':z['number']()[a0_0x4b6731(0x259)]()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x243)),'head':z['number']()['optional']()['describe']('If\x20provided,\x20returns\x20only\x20the\x20first\x20N\x20lines\x20of\x20the\x20file')}),ReadMultipleFilesArgsSchema=z[a0_0x4b6731(0x22b)]({'paths':z[a0_0x4b6731(0x1b9)](z[a0_0x4b6731(0x18d)]())}),WriteFileArgsSchema=z[a0_0x4b6731(0x22b)]({'path':z[a0_0x4b6731(0x18d)](),'content':z[a0_0x4b6731(0x18d)]()}),EditOperation=z['object']({'oldText':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x1fb)]('Text\x20to\x20search\x20for\x20-\x20must\x20match\x20exactly'),'newText':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x201))}),EditFileArgsSchema=z[a0_0x4b6731(0x22b)]({'path':z['string'](),'edits':z['array'](EditOperation),'dryRun':z['boolean']()['default'](![])[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x15c))}),CreateDirectoryArgsSchema=z[a0_0x4b6731(0x22b)]({'path':z[a0_0x4b6731(0x18d)]()}),ListDirectoryArgsSchema=z[a0_0x4b6731(0x22b)]({'path':z['string']()}),ListDirectoryWithSizesArgsSchema=z['object']({'path':z[a0_0x4b6731(0x18d)](),'sortBy':z['enum'](['name',a0_0x4b6731(0x16d)])[a0_0x4b6731(0x259)]()[a0_0x4b6731(0x25b)](a0_0x4b6731(0x219))['describe'](a0_0x4b6731(0x192))}),DirectoryTreeArgsSchema=z[a0_0x4b6731(0x22b)]({'path':z[a0_0x4b6731(0x18d)]()}),MoveFileArgsSchema=z['object']({'source':z['string'](),'destination':z[a0_0x4b6731(0x18d)]()}),SearchFilesArgsSchema=z['object']({'path':z[a0_0x4b6731(0x18d)](),'pattern':z[a0_0x4b6731(0x18d)](),'excludePatterns':z[a0_0x4b6731(0x1b9)](z[a0_0x4b6731(0x18d)]())[a0_0x4b6731(0x259)]()[a0_0x4b6731(0x25b)]([])}),GetFileInfoArgsSchema=z['object']({'path':z[a0_0x4b6731(0x18d)]()}),MorphEditFileArgsSchema=z[a0_0x4b6731(0x22b)]({'path':z[a0_0x4b6731(0x18d)](),'code_edit':z[a0_0x4b6731(0x18d)]()['describe'](a0_0x4b6731(0x222)),'instruction':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x180)),'dryRun':z['boolean']()[a0_0x4b6731(0x25b)](![])[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x1dd))}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x203)),'repo_path':z['string']()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x23b))}),CodebaseSearchArgsSchema=z[a0_0x4b6731(0x22b)]({'query':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x17e)),'repoId':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x1fb)]('Repository\x20identifier'),'branch':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x259)]()[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x23d)),'commitHash':z[a0_0x4b6731(0x18d)]()[a0_0x4b6731(0x259)]()[a0_0x4b6731(0x1fb)]('Specific\x20commit\x20hash\x20to\x20search'),'target_directories':z[a0_0x4b6731(0x1b9)](z[a0_0x4b6731(0x18d)]())[a0_0x4b6731(0x25b)]([])[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x1af)),'limit':z[a0_0x4b6731(0x170)]()[a0_0x4b6731(0x259)]()['default'](0xa)[a0_0x4b6731(0x1fb)](a0_0x4b6731(0x205))}),server=new Server({'name':a0_0x4b6731(0x230),'version':'0.2.0'},{'capabilities':{'tools':{}}});function a0_0x6f80(_0x45f961,_0x3bcb71){_0x45f961=_0x45f961-0x14c;const _0xcb907b=a0_0xcb90();let _0x6f8011=_0xcb907b[_0x45f961];return _0x6f8011;}async function getFileStats(_0x37150b){const _0x30c32b=a0_0x4b6731,_0xc0b55=await a0_0x8f0e46[_0x30c32b(0x15a)](_0x37150b);return{'size':_0xc0b55[_0x30c32b(0x16d)],'created':_0xc0b55['birthtime'],'modified':_0xc0b55[_0x30c32b(0x1eb)],'accessed':_0xc0b55[_0x30c32b(0x189)],'isDirectory':_0xc0b55[_0x30c32b(0x213)](),'isFile':_0xc0b55[_0x30c32b(0x21c)](),'permissions':_0xc0b55[_0x30c32b(0x1bc)][_0x30c32b(0x208)](0x8)[_0x30c32b(0x209)](-0x3)};}async function searchFiles(_0x42e72c,_0x566434,_0x298172=[]){const _0x347b72=[];async function _0x3b8d98(_0x16bd27){const _0x2e3fb7=a0_0x6f80,_0x3d0418=await a0_0x8f0e46[_0x2e3fb7(0x232)](_0x16bd27,{'withFileTypes':!![]});for(const _0x8b0f89 of _0x3d0418){const _0x2751c3=a0_0x1a8ed3[_0x2e3fb7(0x1a0)](_0x16bd27,_0x8b0f89[_0x2e3fb7(0x219)]);try{await validatePath(_0x2751c3);const _0x19c41f=a0_0x1a8ed3['relative'](_0x42e72c,_0x2751c3),_0x1b9892=_0x298172[_0x2e3fb7(0x225)](_0x5148f8=>{const _0x2fabad=_0x2e3fb7,_0x154dc0=_0x5148f8[_0x2fabad(0x18e)]('*')?_0x5148f8:_0x2fabad(0x229)+_0x5148f8+'/**';return minimatch(_0x19c41f,_0x154dc0,{'dot':!![]});});if(_0x1b9892)continue;_0x8b0f89['name'][_0x2e3fb7(0x18a)]()[_0x2e3fb7(0x18e)](_0x566434['toLowerCase']())&&_0x347b72[_0x2e3fb7(0x217)](_0x2751c3),_0x8b0f89[_0x2e3fb7(0x213)]()&&await _0x3b8d98(_0x2751c3);}catch(_0x533bee){continue;}}}return await _0x3b8d98(_0x42e72c),_0x347b72;}function normalizeLineEndings(_0x2cecd9){const _0x4434f0=a0_0x4b6731;return _0x2cecd9[_0x4434f0(0x256)](/\r\n/g,'\x0a');}function createUnifiedDiff(_0x286001,_0x5613b2,_0x1590d5=a0_0x4b6731(0x1ff)){const _0x2452c9=a0_0x4b6731,_0x5f277a=normalizeLineEndings(_0x286001),_0x2c0307=normalizeLineEndings(_0x5613b2);return createTwoFilesPatch(_0x1590d5,_0x1590d5,_0x5f277a,_0x2c0307,_0x2452c9(0x196),_0x2452c9(0x1fd));}async function applyFileEdits(_0x4b28cc,_0x289a1e,_0x30ec64=![]){const _0x561405=a0_0x4b6731,_0x33d5ec=normalizeLineEndings(await a0_0x8f0e46[_0x561405(0x1e9)](_0x4b28cc,_0x561405(0x179)));let _0x2033d5=_0x33d5ec;for(const _0x5708c7 of _0x289a1e){const _0x52d023=normalizeLineEndings(_0x5708c7['oldText']),_0x1462a7=normalizeLineEndings(_0x5708c7[_0x561405(0x1d3)]);if(_0x2033d5[_0x561405(0x18e)](_0x52d023)){_0x2033d5=_0x2033d5[_0x561405(0x256)](_0x52d023,_0x1462a7);continue;}const _0x4cff0b=_0x52d023[_0x561405(0x1f9)]('\x0a'),_0x4d2c71=_0x2033d5[_0x561405(0x1f9)]('\x0a');let _0x2a7a19=![];for(let _0x22766a=0x0;_0x22766a<=_0x4d2c71[_0x561405(0x162)]-_0x4cff0b[_0x561405(0x162)];_0x22766a++){const _0x1194af=_0x4d2c71[_0x561405(0x209)](_0x22766a,_0x22766a+_0x4cff0b[_0x561405(0x162)]),_0x194c4a=_0x4cff0b[_0x561405(0x151)]((_0x13476d,_0x4eafe1)=>{const _0x1e1760=_0x561405,_0x59da3b=_0x1194af[_0x4eafe1];return _0x13476d['trim']()===_0x59da3b[_0x1e1760(0x165)]();});if(_0x194c4a){const _0x22080d=_0x4d2c71[_0x22766a][_0x561405(0x1d8)](/^\s*/)?.[0x0]||'',_0x84908=_0x1462a7[_0x561405(0x1f9)]('\x0a')['map']((_0x1aa2ee,_0x1a7b7d)=>{const _0xc91e10=_0x561405;if(_0x1a7b7d===0x0)return _0x22080d+_0x1aa2ee['trimStart']();const _0x333719=_0x4cff0b[_0x1a7b7d]?.[_0xc91e10(0x1d8)](/^\s*/)?.[0x0]||'',_0x59ae75=_0x1aa2ee[_0xc91e10(0x1d8)](/^\s*/)?.[0x0]||'';if(_0x333719&&_0x59ae75){const _0x215fa8=_0x59ae75[_0xc91e10(0x162)]-_0x333719[_0xc91e10(0x162)];return _0x22080d+'\x20'['repeat'](Math['max'](0x0,_0x215fa8))+_0x1aa2ee[_0xc91e10(0x1e8)]();}return _0x1aa2ee;});_0x4d2c71[_0x561405(0x19b)](_0x22766a,_0x4cff0b[_0x561405(0x162)],..._0x84908),_0x2033d5=_0x4d2c71[_0x561405(0x1a0)]('\x0a'),_0x2a7a19=!![];break;}}if(!_0x2a7a19)throw new Error(_0x561405(0x239)+_0x5708c7[_0x561405(0x16b)]);}const _0x58d1e8=createUnifiedDiff(_0x33d5ec,_0x2033d5,_0x4b28cc);let _0x3b7ebd=0x3;while(_0x58d1e8[_0x561405(0x18e)]('`'[_0x561405(0x195)](_0x3b7ebd))){_0x3b7ebd++;}const _0x201055='`'['repeat'](_0x3b7ebd)+'diff\x0a'+_0x58d1e8+'`'[_0x561405(0x195)](_0x3b7ebd)+'\x0a\x0a';if(!_0x30ec64){const _0x406ce7=_0x4b28cc+'.'+randomBytes(0x10)[_0x561405(0x208)](_0x561405(0x1e6))+_0x561405(0x212);try{await a0_0x8f0e46[_0x561405(0x198)](_0x406ce7,_0x2033d5,_0x561405(0x179)),await a0_0x8f0e46[_0x561405(0x163)](_0x406ce7,_0x4b28cc);}catch(_0x4292ca){try{await a0_0x8f0e46['unlink'](_0x406ce7);}catch{}throw _0x4292ca;}}return _0x201055;}function formatSize(_0x601a87){const _0x5e8481=a0_0x4b6731,_0x114dfe=['B','KB','MB','GB','TB'];if(_0x601a87===0x0)return _0x5e8481(0x257);const _0x41c0f7=Math[_0x5e8481(0x1db)](Math[_0x5e8481(0x24f)](_0x601a87)/Math[_0x5e8481(0x24f)](0x400));if(_0x41c0f7===0x0)return _0x601a87+'\x20'+_0x114dfe[_0x41c0f7];return(_0x601a87/Math[_0x5e8481(0x1f7)](0x400,_0x41c0f7))[_0x5e8481(0x16c)](0x2)+'\x20'+_0x114dfe[_0x41c0f7];}async function tailFile(_0x4acf2f,_0x5de10a){const _0x14b71a=a0_0x4b6731,_0x21eade=0x400,_0x3b8b41=await a0_0x8f0e46[_0x14b71a(0x15a)](_0x4acf2f),_0x3fa3fd=_0x3b8b41[_0x14b71a(0x16d)];if(_0x3fa3fd===0x0)return'';const _0x35dc92=await a0_0x8f0e46[_0x14b71a(0x1c1)](_0x4acf2f,'r');try{const _0x809f59=[];let _0x4776a9=_0x3fa3fd,_0x1a9ad3=Buffer[_0x14b71a(0x160)](_0x21eade),_0x29f0dc=0x0,_0x3a74b6='';while(_0x4776a9>0x0&&_0x29f0dc<_0x5de10a){const _0x3ecc0c=Math['min'](_0x21eade,_0x4776a9);_0x4776a9-=_0x3ecc0c;const {bytesRead:_0x2fcd3b}=await _0x35dc92[_0x14b71a(0x1de)](_0x1a9ad3,0x0,_0x3ecc0c,_0x4776a9);if(!_0x2fcd3b)break;const _0x2660c1=_0x1a9ad3[_0x14b71a(0x209)](0x0,_0x2fcd3b)[_0x14b71a(0x208)]('utf-8'),_0x3e0ddc=_0x2660c1+_0x3a74b6,_0x5d4026=normalizeLineEndings(_0x3e0ddc)[_0x14b71a(0x1f9)]('\x0a');_0x4776a9>0x0&&(_0x3a74b6=_0x5d4026[0x0],_0x5d4026[_0x14b71a(0x1aa)]());for(let _0x2c0e7e=_0x5d4026[_0x14b71a(0x162)]-0x1;_0x2c0e7e>=0x0&&_0x29f0dc<_0x5de10a;_0x2c0e7e--){_0x809f59[_0x14b71a(0x1c2)](_0x5d4026[_0x2c0e7e]),_0x29f0dc++;}}return _0x809f59[_0x14b71a(0x1a0)]('\x0a');}finally{await _0x35dc92[_0x14b71a(0x14c)]();}}async function headFile(_0x264446,_0x4429a2){const _0x4e53d3=a0_0x4b6731,_0x12d066=await a0_0x8f0e46[_0x4e53d3(0x1c1)](_0x264446,'r');try{const _0x452908=[];let _0x4809d0='',_0x1ec5e1=0x0;const _0x1aa1b4=Buffer[_0x4e53d3(0x160)](0x400);while(_0x452908[_0x4e53d3(0x162)]<_0x4429a2){const _0x538912=await _0x12d066[_0x4e53d3(0x1de)](_0x1aa1b4,0x0,_0x1aa1b4[_0x4e53d3(0x162)],_0x1ec5e1);if(_0x538912[_0x4e53d3(0x173)]===0x0)break;_0x1ec5e1+=_0x538912[_0x4e53d3(0x173)],_0x4809d0+=_0x1aa1b4['slice'](0x0,_0x538912[_0x4e53d3(0x173)])[_0x4e53d3(0x208)]('utf-8');const _0x58ac43=_0x4809d0['lastIndexOf']('\x0a');if(_0x58ac43!==-0x1){const _0x46cf5c=_0x4809d0[_0x4e53d3(0x209)](0x0,_0x58ac43)[_0x4e53d3(0x1f9)]('\x0a');_0x4809d0=_0x4809d0[_0x4e53d3(0x209)](_0x58ac43+0x1);for(const _0x4d106b of _0x46cf5c){_0x452908[_0x4e53d3(0x217)](_0x4d106b);if(_0x452908[_0x4e53d3(0x162)]>=_0x4429a2)break;}}}return _0x4809d0[_0x4e53d3(0x162)]>0x0&&_0x452908[_0x4e53d3(0x162)]<_0x4429a2&&_0x452908[_0x4e53d3(0x217)](_0x4809d0),_0x452908['join']('\x0a');}finally{await _0x12d066['close']();}}server[a0_0x4b6731(0x164)](ListToolsRequestSchema,async()=>{const _0x1e1235=a0_0x4b6731,_0x43dc41=[{'name':_0x1e1235(0x177),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x1e1235(0x17b)+_0x1e1235(0x21e)+_0x1e1235(0x15e)+_0x1e1235(0x246)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x1e1235(0x1cf)+_0x1e1235(0x244)+_0x1e1235(0x234)+_0x1e1235(0x1c6)+_0x1e1235(0x249)+_0x1e1235(0x23c)+_0x1e1235(0x218)+_0x1e1235(0x18b)+_0x1e1235(0x224)+_0x1e1235(0x1f4)+_0x1e1235(0x176)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x1e1235(0x237)+_0x1e1235(0x1d2)+_0x1e1235(0x24d)+_0x1e1235(0x172)+_0x1e1235(0x20e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x1e1235(0x210),'description':_0x1e1235(0x1df)+_0x1e1235(0x1bf)+_0x1e1235(0x1a2)+_0x1e1235(0x223)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.'+_0x1e1235(0x1cc)+_0x1e1235(0x1fe)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x1e1235(0x21a),'description':'**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a'+_0x1e1235(0x20a)+_0x1e1235(0x184)+_0x1e1235(0x246)+_0x1e1235(0x231)+_0x1e1235(0x17a)+_0x1e1235(0x1ad)+_0x1e1235(0x182)+'Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20'+_0x1e1235(0x188)+_0x1e1235(0x20b),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x3503e0=_0x43dc41['filter'](_0x8f1f44=>{const _0x3b42a2=_0x1e1235;if(!ENABLED_TOOLS[_0x3b42a2(0x18e)](_0x8f1f44['name']))return![];if(_0x3b42a2(0x1dc)in _0x8f1f44&&_0x8f1f44[_0x3b42a2(0x1dc)]&&!MORPH_API_KEY)return console[_0x3b42a2(0x1b8)](_0x3b42a2(0x19e)+_0x8f1f44[_0x3b42a2(0x219)]+_0x3b42a2(0x19d)),![];return!![];});return{'tools':_0x3503e0[_0x1e1235(0x1ae)](_0x44ba51=>({'name':_0x44ba51[_0x1e1235(0x219)],'description':_0x44ba51[_0x1e1235(0x22c)],'inputSchema':_0x44ba51['inputSchema']}))};}),server[a0_0x4b6731(0x164)](CallToolRequestSchema,async _0x2894dc=>{const _0xeeb504=a0_0x4b6731;try{const {name:_0xd51f49,arguments:_0x8afc91}=_0x2894dc['params'];switch(_0xd51f49){case _0xeeb504(0x177):{const _0x5e0df9=MorphEditFileArgsSchema[_0xeeb504(0x1f8)](_0x8afc91);if(!_0x5e0df9[_0xeeb504(0x1b7)])throw new Error(_0xeeb504(0x194)+_0x5e0df9['error']);const _0x801ba8=await validatePath(_0x5e0df9[_0xeeb504(0x24b)][_0xeeb504(0x167)]);let _0x47a586=null,_0x2a8fb0=!![],_0x4c670e=null;try{_0x47a586=await a0_0x8f0e46['readFile'](_0x801ba8,'utf-8');}catch(_0x44083b){const _0x11730c=_0x44083b[_0xeeb504(0x15b)];_0x11730c===_0xeeb504(0x19f)?(_0x2a8fb0=![],_0x47a586=''):(_0x4c670e=_0xeeb504(0x1e4)+(_0x11730c||_0xeeb504(0x1d5))+_0xeeb504(0x1d1)+(_0x44083b instanceof Error?_0x44083b[_0xeeb504(0x1a1)]:String(_0x44083b)),console[_0xeeb504(0x1b8)](_0xeeb504(0x19e)+_0x4c670e));}try{const _0xd3c923=MORPH_API_KEY;if(!_0xd3c923)throw new Error(_0xeeb504(0x152));const _0xfe1e02=a0_0x1a8ed3[_0xeeb504(0x258)](_0x801ba8),_0x982fc4=a0_0x1a8ed3[_0xeeb504(0x17f)](_0x801ba8),_0x4d1786=await executeEditFile({'target_filepath':_0x982fc4,'code_edit':_0x5e0df9[_0xeeb504(0x24b)][_0xeeb504(0x247)],'instructions':_0x5e0df9['data'][_0xeeb504(0x1fa)]},{'morphApiKey':_0xd3c923,'baseDir':_0xfe1e02,'autoWrite':!_0x5e0df9[_0xeeb504(0x24b)][_0xeeb504(0x1b4)],'generateUdiff':!![],'debug':![]});if(!_0x4d1786[_0xeeb504(0x1b7)])throw new Error(_0x4d1786[_0xeeb504(0x1b8)]||_0xeeb504(0x1ab));const _0x249f63=_0x4d1786['udiff']||'';let _0x4d60a8=0x3;while(_0x249f63[_0xeeb504(0x18e)]('`'[_0xeeb504(0x195)](_0x4d60a8))){_0x4d60a8++;}const _0x1ee3fd='`'['repeat'](_0x4d60a8)+'diff\x0a'+_0x249f63+'`'[_0xeeb504(0x195)](_0x4d60a8)+'\x0a\x0a';if(_0x5e0df9['data'][_0xeeb504(0x1b4)])return{'content':[{'type':_0xeeb504(0x1a3),'text':_0xeeb504(0x252)+(_0x2a8fb0?'':_0xeeb504(0x20c))+':\x20'+_0x5e0df9['data'][_0xeeb504(0x1fa)]+'\x0a\x0a'+_0x1ee3fd+'Use\x20dryRun=false\x20to\x20'+(_0x2a8fb0?_0xeeb504(0x1c4):'create\x20this\x20file')+'.'}]};return{'content':[{'type':_0xeeb504(0x1a3),'text':_0xeeb504(0x24a)+(_0x2a8fb0?'Applied':_0xeeb504(0x1b6))+':\x20'+_0x5e0df9['data'][_0xeeb504(0x1fa)]+'\x0a\x0a'+_0x1ee3fd+_0xeeb504(0x24c)+(_0x2a8fb0?'applied\x20edits\x20to':_0xeeb504(0x1d0))+'\x20'+_0x5e0df9['data'][_0xeeb504(0x167)]}]};}catch(_0x203456){const _0x47ae90=_0x203456 instanceof Error?_0x203456[_0xeeb504(0x1a1)]:String(_0x203456);return reportMorphError({'error_message':_0x47ae90,'error_type':_0x203456 instanceof Error?_0x203456['constructor'][_0xeeb504(0x219)]:'UnknownError','context':{'tool':_0xeeb504(0x177),'file_path':_0x5e0df9[_0xeeb504(0x24b)][_0xeeb504(0x167)],'validated_path':_0x801ba8,'instruction':_0x5e0df9[_0xeeb504(0x24b)]['instruction'],'model':_0xeeb504(0x1ac),'dry_run':_0x5e0df9[_0xeeb504(0x24b)]['dryRun'],'file_exists':_0x2a8fb0,'file_read_error':_0x4c670e,'file_readable':_0x47a586!==null,'request_content':{'path':_0x5e0df9[_0xeeb504(0x24b)]['path'],'code_edit':_0x5e0df9[_0xeeb504(0x24b)][_0xeeb504(0x247)],'instruction':_0x5e0df9['data'][_0xeeb504(0x1fa)],'original_code':_0x47a586!==null?_0x47a586['length']>0xc350?_0x47a586[_0xeeb504(0x21d)](0x0,0xc350)+_0xeeb504(0x183)+_0x47a586[_0xeeb504(0x162)]+'\x20chars)':_0x47a586:_0xeeb504(0x18f)+(_0x4c670e||_0xeeb504(0x21b))+']','original_code_length':_0x47a586?.[_0xeeb504(0x162)]??0x0,'model':'morph-v3-fast','dry_run':_0x5e0df9[_0xeeb504(0x24b)]['dryRun']}},'stack_trace':_0x203456 instanceof Error?_0x203456[_0xeeb504(0x1e5)]:undefined,'source':_0xeeb504(0x1a5)})[_0xeeb504(0x1c7)](()=>{}),{'content':[{'type':_0xeeb504(0x1a3),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x47ae90}],'isError':!![]};}}case'warpgrep_codebase_search':{const _0x3a9490=WarpGrepArgsSchema[_0xeeb504(0x1f8)](_0x8afc91);if(!_0x3a9490[_0xeeb504(0x1b7)])return{'content':[{'type':_0xeeb504(0x1a3),'text':'Invalid\x20arguments:\x20'+_0x3a9490['error']}],'isError':!![]};const _0x4da71d=_0x50df17=>{const _0x9d01d3=_0xeeb504,_0x48e0ba=[];for(const _0x54cbea of _0x50df17||[]){const _0x41c37f=_0x54cbea[_0x9d01d3(0x1a7)],_0x267499=_0x54cbea[_0x9d01d3(0x238)];if(_0x41c37f==='assistant'&&_0x267499){const _0x22370f=_0x267499[_0x9d01d3(0x1f9)]('\x0a')[_0x9d01d3(0x157)](_0xddfe15=>_0xddfe15['trim']());for(const _0x2d2513 of _0x22370f){const _0xe9c33b=_0x2d2513['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0xe9c33b){_0x48e0ba[_0x9d01d3(0x217)]('grep\x20\x27'+_0xe9c33b[0x1]+'\x27\x20'+_0xe9c33b[0x2]);continue;}const _0x55407c=_0x2d2513['match'](/^read\s+(.+)$/);if(_0x55407c){_0x48e0ba[_0x9d01d3(0x217)](_0x9d01d3(0x197)+_0x55407c[0x1]);continue;}const _0x170b75=_0x2d2513[_0x9d01d3(0x1d8)](/^list_directory\s+(.+)$/);if(_0x170b75){_0x48e0ba['push'](_0x9d01d3(0x1d9)+_0x170b75[0x1]);continue;}}}}return _0x48e0ba;};try{const _0x397a47=a0_0x1a8ed3[_0xeeb504(0x156)](_0x3a9490[_0xeeb504(0x24b)]['repo_path']),_0xd43077=new LocalRipgrepProvider(_0x397a47),_0x2ea4eb=await runWarpGrep({'query':_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x240)],'repoRoot':_0x397a47,'morphApiKey':MORPH_API_KEY,'provider':_0xd43077});let _0x129547='';if(_0x2ea4eb['terminationReason']==='completed'&&_0x2ea4eb[_0xeeb504(0x202)]?.[_0xeeb504(0x168)]?.[_0xeeb504(0x20d)]){const _0x529e96=_0x2ea4eb[_0xeeb504(0x202)][_0xeeb504(0x168)]['files'],_0x34f444=[],_0x4cb7ac=[_0xeeb504(0x200)];for(const _0x4de66f of _0x2ea4eb[_0xeeb504(0x250)]){const _0x455a3d=_0x4de66f['role'],_0x1058dd=_0x4de66f[_0xeeb504(0x238)];if(_0x455a3d===_0xeeb504(0x1ed)&&_0x1058dd){const _0x4e269e=_0x1058dd[_0xeeb504(0x1f9)]('\x0a')[_0xeeb504(0x157)](_0x6e7247=>_0x6e7247['trim']());for(const _0xe15202 of _0x4e269e){const _0x14e1a9=_0xe15202[_0xeeb504(0x1d8)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x14e1a9){_0x4cb7ac['push'](_0xeeb504(0x22e)+_0x14e1a9[0x1]+_0xeeb504(0x227)+_0x14e1a9[0x2]+'`');continue;}const _0x2cdb49=_0xe15202[_0xeeb504(0x1d8)](/^read\s+(.+)$/);if(_0x2cdb49){_0x4cb7ac['push'](_0xeeb504(0x1fc)+_0x2cdb49[0x1]+'`');continue;}const _0x2873c5=_0xe15202['match'](/^list_directory\s+(.+)$/);if(_0x2873c5){_0x4cb7ac[_0xeeb504(0x217)](_0xeeb504(0x16f)+_0x2873c5[0x1]+'`');continue;}}}}_0x34f444[_0xeeb504(0x217)](_0x4cb7ac[_0xeeb504(0x1a0)]('\x0a'));const _0x351f59=['',_0xeeb504(0x171)];for(const _0x239e4b of _0x529e96){if(_0x239e4b[_0xeeb504(0x235)]==='*')_0x351f59[_0xeeb504(0x217)]('-\x20'+_0x239e4b[_0xeeb504(0x167)]+':*');else{const _0x294ed8=_0x239e4b[_0xeeb504(0x235)][_0xeeb504(0x1ae)](([_0x59379c,_0x5a3775])=>{if(_0x59379c===_0x5a3775)return''+_0x59379c;return _0x59379c+'-'+_0x5a3775;});_0x351f59[_0xeeb504(0x217)]('-\x20'+_0x239e4b['path']+':'+_0x294ed8[_0xeeb504(0x1a0)](','));}}_0x351f59[_0xeeb504(0x217)](''),_0x34f444['push'](_0x351f59['join']('\x0a')),_0x34f444['push'](_0xeeb504(0x159));const _0x1984df=[];for(const _0x16ff39 of _0x529e96){const _0x20a3b8=a0_0x1a8ed3['resolve'](_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x15d)],_0x16ff39[_0xeeb504(0x167)]);try{const _0x11c4ae=await a0_0x8f0e46[_0xeeb504(0x1e9)](_0x20a3b8,{'encoding':_0xeeb504(0x179)}),_0x25c124=_0x11c4ae[_0xeeb504(0x1f9)](/\r?\n/),_0x9e7e75=['<file\x20path=\x22'+_0x16ff39[_0xeeb504(0x167)]+'\x22>'];if(_0x16ff39[_0xeeb504(0x235)]==='*')for(let _0x472091=0x1;_0x472091<=_0x25c124[_0xeeb504(0x162)];_0x472091++){const _0x4a5081=_0x25c124[_0x472091-0x1];_0x9e7e75[_0xeeb504(0x217)](_0x472091+'|\x20'+_0x4a5081);}else for(const [_0x405142,_0x5b1929]of _0x16ff39['lines']){_0x9e7e75[_0xeeb504(0x162)]>0x1&&_0x9e7e75[_0xeeb504(0x217)]('');for(let _0x474a03=_0x405142;_0x474a03<=_0x5b1929&&_0x474a03<=_0x25c124[_0xeeb504(0x162)];_0x474a03++){const _0x56a214=_0x25c124[_0x474a03-0x1];_0x9e7e75['push'](_0x474a03+'|\x20'+_0x56a214);}}_0x9e7e75[_0xeeb504(0x217)](_0xeeb504(0x214)),_0x1984df[_0xeeb504(0x217)](_0x9e7e75[_0xeeb504(0x1a0)]('\x0a'));}catch(_0x11661c){_0x1984df[_0xeeb504(0x217)](_0xeeb504(0x1c0)+_0x16ff39[_0xeeb504(0x167)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x11661c instanceof Error?_0x11661c[_0xeeb504(0x1a1)]:String(_0x11661c))+_0xeeb504(0x174));}}_0x34f444['push'](_0x1984df[_0xeeb504(0x1a0)]('\x0a\x0a')),_0x129547=_0x34f444['join']('\x0a');const _0x3ff912=_0x2ea4eb[_0xeeb504(0x1c3)]?.['filter'](_0x3a6a6a=>_0x3a6a6a[_0xeeb504(0x1a1)]?.[_0xeeb504(0x1c8)](_0xeeb504(0x1ba)))||[];if(_0x3ff912[_0xeeb504(0x162)]>0x0){const _0x406f10=_0x3ff912[_0xeeb504(0x1ae)](_0xe5236e=>_0xe5236e[_0xeeb504(0x1a1)])['join'](';\x20');reportMorphError({'error_message':_0x406f10,'error_type':_0xeeb504(0x154),'context':{'tool':_0xeeb504(0x210),'repo_path':_0x3a9490['data'][_0xeeb504(0x15d)],'query':_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x240)],'model':_0xeeb504(0x211),'termination_reason':_0xeeb504(0x153),'error_count':_0x3ff912['length'],'is_timeout':![],'files_attempted':_0x529e96['map'](_0x543708=>({'path':_0x543708['path'],'lines':_0x543708[_0xeeb504(0x235)]})),'tool_calls':_0x4da71d(_0x2ea4eb[_0xeeb504(0x250)]),'messages':_0x2ea4eb[_0xeeb504(0x250)]?.[_0xeeb504(0x1ae)](_0x3e0bfe=>({'role':_0x3e0bfe[_0xeeb504(0x1a7)],'content':_0x3e0bfe[_0xeeb504(0x238)]})),'request_content':{'query':_0x3a9490['data']['search_string'],'repo_path':_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x15d)],'repoRoot':a0_0x1a8ed3[_0xeeb504(0x156)](_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x15d)]),'model':_0xeeb504(0x211)}},'source':_0xeeb504(0x1a5)})['catch'](()=>{});}}else{if(_0x2ea4eb[_0xeeb504(0x248)]==='terminated'&&_0x2ea4eb['errors']['length']>0x0){const _0x300b9f=_0x2ea4eb['errors'][_0xeeb504(0x1ae)](_0x59d037=>_0x59d037['message'])['join'](';\x20');_0x129547=_0xeeb504(0x17d)+_0x300b9f;const _0x1534fd=_0x300b9f['toLowerCase']()[_0xeeb504(0x18e)](_0xeeb504(0x169))||_0x300b9f[_0xeeb504(0x18a)]()[_0xeeb504(0x18e)](_0xeeb504(0x254))||_0x300b9f[_0xeeb504(0x18a)]()[_0xeeb504(0x18e)](_0xeeb504(0x1a4)),_0x2bd886=_0x2ea4eb[_0xeeb504(0x202)]?.[_0xeeb504(0x168)]?.[_0xeeb504(0x20d)],_0xaadcac=_0x2ea4eb['errors'][0x0];reportMorphError({'error_message':_0x300b9f,'error_type':_0x1534fd?_0xeeb504(0x190):_0xaadcac?.['constructor']?.[_0xeeb504(0x219)]||_0xeeb504(0x15f),'context':{'tool':_0xeeb504(0x210),'repo_path':_0x3a9490['data']['repo_path'],'query':_0x3a9490[_0xeeb504(0x24b)]['search_string'],'model':_0xeeb504(0x211),'termination_reason':_0x2ea4eb[_0xeeb504(0x248)],'error_count':_0x2ea4eb[_0xeeb504(0x1c3)]['length'],'is_timeout':_0x1534fd,'files_attempted':_0x2bd886?.[_0xeeb504(0x1ae)](_0x1da9c5=>({'path':_0x1da9c5[_0xeeb504(0x167)],'lines':_0x1da9c5[_0xeeb504(0x235)]})),'tool_calls':_0x4da71d(_0x2ea4eb[_0xeeb504(0x250)]),'messages':_0x2ea4eb[_0xeeb504(0x250)]?.[_0xeeb504(0x1ae)](_0x2b5ffc=>({'role':_0x2b5ffc['role'],'content':_0x2b5ffc[_0xeeb504(0x238)]})),'request_content':{'query':_0x3a9490[_0xeeb504(0x24b)]['search_string'],'repo_path':_0x3a9490[_0xeeb504(0x24b)]['repo_path'],'repoRoot':a0_0x1a8ed3[_0xeeb504(0x156)](_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x15d)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0xaadcac?.[_0xeeb504(0x1e5)]||undefined,'source':_0xeeb504(0x1a5)})['catch'](()=>{});}else _0x129547=_0xeeb504(0x1e2);}return{'content':[{'type':'text','text':_0x129547}]};}catch(_0x4eccce){const _0x3c0855=_0x4eccce instanceof Error?_0x4eccce[_0xeeb504(0x1a1)]:String(_0x4eccce),_0x427f71=_0x3c0855[_0xeeb504(0x18a)]()[_0xeeb504(0x18e)](_0xeeb504(0x169))||_0x3c0855[_0xeeb504(0x18a)]()['includes'](_0xeeb504(0x254))||_0x3c0855[_0xeeb504(0x18a)]()[_0xeeb504(0x18e)](_0xeeb504(0x1a4))||_0x4eccce instanceof Error&&_0x4eccce[_0xeeb504(0x219)]==='TimeoutError';return reportMorphError({'error_message':_0x3c0855,'error_type':_0x427f71?_0xeeb504(0x190):_0x4eccce instanceof Error?_0x4eccce[_0xeeb504(0x175)]['name']:_0xeeb504(0x206),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x3a9490['data']['repo_path'],'query':_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x240)],'model':_0xeeb504(0x211),'is_timeout':_0x427f71,'exception_phase':_0xeeb504(0x216),'request_content':{'query':_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x240)],'repo_path':_0x3a9490[_0xeeb504(0x24b)][_0xeeb504(0x15d)],'repoRoot':a0_0x1a8ed3[_0xeeb504(0x156)](_0x3a9490['data'][_0xeeb504(0x15d)]),'model':_0xeeb504(0x211)}},'stack_trace':_0x4eccce instanceof Error?_0x4eccce[_0xeeb504(0x1e5)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':'text','text':_0xeeb504(0x1e1)+_0x3c0855}],'isError':![]};}}case _0xeeb504(0x21a):{const _0x3a95fb=CodebaseSearchArgsSchema[_0xeeb504(0x1f8)](_0x8afc91);if(!_0x3a95fb[_0xeeb504(0x1b7)])return{'content':[{'type':_0xeeb504(0x1a3),'text':_0xeeb504(0x21f)+_0x3a95fb[_0xeeb504(0x1b8)]}],'isError':!![]};try{const _0x474e5f=MORPH_API_KEY;if(!_0x474e5f)throw new Error(_0xeeb504(0x1f3));const _0x47893a=await executeCodebaseSearch({'query':_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x16e)],'target_directories':_0x3a95fb['data']['target_directories'],'limit':_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x14e)]},{'apiKey':_0x474e5f,'repoId':_0x3a95fb['data'][_0xeeb504(0x19a)],'branch':_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x25a)],'commitHash':_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x1a8)],'debug':![]});if(!_0x47893a[_0xeeb504(0x1b7)])return{'content':[{'type':_0xeeb504(0x1a3),'text':'Search\x20failed:\x20'+_0x47893a[_0xeeb504(0x1b8)]}],'isError':!![]};const _0x5a6c7b=_0x47893a[_0xeeb504(0x199)]['length']===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x16e)]+'\x22':_0xeeb504(0x14f)+_0x47893a['results']['length']+'\x20results\x20in\x20'+_0x47893a[_0xeeb504(0x181)][_0xeeb504(0x236)]+'ms:\x0a\x0a'+_0x47893a[_0xeeb504(0x199)][_0xeeb504(0x1ae)]((_0x4f757e,_0x2f7617)=>_0x2f7617+0x1+'.\x20'+_0x4f757e[_0xeeb504(0x251)]+'\x20('+(_0x4f757e[_0xeeb504(0x204)]*0x64)[_0xeeb504(0x16c)](0x1)+_0xeeb504(0x155)+('\x20\x20\x20Lines\x20'+_0x4f757e['startLine']+'-'+_0x4f757e[_0xeeb504(0x17c)]+'\x0a')+(_0xeeb504(0x1ea)+_0x4f757e['content'][_0xeeb504(0x21d)](0x0,0xc8)+(_0x4f757e['content']['length']>0xc8?_0xeeb504(0x185):'')+'\x0a'))[_0xeeb504(0x1a0)]('\x0a');return{'content':[{'type':_0xeeb504(0x1a3),'text':_0x5a6c7b}]};}catch(_0x453698){const _0x1cc3c9=_0x453698 instanceof Error?_0x453698[_0xeeb504(0x1a1)]:String(_0x453698);return reportMorphError({'error_message':_0x1cc3c9,'error_type':_0x453698 instanceof Error?_0x453698['constructor']['name']:_0xeeb504(0x206),'context':{'tool':_0xeeb504(0x21a),'query':_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x16e)],'repo_id':_0x3a95fb[_0xeeb504(0x24b)][_0xeeb504(0x19a)]},'stack_trace':_0x453698 instanceof Error?_0x453698[_0xeeb504(0x1e5)]:undefined,'source':_0xeeb504(0x1a5)})[_0xeeb504(0x1c7)](()=>{}),{'content':[{'type':_0xeeb504(0x1a3),'text':_0xeeb504(0x17d)+_0x1cc3c9}],'isError':!![]};}}default:throw new Error(_0xeeb504(0x178)+_0xd51f49);}}catch(_0xd51e0a){const _0x11047f=_0xd51e0a instanceof Error?_0xd51e0a[_0xeeb504(0x1a1)]:String(_0xd51e0a);return reportMorphError({'error_message':_0x11047f,'error_type':_0xd51e0a instanceof Error?_0xd51e0a[_0xeeb504(0x175)][_0xeeb504(0x219)]:_0xeeb504(0x206),'context':{'tool':name,'arguments':args?JSON[_0xeeb504(0x245)](args)[_0xeeb504(0x21d)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0xd51e0a instanceof Error?_0xd51e0a[_0xeeb504(0x1e5)]:undefined,'source':'mcp-filesystem'})[_0xeeb504(0x1c7)](()=>{}),{'content':[{'type':'text','text':_0xeeb504(0x17d)+_0x11047f}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x27b9a3){const _0x2ebe73=a0_0x4b6731,_0x39b895=await getValidRootDirectories(_0x27b9a3);if(_0x39b895[_0x2ebe73(0x162)]>0x0)allowedDirectories=[..._0x39b895],console[_0x2ebe73(0x1b8)](_0x2ebe73(0x1e0)+_0x39b895[_0x2ebe73(0x162)]+'\x20valid\x20directories');else{console[_0x2ebe73(0x1b8)](_0x2ebe73(0x233));if(ENABLE_WORKSPACE_MODE)try{const _0x511556=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x511556&&(allowedDirectories=[_0x511556],console[_0x2ebe73(0x1b8)]('Fallback:\x20Using\x20workspace\x20root\x20'+_0x511556));}catch(_0x2b3ab1){console[_0x2ebe73(0x1b8)]('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2b3ab1);}}}server[a0_0x4b6731(0x1bb)](RootsListChangedNotificationSchema,async()=>{const _0x2af874=a0_0x4b6731;try{const _0x16f578=await server[_0x2af874(0x1f2)]();_0x16f578&&'roots'in _0x16f578&&await updateAllowedDirectoriesFromRoots(_0x16f578[_0x2af874(0x1e7)]);}catch(_0x2ad712){console['error'](_0x2af874(0x24e),_0x2ad712 instanceof Error?_0x2ad712[_0x2af874(0x1a1)]:String(_0x2ad712));}}),server[a0_0x4b6731(0x1ee)]=async()=>{const _0x3c830e=a0_0x4b6731,_0x1a6453=server[_0x3c830e(0x19c)]();if(_0x1a6453?.['roots'])try{const _0x252122=await server[_0x3c830e(0x1f2)]();_0x252122&&_0x3c830e(0x1e7)in _0x252122?await updateAllowedDirectoriesFromRoots(_0x252122[_0x3c830e(0x1e7)]):console[_0x3c830e(0x1b8)](_0x3c830e(0x1cd));}catch(_0x14ba55){console['error'](_0x3c830e(0x1ec),_0x14ba55 instanceof Error?_0x14ba55[_0x3c830e(0x1a1)]:String(_0x14ba55));}else{if(allowedDirectories['length']>0x0)console[_0x3c830e(0x1b8)](_0x3c830e(0x1b3),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console['error']('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x3c830e(0x1b0));}}};async function runServer(){const _0xab52e9=a0_0x4b6731,_0xa8546a=new StdioServerTransport();await server[_0xab52e9(0x1e3)](_0xa8546a),console[_0xab52e9(0x1b8)](_0xab52e9(0x1ef)),allowedDirectories[_0xab52e9(0x162)]===0x0&&console[_0xab52e9(0x1b8)](_0xab52e9(0x166));}runServer()['catch'](_0x4823be=>{const _0x55eba8=a0_0x4b6731;console[_0x55eba8(0x1b8)](_0x55eba8(0x22a),_0x4823be),process[_0x55eba8(0x1b1)](0x1);});
|
|
2
|
+
const a0_0x2878ee=a0_0x43c2;(function(_0x33e45e,_0x186855){const _0x23c676=a0_0x43c2,_0x30abed=_0x33e45e();while(!![]){try{const _0xc95a80=-parseInt(_0x23c676(0x138))/0x1+parseInt(_0x23c676(0x10c))/0x2*(parseInt(_0x23c676(0xf8))/0x3)+parseInt(_0x23c676(0x134))/0x4*(parseInt(_0x23c676(0xcd))/0x5)+parseInt(_0x23c676(0xfa))/0x6*(-parseInt(_0x23c676(0x11d))/0x7)+parseInt(_0x23c676(0x16e))/0x8*(parseInt(_0x23c676(0x17a))/0x9)+parseInt(_0x23c676(0xde))/0xa+-parseInt(_0x23c676(0x187))/0xb;if(_0xc95a80===_0x186855)break;else _0x30abed['push'](_0x30abed['shift']());}catch(_0x2feb47){_0x30abed['push'](_0x30abed['shift']());}}}(a0_0x2299,0xeffba));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x4e9f2c from'fs/promises';import a0_0x1442c6 from'path';import a0_0x589b3b from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x592ca2 from'axios';function fixPathRepetition(_0x333203){const _0x1dbb44=a0_0x43c2,_0x5640b5=_0x333203['split'](a0_0x1442c6[_0x1dbb44(0xb0)])[_0x1dbb44(0x179)](Boolean);if(_0x5640b5[_0x1dbb44(0xab)]<0x2)return null;for(let _0x486274=Math[_0x1dbb44(0xf3)](_0x5640b5[_0x1dbb44(0xab)]/0x2);_0x486274>=0x1;_0x486274--){for(let _0x5a18a5=0x0;_0x5a18a5<=_0x5640b5['length']-0x2*_0x486274;_0x5a18a5++){const _0x25650e=_0x5640b5[_0x1dbb44(0x16d)](_0x5a18a5,_0x5a18a5+_0x486274),_0x58e2d9=_0x5640b5['slice'](_0x5a18a5+_0x486274,_0x5a18a5+0x2*_0x486274);if(_0x25650e['every']((_0x155937,_0x5c8dd1)=>_0x155937===_0x58e2d9[_0x5c8dd1])){const _0x3590ee=[..._0x5640b5[_0x1dbb44(0x16d)](0x0,_0x5a18a5),..._0x5640b5['slice'](_0x5a18a5+_0x486274)];return a0_0x1442c6[_0x1dbb44(0xb0)]+_0x3590ee[_0x1dbb44(0x120)](a0_0x1442c6[_0x1dbb44(0xb0)]);}}}return null;}const args=process[a0_0x2878ee(0xef)][a0_0x2878ee(0x16d)](0x2),ALL_TOOLS=['edit_file','warpgrep_codebase_search',a0_0x2878ee(0xd0)],DEFAULT_TOOLS=[a0_0x2878ee(0xc2),a0_0x2878ee(0xcc)],ENABLED_TOOLS=process[a0_0x2878ee(0x17e)][a0_0x2878ee(0xac)]?process[a0_0x2878ee(0x17e)]['ENABLED_TOOLS']===a0_0x2878ee(0x130)?ALL_TOOLS:process[a0_0x2878ee(0x17e)][a0_0x2878ee(0xac)][a0_0x2878ee(0x17f)](',')[a0_0x2878ee(0x124)](_0x3f0333=>_0x3f0333[a0_0x2878ee(0x139)]()):DEFAULT_TOOLS;console['error'](a0_0x2878ee(0xc7)+ENABLED_TOOLS[a0_0x2878ee(0x120)](',\x20'));const WORKSPACE_ROOT=process['env'][a0_0x2878ee(0xa0)]||process[a0_0x2878ee(0x17e)]['PWD']||process[a0_0x2878ee(0x159)](),ENABLE_WORKSPACE_MODE=process[a0_0x2878ee(0x17e)][a0_0x2878ee(0x177)]!==a0_0x2878ee(0x15f),MORPH_API_KEY=process[a0_0x2878ee(0x17e)][a0_0x2878ee(0x135)],MORPH_API_URL=process[a0_0x2878ee(0x17e)]['MORPH_API_URL'];MORPH_API_KEY&&!MORPH_API_KEY[a0_0x2878ee(0xdd)]('sk-')&&!MORPH_API_KEY['startsWith'](a0_0x2878ee(0xc9))&&console['error'](a0_0x2878ee(0x131));async function reportMorphError(_0x337774){const _0x2a6d64=a0_0x2878ee;try{await a0_0x592ca2[_0x2a6d64(0x116)]('https://morphllm.com/api/error-report',{..._0x337774,'timestamp':new Date()['toISOString'](),'source':_0x337774[_0x2a6d64(0x176)]||_0x2a6d64(0xb9)},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x2a6d64(0x152)+MORPH_API_KEY}});}catch{}}function a0_0x2299(){const _0x1d26b6=['split','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','readFile','applied\x20edits\x20to','ENOENT','dryRun','Natural\x20language\x20query\x20to\x20search\x20for\x20code','Warning:\x20Workspace\x20fallback\x20failed:\x20','5149375aDrGYo','WORKSPACE_ROOT','commitHash','content','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','push','oninitialized','unknown','Unknown\x20error','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','etimedout','safeParse','length','ENABLED_TOOLS','toLowerCase','-\x20Read\x20file\x20`','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','sep','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','TimeoutError','\x22>\x0aError\x20reading\x20file:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','describe','search_string','Rules:\x0a','mcp-filesystem','role','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','\x20(new\x20file)','roots','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','\x20is\x20not\x20a\x20directory','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','File\x20read\x20error:','edit_file','message','dirname','Workspace\x20mode\x20enabled:\x20Using\x20','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','Enabled\x20tools:\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','morph-','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','Invalid\x20arguments:\x20','warpgrep_codebase_search','6780bOhtmG','results','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','codebase_search','<file\x20path=\x22','exit','error','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','target_directories','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','go.mod','Relevant\x20context\x20found:','Specific\x20commit\x20hash\x20to\x20search','object','constructor','startsWith','4314160yGFoxE','repo_path','pyproject.toml','text','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','package.json','array','Preview\x20changes\x20without\x20applying\x20them.','stack','searchTimeMs','completed_with_file_errors','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','argv','\x0a</file>','-\x20Grepped\x20\x27','setRequestHandler','floor','Warning:\x20','morph-warp-grep-v1-1111v0','realpath','access','3HJBbsU','lines','214494KcQARp','created','filepath','optional','\x20as\x20allowed\x20directory','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','timed\x20out','composer.json','setNotificationHandler','params','Search\x20failed:\x20','Found\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','For\x20deletions:\x0a','3338818ayfHas','requiresApiKey','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','terminationReason','timeout','Benefits:\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','terminated','morph-v3-fast','post','match','default','utf-8','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Error\x20running\x20fast\x20context\x20search:\x20','329YUQnSW','homedir','0.2.0','join','Applied','boolean','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','map','Fatal\x20error\x20running\x20server:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','-\x20Listed\x20directory\x20`','repeat','Error\x20accessing\x20directory\x20','string','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','files','Error:\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','instruction','all','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','metadata','1876mNMamz','MORPH_API_KEY','errors','branch','688974GfhSrh','trim','data','\x0a...\x20(truncated,\x20total:\x20','FileReadError','Cargo.toml','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','%\x20match)\x0a','No\x20results\x20found\x20for\x20query:\x20\x22','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','assistant','UnknownError','name','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Failed\x20to\x20request\x20roots\x20from\x20client:','create\x20this\x20file','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','unknown\x20error','grep\x20\x27','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','catch','toFixed','Created\x20File','\x20\x20\x20Lines\x20','listRoots','substring','Bearer\x20','success','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','diff\x0a','path','basename','Successfully\x20','cwd','finish','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','Morph\x20Edit\x20','isArray','...','false','query','Use\x20dryRun=false\x20to\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','resolve','code','Repository\x20identifier','includes','\x20results\x20in\x20','\x27\x20in\x20`','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','number','read\x20','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','slice','24qvwKyy','\x20valid\x20directories','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Unknown\x20tool:\x20','udiff','endLine','code_edit','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','source','ENABLE_WORKSPACE_MODE','messages','filter','3250449UoYDom','\x20\x20\x20','[could\x20not\x20read\x20file:\x20','</file>','env'];a0_0x2299=function(){return _0x1d26b6;};return a0_0x2299();}args[a0_0x2878ee(0xab)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xa3)),console['error']('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xd6)),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xe7)),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0x148)),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xff)));function a0_0x43c2(_0x1f94f7,_0x41dbae){_0x1f94f7=_0x1f94f7-0xa0;const _0x229970=a0_0x2299();let _0x43c286=_0x229970[_0x1f94f7];return _0x43c286;}function normalizePath(_0x82fab5){return a0_0x1442c6['normalize'](_0x82fab5);}function expandHome(_0x571599){const _0x3a1573=a0_0x2878ee;if(_0x571599['startsWith']('~/')||_0x571599==='~')return a0_0x1442c6[_0x3a1573(0x120)](a0_0x589b3b[_0x3a1573(0x11e)](),_0x571599[_0x3a1573(0x16d)](0x1));return _0x571599;}let allowedDirectories=await Promise[a0_0x2878ee(0x130)](args[a0_0x2878ee(0x124)](async _0x2f6d21=>{const _0x5dbc7e=a0_0x2878ee,_0x46f320=expandHome(_0x2f6d21),_0x488bf3=a0_0x1442c6[_0x5dbc7e(0x163)](_0x46f320);try{const _0x1ef0bf=await a0_0x4e9f2c[_0x5dbc7e(0xf6)](_0x488bf3);return normalizePath(_0x1ef0bf);}catch(_0x4796b4){return normalizePath(_0x488bf3);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x2878ee(0xab)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x2878ee(0xa4)](workspaceDir),console['error'](a0_0x2878ee(0xc5)+workspaceDir+a0_0x2878ee(0xfe)));}catch(a0_0x290b22){console['error'](a0_0x2878ee(0x108)+a0_0x290b22);}async function detectWorkspaceRoot(_0x2c43ac){const _0x37b276=a0_0x2878ee;let _0x3e70cb=a0_0x1442c6[_0x37b276(0x163)](_0x2c43ac);const _0x1ff064=['.git','.vscode',_0x37b276(0xe8),_0x37b276(0x13d),_0x37b276(0xe0),_0x37b276(0xd8),'.cursor','tsconfig.json',_0x37b276(0x103)];while(_0x3e70cb!==a0_0x1442c6[_0x37b276(0xc4)](_0x3e70cb)){for(const _0x3716bc of _0x1ff064){const _0x493f51=a0_0x1442c6[_0x37b276(0x120)](_0x3e70cb,_0x3716bc);try{return await a0_0x4e9f2c[_0x37b276(0xf7)](_0x493f51),normalizePath(_0x3e70cb);}catch{}}_0x3e70cb=a0_0x1442c6['dirname'](_0x3e70cb);}return normalizePath(_0x2c43ac);}await Promise[a0_0x2878ee(0x130)](args['map'](async _0xf59a61=>{const _0x3bd5b0=a0_0x2878ee;try{const _0x517d20=await a0_0x4e9f2c['stat'](expandHome(_0xf59a61));!_0x517d20['isDirectory']()&&(console['error'](_0x3bd5b0(0x12d)+_0xf59a61+_0x3bd5b0(0xbf)),process[_0x3bd5b0(0xd2)](0x1));}catch(_0x45faef){console[_0x3bd5b0(0xd3)](_0x3bd5b0(0x129)+_0xf59a61+':',_0x45faef),process[_0x3bd5b0(0xd2)](0x1);}}));async function validatePath(_0x1fb78c){const _0xa5374d=a0_0x2878ee,_0x2487af=expandHome(_0x1fb78c),_0x8fb536=a0_0x1442c6[_0xa5374d(0x163)](_0x2487af);try{const _0x51fff6=await a0_0x4e9f2c[_0xa5374d(0xf6)](_0x8fb536);return _0x51fff6;}catch(_0x1d9f4d){if(_0x1d9f4d[_0xa5374d(0x164)]===_0xa5374d(0x183)){const _0x531cc4=a0_0x1442c6[_0xa5374d(0xc4)](_0x8fb536);try{const _0x3df03f=await a0_0x4e9f2c[_0xa5374d(0xf6)](_0x531cc4);return a0_0x1442c6[_0xa5374d(0x120)](_0x3df03f,a0_0x1442c6[_0xa5374d(0x157)](_0x8fb536));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x531cc4);}}throw _0x1d9f4d;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x2878ee(0x12a)](),'code_edit':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x10a)),'instruction':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0xb2)),'dryRun':z[a0_0x2878ee(0x122)]()[a0_0x2878ee(0x118)](![])['describe'](a0_0x2878ee(0xea))}),WarpGrepArgsSchema=z[a0_0x2878ee(0xdb)]({'search_string':z[a0_0x2878ee(0x12a)]()['describe'](a0_0x2878ee(0xb1)),'repo_path':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x109))}),CodebaseSearchArgsSchema=z[a0_0x2878ee(0xdb)]({'query':z['string']()['describe'](a0_0x2878ee(0x185)),'repoId':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x165)),'branch':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xfd)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x100)),'commitHash':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xfd)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0xda)),'target_directories':z[a0_0x2878ee(0xe9)](z[a0_0x2878ee(0x12a)]())[a0_0x2878ee(0x118)]([])['describe'](a0_0x2878ee(0xee)),'limit':z[a0_0x2878ee(0x16a)]()[a0_0x2878ee(0xfd)]()[a0_0x2878ee(0x118)](0xa)[a0_0x2878ee(0xb6)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x2878ee(0x11f)},{'capabilities':{'tools':{}}});server[a0_0x2878ee(0xf2)](ListToolsRequestSchema,async()=>{const _0x332435=a0_0x2878ee,_0x25c1ac=[{'name':_0x332435(0xc2),'description':_0x332435(0x11b)+_0x332435(0x141)+_0x332435(0xc0)+_0x332435(0x112)+_0x332435(0x111)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x332435(0x180)+_0x332435(0x170)+_0x332435(0x11a)+_0x332435(0xe5)+_0x332435(0xbb)+_0x332435(0x123)+_0x332435(0x10b)+_0x332435(0xe3)+_0x332435(0xbe)+_0x332435(0xb8)+_0x332435(0x12e)+_0x332435(0x175)+_0x332435(0x16c)+_0x332435(0xaf)+_0x332435(0x113)+_0x332435(0xcf)+_0x332435(0xe2),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x332435(0xca)+'This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20'+_0x332435(0x154)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.'+_0x332435(0xe4)+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x332435(0xd4)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x332435(0xc6)+'Benefits:\x0a'+_0x332435(0x169)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x332435(0x101)+_0x332435(0x15b)+_0x332435(0x13e)+_0x332435(0x132)+'Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x27eacf=_0x25c1ac[_0x332435(0x179)](_0x2ddd9c=>{const _0x43ccd6=_0x332435;if(!ENABLED_TOOLS[_0x43ccd6(0x166)](_0x2ddd9c['name']))return![];if(_0x43ccd6(0x10d)in _0x2ddd9c&&_0x2ddd9c[_0x43ccd6(0x10d)]&&!MORPH_API_KEY)return console[_0x43ccd6(0xd3)](_0x43ccd6(0xf4)+_0x2ddd9c[_0x43ccd6(0x144)]+_0x43ccd6(0x145)),![];return!![];});return{'tools':_0x27eacf[_0x332435(0x124)](_0x5ba2b7=>({'name':_0x5ba2b7[_0x332435(0x144)],'description':_0x5ba2b7['description'],'inputSchema':_0x5ba2b7['inputSchema']}))};}),server[a0_0x2878ee(0xf2)](CallToolRequestSchema,async _0x5509cf=>{const _0x32dbaf=a0_0x2878ee;try{const {name:_0x4eb32a,arguments:_0x1066ed}=_0x5509cf[_0x32dbaf(0x105)];switch(_0x4eb32a){case _0x32dbaf(0xc2):{const _0x44e6e4=MorphEditFileArgsSchema[_0x32dbaf(0xaa)](_0x1066ed);if(!_0x44e6e4['success'])throw new Error(_0x32dbaf(0xa8)+_0x44e6e4['error']);const _0x5505ca=await validatePath(_0x44e6e4['data'][_0x32dbaf(0x156)]);let _0x386c5a=null,_0x109f44=!![],_0x4c0b53=null;try{_0x386c5a=await a0_0x4e9f2c[_0x32dbaf(0x181)](_0x5505ca,_0x32dbaf(0x119));}catch(_0x120495){const _0x201957=_0x120495[_0x32dbaf(0x164)];_0x201957==='ENOENT'?(_0x109f44=![],_0x386c5a=''):(_0x4c0b53='Failed\x20to\x20read\x20file:\x20'+(_0x201957||_0x32dbaf(0xa6))+'\x20-\x20'+(_0x120495 instanceof Error?_0x120495['message']:String(_0x120495)),console['error'](_0x32dbaf(0xf4)+_0x4c0b53));}try{const _0x5afebb=MORPH_API_KEY;if(!_0x5afebb)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x3d43bc=a0_0x1442c6[_0x32dbaf(0xc4)](_0x5505ca),_0x210880=a0_0x1442c6[_0x32dbaf(0x157)](_0x5505ca),_0x2a7867=await executeEditFile({'target_filepath':_0x210880,'code_edit':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x174)],'instructions':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x12f)]},{'morphApiKey':_0x5afebb,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3d43bc,'autoWrite':!_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x184)],'generateUdiff':!![],'debug':![]});if(!_0x2a7867[_0x32dbaf(0x153)])throw new Error(_0x2a7867[_0x32dbaf(0xd3)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x536b1f=_0x2a7867[_0x32dbaf(0x172)]||'';let _0x41824a=0x3;while(_0x536b1f[_0x32dbaf(0x166)]('`'[_0x32dbaf(0x128)](_0x41824a))){_0x41824a++;}const _0xebad9a='`'['repeat'](_0x41824a)+_0x32dbaf(0x155)+_0x536b1f+'`'[_0x32dbaf(0x128)](_0x41824a)+'\x0a\x0a';if(_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x184)])return{'content':[{'type':_0x32dbaf(0xe1),'text':'🔍\x20Morph\x20Edit\x20Preview'+(_0x109f44?'':_0x32dbaf(0xbc))+':\x20'+_0x44e6e4[_0x32dbaf(0x13a)]['instruction']+'\x0a\x0a'+_0xebad9a+_0x32dbaf(0x161)+(_0x109f44?'apply\x20these\x20changes':_0x32dbaf(0x147))+'.'}]};return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0x15c)+(_0x109f44?_0x32dbaf(0x121):_0x32dbaf(0x14e))+':\x20'+_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x12f)]+'\x0a\x0a'+_0xebad9a+_0x32dbaf(0x158)+(_0x109f44?_0x32dbaf(0x182):_0x32dbaf(0xfb))+'\x20'+_0x44e6e4['data'][_0x32dbaf(0x156)]}]};}catch(_0x290644){const _0x3bfd96=_0x290644 instanceof Error?_0x290644[_0x32dbaf(0xc3)]:String(_0x290644);return reportMorphError({'error_message':_0x3bfd96,'error_type':_0x290644 instanceof Error?_0x290644[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:_0x32dbaf(0x143),'context':{'tool':'edit_file','file_path':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x156)],'validated_path':_0x5505ca,'instruction':_0x44e6e4['data']['instruction'],'model':_0x32dbaf(0x115),'dry_run':_0x44e6e4['data'][_0x32dbaf(0x184)],'file_exists':_0x109f44,'file_read_error':_0x4c0b53,'file_readable':_0x386c5a!==null,'request_content':{'path':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x156)],'code_edit':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x174)],'instruction':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x12f)],'original_code':_0x386c5a!==null?_0x386c5a['length']>0xc350?_0x386c5a['substring'](0x0,0xc350)+_0x32dbaf(0x13b)+_0x386c5a[_0x32dbaf(0xab)]+'\x20chars)':_0x386c5a:_0x32dbaf(0x17c)+(_0x4c0b53||_0x32dbaf(0x149))+']','original_code_length':_0x386c5a?.[_0x32dbaf(0xab)]??0x0,'model':_0x32dbaf(0x115),'dry_run':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x184)]}},'stack_trace':_0x290644 instanceof Error?_0x290644[_0x32dbaf(0xeb)]:undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x3bfd96}],'isError':!![]};}}case _0x32dbaf(0xcc):{const _0x3619fe=WarpGrepArgsSchema[_0x32dbaf(0xaa)](_0x1066ed);if(!_0x3619fe['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x3619fe[_0x32dbaf(0xd3)]}],'isError':!![]};const _0x175a7e=_0x1c69b0=>{const _0x5bf4a4=_0x32dbaf,_0x16d8fb=[];for(const _0x5feb14 of _0x1c69b0||[]){const _0x3701cc=_0x5feb14['role'],_0xd8e28=_0x5feb14['content'];if(_0x3701cc===_0x5bf4a4(0x142)&&_0xd8e28){const _0x199790=_0xd8e28['split']('\x0a')[_0x5bf4a4(0x179)](_0x45af79=>_0x45af79[_0x5bf4a4(0x139)]());for(const _0x45252f of _0x199790){const _0x4a4d09=_0x45252f['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x4a4d09){_0x16d8fb[_0x5bf4a4(0xa4)](_0x5bf4a4(0x14a)+_0x4a4d09[0x1]+'\x27\x20'+_0x4a4d09[0x2]);continue;}const _0x1a3f44=_0x45252f[_0x5bf4a4(0x117)](/^read\s+(.+)$/);if(_0x1a3f44){_0x16d8fb[_0x5bf4a4(0xa4)](_0x5bf4a4(0x16b)+_0x1a3f44[0x1]);continue;}const _0x38acae=_0x45252f[_0x5bf4a4(0x117)](/^list_directory\s+(.+)$/);if(_0x38acae){_0x16d8fb[_0x5bf4a4(0xa4)]('list_directory\x20'+_0x38acae[0x1]);continue;}}}}return _0x16d8fb;};try{const _0xefa848=a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)]),_0x1cf845=new LocalRipgrepProvider(_0xefa848),_0x122c1a=await runWarpGrep({'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'repoRoot':_0xefa848,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'provider':_0x1cf845});let _0x150814='';if(_0x122c1a[_0x32dbaf(0x10f)]==='completed'&&_0x122c1a['finish']?.[_0x32dbaf(0x133)]?.[_0x32dbaf(0x12c)]){const _0x5cb1bd=_0x122c1a['finish'][_0x32dbaf(0x133)][_0x32dbaf(0x12c)],_0x456174=[],_0x468ae2=[_0x32dbaf(0x126)];for(const _0x266142 of _0x122c1a[_0x32dbaf(0x178)]){const _0x2fa9ad=_0x266142['role'],_0x2dc6a1=_0x266142[_0x32dbaf(0xa2)];if(_0x2fa9ad==='assistant'&&_0x2dc6a1){const _0x3ec2f8=_0x2dc6a1[_0x32dbaf(0x17f)]('\x0a')['filter'](_0x307c0a=>_0x307c0a[_0x32dbaf(0x139)]());for(const _0x31ad6e of _0x3ec2f8){const _0x5de0f4=_0x31ad6e[_0x32dbaf(0x117)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x5de0f4){_0x468ae2[_0x32dbaf(0xa4)](_0x32dbaf(0xf1)+_0x5de0f4[0x1]+_0x32dbaf(0x168)+_0x5de0f4[0x2]+'`');continue;}const _0x23d5e8=_0x31ad6e['match'](/^read\s+(.+)$/);if(_0x23d5e8){_0x468ae2[_0x32dbaf(0xa4)](_0x32dbaf(0xae)+_0x23d5e8[0x1]+'`');continue;}const _0xe9ad54=_0x31ad6e[_0x32dbaf(0x117)](/^list_directory\s+(.+)$/);if(_0xe9ad54){_0x468ae2[_0x32dbaf(0xa4)](_0x32dbaf(0x127)+_0xe9ad54[0x1]+'`');continue;}}}}_0x456174[_0x32dbaf(0xa4)](_0x468ae2[_0x32dbaf(0x120)]('\x0a'));const _0x457e75=['',_0x32dbaf(0xd9)];for(const _0x39319d of _0x5cb1bd){if(_0x39319d[_0x32dbaf(0xf9)]==='*')_0x457e75[_0x32dbaf(0xa4)]('-\x20'+_0x39319d[_0x32dbaf(0x156)]+':*');else{if(Array['isArray'](_0x39319d[_0x32dbaf(0xf9)])){const _0x5dc90f=_0x39319d[_0x32dbaf(0xf9)][_0x32dbaf(0x124)](([_0x2305d6,_0x749bc5])=>{if(_0x2305d6===_0x749bc5)return''+_0x2305d6;return _0x2305d6+'-'+_0x749bc5;});_0x457e75[_0x32dbaf(0xa4)]('-\x20'+_0x39319d[_0x32dbaf(0x156)]+':'+_0x5dc90f[_0x32dbaf(0x120)](','));}else _0x457e75[_0x32dbaf(0xa4)]('-\x20'+_0x39319d['path']+':*');}}_0x457e75[_0x32dbaf(0xa4)](''),_0x456174[_0x32dbaf(0xa4)](_0x457e75[_0x32dbaf(0x120)]('\x0a')),_0x456174[_0x32dbaf(0xa4)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x54ab9f=[];for(const _0x5cd529 of _0x5cb1bd){let _0xebf57f=a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],_0x5cd529[_0x32dbaf(0x156)]),_0x1246e3=null,_0x2a40ed=null;try{_0x1246e3=await a0_0x4e9f2c[_0x32dbaf(0x181)](_0xebf57f,{'encoding':_0x32dbaf(0x119)});}catch(_0x5c47ab){const _0x5cc114=fixPathRepetition(_0xebf57f);if(_0x5cc114)try{_0x1246e3=await a0_0x4e9f2c[_0x32dbaf(0x181)](_0x5cc114,{'encoding':_0x32dbaf(0x119)}),_0xebf57f=_0x5cc114;}catch{_0x2a40ed=_0x5c47ab instanceof Error?_0x5c47ab:new Error(String(_0x5c47ab));}else _0x2a40ed=_0x5c47ab instanceof Error?_0x5c47ab:new Error(String(_0x5c47ab));}if(_0x1246e3!==null){const _0x7437bd=_0x1246e3['split'](/\r?\n/),_0x266bc1=[_0x32dbaf(0xd1)+_0x5cd529[_0x32dbaf(0x156)]+'\x22>'];if(_0x5cd529[_0x32dbaf(0xf9)]==='*'||!Array[_0x32dbaf(0x15d)](_0x5cd529['lines']))for(let _0x390483=0x1;_0x390483<=_0x7437bd[_0x32dbaf(0xab)];_0x390483++){const _0x5c43d3=_0x7437bd[_0x390483-0x1];_0x266bc1[_0x32dbaf(0xa4)](_0x390483+'|\x20'+_0x5c43d3);}else for(const [_0x575fbe,_0x1cb46d]of _0x5cd529[_0x32dbaf(0xf9)]){_0x266bc1['length']>0x1&&_0x266bc1[_0x32dbaf(0xa4)]('');for(let _0x3f5b6f=_0x575fbe;_0x3f5b6f<=_0x1cb46d&&_0x3f5b6f<=_0x7437bd[_0x32dbaf(0xab)];_0x3f5b6f++){const _0x3b9745=_0x7437bd[_0x3f5b6f-0x1];_0x266bc1[_0x32dbaf(0xa4)](_0x3f5b6f+'|\x20'+_0x3b9745);}}_0x266bc1[_0x32dbaf(0xa4)](_0x32dbaf(0x17d)),_0x54ab9f[_0x32dbaf(0xa4)](_0x266bc1[_0x32dbaf(0x120)]('\x0a'));}else _0x54ab9f[_0x32dbaf(0xa4)](_0x32dbaf(0xd1)+_0x5cd529['path']+_0x32dbaf(0xb4)+(_0x2a40ed?.[_0x32dbaf(0xc3)]||_0x32dbaf(0xa7))+_0x32dbaf(0xf0));}_0x456174[_0x32dbaf(0xa4)](_0x54ab9f[_0x32dbaf(0x120)]('\x0a\x0a')),_0x150814=_0x456174[_0x32dbaf(0x120)]('\x0a');const _0x592ddd=_0x122c1a[_0x32dbaf(0x136)]?.[_0x32dbaf(0x179)](_0x13a97f=>_0x13a97f[_0x32dbaf(0xc3)]?.['startsWith'](_0x32dbaf(0xc1)))||[];if(_0x592ddd[_0x32dbaf(0xab)]>0x0){const _0x594d25=_0x592ddd['map'](_0x5af9cc=>_0x5af9cc['message'])[_0x32dbaf(0x120)](';\x20');reportMorphError({'error_message':_0x594d25,'error_type':_0x32dbaf(0x13c),'context':{'tool':_0x32dbaf(0xcc),'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'model':_0x32dbaf(0xf5),'termination_reason':_0x32dbaf(0xed),'error_count':_0x592ddd['length'],'is_timeout':![],'files_attempted':_0x5cb1bd['map'](_0x545342=>({'path':_0x545342[_0x32dbaf(0x156)],'lines':_0x545342[_0x32dbaf(0xf9)]})),'tool_calls':_0x175a7e(_0x122c1a[_0x32dbaf(0x178)]),'messages':_0x122c1a['messages']?.[_0x32dbaf(0x124)](_0x2a325c=>({'role':_0x2a325c[_0x32dbaf(0xba)],'content':_0x2a325c['content']})),'request_content':{'query':_0x3619fe['data'][_0x32dbaf(0xb7)],'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'repoRoot':a0_0x1442c6['resolve'](_0x3619fe[_0x32dbaf(0x13a)]['repo_path']),'model':_0x32dbaf(0xf5)}},'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{});}}else{if(_0x122c1a[_0x32dbaf(0x10f)]===_0x32dbaf(0x114)&&_0x122c1a['errors']['length']>0x0){const _0x3bc5f3=_0x122c1a[_0x32dbaf(0x136)][_0x32dbaf(0x124)](_0x4c43c6=>_0x4c43c6[_0x32dbaf(0xc3)])[_0x32dbaf(0x120)](';\x20');_0x150814='Error:\x20'+_0x3bc5f3;const _0x5abe93=_0x3bc5f3[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0x110))||_0x3bc5f3[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0x102))||_0x3bc5f3[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0xa9)),_0x57302d=_0x122c1a[_0x32dbaf(0x15a)]?.[_0x32dbaf(0x133)]?.[_0x32dbaf(0x12c)],_0x86071=_0x122c1a[_0x32dbaf(0x136)][0x0];reportMorphError({'error_message':_0x3bc5f3,'error_type':_0x5abe93?_0x32dbaf(0xb3):_0x86071?.[_0x32dbaf(0xdc)]?.['name']||'WarpGrepError','context':{'tool':'warpgrep_codebase_search','repo_path':_0x3619fe['data']['repo_path'],'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x122c1a[_0x32dbaf(0x10f)],'error_count':_0x122c1a['errors'][_0x32dbaf(0xab)],'is_timeout':_0x5abe93,'files_attempted':_0x57302d?.[_0x32dbaf(0x124)](_0x4a4376=>({'path':_0x4a4376[_0x32dbaf(0x156)],'lines':_0x4a4376['lines']})),'tool_calls':_0x175a7e(_0x122c1a[_0x32dbaf(0x178)]),'messages':_0x122c1a[_0x32dbaf(0x178)]?.[_0x32dbaf(0x124)](_0x5405c7=>({'role':_0x5405c7[_0x32dbaf(0xba)],'content':_0x5405c7['content']})),'request_content':{'query':_0x3619fe[_0x32dbaf(0x13a)]['search_string'],'repo_path':_0x3619fe[_0x32dbaf(0x13a)]['repo_path'],'repoRoot':a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x86071?.[_0x32dbaf(0xeb)]||undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{});}else _0x150814=_0x32dbaf(0x10e);}return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x150814}]};}catch(_0x23a2d0){const _0xf611fa=_0x23a2d0 instanceof Error?_0x23a2d0['message']:String(_0x23a2d0),_0x33f135=_0xf611fa[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0x110))||_0xf611fa['toLowerCase']()[_0x32dbaf(0x166)](_0x32dbaf(0x102))||_0xf611fa[_0x32dbaf(0xad)]()['includes'](_0x32dbaf(0xa9))||_0x23a2d0 instanceof Error&&_0x23a2d0[_0x32dbaf(0x144)]==='TimeoutError';return reportMorphError({'error_message':_0xf611fa,'error_type':_0x33f135?_0x32dbaf(0xb3):_0x23a2d0 instanceof Error?_0x23a2d0[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:_0x32dbaf(0x143),'context':{'tool':_0x32dbaf(0xcc),'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'model':'morph-warp-grep-v1-1111v0','is_timeout':_0x33f135,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x3619fe['data'][_0x32dbaf(0xb7)],'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'repoRoot':a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe['data'][_0x32dbaf(0xdf)]),'model':_0x32dbaf(0xf5)}},'stack_trace':_0x23a2d0 instanceof Error?_0x23a2d0['stack']:undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0x11c)+_0xf611fa}],'isError':![]};}}case _0x32dbaf(0xd0):{const _0x495e8c=CodebaseSearchArgsSchema[_0x32dbaf(0xaa)](_0x1066ed);if(!_0x495e8c[_0x32dbaf(0x153)])return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0xcb)+_0x495e8c['error']}],'isError':!![]};try{const _0x52c143=MORPH_API_KEY;if(!_0x52c143)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x3c3c7a=await executeCodebaseSearch({'query':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0x160)],'target_directories':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0xd5)],'limit':_0x495e8c[_0x32dbaf(0x13a)]['limit']},{'apiKey':_0x52c143,'repoId':_0x495e8c['data']['repoId'],'branch':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0x137)],'commitHash':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0xa1)],'debug':![]});if(!_0x3c3c7a[_0x32dbaf(0x153)])return{'content':[{'type':'text','text':_0x32dbaf(0x106)+_0x3c3c7a['error']}],'isError':!![]};const _0x4890ff=_0x3c3c7a[_0x32dbaf(0xce)][_0x32dbaf(0xab)]===0x0?_0x32dbaf(0x140)+_0x495e8c['data']['query']+'\x22':_0x32dbaf(0x107)+_0x3c3c7a[_0x32dbaf(0xce)]['length']+_0x32dbaf(0x167)+_0x3c3c7a['stats'][_0x32dbaf(0xec)]+'ms:\x0a\x0a'+_0x3c3c7a[_0x32dbaf(0xce)]['map']((_0xd5c00e,_0x511f68)=>_0x511f68+0x1+'.\x20'+_0xd5c00e[_0x32dbaf(0xfc)]+'\x20('+(_0xd5c00e['rerankScore']*0x64)[_0x32dbaf(0x14d)](0x1)+_0x32dbaf(0x13f)+(_0x32dbaf(0x14f)+_0xd5c00e['startLine']+'-'+_0xd5c00e[_0x32dbaf(0x173)]+'\x0a')+(_0x32dbaf(0x17b)+_0xd5c00e[_0x32dbaf(0xa2)][_0x32dbaf(0x151)](0x0,0xc8)+(_0xd5c00e[_0x32dbaf(0xa2)][_0x32dbaf(0xab)]>0xc8?_0x32dbaf(0x15e):'')+'\x0a'))[_0x32dbaf(0x120)]('\x0a');return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x4890ff}]};}catch(_0x1b0bdb){const _0x31f12c=_0x1b0bdb instanceof Error?_0x1b0bdb[_0x32dbaf(0xc3)]:String(_0x1b0bdb);return reportMorphError({'error_message':_0x31f12c,'error_type':_0x1b0bdb instanceof Error?_0x1b0bdb[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:_0x32dbaf(0x143),'context':{'tool':_0x32dbaf(0xd0),'query':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0x160)],'repo_id':_0x495e8c['data']['repoId']},'stack_trace':_0x1b0bdb instanceof Error?_0x1b0bdb[_0x32dbaf(0xeb)]:undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':'Error:\x20'+_0x31f12c}],'isError':!![]};}}default:throw new Error(_0x32dbaf(0x171)+_0x4eb32a);}}catch(_0x59206f){const _0xc91385=_0x59206f instanceof Error?_0x59206f[_0x32dbaf(0xc3)]:String(_0x59206f);return reportMorphError({'error_message':_0xc91385,'error_type':_0x59206f instanceof Error?_0x59206f[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:'UnknownError','context':{'tool':name,'arguments':args?JSON['stringify'](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x32dbaf(0x11f)},'stack_trace':_0x59206f instanceof Error?_0x59206f[_0x32dbaf(0xeb)]:undefined,'source':_0x32dbaf(0xb9)})['catch'](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0x12d)+_0xc91385}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x6681df){const _0x2267ca=a0_0x2878ee,_0x3828ec=await getValidRootDirectories(_0x6681df);if(_0x3828ec[_0x2267ca(0xab)]>0x0)allowedDirectories=[..._0x3828ec],console[_0x2267ca(0xd3)](_0x2267ca(0xe6)+_0x3828ec[_0x2267ca(0xab)]+_0x2267ca(0x16f));else{console[_0x2267ca(0xd3)]('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x4e330d=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4e330d&&(allowedDirectories=[_0x4e330d],console['error']('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4e330d));}catch(_0x446329){console[_0x2267ca(0xd3)](_0x2267ca(0x186)+_0x446329);}}}server[a0_0x2878ee(0x104)](RootsListChangedNotificationSchema,async()=>{const _0x466692=a0_0x2878ee;try{const _0x19e550=await server['listRoots']();_0x19e550&&'roots'in _0x19e550&&await updateAllowedDirectoriesFromRoots(_0x19e550[_0x466692(0xbd)]);}catch(_0xdc24f0){console[_0x466692(0xd3)](_0x466692(0x146),_0xdc24f0 instanceof Error?_0xdc24f0[_0x466692(0xc3)]:String(_0xdc24f0));}}),server[a0_0x2878ee(0xa5)]=async()=>{const _0x1e07a2=a0_0x2878ee,_0xd9bba1=server['getClientCapabilities']();if(_0xd9bba1?.[_0x1e07a2(0xbd)])try{const _0x49cca4=await server[_0x1e07a2(0x150)]();_0x49cca4&&_0x1e07a2(0xbd)in _0x49cca4?await updateAllowedDirectoriesFromRoots(_0x49cca4[_0x1e07a2(0xbd)]):console[_0x1e07a2(0xd3)](_0x1e07a2(0xc8));}catch(_0x261337){console[_0x1e07a2(0xd3)](_0x1e07a2(0x162),_0x261337 instanceof Error?_0x261337[_0x1e07a2(0xc3)]:String(_0x261337));}else{if(allowedDirectories[_0x1e07a2(0xab)]>0x0)console['error'](_0x1e07a2(0x12b),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x1e07a2(0xd3)](_0x1e07a2(0xd7));else throw new Error(_0x1e07a2(0x14b));}}};async function runServer(){const _0x23e9de=a0_0x2878ee,_0x4724e8=new StdioServerTransport();await server['connect'](_0x4724e8),console[_0x23e9de(0xd3)](_0x23e9de(0xb5)),allowedDirectories[_0x23e9de(0xab)]===0x0&&console[_0x23e9de(0xd3)]('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x49d194=>{const _0x48152d=a0_0x2878ee;console[_0x48152d(0xd3)](_0x48152d(0x125),_0x49d194),process[_0x48152d(0xd2)](0x1);});
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a1_0x59d1(){const _0x196c79=['1631xybGVm','trim','11940tLSHOx','slice','substring','2554360GpiQlr','normalize','6903VmfulM','startsWith','charAt','21010pSSziH','4174795CJuDuj','toUpperCase','join','2412702nwGPjI','2671724BCiewS','replace','22013qEsqVV','52wkLAir','match'];a1_0x59d1=function(){return _0x196c79;};return a1_0x59d1();}(function(_0x3da7fe,_0x54014b){const _0x5419cb=a1_0xb2ec,_0x1d4c73=_0x3da7fe();while(!![]){try{const _0xbee275=-parseInt(_0x5419cb(0xfa))/0x1*(parseInt(_0x5419cb(0xfb))/0x2)+parseInt(_0x5419cb(0xf7))/0x3+-parseInt(_0x5419cb(0xf8))/0x4+-parseInt(_0x5419cb(0x108))/0x5+parseInt(_0x5419cb(0xff))/0x6*(parseInt(_0x5419cb(0xfd))/0x7)+-parseInt(_0x5419cb(0x102))/0x8+-parseInt(_0x5419cb(0x104))/0x9*(-parseInt(_0x5419cb(0x107))/0xa);if(_0xbee275===_0x54014b)break;else _0x1d4c73['push'](_0x1d4c73['shift']());}catch(_0x5c35d0){_0x1d4c73['push'](_0x1d4c73['shift']());}}}(a1_0x59d1,0x765f0));function a1_0xb2ec(_0x19c9f2,_0x539478){_0x19c9f2=_0x19c9f2-0xf6;const _0x59d129=a1_0x59d1();let _0xb2ec4f=_0x59d129[_0x19c9f2];return _0xb2ec4f;}import a1_0x4af3f7 from'path';import a1_0x1cf96c from'os';export function convertToWindowsPath(_0x2de552){const _0x1f25c7=a1_0xb2ec;if(_0x2de552[_0x1f25c7(0x105)]('/mnt/')){const _0x4d5822=_0x2de552['charAt'](0x5)[_0x1f25c7(0x109)](),_0x452cc9=_0x2de552[_0x1f25c7(0x100)](0x6)['replace'](/\//g,'\x5c');return _0x4d5822+':'+_0x452cc9;}if(_0x2de552[_0x1f25c7(0xfc)](/^\/[a-zA-Z]\//)){const _0x4af79e=_0x2de552[_0x1f25c7(0x106)](0x1)[_0x1f25c7(0x109)](),_0x395f5a=_0x2de552['slice'](0x2)[_0x1f25c7(0xf9)](/\//g,'\x5c');return _0x4af79e+':'+_0x395f5a;}if(_0x2de552[_0x1f25c7(0xfc)](/^[a-zA-Z]:/))return _0x2de552[_0x1f25c7(0xf9)](/\//g,'\x5c');return _0x2de552;}export function normalizePath(_0xc1cf94){const _0x16e7d5=a1_0xb2ec;_0xc1cf94=_0xc1cf94[_0x16e7d5(0xfe)]()['replace'](/^["']|["']$/g,'');const _0x54f5c9=_0xc1cf94['startsWith']('/')&&!_0xc1cf94[_0x16e7d5(0xfc)](/^\/mnt\/[a-z]\//i)&&!_0xc1cf94[_0x16e7d5(0xfc)](/^\/[a-zA-Z]\//);if(_0x54f5c9)return _0xc1cf94[_0x16e7d5(0xf9)](/\/+/g,'/')[_0x16e7d5(0xf9)](/\/+$/,'');_0xc1cf94=convertToWindowsPath(_0xc1cf94);if(_0xc1cf94[_0x16e7d5(0x105)]('\x5c\x5c')){let _0x2c4330=_0xc1cf94;_0x2c4330=_0x2c4330[_0x16e7d5(0xf9)](/^\\{2,}/,'\x5c\x5c');const _0x376d12=_0x2c4330[_0x16e7d5(0x101)](0x2)[_0x16e7d5(0xf9)](/\\\\/g,'\x5c');_0xc1cf94='\x5c\x5c'+_0x376d12;}else _0xc1cf94=_0xc1cf94[_0x16e7d5(0xf9)](/\\\\/g,'\x5c');let _0xda1ab=a1_0x4af3f7[_0x16e7d5(0x103)](_0xc1cf94);_0xc1cf94['startsWith']('\x5c\x5c')&&!_0xda1ab[_0x16e7d5(0x105)]('\x5c\x5c')&&(_0xda1ab='\x5c'+_0xda1ab);if(_0xda1ab['match'](/^[a-zA-Z]:/)){let _0x35ef02=_0xda1ab[_0x16e7d5(0xf9)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x35ef02)&&(_0x35ef02=_0x35ef02['charAt'](0x0)[_0x16e7d5(0x109)]()+_0x35ef02[_0x16e7d5(0x100)](0x1)),_0x35ef02;}return _0xda1ab[_0x16e7d5(0xf9)](/\//g,'\x5c');}export function expandHome(_0x33cbc4){const _0x58468e=a1_0xb2ec;if(_0x33cbc4[_0x58468e(0x105)]('~/')||_0x33cbc4==='~')return a1_0x4af3f7[_0x58468e(0xf6)](a1_0x1cf96c['homedir'](),_0x33cbc4[_0x58468e(0x100)](0x1));return _0x33cbc4;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a2_0x49c1(){const _0x4f75ee=['51114600eQHRhM','219511YphMju','1629956goFyYi','39iKAnSy','isArray','resolve','includes','startsWith','361604nlNSIH','string','336AgtEfP','10341480huQvtu','Path\x20must\x20be\x20absolute\x20after\x20normalization','normalize','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','length','19632elijUk','6538440FQkxRH','isAbsolute'];a2_0x49c1=function(){return _0x4f75ee;};return a2_0x49c1();}(function(_0x2d81fc,_0x4d0e72){const _0xd33252=a2_0x3202,_0x5a7513=_0x2d81fc();while(!![]){try{const _0x394481=-parseInt(_0xd33252(0x102))/0x1+-parseInt(_0xd33252(0x103))/0x2+parseInt(_0xd33252(0x104))/0x3*(-parseInt(_0xd33252(0x109))/0x4)+-parseInt(_0xd33252(0xff))/0x5+-parseInt(_0xd33252(0xfe))/0x6*(parseInt(_0xd33252(0x10b))/0x7)+-parseInt(_0xd33252(0xf8))/0x8+parseInt(_0xd33252(0x101))/0x9;if(_0x394481===_0x4d0e72)break;else _0x5a7513['push'](_0x5a7513['shift']());}catch(_0x21d488){_0x5a7513['push'](_0x5a7513['shift']());}}}(a2_0x49c1,0xade4d));function a2_0x3202(_0x52fa13,_0xac0d1b){_0x52fa13=_0x52fa13-0xf8;const _0x49c10c=a2_0x49c1();let _0x3202a0=_0x49c10c[_0x52fa13];return _0x3202a0;}import a2_0x5bf8c6 from'path';export function isPathWithinAllowedDirectories(_0x10f087,_0x1e5e3f){const _0x180552=a2_0x3202;if(typeof _0x10f087!==_0x180552(0x10a)||!Array[_0x180552(0x105)](_0x1e5e3f))return![];if(!_0x10f087||_0x1e5e3f[_0x180552(0xfd)]===0x0)return![];if(_0x10f087[_0x180552(0x107)]('\x00'))return![];let _0xa9c9a8;try{_0xa9c9a8=a2_0x5bf8c6[_0x180552(0x106)](a2_0x5bf8c6[_0x180552(0xfa)](_0x10f087));}catch{return![];}if(!a2_0x5bf8c6[_0x180552(0x100)](_0xa9c9a8))throw new Error(_0x180552(0xf9));return _0x1e5e3f['some'](_0x8dff02=>{const _0x2ec9cf=_0x180552;if(typeof _0x8dff02!=='string'||!_0x8dff02)return![];if(_0x8dff02[_0x2ec9cf(0x107)]('\x00'))return![];let _0x5b4204;try{_0x5b4204=a2_0x5bf8c6[_0x2ec9cf(0x106)](a2_0x5bf8c6[_0x2ec9cf(0xfa)](_0x8dff02));}catch{return![];}if(!a2_0x5bf8c6['isAbsolute'](_0x5b4204))throw new Error(_0x2ec9cf(0xfb));if(_0xa9c9a8===_0x5b4204)return!![];if(_0x5b4204===a2_0x5bf8c6[_0x2ec9cf(0xfc)])return _0xa9c9a8[_0x2ec9cf(0x108)](a2_0x5bf8c6[_0x2ec9cf(0xfc)]);return _0xa9c9a8[_0x2ec9cf(0x108)](_0x5b4204+a2_0x5bf8c6[_0x2ec9cf(0xfc)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a3_0x2870(){const _0x542170=['1327660mAKZfn','isDirectory','1654494LFORJX','startsWith','invalid\x20path\x20or\x20inaccessible','push','error','636666bXGSJh','315zZcrHn','file://','38oHsFFW','slice','message','resolve','63ifDhfr','6765250gbLEwP','homedir','uri','2374164fqnwao','non-directory\x20root','stat','73919FDEgpa','join','Skipping\x20invalid\x20directory:\x20','realpath','1029032wZPblx'];a3_0x2870=function(){return _0x542170;};return a3_0x2870();}(function(_0x5dfe8c,_0x2188e0){const _0x469d47=a3_0xa08f,_0x27ff30=_0x5dfe8c();while(!![]){try{const _0x544c38=-parseInt(_0x469d47(0x1eb))/0x1*(parseInt(_0x469d47(0x1fa))/0x2)+-parseInt(_0x469d47(0x1f2))/0x3+parseInt(_0x469d47(0x1e8))/0x4+-parseInt(_0x469d47(0x1ff))/0x5+parseInt(_0x469d47(0x1f7))/0x6+-parseInt(_0x469d47(0x1fe))/0x7*(parseInt(_0x469d47(0x1ef))/0x8)+-parseInt(_0x469d47(0x1f8))/0x9*(-parseInt(_0x469d47(0x1f0))/0xa);if(_0x544c38===_0x2188e0)break;else _0x27ff30['push'](_0x27ff30['shift']());}catch(_0x56c976){_0x27ff30['push'](_0x27ff30['shift']());}}}(a3_0x2870,0xd6cb0));import{promises as a3_0x33ee92}from'fs';import a3_0x10955e from'path';import a3_0x25e3fe from'os';function a3_0xa08f(_0x4ddd62,_0x146e4d){_0x4ddd62=_0x4ddd62-0x1e8;const _0x287046=a3_0x2870();let _0xa08fa7=_0x287046[_0x4ddd62];return _0xa08fa7;}import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x46b2ff){const _0x347d4e=a3_0xa08f;try{const _0x5c7d6f=_0x46b2ff[_0x347d4e(0x1f3)](_0x347d4e(0x1f9))?_0x46b2ff[_0x347d4e(0x1fb)](0x7):_0x46b2ff,_0x3ae253=_0x5c7d6f[_0x347d4e(0x1f3)]('~/')||_0x5c7d6f==='~'?a3_0x10955e[_0x347d4e(0x1ec)](a3_0x25e3fe[_0x347d4e(0x200)](),_0x5c7d6f[_0x347d4e(0x1fb)](0x1)):_0x5c7d6f,_0x18c684=a3_0x10955e[_0x347d4e(0x1fd)](_0x3ae253),_0x4629f7=await a3_0x33ee92[_0x347d4e(0x1ee)](_0x18c684);return normalizePath(_0x4629f7);}catch{return null;}}function formatDirectoryError(_0x248c4e,_0xb77965,_0xc2b7d3){const _0x5051a7=a3_0xa08f;if(_0xc2b7d3)return'Skipping\x20'+_0xc2b7d3+':\x20'+_0x248c4e;const _0x27919=_0xb77965 instanceof Error?_0xb77965[_0x5051a7(0x1fc)]:String(_0xb77965);return _0x5051a7(0x1ed)+_0x248c4e+'\x20due\x20to\x20error:\x20'+_0x27919;}export async function getValidRootDirectories(_0x3cde9b){const _0x2e18d7=a3_0xa08f,_0x41c17f=[];for(const _0x57d6ec of _0x3cde9b){const _0x57009d=await parseRootUri(_0x57d6ec[_0x2e18d7(0x201)]);if(!_0x57009d){console[_0x2e18d7(0x1f6)](formatDirectoryError(_0x57d6ec[_0x2e18d7(0x201)],undefined,_0x2e18d7(0x1f4)));continue;}try{const _0xba2d0=await a3_0x33ee92[_0x2e18d7(0x1ea)](_0x57009d);_0xba2d0[_0x2e18d7(0x1f1)]()?_0x41c17f[_0x2e18d7(0x1f5)](_0x57009d):console[_0x2e18d7(0x1f6)](formatDirectoryError(_0x57009d,undefined,_0x2e18d7(0x1e9)));}catch(_0x493aa9){console[_0x2e18d7(0x1f6)](formatDirectoryError(_0x57009d,_0x493aa9));}}return _0x41c17f;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.51",
|
|
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)",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google/generative-ai": "^0.21.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
38
|
-
"@morphllm/morphsdk": "0.2.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.80",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|