@morphllm/morphmcp 0.8.150 → 0.8.151

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/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x3a7f66=a0_0x10fb;(function(_0x4519d5,_0x4d6ee4){const _0x38e214=a0_0x10fb,_0x1332bb=_0x4519d5();while(!![]){try{const _0xbc67b5=parseInt(_0x38e214(0x1ff))/0x1*(-parseInt(_0x38e214(0x278))/0x2)+-parseInt(_0x38e214(0x245))/0x3+parseInt(_0x38e214(0x1fb))/0x4*(parseInt(_0x38e214(0x1c5))/0x5)+-parseInt(_0x38e214(0x243))/0x6+parseInt(_0x38e214(0x259))/0x7+parseInt(_0x38e214(0x236))/0x8+parseInt(_0x38e214(0x1e4))/0x9;if(_0xbc67b5===_0x4d6ee4)break;else _0x1332bb['push'](_0x1332bb['shift']());}catch(_0x3a7ed9){_0x1332bb['push'](_0x1332bb['shift']());}}}(a0_0x37e3,0x9d89a));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x10fb(_0x1700a6,_0x3b4554){_0x1700a6=_0x1700a6-0x1b2;const _0x37e39a=a0_0x37e3();let _0x10fb20=_0x37e39a[_0x1700a6];return _0x10fb20;}import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x3f72bc from'fs/promises';import a0_0x243bd3 from'path';import a0_0x1de3aa 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{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_0x1f5731 from'axios';function fixPathRepetition(_0x2312cb){const _0x4561b3=a0_0x10fb,_0x47f30b=_0x2312cb['split'](a0_0x243bd3[_0x4561b3(0x27d)])[_0x4561b3(0x21d)](Boolean);if(_0x47f30b[_0x4561b3(0x220)]<0x2)return null;for(let _0x5c4600=Math['floor'](_0x47f30b['length']/0x2);_0x5c4600>=0x1;_0x5c4600--){for(let _0x1cb479=0x0;_0x1cb479<=_0x47f30b[_0x4561b3(0x220)]-0x2*_0x5c4600;_0x1cb479++){const _0x2d0a1b=_0x47f30b[_0x4561b3(0x207)](_0x1cb479,_0x1cb479+_0x5c4600),_0x4ad340=_0x47f30b['slice'](_0x1cb479+_0x5c4600,_0x1cb479+0x2*_0x5c4600);if(_0x2d0a1b[_0x4561b3(0x21a)]((_0x54bfba,_0x1ae84e)=>_0x54bfba===_0x4ad340[_0x1ae84e])){const _0x5b1559=[..._0x47f30b[_0x4561b3(0x207)](0x0,_0x1cb479),..._0x47f30b['slice'](_0x1cb479+_0x5c4600)];return a0_0x243bd3[_0x4561b3(0x27d)]+_0x5b1559[_0x4561b3(0x246)](a0_0x243bd3[_0x4561b3(0x27d)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x553b28=a0_0x10fb;try{const _0x38220d=require('../package.json');return _0x38220d[_0x553b28(0x26b)]??_0x553b28(0x24d);}catch(_0x24449d){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x24449d),_0x553b28(0x24d);}}function printHelp(){const _0x1c1a88=a0_0x10fb;console['log'](_0x1c1a88(0x1ef)+getPackageVersion()),console[_0x1c1a88(0x23a)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x1c1a88(0x23a)]('\x0aOptions:'),console[_0x1c1a88(0x23a)](_0x1c1a88(0x273)),console[_0x1c1a88(0x23a)](_0x1c1a88(0x22e)),console[_0x1c1a88(0x23a)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log']('\x0aExamples:'),console[_0x1c1a88(0x23a)]('\x20\x20morph-mcp'),console[_0x1c1a88(0x23a)](_0x1c1a88(0x2a7));}const cliArgs=process[a0_0x3a7f66(0x203)][a0_0x3a7f66(0x207)](0x2),VERSION_FLAGS=new Set([a0_0x3a7f66(0x26f),'-v','-V']),HELP_FLAGS=new Set([a0_0x3a7f66(0x2b9),'-h']);cliArgs[a0_0x3a7f66(0x23f)](_0x377da6=>VERSION_FLAGS[a0_0x3a7f66(0x2b4)](_0x377da6))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x3a7f66(0x1b3)](0x0));cliArgs[a0_0x3a7f66(0x23f)](_0xf97a6e=>HELP_FLAGS[a0_0x3a7f66(0x2b4)](_0xf97a6e))&&(printHelp(),process[a0_0x3a7f66(0x1b3)](0x0));function getCliArg(_0x276b06){const _0x5bc1a1=a0_0x3a7f66;for(let _0x2f0ed5=0x0;_0x2f0ed5<cliArgs[_0x5bc1a1(0x220)];_0x2f0ed5++){const _0x5c2478=cliArgs[_0x2f0ed5];if(_0x5c2478[_0x5bc1a1(0x2a1)]('--'+_0x276b06+'='))return _0x5c2478[_0x5bc1a1(0x207)](('--'+_0x276b06+'=')[_0x5bc1a1(0x220)]);if(_0x5c2478==='--'+_0x276b06&&_0x2f0ed5+0x1<cliArgs[_0x5bc1a1(0x220)])return cliArgs[_0x2f0ed5+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x3a7f66(0x220)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x3a7f66(0x2b4)](arg))continue;if(arg['startsWith'](a0_0x3a7f66(0x2be)))continue;if(arg===a0_0x3a7f66(0x1f0)){i++;continue;}args[a0_0x3a7f66(0x1cc)](arg);}const WORKSPACE_ROOT=process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x226)]||process[a0_0x3a7f66(0x256)]['PWD']||process[a0_0x3a7f66(0x242)](),ENABLE_WORKSPACE_MODE=process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x206)]!=='false',MORPH_API_KEY=getCliArg(a0_0x3a7f66(0x1ee))??process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x2ba)],MORPH_API_URL=process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x1e9)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x3a7f66(0x256)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x23b)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x3a7f66(0x1dc),a0_0x3a7f66(0x1db),a0_0x3a7f66(0x231)]),DISABLED_TOOLS=process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x29a)]?new Set(process[a0_0x3a7f66(0x256)][a0_0x3a7f66(0x29a)][a0_0x3a7f66(0x1f6)](',')[a0_0x3a7f66(0x296)](_0x1979c4=>_0x1979c4[a0_0x3a7f66(0x1ba)]())['filter'](_0x41e505=>_0x41e505[a0_0x3a7f66(0x220)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x3a7f66(0x268)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x3a7f66(0x1d9)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x3a7f66(0x212)+[...KNOWN_TOOL_NAMES][a0_0x3a7f66(0x246)](',\x20'));}console[a0_0x3a7f66(0x1d9)](a0_0x3a7f66(0x1b5)+[...DISABLED_TOOLS][a0_0x3a7f66(0x246)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x3a7f66(0x2a1)](a0_0x3a7f66(0x1d5))&&!MORPH_API_KEY[a0_0x3a7f66(0x2a1)](a0_0x3a7f66(0x29d))&&logMcpStderr(a0_0x3a7f66(0x257));async function reportMorphError(_0x37b176){const _0x93ad0a=a0_0x3a7f66;try{await a0_0x1f5731[_0x93ad0a(0x227)](_0x93ad0a(0x29b),{..._0x37b176,'timestamp':new Date()['toISOString'](),'source':_0x37b176[_0x93ad0a(0x297)]||_0x93ad0a(0x224),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x37b176[_0x93ad0a(0x1ec)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x93ad0a(0x27b),'Authorization':_0x93ad0a(0x1fe)+MORPH_API_KEY}});}catch{}}args[a0_0x3a7f66(0x220)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x3a7f66(0x1dd)),logMcpStderr(a0_0x3a7f66(0x217)),logMcpStderr(a0_0x3a7f66(0x26a)),logMcpStderr(a0_0x3a7f66(0x1c1)),logMcpStderr(a0_0x3a7f66(0x1de)),logMcpStderr(a0_0x3a7f66(0x1d2)));function normalizePath(_0xa32a1){const _0x4f9e77=a0_0x3a7f66;return a0_0x243bd3[_0x4f9e77(0x287)](_0xa32a1);}function expandHome(_0x1d3165){const _0x4f12b9=a0_0x3a7f66;if(_0x1d3165[_0x4f12b9(0x2a1)]('~/')||_0x1d3165==='~')return a0_0x243bd3[_0x4f12b9(0x246)](a0_0x1de3aa['homedir'](),_0x1d3165['slice'](0x1));return _0x1d3165;}let allowedDirectories=await Promise[a0_0x3a7f66(0x1e3)](args[a0_0x3a7f66(0x296)](async _0x3d561d=>{const _0x18d496=a0_0x3a7f66,_0x43b776=expandHome(_0x3d561d),_0x8aabf9=a0_0x243bd3['resolve'](_0x43b776);try{const _0x473301=await a0_0x3f72bc[_0x18d496(0x26e)](_0x8aabf9);return normalizePath(_0x473301);}catch(_0x2251bd){return normalizePath(_0x8aabf9);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x3a7f66(0x220)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x3a7f66(0x1cc)](workspaceDir),logMcpStderr(a0_0x3a7f66(0x1d0)+workspaceDir+a0_0x3a7f66(0x24b)));}catch(a0_0x4bef65){logMcpStderr(a0_0x3a7f66(0x1fc)+a0_0x4bef65);}async function detectWorkspaceRoot(_0x4e9ebe){const _0x389e99=a0_0x3a7f66;let _0x1d92bf=a0_0x243bd3[_0x389e99(0x21c)](_0x4e9ebe);const _0x52e908=[_0x389e99(0x2b0),'.vscode',_0x389e99(0x294),_0x389e99(0x293),'pyproject.toml',_0x389e99(0x20f),'.cursor',_0x389e99(0x216),_0x389e99(0x1f2)];while(_0x1d92bf!==a0_0x243bd3['dirname'](_0x1d92bf)){for(const _0x463a65 of _0x52e908){const _0x39e87a=a0_0x243bd3[_0x389e99(0x246)](_0x1d92bf,_0x463a65);try{return await a0_0x3f72bc[_0x389e99(0x258)](_0x39e87a),normalizePath(_0x1d92bf);}catch{}}_0x1d92bf=a0_0x243bd3[_0x389e99(0x1c0)](_0x1d92bf);}return normalizePath(_0x4e9ebe);}await Promise[a0_0x3a7f66(0x1e3)](args[a0_0x3a7f66(0x296)](async _0x4d1cad=>{const _0x3a712a=a0_0x3a7f66;try{const _0x27f321=await a0_0x3f72bc[_0x3a712a(0x1bf)](expandHome(_0x4d1cad));!_0x27f321[_0x3a712a(0x215)]()&&(logMcpStderr(_0x3a712a(0x214)+_0x4d1cad+_0x3a712a(0x1ea)),process[_0x3a712a(0x1b3)](0x1));}catch(_0x1f6afb){logMcpStderr(_0x3a712a(0x1d3)+_0x4d1cad+':',_0x1f6afb),process[_0x3a712a(0x1b3)](0x1);}}));async function validatePath(_0x3cf92d){const _0x3a6862=a0_0x3a7f66,_0x52f25d=expandHome(_0x3cf92d),_0x157614=a0_0x243bd3[_0x3a6862(0x21c)](_0x52f25d);try{const _0x52d9a6=await a0_0x3f72bc[_0x3a6862(0x26e)](_0x157614);return _0x52d9a6;}catch(_0x53cba2){if(_0x53cba2[_0x3a6862(0x2ae)]===_0x3a6862(0x25e)){const _0x7994ff=a0_0x243bd3[_0x3a6862(0x1c0)](_0x157614);try{const _0x3cf35c=await a0_0x3f72bc['realpath'](_0x7994ff);return a0_0x243bd3[_0x3a6862(0x246)](_0x3cf35c,a0_0x243bd3[_0x3a6862(0x23c)](_0x157614));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x7994ff);}}throw _0x53cba2;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x3a7f66(0x253)](),'code_edit':z[a0_0x3a7f66(0x253)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x1e5)),'instruction':z[a0_0x3a7f66(0x253)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x208)),'dryRun':z['boolean']()[a0_0x3a7f66(0x211)](![])[a0_0x3a7f66(0x247)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x3a7f66(0x228),WarpGrepArgsSchema=z[a0_0x3a7f66(0x2b2)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x3a7f66(0x253)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x1d6)),'search_type':z[a0_0x3a7f66(0x274)]([a0_0x3a7f66(0x211),a0_0x3a7f66(0x1f8)])[a0_0x3a7f66(0x1d4)]()['describe']('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x3a7f66(0x2b2)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x3a7f66(0x1d4)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x2b3)),'owner_repo':z[a0_0x3a7f66(0x253)]()[a0_0x3a7f66(0x1d4)]()[a0_0x3a7f66(0x247)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x3a7f66(0x253)]()[a0_0x3a7f66(0x1d4)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x28a))}),CodebaseSearchArgsSchema=z[a0_0x3a7f66(0x2b2)]({'query':z[a0_0x3a7f66(0x253)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()['describe'](a0_0x3a7f66(0x2bf)),'branch':z[a0_0x3a7f66(0x253)]()[a0_0x3a7f66(0x1d4)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x2ab)),'commitHash':z['string']()[a0_0x3a7f66(0x1d4)]()[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x1f9)),'targetDirectories':z['array'](z['string']())[a0_0x3a7f66(0x211)]([])[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x288)),'limit':z[a0_0x3a7f66(0x277)]()[a0_0x3a7f66(0x1d4)]()[a0_0x3a7f66(0x211)](0xa)[a0_0x3a7f66(0x247)](a0_0x3a7f66(0x292))}),server=new Server({'name':a0_0x3a7f66(0x281),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x3a7f66(0x210)](ListToolsRequestSchema,async()=>{const _0x5af94c=a0_0x3a7f66,_0x138361=[{'name':'edit_file','description':_0x5af94c(0x1d7)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x5af94c(0x1e6)+_0x5af94c(0x279)+_0x5af94c(0x205)+_0x5af94c(0x1f5)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x5af94c(0x1c4)+_0x5af94c(0x218)+_0x5af94c(0x1c7)+_0x5af94c(0x295)+'For\x20deletions:\x0a'+_0x5af94c(0x289)+_0x5af94c(0x272)+'Rules:\x0a'+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x5af94c(0x1f7)+_0x5af94c(0x20a)+_0x5af94c(0x1e8)+_0x5af94c(0x1b9)+_0x5af94c(0x251)+'IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x5af94c(0x1db),'description':'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'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x5af94c(0x1cf)+'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':!![]}],_0x35cda7=_0x138361[_0x5af94c(0x21d)](_0x8a237f=>{const _0x1e52a7=_0x5af94c;if(DISABLED_TOOLS[_0x1e52a7(0x2b4)](_0x8a237f['name']))return console['error'](_0x1e52a7(0x213)+_0x8a237f[_0x1e52a7(0x2af)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x1e52a7(0x25c)in _0x8a237f&&_0x8a237f['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x8a237f[_0x1e52a7(0x2af)]+_0x1e52a7(0x1b2)),![];return!![];});return{'tools':_0x35cda7[_0x5af94c(0x296)](_0x2c80d8=>({'name':_0x2c80d8[_0x5af94c(0x2af)],'description':_0x2c80d8[_0x5af94c(0x2b1)],'inputSchema':_0x2c80d8[_0x5af94c(0x1ca)]}))};}),server[a0_0x3a7f66(0x210)](CallToolRequestSchema,async _0x155870=>{const _0x566ef4=a0_0x3a7f66,{name:_0x512c1b,arguments:_0x59a674}=_0x155870[_0x566ef4(0x22c)];try{if(DISABLED_TOOLS[_0x566ef4(0x2b4)](_0x512c1b))throw new Error('Tool\x20\x22'+_0x512c1b+'\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable');switch(_0x512c1b){case _0x566ef4(0x1dc):{const _0x1813e9=_0x59a674&&typeof _0x59a674===_0x566ef4(0x2b2)&&_0x566ef4(0x2a8)in _0x59a674&&!(_0x566ef4(0x285)in _0x59a674)?{..._0x59a674,'instruction':_0x59a674['instructions'],'instructions':undefined}:_0x59a674,_0x34fd26=MorphEditFileArgsSchema['safeParse'](_0x1813e9);if(!_0x34fd26[_0x566ef4(0x1c6)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x34fd26[_0x566ef4(0x1d9)]);const _0x539c7b=await validatePath(_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x270)]);let _0x35c4f9=null,_0x400a3=!![],_0x19fc63=null;try{_0x35c4f9=await a0_0x3f72bc['readFile'](_0x539c7b,_0x566ef4(0x26d));}catch(_0x5e801b){const _0x5669a5=_0x5e801b[_0x566ef4(0x2ae)];_0x5669a5===_0x566ef4(0x25e)?(_0x400a3=![],_0x35c4f9=''):(_0x19fc63='Failed\x20to\x20read\x20file:\x20'+(_0x5669a5||_0x566ef4(0x24d))+_0x566ef4(0x1cd)+(_0x5e801b instanceof Error?_0x5e801b[_0x566ef4(0x22d)]:String(_0x5e801b)),logMcpStderr(_0x566ef4(0x27a)+_0x19fc63));}let _0x2605a2;try{const _0x4cc48f=MORPH_API_KEY;if(!_0x4cc48f)throw new Error(_0x566ef4(0x298));const _0x3bacf3=a0_0x243bd3[_0x566ef4(0x1c0)](_0x539c7b),_0x51412b=a0_0x243bd3[_0x566ef4(0x23c)](_0x539c7b),_0x2fb584=await executeEditFile({'target_filepath':_0x51412b,'code_edit':_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x237)],'instructions':_0x34fd26[_0x566ef4(0x27c)]['instruction']},{'morphApiKey':_0x4cc48f,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3bacf3,'autoWrite':!_0x34fd26[_0x566ef4(0x27c)]['dryRun'],'generateUdiff':![],'debug':![]});_0x2605a2=_0x2fb584[_0x566ef4(0x24f)];if(!_0x2fb584['success'])throw new Error(_0x2fb584[_0x566ef4(0x1d9)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x4e45e0=_0x2fb584['changes'],_0xc198de=_0x566ef4(0x28f)+_0x4e45e0[_0x566ef4(0x20c)]+',\x20removed\x20'+_0x4e45e0[_0x566ef4(0x2bb)]+',\x20modified\x20'+_0x4e45e0[_0x566ef4(0x244)];if(_0x34fd26[_0x566ef4(0x27c)]['dryRun'])return{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x1ce)+(_0x400a3?'':_0x566ef4(0x28d))+':\x20'+_0x34fd26[_0x566ef4(0x27c)]['instruction']+_0x566ef4(0x283)+_0xc198de+_0x566ef4(0x21f)+_0x34fd26[_0x566ef4(0x27c)]['path']+'.'}]};return{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x22f)+(_0x400a3?'Applied':_0x566ef4(0x21b))+':\x20'+_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x285)]+_0x566ef4(0x283)+_0xc198de+_0x566ef4(0x21f)+_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x270)]+'.'}]};}catch(_0x478c14){const _0x2b3ca4=_0x478c14 instanceof Error?_0x478c14[_0x566ef4(0x22d)]:String(_0x478c14);return reportMorphError({'error_message':_0x2b3ca4,'error_type':_0x478c14 instanceof Error?_0x478c14[_0x566ef4(0x1bc)][_0x566ef4(0x2af)]:_0x566ef4(0x222),'context':{'tool':_0x566ef4(0x1dc),'completion_id':_0x2605a2,'file_path':_0x34fd26['data']['path'],'validated_path':_0x539c7b,'instruction':_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x285)],'model':_0x566ef4(0x1b6),'dry_run':_0x34fd26['data'][_0x566ef4(0x1c3)],'file_exists':_0x400a3,'file_read_error':_0x19fc63,'file_readable':_0x35c4f9!==null,'request_content':{'path':_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x270)],'code_edit':_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x237)],'instruction':_0x34fd26['data'][_0x566ef4(0x285)],'original_code':_0x35c4f9!==null?_0x35c4f9[_0x566ef4(0x220)]>0xc350?_0x35c4f9[_0x566ef4(0x234)](0x0,0xc350)+_0x566ef4(0x1fd)+_0x35c4f9['length']+_0x566ef4(0x26c):_0x35c4f9:'[could\x20not\x20read\x20file:\x20'+(_0x19fc63||_0x566ef4(0x238))+']','original_code_length':_0x35c4f9?.[_0x566ef4(0x220)]??0x0,'model':_0x566ef4(0x1b6),'dry_run':_0x34fd26[_0x566ef4(0x27c)][_0x566ef4(0x1c3)]}},'stack_trace':_0x478c14 instanceof Error?_0x478c14['stack']:undefined,'source':_0x566ef4(0x224)})[_0x566ef4(0x275)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x2b3ca4}],'isError':!![]};}}case'codebase_search':{const _0x1a5c3e=WarpGrepArgsSchema['safeParse'](_0x59a674);if(!_0x1a5c3e[_0x566ef4(0x1c6)])return{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x2a4)+_0x1a5c3e[_0x566ef4(0x1d9)]}],'isError':!![]};const _0x1ccfa9=_0x13e44f=>{const _0x1427bf=_0x566ef4,_0x1794cc=[];for(const _0x1dc510 of _0x13e44f||[]){if(_0x1dc510[_0x1427bf(0x22a)]===_0x1427bf(0x1e1)&&Array['isArray'](_0x1dc510[_0x1427bf(0x21e)]))for(const _0x30a5d0 of _0x1dc510['tool_calls']){try{const _0x59ee12=_0x30a5d0['function']?.[_0x1427bf(0x2af)],_0x1efc83=JSON[_0x1427bf(0x28c)](_0x30a5d0[_0x1427bf(0x2ac)]?.[_0x1427bf(0x2b8)]||'{}');if(_0x59ee12==='grep_search')_0x1794cc[_0x1427bf(0x1cc)]('grep\x20\x27'+_0x1efc83[_0x1427bf(0x1c9)]+'\x27\x20'+(_0x1efc83[_0x1427bf(0x270)]||'.'));else{if(_0x59ee12===_0x1427bf(0x1eb))_0x1794cc[_0x1427bf(0x1cc)](_0x1427bf(0x20b)+_0x1efc83[_0x1427bf(0x270)]);else{if(_0x59ee12===_0x1427bf(0x267))_0x1794cc['push']('list_directory\x20'+(_0x1efc83['command']||'.'));else{if(_0x59ee12==='glob')_0x1794cc['push'](_0x1427bf(0x271)+_0x1efc83[_0x1427bf(0x1c9)]+'\x27\x20'+(_0x1efc83[_0x1427bf(0x270)]||'.'));else _0x59ee12===_0x1427bf(0x2bc)&&_0x1794cc[_0x1427bf(0x1cc)](_0x1427bf(0x2bc));}}}}catch{}}}return _0x1794cc;},_0x4e15d4=_0x2a693f=>{const _0x3fa475=_0x566ef4,_0x381828=[];if(!_0x2a693f||!Array[_0x3fa475(0x263)](_0x2a693f))return _0x381828;const _0x3a35a4=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x3fa475(0x1eb)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x3fa475(0x240),'tool':_0x3fa475(0x1eb)},{'pattern':/\[READ ERROR\]/,'error_type':_0x3fa475(0x1c8),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x3fa475(0x1eb)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x3fa475(0x25a),'tool':_0x3fa475(0x291)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x3fa475(0x299),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x3fa475(0x27f),'tool':_0x3fa475(0x1eb)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x3fa475(0x1eb)},{'pattern':/not a text file/,'error_type':_0x3fa475(0x27f),'tool':_0x3fa475(0x1eb)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x3fa475(0x1eb)},{'pattern':/Error reading file:/,'error_type':_0x3fa475(0x1c8),'tool':_0x3fa475(0x1eb)},{'pattern':/status="error"/,'error_type':_0x3fa475(0x27e),'tool':_0x3fa475(0x24d)}];let _0x1c0eab=0x0;for(const _0x25a7a7 of _0x2a693f){_0x25a7a7[_0x3fa475(0x22a)]===_0x3fa475(0x1e1)&&Array[_0x3fa475(0x263)](_0x25a7a7[_0x3fa475(0x21e)])&&_0x1c0eab++;const _0x10bfc1=_0x25a7a7[_0x3fa475(0x225)];if((_0x25a7a7[_0x3fa475(0x22a)]==='tool'||_0x25a7a7[_0x3fa475(0x22a)]===_0x3fa475(0x241))&&_0x10bfc1&&typeof _0x10bfc1===_0x3fa475(0x253))for(const {pattern:_0x4cd8c7,error_type:_0x45f509,tool:_0x48936a}of _0x3a35a4){const _0x38efc0=_0x10bfc1[_0x3fa475(0x24c)](new RegExp(_0x4cd8c7[_0x3fa475(0x297)],'g'));if(_0x38efc0)for(const _0x29c2a6 of _0x38efc0){const _0x5049e7=_0x10bfc1[_0x3fa475(0x1f4)](_0x29c2a6),_0x9c2715=_0x10bfc1[_0x3fa475(0x234)](_0x5049e7,Math[_0x3fa475(0x252)](_0x5049e7+0xc8,_0x10bfc1[_0x3fa475(0x220)]));_0x381828[_0x3fa475(0x1cc)]({'tool':_0x48936a,'error_type':_0x45f509,'error_message':_0x9c2715[_0x3fa475(0x1f6)]('\x0a')[0x0],'turn':_0x1c0eab});}}}return _0x381828;};try{const _0x2cfb06=a0_0x243bd3['resolve'](_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)]),_0xa7a1bb=_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x28e)],_0x408b4b=_0xa7a1bb===_0x566ef4(0x1f8)?{'allowNames':[_0x566ef4(0x1f8)]}:undefined,_0x12ecc3=new LocalRipgrepProvider(_0x2cfb06,undefined,_0x408b4b),_0x54f5ab=await runWarpGrep({'searchTerm':_0x1a5c3e[_0x566ef4(0x27c)]['search_string'],'repoRoot':_0x2cfb06,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x12ecc3,'search_type':_0xa7a1bb}),_0x34f489=_0x4e15d4(_0x54f5ab['messages']);_0x34f489[_0x566ef4(0x220)]>0x0&&reportMorphError({'error_message':_0x566ef4(0x284)+_0x34f489['length']+_0x566ef4(0x1f3),'error_type':_0x566ef4(0x1d8),'level':_0x566ef4(0x25b),'tool':_0x566ef4(0x1db),'context':{'repo_path':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)],'query':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x201)],'model':'morph-warp-grep-v2.1','termination_reason':_0x54f5ab[_0x566ef4(0x1b8)],'sub_tool_errors':_0x34f489,'timings':_0x54f5ab[_0x566ef4(0x202)],'tool_calls':_0x1ccfa9(_0x54f5ab['messages']),'messages':_0x54f5ab[_0x566ef4(0x1f1)]?.[_0x566ef4(0x296)](_0x1f90d3=>({'role':_0x1f90d3['role'],'content':_0x1f90d3['content'],..._0x1f90d3['tool_calls']?{'tool_calls':_0x1f90d3[_0x566ef4(0x21e)][_0x566ef4(0x220)]}:{},..._0x1f90d3['tool_call_id']?{'tool_call_id':_0x1f90d3[_0x566ef4(0x23e)]}:{}}))},'source':_0x566ef4(0x224)})['catch'](()=>{});let _0x38dd53='';if(_0x54f5ab[_0x566ef4(0x1b8)]===_0x566ef4(0x2ad)&&_0x54f5ab[_0x566ef4(0x2bc)]?.[_0x566ef4(0x1e0)]?.[_0x566ef4(0x209)]){const _0x204f70=_0x54f5ab[_0x566ef4(0x2bc)]['metadata'][_0x566ef4(0x209)];if(_0x204f70['length']===0x0)return _0x38dd53=_0x54f5ab[_0x566ef4(0x2bc)][_0x566ef4(0x20e)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x566ef4(0x1ed),'text':_0x38dd53}]};const _0x6f462d=[],_0x51fb8b=[_0x566ef4(0x262)];for(const _0x57e0ab of _0x54f5ab['messages']){if(_0x57e0ab[_0x566ef4(0x22a)]===_0x566ef4(0x1e1)&&Array[_0x566ef4(0x263)](_0x57e0ab[_0x566ef4(0x21e)]))for(const _0x11571c of _0x57e0ab[_0x566ef4(0x21e)]){try{const _0xd315d9=_0x11571c[_0x566ef4(0x2ac)]?.[_0x566ef4(0x2af)],_0xa1b1f=JSON[_0x566ef4(0x28c)](_0x11571c[_0x566ef4(0x2ac)]?.[_0x566ef4(0x2b8)]||'{}');if(_0xd315d9===_0x566ef4(0x229))_0x51fb8b[_0x566ef4(0x1cc)](_0x566ef4(0x1e7)+_0xa1b1f[_0x566ef4(0x1c9)]+_0x566ef4(0x20d)+(_0xa1b1f['path']||'.')+'`');else{if(_0xd315d9===_0x566ef4(0x1eb))_0x51fb8b['push']('-\x20Read\x20file\x20`'+_0xa1b1f[_0x566ef4(0x270)]+'`');else{if(_0xd315d9===_0x566ef4(0x267))_0x51fb8b[_0x566ef4(0x1cc)](_0x566ef4(0x1b4)+(_0xa1b1f[_0x566ef4(0x266)]||'.')+'`');else _0xd315d9===_0x566ef4(0x2a5)&&_0x51fb8b[_0x566ef4(0x1cc)](_0x566ef4(0x230)+_0xa1b1f[_0x566ef4(0x1c9)]+_0x566ef4(0x290)+(_0xa1b1f[_0x566ef4(0x270)]||'.')+'`');}}}catch{}}}_0x6f462d[_0x566ef4(0x1cc)](_0x51fb8b['join']('\x0a'));const _0x2695f3=['',_0x566ef4(0x2a6)];for(const _0x59a67f of _0x204f70){if(_0x59a67f[_0x566ef4(0x204)]==='*')_0x2695f3['push']('-\x20'+_0x59a67f[_0x566ef4(0x270)]+':*');else{if(Array[_0x566ef4(0x263)](_0x59a67f['lines'])){const _0x56176d=_0x59a67f[_0x566ef4(0x204)]['map'](([_0x59cdf0,_0x1a02e6])=>{if(_0x59cdf0===_0x1a02e6)return''+_0x59cdf0;return _0x59cdf0+'-'+_0x1a02e6;});_0x2695f3[_0x566ef4(0x1cc)]('-\x20'+_0x59a67f['path']+':'+_0x56176d['join'](','));}else _0x2695f3[_0x566ef4(0x1cc)]('-\x20'+_0x59a67f[_0x566ef4(0x270)]+':*');}}_0x2695f3[_0x566ef4(0x1cc)](''),_0x6f462d[_0x566ef4(0x1cc)](_0x2695f3[_0x566ef4(0x246)]('\x0a')),_0x6f462d['push'](_0x566ef4(0x232));const _0x36b1a7=[],_0x13a2c1=[];for(const _0x5e9c1f of _0x204f70){let _0x2fb49b=a0_0x243bd3[_0x566ef4(0x21c)](_0x1a5c3e['data'][_0x566ef4(0x264)],_0x5e9c1f[_0x566ef4(0x270)]),_0x5a0ab3=null,_0x4b8f8c=null;try{_0x5a0ab3=await a0_0x3f72bc[_0x566ef4(0x2a2)](_0x2fb49b,{'encoding':'utf-8'});}catch(_0x145990){const _0x38d583=fixPathRepetition(_0x2fb49b);if(_0x38d583)try{_0x5a0ab3=await a0_0x3f72bc['readFile'](_0x38d583,{'encoding':_0x566ef4(0x26d)}),_0x2fb49b=_0x38d583;}catch{_0x4b8f8c=_0x145990 instanceof Error?_0x145990:new Error(String(_0x145990));}else _0x4b8f8c=_0x145990 instanceof Error?_0x145990:new Error(String(_0x145990));}if(_0x5a0ab3!==null){const _0x1dec44=_0x5a0ab3['split'](/\r?\n/),_0x13d0d3=[];if(_0x5e9c1f[_0x566ef4(0x204)]==='*'||!Array[_0x566ef4(0x263)](_0x5e9c1f['lines']))for(let _0x5ecc0e=0x1;_0x5ecc0e<=_0x1dec44[_0x566ef4(0x220)];_0x5ecc0e++){const _0x5918c5=_0x1dec44[_0x5ecc0e-0x1];_0x13d0d3[_0x566ef4(0x1cc)](_0x5ecc0e+'|\x20'+_0x5918c5);}else for(const [_0x4a42f0,_0x39abf5]of _0x5e9c1f['lines']){_0x13d0d3[_0x566ef4(0x220)]>0x0&&_0x13d0d3[_0x566ef4(0x1cc)]('');for(let _0x2b1637=_0x4a42f0;_0x2b1637<=_0x39abf5&&_0x2b1637<=_0x1dec44[_0x566ef4(0x220)];_0x2b1637++){const _0x31f3c9=_0x1dec44[_0x2b1637-0x1];_0x13d0d3[_0x566ef4(0x1cc)](_0x2b1637+'|\x20'+_0x31f3c9);}}_0x13a2c1[_0x566ef4(0x1cc)]({'path':_0x5e9c1f['path'],'content':_0x13d0d3[_0x566ef4(0x246)]('\x0a')});}else _0x36b1a7[_0x566ef4(0x1cc)](_0x566ef4(0x1fa)+_0x5e9c1f[_0x566ef4(0x270)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x4b8f8c?.[_0x566ef4(0x22d)]||_0x566ef4(0x1bb))+'\x0a</file>');}try{const _0x173799=await compactFileContexts(_0x13a2c1,_0x1a5c3e[_0x566ef4(0x27c)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x33389a of _0x173799){_0x36b1a7[_0x566ef4(0x1cc)](_0x566ef4(0x1fa)+_0x33389a[_0x566ef4(0x270)]+_0x566ef4(0x24a)+_0x33389a['content']+'\x0a</file>');}}catch(_0x132e7a){console['error'](_0x566ef4(0x23d),_0x132e7a);for(const _0x2a0089 of _0x13a2c1){_0x36b1a7['push'](_0x566ef4(0x1fa)+_0x2a0089[_0x566ef4(0x270)]+_0x566ef4(0x24a)+_0x2a0089[_0x566ef4(0x225)]+_0x566ef4(0x22b));}}_0x6f462d['push'](_0x36b1a7[_0x566ef4(0x246)]('\x0a\x0a')),_0x38dd53=_0x6f462d[_0x566ef4(0x246)]('\x0a');const _0x543fa0=_0x54f5ab['errors']?.[_0x566ef4(0x21d)](_0x5cbdd3=>_0x5cbdd3['message']?.['startsWith']('File\x20read\x20error:'))||[];if(_0x543fa0['length']>0x0){const _0x22d466=_0x543fa0['map'](_0x5ef0e0=>_0x5ef0e0[_0x566ef4(0x22d)])['join'](';\x20');reportMorphError({'error_message':_0x22d466,'error_type':'FileReadError','context':{'tool':'codebase_search','repo_path':_0x1a5c3e['data'][_0x566ef4(0x264)],'query':_0x1a5c3e[_0x566ef4(0x27c)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x566ef4(0x2bd),'error_count':_0x543fa0[_0x566ef4(0x220)],'is_timeout':![],'timings':_0x54f5ab[_0x566ef4(0x202)],'files_attempted':_0x204f70['map'](_0x4e02f7=>({'path':_0x4e02f7['path'],'lines':_0x4e02f7[_0x566ef4(0x204)]})),'tool_calls':_0x1ccfa9(_0x54f5ab['messages']),'messages':_0x54f5ab[_0x566ef4(0x1f1)]?.[_0x566ef4(0x296)](_0x56d836=>({'role':_0x56d836[_0x566ef4(0x22a)],'content':_0x56d836[_0x566ef4(0x225)],..._0x56d836[_0x566ef4(0x21e)]?{'tool_calls':_0x56d836[_0x566ef4(0x21e)][_0x566ef4(0x220)]}:{},..._0x56d836[_0x566ef4(0x23e)]?{'tool_call_id':_0x56d836[_0x566ef4(0x23e)]}:{}})),'request_content':{'query':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x201)],'repo_path':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)],'repoRoot':a0_0x243bd3[_0x566ef4(0x21c)](_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)]),'model':_0x566ef4(0x25f)}},'source':'mcp-filesystem'})['catch'](()=>{});}}else{if(_0x54f5ab[_0x566ef4(0x1b8)]===_0x566ef4(0x2a3)&&_0x54f5ab[_0x566ef4(0x1df)][_0x566ef4(0x220)]>0x0){const _0x4635dd=_0x54f5ab[_0x566ef4(0x1df)][_0x566ef4(0x296)](_0x307fff=>_0x307fff[_0x566ef4(0x22d)])[_0x566ef4(0x246)](';\x20');_0x38dd53=_0x566ef4(0x214)+_0x4635dd;const _0x1fade0=_0x4635dd['toLowerCase']()['includes'](_0x566ef4(0x261))||_0x4635dd['toLowerCase']()[_0x566ef4(0x1d1)](_0x566ef4(0x250))||_0x4635dd['toLowerCase']()[_0x566ef4(0x1d1)](_0x566ef4(0x1cb)),_0x1b3347=_0x54f5ab[_0x566ef4(0x2bc)]?.[_0x566ef4(0x1e0)]?.[_0x566ef4(0x209)],_0x43adbd=_0x54f5ab[_0x566ef4(0x1df)][0x0];reportMorphError({'error_message':_0x4635dd,'error_type':_0x1fade0?_0x566ef4(0x221):_0x43adbd?.['constructor']?.[_0x566ef4(0x2af)]||_0x566ef4(0x1c2),'context':{'tool':'codebase_search','repo_path':_0x1a5c3e['data'][_0x566ef4(0x264)],'query':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x201)],'model':_0x566ef4(0x25f),'termination_reason':_0x54f5ab[_0x566ef4(0x1b8)],'error_count':_0x54f5ab['errors'][_0x566ef4(0x220)],'is_timeout':_0x1fade0,'timings':_0x54f5ab[_0x566ef4(0x202)],'files_attempted':_0x1b3347?.[_0x566ef4(0x296)](_0x19a110=>({'path':_0x19a110[_0x566ef4(0x270)],'lines':_0x19a110['lines']})),'tool_calls':_0x1ccfa9(_0x54f5ab[_0x566ef4(0x1f1)]),'messages':_0x54f5ab[_0x566ef4(0x1f1)]?.[_0x566ef4(0x296)](_0x59654e=>({'role':_0x59654e['role'],'content':_0x59654e[_0x566ef4(0x225)],..._0x59654e[_0x566ef4(0x21e)]?{'tool_calls':_0x59654e[_0x566ef4(0x21e)][_0x566ef4(0x220)]}:{},..._0x59654e[_0x566ef4(0x23e)]?{'tool_call_id':_0x59654e[_0x566ef4(0x23e)]}:{}})),'request_content':{'query':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x201)],'repo_path':_0x1a5c3e[_0x566ef4(0x27c)]['repo_path'],'repoRoot':a0_0x243bd3[_0x566ef4(0x21c)](_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x43adbd?.[_0x566ef4(0x269)]||undefined,'source':_0x566ef4(0x224)})[_0x566ef4(0x275)](()=>{});}else _0x38dd53=_0x566ef4(0x255);}return{'content':[{'type':'text','text':_0x38dd53}]};}catch(_0x2663a5){const _0x2baacf=_0x2663a5 instanceof Error?_0x2663a5[_0x566ef4(0x22d)]:String(_0x2663a5),_0x4f013e=_0x2baacf['toLowerCase']()[_0x566ef4(0x1d1)](_0x566ef4(0x261))||_0x2baacf['toLowerCase']()[_0x566ef4(0x1d1)](_0x566ef4(0x250))||_0x2baacf[_0x566ef4(0x2a0)]()[_0x566ef4(0x1d1)](_0x566ef4(0x1cb))||_0x2663a5 instanceof Error&&_0x2663a5[_0x566ef4(0x2af)]===_0x566ef4(0x221);return reportMorphError({'error_message':_0x2baacf,'error_type':_0x4f013e?_0x566ef4(0x221):_0x2663a5 instanceof Error?_0x2663a5['constructor']['name']:_0x566ef4(0x222),'context':{'tool':_0x566ef4(0x1db),'repo_path':_0x1a5c3e['data'][_0x566ef4(0x264)],'query':_0x1a5c3e['data'][_0x566ef4(0x201)],'model':'morph-warp-grep-v2.1','is_timeout':_0x4f013e,'exception_phase':_0x566ef4(0x254),'request_content':{'query':_0x1a5c3e[_0x566ef4(0x27c)]['search_string'],'repo_path':_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)],'repoRoot':a0_0x243bd3[_0x566ef4(0x21c)](_0x1a5c3e[_0x566ef4(0x27c)][_0x566ef4(0x264)]),'model':_0x566ef4(0x25f)}},'stack_trace':_0x2663a5 instanceof Error?_0x2663a5[_0x566ef4(0x269)]:undefined,'source':_0x566ef4(0x224)})[_0x566ef4(0x275)](()=>{}),{'content':[{'type':_0x566ef4(0x1ed),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x2baacf}],'isError':![]};}}case'github_codebase_search':{const _0x5c57f9=WarpGrepGitHubArgsSchema['safeParse'](_0x59a674);if(!_0x5c57f9['success'])return{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x2a4)+_0x5c57f9[_0x566ef4(0x1d9)]}],'isError':!![]};const _0x233963=_0x5c57f9[_0x566ef4(0x27c)][_0x566ef4(0x1da)]||_0x5c57f9[_0x566ef4(0x27c)][_0x566ef4(0x29c)];if(!_0x233963)return{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x219)}],'isError':!![]};const _0xb5cbb4=MORPH_API_KEY;if(!_0xb5cbb4)throw new Error(_0x566ef4(0x298));const _0x43e1f6=Date[_0x566ef4(0x2b6)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x233963+_0x566ef4(0x29e)+_0x5c57f9[_0x566ef4(0x27c)][_0x566ef4(0x201)]+'\x22');try{const _0x5be854=new WarpGrepClient({'morphApiKey':_0xb5cbb4,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3c6dbd=await _0x5be854[_0x566ef4(0x2b7)]({'searchTerm':_0x5c57f9['data']['search_string'],'github':_0x233963,'branch':_0x5c57f9[_0x566ef4(0x27c)]['branch']}),_0x564f52=Date[_0x566ef4(0x2b6)]()-_0x43e1f6;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x564f52+_0x566ef4(0x28b)+_0x3c6dbd[_0x566ef4(0x1c6)]);const _0x535b78=formatResult(_0x3c6dbd);return{'content':[{'type':_0x566ef4(0x1ed),'text':_0x535b78}]};}catch(_0x5c483a){const _0x2efb24=Date['now']()-_0x43e1f6,_0x2631b0=_0x5c483a instanceof Error?_0x5c483a[_0x566ef4(0x22d)]:String(_0x5c483a);return logMcpStderr(_0x566ef4(0x1be)+_0x2efb24+_0x566ef4(0x1b7),_0x2631b0),reportMorphError({'error_message':_0x2631b0,'error_type':_0x5c483a instanceof Error?_0x5c483a[_0x566ef4(0x1bc)][_0x566ef4(0x2af)]:_0x566ef4(0x222),'context':{'tool':_0x566ef4(0x231),'github_url':_0x233963,'search_string':_0x5c57f9[_0x566ef4(0x27c)]['search_string'],'branch':_0x5c57f9['data'][_0x566ef4(0x249)]},'stack_trace':_0x5c483a instanceof Error?_0x5c483a[_0x566ef4(0x269)]:undefined,'source':_0x566ef4(0x224),'tool':_0x566ef4(0x231),'latency_ms':_0x2efb24})[_0x566ef4(0x275)](()=>{}),{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x1bd)+_0x2631b0}],'isError':![]};}}default:throw new Error(_0x566ef4(0x265)+_0x512c1b);}}catch(_0x3b354f){const _0x4be0a4=_0x3b354f instanceof Error?_0x3b354f[_0x566ef4(0x22d)]:String(_0x3b354f);return reportMorphError({'error_message':_0x4be0a4,'error_type':_0x3b354f instanceof Error?_0x3b354f[_0x566ef4(0x1bc)][_0x566ef4(0x2af)]:_0x566ef4(0x222),'context':{'tool':_0x512c1b,'arguments':_0x59a674?JSON[_0x566ef4(0x233)](_0x59a674)[_0x566ef4(0x234)](0x0,0x1f4):undefined,'mcp_server_version':_0x566ef4(0x2a9)},'stack_trace':_0x3b354f instanceof Error?_0x3b354f[_0x566ef4(0x269)]:undefined,'source':_0x566ef4(0x224)})[_0x566ef4(0x275)](()=>{}),{'content':[{'type':_0x566ef4(0x1ed),'text':_0x566ef4(0x214)+_0x4be0a4}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x259bdd){const _0x4ac422=a0_0x3a7f66,_0x496074=await getValidRootDirectories(_0x259bdd);if(_0x496074[_0x4ac422(0x220)]>0x0)allowedDirectories=[..._0x496074],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x496074[_0x4ac422(0x220)]+_0x4ac422(0x200));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x2ed47a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x2ed47a&&(allowedDirectories=[_0x2ed47a],logMcpStderr(_0x4ac422(0x276)+_0x2ed47a));}catch(_0x2ba65f){logMcpStderr(_0x4ac422(0x248)+_0x2ba65f);}}}function a0_0x37e3(){const _0x2deb0f=['requiresApiKey','Failed\x20to\x20request\x20roots\x20from\x20client:','ENOENT','morph-warp-grep-v2.1','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','timeout','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','isArray','repo_path','Unknown\x20tool:\x20','command','list_directory','size','stack','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','version','\x20chars)','utf-8','realpath','--version','path','glob\x20\x27','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','enum','catch','Fallback:\x20Using\x20workspace\x20root\x20','number','1686kRuHHD','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','Warning:\x20','application/json','data','sep','ToolException','BinaryFile','roots','morph-mcp','setNotificationHandler','.\x20Changes:\x20','WarpGrep\x20sub-tool\x20errors:\x20','instruction','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.','normalize','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','ms.\x20Success:\x20','parse','\x20(new\x20file)','search_type','added\x20','`\x20in\x20`','grep','Max\x20results\x20to\x20return','Cargo.toml','package.json','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','map','source','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','RipgrepNotAvailable','DISABLED_TOOLS','https://morphllm.com/api/error-report','owner_repo','morph-','\x20for:\x20\x22','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','toLowerCase','startsWith','readFile','terminated','Invalid\x20arguments:\x20','glob','Relevant\x20context\x20found:','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','instructions','0.2.0','getClientCapabilities','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','function','completed','code','name','.git','description','object','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.','has','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','now','searchGitHub','arguments','--help','MORPH_API_KEY','linesRemoved','finish','completed_with_file_errors','--api-key=','Repository\x20identifier','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','exit','-\x20Listed\x20directory\x20`','Disabled\x20tools:\x20','morph-v3-fast','ms:','terminationReason','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','trim','Unknown\x20error','constructor','GitHub\x20search\x20failed:\x20','[github_codebase_search]\x20Failed\x20in\x20','stat','dirname','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','WarpGrepError','dryRun','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','15BxUlBd','success','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','ReadError','pattern','inputSchema','etimedout','push','\x20-\x20','Morph\x20Edit\x20Preview','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','Workspace\x20mode\x20enabled:\x20Using\x20','includes','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Error\x20accessing\x20directory\x20','optional','sk-','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','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','SubToolError','error','github_url','codebase_search','edit_file','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','errors','metadata','assistant','oninitialized','all','1255968stbTHA','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','-\x20Grepped\x20\x27','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','MORPH_API_URL','\x20is\x20not\x20a\x20directory','read','context','text','api-key','@morphllm/morphmcp\x20','--api-key','messages','composer.json','\x20error(s)','indexOf','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','split','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','node_modules','Specific\x20commit\x20hash\x20to\x20search','<file\x20path=\x22','539444JVhSSf','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','\x0a...\x20(truncated,\x20total:\x20','Bearer\x20','1325CdOhDk','\x20valid\x20directories','search_string','timings','argv','lines','Benefits:\x0a','ENABLE_WORKSPACE_MODE','slice','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','files','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','read\x20','linesAdded','\x27\x20in\x20`','payload','go.mod','setRequestHandler','default','\x22.\x20Known\x20tools:\x20','Tool\x20','Error:\x20','isDirectory','tsconfig.json','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','every','Created\x20File','resolve','filter','tool_calls','.\x20Path:\x20','length','TimeoutError','UnknownError','connect','mcp-filesystem','content','WORKSPACE_ROOT','post','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.','grep_search','role','\x0a</file>','params','message','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Morph\x20Edit\x20','-\x20Glob\x20search\x20`','github_codebase_search','Here\x20is\x20the\x20content\x20of\x20files:\x0a','stringify','substring','listRoots','7898288RSGzRt','code_edit','unknown\x20error','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','log','MORPH_WARP_GREP_TIMEOUT','basename','[codebase_search]\x20compaction\x20failed','tool_call_id','some','PathError','user','cwd','3437928LpwaLU','linesModified','95256vMHHVL','join','describe','Warning:\x20Workspace\x20fallback\x20failed:\x20','branch','\x22>\x0a','\x20as\x20allowed\x20directory','match','unknown','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','completionId','timed\x20out','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','min','string','runWarpGrep_call','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','env','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','access','5848976kLCVdT','RipgrepError','warn'];a0_0x37e3=function(){return _0x2deb0f;};return a0_0x37e3();}server[a0_0x3a7f66(0x282)](RootsListChangedNotificationSchema,async()=>{const _0x2857d9=a0_0x3a7f66;try{const _0x515968=await server[_0x2857d9(0x235)]();_0x515968&&'roots'in _0x515968&&await updateAllowedDirectoriesFromRoots(_0x515968[_0x2857d9(0x280)]);}catch(_0x47fd48){logMcpStderr(_0x2857d9(0x25d),_0x47fd48 instanceof Error?_0x47fd48['message']:String(_0x47fd48));}}),server[a0_0x3a7f66(0x1e2)]=async()=>{const _0x42a0dc=a0_0x3a7f66,_0x2b65ba=server[_0x42a0dc(0x2aa)]();if(_0x2b65ba?.[_0x42a0dc(0x280)])try{const _0x3c2dc8=await server['listRoots']();_0x3c2dc8&&_0x42a0dc(0x280)in _0x3c2dc8?await updateAllowedDirectoriesFromRoots(_0x3c2dc8['roots']):logMcpStderr(_0x42a0dc(0x239));}catch(_0x223bcb){logMcpStderr(_0x42a0dc(0x2b5),_0x223bcb instanceof Error?_0x223bcb[_0x42a0dc(0x22d)]:String(_0x223bcb));}else{if(allowedDirectories[_0x42a0dc(0x220)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x42a0dc(0x24e));else throw new Error(_0x42a0dc(0x286));}}};async function runServer(){const _0x3ac46e=a0_0x3a7f66,_0x105778=new StdioServerTransport();await server[_0x3ac46e(0x223)](_0x105778),logMcpStderr(_0x3ac46e(0x29f)),allowedDirectories[_0x3ac46e(0x220)]===0x0&&logMcpStderr(_0x3ac46e(0x260));}runServer()['catch'](_0x343be9=>{const _0x4a67b6=a0_0x3a7f66;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x343be9),process[_0x4a67b6(0x1b3)](0x1);});
2
+ const a0_0x4156c2=a0_0x4280;(function(_0x3b4c4e,_0x4d93dd){const _0x30c2ee=a0_0x4280,_0x49e3f4=_0x3b4c4e();while(!![]){try{const _0x56cba8=-parseInt(_0x30c2ee(0x158))/0x1*(-parseInt(_0x30c2ee(0x15d))/0x2)+parseInt(_0x30c2ee(0x193))/0x3*(-parseInt(_0x30c2ee(0x175))/0x4)+-parseInt(_0x30c2ee(0x178))/0x5+-parseInt(_0x30c2ee(0x125))/0x6*(parseInt(_0x30c2ee(0x1f7))/0x7)+-parseInt(_0x30c2ee(0x176))/0x8*(-parseInt(_0x30c2ee(0x156))/0x9)+-parseInt(_0x30c2ee(0x11c))/0xa*(parseInt(_0x30c2ee(0x210))/0xb)+parseInt(_0x30c2ee(0x1a4))/0xc;if(_0x56cba8===_0x4d93dd)break;else _0x49e3f4['push'](_0x49e3f4['shift']());}catch(_0x2dddb3){_0x49e3f4['push'](_0x49e3f4['shift']());}}}(a0_0x2052,0xeecb2));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';function a0_0x4280(_0x9c0ce1,_0xe24550){_0x9c0ce1=_0x9c0ce1-0x10f;const _0x205212=a0_0x2052();let _0x4280d6=_0x205212[_0x9c0ce1];return _0x4280d6;}import a0_0x1447fd from'fs/promises';function a0_0x2052(){const _0x59f872=['Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','dryRun','dirname','MORPH_API_KEY','search_string','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','resolve','Warning:\x20','requiresApiKey','MORPH_WARP_GREP_TIMEOUT','description','timed\x20out','File\x20read\x20error:','linesAdded','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','unknown','user','\x20for:\x20\x22','7584010VFCpUu','-\x20Grepped\x20\x27','string','Failed\x20to\x20read\x20file:\x20','pattern','Preview\x20changes\x20without\x20applying\x20them.','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','\x22.\x20Known\x20tools:\x20','completed_with_file_errors','tool_calls','composer.json','\x20error(s)','\x27\x20in\x20`','floor','roots','0.2.0','Error\x20accessing\x20directory\x20','log','repo_path','sep','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','files','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','warn','ENOENT','79354TokSWO','-\x20Listed\x20directory\x20`','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','code','etimedout','Benefits:\x0a','utf-8','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','includes','Error\x20running\x20fast\x20context\x20search:\x20','readFile','@morphllm/morphmcp\x20','boolean','Here\x20is\x20the\x20content\x20of\x20files:\x0a','startsWith','stack','[codebase_search]\x20compaction\x20failed','metadata','[github_codebase_search]\x20Searching\x20','safeParse','WarpGrep\x20sub-tool\x20errors:\x20','code_edit','1630icyAkQ','env','constructor','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','.\x20Changes:\x20','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','stat','substring','6HigHiB','morph-warp-grep-v2.1','role','array','instructions','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','catch','https://morphllm.com/api/error-report','completed','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Disabled\x20tools:\x20','messages','push','Bearer\x20','describe','Cargo.toml','path','\x0a...\x20(truncated,\x20total:\x20','searchGitHub','listRoots','every','basename','read\x20','function','WORKSPACE_ROOT','join','list_directory\x20','lines','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','grep','pyproject.toml','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','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.','.cursor','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','number','-\x20Read\x20file\x20`','message','errors','arguments','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','default','\x20\x20morph-mcp','has',',\x20modified\x20','setRequestHandler','homedir','262422AXrxUZ','.\x20Path:\x20','40153YRflQD','glob','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.','ms:','some','24dfNnZh','instruction','finish','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','TimeoutError',',\x20removed\x20','timings','unknown\x20error','[could\x20not\x20read\x20file:\x20','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Specific\x20commit\x20hash\x20to\x20search','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','indexOf','mcp-filesystem','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','optional','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Unknown\x20error','grep_search','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','\x20disabled\x20via\x20DISABLED_TOOLS','application/json','44rsYhWw','424NtuYZo','codebase_search','433885rFutyS','api-key','Repository\x20identifier','data','all','ReadError','length','\x20-\x20','Tool\x20','success','WarpGrepError','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','UnknownError','--version','\x0a</file>','package.json','\x20(new\x20file)','now','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','exit','access','content','[github_codebase_search]\x20Failed\x20in\x20','FileReadError','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','edit_file','425349aHbdHc','error','Morph\x20Edit\x20Preview','read','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','parse','`\x20in\x20`','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','branch','map','toLowerCase','Error:\x20','list_directory','assistant','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','FileNotFound','min','34279080MUfMPk','source','-\x20Glob\x20search\x20`','tool','slice','\x22>\x0a','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','match','\x20valid\x20directories','Invalid\x20arguments:\x20','object','\x20is\x20not\x20a\x20directory','filter','text','glob\x20\x27','realpath','tool_call_id','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','Applied','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','<file\x20path=\x22','false','../package.json','Relevant\x20context\x20found:','trim','split','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','SubToolError','morph-v3-fast','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','name','Max\x20results\x20to\x20return','node_modules','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Rules:\x0a','oninitialized','SymlinkError','terminationReason','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','toISOString','.git','version','isArray','BinaryFile','❌\x20Morph\x20Edit\x20Failed:\x20','argv','\x20chars)','[github_codebase_search]\x20Done\x20in\x20','github_codebase_search','Tool\x20\x22','RipgrepError','isDirectory','payload','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','post','context','Fatal\x20error\x20running\x20server:','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','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','runWarpGrep_call','Created\x20File','DISABLED_TOOLS','timeout'];a0_0x2052=function(){return _0x59f872;};return a0_0x2052();}import a0_0x14f3ce from'path';import a0_0x4008c1 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{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_0x3ac5d5 from'axios';function fixPathRepetition(_0x1eb9a6){const _0x24266d=a0_0x4280,_0x2c16c8=_0x1eb9a6[_0x24266d(0x1be)](a0_0x14f3ce[_0x24266d(0x20a)])[_0x24266d(0x1b0)](Boolean);if(_0x2c16c8[_0x24266d(0x17e)]<0x2)return null;for(let _0x357651=Math[_0x24266d(0x204)](_0x2c16c8[_0x24266d(0x17e)]/0x2);_0x357651>=0x1;_0x357651--){for(let _0x33df63=0x0;_0x33df63<=_0x2c16c8[_0x24266d(0x17e)]-0x2*_0x357651;_0x33df63++){const _0x45d5ff=_0x2c16c8[_0x24266d(0x1a8)](_0x33df63,_0x33df63+_0x357651),_0xfe21f1=_0x2c16c8['slice'](_0x33df63+_0x357651,_0x33df63+0x2*_0x357651);if(_0x45d5ff[_0x24266d(0x139)]((_0x17d85b,_0x5298d6)=>_0x17d85b===_0xfe21f1[_0x5298d6])){const _0x21d648=[..._0x2c16c8[_0x24266d(0x1a8)](0x0,_0x33df63),..._0x2c16c8['slice'](_0x33df63+_0x357651)];return a0_0x14f3ce[_0x24266d(0x20a)]+_0x21d648[_0x24266d(0x13e)](a0_0x14f3ce[_0x24266d(0x20a)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xef69b9=a0_0x4280;try{const _0xe53463=require(_0xef69b9(0x1bb));return _0xe53463[_0xef69b9(0x1ce)]??_0xef69b9(0x1f4);}catch(_0x2eb3bf){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x2eb3bf),_0xef69b9(0x1f4);}}function printHelp(){const _0x5cd305=a0_0x4280;console[_0x5cd305(0x208)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x5cd305(0x208)](_0x5cd305(0x1da)),console[_0x5cd305(0x208)]('\x0aOptions:'),console[_0x5cd305(0x208)](_0x5cd305(0x1aa)),console['log'](_0x5cd305(0x172)),console[_0x5cd305(0x208)](_0x5cd305(0x147)),console[_0x5cd305(0x208)]('\x0aExamples:'),console['log'](_0x5cd305(0x151)),console['log'](_0x5cd305(0x1c6));}const cliArgs=process[a0_0x4156c2(0x1d2)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x4156c2(0x185),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x4156c2(0x15c)](_0x15d50f=>VERSION_FLAGS['has'](_0x15d50f))&&(console[a0_0x4156c2(0x208)](a0_0x4156c2(0x111)+getPackageVersion()),process[a0_0x4156c2(0x18c)](0x0));cliArgs[a0_0x4156c2(0x15c)](_0x526802=>HELP_FLAGS[a0_0x4156c2(0x152)](_0x526802))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x20be01){const _0x278ec0=a0_0x4156c2;for(let _0x4674d2=0x0;_0x4674d2<cliArgs[_0x278ec0(0x17e)];_0x4674d2++){const _0x48b8be=cliArgs[_0x4674d2];if(_0x48b8be[_0x278ec0(0x114)]('--'+_0x20be01+'='))return _0x48b8be[_0x278ec0(0x1a8)](('--'+_0x20be01+'=')[_0x278ec0(0x17e)]);if(_0x48b8be==='--'+_0x20be01&&_0x4674d2+0x1<cliArgs['length'])return cliArgs[_0x4674d2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x4156c2(0x17e)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4156c2(0x152)](arg)||HELP_FLAGS[a0_0x4156c2(0x152)](arg))continue;if(arg[a0_0x4156c2(0x114)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x13d)]||process[a0_0x4156c2(0x11d)]['PWD']||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x4156c2(0x11d)]['ENABLE_WORKSPACE_MODE']!==a0_0x4156c2(0x1ba),MORPH_API_KEY=getCliArg(a0_0x4156c2(0x179))??process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1e7)],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1ee)]?parseInt(process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1ee)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x4156c2(0x192),a0_0x4156c2(0x177),a0_0x4156c2(0x1d5)]),DISABLED_TOOLS=process['env'][a0_0x4156c2(0x1e2)]?new Set(process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1e2)][a0_0x4156c2(0x1be)](',')['map'](_0x1d83ea=>_0x1d83ea[a0_0x4156c2(0x1bd)]())['filter'](_0x5384bf=>_0x5384bf['length']>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x4156c2(0x152)](tool)&&console[a0_0x4156c2(0x194)](a0_0x4156c2(0x1b8)+tool+a0_0x4156c2(0x1fe)+[...KNOWN_TOOL_NAMES][a0_0x4156c2(0x13e)](',\x20'));}console['error'](a0_0x4156c2(0x12f)+[...DISABLED_TOOLS][a0_0x4156c2(0x13e)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x4156c2(0x114)]('sk-')&&!MORPH_API_KEY[a0_0x4156c2(0x114)]('morph-')&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x6571a5){const _0x3253a3=a0_0x4156c2;try{await a0_0x3ac5d5[_0x3253a3(0x1db)](_0x3253a3(0x12c),{..._0x6571a5,'timestamp':new Date()[_0x3253a3(0x1cc)](),'source':_0x6571a5[_0x3253a3(0x1a5)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x6571a5[_0x3253a3(0x1dc)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3253a3(0x174),'Authorization':_0x3253a3(0x132)+MORPH_API_KEY}});}catch{}}args[a0_0x4156c2(0x17e)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x4156c2(0x141)),logMcpStderr(a0_0x4156c2(0x11f)),logMcpStderr(a0_0x4156c2(0x183)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x4156c2(0x218)));function normalizePath(_0x58e25f){return a0_0x14f3ce['normalize'](_0x58e25f);}function expandHome(_0x31d7a4){const _0x58744f=a0_0x4156c2;if(_0x31d7a4[_0x58744f(0x114)]('~/')||_0x31d7a4==='~')return a0_0x14f3ce[_0x58744f(0x13e)](a0_0x4008c1[_0x58744f(0x155)](),_0x31d7a4[_0x58744f(0x1a8)](0x1));return _0x31d7a4;}let allowedDirectories=await Promise[a0_0x4156c2(0x17c)](args[a0_0x4156c2(0x19c)](async _0x3f6291=>{const _0xdad4dc=a0_0x4156c2,_0x4f912c=expandHome(_0x3f6291),_0x2e501a=a0_0x14f3ce['resolve'](_0x4f912c);try{const _0x2ed0e9=await a0_0x1447fd[_0xdad4dc(0x1b3)](_0x2e501a);return normalizePath(_0x2ed0e9);}catch(_0x4b5601){return normalizePath(_0x2e501a);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4156c2(0x17e)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4156c2(0x131)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x5c2791){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x5c2791);}async function detectWorkspaceRoot(_0x4bc802){const _0x3e15a1=a0_0x4156c2;let _0xc23afc=a0_0x14f3ce[_0x3e15a1(0x1eb)](_0x4bc802);const _0x1aff2f=[_0x3e15a1(0x1cd),'.vscode',_0x3e15a1(0x187),_0x3e15a1(0x134),_0x3e15a1(0x143),'go.mod',_0x3e15a1(0x146),'tsconfig.json',_0x3e15a1(0x201)];while(_0xc23afc!==a0_0x14f3ce[_0x3e15a1(0x1e6)](_0xc23afc)){for(const _0x232736 of _0x1aff2f){const _0x298411=a0_0x14f3ce[_0x3e15a1(0x13e)](_0xc23afc,_0x232736);try{return await a0_0x1447fd[_0x3e15a1(0x18d)](_0x298411),normalizePath(_0xc23afc);}catch{}}_0xc23afc=a0_0x14f3ce[_0x3e15a1(0x1e6)](_0xc23afc);}return normalizePath(_0x4bc802);}await Promise[a0_0x4156c2(0x17c)](args[a0_0x4156c2(0x19c)](async _0x4a1034=>{const _0x29809d=a0_0x4156c2;try{const _0x2088d7=await a0_0x1447fd[_0x29809d(0x123)](expandHome(_0x4a1034));!_0x2088d7[_0x29809d(0x1d8)]()&&(logMcpStderr(_0x29809d(0x19e)+_0x4a1034+_0x29809d(0x1af)),process[_0x29809d(0x18c)](0x1));}catch(_0x179fce){logMcpStderr(_0x29809d(0x207)+_0x4a1034+':',_0x179fce),process[_0x29809d(0x18c)](0x1);}}));async function validatePath(_0x214321){const _0xa01c0d=a0_0x4156c2,_0x9ade45=expandHome(_0x214321),_0x285745=a0_0x14f3ce[_0xa01c0d(0x1eb)](_0x9ade45);try{const _0x3ff01b=await a0_0x1447fd[_0xa01c0d(0x1b3)](_0x285745);return _0x3ff01b;}catch(_0x18468f){if(_0x18468f[_0xa01c0d(0x213)]===_0xa01c0d(0x20f)){const _0x19c2dd=a0_0x14f3ce['dirname'](_0x285745);try{const _0x1d1bd=await a0_0x1447fd['realpath'](_0x19c2dd);return a0_0x14f3ce['join'](_0x1d1bd,a0_0x14f3ce[_0xa01c0d(0x13a)](_0x285745));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x19c2dd);}}throw _0x18468f;}}const MorphEditFileArgsSchema=z[a0_0x4156c2(0x1ae)]({'path':z[a0_0x4156c2(0x1f9)](),'code_edit':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1e9)),'instruction':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x16f)),'dryRun':z[a0_0x4156c2(0x112)]()[a0_0x4156c2(0x150)](![])['describe'](a0_0x4156c2(0x1fc))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x4156c2(0x145),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1b5)),'search_type':z['enum'](['default','node_modules'])['optional']()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1e4))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x4156c2(0x1f9)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x4156c2(0x1f9)]()['optional']()[a0_0x4156c2(0x133)]('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.'),'owner_repo':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1de)),'branch':z['string']()['optional']()[a0_0x4156c2(0x133)](a0_0x4156c2(0x12e))}),CodebaseSearchArgsSchema=z[a0_0x4156c2(0x1ae)]({'query':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x17a)),'branch':z['string']()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1ea)),'commitHash':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x169)),'targetDirectories':z[a0_0x4156c2(0x128)](z['string']())[a0_0x4156c2(0x150)]([])['describe'](a0_0x4156c2(0x1b7)),'limit':z[a0_0x4156c2(0x149)]()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x150)](0xa)[a0_0x4156c2(0x133)](a0_0x4156c2(0x1c4))}),server=new Server({'name':'morph-mcp','version':a0_0x4156c2(0x206)},{'capabilities':{'tools':{}}});server[a0_0x4156c2(0x154)](ListToolsRequestSchema,async()=>{const _0x531cbe=a0_0x4156c2,_0x5105fc=[{'name':_0x531cbe(0x192),'description':_0x531cbe(0x1fd)+_0x531cbe(0x191)+_0x531cbe(0x1cb)+_0x531cbe(0x19a)+_0x531cbe(0x215)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x531cbe(0x161)+_0x531cbe(0x1bf)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x531cbe(0x167)+'For\x20deletions:\x0a'+_0x531cbe(0x120)+_0x531cbe(0x160)+_0x531cbe(0x1c7)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x531cbe(0x20d)+_0x531cbe(0x168)+_0x531cbe(0x18b)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+_0x531cbe(0x1c2)+_0x531cbe(0x20b),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x531cbe(0x177),'description':_0x531cbe(0x1df)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x531cbe(0x14f)+'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':!![]}],_0x3abcdb=_0x5105fc[_0x531cbe(0x1b0)](_0x53941d=>{const _0x4ea788=_0x531cbe;if(DISABLED_TOOLS[_0x4ea788(0x152)](_0x53941d['name']))return console[_0x4ea788(0x194)](_0x4ea788(0x180)+_0x53941d['name']+_0x4ea788(0x173)),![];if(_0x4ea788(0x1ed)in _0x53941d&&_0x53941d['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x4ea788(0x1ec)+_0x53941d['name']+_0x4ea788(0x1a1)),![];return!![];});return{'tools':_0x3abcdb[_0x531cbe(0x19c)](_0x4b1d00=>({'name':_0x4b1d00['name'],'description':_0x4b1d00[_0x531cbe(0x1ef)],'inputSchema':_0x4b1d00['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x1cf084=>{const _0x23274c=a0_0x4156c2,{name:_0x275d4e,arguments:_0x33842c}=_0x1cf084['params'];try{if(DISABLED_TOOLS[_0x23274c(0x152)](_0x275d4e))throw new Error(_0x23274c(0x1d6)+_0x275d4e+'\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable');switch(_0x275d4e){case _0x23274c(0x192):{const _0x50c27c=_0x33842c&&typeof _0x33842c==='object'&&_0x23274c(0x129)in _0x33842c&&!(_0x23274c(0x15e)in _0x33842c)?{..._0x33842c,'instruction':_0x33842c[_0x23274c(0x129)],'instructions':undefined}:_0x33842c,_0x2c7a9d=MorphEditFileArgsSchema[_0x23274c(0x119)](_0x50c27c);if(!_0x2c7a9d[_0x23274c(0x181)])throw new Error(_0x23274c(0x148)+_0x2c7a9d[_0x23274c(0x194)]);const _0x38153a=await validatePath(_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x135)]);let _0x4adbad=null,_0x421468=!![],_0x30485d=null;try{_0x4adbad=await a0_0x1447fd[_0x23274c(0x110)](_0x38153a,_0x23274c(0x216));}catch(_0x1623cb){const _0x44ebd0=_0x1623cb[_0x23274c(0x213)];_0x44ebd0===_0x23274c(0x20f)?(_0x421468=![],_0x4adbad=''):(_0x30485d=_0x23274c(0x1fa)+(_0x44ebd0||_0x23274c(0x1f4))+_0x23274c(0x17f)+(_0x1623cb instanceof Error?_0x1623cb[_0x23274c(0x14b)]:String(_0x1623cb)),logMcpStderr(_0x23274c(0x1ec)+_0x30485d));}let _0x1c4392;try{const _0x55a3ba=MORPH_API_KEY;if(!_0x55a3ba)throw new Error(_0x23274c(0x212));const _0x3bcb9a=a0_0x14f3ce['dirname'](_0x38153a),_0xa1197b=a0_0x14f3ce['basename'](_0x38153a),_0x39f737=await executeEditFile({'target_filepath':_0xa1197b,'code_edit':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x11b)],'instruction':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x15e)]},{'morphApiKey':_0x55a3ba,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3bcb9a,'autoWrite':!_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)],'generateUdiff':![],'debug':![]});_0x1c4392=_0x39f737['completionId'];if(!_0x39f737[_0x23274c(0x181)])throw new Error(_0x39f737[_0x23274c(0x194)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x43c0e6=_0x39f737['changes'],_0x5ac8be='added\x20'+_0x43c0e6[_0x23274c(0x1f2)]+_0x23274c(0x163)+_0x43c0e6['linesRemoved']+_0x23274c(0x153)+_0x43c0e6['linesModified'];if(_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)])return{'content':[{'type':'text','text':_0x23274c(0x195)+(_0x421468?'':_0x23274c(0x188))+':\x20'+_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x15e)]+_0x23274c(0x121)+_0x5ac8be+_0x23274c(0x157)+_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x135)]+'.'}]};return{'content':[{'type':_0x23274c(0x1b1),'text':'Morph\x20Edit\x20'+(_0x421468?_0x23274c(0x1b6):_0x23274c(0x1e1))+':\x20'+_0x2c7a9d['data'][_0x23274c(0x15e)]+_0x23274c(0x121)+_0x5ac8be+_0x23274c(0x157)+_0x2c7a9d['data'][_0x23274c(0x135)]+'.'}]};}catch(_0x5e0a4a){const _0x206ef5=_0x5e0a4a instanceof Error?_0x5e0a4a[_0x23274c(0x14b)]:String(_0x5e0a4a);return reportMorphError({'error_message':_0x206ef5,'error_type':_0x5e0a4a instanceof Error?_0x5e0a4a['constructor'][_0x23274c(0x1c3)]:_0x23274c(0x184),'context':{'tool':_0x23274c(0x192),'completion_id':_0x1c4392,'file_path':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x135)],'validated_path':_0x38153a,'instruction':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x15e)],'model':_0x23274c(0x1c1),'dry_run':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)],'file_exists':_0x421468,'file_read_error':_0x30485d,'file_readable':_0x4adbad!==null,'request_content':{'path':_0x2c7a9d['data']['path'],'code_edit':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x11b)],'instruction':_0x2c7a9d[_0x23274c(0x17b)]['instruction'],'original_code':_0x4adbad!==null?_0x4adbad[_0x23274c(0x17e)]>0xc350?_0x4adbad['substring'](0x0,0xc350)+_0x23274c(0x136)+_0x4adbad['length']+_0x23274c(0x1d3):_0x4adbad:_0x23274c(0x166)+(_0x30485d||_0x23274c(0x165))+']','original_code_length':_0x4adbad?.['length']??0x0,'model':_0x23274c(0x1c1),'dry_run':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)]}},'stack_trace':_0x5e0a4a instanceof Error?_0x5e0a4a[_0x23274c(0x115)]:undefined,'source':_0x23274c(0x16c)})['catch'](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x1d1)+_0x206ef5}],'isError':!![]};}}case _0x23274c(0x177):{const _0x4219d1=WarpGrepArgsSchema[_0x23274c(0x119)](_0x33842c);if(!_0x4219d1['success'])return{'content':[{'type':'text','text':_0x23274c(0x1ad)+_0x4219d1[_0x23274c(0x194)]}],'isError':!![]};const _0x3351a7=_0x47b3de=>{const _0x54e1f0=_0x23274c,_0x10e8d2=[];for(const _0x466869 of _0x47b3de||[]){if(_0x466869[_0x54e1f0(0x127)]===_0x54e1f0(0x1a0)&&Array[_0x54e1f0(0x1cf)](_0x466869[_0x54e1f0(0x200)]))for(const _0x5ae960 of _0x466869[_0x54e1f0(0x200)]){try{const _0x1bd3aa=_0x5ae960[_0x54e1f0(0x13c)]?.[_0x54e1f0(0x1c3)],_0x293402=JSON[_0x54e1f0(0x198)](_0x5ae960['function']?.[_0x54e1f0(0x14d)]||'{}');if(_0x1bd3aa===_0x54e1f0(0x171))_0x10e8d2[_0x54e1f0(0x131)]('grep\x20\x27'+_0x293402[_0x54e1f0(0x1fb)]+'\x27\x20'+(_0x293402[_0x54e1f0(0x135)]||'.'));else{if(_0x1bd3aa===_0x54e1f0(0x196))_0x10e8d2['push'](_0x54e1f0(0x13b)+_0x293402['path']);else{if(_0x1bd3aa===_0x54e1f0(0x19f))_0x10e8d2[_0x54e1f0(0x131)](_0x54e1f0(0x13f)+(_0x293402['command']||'.'));else{if(_0x1bd3aa===_0x54e1f0(0x159))_0x10e8d2[_0x54e1f0(0x131)](_0x54e1f0(0x1b2)+_0x293402[_0x54e1f0(0x1fb)]+'\x27\x20'+(_0x293402[_0x54e1f0(0x135)]||'.'));else _0x1bd3aa===_0x54e1f0(0x15f)&&_0x10e8d2[_0x54e1f0(0x131)](_0x54e1f0(0x15f));}}}}catch{}}}return _0x10e8d2;},_0x58bddd=_0x41d8f2=>{const _0x15d023=_0x23274c,_0x1c6c98=[];if(!_0x41d8f2||!Array[_0x15d023(0x1cf)](_0x41d8f2))return _0x1c6c98;const _0x368f23=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x15d023(0x1a2),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x15d023(0x17d),'tool':_0x15d023(0x196)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x15d023(0x196)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x15d023(0x1d7),'tool':_0x15d023(0x142)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x15d023(0x142)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x15d023(0x1d0),'tool':_0x15d023(0x196)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x15d023(0x196)},{'pattern':/not a text file/,'error_type':_0x15d023(0x1d0),'tool':_0x15d023(0x196)},{'pattern':/symbolic link/,'error_type':_0x15d023(0x1c9),'tool':_0x15d023(0x196)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x15d023(0x196)},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x15d023(0x1f4)}];let _0x1b5f78=0x0;for(const _0x54fd2b of _0x41d8f2){_0x54fd2b[_0x15d023(0x127)]===_0x15d023(0x1a0)&&Array[_0x15d023(0x1cf)](_0x54fd2b[_0x15d023(0x200)])&&_0x1b5f78++;const _0x3baf2e=_0x54fd2b[_0x15d023(0x18e)];if((_0x54fd2b[_0x15d023(0x127)]===_0x15d023(0x1a7)||_0x54fd2b[_0x15d023(0x127)]===_0x15d023(0x1f5))&&_0x3baf2e&&typeof _0x3baf2e==='string')for(const {pattern:_0x4e789c,error_type:_0x5482cb,tool:_0x3b6b10}of _0x368f23){const _0x527c87=_0x3baf2e[_0x15d023(0x1ab)](new RegExp(_0x4e789c[_0x15d023(0x1a5)],'g'));if(_0x527c87)for(const _0x2f238e of _0x527c87){const _0x39c2f2=_0x3baf2e[_0x15d023(0x16b)](_0x2f238e),_0x1ed514=_0x3baf2e[_0x15d023(0x124)](_0x39c2f2,Math[_0x15d023(0x1a3)](_0x39c2f2+0xc8,_0x3baf2e[_0x15d023(0x17e)]));_0x1c6c98[_0x15d023(0x131)]({'tool':_0x3b6b10,'error_type':_0x5482cb,'error_message':_0x1ed514[_0x15d023(0x1be)]('\x0a')[0x0],'turn':_0x1b5f78});}}}return _0x1c6c98;};try{const _0x55ae8e=a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)]),_0x279a40=_0x4219d1[_0x23274c(0x17b)]['search_type'],_0x2c7ce0=_0x279a40===_0x23274c(0x1c5)?{'allowNames':[_0x23274c(0x1c5)]}:undefined,_0x13024d=new LocalRipgrepProvider(_0x55ae8e,undefined,_0x2c7ce0),_0x273a1a=await runWarpGrep({'searchTerm':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'repoRoot':_0x55ae8e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x13024d,'search_type':_0x279a40}),_0x3a1d00=_0x58bddd(_0x273a1a[_0x23274c(0x130)]);_0x3a1d00['length']>0x0&&reportMorphError({'error_message':_0x23274c(0x11a)+_0x3a1d00[_0x23274c(0x17e)]+_0x23274c(0x202),'error_type':_0x23274c(0x1c0),'level':_0x23274c(0x20e),'tool':_0x23274c(0x177),'context':{'repo_path':_0x4219d1['data'][_0x23274c(0x209)],'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'model':_0x23274c(0x126),'termination_reason':_0x273a1a[_0x23274c(0x1ca)],'sub_tool_errors':_0x3a1d00,'timings':_0x273a1a['timings'],'tool_calls':_0x3351a7(_0x273a1a[_0x23274c(0x130)]),'messages':_0x273a1a[_0x23274c(0x130)]?.[_0x23274c(0x19c)](_0x37c104=>({'role':_0x37c104[_0x23274c(0x127)],'content':_0x37c104[_0x23274c(0x18e)],..._0x37c104['tool_calls']?{'tool_calls':_0x37c104[_0x23274c(0x200)]['length']}:{},..._0x37c104[_0x23274c(0x1b4)]?{'tool_call_id':_0x37c104['tool_call_id']}:{}}))},'source':_0x23274c(0x16c)})[_0x23274c(0x12b)](()=>{});let _0x2d6f05='';if(_0x273a1a[_0x23274c(0x1ca)]===_0x23274c(0x12d)&&_0x273a1a[_0x23274c(0x15f)]?.['metadata']?.[_0x23274c(0x20c)]){const _0x2c7bd8=_0x273a1a['finish'][_0x23274c(0x117)][_0x23274c(0x20c)];if(_0x2c7bd8[_0x23274c(0x17e)]===0x0)return _0x2d6f05=_0x273a1a[_0x23274c(0x15f)][_0x23274c(0x1d9)]||_0x23274c(0x197),{'content':[{'type':'text','text':_0x2d6f05}]};const _0x18cfce=[],_0x4e8493=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x46f683 of _0x273a1a[_0x23274c(0x130)]){if(_0x46f683[_0x23274c(0x127)]===_0x23274c(0x1a0)&&Array[_0x23274c(0x1cf)](_0x46f683[_0x23274c(0x200)]))for(const _0x12c11c of _0x46f683[_0x23274c(0x200)]){try{const _0x24e00d=_0x12c11c['function']?.[_0x23274c(0x1c3)],_0x235b2b=JSON[_0x23274c(0x198)](_0x12c11c[_0x23274c(0x13c)]?.['arguments']||'{}');if(_0x24e00d===_0x23274c(0x171))_0x4e8493[_0x23274c(0x131)](_0x23274c(0x1f8)+_0x235b2b[_0x23274c(0x1fb)]+_0x23274c(0x203)+(_0x235b2b[_0x23274c(0x135)]||'.')+'`');else{if(_0x24e00d==='read')_0x4e8493[_0x23274c(0x131)](_0x23274c(0x14a)+_0x235b2b[_0x23274c(0x135)]+'`');else{if(_0x24e00d==='list_directory')_0x4e8493[_0x23274c(0x131)](_0x23274c(0x211)+(_0x235b2b['command']||'.')+'`');else _0x24e00d===_0x23274c(0x159)&&_0x4e8493[_0x23274c(0x131)](_0x23274c(0x1a6)+_0x235b2b['pattern']+_0x23274c(0x199)+(_0x235b2b['path']||'.')+'`');}}}catch{}}}_0x18cfce[_0x23274c(0x131)](_0x4e8493['join']('\x0a'));const _0x3fe4e6=['',_0x23274c(0x1bc)];for(const _0x5e4248 of _0x2c7bd8){if(_0x5e4248[_0x23274c(0x140)]==='*')_0x3fe4e6[_0x23274c(0x131)]('-\x20'+_0x5e4248[_0x23274c(0x135)]+':*');else{if(Array[_0x23274c(0x1cf)](_0x5e4248['lines'])){const _0x43d4b9=_0x5e4248[_0x23274c(0x140)][_0x23274c(0x19c)](([_0x322744,_0x3b527d])=>{if(_0x322744===_0x3b527d)return''+_0x322744;return _0x322744+'-'+_0x3b527d;});_0x3fe4e6[_0x23274c(0x131)]('-\x20'+_0x5e4248[_0x23274c(0x135)]+':'+_0x43d4b9['join'](','));}else _0x3fe4e6[_0x23274c(0x131)]('-\x20'+_0x5e4248[_0x23274c(0x135)]+':*');}}_0x3fe4e6['push'](''),_0x18cfce['push'](_0x3fe4e6['join']('\x0a')),_0x18cfce['push'](_0x23274c(0x113));const _0x117a52=[],_0x30d0ab=[];for(const _0xcb6027 of _0x2c7bd8){let _0x10a978=a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1['data']['repo_path'],_0xcb6027['path']),_0xb87f76=null,_0x1deca9=null;try{_0xb87f76=await a0_0x1447fd[_0x23274c(0x110)](_0x10a978,{'encoding':'utf-8'});}catch(_0x3b90cd){const _0x7ffcbc=fixPathRepetition(_0x10a978);if(_0x7ffcbc)try{_0xb87f76=await a0_0x1447fd[_0x23274c(0x110)](_0x7ffcbc,{'encoding':_0x23274c(0x216)}),_0x10a978=_0x7ffcbc;}catch{_0x1deca9=_0x3b90cd instanceof Error?_0x3b90cd:new Error(String(_0x3b90cd));}else _0x1deca9=_0x3b90cd instanceof Error?_0x3b90cd:new Error(String(_0x3b90cd));}if(_0xb87f76!==null){const _0x5ebe84=_0xb87f76['split'](/\r?\n/),_0x15fca8=[];if(_0xcb6027['lines']==='*'||!Array[_0x23274c(0x1cf)](_0xcb6027['lines']))for(let _0x3cacf4=0x1;_0x3cacf4<=_0x5ebe84[_0x23274c(0x17e)];_0x3cacf4++){const _0x3aa996=_0x5ebe84[_0x3cacf4-0x1];_0x15fca8[_0x23274c(0x131)](_0x3cacf4+'|\x20'+_0x3aa996);}else for(const [_0x5df4c5,_0x507c3b]of _0xcb6027[_0x23274c(0x140)]){_0x15fca8[_0x23274c(0x17e)]>0x0&&_0x15fca8['push']('');for(let _0x41b39a=_0x5df4c5;_0x41b39a<=_0x507c3b&&_0x41b39a<=_0x5ebe84['length'];_0x41b39a++){const _0x28573a=_0x5ebe84[_0x41b39a-0x1];_0x15fca8[_0x23274c(0x131)](_0x41b39a+'|\x20'+_0x28573a);}}_0x30d0ab['push']({'path':_0xcb6027[_0x23274c(0x135)],'content':_0x15fca8[_0x23274c(0x13e)]('\x0a')});}else _0x117a52[_0x23274c(0x131)](_0x23274c(0x1b9)+_0xcb6027[_0x23274c(0x135)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x1deca9?.[_0x23274c(0x14b)]||_0x23274c(0x170))+_0x23274c(0x186));}try{const _0x3b3ade=await compactFileContexts(_0x30d0ab,_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],MORPH_API_KEY,MORPH_API_URL);for(const _0x178a97 of _0x3b3ade){_0x117a52['push'](_0x23274c(0x1b9)+_0x178a97[_0x23274c(0x135)]+_0x23274c(0x1a9)+_0x178a97[_0x23274c(0x18e)]+'\x0a</file>');}}catch(_0x376666){console['error'](_0x23274c(0x116),_0x376666);for(const _0x413d7a of _0x30d0ab){_0x117a52['push'](_0x23274c(0x1b9)+_0x413d7a[_0x23274c(0x135)]+_0x23274c(0x1a9)+_0x413d7a[_0x23274c(0x18e)]+'\x0a</file>');}}_0x18cfce[_0x23274c(0x131)](_0x117a52[_0x23274c(0x13e)]('\x0a\x0a')),_0x2d6f05=_0x18cfce[_0x23274c(0x13e)]('\x0a');const _0x4023ee=_0x273a1a['errors']?.['filter'](_0x2d93fd=>_0x2d93fd[_0x23274c(0x14b)]?.['startsWith'](_0x23274c(0x1f1)))||[];if(_0x4023ee['length']>0x0){const _0x275c1a=_0x4023ee['map'](_0x1f81fb=>_0x1f81fb['message'])[_0x23274c(0x13e)](';\x20');reportMorphError({'error_message':_0x275c1a,'error_type':_0x23274c(0x190),'context':{'tool':'codebase_search','repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'query':_0x4219d1['data'][_0x23274c(0x1e8)],'model':_0x23274c(0x126),'termination_reason':_0x23274c(0x1ff),'error_count':_0x4023ee[_0x23274c(0x17e)],'is_timeout':![],'timings':_0x273a1a[_0x23274c(0x164)],'files_attempted':_0x2c7bd8[_0x23274c(0x19c)](_0xa153be=>({'path':_0xa153be[_0x23274c(0x135)],'lines':_0xa153be[_0x23274c(0x140)]})),'tool_calls':_0x3351a7(_0x273a1a[_0x23274c(0x130)]),'messages':_0x273a1a[_0x23274c(0x130)]?.[_0x23274c(0x19c)](_0x258a86=>({'role':_0x258a86['role'],'content':_0x258a86[_0x23274c(0x18e)],..._0x258a86[_0x23274c(0x200)]?{'tool_calls':_0x258a86[_0x23274c(0x200)]['length']}:{},..._0x258a86[_0x23274c(0x1b4)]?{'tool_call_id':_0x258a86['tool_call_id']}:{}})),'request_content':{'query':_0x4219d1['data'][_0x23274c(0x1e8)],'repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'repoRoot':a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1['data'][_0x23274c(0x209)]),'model':_0x23274c(0x126)}},'source':_0x23274c(0x16c)})['catch'](()=>{});}}else{if(_0x273a1a['terminationReason']==='terminated'&&_0x273a1a[_0x23274c(0x14c)][_0x23274c(0x17e)]>0x0){const _0x5639f4=_0x273a1a[_0x23274c(0x14c)][_0x23274c(0x19c)](_0x119eec=>_0x119eec['message'])[_0x23274c(0x13e)](';\x20');_0x2d6f05=_0x23274c(0x19e)+_0x5639f4;const _0x334203=_0x5639f4[_0x23274c(0x19d)]()[_0x23274c(0x219)](_0x23274c(0x1e3))||_0x5639f4[_0x23274c(0x19d)]()['includes'](_0x23274c(0x1f0))||_0x5639f4['toLowerCase']()['includes'](_0x23274c(0x214)),_0x185edb=_0x273a1a[_0x23274c(0x15f)]?.[_0x23274c(0x117)]?.['files'],_0x2912ac=_0x273a1a[_0x23274c(0x14c)][0x0];reportMorphError({'error_message':_0x5639f4,'error_type':_0x334203?'TimeoutError':_0x2912ac?.['constructor']?.[_0x23274c(0x1c3)]||_0x23274c(0x182),'context':{'tool':_0x23274c(0x177),'repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'model':_0x23274c(0x126),'termination_reason':_0x273a1a[_0x23274c(0x1ca)],'error_count':_0x273a1a[_0x23274c(0x14c)][_0x23274c(0x17e)],'is_timeout':_0x334203,'timings':_0x273a1a[_0x23274c(0x164)],'files_attempted':_0x185edb?.[_0x23274c(0x19c)](_0x551fca=>({'path':_0x551fca[_0x23274c(0x135)],'lines':_0x551fca[_0x23274c(0x140)]})),'tool_calls':_0x3351a7(_0x273a1a[_0x23274c(0x130)]),'messages':_0x273a1a[_0x23274c(0x130)]?.[_0x23274c(0x19c)](_0x1c8f15=>({'role':_0x1c8f15[_0x23274c(0x127)],'content':_0x1c8f15[_0x23274c(0x18e)],..._0x1c8f15[_0x23274c(0x200)]?{'tool_calls':_0x1c8f15[_0x23274c(0x200)][_0x23274c(0x17e)]}:{},..._0x1c8f15[_0x23274c(0x1b4)]?{'tool_call_id':_0x1c8f15[_0x23274c(0x1b4)]}:{}})),'request_content':{'query':_0x4219d1['data'][_0x23274c(0x1e8)],'repo_path':_0x4219d1['data']['repo_path'],'repoRoot':a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)]),'model':_0x23274c(0x126)}},'stack_trace':_0x2912ac?.[_0x23274c(0x115)]||undefined,'source':_0x23274c(0x16c)})[_0x23274c(0x12b)](()=>{});}else _0x2d6f05=_0x23274c(0x122);}return{'content':[{'type':'text','text':_0x2d6f05}]};}catch(_0x25ddf4){const _0x133338=_0x25ddf4 instanceof Error?_0x25ddf4[_0x23274c(0x14b)]:String(_0x25ddf4),_0x781a6a=_0x133338[_0x23274c(0x19d)]()[_0x23274c(0x219)](_0x23274c(0x1e3))||_0x133338[_0x23274c(0x19d)]()['includes'](_0x23274c(0x1f0))||_0x133338[_0x23274c(0x19d)]()[_0x23274c(0x219)](_0x23274c(0x214))||_0x25ddf4 instanceof Error&&_0x25ddf4[_0x23274c(0x1c3)]===_0x23274c(0x162);return reportMorphError({'error_message':_0x133338,'error_type':_0x781a6a?'TimeoutError':_0x25ddf4 instanceof Error?_0x25ddf4[_0x23274c(0x11e)]['name']:_0x23274c(0x184),'context':{'tool':_0x23274c(0x177),'repo_path':_0x4219d1[_0x23274c(0x17b)]['repo_path'],'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'model':'morph-warp-grep-v2.1','is_timeout':_0x781a6a,'exception_phase':_0x23274c(0x1e0),'request_content':{'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'repoRoot':a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)]),'model':_0x23274c(0x126)}},'stack_trace':_0x25ddf4 instanceof Error?_0x25ddf4[_0x23274c(0x115)]:undefined,'source':'mcp-filesystem'})[_0x23274c(0x12b)](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x10f)+_0x133338}],'isError':![]};}}case _0x23274c(0x1d5):{const _0x1140b1=WarpGrepGitHubArgsSchema[_0x23274c(0x119)](_0x33842c);if(!_0x1140b1[_0x23274c(0x181)])return{'content':[{'type':'text','text':_0x23274c(0x1ad)+_0x1140b1[_0x23274c(0x194)]}],'isError':!![]};const _0x294ced=_0x1140b1[_0x23274c(0x17b)]['github_url']||_0x1140b1[_0x23274c(0x17b)]['owner_repo'];if(!_0x294ced)return{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x12a)}],'isError':!![]};const _0x1a7df1=MORPH_API_KEY;if(!_0x1a7df1)throw new Error(_0x23274c(0x212));const _0x2ac8f9=Date[_0x23274c(0x189)]();logMcpStderr(_0x23274c(0x118)+_0x294ced+_0x23274c(0x1f6)+_0x1140b1[_0x23274c(0x17b)][_0x23274c(0x1e8)]+'\x22');try{const _0x5d59f4=new WarpGrepClient({'morphApiKey':_0x1a7df1,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x278ecf=await _0x5d59f4[_0x23274c(0x137)]({'searchTerm':_0x1140b1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'github':_0x294ced,'branch':_0x1140b1[_0x23274c(0x17b)][_0x23274c(0x19b)]}),_0x30cde6=Date['now']()-_0x2ac8f9;logMcpStderr(_0x23274c(0x1d4)+_0x30cde6+'ms.\x20Success:\x20'+_0x278ecf[_0x23274c(0x181)]);const _0x1fc184=formatResult(_0x278ecf);return{'content':[{'type':_0x23274c(0x1b1),'text':_0x1fc184}]};}catch(_0x175549){const _0x44e5c1=Date[_0x23274c(0x189)]()-_0x2ac8f9,_0x564a83=_0x175549 instanceof Error?_0x175549[_0x23274c(0x14b)]:String(_0x175549);return logMcpStderr(_0x23274c(0x18f)+_0x44e5c1+_0x23274c(0x15b),_0x564a83),reportMorphError({'error_message':_0x564a83,'error_type':_0x175549 instanceof Error?_0x175549['constructor'][_0x23274c(0x1c3)]:_0x23274c(0x184),'context':{'tool':_0x23274c(0x1d5),'github_url':_0x294ced,'search_string':_0x1140b1[_0x23274c(0x17b)]['search_string'],'branch':_0x1140b1[_0x23274c(0x17b)]['branch']},'stack_trace':_0x175549 instanceof Error?_0x175549[_0x23274c(0x115)]:undefined,'source':'mcp-filesystem','tool':_0x23274c(0x1d5),'latency_ms':_0x44e5c1})[_0x23274c(0x12b)](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':'GitHub\x20search\x20failed:\x20'+_0x564a83}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x275d4e);}}catch(_0x11a753){const _0x27d613=_0x11a753 instanceof Error?_0x11a753['message']:String(_0x11a753);return reportMorphError({'error_message':_0x27d613,'error_type':_0x11a753 instanceof Error?_0x11a753[_0x23274c(0x11e)]['name']:'UnknownError','context':{'tool':_0x275d4e,'arguments':_0x33842c?JSON['stringify'](_0x33842c)[_0x23274c(0x124)](0x0,0x1f4):undefined,'mcp_server_version':_0x23274c(0x206)},'stack_trace':_0x11a753 instanceof Error?_0x11a753[_0x23274c(0x115)]:undefined,'source':'mcp-filesystem'})[_0x23274c(0x12b)](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x19e)+_0x27d613}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x540fe8){const _0x5c57ea=a0_0x4156c2,_0x309028=await getValidRootDirectories(_0x540fe8);if(_0x309028['length']>0x0)allowedDirectories=[..._0x309028],logMcpStderr(_0x5c57ea(0x16a)+_0x309028[_0x5c57ea(0x17e)]+_0x5c57ea(0x1ac));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x15be26=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x15be26&&(allowedDirectories=[_0x15be26],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x15be26));}catch(_0x2b816c){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2b816c);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x36db49=a0_0x4156c2;try{const _0x34523c=await server[_0x36db49(0x138)]();_0x34523c&&_0x36db49(0x205)in _0x34523c&&await updateAllowedDirectoriesFromRoots(_0x34523c[_0x36db49(0x205)]);}catch(_0x569399){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x569399 instanceof Error?_0x569399[_0x36db49(0x14b)]:String(_0x569399));}}),server[a0_0x4156c2(0x1c8)]=async()=>{const _0x5c7ceb=a0_0x4156c2,_0x39b417=server['getClientCapabilities']();if(_0x39b417?.[_0x5c7ceb(0x205)])try{const _0x28ced7=await server[_0x5c7ceb(0x138)]();_0x28ced7&&_0x5c7ceb(0x205)in _0x28ced7?await updateAllowedDirectoriesFromRoots(_0x28ced7['roots']):logMcpStderr(_0x5c7ceb(0x14e));}catch(_0x22c70e){logMcpStderr(_0x5c7ceb(0x1f3),_0x22c70e instanceof Error?_0x22c70e[_0x5c7ceb(0x14b)]:String(_0x22c70e));}else{if(allowedDirectories[_0x5c7ceb(0x17e)]>0x0)logMcpStderr(_0x5c7ceb(0x16d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5c7ceb(0x18a));else throw new Error(_0x5c7ceb(0x15a));}}};async function runServer(){const _0x127d86=a0_0x4156c2,_0x5787e6=new StdioServerTransport();await server['connect'](_0x5787e6),logMcpStderr(_0x127d86(0x217)),allowedDirectories[_0x127d86(0x17e)]===0x0&&logMcpStderr(_0x127d86(0x144));}runServer()[a0_0x4156c2(0x12b)](_0x313bf0=>{const _0x167beb=a0_0x4156c2;logMcpStderr(_0x167beb(0x1dd),_0x313bf0),process[_0x167beb(0x18c)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x48acc7=a1_0x3aab;(function(_0x4c4778,_0x8083a0){var _0x464b1d=a1_0x3aab,_0x48b829=_0x4c4778();while(!![]){try{var _0x26562a=-parseInt(_0x464b1d(0xce))/0x1*(parseInt(_0x464b1d(0xcf))/0x2)+parseInt(_0x464b1d(0xd2))/0x3*(parseInt(_0x464b1d(0xd9))/0x4)+parseInt(_0x464b1d(0xd7))/0x5+parseInt(_0x464b1d(0xd6))/0x6*(parseInt(_0x464b1d(0xcd))/0x7)+-parseInt(_0x464b1d(0xc9))/0x8+-parseInt(_0x464b1d(0xd5))/0x9+parseInt(_0x464b1d(0xd4))/0xa;if(_0x26562a===_0x8083a0)break;else _0x48b829['push'](_0x48b829['shift']());}catch(_0x41716c){_0x48b829['push'](_0x48b829['shift']());}}}(a1_0x4eae,0x31fe7));import a1_0x4ed687 from'os';export function getOperatingSystemType(_0x4c6684=a1_0x4ed687['platform']()){var _0x33b35d=a1_0x3aab;switch(_0x4c6684){case'darwin':return _0x33b35d(0xc8);case _0x33b35d(0xd1):return _0x33b35d(0xd3);case'linux':return _0x33b35d(0xd8);default:return _0x33b35d(0xd0);}}function a1_0x3aab(_0x65c91d,_0x2410e1){_0x65c91d=_0x65c91d-0xc8;var _0x4eae7c=a1_0x4eae();var _0x3aab54=_0x4eae7c[_0x65c91d];return _0x3aab54;}export function formatMcpLogMessage(_0x12f9ee,_0x4a2b63=a1_0x4ed687[a1_0x48acc7(0xcc)]()){var _0xc2adce=a1_0x48acc7;return _0xc2adce(0xcb)+getOperatingSystemType(_0x4a2b63)+']\x20'+_0x12f9ee;}export function logMcpStderr(_0x2c7bb2,..._0x24b6bf){var _0x43aa86=a1_0x48acc7;console[_0x43aa86(0xca)](formatMcpLogMessage(_0x2c7bb2),..._0x24b6bf);}function a1_0x4eae(){var _0x40956b=['1993728wTEKXO','error','[os=','platform','7jOuKUo','39079QLiBXD','20JmoIjW','Unknown','win32','264765fEMacG','Windows','6316860xJvnRk','1818630hxLWhN','84306gkXPAQ','1564295bSxSPM','Linux','4JgBLzt','macOS'];a1_0x4eae=function(){return _0x40956b;};return a1_0x4eae();}
1
+ function a1_0x5075(){var _0xc0fad9=['123190JHXEyp','7973259NBfhgA','619476tqHssO','[os=','13081456zcSzQb','error','platform','4857YftyxY','1148NvEBhc','7763640YqXOBN','6YlGxzo','931276uFKjeO','747mPaVkW','Linux','win32','Windows'];a1_0x5075=function(){return _0xc0fad9;};return a1_0x5075();}var a1_0x6d4603=a1_0x47e8;function a1_0x47e8(_0x448a32,_0x4ff362){_0x448a32=_0x448a32-0xc5;var _0x5075cd=a1_0x5075();var _0x47e8e2=_0x5075cd[_0x448a32];return _0x47e8e2;}(function(_0x76d300,_0xb79cad){var _0x119d79=a1_0x47e8,_0x1257a4=_0x76d300();while(!![]){try{var _0x4f97cc=-parseInt(_0x119d79(0xcf))/0x1+-parseInt(_0x119d79(0xcc))/0x2*(-parseInt(_0x119d79(0xcb))/0x3)+-parseInt(_0x119d79(0xc6))/0x4+parseInt(_0x119d79(0xcd))/0x5+parseInt(_0x119d79(0xce))/0x6*(-parseInt(_0x119d79(0xc5))/0x7)+parseInt(_0x119d79(0xc8))/0x8+parseInt(_0x119d79(0xd0))/0x9*(-parseInt(_0x119d79(0xd4))/0xa);if(_0x4f97cc===_0xb79cad)break;else _0x1257a4['push'](_0x1257a4['shift']());}catch(_0x272606){_0x1257a4['push'](_0x1257a4['shift']());}}}(a1_0x5075,0xd44b5));import a1_0x2b82ff from'os';export function getOperatingSystemType(_0x424aad=a1_0x2b82ff[a1_0x6d4603(0xca)]()){var _0x1137e7=a1_0x6d4603;switch(_0x424aad){case'darwin':return'macOS';case _0x1137e7(0xd2):return _0x1137e7(0xd3);case'linux':return _0x1137e7(0xd1);default:return'Unknown';}}export function formatMcpLogMessage(_0x172b86,_0x817ed4=a1_0x2b82ff[a1_0x6d4603(0xca)]()){var _0x24e2ba=a1_0x6d4603;return _0x24e2ba(0xc7)+getOperatingSystemType(_0x817ed4)+']\x20'+_0x172b86;}export function logMcpStderr(_0x56ea6c,..._0x5c8b81){var _0x2376f2=a1_0x6d4603;console[_0x2376f2(0xc9)](formatMcpLogMessage(_0x56ea6c),..._0x5c8b81);}
@@ -1 +1 @@
1
- function a2_0x1092(){const _0x4fdd3e=['3743028KTLRma','355160TlExeK','944740xjDPBg','homedir','replace','1532629VcABNw','3YVuxzV','charAt','slice','7249952xQsFGG','substring','match','toUpperCase','join','1234020jvlkIS','startsWith','658311YGCCEy','test'];a2_0x1092=function(){return _0x4fdd3e;};return a2_0x1092();}(function(_0x4a5eda,_0x323b48){const _0x3aa921=a2_0x7f61,_0x5a65be=_0x4a5eda();while(!![]){try{const _0x1869cd=-parseInt(_0x3aa921(0x1c0))/0x1+-parseInt(_0x3aa921(0x1c3))/0x2*(parseInt(_0x3aa921(0x1c8))/0x3)+-parseInt(_0x3aa921(0x1c4))/0x4+-parseInt(_0x3aa921(0x1be))/0x5+parseInt(_0x3aa921(0x1c2))/0x6+parseInt(_0x3aa921(0x1c7))/0x7+parseInt(_0x3aa921(0x1b9))/0x8;if(_0x1869cd===_0x323b48)break;else _0x5a65be['push'](_0x5a65be['shift']());}catch(_0x48aef3){_0x5a65be['push'](_0x5a65be['shift']());}}}(a2_0x1092,0x69045));import a2_0x2257d2 from'path';import a2_0x141e83 from'os';export function convertToWindowsPath(_0x8d09f){const _0x2d235a=a2_0x7f61;if(_0x8d09f[_0x2d235a(0x1bf)]('/mnt/')){const _0x3fd2dc=_0x8d09f[_0x2d235a(0x1c9)](0x5)['toUpperCase'](),_0x29db6a=_0x8d09f['slice'](0x6)[_0x2d235a(0x1c6)](/\//g,'\x5c');return _0x3fd2dc+':'+_0x29db6a;}if(_0x8d09f['match'](/^\/[a-zA-Z]\//)){const _0x532ce1=_0x8d09f['charAt'](0x1)['toUpperCase'](),_0x139396=_0x8d09f['slice'](0x2)[_0x2d235a(0x1c6)](/\//g,'\x5c');return _0x532ce1+':'+_0x139396;}if(_0x8d09f['match'](/^[a-zA-Z]:/))return _0x8d09f[_0x2d235a(0x1c6)](/\//g,'\x5c');return _0x8d09f;}function a2_0x7f61(_0x2138d3,_0x36fefe){_0x2138d3=_0x2138d3-0x1b8;const _0x1092e9=a2_0x1092();let _0x7f61bf=_0x1092e9[_0x2138d3];return _0x7f61bf;}export function normalizePath(_0x1ea0a6){const _0x43c250=a2_0x7f61;_0x1ea0a6=_0x1ea0a6['trim']()[_0x43c250(0x1c6)](/^["']|["']$/g,'');const _0x88abbf=_0x1ea0a6[_0x43c250(0x1bf)]('/')&&!_0x1ea0a6[_0x43c250(0x1bb)](/^\/mnt\/[a-z]\//i)&&!_0x1ea0a6['match'](/^\/[a-zA-Z]\//);if(_0x88abbf)return _0x1ea0a6[_0x43c250(0x1c6)](/\/+/g,'/')['replace'](/\/+$/,'');_0x1ea0a6=convertToWindowsPath(_0x1ea0a6);if(_0x1ea0a6['startsWith']('\x5c\x5c')){let _0x10146f=_0x1ea0a6;_0x10146f=_0x10146f['replace'](/^\\{2,}/,'\x5c\x5c');const _0x175786=_0x10146f[_0x43c250(0x1ba)](0x2)['replace'](/\\\\/g,'\x5c');_0x1ea0a6='\x5c\x5c'+_0x175786;}else _0x1ea0a6=_0x1ea0a6[_0x43c250(0x1c6)](/\\\\/g,'\x5c');let _0x58a8f0=a2_0x2257d2['normalize'](_0x1ea0a6);_0x1ea0a6['startsWith']('\x5c\x5c')&&!_0x58a8f0[_0x43c250(0x1bf)]('\x5c\x5c')&&(_0x58a8f0='\x5c'+_0x58a8f0);if(_0x58a8f0[_0x43c250(0x1bb)](/^[a-zA-Z]:/)){let _0x4b328d=_0x58a8f0[_0x43c250(0x1c6)](/\//g,'\x5c');return/^[a-z]:/[_0x43c250(0x1c1)](_0x4b328d)&&(_0x4b328d=_0x4b328d[_0x43c250(0x1c9)](0x0)[_0x43c250(0x1bc)]()+_0x4b328d[_0x43c250(0x1b8)](0x1)),_0x4b328d;}return _0x58a8f0['replace'](/\//g,'\x5c');}export function expandHome(_0x2ee1a4){const _0x495716=a2_0x7f61;if(_0x2ee1a4[_0x495716(0x1bf)]('~/')||_0x2ee1a4==='~')return a2_0x2257d2[_0x495716(0x1bd)](a2_0x141e83[_0x495716(0x1c5)](),_0x2ee1a4[_0x495716(0x1b8)](0x1));return _0x2ee1a4;}
1
+ function a2_0x23db(_0x183acc,_0x2f008f){_0x183acc=_0x183acc-0x9b;const _0x5295a3=a2_0x5295();let _0x23dbb7=_0x5295a3[_0x183acc];return _0x23dbb7;}(function(_0x3cc1e6,_0x4fdbb3){const _0x5671aa=a2_0x23db,_0x222e5d=_0x3cc1e6();while(!![]){try{const _0x230166=-parseInt(_0x5671aa(0xa1))/0x1+-parseInt(_0x5671aa(0xa2))/0x2*(-parseInt(_0x5671aa(0xad))/0x3)+parseInt(_0x5671aa(0xa9))/0x4*(-parseInt(_0x5671aa(0xa3))/0x5)+parseInt(_0x5671aa(0xa6))/0x6+parseInt(_0x5671aa(0xa8))/0x7*(parseInt(_0x5671aa(0x9e))/0x8)+parseInt(_0x5671aa(0x9c))/0x9+parseInt(_0x5671aa(0xa5))/0xa;if(_0x230166===_0x4fdbb3)break;else _0x222e5d['push'](_0x222e5d['shift']());}catch(_0x157020){_0x222e5d['push'](_0x222e5d['shift']());}}}(a2_0x5295,0xb8fb3));import a2_0x3ef087 from'path';import a2_0x23fc7e from'os';export function convertToWindowsPath(_0x3ebaa7){const _0x591a3a=a2_0x23db;if(_0x3ebaa7['startsWith'](_0x591a3a(0x9b))){const _0x70bc7b=_0x3ebaa7[_0x591a3a(0xaa)](0x5)['toUpperCase'](),_0x715932=_0x3ebaa7['slice'](0x6)['replace'](/\//g,'\x5c');return _0x70bc7b+':'+_0x715932;}if(_0x3ebaa7['match'](/^\/[a-zA-Z]\//)){const _0x298b31=_0x3ebaa7[_0x591a3a(0xaa)](0x1)[_0x591a3a(0xae)](),_0xd76760=_0x3ebaa7['slice'](0x2)[_0x591a3a(0xac)](/\//g,'\x5c');return _0x298b31+':'+_0xd76760;}if(_0x3ebaa7[_0x591a3a(0xa4)](/^[a-zA-Z]:/))return _0x3ebaa7['replace'](/\//g,'\x5c');return _0x3ebaa7;}function a2_0x5295(){const _0x433fce=['719820GJbVev','trim','45584KBlBEW','392MXBdby','charAt','homedir','replace','69QRBsaW','toUpperCase','startsWith','join','/mnt/','113832oKSNyc','slice','904eEopjG','substring','test','972143NbFhcg','5332tIZsCZ','29455xmhZHy','match','13773520tsxiEP'];a2_0x5295=function(){return _0x433fce;};return a2_0x5295();}export function normalizePath(_0x53af37){const _0x250c13=a2_0x23db;_0x53af37=_0x53af37[_0x250c13(0xa7)]()[_0x250c13(0xac)](/^["']|["']$/g,'');const _0x4793c7=_0x53af37[_0x250c13(0xaf)]('/')&&!_0x53af37[_0x250c13(0xa4)](/^\/mnt\/[a-z]\//i)&&!_0x53af37[_0x250c13(0xa4)](/^\/[a-zA-Z]\//);if(_0x4793c7)return _0x53af37['replace'](/\/+/g,'/')[_0x250c13(0xac)](/\/+$/,'');_0x53af37=convertToWindowsPath(_0x53af37);if(_0x53af37[_0x250c13(0xaf)]('\x5c\x5c')){let _0x3b29c2=_0x53af37;_0x3b29c2=_0x3b29c2['replace'](/^\\{2,}/,'\x5c\x5c');const _0x57178c=_0x3b29c2[_0x250c13(0x9f)](0x2)[_0x250c13(0xac)](/\\\\/g,'\x5c');_0x53af37='\x5c\x5c'+_0x57178c;}else _0x53af37=_0x53af37[_0x250c13(0xac)](/\\\\/g,'\x5c');let _0x23465f=a2_0x3ef087['normalize'](_0x53af37);_0x53af37[_0x250c13(0xaf)]('\x5c\x5c')&&!_0x23465f[_0x250c13(0xaf)]('\x5c\x5c')&&(_0x23465f='\x5c'+_0x23465f);if(_0x23465f['match'](/^[a-zA-Z]:/)){let _0x326c0c=_0x23465f[_0x250c13(0xac)](/\//g,'\x5c');return/^[a-z]:/[_0x250c13(0xa0)](_0x326c0c)&&(_0x326c0c=_0x326c0c[_0x250c13(0xaa)](0x0)[_0x250c13(0xae)]()+_0x326c0c['slice'](0x1)),_0x326c0c;}return _0x23465f['replace'](/\//g,'\x5c');}export function expandHome(_0x2e424b){const _0x882831=a2_0x23db;if(_0x2e424b[_0x882831(0xaf)]('~/')||_0x2e424b==='~')return a2_0x3ef087[_0x882831(0xb0)](a2_0x23fc7e[_0x882831(0xab)](),_0x2e424b[_0x882831(0x9d)](0x1));return _0x2e424b;}
@@ -1 +1 @@
1
- function a3_0x13a4(_0x224e07,_0x325094){_0x224e07=_0x224e07-0x124;const _0x22deb7=a3_0x22de();let _0x13a4e2=_0x22deb7[_0x224e07];return _0x13a4e2;}(function(_0xc0befd,_0x290704){const _0x585ada=a3_0x13a4,_0x51b5ca=_0xc0befd();while(!![]){try{const _0x3dac84=-parseInt(_0x585ada(0x129))/0x1+-parseInt(_0x585ada(0x131))/0x2+-parseInt(_0x585ada(0x12e))/0x3*(-parseInt(_0x585ada(0x12c))/0x4)+-parseInt(_0x585ada(0x137))/0x5*(parseInt(_0x585ada(0x128))/0x6)+-parseInt(_0x585ada(0x130))/0x7*(-parseInt(_0x585ada(0x127))/0x8)+-parseInt(_0x585ada(0x125))/0x9*(parseInt(_0x585ada(0x133))/0xa)+parseInt(_0x585ada(0x124))/0xb*(parseInt(_0x585ada(0x135))/0xc);if(_0x3dac84===_0x290704)break;else _0x51b5ca['push'](_0x51b5ca['shift']());}catch(_0x335d41){_0x51b5ca['push'](_0x51b5ca['shift']());}}}(a3_0x22de,0x3ce34));import a3_0x56e831 from'path';export function isPathWithinAllowedDirectories(_0x33202b,_0x448a45){const _0x293d23=a3_0x13a4;if(typeof _0x33202b!=='string'||!Array[_0x293d23(0x138)](_0x448a45))return![];if(!_0x33202b||_0x448a45[_0x293d23(0x136)]===0x0)return![];if(_0x33202b[_0x293d23(0x12d)]('\x00'))return![];let _0x2c4cba;try{_0x2c4cba=a3_0x56e831[_0x293d23(0x132)](a3_0x56e831[_0x293d23(0x134)](_0x33202b));}catch{return![];}if(!a3_0x56e831[_0x293d23(0x12f)](_0x2c4cba))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x448a45['some'](_0xedd7fc=>{const _0x1089b8=_0x293d23;if(typeof _0xedd7fc!==_0x1089b8(0x139)||!_0xedd7fc)return![];if(_0xedd7fc[_0x1089b8(0x12d)]('\x00'))return![];let _0x13641e;try{_0x13641e=a3_0x56e831[_0x1089b8(0x132)](a3_0x56e831['normalize'](_0xedd7fc));}catch{return![];}if(!a3_0x56e831[_0x1089b8(0x12f)](_0x13641e))throw new Error(_0x1089b8(0x12a));if(_0x2c4cba===_0x13641e)return!![];if(_0x13641e===a3_0x56e831['sep'])return _0x2c4cba[_0x1089b8(0x12b)](a3_0x56e831[_0x1089b8(0x126)]);return _0x2c4cba[_0x1089b8(0x12b)](_0x13641e+a3_0x56e831[_0x1089b8(0x126)]);});}function a3_0x22de(){const _0x278bdc=['startsWith','189132EtCIkP','includes','21RXdXZZ','isAbsolute','946967rKcXaP','533014kmzkxA','resolve','258150dLaDyv','normalize','228eRjUuZ','length','1413285TJydbg','isArray','string','681857YZLXQb','171QFuAHu','sep','8qKTyYP','6RobNjL','354970cvglrF','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization'];a3_0x22de=function(){return _0x278bdc;};return a3_0x22de();}
1
+ (function(_0x4cd3f7,_0x2731b2){const _0x28ce02=a3_0x5981,_0x58e1c7=_0x4cd3f7();while(!![]){try{const _0x26883c=-parseInt(_0x28ce02(0xc1))/0x1*(-parseInt(_0x28ce02(0xb4))/0x2)+parseInt(_0x28ce02(0xb1))/0x3+parseInt(_0x28ce02(0xb3))/0x4+-parseInt(_0x28ce02(0xaf))/0x5*(parseInt(_0x28ce02(0xb2))/0x6)+parseInt(_0x28ce02(0xae))/0x7+-parseInt(_0x28ce02(0xb9))/0x8*(parseInt(_0x28ce02(0xba))/0x9)+-parseInt(_0x28ce02(0xbc))/0xa*(parseInt(_0x28ce02(0xbf))/0xb);if(_0x26883c===_0x2731b2)break;else _0x58e1c7['push'](_0x58e1c7['shift']());}catch(_0x4e8a61){_0x58e1c7['push'](_0x58e1c7['shift']());}}}(a3_0x2e06,0xd2376));function a3_0x2e06(){const _0xddc06e=['111294ONTPGb','includes','sep','isArray','string','640lkQtCM','58473ivixhh','resolve','29440YogYbB','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some','2629movyZB','Path\x20must\x20be\x20absolute\x20after\x20normalization','9VWtokg','normalize','isAbsolute','length','4930506fvoJdR','2678315OPWzeM','startsWith','2711340NAQADv','6isPMjN','2044496oWzgrv'];a3_0x2e06=function(){return _0xddc06e;};return a3_0x2e06();}function a3_0x5981(_0xbde3bb,_0x10c232){_0xbde3bb=_0xbde3bb-0xac;const _0x2e0674=a3_0x2e06();let _0x598185=_0x2e0674[_0xbde3bb];return _0x598185;}import a3_0x56e5f7 from'path';export function isPathWithinAllowedDirectories(_0x228553,_0x3c0731){const _0x57f1f8=a3_0x5981;if(typeof _0x228553!==_0x57f1f8(0xb8)||!Array[_0x57f1f8(0xb7)](_0x3c0731))return![];if(!_0x228553||_0x3c0731[_0x57f1f8(0xad)]===0x0)return![];if(_0x228553[_0x57f1f8(0xb5)]('\x00'))return![];let _0x1ef6bb;try{_0x1ef6bb=a3_0x56e5f7[_0x57f1f8(0xbb)](a3_0x56e5f7[_0x57f1f8(0xc2)](_0x228553));}catch{return![];}if(!a3_0x56e5f7[_0x57f1f8(0xac)](_0x1ef6bb))throw new Error(_0x57f1f8(0xc0));return _0x3c0731[_0x57f1f8(0xbe)](_0x5a31e1=>{const _0x68468b=_0x57f1f8;if(typeof _0x5a31e1!==_0x68468b(0xb8)||!_0x5a31e1)return![];if(_0x5a31e1[_0x68468b(0xb5)]('\x00'))return![];let _0x30d98d;try{_0x30d98d=a3_0x56e5f7['resolve'](a3_0x56e5f7['normalize'](_0x5a31e1));}catch{return![];}if(!a3_0x56e5f7[_0x68468b(0xac)](_0x30d98d))throw new Error(_0x68468b(0xbd));if(_0x1ef6bb===_0x30d98d)return!![];if(_0x30d98d===a3_0x56e5f7['sep'])return _0x1ef6bb[_0x68468b(0xb0)](a3_0x56e5f7[_0x68468b(0xb6)]);return _0x1ef6bb[_0x68468b(0xb0)](_0x30d98d+a3_0x56e5f7[_0x68468b(0xb6)]);});}
@@ -1 +1 @@
1
- function a4_0xcd96(){const _0x30d59f=['startsWith','file://','222155FmYCYK','Skipping\x20invalid\x20directory:\x20','11oNRcrU','2KYXuBK','isDirectory','4eXQTWf','join','104687eFVlfk','155859qFotAJ','584072nTtxWg','message','resolve','9TvnasC','187453pEEyGR','slice','Skipping\x20','invalid\x20path\x20or\x20inaccessible','6MKgHbZ','realpath','3133836NLjaJP','2212480DRMVYj','uri'];a4_0xcd96=function(){return _0x30d59f;};return a4_0xcd96();}function a4_0x261b(_0x3169ee,_0x3c407c){_0x3169ee=_0x3169ee-0x1f3;const _0xcd96c0=a4_0xcd96();let _0x261b91=_0xcd96c0[_0x3169ee];return _0x261b91;}(function(_0xad10,_0x105152){const _0x2dd492=a4_0x261b,_0x2dc242=_0xad10();while(!![]){try{const _0x45f513=parseInt(_0x2dd492(0x1fc))/0x1+-parseInt(_0x2dd492(0x1f8))/0x2*(-parseInt(_0x2dd492(0x1fd))/0x3)+-parseInt(_0x2dd492(0x1fa))/0x4*(-parseInt(_0x2dd492(0x1f5))/0x5)+-parseInt(_0x2dd492(0x206))/0x6*(-parseInt(_0x2dd492(0x202))/0x7)+parseInt(_0x2dd492(0x1fe))/0x8*(-parseInt(_0x2dd492(0x201))/0x9)+parseInt(_0x2dd492(0x209))/0xa*(parseInt(_0x2dd492(0x1f7))/0xb)+-parseInt(_0x2dd492(0x208))/0xc;if(_0x45f513===_0x105152)break;else _0x2dc242['push'](_0x2dc242['shift']());}catch(_0x2fd014){_0x2dc242['push'](_0x2dc242['shift']());}}}(a4_0xcd96,0x1c0f8));import{promises as a4_0x5b1aaf}from'fs';import a4_0x672fc from'path';import a4_0x3a81e0 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x11fe00){const _0x25fef7=a4_0x261b;try{const _0x4ce474=_0x11fe00[_0x25fef7(0x1f3)](_0x25fef7(0x1f4))?_0x11fe00[_0x25fef7(0x203)](0x7):_0x11fe00,_0x1b3b0b=_0x4ce474[_0x25fef7(0x1f3)]('~/')||_0x4ce474==='~'?a4_0x672fc[_0x25fef7(0x1fb)](a4_0x3a81e0['homedir'](),_0x4ce474['slice'](0x1)):_0x4ce474,_0x1697ec=a4_0x672fc[_0x25fef7(0x200)](_0x1b3b0b),_0x49fa3b=await a4_0x5b1aaf[_0x25fef7(0x207)](_0x1697ec);return normalizePath(_0x49fa3b);}catch{return null;}}function formatDirectoryError(_0x1377a7,_0x2d27c7,_0x2d8a43){const _0xe4b3e=a4_0x261b;if(_0x2d8a43)return _0xe4b3e(0x204)+_0x2d8a43+':\x20'+_0x1377a7;const _0x510a04=_0x2d27c7 instanceof Error?_0x2d27c7[_0xe4b3e(0x1ff)]:String(_0x2d27c7);return _0xe4b3e(0x1f6)+_0x1377a7+'\x20due\x20to\x20error:\x20'+_0x510a04;}export async function getValidRootDirectories(_0x708a98){const _0x14b8d0=a4_0x261b,_0x35ebdb=[];for(const _0x15979b of _0x708a98){const _0x2944b8=await parseRootUri(_0x15979b[_0x14b8d0(0x20a)]);if(!_0x2944b8){logMcpStderr(formatDirectoryError(_0x15979b['uri'],undefined,_0x14b8d0(0x205)));continue;}try{const _0xeac371=await a4_0x5b1aaf['stat'](_0x2944b8);_0xeac371[_0x14b8d0(0x1f9)]()?_0x35ebdb['push'](_0x2944b8):logMcpStderr(formatDirectoryError(_0x2944b8,undefined,'non-directory\x20root'));}catch(_0x37639a){logMcpStderr(formatDirectoryError(_0x2944b8,_0x37639a));}}return _0x35ebdb;}
1
+ (function(_0x538876,_0x1cf595){const _0x357cb3=a4_0x5272,_0x5c69ff=_0x538876();while(!![]){try{const _0x4df559=parseInt(_0x357cb3(0xf9))/0x1*(-parseInt(_0x357cb3(0xed))/0x2)+-parseInt(_0x357cb3(0xf3))/0x3*(parseInt(_0x357cb3(0xf4))/0x4)+-parseInt(_0x357cb3(0x106))/0x5*(-parseInt(_0x357cb3(0xf0))/0x6)+-parseInt(_0x357cb3(0xf2))/0x7*(-parseInt(_0x357cb3(0xf1))/0x8)+parseInt(_0x357cb3(0xf5))/0x9+-parseInt(_0x357cb3(0xf7))/0xa*(parseInt(_0x357cb3(0xf6))/0xb)+parseInt(_0x357cb3(0x105))/0xc;if(_0x4df559===_0x1cf595)break;else _0x5c69ff['push'](_0x5c69ff['shift']());}catch(_0x1bcd0b){_0x5c69ff['push'](_0x5c69ff['shift']());}}}(a4_0x443c,0x1d8de));import{promises as a4_0x2704b9}from'fs';function a4_0x443c(){const _0x4ce78c=['push','message','slice','join','Skipping\x20','578988AoUSCu','955865EddZnv','330506BqDyoP','startsWith','stat','6thYWSv','8YzKjDQ','680099dHBbrZ','374229cgbjOO','4LBsChW','1911645fWJEex','84293mOGvvy','180CjuVmZ','resolve','1RuLWLD','Skipping\x20invalid\x20directory:\x20','uri','\x20due\x20to\x20error:\x20','homedir','file://','non-directory\x20root'];a4_0x443c=function(){return _0x4ce78c;};return a4_0x443c();}import a4_0x4e5dc2 from'path';import a4_0x103e71 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x25ffcb){const _0x19c63c=a4_0x5272;try{const _0x2b7714=_0x25ffcb[_0x19c63c(0xee)](_0x19c63c(0xfe))?_0x25ffcb[_0x19c63c(0x102)](0x7):_0x25ffcb,_0x4a3d56=_0x2b7714[_0x19c63c(0xee)]('~/')||_0x2b7714==='~'?a4_0x4e5dc2[_0x19c63c(0x103)](a4_0x103e71[_0x19c63c(0xfd)](),_0x2b7714['slice'](0x1)):_0x2b7714,_0x397e66=a4_0x4e5dc2[_0x19c63c(0xf8)](_0x4a3d56),_0x508b05=await a4_0x2704b9['realpath'](_0x397e66);return normalizePath(_0x508b05);}catch{return null;}}function formatDirectoryError(_0x21be67,_0x4c833c,_0x5c3c0d){const _0x130e2d=a4_0x5272;if(_0x5c3c0d)return _0x130e2d(0x104)+_0x5c3c0d+':\x20'+_0x21be67;const _0x4e83e2=_0x4c833c instanceof Error?_0x4c833c[_0x130e2d(0x101)]:String(_0x4c833c);return _0x130e2d(0xfa)+_0x21be67+_0x130e2d(0xfc)+_0x4e83e2;}function a4_0x5272(_0x147483,_0x3518d0){_0x147483=_0x147483-0xed;const _0x443c20=a4_0x443c();let _0x5272de=_0x443c20[_0x147483];return _0x5272de;}export async function getValidRootDirectories(_0x21fc53){const _0xffa4e2=a4_0x5272,_0x5a7835=[];for(const _0x1772ce of _0x21fc53){const _0x2b441e=await parseRootUri(_0x1772ce[_0xffa4e2(0xfb)]);if(!_0x2b441e){logMcpStderr(formatDirectoryError(_0x1772ce[_0xffa4e2(0xfb)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x11680e=await a4_0x2704b9[_0xffa4e2(0xef)](_0x2b441e);_0x11680e['isDirectory']()?_0x5a7835[_0xffa4e2(0x100)](_0x2b441e):logMcpStderr(formatDirectoryError(_0x2b441e,undefined,_0xffa4e2(0xff)));}catch(_0x565744){logMcpStderr(formatDirectoryError(_0x2b441e,_0x565744));}}return _0x5a7835;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.150",
3
+ "version": "0.8.151",
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.154",
38
+ "@morphllm/morphsdk": "0.2.155",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",