@morphllm/morphmcp 0.8.178 → 0.8.180
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 +3 -3
- package/dist/index.js +1 -1
- package/dist/log-utils.js +1 -1
- package/dist/logger.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/dist/tool-definitions.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ All three tools are always exposed. Clients can manage tool visibility on their
|
|
|
17
17
|
### Claude Code
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
claude mcp add morph-mcp -e MORPH_API_KEY=sk-xxx -- npx -y @morphllm/morphmcp
|
|
20
|
+
claude mcp add morph-mcp -e MORPH_API_KEY=sk-xxx -- npx --prefer-offline -y @morphllm/morphmcp
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Cursor
|
|
@@ -29,7 +29,7 @@ Add to `.cursor/mcp.json`:
|
|
|
29
29
|
"mcpServers": {
|
|
30
30
|
"morph-mcp": {
|
|
31
31
|
"command": "npx",
|
|
32
|
-
"args": ["-y", "@morphllm/morphmcp"],
|
|
32
|
+
"args": ["--prefer-offline", "-y", "@morphllm/morphmcp"],
|
|
33
33
|
"env": {
|
|
34
34
|
"MORPH_API_KEY": "sk-xxx"
|
|
35
35
|
}
|
|
@@ -48,7 +48,7 @@ Add to `.vscode/mcp.json`:
|
|
|
48
48
|
"servers": {
|
|
49
49
|
"morph-mcp": {
|
|
50
50
|
"command": "npx",
|
|
51
|
-
"args": ["-y", "@morphllm/morphmcp"],
|
|
51
|
+
"args": ["--prefer-offline", "-y", "@morphllm/morphmcp"],
|
|
52
52
|
"env": {
|
|
53
53
|
"MORPH_API_KEY": "sk-xxx"
|
|
54
54
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x16ed94=a0_0x7395;(function(_0x2fc6a1,_0x599e73){const _0x35f16b=a0_0x7395,_0x378041=_0x2fc6a1();while(!![]){try{const _0xe9f43=-parseInt(_0x35f16b(0x192))/0x1+-parseInt(_0x35f16b(0x18b))/0x2*(parseInt(_0x35f16b(0x1e2))/0x3)+-parseInt(_0x35f16b(0x1fe))/0x4*(parseInt(_0x35f16b(0x114))/0x5)+-parseInt(_0x35f16b(0xfa))/0x6+parseInt(_0x35f16b(0x19c))/0x7*(parseInt(_0x35f16b(0x120))/0x8)+parseInt(_0x35f16b(0x156))/0x9*(parseInt(_0x35f16b(0x180))/0xa)+parseInt(_0x35f16b(0x1ad))/0xb;if(_0xe9f43===_0x599e73)break;else _0x378041['push'](_0x378041['shift']());}catch(_0x56bca1){_0x378041['push'](_0x378041['shift']());}}}(a0_0x50c8,0xa0ef5));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x50c8(){const _0x3f3e0a=['\x20\x20morph-mcp','target_file','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','requiresApiKey','message','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','basename','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Morph\x20Edit\x20Preview','Unknown\x20error','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','BinaryFile','morph-warp-grep-v2.1','some','tool_call_complete','constructor','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','describe','response','api_request_start','FileReadError','UnknownError','<file\x20path=\x22','[github_codebase_search]\x20Done\x20in\x20','file_read_complete','description','lines','ReadError','\x20is\x20not\x20a\x20directory','\x22.\x20Known\x20tools:\x20','readFile','github_search_start','finish','0.2.0','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','warn','Fatal\x20error\x20running\x20server:','content','../package.json','424420JurlbK','-\x20Read\x20file\x20`','dirname','SymlinkError','Parent\x20directory\x20does\x20not\x20exist:\x20','tool_call_received','glob','stack','MORPH_API_KEY','Rules:\x0a','Disabled\x20tools:\x20','394eTkicn','LocalRipgrepProvider','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.',',\x20removed\x20','optional','read','compaction_failed','327272tCyHJE','slice','includes','data','isArray','timeout','min','false','-\x20Grepped\x20\x27','completionId','1217090daRRUh','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.','function','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','cwd','sep','exit','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','list_directory','timed\x20out','Created\x20File','morph-v3-fast','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','Morph\x20FastApply\x20failed\x20without\x20error\x20message','warp_grep_complete','stringify','9573982VrGtYG','path_validation_resolved','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','MORPH_WARP_GREP_TIMEOUT','trim','user','Unknown\x20tool:\x20','EDIT_FILE','tool_call_id','realpath','path','debug','search_type','-\x20Preserve\x20exact\x20indentation\x0a','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','inputSchema','setRequestHandler','Warning:\x20Workspace\x20fallback\x20failed:\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Relevant\x20context\x20found:','join','api-key','\x0a...\x20(truncated,\x20total:\x20','SubToolError','split','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','[github_codebase_search]\x20Failed\x20in\x20','.\x20Changes:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','PWD','metadata','TimeoutError','Bearer\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','morph-v3-large','push','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','post','instruction','--api-key=','completed_with_file_errors','Tool\x20\x22','resolve','API\x20error\x20(auth/rate-limit)','package.json','file_path','branch','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','code','ENABLE_WORKSPACE_MODE','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','[could\x20not\x20read\x20file:\x20','tool_calls','2355mYOQjn','text','ToolException','ms.\x20Success:\x20','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','turns','files','RipgrepError','codebase_search','Workspace\x20mode\x20enabled:\x20Using\x20','Error:\x20','now','\x20chars)','new_string','unknown\x20error','file','dryRun','connect','filter','safeParse','\x20valid\x20directories','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Error\x20accessing\x20directory\x20','\x0aExamples:','catch','\x20(new\x20file)','startsWith','Parameters:\x0a','104OeTfFs','ms:','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','tsconfig.json','match','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','grep','node_modules','--api-key','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','argv','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','.cursor','unknown','etimedout','arguments','toLowerCase','linesModified','GITHUB_CODEBASE_SEARCH','stat','grep_search','context','searchGitHub','number','Warning:\x20','terminationReason','error','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x0a</file>','default','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','sk-','MORPH_LARGE_APPLY','`\x20in\x20`','read\x20','pattern','env','linesRemoved','instructions','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','\x22>\x0aError\x20reading\x20file:\x20','roots','success','922368GsugcS','string','added\x20','status','edit','\x20-\x20','.vscode','every','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','messages','all','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','isDirectory','name','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','Here\x20is\x20the\x20content\x20of\x20files:\x0a','length','Failed\x20to\x20read\x20file:\x20','github_url','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','pyproject.toml','assistant','DISABLED_TOOLS','225095eBCNxU','File\x20read\x20error:','@morphllm/morphmcp\x20','PathError','owner_repo','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','provider_created','composer.json','Tool\x20','search_string','morph-','mcp-filesystem','48jruWLh','Example\x20format:\x0a','FileNotFound','path_validation_start','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','repo_path','--version','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','code_edit','linesAdded','completed','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','MCP','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','tool','command','Max\x20results\x20to\x20return','role','getClientCapabilities','\x20as\x20allowed\x20directory','payload','path_validation_failed','errors','object','Applied','has','parse','-\x20Glob\x20search\x20`','file_read_failed','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','utf-8','.\x20Path:\x20','.git','listRoots','timings','log','edit_file','\x22>\x0a',',\x20modified\x20','github_codebase_search','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','map','Preview\x20changes\x20without\x20applying\x20them.','Fallback:\x20Using\x20workspace\x20root\x20','GitHub\x20search\x20failed:\x20','application/json','runWarpGrep_call','changes','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','enum','size','WarpGrepError','tool_call_error','117chrZzc','\x0aOptions:','MORPH_API_URL'];a0_0x50c8=function(){return _0x3f3e0a;};return a0_0x50c8();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x38b0cc from'fs/promises';import a0_0x37f788 from'path';import a0_0x5afb28 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x30afef from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x193ee6){const _0x59749a=a0_0x7395,_0xec1203=_0x193ee6[_0x59749a(0x1c5)](a0_0x37f788[_0x59749a(0x1a1)])['filter'](Boolean);if(_0xec1203[_0x59749a(0x10c)]<0x2)return null;for(let _0x225f53=Math['floor'](_0xec1203['length']/0x2);_0x225f53>=0x1;_0x225f53--){for(let _0x255ff3=0x0;_0x255ff3<=_0xec1203[_0x59749a(0x10c)]-0x2*_0x225f53;_0x255ff3++){const _0x4e8fe5=_0xec1203[_0x59749a(0x193)](_0x255ff3,_0x255ff3+_0x225f53),_0x92299f=_0xec1203[_0x59749a(0x193)](_0x255ff3+_0x225f53,_0x255ff3+0x2*_0x225f53);if(_0x4e8fe5[_0x59749a(0x101)]((_0x11a781,_0x49f09f)=>_0x11a781===_0x92299f[_0x49f09f])){const _0x4de80a=[..._0xec1203[_0x59749a(0x193)](0x0,_0x255ff3),..._0xec1203[_0x59749a(0x193)](_0x255ff3+_0x225f53)];return a0_0x37f788['sep']+_0x4de80a[_0x59749a(0x1c1)](a0_0x37f788[_0x59749a(0x1a1)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4081ef=a0_0x7395;try{const _0x3a31c8=require(_0x4081ef(0x17f));return _0x3a31c8['version']??'unknown';}catch(_0xa176ea){return logMcpStderr(_0x4081ef(0x1af),_0xa176ea),_0x4081ef(0x20b);}}function printHelp(){const _0x259e42=a0_0x7395;console[_0x259e42(0x143)](_0x259e42(0x116)+getPackageVersion()),console['log']('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x259e42(0x143)](_0x259e42(0x157)),console[_0x259e42(0x143)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x259e42(0x143)](_0x259e42(0x119)),console[_0x259e42(0x143)](_0x259e42(0x12b)),console[_0x259e42(0x143)](_0x259e42(0x1f9)),console[_0x259e42(0x143)](_0x259e42(0x159)),console[_0x259e42(0x143)](_0x259e42(0x10f));}const cliArgs=process[a0_0x16ed94(0x208)][a0_0x16ed94(0x193)](0x2),VERSION_FLAGS=new Set([a0_0x16ed94(0x126),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);function a0_0x7395(_0x27fade,_0xa201a2){_0x27fade=_0x27fade-0xde;const _0x50c8e1=a0_0x50c8();let _0x73953c=_0x50c8e1[_0x27fade];return _0x73953c;}cliArgs[a0_0x16ed94(0x166)](_0x68aa60=>VERSION_FLAGS[a0_0x16ed94(0x139)](_0x68aa60))&&(console[a0_0x16ed94(0x143)]('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x16ed94(0x1a2)](0x0));cliArgs[a0_0x16ed94(0x166)](_0x3f5598=>HELP_FLAGS['has'](_0x3f5598))&&(printHelp(),process[a0_0x16ed94(0x1a2)](0x0));function getCliArg(_0x1ac624){const _0x585664=a0_0x16ed94;for(let _0x15d3ea=0x0;_0x15d3ea<cliArgs[_0x585664(0x10c)];_0x15d3ea++){const _0x52d6be=cliArgs[_0x15d3ea];if(_0x52d6be['startsWith']('--'+_0x1ac624+'='))return _0x52d6be[_0x585664(0x193)](('--'+_0x1ac624+'=')[_0x585664(0x10c)]);if(_0x52d6be==='--'+_0x1ac624&&_0x15d3ea+0x1<cliArgs[_0x585664(0x10c)])return cliArgs[_0x15d3ea+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x16ed94(0x10c)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x16ed94(0x139)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x16ed94(0x1fc)](a0_0x16ed94(0x1d4)))continue;if(arg===a0_0x16ed94(0x206)){i++;continue;}args[a0_0x16ed94(0x1d0)](arg);}const WORKSPACE_ROOT=process[a0_0x16ed94(0xf3)]['WORKSPACE_ROOT']||process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x1ca)]||process[a0_0x16ed94(0x1a0)](),ENABLE_WORKSPACE_MODE=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x1de)]!=='false',MORPH_API_KEY=getCliArg(a0_0x16ed94(0x1c2))??process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x188)],MORPH_API_URL=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x158)],MORPH_LARGE_APPLY=process['env'][a0_0x16ed94(0xef)]!==a0_0x16ed94(0x199),MORPH_WARP_GREP_TIMEOUT=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x1b0)]?parseInt(process['env'][a0_0x16ed94(0x1b0)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x113)]?new Set(process[a0_0x16ed94(0xf3)]['DISABLED_TOOLS'][a0_0x16ed94(0x1c5)](',')[a0_0x16ed94(0x14a)](_0x440f82=>_0x440f82[a0_0x16ed94(0x1b1)]())[a0_0x16ed94(0x1f4)](_0x4502cd=>_0x4502cd['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x16ed94(0x153)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x16ed94(0x139)](tool)&&console[a0_0x16ed94(0xe9)](a0_0x16ed94(0xf6)+tool+a0_0x16ed94(0x176)+[...KNOWN_TOOL_NAMES][a0_0x16ed94(0x1c1)](',\x20'));}console[a0_0x16ed94(0xe9)](a0_0x16ed94(0x18a)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x16ed94(0x1fc)](a0_0x16ed94(0xee))&&!MORPH_API_KEY[a0_0x16ed94(0x1fc)](a0_0x16ed94(0x11e))&&logMcpStderr(a0_0x16ed94(0x124));async function reportMorphError(_0x15429b){const _0x137816=a0_0x16ed94;try{await a0_0x30afef[_0x137816(0x1d2)]('https://morphllm.com/api/error-report',{..._0x15429b,'timestamp':new Date()['toISOString'](),'source':_0x15429b['source']||_0x137816(0x11f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x15429b[_0x137816(0xe4)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x137816(0x14e),'Authorization':_0x137816(0x1cd)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x56fd8a,_0x897e95){const _0x3cd348=a0_0x16ed94;if(_0x56fd8a&&typeof _0x56fd8a==='object'&&'status'in _0x56fd8a)return _0x56fd8a['status'];if(_0x56fd8a&&typeof _0x56fd8a===_0x3cd348(0x137)&&'response'in _0x56fd8a)return _0x56fd8a[_0x3cd348(0x16b)]?.[_0x3cd348(0xfd)];const _0x933e72=_0x897e95[_0x3cd348(0x202)](/\b(401|429)\b/);return _0x933e72?parseInt(_0x933e72[0x1],0xa):null;}function handleMorphAPIError(_0x487e0b){const _0x131355=a0_0x16ed94,_0x30ab0c=_0x487e0b instanceof Error?_0x487e0b[_0x131355(0x15d)]:String(_0x487e0b),_0x3c7f38=extractStatusCode(_0x487e0b,_0x30ab0c);switch(_0x3c7f38){case 0x191:return{'content':[{'type':'text','text':'Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x131355(0x1a4)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x16ed94(0xea)),logMcpStderr(a0_0x16ed94(0x209)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x16ed94(0x15e)),logMcpStderr(a0_0x16ed94(0x102)));function normalizePath(_0x6896e8){return a0_0x37f788['normalize'](_0x6896e8);}function expandHome(_0x5d8e90){const _0x52435f=a0_0x16ed94;if(_0x5d8e90[_0x52435f(0x1fc)]('~/')||_0x5d8e90==='~')return a0_0x37f788['join'](a0_0x5afb28['homedir'](),_0x5d8e90['slice'](0x1));return _0x5d8e90;}let allowedDirectories=await Promise[a0_0x16ed94(0x105)](args['map'](async _0xa3e7d1=>{const _0x397974=a0_0x16ed94,_0x24150c=expandHome(_0xa3e7d1),_0x2f86a8=a0_0x37f788[_0x397974(0x1d7)](_0x24150c);try{const _0x2f050b=await a0_0x38b0cc['realpath'](_0x2f86a8);return normalizePath(_0x2f050b);}catch(_0x7079ba){return normalizePath(_0x2f86a8);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x16ed94(0x10c)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x16ed94(0x1d0)](workspaceDir),logMcpStderr(a0_0x16ed94(0x1eb)+workspaceDir+a0_0x16ed94(0x133)));}catch(a0_0x56c65c){logMcpStderr(a0_0x16ed94(0x160)+a0_0x56c65c);}async function detectWorkspaceRoot(_0x41da66){const _0x1b8582=a0_0x16ed94;let _0x332bec=a0_0x37f788[_0x1b8582(0x1d7)](_0x41da66);const _0x5d53a6=[_0x1b8582(0x140),_0x1b8582(0x100),_0x1b8582(0x1d9),'Cargo.toml',_0x1b8582(0x111),'go.mod',_0x1b8582(0x20a),_0x1b8582(0x201),_0x1b8582(0x11b)];while(_0x332bec!==a0_0x37f788[_0x1b8582(0x182)](_0x332bec)){for(const _0x7b01b8 of _0x5d53a6){const _0x1b6a04=a0_0x37f788['join'](_0x332bec,_0x7b01b8);try{return await a0_0x38b0cc['access'](_0x1b6a04),normalizePath(_0x332bec);}catch{}}_0x332bec=a0_0x37f788[_0x1b8582(0x182)](_0x332bec);}return normalizePath(_0x41da66);}await Promise[a0_0x16ed94(0x105)](args[a0_0x16ed94(0x14a)](async _0x19c514=>{const _0x2c0c5b=a0_0x16ed94;try{const _0x2ca649=await a0_0x38b0cc[_0x2c0c5b(0xe2)](expandHome(_0x19c514));!_0x2ca649[_0x2c0c5b(0x107)]()&&(logMcpStderr(_0x2c0c5b(0x1ec)+_0x19c514+_0x2c0c5b(0x175)),process[_0x2c0c5b(0x1a2)](0x1));}catch(_0x1d64df){logMcpStderr(_0x2c0c5b(0x1f8)+_0x19c514+':',_0x1d64df),process[_0x2c0c5b(0x1a2)](0x1);}}));async function validatePath(_0x30d4d7){const _0x2830ec=a0_0x16ed94,_0x40ea0b=expandHome(_0x30d4d7),_0x36251b=a0_0x37f788[_0x2830ec(0x1d7)](_0x40ea0b);logger[_0x2830ec(0x1b8)](_0x2830ec(0x12c),_0x2830ec(0x123),{'raw_path':_0x30d4d7,'absolute':_0x36251b});try{const _0x58298f=await a0_0x38b0cc[_0x2830ec(0x1b6)](_0x36251b);return logger['debug'](_0x2830ec(0x12c),_0x2830ec(0x1ae),{'resolved':_0x58298f,'symlink':_0x58298f!==_0x36251b}),_0x58298f;}catch(_0x409c09){if(_0x409c09[_0x2830ec(0x1dd)]==='ENOENT'){const _0xad2201=a0_0x37f788[_0x2830ec(0x182)](_0x36251b);try{const _0x885fe5=await a0_0x38b0cc['realpath'](_0xad2201),_0x21a7b2=a0_0x37f788['join'](_0x885fe5,a0_0x37f788[_0x2830ec(0x15f)](_0x36251b));return logger[_0x2830ec(0x1b8)](_0x2830ec(0x12c),_0x2830ec(0x1ae),{'resolved':_0x21a7b2,'new_file':!![]}),_0x21a7b2;}catch{logger['error'](_0x2830ec(0x12c),_0x2830ec(0x135),{'raw_path':_0x30d4d7,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0xad2201});throw new Error(_0x2830ec(0x184)+_0xad2201);}}logger[_0x2830ec(0xe9)](_0x2830ec(0x12c),'path_validation_failed',{'raw_path':_0x30d4d7,'error':_0x409c09['message']});throw _0x409c09;}}const MorphEditFileArgsSchema=z[a0_0x16ed94(0x137)]({'path':z['string'](),'code_edit':z['string']()[a0_0x16ed94(0x16a)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z['string']()['describe'](a0_0x16ed94(0x18d)),'dryRun':z['boolean']()['default'](![])['describe'](a0_0x16ed94(0x14b))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x16ed94(0x10a),WarpGrepArgsSchema=z[a0_0x16ed94(0x137)]({'search_string':z['string']()[a0_0x16ed94(0x16a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x16ed94(0x16a)]('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'),'search_type':z[a0_0x16ed94(0x152)](['default',a0_0x16ed94(0x205)])['optional']()['describe'](a0_0x16ed94(0x127))}),WarpGrepGitHubArgsSchema=z[a0_0x16ed94(0x137)]({'search_string':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x16a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x18f)]()[a0_0x16ed94(0x16a)](a0_0x16ed94(0x148)),'owner_repo':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x18f)]()['describe']('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x18f)]()[a0_0x16ed94(0x16a)](a0_0x16ed94(0x1bf))}),CodebaseSearchArgsSchema=z[a0_0x16ed94(0x137)]({'query':z['string']()[a0_0x16ed94(0x16a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x16ed94(0x16a)]('Repository\x20identifier'),'branch':z['string']()['optional']()[a0_0x16ed94(0x16a)](a0_0x16ed94(0x106)),'commitHash':z['string']()[a0_0x16ed94(0x18f)]()[a0_0x16ed94(0x16a)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x16ed94(0xfb)]())[a0_0x16ed94(0xec)]([])['describe'](a0_0x16ed94(0x1bb)),'limit':z[a0_0x16ed94(0xe6)]()['optional']()[a0_0x16ed94(0xec)](0xa)['describe'](a0_0x16ed94(0x130))}),server=new Server({'name':'morph-mcp','version':a0_0x16ed94(0x17a)},{'capabilities':{'tools':{}}});server[a0_0x16ed94(0x1bd)](ListToolsRequestSchema,async()=>{const _0x58531d=a0_0x16ed94,_0x5e5d06=[{'name':TOOL_NAMES[_0x58531d(0x1b4)],'description':_0x58531d(0x19f)+_0x58531d(0x1fd)+_0x58531d(0xed)+_0x58531d(0x15b)+_0x58531d(0x1a3)+_0x58531d(0x1df)+_0x58531d(0x121)+_0x58531d(0x203)+_0x58531d(0x189)+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x58531d(0x1ba)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x58531d(0x1e6),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0x58531d(0x1dc)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20'+_0x58531d(0x1f7)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3839b8=_0x5e5d06[_0x58531d(0x1f4)](_0x42723d=>{const _0x4f92f=_0x58531d;if(DISABLED_TOOLS[_0x4f92f(0x139)](_0x42723d[_0x4f92f(0x108)]))return console[_0x4f92f(0xe9)](_0x4f92f(0x11c)+_0x42723d[_0x4f92f(0x108)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x4f92f(0x15c)in _0x42723d&&_0x42723d[_0x4f92f(0x15c)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x42723d[_0x4f92f(0x108)]+_0x4f92f(0x13d)),![];return!![];});return{'tools':_0x3839b8[_0x58531d(0x14a)](_0x4a4981=>({'name':_0x4a4981[_0x58531d(0x108)],'description':_0x4a4981[_0x58531d(0x172)],'inputSchema':_0x4a4981[_0x58531d(0x1bc)]}))};}),server[a0_0x16ed94(0x1bd)](CallToolRequestSchema,async _0x18caa7=>{const _0x5d3319=a0_0x16ed94,{name:_0x49f5bf,arguments:_0x44f402}=_0x18caa7['params'],_0x5244ad=Date[_0x5d3319(0x1ed)]();logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x185),{'tool':_0x49f5bf,'args':_0x49f5bf==='edit_file'?{'path':_0x44f402?.[_0x5d3319(0x1b7)],'instruction':_0x44f402?.[_0x5d3319(0x1d3)]||_0x44f402?.[_0x5d3319(0xf5)],'dryRun':_0x44f402?.[_0x5d3319(0x1f2)]}:_0x44f402});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x163)}],'isError':!![]};if(!MORPH_API_KEY[_0x5d3319(0x1fc)](_0x5d3319(0xee))&&!MORPH_API_KEY[_0x5d3319(0x1fc)]('morph-'))return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x1a9)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x49f5bf))return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x1d6)+_0x49f5bf+_0x5d3319(0x12d)}],'isError':![]};switch(_0x49f5bf){case TOOL_NAMES[_0x5d3319(0x1b4)]:{let _0x209dd4=_0x44f402;if(_0x209dd4&&typeof _0x209dd4===_0x5d3319(0x137)){if(!(_0x5d3319(0x1b7)in _0x209dd4)){const _0x499ec6=_0x209dd4[_0x5d3319(0x15a)]??_0x209dd4['filePath']??_0x209dd4['target_filepath']??_0x209dd4[_0x5d3319(0x1da)]??_0x209dd4[_0x5d3319(0x1f1)];if(_0x499ec6)_0x209dd4={..._0x209dd4,'path':_0x499ec6};}'instructions'in _0x209dd4&&!(_0x5d3319(0x1d3)in _0x209dd4)&&(_0x209dd4={..._0x209dd4,'instruction':_0x209dd4[_0x5d3319(0xf5)]});if(!('code_edit'in _0x209dd4)){const _0x5d437e=_0x209dd4['code']??_0x209dd4[_0x5d3319(0x1ef)]??_0x209dd4['content']??_0x209dd4[_0x5d3319(0xfe)];if(_0x5d437e)_0x209dd4={..._0x209dd4,'code_edit':_0x5d437e};}}const _0xaf107c=MorphEditFileArgsSchema[_0x5d3319(0x1f5)](_0x209dd4);if(!_0xaf107c[_0x5d3319(0xf9)])throw new Error(_0x5d3319(0x1c6)+_0xaf107c['error']);const _0x427038=await validatePath(_0xaf107c[_0x5d3319(0x195)]['path']);let _0x3e9517=null,_0x4a5b59=!![],_0x2f2a0d=null;try{_0x3e9517=await a0_0x38b0cc[_0x5d3319(0x177)](_0x427038,_0x5d3319(0x13e)),logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x171),{'path':_0x427038,'size_bytes':_0x3e9517[_0x5d3319(0x10c)]});}catch(_0x1a1216){const _0x341425=_0x1a1216[_0x5d3319(0x1dd)];_0x341425==='ENOENT'?(_0x4a5b59=![],_0x3e9517='',logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x171),{'path':_0x427038,'exists':![]})):(_0x2f2a0d=_0x5d3319(0x10d)+(_0x341425||'unknown')+_0x5d3319(0xff)+(_0x1a1216 instanceof Error?_0x1a1216['message']:String(_0x1a1216)),logger[_0x5d3319(0xe9)]('MCP',_0x5d3319(0x13c),{'path':_0x427038,'error':_0x2f2a0d}),logMcpStderr(_0x5d3319(0xe7)+_0x2f2a0d));}let _0x1189f0;try{const _0x3c4d0e=MORPH_API_KEY;if(!_0x3c4d0e)throw new Error(_0x5d3319(0x103));const _0x240acf=a0_0x37f788[_0x5d3319(0x182)](_0x427038),_0x4132ad=a0_0x37f788[_0x5d3319(0x15f)](_0x427038);logger[_0x5d3319(0x1b8)]('MCP',_0x5d3319(0x16c),{'model':_0x5d3319(0x1a8),'path':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1b7)],'instruction_len':_0xaf107c['data']['instruction'][_0x5d3319(0x10c)],'code_edit_len':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x128)][_0x5d3319(0x10c)],'original_code_len':_0x3e9517?.[_0x5d3319(0x10c)]??0x0,'dry_run':_0xaf107c['data'][_0x5d3319(0x1f2)]});const _0xdcbfd5=Date[_0x5d3319(0x1ed)](),_0x219493=await executeEditFile({'target_filepath':_0x4132ad,'code_edit':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x128)],'instruction':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)]},{'morphApiKey':_0x3c4d0e,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x240acf,'autoWrite':!_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1f2)],'generateUdiff':![],'debug':![]}),_0x193162=Date['now']()-_0xdcbfd5;_0x1189f0=_0x219493[_0x5d3319(0x19b)];if(!_0x219493[_0x5d3319(0xf9)])throw new Error(_0x219493[_0x5d3319(0xe9)]||_0x5d3319(0x1aa));const _0x5df242=_0x219493[_0x5d3319(0x150)],_0x51cc80=_0x5d3319(0xfc)+_0x5df242[_0x5d3319(0x129)]+_0x5d3319(0x18e)+_0x5df242[_0x5d3319(0xf4)]+_0x5d3319(0x146)+_0x5df242[_0x5d3319(0xe0)];logger[_0x5d3319(0x1b8)](_0x5d3319(0x12c),_0x5d3319(0x167),{'tool':_0x5d3319(0x144),'success':!![],'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad,'edit_latency_ms':_0x193162,'changes':{'added':_0x5df242['linesAdded'],'removed':_0x5df242[_0x5d3319(0xf4)],'modified':_0x5df242[_0x5d3319(0xe0)]},'completion_id':_0x1189f0});if(_0xaf107c['data']['dryRun'])return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x161)+(_0x4a5b59?'':_0x5d3319(0x1fb))+':\x20'+_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)]+_0x5d3319(0x1c8)+_0x51cc80+_0x5d3319(0x13f)+_0xaf107c[_0x5d3319(0x195)]['path']+'.'}]};return{'content':[{'type':_0x5d3319(0x1e3),'text':'Morph\x20Edit\x20'+(_0x4a5b59?_0x5d3319(0x138):_0x5d3319(0x1a7))+':\x20'+_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)]+_0x5d3319(0x1c8)+_0x51cc80+_0x5d3319(0x13f)+_0xaf107c['data'][_0x5d3319(0x1b7)]+'.'}]};}catch(_0x909e70){const _0x43bfe0=handleMorphAPIError(_0x909e70);if(_0x43bfe0)return logger['error'](_0x5d3319(0x12c),_0x5d3319(0x155),{'tool':'edit_file','error':_0x5d3319(0x1d8),'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad}),_0x43bfe0;const _0x5b87a2=_0x909e70 instanceof Error?_0x909e70['message']:String(_0x909e70);return logger[_0x5d3319(0xe9)](_0x5d3319(0x12c),'tool_call_error',{'tool':_0x5d3319(0x144),'error':_0x5b87a2,'path':_0xaf107c['data']['path'],'validated_path':_0x427038,'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad,'stack':_0x909e70 instanceof Error?_0x909e70[_0x5d3319(0x187)]:undefined}),reportMorphError({'error_message':_0x5b87a2,'error_type':_0x909e70 instanceof Error?_0x909e70[_0x5d3319(0x168)][_0x5d3319(0x108)]:'UnknownError','context':{'tool':_0x5d3319(0x144),'completion_id':_0x1189f0,'file_path':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1b7)],'validated_path':_0x427038,'instruction':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)],'model':MORPH_LARGE_APPLY?_0x5d3319(0x1cf):_0x5d3319(0x1a8),'dry_run':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1f2)],'file_exists':_0x4a5b59,'file_read_error':_0x2f2a0d,'file_readable':_0x3e9517!==null,'request_content':{'path':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1b7)],'code_edit':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x128)],'instruction':_0xaf107c[_0x5d3319(0x195)]['instruction'],'original_code':_0x3e9517!==null?_0x3e9517[_0x5d3319(0x10c)]>0xc350?_0x3e9517['substring'](0x0,0xc350)+_0x5d3319(0x1c3)+_0x3e9517[_0x5d3319(0x10c)]+_0x5d3319(0x1ee):_0x3e9517:_0x5d3319(0x1e0)+(_0x2f2a0d||_0x5d3319(0x1f0))+']','original_code_length':_0x3e9517?.[_0x5d3319(0x10c)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':'morph-v3-fast','dry_run':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1f2)]}},'stack_trace':_0x909e70 instanceof Error?_0x909e70[_0x5d3319(0x187)]:undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x5b87a2}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x11a1f3=WarpGrepArgsSchema[_0x5d3319(0x1f5)](_0x44f402);if(!_0x11a1f3[_0x5d3319(0xf9)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x11a1f3[_0x5d3319(0xe9)]}],'isError':!![]};const _0x2bd82e=_0x509d74=>{const _0x2faa20=_0x5d3319,_0x79c10=[];for(const _0x391ac0 of _0x509d74||[]){if(_0x391ac0[_0x2faa20(0x131)]===_0x2faa20(0x112)&&Array[_0x2faa20(0x196)](_0x391ac0[_0x2faa20(0x1e1)]))for(const _0x57caca of _0x391ac0['tool_calls']){try{const _0x39e13d=_0x57caca[_0x2faa20(0x19e)]?.[_0x2faa20(0x108)],_0x5b826e=JSON[_0x2faa20(0x13a)](_0x57caca['function']?.[_0x2faa20(0xde)]||'{}');if(_0x39e13d===_0x2faa20(0xe3))_0x79c10[_0x2faa20(0x1d0)]('grep\x20\x27'+_0x5b826e['pattern']+'\x27\x20'+(_0x5b826e[_0x2faa20(0x1b7)]||'.'));else{if(_0x39e13d===_0x2faa20(0x190))_0x79c10[_0x2faa20(0x1d0)](_0x2faa20(0xf1)+_0x5b826e[_0x2faa20(0x1b7)]);else{if(_0x39e13d===_0x2faa20(0x1a5))_0x79c10[_0x2faa20(0x1d0)]('list_directory\x20'+(_0x5b826e[_0x2faa20(0x12f)]||'.'));else{if(_0x39e13d===_0x2faa20(0x186))_0x79c10[_0x2faa20(0x1d0)]('glob\x20\x27'+_0x5b826e[_0x2faa20(0xf2)]+'\x27\x20'+(_0x5b826e[_0x2faa20(0x1b7)]||'.'));else _0x39e13d==='finish'&&_0x79c10[_0x2faa20(0x1d0)](_0x2faa20(0x179));}}}}catch{}}}return _0x79c10;},_0x433f07=_0x3835f0=>{const _0x11c92d=_0x5d3319,_0x268008=[];if(!_0x3835f0||!Array[_0x11c92d(0x196)](_0x3835f0))return _0x268008;const _0x2efc4c=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x11c92d(0x122),'tool':_0x11c92d(0x190)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x11c92d(0x117),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x11c92d(0x174),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x11c92d(0x164),'tool':_0x11c92d(0x190)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x11c92d(0x1e9),'tool':_0x11c92d(0x204)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x11c92d(0x204)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x11c92d(0x164),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x11c92d(0x183),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x11c92d(0x164),'tool':_0x11c92d(0x190)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x11c92d(0x190)},{'pattern':/Error reading file:/,'error_type':_0x11c92d(0x174),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x11c92d(0x1e4),'tool':_0x11c92d(0x20b)}];let _0x384e62=0x0;for(const _0x1956f1 of _0x3835f0){_0x1956f1['role']==='assistant'&&Array['isArray'](_0x1956f1[_0x11c92d(0x1e1)])&&_0x384e62++;const _0x16ac97=_0x1956f1['content'];if((_0x1956f1[_0x11c92d(0x131)]===_0x11c92d(0x12e)||_0x1956f1[_0x11c92d(0x131)]===_0x11c92d(0x1b2))&&_0x16ac97&&typeof _0x16ac97===_0x11c92d(0xfb))for(const {pattern:_0x177727,error_type:_0x4b0191,tool:_0x846ad2}of _0x2efc4c){const _0x2baeff=_0x16ac97[_0x11c92d(0x202)](new RegExp(_0x177727['source'],'g'));if(_0x2baeff)for(const _0xb7d7d3 of _0x2baeff){const _0x3e9411=_0x16ac97['indexOf'](_0xb7d7d3),_0x1706f3=_0x16ac97['substring'](_0x3e9411,Math[_0x11c92d(0x198)](_0x3e9411+0xc8,_0x16ac97['length']));_0x268008['push']({'tool':_0x846ad2,'error_type':_0x4b0191,'error_message':_0x1706f3['split']('\x0a')[0x0],'turn':_0x384e62});}}}return _0x268008;};try{const _0x5c8da4=a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3['data'][_0x5d3319(0x125)]),_0x63485e=_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x1b9)],_0x4b18a3=_0x63485e===_0x5d3319(0x205)?{'allowNames':[_0x5d3319(0x205)]}:undefined,_0x2a867e=new LocalRipgrepProvider(_0x5c8da4,undefined,_0x4b18a3);logger['debug']('MCP',_0x5d3319(0x11a),{'type':_0x5d3319(0x18c),'repo_root':_0x5c8da4,'search_type':_0x63485e||'default'}),logger[_0x5d3319(0x1b8)](_0x5d3319(0x12c),'warp_grep_start',{'query':_0x11a1f3[_0x5d3319(0x195)]['search_string'],'repo_root':_0x5c8da4,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x3a37ff=Date[_0x5d3319(0x1ed)](),_0x2bc555=await runWarpGrep({'searchTerm':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'repoRoot':_0x5c8da4,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x2a867e,'search_type':_0x63485e}),_0x3b444e=Date['now']()-_0x3a37ff,_0x532607=_0x2bc555['finish']?.[_0x5d3319(0x1cb)]?.['files']?.[_0x5d3319(0x10c)]??0x0;logger[_0x5d3319(0x1b8)](_0x5d3319(0x12c),_0x5d3319(0x1ab),{'termination':_0x2bc555[_0x5d3319(0xe8)],'turns':_0x2bc555[_0x5d3319(0x142)]?.[_0x5d3319(0x1e7)]??0x0,'files_found':_0x532607,'latency_ms':_0x3b444e});const _0x2b2e4e=_0x433f07(_0x2bc555[_0x5d3319(0x104)]);_0x2b2e4e[_0x5d3319(0x10c)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2b2e4e[_0x5d3319(0x10c)]+'\x20error(s)','error_type':_0x5d3319(0x1c4),'level':_0x5d3319(0x17c),'tool':_0x5d3319(0x1ea),'context':{'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3[_0x5d3319(0x195)]['search_string'],'model':_0x5d3319(0x165),'termination_reason':_0x2bc555['terminationReason'],'sub_tool_errors':_0x2b2e4e,'timings':_0x2bc555[_0x5d3319(0x142)],'tool_calls':_0x2bd82e(_0x2bc555['messages']),'messages':_0x2bc555['messages']?.['map'](_0x55b824=>({'role':_0x55b824['role'],'content':_0x55b824[_0x5d3319(0x17e)],..._0x55b824[_0x5d3319(0x1e1)]?{'tool_calls':_0x55b824[_0x5d3319(0x1e1)]['length']}:{},..._0x55b824[_0x5d3319(0x1b5)]?{'tool_call_id':_0x55b824[_0x5d3319(0x1b5)]}:{}}))},'source':_0x5d3319(0x11f)})['catch'](()=>{});let _0x6d1d9e='';if(_0x2bc555[_0x5d3319(0xe8)]===_0x5d3319(0x12a)&&_0x2bc555[_0x5d3319(0x179)]?.[_0x5d3319(0x1cb)]?.[_0x5d3319(0x1e8)]){const _0x5b636c=_0x2bc555[_0x5d3319(0x179)][_0x5d3319(0x1cb)][_0x5d3319(0x1e8)];if(_0x5b636c['length']===0x0)return _0x6d1d9e=_0x2bc555[_0x5d3319(0x179)][_0x5d3319(0x134)]||_0x5d3319(0x1d1),{'content':[{'type':_0x5d3319(0x1e3),'text':_0x6d1d9e}]};const _0x3cf235=[],_0x4b8a1f=[_0x5d3319(0x149)];for(const _0x14621f of _0x2bc555['messages']){if(_0x14621f[_0x5d3319(0x131)]===_0x5d3319(0x112)&&Array['isArray'](_0x14621f[_0x5d3319(0x1e1)]))for(const _0xd60e17 of _0x14621f['tool_calls']){try{const _0x150eb7=_0xd60e17[_0x5d3319(0x19e)]?.[_0x5d3319(0x108)],_0xa41761=JSON[_0x5d3319(0x13a)](_0xd60e17['function']?.[_0x5d3319(0xde)]||'{}');if(_0x150eb7===_0x5d3319(0xe3))_0x4b8a1f[_0x5d3319(0x1d0)](_0x5d3319(0x19a)+_0xa41761[_0x5d3319(0xf2)]+'\x27\x20in\x20`'+(_0xa41761['path']||'.')+'`');else{if(_0x150eb7===_0x5d3319(0x190))_0x4b8a1f[_0x5d3319(0x1d0)](_0x5d3319(0x181)+_0xa41761[_0x5d3319(0x1b7)]+'`');else{if(_0x150eb7===_0x5d3319(0x1a5))_0x4b8a1f['push']('-\x20Listed\x20directory\x20`'+(_0xa41761[_0x5d3319(0x12f)]||'.')+'`');else _0x150eb7===_0x5d3319(0x186)&&_0x4b8a1f[_0x5d3319(0x1d0)](_0x5d3319(0x13b)+_0xa41761[_0x5d3319(0xf2)]+_0x5d3319(0xf0)+(_0xa41761[_0x5d3319(0x1b7)]||'.')+'`');}}}catch{}}}_0x3cf235[_0x5d3319(0x1d0)](_0x4b8a1f[_0x5d3319(0x1c1)]('\x0a'));const _0x152368=['',_0x5d3319(0x1c0)];for(const _0x561d70 of _0x5b636c){if(_0x561d70[_0x5d3319(0x173)]==='*')_0x152368[_0x5d3319(0x1d0)]('-\x20'+_0x561d70[_0x5d3319(0x1b7)]+':*');else{if(Array['isArray'](_0x561d70['lines'])){const _0x5c3fb8=_0x561d70[_0x5d3319(0x173)][_0x5d3319(0x14a)](([_0x3eb15e,_0x3bd6f8])=>{if(_0x3eb15e===_0x3bd6f8)return''+_0x3eb15e;return _0x3eb15e+'-'+_0x3bd6f8;});_0x152368[_0x5d3319(0x1d0)]('-\x20'+_0x561d70[_0x5d3319(0x1b7)]+':'+_0x5c3fb8[_0x5d3319(0x1c1)](','));}else _0x152368[_0x5d3319(0x1d0)]('-\x20'+_0x561d70[_0x5d3319(0x1b7)]+':*');}}_0x152368[_0x5d3319(0x1d0)](''),_0x3cf235[_0x5d3319(0x1d0)](_0x152368[_0x5d3319(0x1c1)]('\x0a')),_0x3cf235['push'](_0x5d3319(0x10b));const _0x2d1f68=[],_0x4b6233=[];for(const _0x2ee2c1 of _0x5b636c){let _0x24928e=a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],_0x2ee2c1[_0x5d3319(0x1b7)]),_0x1aeee3=null,_0x5483ad=null;try{_0x1aeee3=await a0_0x38b0cc[_0x5d3319(0x177)](_0x24928e,{'encoding':_0x5d3319(0x13e)});}catch(_0x2a64ba){const _0x490a40=fixPathRepetition(_0x24928e);if(_0x490a40)try{_0x1aeee3=await a0_0x38b0cc[_0x5d3319(0x177)](_0x490a40,{'encoding':'utf-8'}),_0x24928e=_0x490a40;}catch{_0x5483ad=_0x2a64ba instanceof Error?_0x2a64ba:new Error(String(_0x2a64ba));}else _0x5483ad=_0x2a64ba instanceof Error?_0x2a64ba:new Error(String(_0x2a64ba));}if(_0x1aeee3!==null){const _0x3a8bc6=_0x1aeee3[_0x5d3319(0x1c5)](/\r?\n/),_0x2149dd=[];if(_0x2ee2c1['lines']==='*'||!Array['isArray'](_0x2ee2c1[_0x5d3319(0x173)]))for(let _0x580a7f=0x1;_0x580a7f<=_0x3a8bc6[_0x5d3319(0x10c)];_0x580a7f++){const _0x7e776e=_0x3a8bc6[_0x580a7f-0x1];_0x2149dd[_0x5d3319(0x1d0)](_0x580a7f+'|\x20'+_0x7e776e);}else for(const [_0x3d72c1,_0x11abdd]of _0x2ee2c1[_0x5d3319(0x173)]){_0x2149dd[_0x5d3319(0x10c)]>0x0&&_0x2149dd[_0x5d3319(0x1d0)]('');for(let _0x11f9d0=_0x3d72c1;_0x11f9d0<=_0x11abdd&&_0x11f9d0<=_0x3a8bc6[_0x5d3319(0x10c)];_0x11f9d0++){const _0x2d1c9b=_0x3a8bc6[_0x11f9d0-0x1];_0x2149dd[_0x5d3319(0x1d0)](_0x11f9d0+'|\x20'+_0x2d1c9b);}}_0x4b6233[_0x5d3319(0x1d0)]({'path':_0x2ee2c1[_0x5d3319(0x1b7)],'content':_0x2149dd[_0x5d3319(0x1c1)]('\x0a')});}else _0x2d1f68[_0x5d3319(0x1d0)](_0x5d3319(0x16f)+_0x2ee2c1[_0x5d3319(0x1b7)]+_0x5d3319(0xf7)+(_0x5483ad?.[_0x5d3319(0x15d)]||_0x5d3319(0x162))+_0x5d3319(0xeb));}try{const _0x206530=await compactFileContexts(_0x4b6233,_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],MORPH_API_KEY,MORPH_API_URL);for(const _0x24519c of _0x206530){_0x2d1f68['push'](_0x5d3319(0x16f)+_0x24519c[_0x5d3319(0x1b7)]+'\x22>\x0a'+_0x24519c['content']+'\x0a</file>');}}catch(_0x4e2ac2){logger[_0x5d3319(0x17c)](_0x5d3319(0x12c),_0x5d3319(0x191),{'error':_0x4e2ac2 instanceof Error?_0x4e2ac2[_0x5d3319(0x15d)]:String(_0x4e2ac2),'files_count':_0x4b6233[_0x5d3319(0x10c)]});for(const _0x1c1608 of _0x4b6233){_0x2d1f68[_0x5d3319(0x1d0)](_0x5d3319(0x16f)+_0x1c1608[_0x5d3319(0x1b7)]+_0x5d3319(0x145)+_0x1c1608[_0x5d3319(0x17e)]+_0x5d3319(0xeb));}}_0x3cf235[_0x5d3319(0x1d0)](_0x2d1f68['join']('\x0a\x0a')),_0x6d1d9e=_0x3cf235[_0x5d3319(0x1c1)]('\x0a');const _0x53ee64=_0x2bc555[_0x5d3319(0x136)]?.[_0x5d3319(0x1f4)](_0x49d236=>_0x49d236['message']?.['startsWith'](_0x5d3319(0x115)))||[];if(_0x53ee64[_0x5d3319(0x10c)]>0x0){const _0x4d9f53=_0x53ee64['map'](_0x4b1416=>_0x4b1416[_0x5d3319(0x15d)])[_0x5d3319(0x1c1)](';\x20');reportMorphError({'error_message':_0x4d9f53,'error_type':_0x5d3319(0x16d),'context':{'tool':_0x5d3319(0x1ea),'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3[_0x5d3319(0x195)]['search_string'],'model':_0x5d3319(0x165),'termination_reason':_0x5d3319(0x1d5),'error_count':_0x53ee64[_0x5d3319(0x10c)],'is_timeout':![],'timings':_0x2bc555[_0x5d3319(0x142)],'files_attempted':_0x5b636c['map'](_0x23e307=>({'path':_0x23e307[_0x5d3319(0x1b7)],'lines':_0x23e307[_0x5d3319(0x173)]})),'tool_calls':_0x2bd82e(_0x2bc555[_0x5d3319(0x104)]),'messages':_0x2bc555[_0x5d3319(0x104)]?.[_0x5d3319(0x14a)](_0x203c4a=>({'role':_0x203c4a[_0x5d3319(0x131)],'content':_0x203c4a['content'],..._0x203c4a[_0x5d3319(0x1e1)]?{'tool_calls':_0x203c4a[_0x5d3319(0x1e1)]['length']}:{},..._0x203c4a['tool_call_id']?{'tool_call_id':_0x203c4a[_0x5d3319(0x1b5)]}:{}})),'request_content':{'query':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'repoRoot':a0_0x37f788['resolve'](_0x11a1f3['data'][_0x5d3319(0x125)]),'model':_0x5d3319(0x165)}},'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{});}}else{if(_0x2bc555[_0x5d3319(0xe8)]==='terminated'&&_0x2bc555[_0x5d3319(0x136)][_0x5d3319(0x10c)]>0x0){const _0x3e0176=_0x2bc555[_0x5d3319(0x136)]['map'](_0x448807=>_0x448807[_0x5d3319(0x15d)])['join'](';\x20');_0x6d1d9e=_0x5d3319(0x1ec)+_0x3e0176;const _0x212a09=_0x3e0176[_0x5d3319(0xdf)]()[_0x5d3319(0x194)]('timeout')||_0x3e0176[_0x5d3319(0xdf)]()[_0x5d3319(0x194)](_0x5d3319(0x1a6))||_0x3e0176[_0x5d3319(0xdf)]()[_0x5d3319(0x194)](_0x5d3319(0x20c)),_0x48293b=_0x2bc555[_0x5d3319(0x179)]?.[_0x5d3319(0x1cb)]?.[_0x5d3319(0x1e8)],_0x1be8cd=_0x2bc555[_0x5d3319(0x136)][0x0];reportMorphError({'error_message':_0x3e0176,'error_type':_0x212a09?_0x5d3319(0x1cc):_0x1be8cd?.[_0x5d3319(0x168)]?.[_0x5d3319(0x108)]||_0x5d3319(0x154),'context':{'tool':_0x5d3319(0x1ea),'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'model':_0x5d3319(0x165),'termination_reason':_0x2bc555[_0x5d3319(0xe8)],'error_count':_0x2bc555[_0x5d3319(0x136)][_0x5d3319(0x10c)],'is_timeout':_0x212a09,'timings':_0x2bc555[_0x5d3319(0x142)],'files_attempted':_0x48293b?.[_0x5d3319(0x14a)](_0x462c38=>({'path':_0x462c38[_0x5d3319(0x1b7)],'lines':_0x462c38[_0x5d3319(0x173)]})),'tool_calls':_0x2bd82e(_0x2bc555[_0x5d3319(0x104)]),'messages':_0x2bc555[_0x5d3319(0x104)]?.['map'](_0x4ca49e=>({'role':_0x4ca49e[_0x5d3319(0x131)],'content':_0x4ca49e[_0x5d3319(0x17e)],..._0x4ca49e[_0x5d3319(0x1e1)]?{'tool_calls':_0x4ca49e[_0x5d3319(0x1e1)][_0x5d3319(0x10c)]}:{},..._0x4ca49e['tool_call_id']?{'tool_call_id':_0x4ca49e['tool_call_id']}:{}})),'request_content':{'query':_0x11a1f3['data'][_0x5d3319(0x11d)],'repo_path':_0x11a1f3[_0x5d3319(0x195)]['repo_path'],'repoRoot':a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)]),'model':_0x5d3319(0x165)}},'stack_trace':_0x1be8cd?.[_0x5d3319(0x187)]||undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{});}else _0x6d1d9e=_0x5d3319(0x207);}return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x6d1d9e}]};}catch(_0x1de53b){const _0x3c71dd=handleMorphAPIError(_0x1de53b);if(_0x3c71dd)return logger['error'](_0x5d3319(0x12c),_0x5d3319(0x155),{'tool':_0x5d3319(0x1ea),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad}),_0x3c71dd;const _0x44cd7a=_0x1de53b instanceof Error?_0x1de53b[_0x5d3319(0x15d)]:String(_0x1de53b);logger['error'](_0x5d3319(0x12c),'tool_call_error',{'tool':_0x5d3319(0x1ea),'error':_0x44cd7a,'repo_path':_0x11a1f3['data']['repo_path'],'query':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad});const _0x1b10d5=_0x44cd7a['toLowerCase']()['includes'](_0x5d3319(0x197))||_0x44cd7a[_0x5d3319(0xdf)]()[_0x5d3319(0x194)](_0x5d3319(0x1a6))||_0x44cd7a[_0x5d3319(0xdf)]()[_0x5d3319(0x194)]('etimedout')||_0x1de53b instanceof Error&&_0x1de53b[_0x5d3319(0x108)]===_0x5d3319(0x1cc);return reportMorphError({'error_message':_0x44cd7a,'error_type':_0x1b10d5?_0x5d3319(0x1cc):_0x1de53b instanceof Error?_0x1de53b[_0x5d3319(0x168)][_0x5d3319(0x108)]:_0x5d3319(0x16e),'context':{'tool':_0x5d3319(0x1ea),'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3['data'][_0x5d3319(0x11d)],'model':_0x5d3319(0x165),'is_timeout':_0x1b10d5,'exception_phase':_0x5d3319(0x14f),'request_content':{'query':_0x11a1f3['data']['search_string'],'repo_path':_0x11a1f3[_0x5d3319(0x195)]['repo_path'],'repoRoot':a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)]),'model':_0x5d3319(0x165)}},'stack_trace':_0x1de53b instanceof Error?_0x1de53b[_0x5d3319(0x187)]:undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{}),{'content':[{'type':_0x5d3319(0x1e3),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x44cd7a}],'isError':![]};}}case TOOL_NAMES[_0x5d3319(0xe1)]:{const _0x33c141=WarpGrepGitHubArgsSchema[_0x5d3319(0x1f5)](_0x44f402);if(!_0x33c141[_0x5d3319(0xf9)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x33c141['error']}],'isError':!![]};const _0x1593d4=_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x10e)]||_0x33c141['data'][_0x5d3319(0x118)];if(!_0x1593d4)return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x110)}],'isError':!![]};const _0x5d08ef=MORPH_API_KEY;if(!_0x5d08ef)throw new Error(_0x5d3319(0x103));const _0x54f954=Date[_0x5d3319(0x1ed)]();logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x178),{'identifier':_0x1593d4,'query':_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x11d)],'branch':_0x33c141['data'][_0x5d3319(0x1db)]});try{const _0x515fdb=new WarpGrepClient({'morphApiKey':_0x5d08ef,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x165fc5=await _0x515fdb[_0x5d3319(0xe5)]({'searchTerm':_0x33c141[_0x5d3319(0x195)]['search_string'],'github':_0x1593d4,'branch':_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x1db)]}),_0x2bb5c1=Date[_0x5d3319(0x1ed)]()-_0x54f954;logMcpStderr(_0x5d3319(0x170)+_0x2bb5c1+_0x5d3319(0x1e5)+_0x165fc5[_0x5d3319(0xf9)]);const _0x2bd24d=formatResult(_0x165fc5);return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x2bd24d}]};}catch(_0x3e4fcc){const _0x96e822=handleMorphAPIError(_0x3e4fcc);if(_0x96e822)return _0x96e822;const _0x4cd364=Date[_0x5d3319(0x1ed)]()-_0x54f954,_0x4fa035=_0x3e4fcc instanceof Error?_0x3e4fcc[_0x5d3319(0x15d)]:String(_0x3e4fcc);return logMcpStderr(_0x5d3319(0x1c7)+_0x4cd364+_0x5d3319(0x1ff),_0x4fa035),reportMorphError({'error_message':_0x4fa035,'error_type':_0x3e4fcc instanceof Error?_0x3e4fcc[_0x5d3319(0x168)][_0x5d3319(0x108)]:_0x5d3319(0x16e),'context':{'tool':_0x5d3319(0x147),'github_url':_0x1593d4,'search_string':_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x11d)],'branch':_0x33c141[_0x5d3319(0x195)]['branch']},'stack_trace':_0x3e4fcc instanceof Error?_0x3e4fcc['stack']:undefined,'source':'mcp-filesystem','tool':_0x5d3319(0x147),'latency_ms':_0x4cd364})['catch'](()=>{}),{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x14d)+_0x4fa035}],'isError':![]};}}default:throw new Error(_0x5d3319(0x1b3)+_0x49f5bf);}}catch(_0x58c33c){const _0x1c7da0=_0x58c33c instanceof Error?_0x58c33c[_0x5d3319(0x15d)]:String(_0x58c33c);return reportMorphError({'error_message':_0x1c7da0,'error_type':_0x58c33c instanceof Error?_0x58c33c[_0x5d3319(0x168)][_0x5d3319(0x108)]:_0x5d3319(0x16e),'context':{'tool':_0x49f5bf,'arguments':_0x44f402?JSON[_0x5d3319(0x1ac)](_0x44f402)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x5d3319(0x17a)},'stack_trace':_0x58c33c instanceof Error?_0x58c33c[_0x5d3319(0x187)]:undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{}),{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x1ec)+_0x1c7da0}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x49fc92){const _0x4cbba7=a0_0x16ed94,_0x517068=await getValidRootDirectories(_0x49fc92);if(_0x517068['length']>0x0)allowedDirectories=[..._0x517068],logMcpStderr(_0x4cbba7(0x151)+_0x517068[_0x4cbba7(0x10c)]+_0x4cbba7(0x1f6));else{logMcpStderr(_0x4cbba7(0x169));if(ENABLE_WORKSPACE_MODE)try{const _0x311fe6=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x311fe6&&(allowedDirectories=[_0x311fe6],logMcpStderr(_0x4cbba7(0x14c)+_0x311fe6));}catch(_0x5efd1e){logMcpStderr(_0x4cbba7(0x1be)+_0x5efd1e);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x49d578=a0_0x16ed94;try{const _0x40992e=await server[_0x49d578(0x141)]();_0x40992e&&_0x49d578(0xf8)in _0x40992e&&await updateAllowedDirectoriesFromRoots(_0x40992e[_0x49d578(0xf8)]);}catch(_0x3c91ee){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x3c91ee instanceof Error?_0x3c91ee[_0x49d578(0x15d)]:String(_0x3c91ee));}}),server['oninitialized']=async()=>{const _0x480997=a0_0x16ed94,_0x261325=server[_0x480997(0x132)]();if(_0x261325?.['roots'])try{const _0x2ef554=await server['listRoots']();_0x2ef554&&_0x480997(0xf8)in _0x2ef554?await updateAllowedDirectoriesFromRoots(_0x2ef554['roots']):logMcpStderr(_0x480997(0x200));}catch(_0x3c7d0a){logMcpStderr(_0x480997(0x109),_0x3c7d0a instanceof Error?_0x3c7d0a[_0x480997(0x15d)]:String(_0x3c7d0a));}else{if(allowedDirectories[_0x480997(0x10c)]>0x0)logMcpStderr(_0x480997(0x1c9),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x480997(0x17b));else throw new Error(_0x480997(0x19d));}}};async function runServer(){const _0x3e71e7=a0_0x16ed94,_0x11442f=new StdioServerTransport();await server[_0x3e71e7(0x1f3)](_0x11442f),logMcpStderr(_0x3e71e7(0x1ce)),allowedDirectories[_0x3e71e7(0x10c)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x16ed94(0x1fa)](_0x3b6706=>{const _0xddeef0=a0_0x16ed94;logMcpStderr(_0xddeef0(0x17d),_0x3b6706),process[_0xddeef0(0x1a2)](0x1);});
|
|
2
|
+
const a0_0x50aede=a0_0xa12a;(function(_0x52d251,_0x4c29c0){const _0x3f4185=a0_0xa12a,_0x1f85f8=_0x52d251();while(!![]){try{const _0x43bcdb=-parseInt(_0x3f4185(0x23a))/0x1+-parseInt(_0x3f4185(0x157))/0x2*(parseInt(_0x3f4185(0x186))/0x3)+parseInt(_0x3f4185(0x249))/0x4*(parseInt(_0x3f4185(0x22c))/0x5)+-parseInt(_0x3f4185(0x143))/0x6*(-parseInt(_0x3f4185(0x20c))/0x7)+-parseInt(_0x3f4185(0x153))/0x8*(parseInt(_0x3f4185(0x264))/0x9)+parseInt(_0x3f4185(0x1ec))/0xa*(parseInt(_0x3f4185(0x152))/0xb)+-parseInt(_0x3f4185(0x180))/0xc;if(_0x43bcdb===_0x4c29c0)break;else _0x1f85f8['push'](_0x1f85f8['shift']());}catch(_0x4ca6f9){_0x1f85f8['push'](_0x1f85f8['shift']());}}}(a0_0x3bac,0xb2a3e));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_0x5237c2 from'fs/promises';import a0_0x20fcf1 from'path';import a0_0x20d132 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x38920b from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x34efbb){const _0x48c177=a0_0xa12a,_0x5189e9=_0x34efbb['split'](a0_0x20fcf1['sep'])[_0x48c177(0x204)](Boolean);if(_0x5189e9[_0x48c177(0x1eb)]<0x2)return null;for(let _0x15b6b6=Math['floor'](_0x5189e9[_0x48c177(0x1eb)]/0x2);_0x15b6b6>=0x1;_0x15b6b6--){for(let _0x3974d5=0x0;_0x3974d5<=_0x5189e9['length']-0x2*_0x15b6b6;_0x3974d5++){const _0x3d2d2e=_0x5189e9['slice'](_0x3974d5,_0x3974d5+_0x15b6b6),_0xf9cf29=_0x5189e9[_0x48c177(0x1cc)](_0x3974d5+_0x15b6b6,_0x3974d5+0x2*_0x15b6b6);if(_0x3d2d2e[_0x48c177(0x1b2)]((_0x181fde,_0x4e328e)=>_0x181fde===_0xf9cf29[_0x4e328e])){const _0x2b208b=[..._0x5189e9[_0x48c177(0x1cc)](0x0,_0x3974d5),..._0x5189e9[_0x48c177(0x1cc)](_0x3974d5+_0x15b6b6)];return a0_0x20fcf1[_0x48c177(0x185)]+_0x2b208b['join'](a0_0x20fcf1[_0x48c177(0x185)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1daa23=a0_0xa12a;try{const _0x55b2a2=require('../package.json');return _0x55b2a2[_0x1daa23(0x167)]??_0x1daa23(0x1f8);}catch(_0x93a857){return logMcpStderr(_0x1daa23(0x224),_0x93a857),_0x1daa23(0x1f8);}}function printHelp(){const _0x20f751=a0_0xa12a;console[_0x20f751(0x1db)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x20f751(0x1db)](_0x20f751(0x1cd)),console[_0x20f751(0x1db)]('\x0aOptions:'),console[_0x20f751(0x1db)](_0x20f751(0x236)),console[_0x20f751(0x1db)](_0x20f751(0x1a3)),console[_0x20f751(0x1db)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x20f751(0x1db)](_0x20f751(0x1de)),console[_0x20f751(0x1db)](_0x20f751(0x191)),console[_0x20f751(0x1db)](_0x20f751(0x1fe));}const cliArgs=process[a0_0x50aede(0x1af)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x50aede(0x222),'-v','-V']),HELP_FLAGS=new Set([a0_0x50aede(0x154),'-h']);cliArgs[a0_0x50aede(0x259)](_0x5a01c3=>VERSION_FLAGS[a0_0x50aede(0x1b6)](_0x5a01c3))&&(console[a0_0x50aede(0x1db)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x17990d=>HELP_FLAGS[a0_0x50aede(0x1b6)](_0x17990d))&&(printHelp(),process[a0_0x50aede(0x21e)](0x0));function getCliArg(_0x3f8676){const _0x54eea5=a0_0x50aede;for(let _0x3691b2=0x0;_0x3691b2<cliArgs[_0x54eea5(0x1eb)];_0x3691b2++){const _0x1e5ff4=cliArgs[_0x3691b2];if(_0x1e5ff4[_0x54eea5(0x193)]('--'+_0x3f8676+'='))return _0x1e5ff4[_0x54eea5(0x1cc)](('--'+_0x3f8676+'=')['length']);if(_0x1e5ff4==='--'+_0x3f8676&&_0x3691b2+0x1<cliArgs[_0x54eea5(0x1eb)])return cliArgs[_0x3691b2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x50aede(0x1b6)](arg))continue;if(arg[a0_0x50aede(0x193)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x50aede(0x1e1)](arg);}const WORKSPACE_ROOT=process[a0_0x50aede(0x19b)][a0_0x50aede(0x22b)]||process['env'][a0_0x50aede(0x140)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x50aede(0x19b)][a0_0x50aede(0x16f)]!=='false',MORPH_API_KEY=getCliArg(a0_0x50aede(0x15d))??process[a0_0x50aede(0x19b)][a0_0x50aede(0x1cf)],MORPH_API_URL=process[a0_0x50aede(0x19b)][a0_0x50aede(0x1ed)],MORPH_LARGE_APPLY=process[a0_0x50aede(0x19b)]['MORPH_LARGE_APPLY']!==a0_0x50aede(0x156),MORPH_WARP_GREP_TIMEOUT=process['env']['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x50aede(0x19b)][a0_0x50aede(0x218)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x50aede(0x19b)]['DISABLED_TOOLS']?new Set(process[a0_0x50aede(0x19b)][a0_0x50aede(0x21c)]['split'](',')['map'](_0x218205=>_0x218205[a0_0x50aede(0x1c9)]())[a0_0x50aede(0x204)](_0x5b024b=>_0x5b024b[a0_0x50aede(0x1eb)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x50aede(0x1f5)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x50aede(0x1b6)](tool)&&console[a0_0x50aede(0x184)](a0_0x50aede(0x221)+tool+a0_0x50aede(0x247)+[...KNOWN_TOOL_NAMES][a0_0x50aede(0x1e8)](',\x20'));}console[a0_0x50aede(0x184)](a0_0x50aede(0x161)+[...DISABLED_TOOLS][a0_0x50aede(0x1e8)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x50aede(0x193)](a0_0x50aede(0x244))&&!MORPH_API_KEY['startsWith']('morph-')&&logMcpStderr(a0_0x50aede(0x252));async function reportMorphError(_0x33f7c0){const _0x3b53e2=a0_0x50aede;try{await a0_0x38920b['post'](_0x3b53e2(0x183),{..._0x33f7c0,'timestamp':new Date()[_0x3b53e2(0x19f)](),'source':_0x33f7c0[_0x3b53e2(0x20e)]||_0x3b53e2(0x23e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x33f7c0[_0x3b53e2(0x23c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3b53e2(0x1a4),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function a0_0x3bac(){const _0x21badf=['substring','filter','.vscode','metadata','\x20-\x20','indexOf','oninitialized','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','5491647dRWCyn','description','source','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a',',\x20modified\x20','[github_codebase_search]\x20Failed\x20in\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20error(s)','composer.json','tool','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x20chars)','MORPH_WARP_GREP_TIMEOUT','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','completed','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','DISABLED_TOOLS','github_codebase_search','exit','realpath','FileNotFound','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','--version','warp_grep_complete','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','unknown\x20error','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','file_read_failed','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','-\x20Grepped\x20\x27','Created\x20File','WORKSPACE_ROOT','35pdTERQ','files','search_type','lines','stringify','[github_codebase_search]\x20Done\x20in\x20','RipgrepNotAvailable','WarpGrep\x20sub-tool\x20errors:\x20','status','messages','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','payload','WarpGrepError','tool_call_error','1155924IxGaUX','stack','context','string','mcp-filesystem','BinaryFile','access','resolve','repo_path','constructor','sk-','Parent\x20directory\x20does\x20not\x20exist:\x20','read','\x22.\x20Known\x20tools:\x20','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','809696nnmShd','edit_file','go.mod','\x20valid\x20directories','grep','tool_calls','Fallback:\x20Using\x20workspace\x20root\x20','list_directory','❌\x20Morph\x20Edit\x20Failed:\x20','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','compaction_failed','Warning:\x20Workspace\x20fallback\x20failed:\x20','EDIT_FILE','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','filePath','morph-','some','Tool\x20','-\x20Listed\x20directory\x20`','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','boolean','isArray','0.2.0','listRoots','207BZgVgZ','changes','message','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','PWD','path_validation_start','ReadError','6ODYFlq','target_file',',\x20removed\x20','FileReadError','\x22>\x0aError\x20reading\x20file:\x20','node_modules','\x22>\x0a','morph-v3-fast','Error\x20running\x20fast\x20context\x20search:\x20','code_edit','morph-warp-grep-v2.1','name','number','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','toLowerCase','33vBydfH','54152BlGxAZ','--help','Invalid\x20arguments:\x20','false','93914BSKWzh','glob','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Morph\x20Edit\x20','Unknown\x20error','instructions','api-key','command','response','tool_call_complete','Disabled\x20tools:\x20','branch','map','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.','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','version','morph-v3-large','inputSchema','RipgrepError','all','match','isDirectory','errors','ENABLE_WORKSPACE_MODE','params','setRequestHandler','CODEBASE_SEARCH','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','etimedout','tool_call_received','timed\x20out','text','ms:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','glob\x20\x27','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','now','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','min','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','7683408CiMpSU','role','roots','https://morphllm.com/api/error-report','error','sep','33RQRCjl','instruction','Max\x20results\x20to\x20return','morph-mcp','grep_search','Error\x20accessing\x20directory\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','catch','api_request_start','split','searchGitHub','\x20\x20morph-mcp','provider_created','startsWith','arguments','data','default','SymlinkError','-\x20Read\x20file\x20`','search_string','pattern','env','linesRemoved','.git','basename','toISOString','code','\x0a...\x20(truncated,\x20total:\x20','function','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','application/json','-\x20Preserve\x20exact\x20indentation\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x27\x20in\x20`','finish','setNotificationHandler','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x20as\x20allowed\x20directory','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','ms.\x20Success:\x20','file_path','argv','[could\x20not\x20read\x20file:\x20','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','every','homedir','Preview\x20changes\x20without\x20applying\x20them.','Example\x20format:\x0a','has','tool_call_id','MCP','content','assistant','completionId','user','Workspace\x20mode\x20enabled:\x20Using\x20','timings','completed_with_file_errors','list_directory\x20','object','terminationReason','debug','dryRun','safeParse','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','GitHub\x20search\x20failed:\x20','dirname','trim','readFile','file','slice','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','path','MORPH_API_KEY','\x0a</file>','includes','UnknownError','file_read_complete','Unknown\x20tool:\x20','success','API\x20error\x20(auth/rate-limit)','linesModified','warn','Error:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','log','requiresApiKey','path_validation_resolved','\x0aExamples:','Tool\x20\x22','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','push','utf-8','Warning:\x20','ENOENT','runWarpGrep_call','Here\x20is\x20the\x20content\x20of\x20files:\x0a','.\x20Path:\x20','join','codebase_search','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','length','3328810UGgjBH','MORPH_API_URL','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Parameters:\x0a','.\x20Changes:\x20','linesAdded','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','github_url','new_string','size','optional','Repository\x20identifier','unknown','edit','describe','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','tsconfig.json','TimeoutError','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Morph\x20FastApply\x20failed\x20without\x20error\x20message','timeout','<file\x20path=\x22'];a0_0x3bac=function(){return _0x21badf;};return a0_0x3bac();}function extractStatusCode(_0x30de50,_0x42dc7d){const _0x68eb49=a0_0x50aede;if(_0x30de50&&typeof _0x30de50==='object'&&'status'in _0x30de50)return _0x30de50[_0x68eb49(0x234)];if(_0x30de50&&typeof _0x30de50===_0x68eb49(0x1c1)&&'response'in _0x30de50)return _0x30de50[_0x68eb49(0x15f)]?.[_0x68eb49(0x234)];const _0x71f65c=_0x42dc7d[_0x68eb49(0x16c)](/\b(401|429)\b/);return _0x71f65c?parseInt(_0x71f65c[0x1],0xa):null;}function a0_0xa12a(_0x52770a,_0x2e912f){_0x52770a=_0x52770a-0x13d;const _0x3bac17=a0_0x3bac();let _0xa12acf=_0x3bac17[_0x52770a];return _0xa12acf;}function handleMorphAPIError(_0x6093a2){const _0xfc9775=a0_0x50aede,_0x259be3=_0x6093a2 instanceof Error?_0x6093a2[_0xfc9775(0x13e)]:String(_0x6093a2),_0x2f3977=extractStatusCode(_0x6093a2,_0x259be3);switch(_0x2f3977){case 0x191:return{'content':[{'type':_0xfc9775(0x177),'text':_0xfc9775(0x17f)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0xfc9775(0x177),'text':_0xfc9775(0x228)}],'isError':!![]};default:return null;}}args[a0_0x50aede(0x1eb)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x50aede(0x1c6)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x50aede(0x17d)),logMcpStderr(a0_0x50aede(0x212)),logMcpStderr(a0_0x50aede(0x256)),logMcpStderr(a0_0x50aede(0x21b)));function normalizePath(_0x5d41b7){return a0_0x20fcf1['normalize'](_0x5d41b7);}function expandHome(_0x1fe926){const _0x5986e3=a0_0x50aede;if(_0x1fe926['startsWith']('~/')||_0x1fe926==='~')return a0_0x20fcf1[_0x5986e3(0x1e8)](a0_0x20d132[_0x5986e3(0x1b3)](),_0x1fe926[_0x5986e3(0x1cc)](0x1));return _0x1fe926;}let allowedDirectories=await Promise[a0_0x50aede(0x16b)](args[a0_0x50aede(0x163)](async _0x21aba1=>{const _0x349caa=a0_0x50aede,_0x3591d0=expandHome(_0x21aba1),_0x492365=a0_0x20fcf1[_0x349caa(0x241)](_0x3591d0);try{const _0xe118bf=await a0_0x5237c2[_0x349caa(0x21f)](_0x492365);return normalizePath(_0xe118bf);}catch(_0x54b4c0){return normalizePath(_0x492365);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x50aede(0x1eb)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x50aede(0x1e1)](workspaceDir),logMcpStderr(a0_0x50aede(0x1bd)+workspaceDir+a0_0x50aede(0x1ab)));}catch(a0_0x1c040f){logMcpStderr(a0_0x50aede(0x1fb)+a0_0x1c040f);}async function detectWorkspaceRoot(_0x343c35){const _0x575a89=a0_0x50aede;let _0x4121c3=a0_0x20fcf1[_0x575a89(0x241)](_0x343c35);const _0x276597=[_0x575a89(0x19d),_0x575a89(0x205),'package.json','Cargo.toml','pyproject.toml',_0x575a89(0x24b),'.cursor',_0x575a89(0x1fc),_0x575a89(0x214)];while(_0x4121c3!==a0_0x20fcf1[_0x575a89(0x1c8)](_0x4121c3)){for(const _0x1a343b of _0x276597){const _0x26a88f=a0_0x20fcf1[_0x575a89(0x1e8)](_0x4121c3,_0x1a343b);try{return await a0_0x5237c2[_0x575a89(0x240)](_0x26a88f),normalizePath(_0x4121c3);}catch{}}_0x4121c3=a0_0x20fcf1[_0x575a89(0x1c8)](_0x4121c3);}return normalizePath(_0x343c35);}await Promise[a0_0x50aede(0x16b)](args[a0_0x50aede(0x163)](async _0x5bc67f=>{const _0x57c185=a0_0x50aede;try{const _0x5edf2b=await a0_0x5237c2['stat'](expandHome(_0x5bc67f));!_0x5edf2b[_0x57c185(0x16d)]()&&(logMcpStderr(_0x57c185(0x1d9)+_0x5bc67f+'\x20is\x20not\x20a\x20directory'),process[_0x57c185(0x21e)](0x1));}catch(_0x20b24c){logMcpStderr(_0x57c185(0x18b)+_0x5bc67f+':',_0x20b24c),process['exit'](0x1);}}));async function validatePath(_0x295ed4){const _0x38d557=a0_0x50aede,_0x32132d=expandHome(_0x295ed4),_0x5a4097=a0_0x20fcf1[_0x38d557(0x241)](_0x32132d);logger['debug'](_0x38d557(0x1b8),_0x38d557(0x141),{'raw_path':_0x295ed4,'absolute':_0x5a4097});try{const _0x115f5e=await a0_0x5237c2[_0x38d557(0x21f)](_0x5a4097);return logger['debug'](_0x38d557(0x1b8),_0x38d557(0x1dd),{'resolved':_0x115f5e,'symlink':_0x115f5e!==_0x5a4097}),_0x115f5e;}catch(_0xbcf01a){if(_0xbcf01a['code']===_0x38d557(0x1e4)){const _0x2973c8=a0_0x20fcf1[_0x38d557(0x1c8)](_0x5a4097);try{const _0x903617=await a0_0x5237c2[_0x38d557(0x21f)](_0x2973c8),_0xb960cf=a0_0x20fcf1[_0x38d557(0x1e8)](_0x903617,a0_0x20fcf1[_0x38d557(0x19e)](_0x5a4097));return logger[_0x38d557(0x1c3)](_0x38d557(0x1b8),_0x38d557(0x1dd),{'resolved':_0xb960cf,'new_file':!![]}),_0xb960cf;}catch{logger[_0x38d557(0x184)](_0x38d557(0x1b8),'path_validation_failed',{'raw_path':_0x295ed4,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x2973c8});throw new Error(_0x38d557(0x245)+_0x2973c8);}}logger[_0x38d557(0x184)](_0x38d557(0x1b8),'path_validation_failed',{'raw_path':_0x295ed4,'error':_0xbcf01a[_0x38d557(0x13e)]});throw _0xbcf01a;}}const MorphEditFileArgsSchema=z[a0_0x50aede(0x1c1)]({'path':z[a0_0x50aede(0x23d)](),'code_edit':z['string']()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1ee)),'instruction':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1f2)),'dryRun':z[a0_0x50aede(0x260)]()[a0_0x50aede(0x196)](![])[a0_0x50aede(0x1fa)](a0_0x50aede(0x1b4))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x50aede(0x25d),WarpGrepArgsSchema=z[a0_0x50aede(0x1c1)]({'search_string':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x50aede(0x23d)]()['describe']('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'),'search_type':z['enum']([a0_0x50aede(0x196),a0_0x50aede(0x148)])[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x50aede(0x1c1)]({'search_string':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x50aede(0x23d)]()['optional']()['describe'](a0_0x50aede(0x25f)),'owner_repo':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1da)),'branch':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()['describe'](a0_0x50aede(0x1a6))}),CodebaseSearchArgsSchema=z[a0_0x50aede(0x1c1)]({'query':z[a0_0x50aede(0x23d)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()['describe'](a0_0x50aede(0x1f7)),'branch':z['string']()[a0_0x50aede(0x1f6)]()['describe'](a0_0x50aede(0x173)),'commitHash':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x50aede(0x23d)]())['default']([])[a0_0x50aede(0x1fa)](a0_0x50aede(0x159)),'limit':z[a0_0x50aede(0x14f)]()['optional']()[a0_0x50aede(0x196)](0xa)[a0_0x50aede(0x1fa)](a0_0x50aede(0x188))}),server=new Server({'name':a0_0x50aede(0x189),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x50aede(0x171)](ListToolsRequestSchema,async()=>{const _0x28f2d9=a0_0x50aede,_0x9cfce2=[{'name':TOOL_NAMES[_0x28f2d9(0x255)],'description':_0x28f2d9(0x20f)+_0x28f2d9(0x1ef)+_0x28f2d9(0x13f)+_0x28f2d9(0x1b1)+_0x28f2d9(0x248)+_0x28f2d9(0x20a)+_0x28f2d9(0x1b5)+'//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a'+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x28f2d9(0x1a5)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x28f2d9(0x165),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x28f2d9(0x172)],'description':_0x28f2d9(0x219)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x28f2d9(0x1e0)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3e393d=_0x9cfce2[_0x28f2d9(0x204)](_0x3118d4=>{const _0xd93567=_0x28f2d9;if(DISABLED_TOOLS[_0xd93567(0x1b6)](_0x3118d4['name']))return console[_0xd93567(0x184)](_0xd93567(0x25a)+_0x3118d4[_0xd93567(0x14e)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0xd93567(0x1dc)in _0x3118d4&&_0x3118d4['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0xd93567(0x1e3)+_0x3118d4[_0xd93567(0x14e)]+_0xd93567(0x1aa)),![];return!![];});return{'tools':_0x3e393d['map'](_0x1054ef=>({'name':_0x1054ef[_0x28f2d9(0x14e)],'description':_0x1054ef[_0x28f2d9(0x20d)],'inputSchema':_0x1054ef[_0x28f2d9(0x169)]}))};}),server[a0_0x50aede(0x171)](CallToolRequestSchema,async _0x12a6be=>{const _0x367870=a0_0x50aede,{name:_0x39e5ba,arguments:_0x2c41b8}=_0x12a6be[_0x367870(0x170)],_0x32b9cc=Date[_0x367870(0x17c)]();logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x175),{'tool':_0x39e5ba,'args':_0x39e5ba==='edit_file'?{'path':_0x2c41b8?.[_0x367870(0x1ce)],'instruction':_0x2c41b8?.[_0x367870(0x187)]||_0x2c41b8?.[_0x367870(0x15c)],'dryRun':_0x2c41b8?.[_0x367870(0x1c4)]}:_0x2c41b8});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x166)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x367870(0x244))&&!MORPH_API_KEY[_0x367870(0x193)](_0x367870(0x258)))return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x226)}],'isError':!![]};if(DISABLED_TOOLS[_0x367870(0x1b6)](_0x39e5ba))return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1df)+_0x39e5ba+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x39e5ba){case TOOL_NAMES[_0x367870(0x255)]:{let _0x2d7e95=_0x2c41b8;if(_0x2d7e95&&typeof _0x2d7e95===_0x367870(0x1c1)){if(!('path'in _0x2d7e95)){const _0x1d14f4=_0x2d7e95[_0x367870(0x144)]??_0x2d7e95[_0x367870(0x257)]??_0x2d7e95['target_filepath']??_0x2d7e95[_0x367870(0x1ae)]??_0x2d7e95[_0x367870(0x1cb)];if(_0x1d14f4)_0x2d7e95={..._0x2d7e95,'path':_0x1d14f4};}_0x367870(0x15c)in _0x2d7e95&&!(_0x367870(0x187)in _0x2d7e95)&&(_0x2d7e95={..._0x2d7e95,'instruction':_0x2d7e95[_0x367870(0x15c)]});if(!(_0x367870(0x14c)in _0x2d7e95)){const _0x19b26e=_0x2d7e95[_0x367870(0x1a0)]??_0x2d7e95[_0x367870(0x1f4)]??_0x2d7e95['content']??_0x2d7e95[_0x367870(0x1f9)];if(_0x19b26e)_0x2d7e95={..._0x2d7e95,'code_edit':_0x19b26e};}}const _0x52f74c=MorphEditFileArgsSchema[_0x367870(0x1c5)](_0x2d7e95);if(!_0x52f74c[_0x367870(0x1d5)])throw new Error(_0x367870(0x150)+_0x52f74c[_0x367870(0x184)]);const _0x5ebd9a=await validatePath(_0x52f74c[_0x367870(0x195)]['path']);let _0x485029=null,_0x33603c=!![],_0x4e56bc=null;try{_0x485029=await a0_0x5237c2[_0x367870(0x1ca)](_0x5ebd9a,_0x367870(0x1e2)),logger['debug'](_0x367870(0x1b8),_0x367870(0x1d3),{'path':_0x5ebd9a,'size_bytes':_0x485029[_0x367870(0x1eb)]});}catch(_0x4ebf4f){const _0x6b9b42=_0x4ebf4f[_0x367870(0x1a0)];_0x6b9b42===_0x367870(0x1e4)?(_0x33603c=![],_0x485029='',logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x1d3),{'path':_0x5ebd9a,'exists':![]})):(_0x4e56bc='Failed\x20to\x20read\x20file:\x20'+(_0x6b9b42||_0x367870(0x1f8))+_0x367870(0x207)+(_0x4ebf4f instanceof Error?_0x4ebf4f['message']:String(_0x4ebf4f)),logger['error'](_0x367870(0x1b8),_0x367870(0x227),{'path':_0x5ebd9a,'error':_0x4e56bc}),logMcpStderr(_0x367870(0x1e3)+_0x4e56bc));}let _0x7413e;try{const _0x2e36fe=MORPH_API_KEY;if(!_0x2e36fe)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x11cbab=a0_0x20fcf1['dirname'](_0x5ebd9a),_0x285d8f=a0_0x20fcf1[_0x367870(0x19e)](_0x5ebd9a);logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x18e),{'model':_0x367870(0x14a),'path':_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)],'instruction_len':_0x52f74c[_0x367870(0x195)][_0x367870(0x187)]['length'],'code_edit_len':_0x52f74c['data'][_0x367870(0x14c)][_0x367870(0x1eb)],'original_code_len':_0x485029?.[_0x367870(0x1eb)]??0x0,'dry_run':_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)]});const _0x2d480b=Date['now'](),_0x580e5d=await executeEditFile({'target_filepath':_0x285d8f,'code_edit':_0x52f74c[_0x367870(0x195)][_0x367870(0x14c)],'instruction':_0x52f74c[_0x367870(0x195)][_0x367870(0x187)]},{'morphApiKey':_0x2e36fe,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x11cbab,'autoWrite':!_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)],'generateUdiff':![],'debug':![]}),_0x89f152=Date['now']()-_0x2d480b;_0x7413e=_0x580e5d[_0x367870(0x1bb)];if(!_0x580e5d[_0x367870(0x1d5)])throw new Error(_0x580e5d[_0x367870(0x184)]||_0x367870(0x200));const _0x5bb124=_0x580e5d[_0x367870(0x13d)],_0x4fab8d='added\x20'+_0x5bb124[_0x367870(0x1f1)]+_0x367870(0x145)+_0x5bb124[_0x367870(0x19c)]+_0x367870(0x210)+_0x5bb124['linesModified'];logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x160),{'tool':_0x367870(0x24a),'success':!![],'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc,'edit_latency_ms':_0x89f152,'changes':{'added':_0x5bb124[_0x367870(0x1f1)],'removed':_0x5bb124[_0x367870(0x19c)],'modified':_0x5bb124[_0x367870(0x1d7)]},'completion_id':_0x7413e});if(_0x52f74c[_0x367870(0x195)]['dryRun'])return{'content':[{'type':_0x367870(0x177),'text':'Morph\x20Edit\x20Preview'+(_0x33603c?'':'\x20(new\x20file)')+':\x20'+_0x52f74c['data'][_0x367870(0x187)]+_0x367870(0x1f0)+_0x4fab8d+_0x367870(0x1e7)+_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)]+'.'}]};return{'content':[{'type':'text','text':_0x367870(0x15a)+(_0x33603c?'Applied':_0x367870(0x22a))+':\x20'+_0x52f74c['data'][_0x367870(0x187)]+_0x367870(0x1f0)+_0x4fab8d+'.\x20Path:\x20'+_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)]+'.'}]};}catch(_0x1233d7){const _0x10e89b=handleMorphAPIError(_0x1233d7);if(_0x10e89b)return logger[_0x367870(0x184)](_0x367870(0x1b8),_0x367870(0x239),{'tool':_0x367870(0x24a),'error':_0x367870(0x1d6),'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc}),_0x10e89b;const _0x49423f=_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x13e)]:String(_0x1233d7);return logger['error'](_0x367870(0x1b8),'tool_call_error',{'tool':_0x367870(0x24a),'error':_0x49423f,'path':_0x52f74c['data']['path'],'validated_path':_0x5ebd9a,'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc,'stack':_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x23b)]:undefined}),reportMorphError({'error_message':_0x49423f,'error_type':_0x1233d7 instanceof Error?_0x1233d7['constructor'][_0x367870(0x14e)]:_0x367870(0x1d2),'context':{'tool':_0x367870(0x24a),'completion_id':_0x7413e,'file_path':_0x52f74c['data'][_0x367870(0x1ce)],'validated_path':_0x5ebd9a,'instruction':_0x52f74c['data']['instruction'],'model':MORPH_LARGE_APPLY?_0x367870(0x168):_0x367870(0x14a),'dry_run':_0x52f74c['data']['dryRun'],'file_exists':_0x33603c,'file_read_error':_0x4e56bc,'file_readable':_0x485029!==null,'request_content':{'path':_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)],'code_edit':_0x52f74c[_0x367870(0x195)][_0x367870(0x14c)],'instruction':_0x52f74c['data']['instruction'],'original_code':_0x485029!==null?_0x485029[_0x367870(0x1eb)]>0xc350?_0x485029[_0x367870(0x203)](0x0,0xc350)+_0x367870(0x1a1)+_0x485029[_0x367870(0x1eb)]+_0x367870(0x217):_0x485029:_0x367870(0x1b0)+(_0x4e56bc||_0x367870(0x225))+']','original_code_length':_0x485029?.[_0x367870(0x1eb)]??0x0,'model':MORPH_LARGE_APPLY?_0x367870(0x168):'morph-v3-fast','dry_run':_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)]}},'stack_trace':_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x23b)]:undefined,'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{}),{'content':[{'type':'text','text':_0x367870(0x251)+_0x49423f}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x3d8421=WarpGrepArgsSchema['safeParse'](_0x2c41b8);if(!_0x3d8421[_0x367870(0x1d5)])return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x155)+_0x3d8421['error']}],'isError':!![]};const _0x4a5946=_0x45dc90=>{const _0x1450f8=_0x367870,_0x4e71d3=[];for(const _0x5e9e8f of _0x45dc90||[]){if(_0x5e9e8f[_0x1450f8(0x181)]===_0x1450f8(0x1ba)&&Array[_0x1450f8(0x261)](_0x5e9e8f[_0x1450f8(0x24e)]))for(const _0x5a2c19 of _0x5e9e8f['tool_calls']){try{const _0x5ef070=_0x5a2c19[_0x1450f8(0x1a2)]?.[_0x1450f8(0x14e)],_0x47a80f=JSON['parse'](_0x5a2c19['function']?.[_0x1450f8(0x194)]||'{}');if(_0x5ef070==='grep_search')_0x4e71d3[_0x1450f8(0x1e1)]('grep\x20\x27'+_0x47a80f[_0x1450f8(0x19a)]+'\x27\x20'+(_0x47a80f['path']||'.'));else{if(_0x5ef070==='read')_0x4e71d3[_0x1450f8(0x1e1)]('read\x20'+_0x47a80f[_0x1450f8(0x1ce)]);else{if(_0x5ef070===_0x1450f8(0x250))_0x4e71d3['push'](_0x1450f8(0x1c0)+(_0x47a80f[_0x1450f8(0x15e)]||'.'));else{if(_0x5ef070===_0x1450f8(0x158))_0x4e71d3[_0x1450f8(0x1e1)](_0x1450f8(0x17a)+_0x47a80f[_0x1450f8(0x19a)]+'\x27\x20'+(_0x47a80f[_0x1450f8(0x1ce)]||'.'));else _0x5ef070==='finish'&&_0x4e71d3[_0x1450f8(0x1e1)](_0x1450f8(0x1a8));}}}}catch{}}}return _0x4e71d3;},_0x4e686f=_0x36560f=>{const _0x2657d7=_0x367870,_0xe32c46=[];if(!_0x36560f||!Array[_0x2657d7(0x261)](_0x36560f))return _0xe32c46;const _0x4e27fd=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2657d7(0x220),'tool':_0x2657d7(0x246)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x2657d7(0x246)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2657d7(0x142),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x2657d7(0x246)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2657d7(0x16a),'tool':_0x2657d7(0x24d)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2657d7(0x232),'tool':_0x2657d7(0x24d)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2657d7(0x23f),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':'read'},{'pattern':/not a text file/,'error_type':_0x2657d7(0x23f),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x2657d7(0x197),'tool':_0x2657d7(0x246)},{'pattern':/Error reading file:/,'error_type':_0x2657d7(0x142),'tool':'read'},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x28bb96=0x0;for(const _0x23d707 of _0x36560f){_0x23d707[_0x2657d7(0x181)]==='assistant'&&Array['isArray'](_0x23d707[_0x2657d7(0x24e)])&&_0x28bb96++;const _0x19f99b=_0x23d707['content'];if((_0x23d707['role']===_0x2657d7(0x215)||_0x23d707[_0x2657d7(0x181)]===_0x2657d7(0x1bc))&&_0x19f99b&&typeof _0x19f99b===_0x2657d7(0x23d))for(const {pattern:_0x199604,error_type:_0x4c00b4,tool:_0xc39334}of _0x4e27fd){const _0x40edf5=_0x19f99b[_0x2657d7(0x16c)](new RegExp(_0x199604[_0x2657d7(0x20e)],'g'));if(_0x40edf5)for(const _0x5c6c8b of _0x40edf5){const _0x74ddc7=_0x19f99b[_0x2657d7(0x208)](_0x5c6c8b),_0x193646=_0x19f99b[_0x2657d7(0x203)](_0x74ddc7,Math[_0x2657d7(0x17e)](_0x74ddc7+0xc8,_0x19f99b[_0x2657d7(0x1eb)]));_0xe32c46[_0x2657d7(0x1e1)]({'tool':_0xc39334,'error_type':_0x4c00b4,'error_message':_0x193646[_0x2657d7(0x18f)]('\x0a')[0x0],'turn':_0x28bb96});}}}return _0xe32c46;};try{const _0x1342d8=a0_0x20fcf1[_0x367870(0x241)](_0x3d8421['data'][_0x367870(0x242)]),_0x4e1133=_0x3d8421[_0x367870(0x195)][_0x367870(0x22e)],_0x1eed7d=_0x4e1133===_0x367870(0x148)?{'allowNames':[_0x367870(0x148)]}:undefined,_0x1a7a14=new LocalRipgrepProvider(_0x1342d8,undefined,_0x1eed7d);logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x192),{'type':'LocalRipgrepProvider','repo_root':_0x1342d8,'search_type':_0x4e1133||_0x367870(0x196)}),logger['debug'](_0x367870(0x1b8),'warp_grep_start',{'query':_0x3d8421['data'][_0x367870(0x199)],'repo_root':_0x1342d8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x808e76=Date[_0x367870(0x17c)](),_0x4bae9b=await runWarpGrep({'searchTerm':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repoRoot':_0x1342d8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1a7a14,'search_type':_0x4e1133}),_0x2580d0=Date[_0x367870(0x17c)]()-_0x808e76,_0x2afa31=_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)]?.[_0x367870(0x1eb)]??0x0;logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x223),{'termination':_0x4bae9b[_0x367870(0x1c2)],'turns':_0x4bae9b[_0x367870(0x1be)]?.['turns']??0x0,'files_found':_0x2afa31,'latency_ms':_0x2580d0});const _0x1807b1=_0x4e686f(_0x4bae9b[_0x367870(0x235)]);_0x1807b1[_0x367870(0x1eb)]>0x0&&reportMorphError({'error_message':_0x367870(0x233)+_0x1807b1['length']+_0x367870(0x213),'error_type':'SubToolError','level':_0x367870(0x1d8),'tool':_0x367870(0x1e9),'context':{'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'termination_reason':_0x4bae9b[_0x367870(0x1c2)],'sub_tool_errors':_0x1807b1,'timings':_0x4bae9b[_0x367870(0x1be)],'tool_calls':_0x4a5946(_0x4bae9b[_0x367870(0x235)]),'messages':_0x4bae9b[_0x367870(0x235)]?.[_0x367870(0x163)](_0x1ff604=>({'role':_0x1ff604[_0x367870(0x181)],'content':_0x1ff604['content'],..._0x1ff604[_0x367870(0x24e)]?{'tool_calls':_0x1ff604['tool_calls']['length']}:{},..._0x1ff604[_0x367870(0x1b7)]?{'tool_call_id':_0x1ff604[_0x367870(0x1b7)]}:{}}))},'source':_0x367870(0x23e)})['catch'](()=>{});let _0x228bf2='';if(_0x4bae9b['terminationReason']===_0x367870(0x21a)&&_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)]){const _0x284cac=_0x4bae9b[_0x367870(0x1a8)][_0x367870(0x206)]['files'];if(_0x284cac[_0x367870(0x1eb)]===0x0)return _0x228bf2=_0x4bae9b[_0x367870(0x1a8)][_0x367870(0x237)]||_0x367870(0x1ea),{'content':[{'type':_0x367870(0x177),'text':_0x228bf2}]};const _0x119d62=[],_0x5e740c=[_0x367870(0x179)];for(const _0x580d1c of _0x4bae9b['messages']){if(_0x580d1c[_0x367870(0x181)]===_0x367870(0x1ba)&&Array[_0x367870(0x261)](_0x580d1c[_0x367870(0x24e)]))for(const _0x33564d of _0x580d1c[_0x367870(0x24e)]){try{const _0x2fed0c=_0x33564d[_0x367870(0x1a2)]?.[_0x367870(0x14e)],_0x1ff2ac=JSON['parse'](_0x33564d[_0x367870(0x1a2)]?.[_0x367870(0x194)]||'{}');if(_0x2fed0c===_0x367870(0x18a))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x229)+_0x1ff2ac[_0x367870(0x19a)]+_0x367870(0x1a7)+(_0x1ff2ac[_0x367870(0x1ce)]||'.')+'`');else{if(_0x2fed0c===_0x367870(0x246))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x198)+_0x1ff2ac['path']+'`');else{if(_0x2fed0c===_0x367870(0x250))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x25b)+(_0x1ff2ac[_0x367870(0x15e)]||'.')+'`');else _0x2fed0c===_0x367870(0x158)&&_0x5e740c['push']('-\x20Glob\x20search\x20`'+_0x1ff2ac[_0x367870(0x19a)]+'`\x20in\x20`'+(_0x1ff2ac['path']||'.')+'`');}}}catch{}}}_0x119d62[_0x367870(0x1e1)](_0x5e740c[_0x367870(0x1e8)]('\x0a'));const _0x1b0c55=['','Relevant\x20context\x20found:'];for(const _0x557667 of _0x284cac){if(_0x557667[_0x367870(0x22f)]==='*')_0x1b0c55[_0x367870(0x1e1)]('-\x20'+_0x557667[_0x367870(0x1ce)]+':*');else{if(Array[_0x367870(0x261)](_0x557667[_0x367870(0x22f)])){const _0x501c22=_0x557667[_0x367870(0x22f)][_0x367870(0x163)](([_0xcb238b,_0x296cac])=>{if(_0xcb238b===_0x296cac)return''+_0xcb238b;return _0xcb238b+'-'+_0x296cac;});_0x1b0c55['push']('-\x20'+_0x557667[_0x367870(0x1ce)]+':'+_0x501c22['join'](','));}else _0x1b0c55['push']('-\x20'+_0x557667[_0x367870(0x1ce)]+':*');}}_0x1b0c55[_0x367870(0x1e1)](''),_0x119d62[_0x367870(0x1e1)](_0x1b0c55[_0x367870(0x1e8)]('\x0a')),_0x119d62[_0x367870(0x1e1)](_0x367870(0x1e6));const _0x28721f=[],_0x1f4112=[];for(const _0x7047ed of _0x284cac){let _0x1d18d4=a0_0x20fcf1[_0x367870(0x241)](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],_0x7047ed[_0x367870(0x1ce)]),_0x3285d3=null,_0x44bf1b=null;try{_0x3285d3=await a0_0x5237c2[_0x367870(0x1ca)](_0x1d18d4,{'encoding':_0x367870(0x1e2)});}catch(_0x7526e2){const _0x5820b9=fixPathRepetition(_0x1d18d4);if(_0x5820b9)try{_0x3285d3=await a0_0x5237c2[_0x367870(0x1ca)](_0x5820b9,{'encoding':_0x367870(0x1e2)}),_0x1d18d4=_0x5820b9;}catch{_0x44bf1b=_0x7526e2 instanceof Error?_0x7526e2:new Error(String(_0x7526e2));}else _0x44bf1b=_0x7526e2 instanceof Error?_0x7526e2:new Error(String(_0x7526e2));}if(_0x3285d3!==null){const _0x17a628=_0x3285d3[_0x367870(0x18f)](/\r?\n/),_0x118efd=[];if(_0x7047ed[_0x367870(0x22f)]==='*'||!Array[_0x367870(0x261)](_0x7047ed['lines']))for(let _0x3169b3=0x1;_0x3169b3<=_0x17a628[_0x367870(0x1eb)];_0x3169b3++){const _0x6e34ca=_0x17a628[_0x3169b3-0x1];_0x118efd[_0x367870(0x1e1)](_0x3169b3+'|\x20'+_0x6e34ca);}else for(const [_0x84d787,_0x183a87]of _0x7047ed[_0x367870(0x22f)]){_0x118efd[_0x367870(0x1eb)]>0x0&&_0x118efd[_0x367870(0x1e1)]('');for(let _0x4110e5=_0x84d787;_0x4110e5<=_0x183a87&&_0x4110e5<=_0x17a628['length'];_0x4110e5++){const _0xd85615=_0x17a628[_0x4110e5-0x1];_0x118efd[_0x367870(0x1e1)](_0x4110e5+'|\x20'+_0xd85615);}}_0x1f4112[_0x367870(0x1e1)]({'path':_0x7047ed[_0x367870(0x1ce)],'content':_0x118efd['join']('\x0a')});}else _0x28721f['push'](_0x367870(0x202)+_0x7047ed[_0x367870(0x1ce)]+_0x367870(0x147)+(_0x44bf1b?.[_0x367870(0x13e)]||_0x367870(0x15b))+'\x0a</file>');}try{const _0x5ed92c=await compactFileContexts(_0x1f4112,_0x3d8421['data'][_0x367870(0x199)],MORPH_API_KEY,MORPH_API_URL);for(const _0x2fdc12 of _0x5ed92c){_0x28721f[_0x367870(0x1e1)](_0x367870(0x202)+_0x2fdc12[_0x367870(0x1ce)]+'\x22>\x0a'+_0x2fdc12['content']+_0x367870(0x1d0));}}catch(_0x42c63c){logger[_0x367870(0x1d8)](_0x367870(0x1b8),_0x367870(0x253),{'error':_0x42c63c instanceof Error?_0x42c63c[_0x367870(0x13e)]:String(_0x42c63c),'files_count':_0x1f4112[_0x367870(0x1eb)]});for(const _0x3825be of _0x1f4112){_0x28721f[_0x367870(0x1e1)](_0x367870(0x202)+_0x3825be[_0x367870(0x1ce)]+_0x367870(0x149)+_0x3825be['content']+_0x367870(0x1d0));}}_0x119d62['push'](_0x28721f['join']('\x0a\x0a')),_0x228bf2=_0x119d62[_0x367870(0x1e8)]('\x0a');const _0x219e8e=_0x4bae9b[_0x367870(0x16e)]?.[_0x367870(0x204)](_0x389401=>_0x389401[_0x367870(0x13e)]?.[_0x367870(0x193)]('File\x20read\x20error:'))||[];if(_0x219e8e['length']>0x0){const _0xa2a7bb=_0x219e8e['map'](_0x4a4a44=>_0x4a4a44[_0x367870(0x13e)])[_0x367870(0x1e8)](';\x20');reportMorphError({'error_message':_0xa2a7bb,'error_type':_0x367870(0x146),'context':{'tool':_0x367870(0x1e9),'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'termination_reason':_0x367870(0x1bf),'error_count':_0x219e8e[_0x367870(0x1eb)],'is_timeout':![],'timings':_0x4bae9b[_0x367870(0x1be)],'files_attempted':_0x284cac[_0x367870(0x163)](_0x5d02f7=>({'path':_0x5d02f7['path'],'lines':_0x5d02f7[_0x367870(0x22f)]})),'tool_calls':_0x4a5946(_0x4bae9b[_0x367870(0x235)]),'messages':_0x4bae9b[_0x367870(0x235)]?.[_0x367870(0x163)](_0xe3c89c=>({'role':_0xe3c89c['role'],'content':_0xe3c89c[_0x367870(0x1b9)],..._0xe3c89c[_0x367870(0x24e)]?{'tool_calls':_0xe3c89c[_0x367870(0x24e)]['length']}:{},..._0xe3c89c[_0x367870(0x1b7)]?{'tool_call_id':_0xe3c89c[_0x367870(0x1b7)]}:{}})),'request_content':{'query':_0x3d8421['data']['search_string'],'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'repoRoot':a0_0x20fcf1['resolve'](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{});}}else{if(_0x4bae9b[_0x367870(0x1c2)]==='terminated'&&_0x4bae9b['errors']['length']>0x0){const _0x36cfec=_0x4bae9b[_0x367870(0x16e)][_0x367870(0x163)](_0x4b3ff2=>_0x4b3ff2[_0x367870(0x13e)])['join'](';\x20');_0x228bf2='Error:\x20'+_0x36cfec;const _0x328c97=_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x201))||_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x176))||_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)]('etimedout'),_0x3d3f8c=_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)],_0x2c9284=_0x4bae9b['errors'][0x0];reportMorphError({'error_message':_0x36cfec,'error_type':_0x328c97?_0x367870(0x1fd):_0x2c9284?.[_0x367870(0x243)]?.[_0x367870(0x14e)]||_0x367870(0x238),'context':{'tool':'codebase_search','repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':'morph-warp-grep-v2.1','termination_reason':_0x4bae9b[_0x367870(0x1c2)],'error_count':_0x4bae9b[_0x367870(0x16e)][_0x367870(0x1eb)],'is_timeout':_0x328c97,'timings':_0x4bae9b['timings'],'files_attempted':_0x3d3f8c?.['map'](_0x37c99e=>({'path':_0x37c99e['path'],'lines':_0x37c99e[_0x367870(0x22f)]})),'tool_calls':_0x4a5946(_0x4bae9b['messages']),'messages':_0x4bae9b['messages']?.[_0x367870(0x163)](_0x2ec35a=>({'role':_0x2ec35a[_0x367870(0x181)],'content':_0x2ec35a[_0x367870(0x1b9)],..._0x2ec35a[_0x367870(0x24e)]?{'tool_calls':_0x2ec35a[_0x367870(0x24e)]['length']}:{},..._0x2ec35a[_0x367870(0x1b7)]?{'tool_call_id':_0x2ec35a['tool_call_id']}:{}})),'request_content':{'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repo_path':_0x3d8421[_0x367870(0x195)]['repo_path'],'repoRoot':a0_0x20fcf1['resolve'](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'stack_trace':_0x2c9284?.['stack']||undefined,'source':_0x367870(0x23e)})[_0x367870(0x18d)](()=>{});}else _0x228bf2=_0x367870(0x1ac);}return{'content':[{'type':_0x367870(0x177),'text':_0x228bf2}]};}catch(_0x5659ae){const _0x49c3c5=handleMorphAPIError(_0x5659ae);if(_0x49c3c5)return logger[_0x367870(0x184)](_0x367870(0x1b8),_0x367870(0x239),{'tool':_0x367870(0x1e9),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc}),_0x49c3c5;const _0x2869b5=_0x5659ae instanceof Error?_0x5659ae[_0x367870(0x13e)]:String(_0x5659ae);logger[_0x367870(0x184)](_0x367870(0x1b8),'tool_call_error',{'tool':_0x367870(0x1e9),'error':_0x2869b5,'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'latency_ms':Date['now']()-_0x32b9cc});const _0xcad7e9=_0x2869b5['toLowerCase']()[_0x367870(0x1d1)](_0x367870(0x201))||_0x2869b5[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x176))||_0x2869b5['toLowerCase']()[_0x367870(0x1d1)](_0x367870(0x174))||_0x5659ae instanceof Error&&_0x5659ae['name']==='TimeoutError';return reportMorphError({'error_message':_0x2869b5,'error_type':_0xcad7e9?_0x367870(0x1fd):_0x5659ae instanceof Error?_0x5659ae['constructor']['name']:_0x367870(0x1d2),'context':{'tool':_0x367870(0x1e9),'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'is_timeout':_0xcad7e9,'exception_phase':_0x367870(0x1e5),'request_content':{'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'repoRoot':a0_0x20fcf1[_0x367870(0x241)](_0x3d8421['data'][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'stack_trace':_0x5659ae instanceof Error?_0x5659ae['stack']:undefined,'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x14b)+_0x2869b5}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x452801=WarpGrepGitHubArgsSchema['safeParse'](_0x2c41b8);if(!_0x452801[_0x367870(0x1d5)])return{'content':[{'type':'text','text':_0x367870(0x155)+_0x452801[_0x367870(0x184)]}],'isError':!![]};const _0x31f84=_0x452801[_0x367870(0x195)][_0x367870(0x1f3)]||_0x452801['data']['owner_repo'];if(!_0x31f84)return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x20b)}],'isError':!![]};const _0x292cfd=MORPH_API_KEY;if(!_0x292cfd)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x4e8dc6=Date[_0x367870(0x17c)]();logger[_0x367870(0x1c3)](_0x367870(0x1b8),'github_search_start',{'identifier':_0x31f84,'query':_0x452801['data'][_0x367870(0x199)],'branch':_0x452801['data'][_0x367870(0x162)]});try{const _0x390dd0=new WarpGrepClient({'morphApiKey':_0x292cfd,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x50e668=await _0x390dd0[_0x367870(0x190)]({'searchTerm':_0x452801['data'][_0x367870(0x199)],'github':_0x31f84,'branch':_0x452801[_0x367870(0x195)][_0x367870(0x162)]}),_0x5d0833=Date[_0x367870(0x17c)]()-_0x4e8dc6;logMcpStderr(_0x367870(0x231)+_0x5d0833+_0x367870(0x1ad)+_0x50e668[_0x367870(0x1d5)]);const _0xdcd3=formatResult(_0x50e668);return{'content':[{'type':_0x367870(0x177),'text':_0xdcd3}]};}catch(_0x4eafbd){const _0x266454=handleMorphAPIError(_0x4eafbd);if(_0x266454)return _0x266454;const _0x7b2f22=Date[_0x367870(0x17c)]()-_0x4e8dc6,_0x12c733=_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x13e)]:String(_0x4eafbd);return logMcpStderr(_0x367870(0x211)+_0x7b2f22+_0x367870(0x178),_0x12c733),reportMorphError({'error_message':_0x12c733,'error_type':_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x243)]['name']:'UnknownError','context':{'tool':_0x367870(0x21d),'github_url':_0x31f84,'search_string':_0x452801['data']['search_string'],'branch':_0x452801[_0x367870(0x195)][_0x367870(0x162)]},'stack_trace':_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x23b)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x7b2f22})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1c7)+_0x12c733}],'isError':![]};}}default:throw new Error(_0x367870(0x1d4)+_0x39e5ba);}}catch(_0x18c788){const _0x3ab192=_0x18c788 instanceof Error?_0x18c788[_0x367870(0x13e)]:String(_0x18c788);return reportMorphError({'error_message':_0x3ab192,'error_type':_0x18c788 instanceof Error?_0x18c788[_0x367870(0x243)]['name']:_0x367870(0x1d2),'context':{'tool':_0x39e5ba,'arguments':_0x2c41b8?JSON[_0x367870(0x230)](_0x2c41b8)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x367870(0x262)},'stack_trace':_0x18c788 instanceof Error?_0x18c788[_0x367870(0x23b)]:undefined,'source':_0x367870(0x23e)})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1d9)+_0x3ab192}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3f6df9){const _0x1f8900=a0_0x50aede,_0x15d9d5=await getValidRootDirectories(_0x3f6df9);if(_0x15d9d5[_0x1f8900(0x1eb)]>0x0)allowedDirectories=[..._0x15d9d5],logMcpStderr(_0x1f8900(0x18c)+_0x15d9d5[_0x1f8900(0x1eb)]+_0x1f8900(0x24c));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x36107b=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x36107b&&(allowedDirectories=[_0x36107b],logMcpStderr(_0x1f8900(0x24f)+_0x36107b));}catch(_0x3f904a){logMcpStderr(_0x1f8900(0x254)+_0x3f904a);}}}server[a0_0x50aede(0x1a9)](RootsListChangedNotificationSchema,async()=>{const _0x2d5c5a=a0_0x50aede;try{const _0x57d765=await server[_0x2d5c5a(0x263)]();_0x57d765&&'roots'in _0x57d765&&await updateAllowedDirectoriesFromRoots(_0x57d765[_0x2d5c5a(0x182)]);}catch(_0x476442){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x476442 instanceof Error?_0x476442[_0x2d5c5a(0x13e)]:String(_0x476442));}}),server[a0_0x50aede(0x209)]=async()=>{const _0x26d65e=a0_0x50aede,_0x594014=server['getClientCapabilities']();if(_0x594014?.['roots'])try{const _0x5b73e2=await server['listRoots']();_0x5b73e2&&_0x26d65e(0x182)in _0x5b73e2?await updateAllowedDirectoriesFromRoots(_0x5b73e2[_0x26d65e(0x182)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x10eac3){logMcpStderr(_0x26d65e(0x17b),_0x10eac3 instanceof Error?_0x10eac3[_0x26d65e(0x13e)]:String(_0x10eac3));}else{if(allowedDirectories[_0x26d65e(0x1eb)]>0x0)logMcpStderr(_0x26d65e(0x25c),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x26d65e(0x1ff));else throw new Error(_0x26d65e(0x164));}}};async function runServer(){const _0x51224e=a0_0x50aede,_0x57b860=new StdioServerTransport();await server['connect'](_0x57b860),logMcpStderr(_0x51224e(0x25e)),allowedDirectories['length']===0x0&&logMcpStderr(_0x51224e(0x216));}runServer()[a0_0x50aede(0x18d)](_0x29f384=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x29f384),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a1_0x578c(){var _0x47f255=['Windows','MCP','macOS','error','Linux','darwin','10041241UyEkYN','length','[os=','Unknown','win32','981354wefEaC','info','909775oyibnZ','platform','3047535FTLbth','6964280TGRsef','24SYqeRf','1871917nzjBbE','map','5834634vHFpKw','3bREJbV'];a1_0x578c=function(){return _0x47f255;};return a1_0x578c();}var a1_0x1e6af9=a1_0x1f8c;(function(_0x4b7cb3,_0x2717d5){var _0x250058=a1_0x1f8c,_0x51c4e6=_0x4b7cb3();while(!![]){try{var _0x55e964=parseInt(_0x250058(0x1ce))/0x1+-parseInt(_0x250058(0x1dd))/0x2+parseInt(_0x250058(0x1d1))/0x3*(-parseInt(_0x250058(0x1cc))/0x4)+-parseInt(_0x250058(0x1c9))/0x5+-parseInt(_0x250058(0x1d0))/0x6+parseInt(_0x250058(0x1d8))/0x7+parseInt(_0x250058(0x1cd))/0x8*(parseInt(_0x250058(0x1cb))/0x9);if(_0x55e964===_0x2717d5)break;else _0x51c4e6['push'](_0x51c4e6['shift']());}catch(_0xffbff3){_0x51c4e6['push'](_0x51c4e6['shift']());}}}(a1_0x578c,0xe4894));function a1_0x1f8c(_0x372c44,_0x5e9e07){_0x372c44=_0x372c44-0x1c9;var _0x578cc8=a1_0x578c();var _0x1f8c94=_0x578cc8[_0x372c44];return _0x1f8c94;}import a1_0x3b0571 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x5a87a5=a1_0x3b0571[a1_0x1e6af9(0x1ca)]()){var _0x16766b=a1_0x1e6af9;switch(_0x5a87a5){case _0x16766b(0x1d7):return _0x16766b(0x1d4);case _0x16766b(0x1dc):return _0x16766b(0x1d2);case'linux':return _0x16766b(0x1d6);default:return _0x16766b(0x1db);}}export function formatMcpLogMessage(_0x30d31d,_0x4f494c=a1_0x3b0571[a1_0x1e6af9(0x1ca)]()){var _0x12d10a=a1_0x1e6af9;return _0x12d10a(0x1da)+getOperatingSystemType(_0x4f494c)+']\x20'+_0x30d31d;}export function logMcpStderr(_0x1ac1e4,..._0x67e285){var _0x47befa=a1_0x1e6af9;console[_0x47befa(0x1d5)](formatMcpLogMessage(_0x1ac1e4),..._0x67e285),logger[_0x47befa(0x1de)](_0x47befa(0x1d3),_0x1ac1e4,_0x67e285[_0x47befa(0x1d9)]?{'args':_0x67e285[_0x47befa(0x1cf)](_0x34fc2c=>String(_0x34fc2c))}:undefined);}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a2_0x1056(_0x4bf09d,_0x19c689){_0x4bf09d=_0x4bf09d-0x1b6;const _0x584d6a=a2_0x584d();let _0x10560d=_0x584d6a[_0x4bf09d];return _0x10560d;}const a2_0x301809=a2_0x1056;(function(_0x56e816,_0x509184){const _0x5435e7=a2_0x1056,_0x5aafdb=_0x56e816();while(!![]){try{const _0x5f0a79=-parseInt(_0x5435e7(0x1c9))/0x1+parseInt(_0x5435e7(0x1c5))/0x2+-parseInt(_0x5435e7(0x1b8))/0x3+parseInt(_0x5435e7(0x1b6))/0x4+parseInt(_0x5435e7(0x1bd))/0x5*(parseInt(_0x5435e7(0x1b9))/0x6)+parseInt(_0x5435e7(0x1c3))/0x7*(-parseInt(_0x5435e7(0x1bf))/0x8)+parseInt(_0x5435e7(0x1c7))/0x9;if(_0x5f0a79===_0x509184)break;else _0x5aafdb['push'](_0x5aafdb['shift']());}catch(_0x12ee37){_0x5aafdb['push'](_0x5aafdb['shift']());}}}(a2_0x584d,0x78178));import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x301809(0x1c2)];constructor(){const _0x1e8dec=a2_0x301809;this[_0x1e8dec(0x1bc)]=process[_0x1e8dec(0x1c0)]['MORPH_DEBUG']==='1'||!!process[_0x1e8dec(0x1c0)][_0x1e8dec(0x1cd)];const _0x213431=process[_0x1e8dec(0x1c0)]['MORPH_LOG_FILE'];this[_0x1e8dec(0x1c2)]=_0x213431?createWriteStream(_0x213431,{'flags':'a'}):null;}[a2_0x301809(0x1ca)](_0x5459d1,_0x2dad74,_0x474f95){const _0x3ab30d=a2_0x301809;this[_0x3ab30d(0x1ba)](_0x3ab30d(0x1ca),_0x5459d1,_0x2dad74,_0x474f95);}[a2_0x301809(0x1cb)](_0x4b25f1,_0x3cccbf,_0x20e914){const _0x2277ba=a2_0x301809;this[_0x2277ba(0x1ba)]('info',_0x4b25f1,_0x3cccbf,_0x20e914);}[a2_0x301809(0x1c1)](_0x548a59,_0x309a89,_0x483bbf){const _0x2223fd=a2_0x301809;this[_0x2223fd(0x1ba)]('warn',_0x548a59,_0x309a89,_0x483bbf);}[a2_0x301809(0x1bb)](_0x43962d,_0x312de8,_0xb256f9){const _0xe394c2=a2_0x301809;this[_0xe394c2(0x1ba)]('error',_0x43962d,_0x312de8,_0xb256f9);}[a2_0x301809(0x1c6)](){const _0xee4b69=a2_0x301809;this[_0xee4b69(0x1bc)]=!![];}get[a2_0x301809(0x1be)](){const _0x448eaf=a2_0x301809;return this[_0x448eaf(0x1bc)];}['_log'](_0x49fd78,_0x4d7990,_0x1b704a,_0x4c5344){const _0x167110=a2_0x301809;if(_0x49fd78!==_0x167110(0x1bb)&&!this['enabled'])return;const _0x2fbbda=new Date()[_0x167110(0x1c4)](),_0x3c0f13='['+_0x2fbbda+_0x167110(0x1cc)+_0x49fd78['toUpperCase']()+_0x167110(0x1cc)+_0x4d7990+']';console['error'](_0x4c5344?_0x3c0f13+'\x20'+_0x1b704a+'\x20'+JSON[_0x167110(0x1c8)](_0x4c5344):_0x3c0f13+'\x20'+_0x1b704a),this['fileStream']?.[_0x167110(0x1b7)](JSON[_0x167110(0x1c8)]({'ts':_0x2fbbda,'level':_0x49fd78,'component':_0x4d7990,'msg':_0x1b704a,..._0x4c5344&&{'data':_0x4c5344}})+'\x0a');}}function a2_0x584d(){const _0x496d9e=['warn','fileStream','28aZYmCB','toISOString','1608716uIImdj','enable','3461895tOYCoN','stringify','854074nCSzQN','debug','info',']\x20[','MORPH_LOG_FILE','3334648hwSBBS','write','876066SBioHe','6njfvhh','_log','error','enabled','1626605EMeNXZ','isEnabled','1420008hdJhHw','env'];a2_0x584d=function(){return _0x496d9e;};return a2_0x584d();}export const logger=new MorphLogger();
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x49c7a2,_0x373e80){const _0x334fba=a3_0x2f95,_0x367dc5=_0x49c7a2();while(!![]){try{const _0x4181ca=parseInt(_0x334fba(0x95))/0x1*(parseInt(_0x334fba(0x94))/0x2)+-parseInt(_0x334fba(0xa4))/0x3*(parseInt(_0x334fba(0x98))/0x4)+parseInt(_0x334fba(0xa1))/0x5+-parseInt(_0x334fba(0x9d))/0x6*(-parseInt(_0x334fba(0x9c))/0x7)+parseInt(_0x334fba(0xa5))/0x8+-parseInt(_0x334fba(0x92))/0x9*(-parseInt(_0x334fba(0x9e))/0xa)+-parseInt(_0x334fba(0xa3))/0xb;if(_0x4181ca===_0x373e80)break;else _0x367dc5['push'](_0x367dc5['shift']());}catch(_0x3730e9){_0x367dc5['push'](_0x367dc5['shift']());}}}(a3_0x4140,0x99a30));import a3_0x30bcad from'path';import a3_0x310f09 from'os';function a3_0x4140(){const _0x37d8d3=['trim','34228ZOtvFW','charAt','substring','normalize','77yjyZBp','633522sGhyuR','327310tjQLqe','replace','join','287035EFtuss','toUpperCase','18017681BzsIpZ','168dyyLwP','2069040QTwIol','slice','match','/mnt/','234CpvVJY','test','2YkcSOh','417959YDETUQ','startsWith'];a3_0x4140=function(){return _0x37d8d3;};return a3_0x4140();}export function convertToWindowsPath(_0x34f729){const _0x317181=a3_0x2f95;if(_0x34f729['startsWith'](_0x317181(0x91))){const _0x2d8834=_0x34f729[_0x317181(0x99)](0x5)[_0x317181(0xa2)](),_0x1682b1=_0x34f729[_0x317181(0x8f)](0x6)[_0x317181(0x9f)](/\//g,'\x5c');return _0x2d8834+':'+_0x1682b1;}if(_0x34f729[_0x317181(0x90)](/^\/[a-zA-Z]\//)){const _0x536469=_0x34f729[_0x317181(0x99)](0x1)['toUpperCase'](),_0x36d374=_0x34f729['slice'](0x2)[_0x317181(0x9f)](/\//g,'\x5c');return _0x536469+':'+_0x36d374;}if(_0x34f729[_0x317181(0x90)](/^[a-zA-Z]:/))return _0x34f729[_0x317181(0x9f)](/\//g,'\x5c');return _0x34f729;}export function normalizePath(_0x29f9d3){const _0x2585b8=a3_0x2f95;_0x29f9d3=_0x29f9d3[_0x2585b8(0x97)]()[_0x2585b8(0x9f)](/^["']|["']$/g,'');const _0x53d920=_0x29f9d3['startsWith']('/')&&!_0x29f9d3[_0x2585b8(0x90)](/^\/mnt\/[a-z]\//i)&&!_0x29f9d3[_0x2585b8(0x90)](/^\/[a-zA-Z]\//);if(_0x53d920)return _0x29f9d3['replace'](/\/+/g,'/')[_0x2585b8(0x9f)](/\/+$/,'');_0x29f9d3=convertToWindowsPath(_0x29f9d3);if(_0x29f9d3[_0x2585b8(0x96)]('\x5c\x5c')){let _0x363f77=_0x29f9d3;_0x363f77=_0x363f77['replace'](/^\\{2,}/,'\x5c\x5c');const _0x174657=_0x363f77[_0x2585b8(0x9a)](0x2)[_0x2585b8(0x9f)](/\\\\/g,'\x5c');_0x29f9d3='\x5c\x5c'+_0x174657;}else _0x29f9d3=_0x29f9d3[_0x2585b8(0x9f)](/\\\\/g,'\x5c');let _0x3cc2dc=a3_0x30bcad[_0x2585b8(0x9b)](_0x29f9d3);_0x29f9d3[_0x2585b8(0x96)]('\x5c\x5c')&&!_0x3cc2dc[_0x2585b8(0x96)]('\x5c\x5c')&&(_0x3cc2dc='\x5c'+_0x3cc2dc);if(_0x3cc2dc[_0x2585b8(0x90)](/^[a-zA-Z]:/)){let _0x1e08df=_0x3cc2dc[_0x2585b8(0x9f)](/\//g,'\x5c');return/^[a-z]:/[_0x2585b8(0x93)](_0x1e08df)&&(_0x1e08df=_0x1e08df[_0x2585b8(0x99)](0x0)[_0x2585b8(0xa2)]()+_0x1e08df[_0x2585b8(0x8f)](0x1)),_0x1e08df;}return _0x3cc2dc[_0x2585b8(0x9f)](/\//g,'\x5c');}function a3_0x2f95(_0x267eda,_0x593058){_0x267eda=_0x267eda-0x8f;const _0x414053=a3_0x4140();let _0x2f9571=_0x414053[_0x267eda];return _0x2f9571;}export function expandHome(_0x14cc54){const _0x35aedc=a3_0x2f95;if(_0x14cc54[_0x35aedc(0x96)]('~/')||_0x14cc54==='~')return a3_0x30bcad[_0x35aedc(0xa0)](a3_0x310f09['homedir'](),_0x14cc54['slice'](0x1));return _0x14cc54;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a4_0x5bb1(_0x3f1cec,_0x5ae989){_0x3f1cec=_0x3f1cec-0x172;const _0x1a6ef9=a4_0x1a6e();let _0x5bb19b=_0x1a6ef9[_0x3f1cec];return _0x5bb19b;}function a4_0x1a6e(){const _0xdd1e01=['3859332wMDHTQ','resolve','length','isArray','10356750krbdqb','normalize','5PIEoxl','2671240NbxXJf','1SHTlaT','12mypODb','8HzNmtz','isAbsolute','1848690IfWkHe','sep','12101663mKaLLE','529786YqxCqY','Path\x20must\x20be\x20absolute\x20after\x20normalization','string','includes','6yMSlFn','startsWith','14179407tdGneo'];a4_0x1a6e=function(){return _0xdd1e01;};return a4_0x1a6e();}(function(_0x3ef8e7,_0x25778c){const _0x4b26e7=a4_0x5bb1,_0x426306=_0x3ef8e7();while(!![]){try{const _0x3422f6=-parseInt(_0x4b26e7(0x175))/0x1*(parseInt(_0x4b26e7(0x17c))/0x2)+-parseInt(_0x4b26e7(0x180))/0x3*(-parseInt(_0x4b26e7(0x174))/0x4)+parseInt(_0x4b26e7(0x173))/0x5*(parseInt(_0x4b26e7(0x183))/0x6)+-parseInt(_0x4b26e7(0x17b))/0x7*(-parseInt(_0x4b26e7(0x177))/0x8)+-parseInt(_0x4b26e7(0x179))/0x9+-parseInt(_0x4b26e7(0x187))/0xa+parseInt(_0x4b26e7(0x182))/0xb*(-parseInt(_0x4b26e7(0x176))/0xc);if(_0x3422f6===_0x25778c)break;else _0x426306['push'](_0x426306['shift']());}catch(_0x2bd9bf){_0x426306['push'](_0x426306['shift']());}}}(a4_0x1a6e,0xdecfc));import a4_0x53edf1 from'path';export function isPathWithinAllowedDirectories(_0x230f73,_0x219218){const _0x190a46=a4_0x5bb1;if(typeof _0x230f73!==_0x190a46(0x17e)||!Array[_0x190a46(0x186)](_0x219218))return![];if(!_0x230f73||_0x219218[_0x190a46(0x185)]===0x0)return![];if(_0x230f73[_0x190a46(0x17f)]('\x00'))return![];let _0x46b1ac;try{_0x46b1ac=a4_0x53edf1[_0x190a46(0x184)](a4_0x53edf1[_0x190a46(0x172)](_0x230f73));}catch{return![];}if(!a4_0x53edf1[_0x190a46(0x178)](_0x46b1ac))throw new Error(_0x190a46(0x17d));return _0x219218['some'](_0x1d02ab=>{const _0x125ddd=_0x190a46;if(typeof _0x1d02ab!==_0x125ddd(0x17e)||!_0x1d02ab)return![];if(_0x1d02ab[_0x125ddd(0x17f)]('\x00'))return![];let _0xf6324e;try{_0xf6324e=a4_0x53edf1[_0x125ddd(0x184)](a4_0x53edf1['normalize'](_0x1d02ab));}catch{return![];}if(!a4_0x53edf1[_0x125ddd(0x178)](_0xf6324e))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x46b1ac===_0xf6324e)return!![];if(_0xf6324e===a4_0x53edf1[_0x125ddd(0x17a)])return _0x46b1ac[_0x125ddd(0x181)](a4_0x53edf1[_0x125ddd(0x17a)]);return _0x46b1ac['startsWith'](_0xf6324e+a4_0x53edf1[_0x125ddd(0x17a)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x22b1d5,_0x10406b){const _0x56993e=a5_0xe19c,_0xca8bf2=_0x22b1d5();while(!![]){try{const _0x2b92fd=-parseInt(_0x56993e(0x1a1))/0x1*(-parseInt(_0x56993e(0x193))/0x2)+-parseInt(_0x56993e(0x197))/0x3*(parseInt(_0x56993e(0x18f))/0x4)+parseInt(_0x56993e(0x19d))/0x5*(parseInt(_0x56993e(0x19c))/0x6)+parseInt(_0x56993e(0x1a5))/0x7*(parseInt(_0x56993e(0x19f))/0x8)+parseInt(_0x56993e(0x19e))/0x9+parseInt(_0x56993e(0x1a8))/0xa*(-parseInt(_0x56993e(0x190))/0xb)+-parseInt(_0x56993e(0x19b))/0xc;if(_0x2b92fd===_0x10406b)break;else _0xca8bf2['push'](_0xca8bf2['shift']());}catch(_0x3a38d5){_0xca8bf2['push'](_0xca8bf2['shift']());}}}(a5_0x457a,0xcbafd));import{promises as a5_0x62b470}from'fs';import a5_0x357a98 from'path';import a5_0x19a7da from'os';import{normalizePath}from'./path-utils.js';function a5_0x457a(){const _0x3495a6=['429BLBqEP','slice','homedir','2JcHDiK','invalid\x20path\x20or\x20inaccessible','push','\x20due\x20to\x20error:\x20','8805oTDohc','join','stat','uri','27605940gxvVrQ','6foCDon','4827245fDSJbs','14940981JdeJPG','402104CRFoaU','message','1337129wwzgWG','non-directory\x20root','file://','resolve','203dhWNgz','realpath','isDirectory','377570XyfDfU','Skipping\x20invalid\x20directory:\x20','1108IxxEzM'];a5_0x457a=function(){return _0x3495a6;};return a5_0x457a();}import{logMcpStderr}from'./log-utils.js';function a5_0xe19c(_0x22983f,_0x41c1d0){_0x22983f=_0x22983f-0x18f;const _0x457a67=a5_0x457a();let _0xe19cfb=_0x457a67[_0x22983f];return _0xe19cfb;}async function parseRootUri(_0x499842){const _0x5ab305=a5_0xe19c;try{const _0x2d732e=_0x499842['startsWith'](_0x5ab305(0x1a3))?_0x499842[_0x5ab305(0x191)](0x7):_0x499842,_0x1b2f60=_0x2d732e['startsWith']('~/')||_0x2d732e==='~'?a5_0x357a98[_0x5ab305(0x198)](a5_0x19a7da[_0x5ab305(0x192)](),_0x2d732e['slice'](0x1)):_0x2d732e,_0x287222=a5_0x357a98[_0x5ab305(0x1a4)](_0x1b2f60),_0x3c1056=await a5_0x62b470[_0x5ab305(0x1a6)](_0x287222);return normalizePath(_0x3c1056);}catch{return null;}}function formatDirectoryError(_0x71924,_0x4450a9,_0xaa30f2){const _0x4ef01e=a5_0xe19c;if(_0xaa30f2)return'Skipping\x20'+_0xaa30f2+':\x20'+_0x71924;const _0x273ad9=_0x4450a9 instanceof Error?_0x4450a9[_0x4ef01e(0x1a0)]:String(_0x4450a9);return _0x4ef01e(0x1a9)+_0x71924+_0x4ef01e(0x196)+_0x273ad9;}export async function getValidRootDirectories(_0x590122){const _0x37337d=a5_0xe19c,_0x49bb02=[];for(const _0x578a56 of _0x590122){const _0x382701=await parseRootUri(_0x578a56[_0x37337d(0x19a)]);if(!_0x382701){logMcpStderr(formatDirectoryError(_0x578a56[_0x37337d(0x19a)],undefined,_0x37337d(0x194)));continue;}try{const _0x2bb7fb=await a5_0x62b470[_0x37337d(0x199)](_0x382701);_0x2bb7fb[_0x37337d(0x1a7)]()?_0x49bb02[_0x37337d(0x195)](_0x382701):logMcpStderr(formatDirectoryError(_0x382701,undefined,_0x37337d(0x1a2)));}catch(_0x4f0296){logMcpStderr(formatDirectoryError(_0x382701,_0x4f0296));}}return _0x49bb02;}
|
package/dist/tool-definitions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x1c0466=a6_0x2a27;(function(_0x267915,_0x30affc){const _0x52d55c=a6_0x2a27,_0x5011b6=_0x267915();while(!![]){try{const _0x894ddd=parseInt(_0x52d55c(0x175))/0x1+-parseInt(_0x52d55c(0x173))/0x2*(parseInt(_0x52d55c(0x177))/0x3)+-parseInt(_0x52d55c(0x178))/0x4*(parseInt(_0x52d55c(0x176))/0x5)+-parseInt(_0x52d55c(0x179))/0x6*(-parseInt(_0x52d55c(0x17e))/0x7)+-parseInt(_0x52d55c(0x17f))/0x8*(-parseInt(_0x52d55c(0x174))/0x9)+parseInt(_0x52d55c(0x172))/0xa+-parseInt(_0x52d55c(0x17b))/0xb;if(_0x894ddd===_0x30affc)break;else _0x5011b6['push'](_0x5011b6['shift']());}catch(_0x12936c){_0x5011b6['push'](_0x5011b6['shift']());}}}(a6_0xd26a,0x3461f));export const TOOL_NAMES={'EDIT_FILE':a6_0x1c0466(0x17a),'CODEBASE_SEARCH':a6_0x1c0466(0x180),'GITHUB_CODEBASE_SEARCH':a6_0x1c0466(0x17d)};export const ALL_TOOL_NAMES=Object[a6_0x1c0466(0x17c)](TOOL_NAMES);function a6_0x2a27(_0x5c8679,_0x88d40b){_0x5c8679=_0x5c8679-0x172;const _0xd26a22=a6_0xd26a();let _0x2a2712=_0xd26a22[_0x5c8679];return _0x2a2712;}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0xd26a(){const _0x466164=['196691ZIBmSM','values','github_codebase_search','35042koeXnT','16CcBdVa','codebase_search','1187580nUvBDT','453758eLDHey','1620558wOybYO','87030vhoqVU','86015yEIehb','3tyWRnh','76PCMUxI','264ofrXjg','edit_file'];a6_0xd26a=function(){return _0x466164;};return a6_0xd26a();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.180",
|
|
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.170",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|