@morphllm/morphmcp 0.8.56 → 0.8.58

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_0x1012f2=a0_0xedc3;(function(_0x2c60c0,_0x5b15b2){const _0x4f4148=a0_0xedc3,_0xe6377e=_0x2c60c0();while(!![]){try{const _0x352663=parseInt(_0x4f4148(0x27d))/0x1+-parseInt(_0x4f4148(0x250))/0x2*(parseInt(_0x4f4148(0x1e2))/0x3)+parseInt(_0x4f4148(0x295))/0x4+parseInt(_0x4f4148(0x201))/0x5+parseInt(_0x4f4148(0x1c2))/0x6+parseInt(_0x4f4148(0x24e))/0x7*(-parseInt(_0x4f4148(0x283))/0x8)+-parseInt(_0x4f4148(0x21c))/0x9;if(_0x352663===_0x5b15b2)break;else _0xe6377e['push'](_0xe6377e['shift']());}catch(_0x52f2a5){_0xe6377e['push'](_0xe6377e['shift']());}}}(a0_0x58e4,0x5f447));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x3290e4 from'fs/promises';import a0_0x66a465 from'path';import a0_0x4b85a3 from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x2767dc from'axios';function fixPathRepetition(_0x727558){const _0x4d06f=a0_0xedc3,_0x1295df=_0x727558[_0x4d06f(0x287)](a0_0x66a465[_0x4d06f(0x1ec)])[_0x4d06f(0x1b2)](Boolean);if(_0x1295df[_0x4d06f(0x1b9)]<0x2)return null;for(let _0x29cec9=Math['floor'](_0x1295df[_0x4d06f(0x1b9)]/0x2);_0x29cec9>=0x1;_0x29cec9--){for(let _0x5206f5=0x0;_0x5206f5<=_0x1295df[_0x4d06f(0x1b9)]-0x2*_0x29cec9;_0x5206f5++){const _0x59af37=_0x1295df[_0x4d06f(0x25d)](_0x5206f5,_0x5206f5+_0x29cec9),_0x1981bd=_0x1295df[_0x4d06f(0x25d)](_0x5206f5+_0x29cec9,_0x5206f5+0x2*_0x29cec9);if(_0x59af37[_0x4d06f(0x22e)]((_0x40fab1,_0x155eae)=>_0x40fab1===_0x1981bd[_0x155eae])){const _0x35f309=[..._0x1295df['slice'](0x0,_0x5206f5),..._0x1295df[_0x4d06f(0x25d)](_0x5206f5+_0x29cec9)];return a0_0x66a465['sep']+_0x35f309[_0x4d06f(0x1ae)](a0_0x66a465[_0x4d06f(0x1ec)]);}}}return null;}const args=process['argv'][a0_0x1012f2(0x25d)](0x2),ALL_TOOLS=[a0_0x1012f2(0x1c0),a0_0x1012f2(0x264),a0_0x1012f2(0x29a)],DEFAULT_TOOLS=[a0_0x1012f2(0x1c0),'warpgrep_codebase_search'],ENABLED_TOOLS=process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x28f)]?process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x28f)]==='all'?ALL_TOOLS:process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x28f)][a0_0x1012f2(0x287)](',')['map'](_0x290ad3=>_0x290ad3[a0_0x1012f2(0x28a)]()):DEFAULT_TOOLS;console['error']('Enabled\x20tools:\x20'+ENABLED_TOOLS['join'](',\x20'));const WORKSPACE_ROOT=process['env'][a0_0x1012f2(0x228)]||process[a0_0x1012f2(0x23a)]['PWD']||process[a0_0x1012f2(0x1f0)](),ENABLE_WORKSPACE_MODE=process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x234)]!==a0_0x1012f2(0x25f),MORPH_API_KEY=process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x27c)],MORPH_API_URL=process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x1d2)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x1012f2(0x23a)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x1012f2(0x23a)][a0_0x1012f2(0x200)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x1012f2(0x27a))&&!MORPH_API_KEY[a0_0x1012f2(0x277)](a0_0x1012f2(0x1cc))&&console[a0_0x1012f2(0x20c)](a0_0x1012f2(0x1fd));async function reportMorphError(_0x4dc3ae){const _0x2516a2=a0_0x1012f2;try{await a0_0x2767dc['post'](_0x2516a2(0x27e),{..._0x4dc3ae,'timestamp':new Date()[_0x2516a2(0x1e7)](),'source':_0x4dc3ae[_0x2516a2(0x1ce)]||_0x2516a2(0x26c)},{'timeout':0x1388,'headers':{'Content-Type':_0x2516a2(0x257),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x1012f2(0x1b9)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x1012f2(0x20c)]('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),console[a0_0x1012f2(0x20c)](a0_0x1012f2(0x216)),console[a0_0x1012f2(0x20c)]('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),console[a0_0x1012f2(0x20c)](a0_0x1012f2(0x296)),console['error'](a0_0x1012f2(0x263)),console[a0_0x1012f2(0x20c)]('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x541fd2){const _0x97f499=a0_0x1012f2;return a0_0x66a465[_0x97f499(0x1d7)](_0x541fd2);}function expandHome(_0x1ee3a8){const _0x244e51=a0_0x1012f2;if(_0x1ee3a8[_0x244e51(0x277)]('~/')||_0x1ee3a8==='~')return a0_0x66a465[_0x244e51(0x1ae)](a0_0x4b85a3[_0x244e51(0x274)](),_0x1ee3a8[_0x244e51(0x25d)](0x1));return _0x1ee3a8;}let allowedDirectories=await Promise[a0_0x1012f2(0x25c)](args[a0_0x1012f2(0x22d)](async _0x5b2f44=>{const _0x15ef51=a0_0x1012f2,_0x3aaab8=expandHome(_0x5b2f44),_0x17cb21=a0_0x66a465['resolve'](_0x3aaab8);try{const _0x45da5f=await a0_0x3290e4[_0x15ef51(0x1b1)](_0x17cb21);return normalizePath(_0x45da5f);}catch(_0x30bc04){return normalizePath(_0x17cb21);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x1012f2(0x1b9)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x1012f2(0x236)](workspaceDir),console[a0_0x1012f2(0x20c)]('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x1012f2(0x23f)));}catch(a0_0xedc210){console['error'](a0_0x1012f2(0x246)+a0_0xedc210);}async function detectWorkspaceRoot(_0x4f916e){const _0x756082=a0_0x1012f2;let _0x2a1b0f=a0_0x66a465[_0x756082(0x252)](_0x4f916e);const _0x5af571=[_0x756082(0x207),'.vscode',_0x756082(0x1fb),_0x756082(0x239),_0x756082(0x272),_0x756082(0x1fa),_0x756082(0x223),'tsconfig.json',_0x756082(0x294)];while(_0x2a1b0f!==a0_0x66a465[_0x756082(0x237)](_0x2a1b0f)){for(const _0x4f7f9c of _0x5af571){const _0x42aa52=a0_0x66a465['join'](_0x2a1b0f,_0x4f7f9c);try{return await a0_0x3290e4[_0x756082(0x1fe)](_0x42aa52),normalizePath(_0x2a1b0f);}catch{}}_0x2a1b0f=a0_0x66a465[_0x756082(0x237)](_0x2a1b0f);}return normalizePath(_0x4f916e);}await Promise[a0_0x1012f2(0x25c)](args[a0_0x1012f2(0x22d)](async _0x4eb799=>{const _0x2cdcc2=a0_0x1012f2;try{const _0x31c593=await a0_0x3290e4[_0x2cdcc2(0x255)](expandHome(_0x4eb799));!_0x31c593[_0x2cdcc2(0x1bd)]()&&(console[_0x2cdcc2(0x20c)](_0x2cdcc2(0x259)+_0x4eb799+_0x2cdcc2(0x1d6)),process[_0x2cdcc2(0x219)](0x1));}catch(_0xfd8a0f){console[_0x2cdcc2(0x20c)](_0x2cdcc2(0x1d9)+_0x4eb799+':',_0xfd8a0f),process['exit'](0x1);}}));async function validatePath(_0xc6fcc5){const _0x201ca0=a0_0x1012f2,_0x5cc4c3=expandHome(_0xc6fcc5),_0x5b075c=a0_0x66a465[_0x201ca0(0x252)](_0x5cc4c3);try{const _0x53a639=await a0_0x3290e4[_0x201ca0(0x1b1)](_0x5b075c);return _0x53a639;}catch(_0x258b4c){if(_0x258b4c[_0x201ca0(0x21b)]===_0x201ca0(0x22c)){const _0x220da1=a0_0x66a465[_0x201ca0(0x237)](_0x5b075c);try{const _0x25b896=await a0_0x3290e4['realpath'](_0x220da1);return a0_0x66a465[_0x201ca0(0x1ae)](_0x25b896,a0_0x66a465[_0x201ca0(0x1dd)](_0x5b075c));}catch{throw new Error(_0x201ca0(0x211)+_0x220da1);}}throw _0x258b4c;}}const MorphEditFileArgsSchema=z[a0_0x1012f2(0x243)]({'path':z['string'](),'code_edit':z['string']()[a0_0x1012f2(0x29f)](a0_0x1012f2(0x23c)),'instruction':z[a0_0x1012f2(0x280)]()[a0_0x1012f2(0x29f)](a0_0x1012f2(0x26b)),'dryRun':z[a0_0x1012f2(0x1f7)]()[a0_0x1012f2(0x1c4)](![])[a0_0x1012f2(0x29f)]('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x1012f2(0x280)]()[a0_0x1012f2(0x29f)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'repo_path':z[a0_0x1012f2(0x280)]()['describe'](a0_0x1012f2(0x1df))}),CodebaseSearchArgsSchema=z[a0_0x1012f2(0x243)]({'query':z[a0_0x1012f2(0x280)]()[a0_0x1012f2(0x29f)](a0_0x1012f2(0x269)),'repoId':z[a0_0x1012f2(0x280)]()[a0_0x1012f2(0x29f)](a0_0x1012f2(0x23e)),'branch':z[a0_0x1012f2(0x280)]()['optional']()['describe'](a0_0x1012f2(0x286)),'commitHash':z[a0_0x1012f2(0x280)]()[a0_0x1012f2(0x1b6)]()[a0_0x1012f2(0x29f)](a0_0x1012f2(0x1e5)),'target_directories':z[a0_0x1012f2(0x22a)](z[a0_0x1012f2(0x280)]())[a0_0x1012f2(0x1c4)]([])[a0_0x1012f2(0x29f)](a0_0x1012f2(0x268)),'limit':z[a0_0x1012f2(0x1cd)]()['optional']()[a0_0x1012f2(0x1c4)](0xa)[a0_0x1012f2(0x29f)](a0_0x1012f2(0x225))}),server=new Server({'name':a0_0x1012f2(0x227),'version':a0_0x1012f2(0x28c)},{'capabilities':{'tools':{}}});function a0_0xedc3(_0x3e7be2,_0x509380){_0x3e7be2=_0x3e7be2-0x1ad;const _0x58e463=a0_0x58e4();let _0xedc3c4=_0x58e463[_0x3e7be2];return _0xedc3c4;}server[a0_0x1012f2(0x1f4)](ListToolsRequestSchema,async()=>{const _0x3917b3=a0_0x1012f2,_0x2b630d=[{'name':'edit_file','description':_0x3917b3(0x1bc)+_0x3917b3(0x1f9)+_0x3917b3(0x1af)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+_0x3917b3(0x273)+_0x3917b3(0x241)+_0x3917b3(0x220)+_0x3917b3(0x1bb)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x3917b3(0x209)+_0x3917b3(0x1cb)+_0x3917b3(0x1da)+_0x3917b3(0x1c3)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+'Rules:\x0a'+_0x3917b3(0x278)+_0x3917b3(0x281)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x3917b3(0x244)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x3917b3(0x299),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x3917b3(0x290)+_0x3917b3(0x20a)+_0x3917b3(0x1ef)+_0x3917b3(0x25a)+_0x3917b3(0x24b)+_0x3917b3(0x1c7)+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x3917b3(0x29a),'description':_0x3917b3(0x1f5)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x3917b3(0x27b)+_0x3917b3(0x256)+_0x3917b3(0x25e)+_0x3917b3(0x215)+_0x3917b3(0x1e4)+_0x3917b3(0x240)+'Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20'+_0x3917b3(0x213)+_0x3917b3(0x205),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x38b483=_0x2b630d[_0x3917b3(0x1b2)](_0x28f1fa=>{const _0x2c5fb2=_0x3917b3;if(!ENABLED_TOOLS[_0x2c5fb2(0x270)](_0x28f1fa[_0x2c5fb2(0x206)]))return![];if(_0x2c5fb2(0x20f)in _0x28f1fa&&_0x28f1fa[_0x2c5fb2(0x20f)]&&!MORPH_API_KEY)return console['error'](_0x2c5fb2(0x1bf)+_0x28f1fa['name']+_0x2c5fb2(0x260)),![];return!![];});return{'tools':_0x38b483['map'](_0x1e3036=>({'name':_0x1e3036[_0x3917b3(0x206)],'description':_0x1e3036[_0x3917b3(0x254)],'inputSchema':_0x1e3036[_0x3917b3(0x1f6)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x23f6ba=>{const _0xe7167e=a0_0x1012f2;try{const {name:_0x3cbc97,arguments:_0x4ece14}=_0x23f6ba[_0xe7167e(0x1f1)];switch(_0x3cbc97){case _0xe7167e(0x1c0):{const _0x43b2e5=MorphEditFileArgsSchema['safeParse'](_0x4ece14);if(!_0x43b2e5[_0xe7167e(0x28d)])throw new Error(_0xe7167e(0x208)+_0x43b2e5['error']);const _0x42ca5b=await validatePath(_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x271)]);let _0x5a003c=null,_0x1caf4f=!![],_0x12ca84=null;try{_0x5a003c=await a0_0x3290e4[_0xe7167e(0x22b)](_0x42ca5b,_0xe7167e(0x217));}catch(_0x6b81b5){const _0x1fae08=_0x6b81b5[_0xe7167e(0x21b)];_0x1fae08===_0xe7167e(0x22c)?(_0x1caf4f=![],_0x5a003c=''):(_0x12ca84=_0xe7167e(0x222)+(_0x1fae08||_0xe7167e(0x26a))+_0xe7167e(0x1ee)+(_0x6b81b5 instanceof Error?_0x6b81b5['message']:String(_0x6b81b5)),console[_0xe7167e(0x20c)]('Warning:\x20'+_0x12ca84));}try{const _0x27c2a2=MORPH_API_KEY;if(!_0x27c2a2)throw new Error(_0xe7167e(0x224));const _0x1ddc4b=a0_0x66a465['dirname'](_0x42ca5b),_0x11f92e=a0_0x66a465[_0xe7167e(0x1dd)](_0x42ca5b),_0x66762f=await executeEditFile({'target_filepath':_0x11f92e,'code_edit':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x1eb)],'instructions':_0x43b2e5[_0xe7167e(0x23b)]['instruction']},{'morphApiKey':_0x27c2a2,'morphApiUrl':MORPH_API_URL,'baseDir':_0x1ddc4b,'autoWrite':!_0x43b2e5['data'][_0xe7167e(0x242)],'generateUdiff':!![],'debug':![]});if(!_0x66762f['success'])throw new Error(_0x66762f[_0xe7167e(0x20c)]||_0xe7167e(0x1f2));const _0x4bc3b1=_0x66762f['udiff']||'';let _0x5a6b26=0x3;while(_0x4bc3b1['includes']('`'['repeat'](_0x5a6b26))){_0x5a6b26++;}const _0xa865ef='`'['repeat'](_0x5a6b26)+_0xe7167e(0x275)+_0x4bc3b1+'`'[_0xe7167e(0x285)](_0x5a6b26)+'\x0a\x0a';if(_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x242)])return{'content':[{'type':'text','text':_0xe7167e(0x1d5)+(_0x1caf4f?'':_0xe7167e(0x1c1))+':\x20'+_0x43b2e5['data'][_0xe7167e(0x1f3)]+'\x0a\x0a'+_0xa865ef+'Use\x20dryRun=false\x20to\x20'+(_0x1caf4f?_0xe7167e(0x1b5):'create\x20this\x20file')+'.'}]};return{'content':[{'type':_0xe7167e(0x267),'text':'Morph\x20Edit\x20'+(_0x1caf4f?_0xe7167e(0x28e):_0xe7167e(0x1c6))+':\x20'+_0x43b2e5['data']['instruction']+'\x0a\x0a'+_0xa865ef+_0xe7167e(0x29d)+(_0x1caf4f?_0xe7167e(0x218):'created')+'\x20'+_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x271)]}]};}catch(_0x415087){const _0x191201=_0x415087 instanceof Error?_0x415087[_0xe7167e(0x1d4)]:String(_0x415087);return reportMorphError({'error_message':_0x191201,'error_type':_0x415087 instanceof Error?_0x415087[_0xe7167e(0x266)]['name']:'UnknownError','context':{'tool':_0xe7167e(0x1c0),'file_path':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x271)],'validated_path':_0x42ca5b,'instruction':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x1f3)],'model':'morph-v3-fast','dry_run':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x242)],'file_exists':_0x1caf4f,'file_read_error':_0x12ca84,'file_readable':_0x5a003c!==null,'request_content':{'path':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x271)],'code_edit':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x1eb)],'instruction':_0x43b2e5[_0xe7167e(0x23b)][_0xe7167e(0x1f3)],'original_code':_0x5a003c!==null?_0x5a003c[_0xe7167e(0x1b9)]>0xc350?_0x5a003c[_0xe7167e(0x288)](0x0,0xc350)+_0xe7167e(0x279)+_0x5a003c[_0xe7167e(0x1b9)]+_0xe7167e(0x298):_0x5a003c:_0xe7167e(0x238)+(_0x12ca84||_0xe7167e(0x26e))+']','original_code_length':_0x5a003c?.[_0xe7167e(0x1b9)]??0x0,'model':_0xe7167e(0x261),'dry_run':_0x43b2e5[_0xe7167e(0x23b)]['dryRun']}},'stack_trace':_0x415087 instanceof Error?_0x415087['stack']:undefined,'source':'mcp-filesystem'})[_0xe7167e(0x22f)](()=>{}),{'content':[{'type':_0xe7167e(0x267),'text':_0xe7167e(0x1dc)+_0x191201}],'isError':!![]};}}case'warpgrep_codebase_search':{const _0x1256c2=WarpGrepArgsSchema[_0xe7167e(0x1c9)](_0x4ece14);if(!_0x1256c2[_0xe7167e(0x28d)])return{'content':[{'type':_0xe7167e(0x267),'text':_0xe7167e(0x29e)+_0x1256c2[_0xe7167e(0x20c)]}],'isError':!![]};const _0x4b6f37=_0x4e69b1=>{const _0x530336=_0xe7167e,_0x149f36=[];for(const _0x1dd92b of _0x4e69b1||[]){const _0xc3f93c=_0x1dd92b[_0x530336(0x20d)],_0x53806a=_0x1dd92b[_0x530336(0x1e0)];if(_0xc3f93c===_0x530336(0x25b)&&_0x53806a){const _0x595368=_0x53806a[_0x530336(0x287)]('\x0a')[_0x530336(0x1b2)](_0x4f395e=>_0x4f395e[_0x530336(0x28a)]());for(const _0x2cef7e of _0x595368){const _0x3883c2=_0x2cef7e[_0x530336(0x203)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x3883c2){_0x149f36[_0x530336(0x236)](_0x530336(0x1d0)+_0x3883c2[0x1]+'\x27\x20'+_0x3883c2[0x2]);continue;}const _0x5a0b16=_0x2cef7e[_0x530336(0x203)](/^read\s+(.+)$/);if(_0x5a0b16){_0x149f36[_0x530336(0x236)](_0x530336(0x1b7)+_0x5a0b16[0x1]);continue;}const _0x1b80c5=_0x2cef7e[_0x530336(0x203)](/^list_directory\s+(.+)$/);if(_0x1b80c5){_0x149f36['push'](_0x530336(0x245)+_0x1b80c5[0x1]);continue;}}}}return _0x149f36;};try{const _0x159d95=a0_0x66a465['resolve'](_0x1256c2['data'][_0xe7167e(0x29b)]),_0x5625ae=new LocalRipgrepProvider(_0x159d95),_0x5e5ba6=await runWarpGrep({'query':_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x1ea)],'repoRoot':_0x159d95,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x5625ae});let _0x405b90='';if(_0x5e5ba6[_0xe7167e(0x292)]===_0xe7167e(0x235)&&_0x5e5ba6[_0xe7167e(0x210)]?.[_0xe7167e(0x1ba)]?.[_0xe7167e(0x1f8)]){const _0x2627fb=_0x5e5ba6[_0xe7167e(0x210)][_0xe7167e(0x1ba)]['files'],_0x5099eb=[],_0x311830=[_0xe7167e(0x251)];for(const _0x2b8197 of _0x5e5ba6['messages']){const _0x5b961a=_0x2b8197[_0xe7167e(0x20d)],_0x4fad53=_0x2b8197[_0xe7167e(0x1e0)];if(_0x5b961a===_0xe7167e(0x25b)&&_0x4fad53){const _0x2fc5a9=_0x4fad53[_0xe7167e(0x287)]('\x0a')[_0xe7167e(0x1b2)](_0x56432e=>_0x56432e[_0xe7167e(0x28a)]());for(const _0x297277 of _0x2fc5a9){const _0x11d111=_0x297277[_0xe7167e(0x203)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x11d111){_0x311830['push'](_0xe7167e(0x28b)+_0x11d111[0x1]+_0xe7167e(0x276)+_0x11d111[0x2]+'`');continue;}const _0x5642b9=_0x297277[_0xe7167e(0x203)](/^read\s+(.+)$/);if(_0x5642b9){_0x311830[_0xe7167e(0x236)](_0xe7167e(0x23d)+_0x5642b9[0x1]+'`');continue;}const _0x3f866b=_0x297277[_0xe7167e(0x203)](/^list_directory\s+(.+)$/);if(_0x3f866b){_0x311830[_0xe7167e(0x236)](_0xe7167e(0x221)+_0x3f866b[0x1]+'`');continue;}}}}_0x5099eb[_0xe7167e(0x236)](_0x311830[_0xe7167e(0x1ae)]('\x0a'));const _0x229dff=['',_0xe7167e(0x284)];for(const _0x44e5b9 of _0x2627fb){if(_0x44e5b9[_0xe7167e(0x1d3)]==='*')_0x229dff[_0xe7167e(0x236)]('-\x20'+_0x44e5b9[_0xe7167e(0x271)]+':*');else{if(Array[_0xe7167e(0x24a)](_0x44e5b9[_0xe7167e(0x1d3)])){const _0x1d3c62=_0x44e5b9['lines']['map'](([_0x52bbe5,_0xd74e8])=>{if(_0x52bbe5===_0xd74e8)return''+_0x52bbe5;return _0x52bbe5+'-'+_0xd74e8;});_0x229dff[_0xe7167e(0x236)]('-\x20'+_0x44e5b9[_0xe7167e(0x271)]+':'+_0x1d3c62['join'](','));}else _0x229dff[_0xe7167e(0x236)]('-\x20'+_0x44e5b9[_0xe7167e(0x271)]+':*');}}_0x229dff[_0xe7167e(0x236)](''),_0x5099eb[_0xe7167e(0x236)](_0x229dff['join']('\x0a')),_0x5099eb[_0xe7167e(0x236)](_0xe7167e(0x1e8));const _0xc4d2ee=[];for(const _0x2018a6 of _0x2627fb){let _0x3a07aa=a0_0x66a465[_0xe7167e(0x252)](_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x29b)],_0x2018a6[_0xe7167e(0x271)]),_0x48342e=null,_0x37521d=null;try{_0x48342e=await a0_0x3290e4[_0xe7167e(0x22b)](_0x3a07aa,{'encoding':_0xe7167e(0x217)});}catch(_0x210bda){const _0x1af458=fixPathRepetition(_0x3a07aa);if(_0x1af458)try{_0x48342e=await a0_0x3290e4[_0xe7167e(0x22b)](_0x1af458,{'encoding':'utf-8'}),_0x3a07aa=_0x1af458;}catch{_0x37521d=_0x210bda instanceof Error?_0x210bda:new Error(String(_0x210bda));}else _0x37521d=_0x210bda instanceof Error?_0x210bda:new Error(String(_0x210bda));}if(_0x48342e!==null){const _0x32b0d4=_0x48342e[_0xe7167e(0x287)](/\r?\n/),_0x5086bc=[_0xe7167e(0x1ad)+_0x2018a6[_0xe7167e(0x271)]+'\x22>'];if(_0x2018a6[_0xe7167e(0x1d3)]==='*'||!Array[_0xe7167e(0x24a)](_0x2018a6[_0xe7167e(0x1d3)]))for(let _0x4eab0d=0x1;_0x4eab0d<=_0x32b0d4[_0xe7167e(0x1b9)];_0x4eab0d++){const _0x2036f8=_0x32b0d4[_0x4eab0d-0x1];_0x5086bc[_0xe7167e(0x236)](_0x4eab0d+'|\x20'+_0x2036f8);}else for(const [_0x5453a5,_0x3cd0c7]of _0x2018a6[_0xe7167e(0x1d3)]){_0x5086bc['length']>0x1&&_0x5086bc[_0xe7167e(0x236)]('');for(let _0x23d14f=_0x5453a5;_0x23d14f<=_0x3cd0c7&&_0x23d14f<=_0x32b0d4['length'];_0x23d14f++){const _0x4ad240=_0x32b0d4[_0x23d14f-0x1];_0x5086bc['push'](_0x23d14f+'|\x20'+_0x4ad240);}}_0x5086bc[_0xe7167e(0x236)]('</file>'),_0xc4d2ee[_0xe7167e(0x236)](_0x5086bc[_0xe7167e(0x1ae)]('\x0a'));}else _0xc4d2ee[_0xe7167e(0x236)](_0xe7167e(0x1ad)+_0x2018a6[_0xe7167e(0x271)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x37521d?.[_0xe7167e(0x1d4)]||_0xe7167e(0x1e1))+'\x0a</file>');}_0x5099eb[_0xe7167e(0x236)](_0xc4d2ee['join']('\x0a\x0a')),_0x405b90=_0x5099eb['join']('\x0a');const _0x55ad5f=_0x5e5ba6[_0xe7167e(0x1ed)]?.[_0xe7167e(0x1b2)](_0x46b5e2=>_0x46b5e2[_0xe7167e(0x1d4)]?.[_0xe7167e(0x277)]('File\x20read\x20error:'))||[];if(_0x55ad5f[_0xe7167e(0x1b9)]>0x0){const _0x33679a=_0x55ad5f[_0xe7167e(0x22d)](_0x3c6613=>_0x3c6613[_0xe7167e(0x1d4)])[_0xe7167e(0x1ae)](';\x20');reportMorphError({'error_message':_0x33679a,'error_type':_0xe7167e(0x231),'context':{'tool':_0xe7167e(0x264),'repo_path':_0x1256c2['data'][_0xe7167e(0x29b)],'query':_0x1256c2['data'][_0xe7167e(0x1ea)],'model':_0xe7167e(0x21d),'termination_reason':'completed_with_file_errors','error_count':_0x55ad5f[_0xe7167e(0x1b9)],'is_timeout':![],'timings':_0x5e5ba6[_0xe7167e(0x20b)],'files_attempted':_0x2627fb[_0xe7167e(0x22d)](_0x401c4d=>({'path':_0x401c4d[_0xe7167e(0x271)],'lines':_0x401c4d[_0xe7167e(0x1d3)]})),'tool_calls':_0x4b6f37(_0x5e5ba6['messages']),'messages':_0x5e5ba6['messages']?.[_0xe7167e(0x22d)](_0x14002a=>({'role':_0x14002a['role'],'content':_0x14002a[_0xe7167e(0x1e0)]})),'request_content':{'query':_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x1ea)],'repo_path':_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x29b)],'repoRoot':a0_0x66a465[_0xe7167e(0x252)](_0x1256c2['data']['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'source':_0xe7167e(0x26c)})[_0xe7167e(0x22f)](()=>{});}}else{if(_0x5e5ba6['terminationReason']==='terminated'&&_0x5e5ba6[_0xe7167e(0x1ed)]['length']>0x0){const _0x1e498c=_0x5e5ba6[_0xe7167e(0x1ed)][_0xe7167e(0x22d)](_0x39c537=>_0x39c537[_0xe7167e(0x1d4)])[_0xe7167e(0x1ae)](';\x20');_0x405b90='Error:\x20'+_0x1e498c;const _0x1d5756=_0x1e498c[_0xe7167e(0x1c5)]()[_0xe7167e(0x270)]('timeout')||_0x1e498c[_0xe7167e(0x1c5)]()[_0xe7167e(0x270)](_0xe7167e(0x282))||_0x1e498c[_0xe7167e(0x1c5)]()[_0xe7167e(0x270)](_0xe7167e(0x24f)),_0x78f30=_0x5e5ba6[_0xe7167e(0x210)]?.[_0xe7167e(0x1ba)]?.[_0xe7167e(0x1f8)],_0xda564e=_0x5e5ba6[_0xe7167e(0x1ed)][0x0];reportMorphError({'error_message':_0x1e498c,'error_type':_0x1d5756?'TimeoutError':_0xda564e?.[_0xe7167e(0x266)]?.[_0xe7167e(0x206)]||_0xe7167e(0x1de),'context':{'tool':_0xe7167e(0x264),'repo_path':_0x1256c2[_0xe7167e(0x23b)]['repo_path'],'query':_0x1256c2[_0xe7167e(0x23b)]['search_string'],'model':_0xe7167e(0x21d),'termination_reason':_0x5e5ba6['terminationReason'],'error_count':_0x5e5ba6[_0xe7167e(0x1ed)]['length'],'is_timeout':_0x1d5756,'timings':_0x5e5ba6[_0xe7167e(0x20b)],'files_attempted':_0x78f30?.[_0xe7167e(0x22d)](_0x9e8ae2=>({'path':_0x9e8ae2[_0xe7167e(0x271)],'lines':_0x9e8ae2[_0xe7167e(0x1d3)]})),'tool_calls':_0x4b6f37(_0x5e5ba6[_0xe7167e(0x289)]),'messages':_0x5e5ba6[_0xe7167e(0x289)]?.['map'](_0x8603d0=>({'role':_0x8603d0['role'],'content':_0x8603d0[_0xe7167e(0x1e0)]})),'request_content':{'query':_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x1ea)],'repo_path':_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x29b)],'repoRoot':a0_0x66a465['resolve'](_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x29b)]),'model':_0xe7167e(0x21d)}},'stack_trace':_0xda564e?.['stack']||undefined,'source':_0xe7167e(0x26c)})[_0xe7167e(0x22f)](()=>{});}else _0x405b90=_0xe7167e(0x204);}return{'content':[{'type':_0xe7167e(0x267),'text':_0x405b90}]};}catch(_0x814100){const _0x381a0d=_0x814100 instanceof Error?_0x814100[_0xe7167e(0x1d4)]:String(_0x814100),_0xa8c873=_0x381a0d['toLowerCase']()['includes'](_0xe7167e(0x1cf))||_0x381a0d['toLowerCase']()['includes'](_0xe7167e(0x282))||_0x381a0d['toLowerCase']()[_0xe7167e(0x270)]('etimedout')||_0x814100 instanceof Error&&_0x814100[_0xe7167e(0x206)]==='TimeoutError';return reportMorphError({'error_message':_0x381a0d,'error_type':_0xa8c873?_0xe7167e(0x24c):_0x814100 instanceof Error?_0x814100['constructor']['name']:_0xe7167e(0x1b3),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x1256c2[_0xe7167e(0x23b)]['repo_path'],'query':_0x1256c2[_0xe7167e(0x23b)]['search_string'],'model':_0xe7167e(0x21d),'is_timeout':_0xa8c873,'exception_phase':_0xe7167e(0x262),'request_content':{'query':_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x1ea)],'repo_path':_0x1256c2[_0xe7167e(0x23b)]['repo_path'],'repoRoot':a0_0x66a465[_0xe7167e(0x252)](_0x1256c2[_0xe7167e(0x23b)][_0xe7167e(0x29b)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x814100 instanceof Error?_0x814100['stack']:undefined,'source':_0xe7167e(0x26c)})[_0xe7167e(0x22f)](()=>{}),{'content':[{'type':'text','text':_0xe7167e(0x27f)+_0x381a0d}],'isError':![]};}}case _0xe7167e(0x29a):{const _0x389b82=CodebaseSearchArgsSchema[_0xe7167e(0x1c9)](_0x4ece14);if(!_0x389b82[_0xe7167e(0x28d)])return{'content':[{'type':_0xe7167e(0x267),'text':'Invalid\x20arguments:\x20'+_0x389b82['error']}],'isError':!![]};try{const _0x2aa816=MORPH_API_KEY;if(!_0x2aa816)throw new Error(_0xe7167e(0x29c));const _0x5c3989=await executeCodebaseSearch({'query':_0x389b82['data'][_0xe7167e(0x26d)],'target_directories':_0x389b82[_0xe7167e(0x23b)][_0xe7167e(0x21e)],'limit':_0x389b82[_0xe7167e(0x23b)][_0xe7167e(0x1e9)]},{'apiKey':_0x2aa816,'repoId':_0x389b82['data'][_0xe7167e(0x1d1)],'branch':_0x389b82[_0xe7167e(0x23b)][_0xe7167e(0x1fc)],'commitHash':_0x389b82['data'][_0xe7167e(0x233)],'debug':![]});if(!_0x5c3989['success'])return{'content':[{'type':_0xe7167e(0x267),'text':_0xe7167e(0x20e)+_0x5c3989[_0xe7167e(0x20c)]}],'isError':!![]};const _0x1b342c=_0x5c3989[_0xe7167e(0x214)][_0xe7167e(0x1b9)]===0x0?_0xe7167e(0x249)+_0x389b82[_0xe7167e(0x23b)]['query']+'\x22':_0xe7167e(0x1ff)+_0x5c3989['results'][_0xe7167e(0x1b9)]+_0xe7167e(0x297)+_0x5c3989[_0xe7167e(0x1e3)][_0xe7167e(0x21a)]+'ms:\x0a\x0a'+_0x5c3989[_0xe7167e(0x214)][_0xe7167e(0x22d)]((_0x5aeb0,_0x8e9e0c)=>_0x8e9e0c+0x1+'.\x20'+_0x5aeb0[_0xe7167e(0x1d8)]+'\x20('+(_0x5aeb0[_0xe7167e(0x258)]*0x64)[_0xe7167e(0x202)](0x1)+_0xe7167e(0x248)+(_0xe7167e(0x230)+_0x5aeb0[_0xe7167e(0x1e6)]+'-'+_0x5aeb0[_0xe7167e(0x1db)]+'\x0a')+(_0xe7167e(0x1ca)+_0x5aeb0[_0xe7167e(0x1e0)][_0xe7167e(0x288)](0x0,0xc8)+(_0x5aeb0['content'][_0xe7167e(0x1b9)]>0xc8?'...':'')+'\x0a'))['join']('\x0a');return{'content':[{'type':_0xe7167e(0x267),'text':_0x1b342c}]};}catch(_0x25fdef){const _0x4435ae=_0x25fdef instanceof Error?_0x25fdef['message']:String(_0x25fdef);return reportMorphError({'error_message':_0x4435ae,'error_type':_0x25fdef instanceof Error?_0x25fdef['constructor']['name']:_0xe7167e(0x1b3),'context':{'tool':'codebase_search','query':_0x389b82[_0xe7167e(0x23b)][_0xe7167e(0x26d)],'repo_id':_0x389b82[_0xe7167e(0x23b)]['repoId']},'stack_trace':_0x25fdef instanceof Error?_0x25fdef[_0xe7167e(0x1be)]:undefined,'source':_0xe7167e(0x26c)})[_0xe7167e(0x22f)](()=>{}),{'content':[{'type':'text','text':_0xe7167e(0x259)+_0x4435ae}],'isError':!![]};}}default:throw new Error(_0xe7167e(0x24d)+_0x3cbc97);}}catch(_0x35578d){const _0x62294f=_0x35578d instanceof Error?_0x35578d[_0xe7167e(0x1d4)]:String(_0x35578d);return reportMorphError({'error_message':_0x62294f,'error_type':_0x35578d instanceof Error?_0x35578d[_0xe7167e(0x266)][_0xe7167e(0x206)]:_0xe7167e(0x1b3),'context':{'tool':name,'arguments':args?JSON['stringify'](args)[_0xe7167e(0x288)](0x0,0x1f4):undefined,'mcp_server_version':_0xe7167e(0x28c)},'stack_trace':_0x35578d instanceof Error?_0x35578d[_0xe7167e(0x1be)]:undefined,'source':_0xe7167e(0x26c)})[_0xe7167e(0x22f)](()=>{}),{'content':[{'type':_0xe7167e(0x267),'text':'Error:\x20'+_0x62294f}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x206fb3){const _0x1eb3ab=a0_0x1012f2,_0x38e6cd=await getValidRootDirectories(_0x206fb3);if(_0x38e6cd[_0x1eb3ab(0x1b9)]>0x0)allowedDirectories=[..._0x38e6cd],console[_0x1eb3ab(0x20c)](_0x1eb3ab(0x291)+_0x38e6cd[_0x1eb3ab(0x1b9)]+_0x1eb3ab(0x265));else{console[_0x1eb3ab(0x20c)]('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x87e61e=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x87e61e&&(allowedDirectories=[_0x87e61e],console[_0x1eb3ab(0x20c)](_0x1eb3ab(0x232)+_0x87e61e));}catch(_0x3e6f38){console[_0x1eb3ab(0x20c)](_0x1eb3ab(0x212)+_0x3e6f38);}}}server[a0_0x1012f2(0x1b4)](RootsListChangedNotificationSchema,async()=>{const _0x3ccf5b=a0_0x1012f2;try{const _0x11aca5=await server[_0x3ccf5b(0x247)]();_0x11aca5&&_0x3ccf5b(0x293)in _0x11aca5&&await updateAllowedDirectoriesFromRoots(_0x11aca5[_0x3ccf5b(0x293)]);}catch(_0x54913c){console[_0x3ccf5b(0x20c)](_0x3ccf5b(0x21f),_0x54913c instanceof Error?_0x54913c[_0x3ccf5b(0x1d4)]:String(_0x54913c));}}),server[a0_0x1012f2(0x1c8)]=async()=>{const _0x596a8d=a0_0x1012f2,_0x1df04a=server[_0x596a8d(0x229)]();if(_0x1df04a?.['roots'])try{const _0x378ba1=await server[_0x596a8d(0x247)]();_0x378ba1&&_0x596a8d(0x293)in _0x378ba1?await updateAllowedDirectoriesFromRoots(_0x378ba1['roots']):console['error'](_0x596a8d(0x226));}catch(_0x4cc520){console['error']('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x4cc520 instanceof Error?_0x4cc520['message']:String(_0x4cc520));}else{if(allowedDirectories[_0x596a8d(0x1b9)]>0x0)console[_0x596a8d(0x20c)](_0x596a8d(0x253),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x596a8d(0x20c)](_0x596a8d(0x1b8));else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};function a0_0x58e4(){const _0x54d984=['Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','-\x20Read\x20file\x20`','Repository\x20identifier','\x20as\x20allowed\x20directory','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','dryRun','object','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','list_directory\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','listRoots','%\x20match)\x0a','No\x20results\x20found\x20for\x20query:\x20\x22','isArray','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','TimeoutError','Unknown\x20tool:\x20','406eTOEyK','etimedout','38EGCYcP','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','resolve','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','description','stat','Benefits:\x0a','application/json','rerankScore','Error:\x20','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','assistant','all','slice','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','false','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','morph-v3-fast','runWarpGrep_call','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','warpgrep_codebase_search','\x20valid\x20directories','constructor','text','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Natural\x20language\x20query\x20to\x20search\x20for\x20code','unknown','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','mcp-filesystem','query','unknown\x20error','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','includes','path','pyproject.toml','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','homedir','diff\x0a','\x27\x20in\x20`','startsWith','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','\x0a...\x20(truncated,\x20total:\x20','sk-','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','MORPH_API_KEY','302306oQnLDC','https://morphllm.com/api/error-report','Error\x20running\x20fast\x20context\x20search:\x20','string','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','timed\x20out','62576auBRAG','Relevant\x20context\x20found:','repeat','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','split','substring','messages','trim','-\x20Grepped\x20\x27','0.2.0','success','Applied','ENABLED_TOOLS','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','terminationReason','roots','composer.json','2684536uOcQvW','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20results\x20in\x20','\x20chars)','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','codebase_search','repo_path','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','Successfully\x20','Invalid\x20arguments:\x20','describe','<file\x20path=\x22','join','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','connect','realpath','filter','UnknownError','setNotificationHandler','apply\x20these\x20changes','optional','read\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','length','metadata','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','isDirectory','stack','Warning:\x20','edit_file','\x20(new\x20file)','3675204WOPXPX','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','default','toLowerCase','Created\x20File','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','oninitialized','safeParse','\x20\x20\x20','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','morph-','number','source','timeout','grep\x20\x27','repoId','MORPH_API_URL','lines','message','🔍\x20Morph\x20Edit\x20Preview','\x20is\x20not\x20a\x20directory','normalize','filepath','Error\x20accessing\x20directory\x20','For\x20deletions:\x0a','endLine','❌\x20Morph\x20Edit\x20Failed:\x20','basename','WarpGrepError','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','content','Unknown\x20error','57333VxBunK','stats','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Specific\x20commit\x20hash\x20to\x20search','startLine','toISOString','Here\x20is\x20the\x20content\x20of\x20files:\x0a','limit','search_string','code_edit','sep','errors','\x20-\x20','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','cwd','params','Morph\x20FastApply\x20failed\x20without\x20error\x20message','instruction','setRequestHandler','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','inputSchema','boolean','files','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','go.mod','package.json','branch','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','access','Found\x20','MORPH_WARP_GREP_TIMEOUT','2372505pDAJGp','toFixed','match','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','name','.git','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','timings','error','role','Search\x20failed:\x20','requiresApiKey','finish','Parent\x20directory\x20does\x20not\x20exist:\x20','Warning:\x20Workspace\x20fallback\x20failed:\x20','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','results','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','utf-8','applied\x20edits\x20to','exit','searchTimeMs','code','7681275ceDZfb','morph-warp-grep-v1-1111v0','target_directories','Failed\x20to\x20request\x20roots\x20from\x20client:','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','-\x20Listed\x20directory\x20`','Failed\x20to\x20read\x20file:\x20','.cursor','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Max\x20results\x20to\x20return','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','morph-mcp','WORKSPACE_ROOT','getClientCapabilities','array','readFile','ENOENT','map','every','catch','\x20\x20\x20Lines\x20','FileReadError','Fallback:\x20Using\x20workspace\x20root\x20','commitHash','ENABLE_WORKSPACE_MODE','completed','push','dirname','[could\x20not\x20read\x20file:\x20','Cargo.toml','env','data'];a0_0x58e4=function(){return _0x54d984;};return a0_0x58e4();}async function runServer(){const _0x10c7fb=a0_0x1012f2,_0x1c7e9f=new StdioServerTransport();await server[_0x10c7fb(0x1b0)](_0x1c7e9f),console['error'](_0x10c7fb(0x26f)),allowedDirectories[_0x10c7fb(0x1b9)]===0x0&&console[_0x10c7fb(0x20c)]('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x1012f2(0x22f)](_0x14aa57=>{const _0x1d88b3=a0_0x1012f2;console[_0x1d88b3(0x20c)]('Fatal\x20error\x20running\x20server:',_0x14aa57),process['exit'](0x1);});
2
+ const a0_0x518e0b=a0_0x5b97;(function(_0x1495a4,_0x146eb7){const _0x5654e4=a0_0x5b97,_0x1bb812=_0x1495a4();while(!![]){try{const _0x224254=-parseInt(_0x5654e4(0x13e))/0x1+parseInt(_0x5654e4(0xf1))/0x2+-parseInt(_0x5654e4(0xb6))/0x3+parseInt(_0x5654e4(0x170))/0x4+parseInt(_0x5654e4(0x113))/0x5*(-parseInt(_0x5654e4(0x12d))/0x6)+parseInt(_0x5654e4(0x156))/0x7+parseInt(_0x5654e4(0x152))/0x8;if(_0x224254===_0x146eb7)break;else _0x1bb812['push'](_0x1bb812['shift']());}catch(_0x70f01e){_0x1bb812['push'](_0x1bb812['shift']());}}}(a0_0x41bb,0xd1ecf));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x41bb(){const _0x15dafa=['code','repoId','ENABLE_WORKSPACE_MODE','Error:\x20','source','Enabled\x20tools:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','1471476eMRNbx','terminationReason','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','.git','WarpGrepError','ENOENT','substring','oninitialized','Relevant\x20context\x20found:','Created\x20File','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','branch','morph-warp-grep-v1-1111v0','success','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','<file\x20path=\x22','default','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','24816696ftrISL','unknown','Failed\x20to\x20read\x20file:\x20','timeout','3285653rBSOkD','Failed\x20to\x20request\x20roots\x20from\x20client:','apply\x20these\x20changes','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','setRequestHandler','map','all','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','every','\x20\x20\x20Lines\x20','object','search_string','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','etimedout','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','startsWith','push','assistant','sk-','startLine','\x20-\x20','inputSchema','FileReadError','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','readFile','667288SWvxfR','realpath','-\x20Read\x20file\x20`','create\x20this\x20file','runWarpGrep_call','Applied','slice','\x0a...\x20(truncated,\x20total:\x20','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','UnknownError','Natural\x20language\x20query\x20to\x20search\x20for\x20code','exit','Morph\x20Edit\x20','repo_path','Error\x20running\x20fast\x20context\x20search:\x20','getClientCapabilities','\x20valid\x20directories','Rules:\x0a','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','-\x20Listed\x20directory\x20`','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','diff\x0a','code_edit','terminated','metadata','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','No\x20results\x20found\x20for\x20query:\x20\x22','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','toFixed','env','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','</file>','searchTimeMs','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','constructor','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','optional','For\x20deletions:\x0a','results','mcp-filesystem','toLowerCase','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','endLine','error','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.','stack','Search\x20failed:\x20','role','Fatal\x20error\x20running\x20server:','Fallback:\x20Using\x20workspace\x20root\x20','Invalid\x20arguments:\x20','post','Unknown\x20tool:\x20','isDirectory','https://morphllm.com/api/error-report','Workspace\x20mode\x20enabled:\x20Using\x20','morph-mcp','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','4158183qDYpLZ','query','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','Warning:\x20Workspace\x20fallback\x20failed:\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','stat','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','string','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','ENABLED_TOOLS','toISOString','warpgrep_codebase_search','files','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','sep','errors','limit','roots','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','number','go.mod','join','edit_file','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','argv','🔍\x20Morph\x20Edit\x20Preview','\x0a</file>','repeat','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','filter','\x20as\x20allowed\x20directory','filepath','target_directories','Bearer\x20','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Max\x20results\x20to\x20return','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','dirname','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','resolve','finish','path','describe','Cargo.toml','pyproject.toml','data','content','stats','access','morph-v3-fast','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','utf-8','codebase_search','listRoots','connect','tsconfig.json','composer.json','timed\x20out','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','158100tYrebR','instruction','Parent\x20directory\x20does\x20not\x20exist:\x20','TimeoutError','Error\x20accessing\x20directory\x20','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','array','description','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','morph-','Found\x20','commitHash','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','.cursor','lines','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','message','MORPH_API_KEY','Repository\x20identifier','messages','basename','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','ms:\x0a\x0a','floor','0.2.0','application/json','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','list_directory\x20','length','name','match','\x22>\x0aError\x20reading\x20file:\x20','770YLgeKj','dryRun','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','-\x20Grepped\x20\x27','stringify','...','requiresApiKey','timings','catch','isArray','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','completed','text','\x20chars)','params','rerankScore','\x20\x20\x20','trim','setNotificationHandler','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','\x20results\x20in\x20','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','[could\x20not\x20read\x20file:\x20','udiff','safeParse','PWD','3894cbnhlc','split','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','Specific\x20commit\x20hash\x20to\x20search','Warning:\x20','includes','.vscode','normalize','unknown\x20error'];a0_0x41bb=function(){return _0x15dafa;};return a0_0x41bb();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x5f0edb from'fs/promises';import a0_0xe825a8 from'path';import a0_0x5d3953 from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x5f31fc from'axios';function fixPathRepetition(_0x5dc96e){const _0x1b68d1=a0_0x5b97,_0x23346a=_0x5dc96e[_0x1b68d1(0x12e)](a0_0xe825a8[_0x1b68d1(0xc4)])['filter'](Boolean);if(_0x23346a[_0x1b68d1(0x10f)]<0x2)return null;for(let _0x279677=Math[_0x1b68d1(0x10a)](_0x23346a['length']/0x2);_0x279677>=0x1;_0x279677--){for(let _0x97ee50=0x0;_0x97ee50<=_0x23346a['length']-0x2*_0x279677;_0x97ee50++){const _0x43a331=_0x23346a[_0x1b68d1(0x176)](_0x97ee50,_0x97ee50+_0x279677),_0x1b6e67=_0x23346a[_0x1b68d1(0x176)](_0x97ee50+_0x279677,_0x97ee50+0x2*_0x279677);if(_0x43a331[_0x1b68d1(0x15e)]((_0x4a21f9,_0x49e380)=>_0x4a21f9===_0x1b6e67[_0x49e380])){const _0x36d0f6=[..._0x23346a[_0x1b68d1(0x176)](0x0,_0x97ee50),..._0x23346a['slice'](_0x97ee50+_0x279677)];return a0_0xe825a8[_0x1b68d1(0xc4)]+_0x36d0f6['join'](a0_0xe825a8[_0x1b68d1(0xc4)]);}}}return null;}const args=process[a0_0x518e0b(0xce)]['slice'](0x2),ALL_TOOLS=['edit_file',a0_0x518e0b(0xc1),'codebase_search'],DEFAULT_TOOLS=[a0_0x518e0b(0xcc),a0_0x518e0b(0xc1)],ENABLED_TOOLS=process[a0_0x518e0b(0x18d)][a0_0x518e0b(0xbf)]?process[a0_0x518e0b(0x18d)]['ENABLED_TOOLS']==='all'?ALL_TOOLS:process[a0_0x518e0b(0x18d)][a0_0x518e0b(0xbf)]['split'](',')['map'](_0x365ae0=>_0x365ae0[a0_0x518e0b(0x124)]()):DEFAULT_TOOLS;console[a0_0x518e0b(0x19b)](a0_0x518e0b(0x13b)+ENABLED_TOOLS['join'](',\x20'));const WORKSPACE_ROOT=process[a0_0x518e0b(0x18d)]['WORKSPACE_ROOT']||process[a0_0x518e0b(0x18d)][a0_0x518e0b(0x12c)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x518e0b(0x138)]!=='false',MORPH_API_KEY=process[a0_0x518e0b(0x18d)][a0_0x518e0b(0x103)],MORPH_API_URL=process[a0_0x518e0b(0x18d)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x518e0b(0x18d)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process['env']['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x518e0b(0x166)](a0_0x518e0b(0x169))&&!MORPH_API_KEY['startsWith'](a0_0x518e0b(0xfb))&&console[a0_0x518e0b(0x19b)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0xd4b34a){const _0x1c4cc5=a0_0x518e0b;try{await a0_0x5f31fc[_0x1c4cc5(0xad)](_0x1c4cc5(0xb0),{..._0xd4b34a,'timestamp':new Date()[_0x1c4cc5(0xc0)](),'source':_0xd4b34a[_0x1c4cc5(0x13a)]||_0x1c4cc5(0x197)},{'timeout':0x1388,'headers':{'Content-Type':_0x1c4cc5(0x10c),'Authorization':_0x1c4cc5(0xd7)+MORPH_API_KEY}});}catch{}}args[a0_0x518e0b(0x10f)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x518e0b(0x19b)](a0_0x518e0b(0xdc)),console[a0_0x518e0b(0x19b)](a0_0x518e0b(0x18b)),console[a0_0x518e0b(0x19b)](a0_0x518e0b(0x193)),console['error'](a0_0x518e0b(0x165)),console[a0_0x518e0b(0x19b)]('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console[a0_0x518e0b(0x19b)]('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x251d03){const _0x5864ec=a0_0x518e0b;return a0_0xe825a8[_0x5864ec(0x134)](_0x251d03);}function expandHome(_0x3550c9){const _0x1ef5e2=a0_0x518e0b;if(_0x3550c9['startsWith']('~/')||_0x3550c9==='~')return a0_0xe825a8[_0x1ef5e2(0xcb)](a0_0x5d3953['homedir'](),_0x3550c9['slice'](0x1));return _0x3550c9;}let allowedDirectories=await Promise[a0_0x518e0b(0x15c)](args['map'](async _0x4d62ab=>{const _0x489741=a0_0x518e0b,_0x5832fd=expandHome(_0x4d62ab),_0x3683db=a0_0xe825a8[_0x489741(0xdd)](_0x5832fd);try{const _0x1494c5=await a0_0x5f0edb[_0x489741(0x171)](_0x3683db);return normalizePath(_0x1494c5);}catch(_0x418d89){return normalizePath(_0x3683db);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x518e0b(0x10f)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console[a0_0x518e0b(0x19b)](a0_0x518e0b(0xb1)+workspaceDir+a0_0x518e0b(0xd4)));}catch(a0_0x2cc6e8){console['error'](a0_0x518e0b(0xba)+a0_0x2cc6e8);}async function detectWorkspaceRoot(_0xc94690){const _0x5efd1e=a0_0x518e0b;let _0x5a7860=a0_0xe825a8[_0x5efd1e(0xdd)](_0xc94690);const _0x26f2ea=[_0x5efd1e(0x142),_0x5efd1e(0x133),'package.json',_0x5efd1e(0xe1),_0x5efd1e(0xe2),_0x5efd1e(0xca),_0x5efd1e(0xff),_0x5efd1e(0xed),_0x5efd1e(0xee)];while(_0x5a7860!==a0_0xe825a8[_0x5efd1e(0xdb)](_0x5a7860)){for(const _0x28771f of _0x26f2ea){const _0x25bb60=a0_0xe825a8[_0x5efd1e(0xcb)](_0x5a7860,_0x28771f);try{return await a0_0x5f0edb[_0x5efd1e(0xe6)](_0x25bb60),normalizePath(_0x5a7860);}catch{}}_0x5a7860=a0_0xe825a8[_0x5efd1e(0xdb)](_0x5a7860);}return normalizePath(_0xc94690);}await Promise[a0_0x518e0b(0x15c)](args[a0_0x518e0b(0x15b)](async _0x2eb6fe=>{const _0x14f62a=a0_0x518e0b;try{const _0x5cf299=await a0_0x5f0edb[_0x14f62a(0xbb)](expandHome(_0x2eb6fe));!_0x5cf299[_0x14f62a(0xaf)]()&&(console[_0x14f62a(0x19b)](_0x14f62a(0x139)+_0x2eb6fe+'\x20is\x20not\x20a\x20directory'),process[_0x14f62a(0x17b)](0x1));}catch(_0x104dce){console['error'](_0x14f62a(0xf5)+_0x2eb6fe+':',_0x104dce),process[_0x14f62a(0x17b)](0x1);}}));async function validatePath(_0xf1e368){const _0xa422cf=a0_0x518e0b,_0x44f93c=expandHome(_0xf1e368),_0x3b8482=a0_0xe825a8[_0xa422cf(0xdd)](_0x44f93c);try{const _0x222481=await a0_0x5f0edb[_0xa422cf(0x171)](_0x3b8482);return _0x222481;}catch(_0x4d0b40){if(_0x4d0b40[_0xa422cf(0x136)]===_0xa422cf(0x144)){const _0x3e5aaf=a0_0xe825a8[_0xa422cf(0xdb)](_0x3b8482);try{const _0x2da5cc=await a0_0x5f0edb[_0xa422cf(0x171)](_0x3e5aaf);return a0_0xe825a8[_0xa422cf(0xcb)](_0x2da5cc,a0_0xe825a8[_0xa422cf(0x106)](_0x3b8482));}catch{throw new Error(_0xa422cf(0xf3)+_0x3e5aaf);}}throw _0x4d0b40;}}const MorphEditFileArgsSchema=z[a0_0x518e0b(0x160)]({'path':z[a0_0x518e0b(0xbd)](),'code_edit':z['string']()[a0_0x518e0b(0xe0)](a0_0x518e0b(0xfa)),'instruction':z[a0_0x518e0b(0xbd)]()[a0_0x518e0b(0xe0)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z['boolean']()[a0_0x518e0b(0x150)](![])[a0_0x518e0b(0xe0)]('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x518e0b(0xbd)]()['describe'](a0_0x518e0b(0xfe)),'repo_path':z[a0_0x518e0b(0xbd)]()[a0_0x518e0b(0xe0)](a0_0x518e0b(0x149))}),CodebaseSearchArgsSchema=z[a0_0x518e0b(0x160)]({'query':z['string']()[a0_0x518e0b(0xe0)](a0_0x518e0b(0x17a)),'repoId':z[a0_0x518e0b(0xbd)]()['describe'](a0_0x518e0b(0x104)),'branch':z[a0_0x518e0b(0xbd)]()[a0_0x518e0b(0x194)]()['describe'](a0_0x518e0b(0x126)),'commitHash':z[a0_0x518e0b(0xbd)]()[a0_0x518e0b(0x194)]()[a0_0x518e0b(0xe0)](a0_0x518e0b(0x130)),'target_directories':z[a0_0x518e0b(0xf7)](z[a0_0x518e0b(0xbd)]())[a0_0x518e0b(0x150)]([])[a0_0x518e0b(0xe0)](a0_0x518e0b(0x189)),'limit':z[a0_0x518e0b(0xc9)]()[a0_0x518e0b(0x194)]()['default'](0xa)[a0_0x518e0b(0xe0)](a0_0x518e0b(0xd9))}),server=new Server({'name':a0_0x518e0b(0xb2),'version':a0_0x518e0b(0x10b)},{'capabilities':{'tools':{}}});server[a0_0x518e0b(0x15a)](ListToolsRequestSchema,async()=>{const _0x53d2da=a0_0x518e0b,_0x43ae98=[{'name':_0x53d2da(0xcc),'description':_0x53d2da(0x13d)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x53d2da(0x10d)+_0x53d2da(0xd2)+'Benefits:\x0a'+_0x53d2da(0xbe)+_0x53d2da(0x151)+_0x53d2da(0x191)+_0x53d2da(0xf6)+_0x53d2da(0x108)+_0x53d2da(0x101)+_0x53d2da(0x159)+_0x53d2da(0x195)+_0x53d2da(0xb4)+_0x53d2da(0x163)+_0x53d2da(0x181)+_0x53d2da(0xda)+_0x53d2da(0xc8)+_0x53d2da(0x162)+_0x53d2da(0xd8)+_0x53d2da(0x115)+_0x53d2da(0xf9)+_0x53d2da(0xe8),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x53d2da(0xc1),'description':_0x53d2da(0x178)+_0x53d2da(0xf0)+_0x53d2da(0x182)+_0x53d2da(0xc3)+_0x53d2da(0x14e)+_0x53d2da(0xcd)+_0x53d2da(0x12f)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x53d2da(0xea),'description':'**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a'+_0x53d2da(0x18e)+_0x53d2da(0x128)+'Benefits:\x0a'+_0x53d2da(0x199)+_0x53d2da(0xb8)+_0x53d2da(0xb5)+'-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a'+'Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20'+'Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20'+_0x53d2da(0x11d),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x131934=_0x43ae98['filter'](_0x5bb805=>{const _0x181e69=_0x53d2da;if(!ENABLED_TOOLS[_0x181e69(0x132)](_0x5bb805[_0x181e69(0x110)]))return![];if(_0x181e69(0x119)in _0x5bb805&&_0x5bb805[_0x181e69(0x119)]&&!MORPH_API_KEY)return console['error']('Warning:\x20'+_0x5bb805[_0x181e69(0x110)]+_0x181e69(0x141)),![];return!![];});return{'tools':_0x131934[_0x53d2da(0x15b)](_0x28fabf=>({'name':_0x28fabf[_0x53d2da(0x110)],'description':_0x28fabf[_0x53d2da(0xf8)],'inputSchema':_0x28fabf[_0x53d2da(0x16c)]}))};}),server[a0_0x518e0b(0x15a)](CallToolRequestSchema,async _0x321380=>{const _0x37a4dc=a0_0x518e0b;try{const {name:_0x8beef9,arguments:_0x50200b}=_0x321380[_0x37a4dc(0x121)];switch(_0x8beef9){case _0x37a4dc(0xcc):{const _0x2a902d=MorphEditFileArgsSchema['safeParse'](_0x50200b);if(!_0x2a902d[_0x37a4dc(0x14c)])throw new Error(_0x37a4dc(0xb3)+_0x2a902d[_0x37a4dc(0x19b)]);const _0x2f44ff=await validatePath(_0x2a902d[_0x37a4dc(0xe3)]['path']);let _0x514ab6=null,_0x507ae0=!![],_0x357706=null;try{_0x514ab6=await a0_0x5f0edb[_0x37a4dc(0x16f)](_0x2f44ff,_0x37a4dc(0xe9));}catch(_0x506b0a){const _0x33af9f=_0x506b0a[_0x37a4dc(0x136)];_0x33af9f==='ENOENT'?(_0x507ae0=![],_0x514ab6=''):(_0x357706=_0x37a4dc(0x154)+(_0x33af9f||_0x37a4dc(0x153))+_0x37a4dc(0x16b)+(_0x506b0a instanceof Error?_0x506b0a[_0x37a4dc(0x102)]:String(_0x506b0a)),console[_0x37a4dc(0x19b)](_0x37a4dc(0x131)+_0x357706));}try{const _0x1b2c2b=MORPH_API_KEY;if(!_0x1b2c2b)throw new Error(_0x37a4dc(0x184));const _0xf84167=a0_0xe825a8[_0x37a4dc(0xdb)](_0x2f44ff),_0x5b41ea=a0_0xe825a8[_0x37a4dc(0x106)](_0x2f44ff),_0x5f0a25=await executeEditFile({'target_filepath':_0x5b41ea,'code_edit':_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0x186)],'instructions':_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0xf2)]},{'morphApiKey':_0x1b2c2b,'morphApiUrl':MORPH_API_URL,'baseDir':_0xf84167,'autoWrite':!_0x2a902d[_0x37a4dc(0xe3)]['dryRun'],'generateUdiff':!![],'debug':![]});if(!_0x5f0a25[_0x37a4dc(0x14c)])throw new Error(_0x5f0a25['error']||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x21632c=_0x5f0a25[_0x37a4dc(0x12a)]||'';let _0x100b35=0x3;while(_0x21632c[_0x37a4dc(0x132)]('`'['repeat'](_0x100b35))){_0x100b35++;}const _0xa59119='`'['repeat'](_0x100b35)+_0x37a4dc(0x185)+_0x21632c+'`'[_0x37a4dc(0xd1)](_0x100b35)+'\x0a\x0a';if(_0x2a902d[_0x37a4dc(0xe3)]['dryRun'])return{'content':[{'type':'text','text':_0x37a4dc(0xcf)+(_0x507ae0?'':'\x20(new\x20file)')+':\x20'+_0x2a902d['data'][_0x37a4dc(0xf2)]+'\x0a\x0a'+_0xa59119+'Use\x20dryRun=false\x20to\x20'+(_0x507ae0?_0x37a4dc(0x158):_0x37a4dc(0x173))+'.'}]};return{'content':[{'type':'text','text':_0x37a4dc(0x17c)+(_0x507ae0?_0x37a4dc(0x175):_0x37a4dc(0x148))+':\x20'+_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0xf2)]+'\x0a\x0a'+_0xa59119+'Successfully\x20'+(_0x507ae0?'applied\x20edits\x20to':'created')+'\x20'+_0x2a902d[_0x37a4dc(0xe3)]['path']}]};}catch(_0x410cce){const _0x5692b8=_0x410cce instanceof Error?_0x410cce[_0x37a4dc(0x102)]:String(_0x410cce);return reportMorphError({'error_message':_0x5692b8,'error_type':_0x410cce instanceof Error?_0x410cce[_0x37a4dc(0x192)][_0x37a4dc(0x110)]:_0x37a4dc(0x179),'context':{'tool':'edit_file','file_path':_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0xdf)],'validated_path':_0x2f44ff,'instruction':_0x2a902d[_0x37a4dc(0xe3)]['instruction'],'model':_0x37a4dc(0xe7),'dry_run':_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0x114)],'file_exists':_0x507ae0,'file_read_error':_0x357706,'file_readable':_0x514ab6!==null,'request_content':{'path':_0x2a902d['data'][_0x37a4dc(0xdf)],'code_edit':_0x2a902d['data'][_0x37a4dc(0x186)],'instruction':_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0xf2)],'original_code':_0x514ab6!==null?_0x514ab6['length']>0xc350?_0x514ab6[_0x37a4dc(0x145)](0x0,0xc350)+_0x37a4dc(0x177)+_0x514ab6['length']+_0x37a4dc(0x120):_0x514ab6:_0x37a4dc(0x129)+(_0x357706||_0x37a4dc(0x135))+']','original_code_length':_0x514ab6?.['length']??0x0,'model':_0x37a4dc(0xe7),'dry_run':_0x2a902d[_0x37a4dc(0xe3)][_0x37a4dc(0x114)]}},'stack_trace':_0x410cce instanceof Error?_0x410cce[_0x37a4dc(0x19d)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x37a4dc(0x11f),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x5692b8}],'isError':!![]};}}case _0x37a4dc(0xc1):{const _0x4b63f9=WarpGrepArgsSchema[_0x37a4dc(0x12b)](_0x50200b);if(!_0x4b63f9[_0x37a4dc(0x14c)])return{'content':[{'type':_0x37a4dc(0x11f),'text':_0x37a4dc(0xac)+_0x4b63f9[_0x37a4dc(0x19b)]}],'isError':!![]};const _0x50c344=_0x1a4d72=>{const _0x23bf75=_0x37a4dc,_0x567102=[];for(const _0x4f4e7a of _0x1a4d72||[]){const _0x1d3769=_0x4f4e7a[_0x23bf75(0x19f)],_0x10576d=_0x4f4e7a[_0x23bf75(0xe4)];if(_0x1d3769===_0x23bf75(0x168)&&_0x10576d){const _0x1a308c=_0x10576d[_0x23bf75(0x12e)]('\x0a')['filter'](_0x2d05ff=>_0x2d05ff['trim']());for(const _0x5d3f72 of _0x1a308c){const _0x55add1=_0x5d3f72[_0x23bf75(0x111)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x55add1){_0x567102[_0x23bf75(0x167)]('grep\x20\x27'+_0x55add1[0x1]+'\x27\x20'+_0x55add1[0x2]);continue;}const _0x13f515=_0x5d3f72['match'](/^read\s+(.+)$/);if(_0x13f515){_0x567102[_0x23bf75(0x167)]('read\x20'+_0x13f515[0x1]);continue;}const _0x15bc0c=_0x5d3f72[_0x23bf75(0x111)](/^list_directory\s+(.+)$/);if(_0x15bc0c){_0x567102[_0x23bf75(0x167)](_0x23bf75(0x10e)+_0x15bc0c[0x1]);continue;}}}}return _0x567102;};try{const _0xf750fa=a0_0xe825a8[_0x37a4dc(0xdd)](_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x17d)]),_0x325e5e=new LocalRipgrepProvider(_0xf750fa),_0x354307=await runWarpGrep({'query':_0x4b63f9['data'][_0x37a4dc(0x161)],'repoRoot':_0xf750fa,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x325e5e});let _0x20079e='';if(_0x354307[_0x37a4dc(0x13f)]===_0x37a4dc(0x11e)&&_0x354307[_0x37a4dc(0xde)]?.[_0x37a4dc(0x188)]?.[_0x37a4dc(0xc2)]){const _0x593c12=_0x354307[_0x37a4dc(0xde)][_0x37a4dc(0x188)]['files'],_0x222bef=[],_0x39feb3=[_0x37a4dc(0x140)];for(const _0x518920 of _0x354307[_0x37a4dc(0x105)]){const _0x19e6a3=_0x518920[_0x37a4dc(0x19f)],_0x32ab12=_0x518920[_0x37a4dc(0xe4)];if(_0x19e6a3==='assistant'&&_0x32ab12){const _0x391672=_0x32ab12['split']('\x0a')[_0x37a4dc(0xd3)](_0xf06c6a=>_0xf06c6a[_0x37a4dc(0x124)]());for(const _0x30bd93 of _0x391672){const _0x28d38=_0x30bd93[_0x37a4dc(0x111)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x28d38){_0x39feb3[_0x37a4dc(0x167)](_0x37a4dc(0x116)+_0x28d38[0x1]+'\x27\x20in\x20`'+_0x28d38[0x2]+'`');continue;}const _0x21ceaf=_0x30bd93[_0x37a4dc(0x111)](/^read\s+(.+)$/);if(_0x21ceaf){_0x39feb3[_0x37a4dc(0x167)](_0x37a4dc(0x172)+_0x21ceaf[0x1]+'`');continue;}const _0x108001=_0x30bd93[_0x37a4dc(0x111)](/^list_directory\s+(.+)$/);if(_0x108001){_0x39feb3[_0x37a4dc(0x167)](_0x37a4dc(0x183)+_0x108001[0x1]+'`');continue;}}}}_0x222bef[_0x37a4dc(0x167)](_0x39feb3[_0x37a4dc(0xcb)]('\x0a'));const _0x3e4aaf=['',_0x37a4dc(0x147)];for(const _0x134d43 of _0x593c12){if(_0x134d43[_0x37a4dc(0x100)]==='*')_0x3e4aaf[_0x37a4dc(0x167)]('-\x20'+_0x134d43['path']+':*');else{if(Array['isArray'](_0x134d43['lines'])){const _0x592373=_0x134d43[_0x37a4dc(0x100)]['map'](([_0x4b8bc7,_0x111094])=>{if(_0x4b8bc7===_0x111094)return''+_0x4b8bc7;return _0x4b8bc7+'-'+_0x111094;});_0x3e4aaf[_0x37a4dc(0x167)]('-\x20'+_0x134d43[_0x37a4dc(0xdf)]+':'+_0x592373[_0x37a4dc(0xcb)](','));}else _0x3e4aaf[_0x37a4dc(0x167)]('-\x20'+_0x134d43[_0x37a4dc(0xdf)]+':*');}}_0x3e4aaf[_0x37a4dc(0x167)](''),_0x222bef['push'](_0x3e4aaf['join']('\x0a')),_0x222bef[_0x37a4dc(0x167)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x18bcd7=[];for(const _0x1d0122 of _0x593c12){let _0x34d1db=a0_0xe825a8[_0x37a4dc(0xdd)](_0x4b63f9['data'][_0x37a4dc(0x17d)],_0x1d0122[_0x37a4dc(0xdf)]),_0x3a7b84=null,_0x262c00=null;try{_0x3a7b84=await a0_0x5f0edb[_0x37a4dc(0x16f)](_0x34d1db,{'encoding':'utf-8'});}catch(_0x56fea1){const _0x195a93=fixPathRepetition(_0x34d1db);if(_0x195a93)try{_0x3a7b84=await a0_0x5f0edb['readFile'](_0x195a93,{'encoding':'utf-8'}),_0x34d1db=_0x195a93;}catch{_0x262c00=_0x56fea1 instanceof Error?_0x56fea1:new Error(String(_0x56fea1));}else _0x262c00=_0x56fea1 instanceof Error?_0x56fea1:new Error(String(_0x56fea1));}if(_0x3a7b84!==null){const _0x14d5ba=_0x3a7b84[_0x37a4dc(0x12e)](/\r?\n/),_0x1da1a7=[_0x37a4dc(0x14f)+_0x1d0122[_0x37a4dc(0xdf)]+'\x22>'];if(_0x1d0122[_0x37a4dc(0x100)]==='*'||!Array[_0x37a4dc(0x11c)](_0x1d0122[_0x37a4dc(0x100)]))for(let _0x417541=0x1;_0x417541<=_0x14d5ba['length'];_0x417541++){const _0x212e12=_0x14d5ba[_0x417541-0x1];_0x1da1a7[_0x37a4dc(0x167)](_0x417541+'|\x20'+_0x212e12);}else for(const [_0x26cd38,_0x9451e1]of _0x1d0122[_0x37a4dc(0x100)]){_0x1da1a7['length']>0x1&&_0x1da1a7[_0x37a4dc(0x167)]('');for(let _0x2944a1=_0x26cd38;_0x2944a1<=_0x9451e1&&_0x2944a1<=_0x14d5ba[_0x37a4dc(0x10f)];_0x2944a1++){const _0x3fe8f9=_0x14d5ba[_0x2944a1-0x1];_0x1da1a7[_0x37a4dc(0x167)](_0x2944a1+'|\x20'+_0x3fe8f9);}}_0x1da1a7[_0x37a4dc(0x167)](_0x37a4dc(0x18f)),_0x18bcd7[_0x37a4dc(0x167)](_0x1da1a7['join']('\x0a'));}else _0x18bcd7['push']('<file\x20path=\x22'+_0x1d0122[_0x37a4dc(0xdf)]+_0x37a4dc(0x112)+(_0x262c00?.[_0x37a4dc(0x102)]||'Unknown\x20error')+_0x37a4dc(0xd0));}_0x222bef[_0x37a4dc(0x167)](_0x18bcd7['join']('\x0a\x0a')),_0x20079e=_0x222bef[_0x37a4dc(0xcb)]('\x0a');const _0x53b8a3=_0x354307['errors']?.[_0x37a4dc(0xd3)](_0x500b3a=>_0x500b3a[_0x37a4dc(0x102)]?.[_0x37a4dc(0x166)]('File\x20read\x20error:'))||[];if(_0x53b8a3[_0x37a4dc(0x10f)]>0x0){const _0x38556a=_0x53b8a3[_0x37a4dc(0x15b)](_0x199bef=>_0x199bef[_0x37a4dc(0x102)])[_0x37a4dc(0xcb)](';\x20');reportMorphError({'error_message':_0x38556a,'error_type':_0x37a4dc(0x16d),'context':{'tool':_0x37a4dc(0xc1),'repo_path':_0x4b63f9[_0x37a4dc(0xe3)]['repo_path'],'query':_0x4b63f9[_0x37a4dc(0xe3)]['search_string'],'model':'morph-warp-grep-v1-1111v0','termination_reason':'completed_with_file_errors','error_count':_0x53b8a3[_0x37a4dc(0x10f)],'is_timeout':![],'timings':_0x354307[_0x37a4dc(0x11a)],'files_attempted':_0x593c12[_0x37a4dc(0x15b)](_0x317d99=>({'path':_0x317d99[_0x37a4dc(0xdf)],'lines':_0x317d99['lines']})),'tool_calls':_0x50c344(_0x354307[_0x37a4dc(0x105)]),'messages':_0x354307[_0x37a4dc(0x105)]?.[_0x37a4dc(0x15b)](_0x401015=>({'role':_0x401015[_0x37a4dc(0x19f)],'content':_0x401015[_0x37a4dc(0xe4)]})),'request_content':{'query':_0x4b63f9['data'][_0x37a4dc(0x161)],'repo_path':_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x17d)],'repoRoot':a0_0xe825a8[_0x37a4dc(0xdd)](_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x17d)]),'model':'morph-warp-grep-v1-1111v0'}},'source':'mcp-filesystem'})[_0x37a4dc(0x11b)](()=>{});}}else{if(_0x354307['terminationReason']===_0x37a4dc(0x187)&&_0x354307['errors'][_0x37a4dc(0x10f)]>0x0){const _0x232e84=_0x354307['errors'][_0x37a4dc(0x15b)](_0x732654=>_0x732654[_0x37a4dc(0x102)])[_0x37a4dc(0xcb)](';\x20');_0x20079e='Error:\x20'+_0x232e84;const _0x275a53=_0x232e84[_0x37a4dc(0x198)]()[_0x37a4dc(0x132)]('timeout')||_0x232e84[_0x37a4dc(0x198)]()['includes']('timed\x20out')||_0x232e84[_0x37a4dc(0x198)]()[_0x37a4dc(0x132)](_0x37a4dc(0x164)),_0x24e2a4=_0x354307[_0x37a4dc(0xde)]?.[_0x37a4dc(0x188)]?.[_0x37a4dc(0xc2)],_0x598f69=_0x354307[_0x37a4dc(0xc5)][0x0];reportMorphError({'error_message':_0x232e84,'error_type':_0x275a53?_0x37a4dc(0xf4):_0x598f69?.['constructor']?.[_0x37a4dc(0x110)]||_0x37a4dc(0x143),'context':{'tool':_0x37a4dc(0xc1),'repo_path':_0x4b63f9['data']['repo_path'],'query':_0x4b63f9[_0x37a4dc(0xe3)]['search_string'],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x354307[_0x37a4dc(0x13f)],'error_count':_0x354307[_0x37a4dc(0xc5)][_0x37a4dc(0x10f)],'is_timeout':_0x275a53,'timings':_0x354307[_0x37a4dc(0x11a)],'files_attempted':_0x24e2a4?.[_0x37a4dc(0x15b)](_0x59c526=>({'path':_0x59c526[_0x37a4dc(0xdf)],'lines':_0x59c526[_0x37a4dc(0x100)]})),'tool_calls':_0x50c344(_0x354307[_0x37a4dc(0x105)]),'messages':_0x354307[_0x37a4dc(0x105)]?.[_0x37a4dc(0x15b)](_0x3eec05=>({'role':_0x3eec05['role'],'content':_0x3eec05[_0x37a4dc(0xe4)]})),'request_content':{'query':_0x4b63f9[_0x37a4dc(0xe3)]['search_string'],'repo_path':_0x4b63f9['data'][_0x37a4dc(0x17d)],'repoRoot':a0_0xe825a8['resolve'](_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x17d)]),'model':_0x37a4dc(0x14b)}},'stack_trace':_0x598f69?.['stack']||undefined,'source':_0x37a4dc(0x197)})['catch'](()=>{});}else _0x20079e='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x20079e}]};}catch(_0x7d1860){const _0x45cfca=_0x7d1860 instanceof Error?_0x7d1860[_0x37a4dc(0x102)]:String(_0x7d1860),_0x4c6ca3=_0x45cfca[_0x37a4dc(0x198)]()[_0x37a4dc(0x132)](_0x37a4dc(0x155))||_0x45cfca[_0x37a4dc(0x198)]()[_0x37a4dc(0x132)](_0x37a4dc(0xef))||_0x45cfca[_0x37a4dc(0x198)]()[_0x37a4dc(0x132)]('etimedout')||_0x7d1860 instanceof Error&&_0x7d1860[_0x37a4dc(0x110)]===_0x37a4dc(0xf4);return reportMorphError({'error_message':_0x45cfca,'error_type':_0x4c6ca3?_0x37a4dc(0xf4):_0x7d1860 instanceof Error?_0x7d1860['constructor'][_0x37a4dc(0x110)]:'UnknownError','context':{'tool':_0x37a4dc(0xc1),'repo_path':_0x4b63f9[_0x37a4dc(0xe3)]['repo_path'],'query':_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x161)],'model':_0x37a4dc(0x14b),'is_timeout':_0x4c6ca3,'exception_phase':_0x37a4dc(0x174),'request_content':{'query':_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x161)],'repo_path':_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x17d)],'repoRoot':a0_0xe825a8[_0x37a4dc(0xdd)](_0x4b63f9[_0x37a4dc(0xe3)][_0x37a4dc(0x17d)]),'model':_0x37a4dc(0x14b)}},'stack_trace':_0x7d1860 instanceof Error?_0x7d1860[_0x37a4dc(0x19d)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x37a4dc(0x11f),'text':_0x37a4dc(0x17e)+_0x45cfca}],'isError':![]};}}case _0x37a4dc(0xea):{const _0x57461f=CodebaseSearchArgsSchema[_0x37a4dc(0x12b)](_0x50200b);if(!_0x57461f[_0x37a4dc(0x14c)])return{'content':[{'type':_0x37a4dc(0x11f),'text':'Invalid\x20arguments:\x20'+_0x57461f[_0x37a4dc(0x19b)]}],'isError':!![]};try{const _0x527b32=MORPH_API_KEY;if(!_0x527b32)throw new Error(_0x37a4dc(0x16e));const _0x59dec8=await executeCodebaseSearch({'query':_0x57461f['data'][_0x37a4dc(0xb7)],'target_directories':_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0xd6)],'limit':_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0xc6)]},{'apiKey':_0x527b32,'repoId':_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0x137)],'branch':_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0x14a)],'commitHash':_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0xfd)],'debug':![]});if(!_0x59dec8[_0x37a4dc(0x14c)])return{'content':[{'type':_0x37a4dc(0x11f),'text':_0x37a4dc(0x19e)+_0x59dec8[_0x37a4dc(0x19b)]}],'isError':!![]};const _0x1351cd=_0x59dec8[_0x37a4dc(0x196)]['length']===0x0?_0x37a4dc(0x18a)+_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0xb7)]+'\x22':_0x37a4dc(0xfc)+_0x59dec8[_0x37a4dc(0x196)][_0x37a4dc(0x10f)]+_0x37a4dc(0x127)+_0x59dec8[_0x37a4dc(0xe5)][_0x37a4dc(0x190)]+_0x37a4dc(0x109)+_0x59dec8[_0x37a4dc(0x196)]['map']((_0x5f048b,_0x4e7804)=>_0x4e7804+0x1+'.\x20'+_0x5f048b[_0x37a4dc(0xd5)]+'\x20('+(_0x5f048b[_0x37a4dc(0x122)]*0x64)[_0x37a4dc(0x18c)](0x1)+'%\x20match)\x0a'+(_0x37a4dc(0x15f)+_0x5f048b[_0x37a4dc(0x16a)]+'-'+_0x5f048b[_0x37a4dc(0x19a)]+'\x0a')+(_0x37a4dc(0x123)+_0x5f048b['content'][_0x37a4dc(0x145)](0x0,0xc8)+(_0x5f048b[_0x37a4dc(0xe4)]['length']>0xc8?_0x37a4dc(0x118):'')+'\x0a'))[_0x37a4dc(0xcb)]('\x0a');return{'content':[{'type':_0x37a4dc(0x11f),'text':_0x1351cd}]};}catch(_0x5db4cd){const _0x4c3907=_0x5db4cd instanceof Error?_0x5db4cd[_0x37a4dc(0x102)]:String(_0x5db4cd);return reportMorphError({'error_message':_0x4c3907,'error_type':_0x5db4cd instanceof Error?_0x5db4cd[_0x37a4dc(0x192)][_0x37a4dc(0x110)]:_0x37a4dc(0x179),'context':{'tool':'codebase_search','query':_0x57461f['data'][_0x37a4dc(0xb7)],'repo_id':_0x57461f[_0x37a4dc(0xe3)][_0x37a4dc(0x137)]},'stack_trace':_0x5db4cd instanceof Error?_0x5db4cd[_0x37a4dc(0x19d)]:undefined,'source':_0x37a4dc(0x197)})['catch'](()=>{}),{'content':[{'type':_0x37a4dc(0x11f),'text':_0x37a4dc(0x139)+_0x4c3907}],'isError':!![]};}}default:throw new Error(_0x37a4dc(0xae)+_0x8beef9);}}catch(_0x4af372){const _0x2e371a=_0x4af372 instanceof Error?_0x4af372[_0x37a4dc(0x102)]:String(_0x4af372);return reportMorphError({'error_message':_0x2e371a,'error_type':_0x4af372 instanceof Error?_0x4af372['constructor']['name']:_0x37a4dc(0x179),'context':{'tool':name,'arguments':args?JSON[_0x37a4dc(0x117)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x37a4dc(0x10b)},'stack_trace':_0x4af372 instanceof Error?_0x4af372[_0x37a4dc(0x19d)]:undefined,'source':_0x37a4dc(0x197)})['catch'](()=>{}),{'content':[{'type':'text','text':'Error:\x20'+_0x2e371a}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x29acfc){const _0x1152a1=a0_0x518e0b,_0x3003a1=await getValidRootDirectories(_0x29acfc);if(_0x3003a1[_0x1152a1(0x10f)]>0x0)allowedDirectories=[..._0x3003a1],console[_0x1152a1(0x19b)](_0x1152a1(0xbc)+_0x3003a1['length']+_0x1152a1(0x180));else{console['error']('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x1a3d13=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1a3d13&&(allowedDirectories=[_0x1a3d13],console['error'](_0x1152a1(0xab)+_0x1a3d13));}catch(_0x342834){console['error'](_0x1152a1(0xb9)+_0x342834);}}}server[a0_0x518e0b(0x125)](RootsListChangedNotificationSchema,async()=>{const _0x3c039a=a0_0x518e0b;try{const _0x12445a=await server[_0x3c039a(0xeb)]();_0x12445a&&_0x3c039a(0xc7)in _0x12445a&&await updateAllowedDirectoriesFromRoots(_0x12445a[_0x3c039a(0xc7)]);}catch(_0x8784da){console[_0x3c039a(0x19b)](_0x3c039a(0x157),_0x8784da instanceof Error?_0x8784da[_0x3c039a(0x102)]:String(_0x8784da));}}),server[a0_0x518e0b(0x146)]=async()=>{const _0x3387ed=a0_0x518e0b,_0x24b6cf=server[_0x3387ed(0x17f)]();if(_0x24b6cf?.[_0x3387ed(0xc7)])try{const _0x44ef74=await server['listRoots']();_0x44ef74&&_0x3387ed(0xc7)in _0x44ef74?await updateAllowedDirectoriesFromRoots(_0x44ef74[_0x3387ed(0xc7)]):console[_0x3387ed(0x19b)]('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x45e52a){console[_0x3387ed(0x19b)]('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x45e52a instanceof Error?_0x45e52a[_0x3387ed(0x102)]:String(_0x45e52a));}else{if(allowedDirectories[_0x3387ed(0x10f)]>0x0)console[_0x3387ed(0x19b)](_0x3387ed(0x15d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x3387ed(0x19b)](_0x3387ed(0x107));else throw new Error(_0x3387ed(0x19c));}}};function a0_0x5b97(_0x54916f,_0x55646d){_0x54916f=_0x54916f-0xaa;const _0x41bbcf=a0_0x41bb();let _0x5b975a=_0x41bbcf[_0x54916f];return _0x5b975a;}async function runServer(){const _0x1dc483=a0_0x518e0b,_0x540461=new StdioServerTransport();await server[_0x1dc483(0xec)](_0x540461),console[_0x1dc483(0x19b)](_0x1dc483(0x13c)),allowedDirectories[_0x1dc483(0x10f)]===0x0&&console[_0x1dc483(0x19b)](_0x1dc483(0x14d));}runServer()[a0_0x518e0b(0x11b)](_0x547a22=>{const _0x485049=a0_0x518e0b;console[_0x485049(0x19b)](_0x485049(0xaa),_0x547a22),process['exit'](0x1);});
@@ -1 +1 @@
1
- (function(_0x23c304,_0x44b059){const _0x5126ea=a1_0x16e8,_0x2d140b=_0x23c304();while(!![]){try{const _0x9c3416=-parseInt(_0x5126ea(0x1ba))/0x1+parseInt(_0x5126ea(0x1ae))/0x2+parseInt(_0x5126ea(0x1b8))/0x3*(-parseInt(_0x5126ea(0x1a3))/0x4)+-parseInt(_0x5126ea(0x1a8))/0x5*(parseInt(_0x5126ea(0x1a6))/0x6)+parseInt(_0x5126ea(0x1b3))/0x7*(-parseInt(_0x5126ea(0x1ab))/0x8)+-parseInt(_0x5126ea(0x1a5))/0x9+-parseInt(_0x5126ea(0x1b5))/0xa*(-parseInt(_0x5126ea(0x1ad))/0xb);if(_0x9c3416===_0x44b059)break;else _0x2d140b['push'](_0x2d140b['shift']());}catch(_0x3683e9){_0x2d140b['push'](_0x2d140b['shift']());}}}(a1_0x36bf,0xdedfd));import a1_0x182850 from'path';import a1_0x50a584 from'os';export function convertToWindowsPath(_0x2917f6){const _0x357cf5=a1_0x16e8;if(_0x2917f6[_0x357cf5(0x1b9)](_0x357cf5(0x1a4))){const _0x4493c0=_0x2917f6[_0x357cf5(0x1ac)](0x5)[_0x357cf5(0x1b7)](),_0x434dbe=_0x2917f6['slice'](0x6)[_0x357cf5(0x1b1)](/\//g,'\x5c');return _0x4493c0+':'+_0x434dbe;}if(_0x2917f6[_0x357cf5(0x1b0)](/^\/[a-zA-Z]\//)){const _0x7f50aa=_0x2917f6['charAt'](0x1)[_0x357cf5(0x1b7)](),_0x57ff61=_0x2917f6['slice'](0x2)[_0x357cf5(0x1b1)](/\//g,'\x5c');return _0x7f50aa+':'+_0x57ff61;}if(_0x2917f6[_0x357cf5(0x1b0)](/^[a-zA-Z]:/))return _0x2917f6[_0x357cf5(0x1b1)](/\//g,'\x5c');return _0x2917f6;}function a1_0x16e8(_0x21dcc3,_0x197cc1){_0x21dcc3=_0x21dcc3-0x1a3;const _0x36bf5c=a1_0x36bf();let _0x16e808=_0x36bf5c[_0x21dcc3];return _0x16e808;}export function normalizePath(_0x2a17eb){const _0x57a8d0=a1_0x16e8;_0x2a17eb=_0x2a17eb[_0x57a8d0(0x1af)]()[_0x57a8d0(0x1b1)](/^["']|["']$/g,'');const _0x58df11=_0x2a17eb[_0x57a8d0(0x1b9)]('/')&&!_0x2a17eb[_0x57a8d0(0x1b0)](/^\/mnt\/[a-z]\//i)&&!_0x2a17eb[_0x57a8d0(0x1b0)](/^\/[a-zA-Z]\//);if(_0x58df11)return _0x2a17eb[_0x57a8d0(0x1b1)](/\/+/g,'/')[_0x57a8d0(0x1b1)](/\/+$/,'');_0x2a17eb=convertToWindowsPath(_0x2a17eb);if(_0x2a17eb[_0x57a8d0(0x1b9)]('\x5c\x5c')){let _0x1c49ac=_0x2a17eb;_0x1c49ac=_0x1c49ac[_0x57a8d0(0x1b1)](/^\\{2,}/,'\x5c\x5c');const _0xfa7bc2=_0x1c49ac[_0x57a8d0(0x1b6)](0x2)['replace'](/\\\\/g,'\x5c');_0x2a17eb='\x5c\x5c'+_0xfa7bc2;}else _0x2a17eb=_0x2a17eb[_0x57a8d0(0x1b1)](/\\\\/g,'\x5c');let _0x1249d9=a1_0x182850[_0x57a8d0(0x1a9)](_0x2a17eb);_0x2a17eb['startsWith']('\x5c\x5c')&&!_0x1249d9[_0x57a8d0(0x1b9)]('\x5c\x5c')&&(_0x1249d9='\x5c'+_0x1249d9);if(_0x1249d9[_0x57a8d0(0x1b0)](/^[a-zA-Z]:/)){let _0x99bbe3=_0x1249d9[_0x57a8d0(0x1b1)](/\//g,'\x5c');return/^[a-z]:/[_0x57a8d0(0x1aa)](_0x99bbe3)&&(_0x99bbe3=_0x99bbe3[_0x57a8d0(0x1ac)](0x0)[_0x57a8d0(0x1b7)]()+_0x99bbe3[_0x57a8d0(0x1a7)](0x1)),_0x99bbe3;}return _0x1249d9[_0x57a8d0(0x1b1)](/\//g,'\x5c');}export function expandHome(_0x4da5c5){const _0x11a321=a1_0x16e8;if(_0x4da5c5[_0x11a321(0x1b9)]('~/')||_0x4da5c5==='~')return a1_0x182850[_0x11a321(0x1b2)](a1_0x50a584[_0x11a321(0x1b4)](),_0x4da5c5[_0x11a321(0x1a7)](0x1));return _0x4da5c5;}function a1_0x36bf(){const _0x474ef1=['toUpperCase','9627UCQsnF','startsWith','617503kUVxDW','1696tkvAby','/mnt/','6687144ausTKC','20250LCcWbi','slice','1325gMkcvF','normalize','test','53152YrOJOn','charAt','2222uthhEy','2441126ZrpnHe','trim','match','replace','join','350kemyYp','homedir','180200gyssxp','substring'];a1_0x36bf=function(){return _0x474ef1;};return a1_0x36bf();}
1
+ (function(_0x5eee26,_0x195935){const _0x390c2a=a1_0x4fd0,_0x4f74ec=_0x5eee26();while(!![]){try{const _0x112cb6=parseInt(_0x390c2a(0x147))/0x1*(-parseInt(_0x390c2a(0x14b))/0x2)+-parseInt(_0x390c2a(0x14d))/0x3*(-parseInt(_0x390c2a(0x144))/0x4)+parseInt(_0x390c2a(0x149))/0x5+-parseInt(_0x390c2a(0x15a))/0x6*(-parseInt(_0x390c2a(0x151))/0x7)+-parseInt(_0x390c2a(0x154))/0x8+-parseInt(_0x390c2a(0x14a))/0x9+-parseInt(_0x390c2a(0x14e))/0xa*(-parseInt(_0x390c2a(0x148))/0xb);if(_0x112cb6===_0x195935)break;else _0x4f74ec['push'](_0x4f74ec['shift']());}catch(_0x554744){_0x4f74ec['push'](_0x4f74ec['shift']());}}}(a1_0x36da,0xe93aa));import a1_0xdda903 from'path';function a1_0x4fd0(_0x565ce3,_0x23a0dc){_0x565ce3=_0x565ce3-0x143;const _0x36da25=a1_0x36da();let _0x4fd0d4=_0x36da25[_0x565ce3];return _0x4fd0d4;}import a1_0x57e158 from'os';export function convertToWindowsPath(_0x5d702e){const _0x424568=a1_0x4fd0;if(_0x5d702e[_0x424568(0x155)](_0x424568(0x143))){const _0x36f261=_0x5d702e[_0x424568(0x150)](0x5)[_0x424568(0x153)](),_0xaedd9c=_0x5d702e[_0x424568(0x14f)](0x6)['replace'](/\//g,'\x5c');return _0x36f261+':'+_0xaedd9c;}if(_0x5d702e['match'](/^\/[a-zA-Z]\//)){const _0x59101e=_0x5d702e[_0x424568(0x150)](0x1)[_0x424568(0x153)](),_0x5d7b17=_0x5d702e['slice'](0x2)[_0x424568(0x157)](/\//g,'\x5c');return _0x59101e+':'+_0x5d7b17;}if(_0x5d702e[_0x424568(0x152)](/^[a-zA-Z]:/))return _0x5d702e[_0x424568(0x157)](/\//g,'\x5c');return _0x5d702e;}export function normalizePath(_0x4a7314){const _0x7e55d4=a1_0x4fd0;_0x4a7314=_0x4a7314[_0x7e55d4(0x159)]()[_0x7e55d4(0x157)](/^["']|["']$/g,'');const _0x4bef85=_0x4a7314[_0x7e55d4(0x155)]('/')&&!_0x4a7314[_0x7e55d4(0x152)](/^\/mnt\/[a-z]\//i)&&!_0x4a7314[_0x7e55d4(0x152)](/^\/[a-zA-Z]\//);if(_0x4bef85)return _0x4a7314[_0x7e55d4(0x157)](/\/+/g,'/')['replace'](/\/+$/,'');_0x4a7314=convertToWindowsPath(_0x4a7314);if(_0x4a7314[_0x7e55d4(0x155)]('\x5c\x5c')){let _0x494484=_0x4a7314;_0x494484=_0x494484[_0x7e55d4(0x157)](/^\\{2,}/,'\x5c\x5c');const _0x458355=_0x494484[_0x7e55d4(0x156)](0x2)[_0x7e55d4(0x157)](/\\\\/g,'\x5c');_0x4a7314='\x5c\x5c'+_0x458355;}else _0x4a7314=_0x4a7314['replace'](/\\\\/g,'\x5c');let _0x31dee1=a1_0xdda903[_0x7e55d4(0x145)](_0x4a7314);_0x4a7314[_0x7e55d4(0x155)]('\x5c\x5c')&&!_0x31dee1[_0x7e55d4(0x155)]('\x5c\x5c')&&(_0x31dee1='\x5c'+_0x31dee1);if(_0x31dee1['match'](/^[a-zA-Z]:/)){let _0x47a008=_0x31dee1['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x7e55d4(0x158)](_0x47a008)&&(_0x47a008=_0x47a008[_0x7e55d4(0x150)](0x0)[_0x7e55d4(0x153)]()+_0x47a008[_0x7e55d4(0x14f)](0x1)),_0x47a008;}return _0x31dee1['replace'](/\//g,'\x5c');}function a1_0x36da(){const _0x4d10aa=['1624621pseMkJ','288310hdmdPa','8620045JLDqEi','5807547nXbyHz','2eBQaoL','homedir','15oIRQAF','440Btxroj','slice','charAt','791ADKREn','match','toUpperCase','11892912SmcXPk','startsWith','substring','replace','test','trim','61140iSPCQP','/mnt/','546484uqIFnD','normalize','join'];a1_0x36da=function(){return _0x4d10aa;};return a1_0x36da();}export function expandHome(_0x5582b9){const _0x1f1528=a1_0x4fd0;if(_0x5582b9[_0x1f1528(0x155)]('~/')||_0x5582b9==='~')return a1_0xdda903[_0x1f1528(0x146)](a1_0x57e158[_0x1f1528(0x14c)](),_0x5582b9[_0x1f1528(0x14f)](0x1));return _0x5582b9;}
@@ -1 +1 @@
1
- function a2_0x2c81(_0x3f11d6,_0x3add02){_0x3f11d6=_0x3f11d6-0xef;const _0x5d8814=a2_0x5d88();let _0x2c8160=_0x5d8814[_0x3f11d6];return _0x2c8160;}(function(_0x4168ca,_0x37db51){const _0x43dff3=a2_0x2c81,_0xdd3c05=_0x4168ca();while(!![]){try{const _0x42975e=parseInt(_0x43dff3(0xff))/0x1+-parseInt(_0x43dff3(0xf6))/0x2+-parseInt(_0x43dff3(0x100))/0x3*(parseInt(_0x43dff3(0xf5))/0x4)+-parseInt(_0x43dff3(0xfd))/0x5+parseInt(_0x43dff3(0xf1))/0x6+parseInt(_0x43dff3(0xf8))/0x7+parseInt(_0x43dff3(0xf7))/0x8;if(_0x42975e===_0x37db51)break;else _0xdd3c05['push'](_0xdd3c05['shift']());}catch(_0xa253f){_0xdd3c05['push'](_0xdd3c05['shift']());}}}(a2_0x5d88,0x5a8e1));function a2_0x5d88(){const _0x26ea07=['isArray','Path\x20must\x20be\x20absolute\x20after\x20normalization','113688KUZDFA','normalize','includes','some','7636tSzIVB','1461262AbtJkS','9928640brNpuM','411362XWmQbV','resolve','sep','isAbsolute','length','1304870wMPqkO','string','276622FTXSGE','366CsRYRz','startsWith'];a2_0x5d88=function(){return _0x26ea07;};return a2_0x5d88();}import a2_0x41e8ef from'path';export function isPathWithinAllowedDirectories(_0x252ecd,_0xaae41c){const _0x423a51=a2_0x2c81;if(typeof _0x252ecd!=='string'||!Array[_0x423a51(0xef)](_0xaae41c))return![];if(!_0x252ecd||_0xaae41c[_0x423a51(0xfc)]===0x0)return![];if(_0x252ecd[_0x423a51(0xf3)]('\x00'))return![];let _0x27df44;try{_0x27df44=a2_0x41e8ef[_0x423a51(0xf9)](a2_0x41e8ef[_0x423a51(0xf2)](_0x252ecd));}catch{return![];}if(!a2_0x41e8ef[_0x423a51(0xfb)](_0x27df44))throw new Error(_0x423a51(0xf0));return _0xaae41c[_0x423a51(0xf4)](_0x495ddb=>{const _0x2afd5e=_0x423a51;if(typeof _0x495ddb!==_0x2afd5e(0xfe)||!_0x495ddb)return![];if(_0x495ddb['includes']('\x00'))return![];let _0x42b6e3;try{_0x42b6e3=a2_0x41e8ef[_0x2afd5e(0xf9)](a2_0x41e8ef['normalize'](_0x495ddb));}catch{return![];}if(!a2_0x41e8ef[_0x2afd5e(0xfb)](_0x42b6e3))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x27df44===_0x42b6e3)return!![];if(_0x42b6e3===a2_0x41e8ef[_0x2afd5e(0xfa)])return _0x27df44[_0x2afd5e(0x101)](a2_0x41e8ef['sep']);return _0x27df44[_0x2afd5e(0x101)](_0x42b6e3+a2_0x41e8ef['sep']);});}
1
+ (function(_0x1d1129,_0xbf0d80){const _0x197c79=a2_0x1ef1,_0x36b254=_0x1d1129();while(!![]){try{const _0x184c58=-parseInt(_0x197c79(0xd5))/0x1+parseInt(_0x197c79(0xde))/0x2+parseInt(_0x197c79(0xd8))/0x3*(-parseInt(_0x197c79(0xd2))/0x4)+parseInt(_0x197c79(0xd0))/0x5*(parseInt(_0x197c79(0xd3))/0x6)+-parseInt(_0x197c79(0xdb))/0x7*(parseInt(_0x197c79(0xdd))/0x8)+parseInt(_0x197c79(0xd9))/0x9*(parseInt(_0x197c79(0xcf))/0xa)+-parseInt(_0x197c79(0xcc))/0xb*(-parseInt(_0x197c79(0xd4))/0xc);if(_0x184c58===_0xbf0d80)break;else _0x36b254['push'](_0x36b254['shift']());}catch(_0x5befb6){_0x36b254['push'](_0x36b254['shift']());}}}(a2_0x1eec,0x55056));function a2_0x1ef1(_0x1b71ae,_0xd3dc49){_0x1b71ae=_0x1b71ae-0xcc;const _0x1eec55=a2_0x1eec();let _0x1ef1e1=_0x1eec55[_0x1b71ae];return _0x1ef1e1;}import a2_0x5a6213 from'path';export function isPathWithinAllowedDirectories(_0x13972f,_0x1250e4){const _0x205349=a2_0x1ef1;if(typeof _0x13972f!==_0x205349(0xd7)||!Array[_0x205349(0xdc)](_0x1250e4))return![];if(!_0x13972f||_0x1250e4['length']===0x0)return![];if(_0x13972f[_0x205349(0xcd)]('\x00'))return![];let _0x1fb190;try{_0x1fb190=a2_0x5a6213[_0x205349(0xce)](a2_0x5a6213['normalize'](_0x13972f));}catch{return![];}if(!a2_0x5a6213[_0x205349(0xd1)](_0x1fb190))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x1250e4[_0x205349(0xdf)](_0x36b343=>{const _0x1458e2=_0x205349;if(typeof _0x36b343!=='string'||!_0x36b343)return![];if(_0x36b343[_0x1458e2(0xcd)]('\x00'))return![];let _0x115dd8;try{_0x115dd8=a2_0x5a6213[_0x1458e2(0xce)](a2_0x5a6213[_0x1458e2(0xd6)](_0x36b343));}catch{return![];}if(!a2_0x5a6213[_0x1458e2(0xd1)](_0x115dd8))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x1fb190===_0x115dd8)return!![];if(_0x115dd8===a2_0x5a6213[_0x1458e2(0xe0)])return _0x1fb190[_0x1458e2(0xda)](a2_0x5a6213['sep']);return _0x1fb190['startsWith'](_0x115dd8+a2_0x5a6213[_0x1458e2(0xe0)]);});}function a2_0x1eec(){const _0x4b0c7a=['11xRUPrg','includes','resolve','1130cAMQHR','28445RNcuHy','isAbsolute','62820WxkXnY','366JmGJtx','9692352ZdTIGk','634509lXjDIg','normalize','string','129nmPvSR','46323dYwJrT','startsWith','7pDJQna','isArray','1338504aCcdtj','178094pgDyhx','some','sep'];a2_0x1eec=function(){return _0x4b0c7a;};return a2_0x1eec();}
@@ -1 +1 @@
1
- (function(_0x331977,_0x3dcdcc){const _0x598782=a3_0x4f8d,_0x366d15=_0x331977();while(!![]){try{const _0x2110a8=-parseInt(_0x598782(0xa7))/0x1*(parseInt(_0x598782(0xa0))/0x2)+parseInt(_0x598782(0xb2))/0x3*(-parseInt(_0x598782(0xac))/0x4)+parseInt(_0x598782(0xb3))/0x5+parseInt(_0x598782(0xb9))/0x6*(-parseInt(_0x598782(0xaf))/0x7)+parseInt(_0x598782(0xa9))/0x8+-parseInt(_0x598782(0xb1))/0x9*(parseInt(_0x598782(0xa4))/0xa)+-parseInt(_0x598782(0xae))/0xb*(-parseInt(_0x598782(0xab))/0xc);if(_0x2110a8===_0x3dcdcc)break;else _0x366d15['push'](_0x366d15['shift']());}catch(_0x36563f){_0x366d15['push'](_0x366d15['shift']());}}}(a3_0x46d4,0x74218));function a3_0x4f8d(_0x1d50ea,_0x1cf9df){_0x1d50ea=_0x1d50ea-0x9e;const _0x46d467=a3_0x46d4();let _0x4f8d74=_0x46d467[_0x1d50ea];return _0x4f8d74;}import{promises as a3_0x5d6d17}from'fs';import a3_0x48e33a from'path';function a3_0x46d4(){const _0x1bc885=['2237045CYhSPr','join','\x20due\x20to\x20error:\x20','Skipping\x20invalid\x20directory:\x20','startsWith','Skipping\x20','6GZmqtM','invalid\x20path\x20or\x20inaccessible','file://','resolve','4MIMIFX','push','uri','message','9299060VFpyNG','slice','error','463687OhxCiX','realpath','4160904eCxmTd','isDirectory','12mYwYwf','31268wVXPLk','stat','29465062QcnAAH','4650807KLyocX','homedir','9MwrxEs','249gKSnZe'];a3_0x46d4=function(){return _0x1bc885;};return a3_0x46d4();}import a3_0x15d2a0 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x25e93d){const _0xc8d26d=a3_0x4f8d;try{const _0x1f0f64=_0x25e93d[_0xc8d26d(0xb7)](_0xc8d26d(0x9e))?_0x25e93d[_0xc8d26d(0xa5)](0x7):_0x25e93d,_0x1e0204=_0x1f0f64['startsWith']('~/')||_0x1f0f64==='~'?a3_0x48e33a[_0xc8d26d(0xb4)](a3_0x15d2a0[_0xc8d26d(0xb0)](),_0x1f0f64[_0xc8d26d(0xa5)](0x1)):_0x1f0f64,_0x50181d=a3_0x48e33a[_0xc8d26d(0x9f)](_0x1e0204),_0xb9623a=await a3_0x5d6d17[_0xc8d26d(0xa8)](_0x50181d);return normalizePath(_0xb9623a);}catch{return null;}}function formatDirectoryError(_0x2f4dc3,_0x48f862,_0xe7823a){const _0x1367f4=a3_0x4f8d;if(_0xe7823a)return _0x1367f4(0xb8)+_0xe7823a+':\x20'+_0x2f4dc3;const _0x45de95=_0x48f862 instanceof Error?_0x48f862[_0x1367f4(0xa3)]:String(_0x48f862);return _0x1367f4(0xb6)+_0x2f4dc3+_0x1367f4(0xb5)+_0x45de95;}export async function getValidRootDirectories(_0x529516){const _0x3e64e4=a3_0x4f8d,_0x3a9439=[];for(const _0x36d0b6 of _0x529516){const _0x3c36cd=await parseRootUri(_0x36d0b6['uri']);if(!_0x3c36cd){console[_0x3e64e4(0xa6)](formatDirectoryError(_0x36d0b6[_0x3e64e4(0xa2)],undefined,_0x3e64e4(0xba)));continue;}try{const _0x39354c=await a3_0x5d6d17[_0x3e64e4(0xad)](_0x3c36cd);_0x39354c[_0x3e64e4(0xaa)]()?_0x3a9439[_0x3e64e4(0xa1)](_0x3c36cd):console[_0x3e64e4(0xa6)](formatDirectoryError(_0x3c36cd,undefined,'non-directory\x20root'));}catch(_0x5f55fe){console[_0x3e64e4(0xa6)](formatDirectoryError(_0x3c36cd,_0x5f55fe));}}return _0x3a9439;}
1
+ (function(_0x447df0,_0x5f042b){const _0x2cd40e=a3_0x14ae,_0x429327=_0x447df0();while(!![]){try{const _0x29e39a=-parseInt(_0x2cd40e(0xe5))/0x1*(-parseInt(_0x2cd40e(0xe2))/0x2)+-parseInt(_0x2cd40e(0xdc))/0x3*(-parseInt(_0x2cd40e(0xcc))/0x4)+-parseInt(_0x2cd40e(0xd7))/0x5*(-parseInt(_0x2cd40e(0xd5))/0x6)+-parseInt(_0x2cd40e(0xd1))/0x7+-parseInt(_0x2cd40e(0xdf))/0x8+-parseInt(_0x2cd40e(0xe6))/0x9*(parseInt(_0x2cd40e(0xd3))/0xa)+parseInt(_0x2cd40e(0xcd))/0xb;if(_0x29e39a===_0x5f042b)break;else _0x429327['push'](_0x429327['shift']());}catch(_0x5df91b){_0x429327['push'](_0x429327['shift']());}}}(a3_0x3566,0x43360));import{promises as a3_0x3e9744}from'fs';import a3_0x51b410 from'path';import a3_0x1675e8 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x388ac5){const _0x58d738=a3_0x14ae;try{const _0x380e9d=_0x388ac5[_0x58d738(0xcf)](_0x58d738(0xe4))?_0x388ac5[_0x58d738(0xd8)](0x7):_0x388ac5,_0x19c463=_0x380e9d['startsWith']('~/')||_0x380e9d==='~'?a3_0x51b410[_0x58d738(0xe0)](a3_0x1675e8[_0x58d738(0xde)](),_0x380e9d[_0x58d738(0xd8)](0x1)):_0x380e9d,_0x1c441f=a3_0x51b410[_0x58d738(0xd6)](_0x19c463),_0x35fab3=await a3_0x3e9744[_0x58d738(0xce)](_0x1c441f);return normalizePath(_0x35fab3);}catch{return null;}}function formatDirectoryError(_0x259fcc,_0xfbf9e2,_0x43f977){const _0x253197=a3_0x14ae;if(_0x43f977)return'Skipping\x20'+_0x43f977+':\x20'+_0x259fcc;const _0x92fdb6=_0xfbf9e2 instanceof Error?_0xfbf9e2[_0x253197(0xdb)]:String(_0xfbf9e2);return _0x253197(0xdd)+_0x259fcc+_0x253197(0xe1)+_0x92fdb6;}function a3_0x14ae(_0x19fb51,_0x381ff2){_0x19fb51=_0x19fb51-0xcc;const _0x35669b=a3_0x3566();let _0x14aef5=_0x35669b[_0x19fb51];return _0x14aef5;}function a3_0x3566(){const _0x2f908f=['2493428KyGhKi','non-directory\x20root','1913720fkyZBe','uri','12OKqXwU','resolve','1129895OlROHu','slice','push','isDirectory','message','77433GciRmO','Skipping\x20invalid\x20directory:\x20','homedir','3779456dmRpUk','join','\x20due\x20to\x20error:\x20','198srQHMG','error','file://','4337IBRncE','9XIiJoC','44fhaDih','1430682EzQuSy','realpath','startsWith','invalid\x20path\x20or\x20inaccessible'];a3_0x3566=function(){return _0x2f908f;};return a3_0x3566();}export async function getValidRootDirectories(_0x7299dc){const _0x42f1d1=a3_0x14ae,_0x297bad=[];for(const _0x2489f5 of _0x7299dc){const _0x1095d4=await parseRootUri(_0x2489f5[_0x42f1d1(0xd4)]);if(!_0x1095d4){console[_0x42f1d1(0xe3)](formatDirectoryError(_0x2489f5['uri'],undefined,_0x42f1d1(0xd0)));continue;}try{const _0x30238c=await a3_0x3e9744['stat'](_0x1095d4);_0x30238c[_0x42f1d1(0xda)]()?_0x297bad[_0x42f1d1(0xd9)](_0x1095d4):console[_0x42f1d1(0xe3)](formatDirectoryError(_0x1095d4,undefined,_0x42f1d1(0xd2)));}catch(_0x30618d){console[_0x42f1d1(0xe3)](formatDirectoryError(_0x1095d4,_0x30618d));}}return _0x297bad;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.56",
3
+ "version": "0.8.58",
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.83",
38
+ "@morphllm/morphsdk": "0.2.85",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",