@morphllm/morphmcp 0.8.123 → 0.8.125

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_0x56569c=a0_0x5081;(function(_0x20807d,_0x2e05fb){const _0x5184d3=a0_0x5081,_0xc3d381=_0x20807d();while(!![]){try{const _0x2dc181=parseInt(_0x5184d3(0x1af))/0x1+parseInt(_0x5184d3(0x200))/0x2*(parseInt(_0x5184d3(0x14d))/0x3)+parseInt(_0x5184d3(0x15d))/0x4*(parseInt(_0x5184d3(0x204))/0x5)+parseInt(_0x5184d3(0x19f))/0x6+-parseInt(_0x5184d3(0x19c))/0x7+parseInt(_0x5184d3(0x138))/0x8+-parseInt(_0x5184d3(0x143))/0x9;if(_0x2dc181===_0x2e05fb)break;else _0xc3d381['push'](_0xc3d381['shift']());}catch(_0x4a1f4a){_0xc3d381['push'](_0xc3d381['shift']());}}}(a0_0x1b77,0xe37c7));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_0x3c5a44 from'fs/promises';import a0_0x334e2e from'path';import a0_0x3ff23a from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';function a0_0x1b77(){const _0x16fb19=['\x20chars)','isArray','stack',',\x20modified\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','optional','describe','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','207684udeeRh','MORPH_API_KEY','version','filter','code','content','-\x20Listed\x20directory\x20`','roots','File\x20read\x20error:','morphApiUrl','Bearer\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','\x20error(s)','split',',\x20removed\x20','Natural\x20language\x20query\x20to\x20search\x20for\x20code','270236nlhPdn','Failed\x20to\x20read\x20file:\x20','startsWith','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','user','search_type','completed','basename','lines','oninitialized','added\x20','terminated','log','provider','metadata','Workspace\x20mode\x20enabled:\x20Using\x20','\x20as\x20allowed\x20directory','search_string','inputSchema','Error\x20accessing\x20directory\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','completed_with_file_errors','isDirectory','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','env','Morph\x20Edit\x20','SubToolError','enum','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','params','list_directory\x20','some','getClientCapabilities','stringify','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','every','\x0a</file>','normalize','.cursor','code_edit','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','linesModified','files','grep','UnknownError','homedir','description','codebase_search','object','Morph\x20Edit\x20Preview','etimedout','Error:\x20','dirname','data','Repository\x20identifier','--api-key','Cargo.toml','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','ToolException','Created\x20File','Invalid\x20arguments:\x20','.vscode','has','11798318CtRAwn','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','tsconfig.json','4358226LMfyfb','messages','boolean','[warpgrep_github_search]\x20Failed\x20in\x20','.\x20Changes:\x20','edit_file','length','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','post','map','unknown\x20error','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','toLowerCase','requiresApiKey','github','1418486NcXTKi','safeParse','TimeoutError','[warpgrep_github_search]\x20Searching\x20','timings','mcp-filesystem','includes','assistant','sep','readFile','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','RipgrepNotAvailable','payload','WORKSPACE_ROOT','constructor','Warning:\x20','text','ms.\x20Success:\x20','read','instruction','timed\x20out','Warning:\x20Workspace\x20fallback\x20failed:\x20','sk-','FileReadError','path','setRequestHandler','Relevant\x20context\x20found:','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','warpgrep_github_search','morph-warp-grep-v1-1111v0','https://morphllm.com/api/error-report','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','ms:','errors','dryRun','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','BinaryFile','match','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','\x20valid\x20directories','morph-v3-fast','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22\x20Bad\x20example:\x20\x22auth()\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keywords,\x20or\x20symbol-only\x20queries.','ReadError','\x0aExamples:','branch','all','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','join','-\x20Grepped\x20\x27','message','MORPH_WARP_GREP_TIMEOUT','<file\x20path=\x22','trim','composer.json','role','warn','❌\x20Morph\x20Edit\x20Failed:\x20','WarpGrep\x20sub-tool\x20errors:\x20','morph-mcp','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','terminationReason','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','push','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','timeout','For\x20deletions:\x0a','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','changes','--api-key=','--help','access','connect','owner_repo','\x22>\x0aError\x20reading\x20file:\x20','</file>','Benefits:\x0a','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','ENABLE_WORKSPACE_MODE','../package.json','Applied','@morphllm/morphmcp\x20','50uXKMDx','repo_path','Parent\x20directory\x20does\x20not\x20exist:\x20','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','50AOEtKz','GitHub\x20search\x20failed:\x20','completionId','ENOENT','setNotificationHandler','exit','default','listRoots','node_modules','fromCharCode','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Failed\x20to\x20request\x20roots\x20from\x20client:','floor','\x20(new\x20file)','substring','indexOf','success','array','grep\x20\x27','searchRequest','PathError','catch','[warpgrep_github_search]\x20Done\x20in\x20','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x0aOptions:','.\x20Path:\x20','toISOString','[could\x20not\x20read\x20file:\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Specific\x20commit\x20hash\x20to\x20search','linesRemoved','realpath','unknown','now','application/json','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','error','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','name','slice','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','MORPH_API_URL','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','morphApiKey','SymlinkError','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','runWarpGrep_call','github_url','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','finish','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','\x0a...\x20(truncated,\x20total:\x20','10625184kouIxm','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','utf-8','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','source','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','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','resolve','string','Unknown\x20tool:\x20','29358342AYudcJ'];a0_0x1b77=function(){return _0x16fb19;};return a0_0x1b77();}import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import a0_0x2d312a from'axios';function fixPathRepetition(_0x599692){const _0x3ff7ff=a0_0x5081,_0x516096=_0x599692['split'](a0_0x334e2e[_0x3ff7ff(0x1b7)])[_0x3ff7ff(0x150)](Boolean);if(_0x516096[_0x3ff7ff(0x1a5)]<0x2)return null;for(let _0x449996=Math[_0x3ff7ff(0x210)](_0x516096[_0x3ff7ff(0x1a5)]/0x2);_0x449996>=0x1;_0x449996--){for(let _0xbdcbe6=0x0;_0xbdcbe6<=_0x516096[_0x3ff7ff(0x1a5)]-0x2*_0x449996;_0xbdcbe6++){const _0xb07d0=_0x516096[_0x3ff7ff(0x128)](_0xbdcbe6,_0xbdcbe6+_0x449996),_0x2eeab2=_0x516096[_0x3ff7ff(0x128)](_0xbdcbe6+_0x449996,_0xbdcbe6+0x2*_0x449996);if(_0xb07d0[_0x3ff7ff(0x180)]((_0x3beab6,_0x499f34)=>_0x3beab6===_0x2eeab2[_0x499f34])){const _0x235da3=[..._0x516096[_0x3ff7ff(0x128)](0x0,_0xbdcbe6),..._0x516096[_0x3ff7ff(0x128)](_0xbdcbe6+_0x449996)];return a0_0x334e2e['sep']+_0x235da3[_0x3ff7ff(0x1de)](a0_0x334e2e[_0x3ff7ff(0x1b7)]);}}}return null;}function runWarpGrepWithSearchRequest(_0x55be40){const _0x4a5d16=a0_0x5081,_0x1a78d9={'repoRoot':_0x55be40['repoRoot'],'morphApiKey':_0x55be40[_0x4a5d16(0x12d)],'morphApiUrl':_0x55be40[_0x4a5d16(0x156)],'timeout':_0x55be40['timeout'],'provider':_0x55be40[_0x4a5d16(0x16a)],'search_type':_0x55be40[_0x4a5d16(0x162)]};return _0x1a78d9[String[_0x4a5d16(0x20d)](0x73,0x65,0x61,0x72,0x63,0x68,0x54,0x65,0x72,0x6d)]=_0x55be40['searchRequest'],runWarpGrep(_0x1a78d9);}function searchGitHubWithSearchRequest(_0x256f16,_0x15034f){const _0x562d79=a0_0x5081,_0xf9d46e={'github':_0x15034f[_0x562d79(0x1ae)],'branch':_0x15034f[_0x562d79(0x1db)]};return _0xf9d46e[String[_0x562d79(0x20d)](0x73,0x65,0x61,0x72,0x63,0x68,0x54,0x65,0x72,0x6d)]=_0x15034f[_0x562d79(0x217)],_0xf9d46e[String[_0x562d79(0x20d)](0x71,0x75,0x65,0x72,0x79)]=_0x15034f[_0x562d79(0x217)],_0x256f16['searchGitHub'](_0xf9d46e);}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x199d31=a0_0x5081;try{const _0x5b9ff6=require(_0x199d31(0x1fd));return _0x5b9ff6[_0x199d31(0x14f)]??_0x199d31(0x121);}catch(_0x1f893d){return console[_0x199d31(0x125)](_0x199d31(0x196),_0x1f893d),_0x199d31(0x121);}}function printHelp(){const _0x36bc8b=a0_0x5081;console[_0x36bc8b(0x169)](_0x36bc8b(0x1ff)+getPackageVersion()),console[_0x36bc8b(0x169)](_0x36bc8b(0x11d)),console[_0x36bc8b(0x169)](_0x36bc8b(0x21c)),console['log']('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x36bc8b(0x169)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x36bc8b(0x169)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log'](_0x36bc8b(0x1da)),console['log']('\x20\x20morph-mcp'),console['log'](_0x36bc8b(0x160));}const cliArgs=process['argv']['slice'](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x56569c(0x1f4),'-h']);cliArgs[a0_0x56569c(0x17c)](_0x196361=>VERSION_FLAGS[a0_0x56569c(0x19b)](_0x196361))&&(console[a0_0x56569c(0x169)](a0_0x56569c(0x1ff)+getPackageVersion()),process[a0_0x56569c(0x209)](0x0));cliArgs['some'](_0x3e93aa=>HELP_FLAGS[a0_0x56569c(0x19b)](_0x3e93aa))&&(printHelp(),process[a0_0x56569c(0x209)](0x0));function getCliArg(_0x5eb11c){const _0x33cdc9=a0_0x56569c;for(let _0x5d116f=0x0;_0x5d116f<cliArgs[_0x33cdc9(0x1a5)];_0x5d116f++){const _0x3e9702=cliArgs[_0x5d116f];if(_0x3e9702['startsWith']('--'+_0x5eb11c+'='))return _0x3e9702['slice'](('--'+_0x5eb11c+'=')['length']);if(_0x3e9702==='--'+_0x5eb11c&&_0x5d116f+0x1<cliArgs[_0x33cdc9(0x1a5)])return cliArgs[_0x5d116f+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x56569c(0x19b)](arg))continue;if(arg[a0_0x56569c(0x15f)](a0_0x56569c(0x1f3)))continue;if(arg===a0_0x56569c(0x194)){i++;continue;}args[a0_0x56569c(0x1ed)](arg);}function a0_0x5081(_0x169f7d,_0x2516f3){_0x169f7d=_0x169f7d-0x11b;const _0x1b77c4=a0_0x1b77();let _0x5081d1=_0x1b77c4[_0x169f7d];return _0x5081d1;}const WORKSPACE_ROOT=process[a0_0x56569c(0x175)][a0_0x56569c(0x1bc)]||process[a0_0x56569c(0x175)]['PWD']||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x56569c(0x175)][a0_0x56569c(0x1fc)]!=='false',MORPH_API_KEY=getCliArg('api-key')??process[a0_0x56569c(0x175)][a0_0x56569c(0x14e)],MORPH_API_URL=process[a0_0x56569c(0x175)][a0_0x56569c(0x12b)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x56569c(0x175)][a0_0x56569c(0x1e1)]?parseInt(process['env'][a0_0x56569c(0x1e1)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x56569c(0x15f)](a0_0x56569c(0x1c5))&&!MORPH_API_KEY[a0_0x56569c(0x15f)]('morph-')&&console[a0_0x56569c(0x125)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0xfb9b49){const _0x3f76a9=a0_0x56569c;try{await a0_0x2d312a[_0x3f76a9(0x1a8)](_0x3f76a9(0x1cd),{..._0xfb9b49,'timestamp':new Date()[_0x3f76a9(0x11b)](),'source':_0xfb9b49[_0x3f76a9(0x13d)]||_0x3f76a9(0x1b4)},{'timeout':0x1388,'headers':{'Content-Type':_0x3f76a9(0x123),'Authorization':_0x3f76a9(0x157)+MORPH_API_KEY}});}catch{}}args[a0_0x56569c(0x1a5)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x56569c(0x125)]('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),console[a0_0x56569c(0x125)]('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console[a0_0x56569c(0x125)](a0_0x56569c(0x134)),console[a0_0x56569c(0x125)](a0_0x56569c(0x171)),console['error'](a0_0x56569c(0x1ca)),console['error'](a0_0x56569c(0x148)));function normalizePath(_0x85750b){const _0x17a05b=a0_0x56569c;return a0_0x334e2e[_0x17a05b(0x182)](_0x85750b);}function expandHome(_0x37ade2){const _0x55f3d6=a0_0x56569c;if(_0x37ade2['startsWith']('~/')||_0x37ade2==='~')return a0_0x334e2e['join'](a0_0x3ff23a[_0x55f3d6(0x18a)](),_0x37ade2[_0x55f3d6(0x128)](0x1));return _0x37ade2;}let allowedDirectories=await Promise[a0_0x56569c(0x1dc)](args[a0_0x56569c(0x1a9)](async _0x3057c1=>{const _0x4b2538=a0_0x56569c,_0x53e725=expandHome(_0x3057c1),_0x54b793=a0_0x334e2e[_0x4b2538(0x140)](_0x53e725);try{const _0x513ab6=await a0_0x3c5a44[_0x4b2538(0x120)](_0x54b793);return normalizePath(_0x513ab6);}catch(_0x3f68f8){return normalizePath(_0x54b793);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x56569c(0x1a5)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console['error'](a0_0x56569c(0x16c)+workspaceDir+a0_0x56569c(0x16d)));}catch(a0_0x45f7f6){console[a0_0x56569c(0x125)](a0_0x56569c(0x1ee)+a0_0x45f7f6);}async function detectWorkspaceRoot(_0x1614f8){const _0xe54ead=a0_0x56569c;let _0x41d8bc=a0_0x334e2e[_0xe54ead(0x140)](_0x1614f8);const _0x4484a7=['.git',_0xe54ead(0x19a),'package.json',_0xe54ead(0x195),'pyproject.toml','go.mod',_0xe54ead(0x183),_0xe54ead(0x19e),_0xe54ead(0x1e4)];while(_0x41d8bc!==a0_0x334e2e[_0xe54ead(0x191)](_0x41d8bc)){for(const _0x54fff3 of _0x4484a7){const _0x1ab97b=a0_0x334e2e[_0xe54ead(0x1de)](_0x41d8bc,_0x54fff3);try{return await a0_0x3c5a44[_0xe54ead(0x1f5)](_0x1ab97b),normalizePath(_0x41d8bc);}catch{}}_0x41d8bc=a0_0x334e2e['dirname'](_0x41d8bc);}return normalizePath(_0x1614f8);}await Promise[a0_0x56569c(0x1dc)](args[a0_0x56569c(0x1a9)](async _0x8af1b1=>{const _0x8965ad=a0_0x56569c;try{const _0x415b67=await a0_0x3c5a44['stat'](expandHome(_0x8af1b1));!_0x415b67[_0x8965ad(0x173)]()&&(console[_0x8965ad(0x125)](_0x8965ad(0x190)+_0x8af1b1+'\x20is\x20not\x20a\x20directory'),process[_0x8965ad(0x209)](0x1));}catch(_0x33631b){console[_0x8965ad(0x125)](_0x8965ad(0x170)+_0x8af1b1+':',_0x33631b),process[_0x8965ad(0x209)](0x1);}}));async function validatePath(_0x2442b5){const _0x43402a=a0_0x56569c,_0x282cd5=expandHome(_0x2442b5),_0x285463=a0_0x334e2e[_0x43402a(0x140)](_0x282cd5);try{const _0x1a11e5=await a0_0x3c5a44[_0x43402a(0x120)](_0x285463);return _0x1a11e5;}catch(_0x513d27){if(_0x513d27[_0x43402a(0x151)]===_0x43402a(0x207)){const _0x25392c=a0_0x334e2e['dirname'](_0x285463);try{const _0x1aa7a1=await a0_0x3c5a44['realpath'](_0x25392c);return a0_0x334e2e[_0x43402a(0x1de)](_0x1aa7a1,a0_0x334e2e[_0x43402a(0x164)](_0x285463));}catch{throw new Error(_0x43402a(0x202)+_0x25392c);}}throw _0x513d27;}}const MorphEditFileArgsSchema=z[a0_0x56569c(0x18d)]({'path':z[a0_0x56569c(0x141)](),'code_edit':z[a0_0x56569c(0x141)]()['describe'](a0_0x56569c(0x203)),'instruction':z[a0_0x56569c(0x141)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x20e)),'dryRun':z[a0_0x56569c(0x1a1)]()['default'](![])[a0_0x56569c(0x14a)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x56569c(0x1d8),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x56569c(0x141)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x56569c(0x141)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x13f)),'search_type':z[a0_0x56569c(0x178)]([a0_0x56569c(0x20a),a0_0x56569c(0x20c)])['optional']()[a0_0x56569c(0x14a)](a0_0x56569c(0x1fb))}),WarpGrepGitHubArgsSchema=z[a0_0x56569c(0x18d)]({'search_string':z[a0_0x56569c(0x141)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x13a)),'github_url':z[a0_0x56569c(0x141)]()['optional']()[a0_0x56569c(0x14a)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z['string']()['optional']()[a0_0x56569c(0x14a)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z['string']()['optional']()[a0_0x56569c(0x14a)](a0_0x56569c(0x12a))}),CodebaseSearchArgsSchema=z['object']({'query':z[a0_0x56569c(0x141)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x15c)),'repoId':z[a0_0x56569c(0x141)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x193)),'branch':z['string']()[a0_0x56569c(0x149)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x136)),'commitHash':z[a0_0x56569c(0x141)]()[a0_0x56569c(0x149)]()[a0_0x56569c(0x14a)](a0_0x56569c(0x11e)),'targetDirectories':z[a0_0x56569c(0x215)](z[a0_0x56569c(0x141)]())[a0_0x56569c(0x20a)]([])[a0_0x56569c(0x14a)](a0_0x56569c(0x185)),'limit':z['number']()['optional']()['default'](0xa)[a0_0x56569c(0x14a)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x56569c(0x1e9),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x56569c(0x1c8)](ListToolsRequestSchema,async()=>{const _0x1900fe=a0_0x56569c,_0x4f97d6=[{'name':'edit_file','description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x1900fe(0x1d5)+_0x1900fe(0x14c)+_0x1900fe(0x174)+_0x1900fe(0x1fa)+_0x1900fe(0x1ab)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x1900fe(0x14b)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x1900fe(0x1d2)+_0x1900fe(0x1f0)+_0x1900fe(0x1ea)+_0x1900fe(0x124)+'Rules:\x0a'+_0x1900fe(0x1ec)+_0x1900fe(0x17f)+_0x1900fe(0x13c)+_0x1900fe(0x1ce)+_0x1900fe(0x129)+_0x1900fe(0x19d)+_0x1900fe(0x1dd),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x1900fe(0x18c),'description':_0x1900fe(0x1a6)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x1900fe(0x126)+_0x1900fe(0x139)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x2481ef=_0x4f97d6[_0x1900fe(0x150)](_0x1ff312=>{const _0x50bf32=_0x1900fe;if(_0x50bf32(0x1ad)in _0x1ff312&&_0x1ff312[_0x50bf32(0x1ad)]&&!MORPH_API_KEY)return console['error'](_0x50bf32(0x1be)+_0x1ff312[_0x50bf32(0x127)]+_0x50bf32(0x130)),![];return!![];});return{'tools':_0x2481ef[_0x1900fe(0x1a9)](_0xc09a1a=>({'name':_0xc09a1a[_0x1900fe(0x127)],'description':_0xc09a1a[_0x1900fe(0x18b)],'inputSchema':_0xc09a1a[_0x1900fe(0x16f)]}))};}),server[a0_0x56569c(0x1c8)](CallToolRequestSchema,async _0x1a9b3c=>{const _0x386063=a0_0x56569c;try{const {name:_0x38e6b2,arguments:_0x49d9fc}=_0x1a9b3c[_0x386063(0x17a)];switch(_0x38e6b2){case _0x386063(0x1a4):{const _0x10fcd7=MorphEditFileArgsSchema[_0x386063(0x1b0)](_0x49d9fc);if(!_0x10fcd7['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x10fcd7[_0x386063(0x125)]);const _0x24dc19=await validatePath(_0x10fcd7[_0x386063(0x192)]['path']);let _0x161c42=null,_0x5c48e5=!![],_0x15535b=null;try{_0x161c42=await a0_0x3c5a44[_0x386063(0x1b8)](_0x24dc19,_0x386063(0x13b));}catch(_0x18f02){const _0x195ce3=_0x18f02[_0x386063(0x151)];_0x195ce3==='ENOENT'?(_0x5c48e5=![],_0x161c42=''):(_0x15535b=_0x386063(0x15e)+(_0x195ce3||_0x386063(0x121))+'\x20-\x20'+(_0x18f02 instanceof Error?_0x18f02['message']:String(_0x18f02)),console[_0x386063(0x125)](_0x386063(0x1be)+_0x15535b));}let _0x1aa77c;try{const _0x5770a6=MORPH_API_KEY;if(!_0x5770a6)throw new Error(_0x386063(0x1f1));const _0x5428eb=a0_0x334e2e[_0x386063(0x191)](_0x24dc19),_0x662f1c=a0_0x334e2e[_0x386063(0x164)](_0x24dc19),_0x157402=await executeEditFile({'target_filepath':_0x662f1c,'code_edit':_0x10fcd7[_0x386063(0x192)][_0x386063(0x184)],'instructions':_0x10fcd7['data'][_0x386063(0x1c2)]},{'morphApiKey':_0x5770a6,'morphApiUrl':MORPH_API_URL,'baseDir':_0x5428eb,'autoWrite':!_0x10fcd7[_0x386063(0x192)][_0x386063(0x1d1)],'generateUdiff':![],'debug':![]});_0x1aa77c=_0x157402[_0x386063(0x206)];if(!_0x157402[_0x386063(0x214)])throw new Error(_0x157402['error']||_0x386063(0x158));const _0x580e66=_0x157402[_0x386063(0x1f2)],_0x11d2fb=_0x386063(0x167)+_0x580e66['linesAdded']+_0x386063(0x15b)+_0x580e66[_0x386063(0x11f)]+_0x386063(0x147)+_0x580e66[_0x386063(0x186)];if(_0x10fcd7['data'][_0x386063(0x1d1)])return{'content':[{'type':'text','text':_0x386063(0x18e)+(_0x5c48e5?'':_0x386063(0x211))+':\x20'+_0x10fcd7[_0x386063(0x192)]['instruction']+_0x386063(0x1a3)+_0x11d2fb+_0x386063(0x21d)+_0x10fcd7[_0x386063(0x192)][_0x386063(0x1c7)]+'.'}]};return{'content':[{'type':_0x386063(0x1bf),'text':_0x386063(0x176)+(_0x5c48e5?_0x386063(0x1fe):_0x386063(0x198))+':\x20'+_0x10fcd7['data']['instruction']+'.\x20Changes:\x20'+_0x11d2fb+_0x386063(0x21d)+_0x10fcd7[_0x386063(0x192)][_0x386063(0x1c7)]+'.'}]};}catch(_0x38672b){const _0xe27218=_0x38672b instanceof Error?_0x38672b[_0x386063(0x1e0)]:String(_0x38672b);return reportMorphError({'error_message':_0xe27218,'error_type':_0x38672b instanceof Error?_0x38672b[_0x386063(0x1bd)][_0x386063(0x127)]:'UnknownError','context':{'tool':'edit_file','completion_id':_0x1aa77c,'file_path':_0x10fcd7[_0x386063(0x192)]['path'],'validated_path':_0x24dc19,'instruction':_0x10fcd7[_0x386063(0x192)][_0x386063(0x1c2)],'model':_0x386063(0x1d7),'dry_run':_0x10fcd7[_0x386063(0x192)]['dryRun'],'file_exists':_0x5c48e5,'file_read_error':_0x15535b,'file_readable':_0x161c42!==null,'request_content':{'path':_0x10fcd7[_0x386063(0x192)][_0x386063(0x1c7)],'code_edit':_0x10fcd7[_0x386063(0x192)][_0x386063(0x184)],'instruction':_0x10fcd7[_0x386063(0x192)][_0x386063(0x1c2)],'original_code':_0x161c42!==null?_0x161c42[_0x386063(0x1a5)]>0xc350?_0x161c42['substring'](0x0,0xc350)+_0x386063(0x137)+_0x161c42[_0x386063(0x1a5)]+_0x386063(0x144):_0x161c42:_0x386063(0x11c)+(_0x15535b||_0x386063(0x1aa))+']','original_code_length':_0x161c42?.['length']??0x0,'model':'morph-v3-fast','dry_run':_0x10fcd7[_0x386063(0x192)]['dryRun']}},'stack_trace':_0x38672b instanceof Error?_0x38672b[_0x386063(0x146)]:undefined,'source':_0x386063(0x1b4)})[_0x386063(0x219)](()=>{}),{'content':[{'type':_0x386063(0x1bf),'text':_0x386063(0x1e7)+_0xe27218}],'isError':!![]};}}case _0x386063(0x18c):{const _0xd3f494=WarpGrepArgsSchema[_0x386063(0x1b0)](_0x49d9fc);if(!_0xd3f494[_0x386063(0x214)])return{'content':[{'type':_0x386063(0x1bf),'text':'Invalid\x20arguments:\x20'+_0xd3f494[_0x386063(0x125)]}],'isError':!![]};const _0x4cea92=_0x20c364=>{const _0x1ecbab=_0x386063,_0x34394e=[];for(const _0x1f8717 of _0x20c364||[]){const _0x14c49d=_0x1f8717[_0x1ecbab(0x1e5)],_0x13f261=_0x1f8717['content'];if(_0x14c49d===_0x1ecbab(0x1b6)&&_0x13f261){const _0x84d332=_0x13f261[_0x1ecbab(0x15a)]('\x0a')[_0x1ecbab(0x150)](_0xbf2de8=>_0xbf2de8['trim']());for(const _0x154e33 of _0x84d332){const _0x2bd925=_0x154e33['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x2bd925){_0x34394e[_0x1ecbab(0x1ed)](_0x1ecbab(0x216)+_0x2bd925[0x1]+'\x27\x20'+_0x2bd925[0x2]);continue;}const _0x2b801d=_0x154e33['match'](/^read\s+(.+)$/);if(_0x2b801d){_0x34394e[_0x1ecbab(0x1ed)]('read\x20'+_0x2b801d[0x1]);continue;}const _0x66ecfc=_0x154e33[_0x1ecbab(0x1d4)](/^list_directory\s+(.+)$/);if(_0x66ecfc){_0x34394e[_0x1ecbab(0x1ed)](_0x1ecbab(0x17b)+_0x66ecfc[0x1]);continue;}}}}return _0x34394e;},_0x2528fb=_0x321af6=>{const _0x5162ad=_0x386063,_0x15ca32=[];if(!_0x321af6||!Array[_0x5162ad(0x145)](_0x321af6))return _0x15ca32;const _0x341ab7=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x5162ad(0x1c1)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x5162ad(0x218),'tool':_0x5162ad(0x1c1)},{'pattern':/\[READ ERROR\]/,'error_type':_0x5162ad(0x1d9),'tool':_0x5162ad(0x1c1)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x5162ad(0x1c1)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x5162ad(0x1ba),'tool':_0x5162ad(0x188)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x5162ad(0x1d3),'tool':_0x5162ad(0x1c1)},{'pattern':/\[SYMLINK\]/,'error_type':_0x5162ad(0x12e),'tool':_0x5162ad(0x1c1)},{'pattern':/not a text file/,'error_type':_0x5162ad(0x1d3),'tool':'read'},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x5162ad(0x1c1)},{'pattern':/Error reading file:/,'error_type':_0x5162ad(0x1d9),'tool':_0x5162ad(0x1c1)},{'pattern':/status="error"/,'error_type':_0x5162ad(0x197),'tool':_0x5162ad(0x121)}];let _0x5438a4=0x0;for(const _0x585893 of _0x321af6){if(_0x585893[_0x5162ad(0x1e5)]===_0x5162ad(0x161)){_0x5438a4++;const _0x438c26=_0x585893[_0x5162ad(0x152)];if(!_0x438c26||typeof _0x438c26!==_0x5162ad(0x141))continue;for(const {pattern:_0xf3afaa,error_type:_0x6a361a,tool:_0x15808d}of _0x341ab7){const _0x3976e1=_0x438c26[_0x5162ad(0x1d4)](new RegExp(_0xf3afaa[_0x5162ad(0x13d)],'g'));if(_0x3976e1)for(const _0x3f4774 of _0x3976e1){const _0x35514c=_0x438c26[_0x5162ad(0x213)](_0x3f4774),_0x4563b0=_0x438c26['substring'](_0x35514c,Math['min'](_0x35514c+0xc8,_0x438c26['length']));_0x15ca32[_0x5162ad(0x1ed)]({'tool':_0x15808d,'error_type':_0x6a361a,'error_message':_0x4563b0[_0x5162ad(0x15a)]('\x0a')[0x0],'turn':_0x5438a4});}}}}return _0x15ca32;};try{const _0x30de0f=a0_0x334e2e[_0x386063(0x140)](_0xd3f494[_0x386063(0x192)]['repo_path']),_0x800e5d=_0xd3f494[_0x386063(0x192)]['search_type'],_0x2609a8=_0x800e5d==='node_modules'?{'allowNames':[_0x386063(0x20c)]}:undefined,_0x297b32=new LocalRipgrepProvider(_0x30de0f,undefined,_0x2609a8),_0x433a29=await runWarpGrepWithSearchRequest({'searchRequest':_0xd3f494[_0x386063(0x192)][_0x386063(0x16e)],'repoRoot':_0x30de0f,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x297b32,'search_type':_0x800e5d}),_0x38c03a=_0x2528fb(_0x433a29['messages']);_0x38c03a['length']>0x0&&reportMorphError({'error_message':_0x386063(0x1e8)+_0x38c03a[_0x386063(0x1a5)]+_0x386063(0x159),'error_type':_0x386063(0x177),'level':_0x386063(0x1e6),'tool':_0x386063(0x18c),'context':{'repo_path':_0xd3f494[_0x386063(0x192)][_0x386063(0x201)],'query':_0xd3f494['data']['search_string'],'model':_0x386063(0x1cc),'termination_reason':_0x433a29['terminationReason'],'sub_tool_errors':_0x38c03a,'timings':_0x433a29[_0x386063(0x1b3)],'tool_calls':_0x4cea92(_0x433a29[_0x386063(0x1a0)]),'messages':_0x433a29[_0x386063(0x1a0)]?.[_0x386063(0x1a9)](_0x1f756d=>({'role':_0x1f756d['role'],'content':_0x1f756d['content']}))},'source':_0x386063(0x1b4)})['catch'](()=>{});let _0x1c1ba0='';if(_0x433a29[_0x386063(0x1eb)]===_0x386063(0x163)&&_0x433a29[_0x386063(0x135)]?.['metadata']?.['files']){const _0x11ea0b=_0x433a29[_0x386063(0x135)][_0x386063(0x16b)][_0x386063(0x187)];if(_0x11ea0b[_0x386063(0x1a5)]===0x0)return _0x1c1ba0=_0x433a29[_0x386063(0x135)][_0x386063(0x1bb)]||_0x386063(0x179),{'content':[{'type':_0x386063(0x1bf),'text':_0x1c1ba0}]};const _0xd3f1da=[],_0x33336b=[_0x386063(0x133)];for(const _0xf93fdd of _0x433a29[_0x386063(0x1a0)]){const _0x4d340a=_0xf93fdd['role'],_0x5d7f51=_0xf93fdd['content'];if(_0x4d340a===_0x386063(0x1b6)&&_0x5d7f51){const _0x5af096=_0x5d7f51['split']('\x0a')[_0x386063(0x150)](_0x1da0e0=>_0x1da0e0[_0x386063(0x1e3)]());for(const _0x518452 of _0x5af096){const _0x4ba5c2=_0x518452[_0x386063(0x1d4)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x4ba5c2){_0x33336b['push'](_0x386063(0x1df)+_0x4ba5c2[0x1]+'\x27\x20in\x20`'+_0x4ba5c2[0x2]+'`');continue;}const _0x4c00b3=_0x518452['match'](/^read\s+(.+)$/);if(_0x4c00b3){_0x33336b['push']('-\x20Read\x20file\x20`'+_0x4c00b3[0x1]+'`');continue;}const _0x3426eb=_0x518452[_0x386063(0x1d4)](/^list_directory\s+(.+)$/);if(_0x3426eb){_0x33336b['push'](_0x386063(0x153)+_0x3426eb[0x1]+'`');continue;}}}}_0xd3f1da[_0x386063(0x1ed)](_0x33336b['join']('\x0a'));const _0x57ae50=['',_0x386063(0x1c9)];for(const _0x1a8a51 of _0x11ea0b){if(_0x1a8a51[_0x386063(0x165)]==='*')_0x57ae50[_0x386063(0x1ed)]('-\x20'+_0x1a8a51[_0x386063(0x1c7)]+':*');else{if(Array[_0x386063(0x145)](_0x1a8a51[_0x386063(0x165)])){const _0x5b57b9=_0x1a8a51[_0x386063(0x165)][_0x386063(0x1a9)](([_0x36a456,_0x32f30d])=>{if(_0x36a456===_0x32f30d)return''+_0x36a456;return _0x36a456+'-'+_0x32f30d;});_0x57ae50['push']('-\x20'+_0x1a8a51[_0x386063(0x1c7)]+':'+_0x5b57b9[_0x386063(0x1de)](','));}else _0x57ae50[_0x386063(0x1ed)]('-\x20'+_0x1a8a51['path']+':*');}}_0x57ae50[_0x386063(0x1ed)](''),_0xd3f1da[_0x386063(0x1ed)](_0x57ae50[_0x386063(0x1de)]('\x0a')),_0xd3f1da[_0x386063(0x1ed)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x1ec489=[];for(const _0xc4240e of _0x11ea0b){let _0x2b070e=a0_0x334e2e[_0x386063(0x140)](_0xd3f494['data'][_0x386063(0x201)],_0xc4240e[_0x386063(0x1c7)]),_0x5a34ab=null,_0x1c4c0a=null;try{_0x5a34ab=await a0_0x3c5a44[_0x386063(0x1b8)](_0x2b070e,{'encoding':'utf-8'});}catch(_0x464c00){const _0x2c77ad=fixPathRepetition(_0x2b070e);if(_0x2c77ad)try{_0x5a34ab=await a0_0x3c5a44[_0x386063(0x1b8)](_0x2c77ad,{'encoding':_0x386063(0x13b)}),_0x2b070e=_0x2c77ad;}catch{_0x1c4c0a=_0x464c00 instanceof Error?_0x464c00:new Error(String(_0x464c00));}else _0x1c4c0a=_0x464c00 instanceof Error?_0x464c00:new Error(String(_0x464c00));}if(_0x5a34ab!==null){const _0x14d3be=_0x5a34ab[_0x386063(0x15a)](/\r?\n/),_0x21c572=[_0x386063(0x1e2)+_0xc4240e[_0x386063(0x1c7)]+'\x22>'];if(_0xc4240e['lines']==='*'||!Array[_0x386063(0x145)](_0xc4240e[_0x386063(0x165)]))for(let _0x5db016=0x1;_0x5db016<=_0x14d3be['length'];_0x5db016++){const _0x496a96=_0x14d3be[_0x5db016-0x1];_0x21c572['push'](_0x5db016+'|\x20'+_0x496a96);}else for(const [_0x5556d8,_0x157f2b]of _0xc4240e[_0x386063(0x165)]){_0x21c572[_0x386063(0x1a5)]>0x1&&_0x21c572['push']('');for(let _0x20b226=_0x5556d8;_0x20b226<=_0x157f2b&&_0x20b226<=_0x14d3be[_0x386063(0x1a5)];_0x20b226++){const _0x577afa=_0x14d3be[_0x20b226-0x1];_0x21c572[_0x386063(0x1ed)](_0x20b226+'|\x20'+_0x577afa);}}_0x21c572['push'](_0x386063(0x1f9)),_0x1ec489[_0x386063(0x1ed)](_0x21c572[_0x386063(0x1de)]('\x0a'));}else _0x1ec489[_0x386063(0x1ed)](_0x386063(0x1e2)+_0xc4240e['path']+_0x386063(0x1f8)+(_0x1c4c0a?.[_0x386063(0x1e0)]||'Unknown\x20error')+_0x386063(0x181));}_0xd3f1da[_0x386063(0x1ed)](_0x1ec489[_0x386063(0x1de)]('\x0a\x0a')),_0x1c1ba0=_0xd3f1da[_0x386063(0x1de)]('\x0a');const _0xa4e93=_0x433a29[_0x386063(0x1d0)]?.[_0x386063(0x150)](_0x56a84d=>_0x56a84d[_0x386063(0x1e0)]?.[_0x386063(0x15f)](_0x386063(0x155)))||[];if(_0xa4e93['length']>0x0){const _0x5648c9=_0xa4e93[_0x386063(0x1a9)](_0x7fb432=>_0x7fb432['message'])['join'](';\x20');reportMorphError({'error_message':_0x5648c9,'error_type':_0x386063(0x1c6),'context':{'tool':_0x386063(0x18c),'repo_path':_0xd3f494[_0x386063(0x192)][_0x386063(0x201)],'query':_0xd3f494[_0x386063(0x192)][_0x386063(0x16e)],'model':_0x386063(0x1cc),'termination_reason':_0x386063(0x172),'error_count':_0xa4e93['length'],'is_timeout':![],'timings':_0x433a29['timings'],'files_attempted':_0x11ea0b['map'](_0x39a4ce=>({'path':_0x39a4ce[_0x386063(0x1c7)],'lines':_0x39a4ce[_0x386063(0x165)]})),'tool_calls':_0x4cea92(_0x433a29[_0x386063(0x1a0)]),'messages':_0x433a29[_0x386063(0x1a0)]?.[_0x386063(0x1a9)](_0x4b935a=>({'role':_0x4b935a['role'],'content':_0x4b935a[_0x386063(0x152)]})),'request_content':{'query':_0xd3f494[_0x386063(0x192)][_0x386063(0x16e)],'repo_path':_0xd3f494[_0x386063(0x192)][_0x386063(0x201)],'repoRoot':a0_0x334e2e[_0x386063(0x140)](_0xd3f494[_0x386063(0x192)]['repo_path']),'model':_0x386063(0x1cc)}},'source':_0x386063(0x1b4)})[_0x386063(0x219)](()=>{});}}else{if(_0x433a29[_0x386063(0x1eb)]===_0x386063(0x168)&&_0x433a29[_0x386063(0x1d0)][_0x386063(0x1a5)]>0x0){const _0x3afe37=_0x433a29[_0x386063(0x1d0)][_0x386063(0x1a9)](_0x1605e3=>_0x1605e3['message'])[_0x386063(0x1de)](';\x20');_0x1c1ba0=_0x386063(0x190)+_0x3afe37;const _0x23f0c7=_0x3afe37['toLowerCase']()[_0x386063(0x1b5)](_0x386063(0x1ef))||_0x3afe37[_0x386063(0x1ac)]()[_0x386063(0x1b5)](_0x386063(0x1c3))||_0x3afe37[_0x386063(0x1ac)]()[_0x386063(0x1b5)](_0x386063(0x18f)),_0x3d47b2=_0x433a29[_0x386063(0x135)]?.[_0x386063(0x16b)]?.[_0x386063(0x187)],_0x489d4c=_0x433a29[_0x386063(0x1d0)][0x0];reportMorphError({'error_message':_0x3afe37,'error_type':_0x23f0c7?_0x386063(0x1b1):_0x489d4c?.[_0x386063(0x1bd)]?.[_0x386063(0x127)]||'WarpGrepError','context':{'tool':_0x386063(0x18c),'repo_path':_0xd3f494[_0x386063(0x192)][_0x386063(0x201)],'query':_0xd3f494['data'][_0x386063(0x16e)],'model':_0x386063(0x1cc),'termination_reason':_0x433a29[_0x386063(0x1eb)],'error_count':_0x433a29[_0x386063(0x1d0)]['length'],'is_timeout':_0x23f0c7,'timings':_0x433a29[_0x386063(0x1b3)],'files_attempted':_0x3d47b2?.['map'](_0x4a95d3=>({'path':_0x4a95d3[_0x386063(0x1c7)],'lines':_0x4a95d3['lines']})),'tool_calls':_0x4cea92(_0x433a29[_0x386063(0x1a0)]),'messages':_0x433a29[_0x386063(0x1a0)]?.[_0x386063(0x1a9)](_0x5ec9e0=>({'role':_0x5ec9e0[_0x386063(0x1e5)],'content':_0x5ec9e0['content']})),'request_content':{'query':_0xd3f494[_0x386063(0x192)][_0x386063(0x16e)],'repo_path':_0xd3f494['data']['repo_path'],'repoRoot':a0_0x334e2e[_0x386063(0x140)](_0xd3f494['data']['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x489d4c?.['stack']||undefined,'source':_0x386063(0x1b4)})[_0x386063(0x219)](()=>{});}else _0x1c1ba0=_0x386063(0x12c);}return{'content':[{'type':_0x386063(0x1bf),'text':_0x1c1ba0}]};}catch(_0x971d5){const _0x1f70c6=_0x971d5 instanceof Error?_0x971d5[_0x386063(0x1e0)]:String(_0x971d5),_0x4d2c67=_0x1f70c6[_0x386063(0x1ac)]()['includes'](_0x386063(0x1ef))||_0x1f70c6['toLowerCase']()['includes'](_0x386063(0x1c3))||_0x1f70c6[_0x386063(0x1ac)]()['includes'](_0x386063(0x18f))||_0x971d5 instanceof Error&&_0x971d5[_0x386063(0x127)]==='TimeoutError';return reportMorphError({'error_message':_0x1f70c6,'error_type':_0x4d2c67?_0x386063(0x1b1):_0x971d5 instanceof Error?_0x971d5['constructor'][_0x386063(0x127)]:_0x386063(0x189),'context':{'tool':_0x386063(0x18c),'repo_path':_0xd3f494[_0x386063(0x192)][_0x386063(0x201)],'query':_0xd3f494[_0x386063(0x192)]['search_string'],'model':_0x386063(0x1cc),'is_timeout':_0x4d2c67,'exception_phase':_0x386063(0x131),'request_content':{'query':_0xd3f494[_0x386063(0x192)][_0x386063(0x16e)],'repo_path':_0xd3f494[_0x386063(0x192)][_0x386063(0x201)],'repoRoot':a0_0x334e2e['resolve'](_0xd3f494['data'][_0x386063(0x201)]),'model':_0x386063(0x1cc)}},'stack_trace':_0x971d5 instanceof Error?_0x971d5[_0x386063(0x146)]:undefined,'source':_0x386063(0x1b4)})[_0x386063(0x219)](()=>{}),{'content':[{'type':_0x386063(0x1bf),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x1f70c6}],'isError':![]};}}case _0x386063(0x1cb):{const _0x227e61=WarpGrepGitHubArgsSchema[_0x386063(0x1b0)](_0x49d9fc);if(!_0x227e61[_0x386063(0x214)])return{'content':[{'type':_0x386063(0x1bf),'text':_0x386063(0x199)+_0x227e61[_0x386063(0x125)]}],'isError':!![]};const _0x32b709=_0x227e61[_0x386063(0x192)][_0x386063(0x132)]||_0x227e61[_0x386063(0x192)][_0x386063(0x1f7)];if(!_0x32b709)return{'content':[{'type':_0x386063(0x1bf),'text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x115549=MORPH_API_KEY;if(!_0x115549)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x109f22=Date[_0x386063(0x122)]();console['error'](_0x386063(0x1b2)+_0x32b709+'\x20for:\x20\x22'+_0x227e61['data'][_0x386063(0x16e)]+'\x22');try{const _0x4b287b=new WarpGrepClient({'morphApiKey':_0x115549,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x200170=await searchGitHubWithSearchRequest(_0x4b287b,{'searchRequest':_0x227e61[_0x386063(0x192)][_0x386063(0x16e)],'github':_0x32b709,'branch':_0x227e61['data'][_0x386063(0x1db)]}),_0x575d65=Date['now']()-_0x109f22;console[_0x386063(0x125)](_0x386063(0x21a)+_0x575d65+_0x386063(0x1c0)+_0x200170['success']);const _0x40569c=formatResult(_0x200170);return{'content':[{'type':'text','text':_0x40569c}]};}catch(_0x49b46e){const _0x3558ae=Date[_0x386063(0x122)]()-_0x109f22,_0x2fcb7d=_0x49b46e instanceof Error?_0x49b46e[_0x386063(0x1e0)]:String(_0x49b46e);return console[_0x386063(0x125)](_0x386063(0x1a2)+_0x3558ae+_0x386063(0x1cf),_0x2fcb7d),reportMorphError({'error_message':_0x2fcb7d,'error_type':_0x49b46e instanceof Error?_0x49b46e[_0x386063(0x1bd)][_0x386063(0x127)]:_0x386063(0x189),'context':{'tool':_0x386063(0x1cb),'github_url':_0x32b709,'search_string':_0x227e61['data'][_0x386063(0x16e)],'branch':_0x227e61[_0x386063(0x192)][_0x386063(0x1db)]},'stack_trace':_0x49b46e instanceof Error?_0x49b46e[_0x386063(0x146)]:undefined,'source':_0x386063(0x1b4),'tool':_0x386063(0x1cb),'latency_ms':_0x3558ae})['catch'](()=>{}),{'content':[{'type':_0x386063(0x1bf),'text':_0x386063(0x205)+_0x2fcb7d}],'isError':![]};}}default:throw new Error(_0x386063(0x142)+_0x38e6b2);}}catch(_0x181225){const _0x43251d=_0x181225 instanceof Error?_0x181225[_0x386063(0x1e0)]:String(_0x181225);return reportMorphError({'error_message':_0x43251d,'error_type':_0x181225 instanceof Error?_0x181225[_0x386063(0x1bd)][_0x386063(0x127)]:'UnknownError','context':{'tool':name,'arguments':args?JSON[_0x386063(0x17e)](args)[_0x386063(0x212)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x181225 instanceof Error?_0x181225[_0x386063(0x146)]:undefined,'source':_0x386063(0x1b4)})[_0x386063(0x219)](()=>{}),{'content':[{'type':_0x386063(0x1bf),'text':_0x386063(0x190)+_0x43251d}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x72f003){const _0x2543b9=a0_0x56569c,_0x2cd35f=await getValidRootDirectories(_0x72f003);if(_0x2cd35f[_0x2543b9(0x1a5)]>0x0)allowedDirectories=[..._0x2cd35f],console[_0x2543b9(0x125)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x2cd35f[_0x2543b9(0x1a5)]+_0x2543b9(0x1d6));else{console[_0x2543b9(0x125)](_0x2543b9(0x13e));if(ENABLE_WORKSPACE_MODE)try{const _0x38c37a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x38c37a&&(allowedDirectories=[_0x38c37a],console[_0x2543b9(0x125)]('Fallback:\x20Using\x20workspace\x20root\x20'+_0x38c37a));}catch(_0x123fd1){console['error'](_0x2543b9(0x1c4)+_0x123fd1);}}}server[a0_0x56569c(0x208)](RootsListChangedNotificationSchema,async()=>{const _0x547e63=a0_0x56569c;try{const _0x1e07bb=await server[_0x547e63(0x20b)]();_0x1e07bb&&_0x547e63(0x154)in _0x1e07bb&&await updateAllowedDirectoriesFromRoots(_0x1e07bb['roots']);}catch(_0x3e17ed){console[_0x547e63(0x125)](_0x547e63(0x20f),_0x3e17ed instanceof Error?_0x3e17ed[_0x547e63(0x1e0)]:String(_0x3e17ed));}}),server[a0_0x56569c(0x166)]=async()=>{const _0x5c4ccd=a0_0x56569c,_0x52f204=server[_0x5c4ccd(0x17d)]();if(_0x52f204?.[_0x5c4ccd(0x154)])try{const _0x4da799=await server[_0x5c4ccd(0x20b)]();_0x4da799&&'roots'in _0x4da799?await updateAllowedDirectoriesFromRoots(_0x4da799[_0x5c4ccd(0x154)]):console[_0x5c4ccd(0x125)]('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x226a8c){console['error'](_0x5c4ccd(0x1a7),_0x226a8c instanceof Error?_0x226a8c[_0x5c4ccd(0x1e0)]:String(_0x226a8c));}else{if(allowedDirectories[_0x5c4ccd(0x1a5)]>0x0)console[_0x5c4ccd(0x125)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x5c4ccd(0x125)](_0x5c4ccd(0x12f));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.');}}};async function runServer(){const _0x58705f=a0_0x56569c,_0x3ccc26=new StdioServerTransport();await server[_0x58705f(0x1f6)](_0x3ccc26),console[_0x58705f(0x125)](_0x58705f(0x1b9)),allowedDirectories['length']===0x0&&console['error'](_0x58705f(0x21b));}runServer()[a0_0x56569c(0x219)](_0x207554=>{const _0x57e5e4=a0_0x56569c;console[_0x57e5e4(0x125)]('Fatal\x20error\x20running\x20server:',_0x207554),process[_0x57e5e4(0x209)](0x1);});
2
+ const a0_0x487fa1=a0_0x31e8;(function(_0x1e68a5,_0x2c1222){const _0x112ebe=a0_0x31e8,_0x141700=_0x1e68a5();while(!![]){try{const _0x236e95=parseInt(_0x112ebe(0x12e))/0x1*(parseInt(_0x112ebe(0x1d1))/0x2)+-parseInt(_0x112ebe(0xe7))/0x3+parseInt(_0x112ebe(0x103))/0x4*(parseInt(_0x112ebe(0x10f))/0x5)+parseInt(_0x112ebe(0x11f))/0x6+parseInt(_0x112ebe(0x11a))/0x7*(-parseInt(_0x112ebe(0x112))/0x8)+-parseInt(_0x112ebe(0x1d9))/0x9*(-parseInt(_0x112ebe(0x154))/0xa)+-parseInt(_0x112ebe(0x129))/0xb;if(_0x236e95===_0x2c1222)break;else _0x141700['push'](_0x141700['shift']());}catch(_0x3df2d1){_0x141700['push'](_0x141700['shift']());}}}(a0_0x22d5,0x3130b));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_0x4d8b09 from'fs/promises';import a0_0x36dc60 from'path';import a0_0x521542 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import a0_0x4200e4 from'axios';function fixPathRepetition(_0x2df065){const _0x186e20=a0_0x31e8,_0x4538a2=_0x2df065['split'](a0_0x36dc60[_0x186e20(0x13f)])[_0x186e20(0x18d)](Boolean);if(_0x4538a2['length']<0x2)return null;for(let _0x4cfd1c=Math[_0x186e20(0x14f)](_0x4538a2[_0x186e20(0x16f)]/0x2);_0x4cfd1c>=0x1;_0x4cfd1c--){for(let _0x8be456=0x0;_0x8be456<=_0x4538a2['length']-0x2*_0x4cfd1c;_0x8be456++){const _0x13c0be=_0x4538a2[_0x186e20(0xfc)](_0x8be456,_0x8be456+_0x4cfd1c),_0x553662=_0x4538a2[_0x186e20(0xfc)](_0x8be456+_0x4cfd1c,_0x8be456+0x2*_0x4cfd1c);if(_0x13c0be[_0x186e20(0x17c)]((_0x312446,_0x213a3c)=>_0x312446===_0x553662[_0x213a3c])){const _0x43b589=[..._0x4538a2[_0x186e20(0xfc)](0x0,_0x8be456),..._0x4538a2[_0x186e20(0xfc)](_0x8be456+_0x4cfd1c)];return a0_0x36dc60[_0x186e20(0x13f)]+_0x43b589['join'](a0_0x36dc60['sep']);}}}return null;}function runWarpGrepWithSearchRequest(_0x3cbf12){const _0x43c288=a0_0x31e8,_0x59b4a={'repoRoot':_0x3cbf12[_0x43c288(0x172)],'morphApiKey':_0x3cbf12['morphApiKey'],'morphApiUrl':_0x3cbf12[_0x43c288(0x165)],'timeout':_0x3cbf12[_0x43c288(0x176)],'provider':_0x3cbf12[_0x43c288(0x100)],'search_type':_0x3cbf12[_0x43c288(0x1a4)]};return _0x59b4a[String[_0x43c288(0x195)](0x73,0x65,0x61,0x72,0x63,0x68,0x54,0x65,0x72,0x6d)]=_0x3cbf12[_0x43c288(0x1a2)],runWarpGrep(_0x59b4a);}function searchGitHubWithSearchRequest(_0x5e1483,_0x3d3bf4){const _0x1b675e=a0_0x31e8,_0x29ab62={'github':_0x3d3bf4[_0x1b675e(0x136)],'branch':_0x3d3bf4[_0x1b675e(0x1cb)]};return _0x29ab62[String[_0x1b675e(0x195)](0x73,0x65,0x61,0x72,0x63,0x68,0x54,0x65,0x72,0x6d)]=_0x3d3bf4[_0x1b675e(0x1a2)],_0x29ab62[String[_0x1b675e(0x195)](0x71,0x75,0x65,0x72,0x79)]=_0x3d3bf4[_0x1b675e(0x1a2)],_0x5e1483[_0x1b675e(0x1a7)](_0x29ab62);}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x5b194c=a0_0x31e8;try{const _0x1160ec=require(_0x5b194c(0x102));return _0x1160ec[_0x5b194c(0x174)]??_0x5b194c(0x1a3);}catch(_0xb01923){return logMcpStderr(_0x5b194c(0x1d7),_0xb01923),_0x5b194c(0x1a3);}}function printHelp(){const _0x533369=a0_0x31e8;console[_0x533369(0x173)](_0x533369(0x109)+getPackageVersion()),console['log'](_0x533369(0x122)),console[_0x533369(0x173)](_0x533369(0x1b0)),console[_0x533369(0x173)](_0x533369(0x18c)),console[_0x533369(0x173)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x533369(0x173)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x533369(0x173)](_0x533369(0x148)),console[_0x533369(0x173)]('\x20\x20morph-mcp'),console[_0x533369(0x173)](_0x533369(0x12d));}const cliArgs=process[a0_0x487fa1(0x175)][a0_0x487fa1(0xfc)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x487fa1(0x12b),'-h']);cliArgs[a0_0x487fa1(0x140)](_0x2773b9=>VERSION_FLAGS['has'](_0x2773b9))&&(console[a0_0x487fa1(0x173)]('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x487fa1(0x14e)](0x0));cliArgs['some'](_0x272897=>HELP_FLAGS[a0_0x487fa1(0x149)](_0x272897))&&(printHelp(),process[a0_0x487fa1(0x14e)](0x0));function getCliArg(_0x311149){const _0x51b301=a0_0x487fa1;for(let _0x2ad845=0x0;_0x2ad845<cliArgs[_0x51b301(0x16f)];_0x2ad845++){const _0x27b7f7=cliArgs[_0x2ad845];if(_0x27b7f7[_0x51b301(0x17d)]('--'+_0x311149+'='))return _0x27b7f7[_0x51b301(0xfc)](('--'+_0x311149+'=')[_0x51b301(0x16f)]);if(_0x27b7f7==='--'+_0x311149&&_0x2ad845+0x1<cliArgs[_0x51b301(0x16f)])return cliArgs[_0x2ad845+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x487fa1(0x16f)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x487fa1(0x149)](arg)||HELP_FLAGS[a0_0x487fa1(0x149)](arg))continue;if(arg[a0_0x487fa1(0x17d)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x487fa1(0xed)](arg);}const WORKSPACE_ROOT=process[a0_0x487fa1(0x167)][a0_0x487fa1(0x110)]||process[a0_0x487fa1(0x167)][a0_0x487fa1(0x144)]||process[a0_0x487fa1(0x191)](),ENABLE_WORKSPACE_MODE=process['env']['ENABLE_WORKSPACE_MODE']!==a0_0x487fa1(0x1ca),MORPH_API_KEY=getCliArg(a0_0x487fa1(0x18b))??process[a0_0x487fa1(0x167)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x487fa1(0x167)][a0_0x487fa1(0x1ab)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x487fa1(0x167)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process['env'][a0_0x487fa1(0x1c5)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x487fa1(0x16a),a0_0x487fa1(0x1bc),a0_0x487fa1(0x1c8),'codebase_search']),DISABLED_TOOLS=process[a0_0x487fa1(0x167)][a0_0x487fa1(0x13a)]?new Set(process[a0_0x487fa1(0x167)][a0_0x487fa1(0x13a)][a0_0x487fa1(0x15f)](',')[a0_0x487fa1(0x119)](_0x1adfe9=>_0x1adfe9['trim']())[a0_0x487fa1(0x18d)](_0x3123ff=>_0x3123ff['length']>0x0)):new Set();if(DISABLED_TOOLS[a0_0x487fa1(0x171)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x487fa1(0x128)](a0_0x487fa1(0x160)+tool+a0_0x487fa1(0x196)+[...KNOWN_TOOL_NAMES][a0_0x487fa1(0x10a)](',\x20'));}console[a0_0x487fa1(0x128)](a0_0x487fa1(0x198)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x487fa1(0x17d)](a0_0x487fa1(0x199))&&!MORPH_API_KEY[a0_0x487fa1(0x17d)](a0_0x487fa1(0x11d))&&logMcpStderr(a0_0x487fa1(0x1af));async function reportMorphError(_0x4871d1){const _0x267f50=a0_0x487fa1;try{await a0_0x4200e4['post'](_0x267f50(0x16c),{..._0x4871d1,'timestamp':new Date()['toISOString'](),'source':_0x4871d1[_0x267f50(0x1b1)]||_0x267f50(0x181),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4871d1[_0x267f50(0x1a0)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x267f50(0x158),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x487fa1(0x16f)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x487fa1(0x166)),logMcpStderr(a0_0x487fa1(0x19e)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x487fa1(0x13c)));function a0_0x22d5(){const _0x2d5fc1=['\x22.\x20Known\x20tools:\x20','stack','Disabled\x20tools:\x20','sk-','params','catch','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','code_edit','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','context','instruction','searchRequest','unknown','search_type','Warning:\x20','Preview\x20changes\x20without\x20applying\x20them.','searchGitHub','SymlinkError','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Fatal\x20error\x20running\x20server:','MORPH_API_URL','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','lines','Morph\x20Edit\x20Preview','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','\x0aOptions:','source','files','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','ReadError','ms:','codebase_search','match','\x20chars)','data','.\x20Changes:\x20','0.2.0','warpgrep_codebase_search','[warpgrep_github_search]\x20Done\x20in\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','array','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','listRoots','added\x20','content','isArray','MORPH_WARP_GREP_TIMEOUT','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','warpgrep_github_search','.\x20Path:\x20','false','branch','.git','linesModified','name','Cargo.toml','\x0a</file>','222iRYkCp','grep','indexOf','Tool\x20\x22','object','messages','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','BinaryFile','9DoNhZp','terminationReason','\x20disabled\x20via\x20DISABLED_TOOLS','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','composer.json','resolve','optional','\x0a...\x20(truncated,\x20total:\x20','includes','role','linesRemoved','-\x20Grepped\x20\x27','completed','enum','terminated','pyproject.toml','text','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.','etimedout','Rules:\x0a','inputSchema','FileNotFound','930915QBNoix','\x20-\x20','node_modules','default','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Applied','push','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','go.mod','now','dryRun','-\x20Read\x20file\x20`','[warpgrep_github_search]\x20Searching\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','basename','setNotificationHandler','number','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Error:\x20','Failed\x20to\x20read\x20file:\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','slice','.vscode','code','constructor','provider','Invalid\x20arguments:\x20','../package.json','34916cWTEMc','describe','readFile','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','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x20for:\x20\x22','@morphllm/morphmcp\x20','join','normalize','Error\x20accessing\x20directory\x20','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','timings','115YfJJgg','WORKSPACE_ROOT','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','1207696KClxgr','setRequestHandler','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','</file>','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Specific\x20commit\x20hash\x20to\x20search','ms.\x20Success:\x20','map','14PYgWei','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','RipgrepError','morph-','Unknown\x20tool:\x20','1915674IEsqGp',',\x20removed\x20','\x20valid\x20directories','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','UnknownError','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','roots','error','3180243rzMoul','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','--help','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','2265WyQutm','ENOENT','changes','❌\x20Morph\x20Edit\x20Failed:\x20','Natural\x20language\x20query\x20to\x20search\x20for\x20code','\x27\x20in\x20`','tsconfig.json','realpath','github','File\x20read\x20error:','.cursor','path','DISABLED_TOOLS','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Tool\x20','trim','sep','some','grep\x20\x27','WarpGrep\x20sub-tool\x20errors:\x20','all','PWD','search_string','finish','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','\x0aExamples:','has','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','morph-v3-fast','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','linesAdded','exit','floor','user','repo_path',',\x20modified\x20','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22\x20Bad\x20example:\x20\x22auth()\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keywords,\x20or\x20symbol-only\x20queries.','3313640qwBccU','isDirectory','\x20as\x20allowed\x20directory','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','application/json','message','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','metadata','Max\x20results\x20to\x20return','requiresApiKey','Morph\x20FastApply\x20failed\x20without\x20error\x20message','split','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Failed\x20to\x20request\x20roots\x20from\x20client:','homedir','timed\x20out','morphApiUrl','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','env','\x22>\x0aError\x20reading\x20file:\x20','Workspace\x20mode\x20enabled:\x20Using\x20','edit_file','dirname','https://morphllm.com/api/error-report','read','\x20error(s)','length','boolean','size','repoRoot','log','version','argv','timeout','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','string','morph-warp-grep-v1-1111v0','toLowerCase','every','startsWith','TimeoutError','success','PathError','mcp-filesystem','github_url','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','safeParse','assistant','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','FileReadError','Warning:\x20Workspace\x20fallback\x20failed:\x20','stat','api-key','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','filter','errors','list_directory\x20','connect','cwd','Fallback:\x20Using\x20workspace\x20root\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','<file\x20path=\x22','fromCharCode'];a0_0x22d5=function(){return _0x2d5fc1;};return a0_0x22d5();}function normalizePath(_0x55a65c){const _0x1ca159=a0_0x487fa1;return a0_0x36dc60[_0x1ca159(0x10b)](_0x55a65c);}function expandHome(_0xeef3ba){const _0x394451=a0_0x487fa1;if(_0xeef3ba[_0x394451(0x17d)]('~/')||_0xeef3ba==='~')return a0_0x36dc60['join'](a0_0x521542[_0x394451(0x163)](),_0xeef3ba[_0x394451(0xfc)](0x1));return _0xeef3ba;}let allowedDirectories=await Promise[a0_0x487fa1(0x143)](args[a0_0x487fa1(0x119)](async _0x31351=>{const _0x59f1f4=a0_0x487fa1,_0xa639ad=expandHome(_0x31351),_0x19c07c=a0_0x36dc60['resolve'](_0xa639ad);try{const _0x1d61e4=await a0_0x4d8b09[_0x59f1f4(0x135)](_0x19c07c);return normalizePath(_0x1d61e4);}catch(_0x55efd6){return normalizePath(_0x19c07c);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x487fa1(0x169)+workspaceDir+a0_0x487fa1(0x156)));}catch(a0_0x5c881d){logMcpStderr(a0_0x487fa1(0x183)+a0_0x5c881d);}async function detectWorkspaceRoot(_0x25e561){const _0x118707=a0_0x487fa1;let _0x3d82f6=a0_0x36dc60[_0x118707(0x1de)](_0x25e561);const _0x534914=[_0x118707(0x1cc),_0x118707(0xfd),'package.json',_0x118707(0x1cf),_0x118707(0xe0),_0x118707(0xef),_0x118707(0x138),_0x118707(0x134),_0x118707(0x1dd)];while(_0x3d82f6!==a0_0x36dc60[_0x118707(0x16b)](_0x3d82f6)){for(const _0x45f05e of _0x534914){const _0xbcc48d=a0_0x36dc60[_0x118707(0x10a)](_0x3d82f6,_0x45f05e);try{return await a0_0x4d8b09['access'](_0xbcc48d),normalizePath(_0x3d82f6);}catch{}}_0x3d82f6=a0_0x36dc60[_0x118707(0x16b)](_0x3d82f6);}return normalizePath(_0x25e561);}await Promise[a0_0x487fa1(0x143)](args[a0_0x487fa1(0x119)](async _0x2d2aad=>{const _0x43ebe2=a0_0x487fa1;try{const _0x200492=await a0_0x4d8b09[_0x43ebe2(0x18a)](expandHome(_0x2d2aad));!_0x200492[_0x43ebe2(0x155)]()&&(logMcpStderr(_0x43ebe2(0xf9)+_0x2d2aad+'\x20is\x20not\x20a\x20directory'),process[_0x43ebe2(0x14e)](0x1));}catch(_0x5d7041){logMcpStderr(_0x43ebe2(0x10c)+_0x2d2aad+':',_0x5d7041),process[_0x43ebe2(0x14e)](0x1);}}));function a0_0x31e8(_0x57e89c,_0x574baa){_0x57e89c=_0x57e89c-0xdd;const _0x22d525=a0_0x22d5();let _0x31e8b8=_0x22d525[_0x57e89c];return _0x31e8b8;}async function validatePath(_0x3c895a){const _0x1a8c00=a0_0x487fa1,_0x51175d=expandHome(_0x3c895a),_0x5ef0dc=a0_0x36dc60['resolve'](_0x51175d);try{const _0x5702d5=await a0_0x4d8b09['realpath'](_0x5ef0dc);return _0x5702d5;}catch(_0x55f22b){if(_0x55f22b[_0x1a8c00(0xfe)]===_0x1a8c00(0x12f)){const _0x25af18=a0_0x36dc60[_0x1a8c00(0x16b)](_0x5ef0dc);try{const _0x132250=await a0_0x4d8b09[_0x1a8c00(0x135)](_0x25af18);return a0_0x36dc60[_0x1a8c00(0x10a)](_0x132250,a0_0x36dc60[_0x1a8c00(0xf5)](_0x5ef0dc));}catch{throw new Error(_0x1a8c00(0x124)+_0x25af18);}}throw _0x55f22b;}}const MorphEditFileArgsSchema=z[a0_0x487fa1(0x1d5)]({'path':z[a0_0x487fa1(0x179)](),'code_edit':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x104)](a0_0x487fa1(0x19c)),'instruction':z[a0_0x487fa1(0x179)]()['describe']('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0x487fa1(0x170)]()[a0_0x487fa1(0xea)](![])[a0_0x487fa1(0x104)](a0_0x487fa1(0x1a6))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x487fa1(0x153),WarpGrepArgsSchema=z[a0_0x487fa1(0x1d5)]({'search_string':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x104)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x104)](a0_0x487fa1(0x106)),'search_type':z[a0_0x487fa1(0xde)]([a0_0x487fa1(0xea),a0_0x487fa1(0xe9)])[a0_0x487fa1(0x1df)]()['describe']('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x487fa1(0x1d5)]({'search_string':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x104)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'github_url':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x1df)]()[a0_0x487fa1(0x104)](a0_0x487fa1(0x11b)),'owner_repo':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x1df)]()[a0_0x487fa1(0x104)](a0_0x487fa1(0x193)),'branch':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x1df)]()[a0_0x487fa1(0x104)](a0_0x487fa1(0x1b3))}),CodebaseSearchArgsSchema=z[a0_0x487fa1(0x1d5)]({'query':z[a0_0x487fa1(0x179)]()[a0_0x487fa1(0x104)](a0_0x487fa1(0x132)),'repoId':z['string']()[a0_0x487fa1(0x104)]('Repository\x20identifier'),'branch':z[a0_0x487fa1(0x179)]()['optional']()[a0_0x487fa1(0x104)](a0_0x487fa1(0x15a)),'commitHash':z['string']()[a0_0x487fa1(0x1df)]()['describe'](a0_0x487fa1(0x117)),'targetDirectories':z[a0_0x487fa1(0x1bf)](z[a0_0x487fa1(0x179)]())[a0_0x487fa1(0xea)]([])['describe'](a0_0x487fa1(0x1c6)),'limit':z[a0_0x487fa1(0xf7)]()[a0_0x487fa1(0x1df)]()['default'](0xa)['describe'](a0_0x487fa1(0x15c))}),server=new Server({'name':'morph-mcp','version':a0_0x487fa1(0x1bb)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x3ba57f=a0_0x487fa1,_0x12f692=[{'name':'edit_file','description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x3ba57f(0x157)+_0x3ba57f(0x147)+'Benefits:\x0a'+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x3ba57f(0x178)+_0x3ba57f(0x1be)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+_0x3ba57f(0x1ac)+_0x3ba57f(0x116)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+'For\x20deletions:\x0a'+_0x3ba57f(0x125)+_0x3ba57f(0x186)+_0x3ba57f(0xe4)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x3ba57f(0x177)+_0x3ba57f(0x1dc)+_0x3ba57f(0xeb)+_0x3ba57f(0xfb)+_0x3ba57f(0x1c7)+_0x3ba57f(0x10d),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x3ba57f(0x1c0)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3ba57f(0x187)+_0x3ba57f(0x14c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x160aa3=_0x12f692['filter'](_0x5d89cf=>{const _0x59d81d=_0x3ba57f;if(DISABLED_TOOLS[_0x59d81d(0x149)](_0x5d89cf['name']))return console[_0x59d81d(0x128)](_0x59d81d(0x13d)+_0x5d89cf[_0x59d81d(0x1ce)]+_0x59d81d(0x1db)),![];if(_0x59d81d(0x15d)in _0x5d89cf&&_0x5d89cf[_0x59d81d(0x15d)]&&!MORPH_API_KEY)return logMcpStderr(_0x59d81d(0x1a5)+_0x5d89cf[_0x59d81d(0x1ce)]+_0x59d81d(0x114)),![];return!![];});return{'tools':_0x160aa3['map'](_0x5362e5=>({'name':_0x5362e5[_0x3ba57f(0x1ce)],'description':_0x5362e5['description'],'inputSchema':_0x5362e5[_0x3ba57f(0xe5)]}))};}),server[a0_0x487fa1(0x113)](CallToolRequestSchema,async _0x16b17b=>{const _0x34f97a=a0_0x487fa1,{name:_0x13db57,arguments:_0x3cc748}=_0x16b17b[_0x34f97a(0x19a)];try{if(DISABLED_TOOLS[_0x34f97a(0x149)](_0x13db57))throw new Error(_0x34f97a(0x1d4)+_0x13db57+'\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable');switch(_0x13db57){case _0x34f97a(0x16a):{const _0x3920c2=MorphEditFileArgsSchema[_0x34f97a(0x184)](_0x3cc748);if(!_0x3920c2[_0x34f97a(0x17f)])throw new Error(_0x34f97a(0x14a)+_0x3920c2['error']);const _0x1cfa21=await validatePath(_0x3920c2['data'][_0x34f97a(0x139)]);let _0x597869=null,_0x5668b4=!![],_0x2217ae=null;try{_0x597869=await a0_0x4d8b09['readFile'](_0x1cfa21,'utf-8');}catch(_0x22c965){const _0x1dabf0=_0x22c965[_0x34f97a(0xfe)];_0x1dabf0===_0x34f97a(0x12f)?(_0x5668b4=![],_0x597869=''):(_0x2217ae=_0x34f97a(0xfa)+(_0x1dabf0||_0x34f97a(0x1a3))+_0x34f97a(0xe8)+(_0x22c965 instanceof Error?_0x22c965['message']:String(_0x22c965)),logMcpStderr(_0x34f97a(0x1a5)+_0x2217ae));}let _0x1811f9;try{const _0x149d02=MORPH_API_KEY;if(!_0x149d02)throw new Error(_0x34f97a(0xf4));const _0x4d66ed=a0_0x36dc60[_0x34f97a(0x16b)](_0x1cfa21),_0x551892=a0_0x36dc60[_0x34f97a(0xf5)](_0x1cfa21),_0x8a97bc=await executeEditFile({'target_filepath':_0x551892,'code_edit':_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0x19d)],'instructions':_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0x1a1)]},{'morphApiKey':_0x149d02,'morphApiUrl':MORPH_API_URL,'baseDir':_0x4d66ed,'autoWrite':!_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0xf1)],'generateUdiff':![],'debug':![]});_0x1811f9=_0x8a97bc['completionId'];if(!_0x8a97bc[_0x34f97a(0x17f)])throw new Error(_0x8a97bc[_0x34f97a(0x128)]||_0x34f97a(0x15e));const _0x5b6865=_0x8a97bc[_0x34f97a(0x130)],_0x553bcf=_0x34f97a(0x1c2)+_0x5b6865[_0x34f97a(0x14d)]+_0x34f97a(0x120)+_0x5b6865[_0x34f97a(0x1e3)]+_0x34f97a(0x152)+_0x5b6865[_0x34f97a(0x1cd)];if(_0x3920c2['data'][_0x34f97a(0xf1)])return{'content':[{'type':_0x34f97a(0xe1),'text':_0x34f97a(0x1ae)+(_0x5668b4?'':'\x20(new\x20file)')+':\x20'+_0x3920c2['data']['instruction']+_0x34f97a(0x1ba)+_0x553bcf+_0x34f97a(0x1c9)+_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0x139)]+'.'}]};return{'content':[{'type':'text','text':'Morph\x20Edit\x20'+(_0x5668b4?_0x34f97a(0xec):'Created\x20File')+':\x20'+_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0x1a1)]+'.\x20Changes:\x20'+_0x553bcf+_0x34f97a(0x1c9)+_0x3920c2['data']['path']+'.'}]};}catch(_0x120fb0){const _0x1324bf=_0x120fb0 instanceof Error?_0x120fb0['message']:String(_0x120fb0);return reportMorphError({'error_message':_0x1324bf,'error_type':_0x120fb0 instanceof Error?_0x120fb0['constructor'][_0x34f97a(0x1ce)]:_0x34f97a(0x123),'context':{'tool':_0x34f97a(0x16a),'completion_id':_0x1811f9,'file_path':_0x3920c2['data'][_0x34f97a(0x139)],'validated_path':_0x1cfa21,'instruction':_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0x1a1)],'model':_0x34f97a(0x14b),'dry_run':_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0xf1)],'file_exists':_0x5668b4,'file_read_error':_0x2217ae,'file_readable':_0x597869!==null,'request_content':{'path':_0x3920c2[_0x34f97a(0x1b9)][_0x34f97a(0x139)],'code_edit':_0x3920c2['data'][_0x34f97a(0x19d)],'instruction':_0x3920c2['data']['instruction'],'original_code':_0x597869!==null?_0x597869['length']>0xc350?_0x597869['substring'](0x0,0xc350)+_0x34f97a(0x1e0)+_0x597869[_0x34f97a(0x16f)]+_0x34f97a(0x1b8):_0x597869:'[could\x20not\x20read\x20file:\x20'+(_0x2217ae||'unknown\x20error')+']','original_code_length':_0x597869?.['length']??0x0,'model':_0x34f97a(0x14b),'dry_run':_0x3920c2['data'][_0x34f97a(0xf1)]}},'stack_trace':_0x120fb0 instanceof Error?_0x120fb0['stack']:undefined,'source':_0x34f97a(0x181)})[_0x34f97a(0x19b)](()=>{}),{'content':[{'type':'text','text':_0x34f97a(0x131)+_0x1324bf}],'isError':!![]};}}case _0x34f97a(0x1b6):{const _0x16d6fe=WarpGrepArgsSchema['safeParse'](_0x3cc748);if(!_0x16d6fe[_0x34f97a(0x17f)])return{'content':[{'type':_0x34f97a(0xe1),'text':_0x34f97a(0x101)+_0x16d6fe[_0x34f97a(0x128)]}],'isError':!![]};const _0x1fa086=_0x3fb245=>{const _0x2c5fa6=_0x34f97a,_0x2ef7fc=[];for(const _0x48498d of _0x3fb245||[]){const _0x3c256b=_0x48498d[_0x2c5fa6(0x1e2)],_0x10e41c=_0x48498d['content'];if(_0x3c256b===_0x2c5fa6(0x185)&&_0x10e41c){const _0x2da8c6=_0x10e41c[_0x2c5fa6(0x15f)]('\x0a')['filter'](_0x23f8d1=>_0x23f8d1[_0x2c5fa6(0x13e)]());for(const _0x584858 of _0x2da8c6){const _0x1687e0=_0x584858[_0x2c5fa6(0x1b7)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1687e0){_0x2ef7fc['push'](_0x2c5fa6(0x141)+_0x1687e0[0x1]+'\x27\x20'+_0x1687e0[0x2]);continue;}const _0x18bfe8=_0x584858[_0x2c5fa6(0x1b7)](/^read\s+(.+)$/);if(_0x18bfe8){_0x2ef7fc[_0x2c5fa6(0xed)]('read\x20'+_0x18bfe8[0x1]);continue;}const _0x47b46e=_0x584858['match'](/^list_directory\s+(.+)$/);if(_0x47b46e){_0x2ef7fc[_0x2c5fa6(0xed)](_0x2c5fa6(0x18f)+_0x47b46e[0x1]);continue;}}}}return _0x2ef7fc;},_0x5101c0=_0x375aab=>{const _0x45d0de=_0x34f97a,_0x42c1cf=[];if(!_0x375aab||!Array[_0x45d0de(0x1c4)](_0x375aab))return _0x42c1cf;const _0x7b1777=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x45d0de(0xe6),'tool':_0x45d0de(0x16d)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x45d0de(0x180),'tool':_0x45d0de(0x16d)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x45d0de(0x16d)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x45d0de(0x1d8),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x45d0de(0x11c),'tool':_0x45d0de(0x1d2)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x45d0de(0x1a8),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x45d0de(0x1d8),'tool':'read'},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x45d0de(0x16d)},{'pattern':/Error reading file:/,'error_type':_0x45d0de(0x1b4),'tool':'read'},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x45d0de(0x1a3)}];let _0x3f8cdf=0x0;for(const _0x10cb9a of _0x375aab){if(_0x10cb9a[_0x45d0de(0x1e2)]===_0x45d0de(0x150)){_0x3f8cdf++;const _0x2a0023=_0x10cb9a[_0x45d0de(0x1c3)];if(!_0x2a0023||typeof _0x2a0023!=='string')continue;for(const {pattern:_0x15032a,error_type:_0x4b2cdc,tool:_0x3379aa}of _0x7b1777){const _0x200a2c=_0x2a0023['match'](new RegExp(_0x15032a[_0x45d0de(0x1b1)],'g'));if(_0x200a2c)for(const _0x25f9ee of _0x200a2c){const _0x38ed41=_0x2a0023[_0x45d0de(0x1d3)](_0x25f9ee),_0x541b35=_0x2a0023['substring'](_0x38ed41,Math['min'](_0x38ed41+0xc8,_0x2a0023['length']));_0x42c1cf[_0x45d0de(0xed)]({'tool':_0x3379aa,'error_type':_0x4b2cdc,'error_message':_0x541b35[_0x45d0de(0x15f)]('\x0a')[0x0],'turn':_0x3f8cdf});}}}}return _0x42c1cf;};try{const _0x5f0dd2=a0_0x36dc60[_0x34f97a(0x1de)](_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)]),_0x2c2dd6=_0x16d6fe['data'][_0x34f97a(0x1a4)],_0x5783f0=_0x2c2dd6===_0x34f97a(0xe9)?{'allowNames':[_0x34f97a(0xe9)]}:undefined,_0x33a7a8=new LocalRipgrepProvider(_0x5f0dd2,undefined,_0x5783f0),_0x3e1812=await runWarpGrepWithSearchRequest({'searchRequest':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x145)],'repoRoot':_0x5f0dd2,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x33a7a8,'search_type':_0x2c2dd6}),_0x4914fb=_0x5101c0(_0x3e1812[_0x34f97a(0x1d6)]);_0x4914fb[_0x34f97a(0x16f)]>0x0&&reportMorphError({'error_message':_0x34f97a(0x142)+_0x4914fb[_0x34f97a(0x16f)]+_0x34f97a(0x16e),'error_type':'SubToolError','level':'warn','tool':_0x34f97a(0x1b6),'context':{'repo_path':_0x16d6fe[_0x34f97a(0x1b9)]['repo_path'],'query':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x145)],'model':_0x34f97a(0x17a),'termination_reason':_0x3e1812[_0x34f97a(0x1da)],'sub_tool_errors':_0x4914fb,'timings':_0x3e1812[_0x34f97a(0x10e)],'tool_calls':_0x1fa086(_0x3e1812[_0x34f97a(0x1d6)]),'messages':_0x3e1812[_0x34f97a(0x1d6)]?.['map'](_0x4a1d4e=>({'role':_0x4a1d4e[_0x34f97a(0x1e2)],'content':_0x4a1d4e[_0x34f97a(0x1c3)]}))},'source':'mcp-filesystem'})[_0x34f97a(0x19b)](()=>{});let _0x57f032='';if(_0x3e1812[_0x34f97a(0x1da)]===_0x34f97a(0xdd)&&_0x3e1812[_0x34f97a(0x146)]?.[_0x34f97a(0x15b)]?.[_0x34f97a(0x1b2)]){const _0x5753c4=_0x3e1812[_0x34f97a(0x146)]['metadata'][_0x34f97a(0x1b2)];if(_0x5753c4['length']===0x0)return _0x57f032=_0x3e1812['finish']['payload']||_0x34f97a(0xee),{'content':[{'type':_0x34f97a(0xe1),'text':_0x57f032}]};const _0x3420fb=[],_0x3c0572=[_0x34f97a(0x111)];for(const _0xd9a28e of _0x3e1812[_0x34f97a(0x1d6)]){const _0x2e0d59=_0xd9a28e[_0x34f97a(0x1e2)],_0x5b9e9a=_0xd9a28e[_0x34f97a(0x1c3)];if(_0x2e0d59===_0x34f97a(0x185)&&_0x5b9e9a){const _0x1fea18=_0x5b9e9a[_0x34f97a(0x15f)]('\x0a')[_0x34f97a(0x18d)](_0x17a066=>_0x17a066[_0x34f97a(0x13e)]());for(const _0x2f6925 of _0x1fea18){const _0x385fa1=_0x2f6925[_0x34f97a(0x1b7)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x385fa1){_0x3c0572[_0x34f97a(0xed)](_0x34f97a(0x1e4)+_0x385fa1[0x1]+_0x34f97a(0x133)+_0x385fa1[0x2]+'`');continue;}const _0x614c1c=_0x2f6925[_0x34f97a(0x1b7)](/^read\s+(.+)$/);if(_0x614c1c){_0x3c0572[_0x34f97a(0xed)](_0x34f97a(0xf2)+_0x614c1c[0x1]+'`');continue;}const _0x32549c=_0x2f6925[_0x34f97a(0x1b7)](/^list_directory\s+(.+)$/);if(_0x32549c){_0x3c0572[_0x34f97a(0xed)]('-\x20Listed\x20directory\x20`'+_0x32549c[0x1]+'`');continue;}}}}_0x3420fb[_0x34f97a(0xed)](_0x3c0572[_0x34f97a(0x10a)]('\x0a'));const _0x32e3bb=['','Relevant\x20context\x20found:'];for(const _0x1769a3 of _0x5753c4){if(_0x1769a3[_0x34f97a(0x1ad)]==='*')_0x32e3bb[_0x34f97a(0xed)]('-\x20'+_0x1769a3[_0x34f97a(0x139)]+':*');else{if(Array['isArray'](_0x1769a3['lines'])){const _0x4df667=_0x1769a3[_0x34f97a(0x1ad)]['map'](([_0x328cb0,_0x1099d3])=>{if(_0x328cb0===_0x1099d3)return''+_0x328cb0;return _0x328cb0+'-'+_0x1099d3;});_0x32e3bb[_0x34f97a(0xed)]('-\x20'+_0x1769a3[_0x34f97a(0x139)]+':'+_0x4df667['join'](','));}else _0x32e3bb[_0x34f97a(0xed)]('-\x20'+_0x1769a3[_0x34f97a(0x139)]+':*');}}_0x32e3bb[_0x34f97a(0xed)](''),_0x3420fb[_0x34f97a(0xed)](_0x32e3bb[_0x34f97a(0x10a)]('\x0a')),_0x3420fb[_0x34f97a(0xed)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x19f44a=[];for(const _0x4771f9 of _0x5753c4){let _0x1fcb57=a0_0x36dc60[_0x34f97a(0x1de)](_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)],_0x4771f9[_0x34f97a(0x139)]),_0x3ff95c=null,_0x1e57f4=null;try{_0x3ff95c=await a0_0x4d8b09[_0x34f97a(0x105)](_0x1fcb57,{'encoding':'utf-8'});}catch(_0x1dbd96){const _0x41a434=fixPathRepetition(_0x1fcb57);if(_0x41a434)try{_0x3ff95c=await a0_0x4d8b09[_0x34f97a(0x105)](_0x41a434,{'encoding':'utf-8'}),_0x1fcb57=_0x41a434;}catch{_0x1e57f4=_0x1dbd96 instanceof Error?_0x1dbd96:new Error(String(_0x1dbd96));}else _0x1e57f4=_0x1dbd96 instanceof Error?_0x1dbd96:new Error(String(_0x1dbd96));}if(_0x3ff95c!==null){const _0x53c915=_0x3ff95c['split'](/\r?\n/),_0x48ecc7=[_0x34f97a(0x194)+_0x4771f9[_0x34f97a(0x139)]+'\x22>'];if(_0x4771f9[_0x34f97a(0x1ad)]==='*'||!Array[_0x34f97a(0x1c4)](_0x4771f9[_0x34f97a(0x1ad)]))for(let _0x109c1c=0x1;_0x109c1c<=_0x53c915[_0x34f97a(0x16f)];_0x109c1c++){const _0x5026ff=_0x53c915[_0x109c1c-0x1];_0x48ecc7[_0x34f97a(0xed)](_0x109c1c+'|\x20'+_0x5026ff);}else for(const [_0x1709c8,_0x2562b4]of _0x4771f9['lines']){_0x48ecc7['length']>0x1&&_0x48ecc7[_0x34f97a(0xed)]('');for(let _0x5474c7=_0x1709c8;_0x5474c7<=_0x2562b4&&_0x5474c7<=_0x53c915['length'];_0x5474c7++){const _0x1b6aa4=_0x53c915[_0x5474c7-0x1];_0x48ecc7[_0x34f97a(0xed)](_0x5474c7+'|\x20'+_0x1b6aa4);}}_0x48ecc7[_0x34f97a(0xed)](_0x34f97a(0x115)),_0x19f44a[_0x34f97a(0xed)](_0x48ecc7['join']('\x0a'));}else _0x19f44a[_0x34f97a(0xed)](_0x34f97a(0x194)+_0x4771f9['path']+_0x34f97a(0x168)+(_0x1e57f4?.[_0x34f97a(0x159)]||'Unknown\x20error')+_0x34f97a(0x1d0));}_0x3420fb['push'](_0x19f44a[_0x34f97a(0x10a)]('\x0a\x0a')),_0x57f032=_0x3420fb[_0x34f97a(0x10a)]('\x0a');const _0x426227=_0x3e1812[_0x34f97a(0x18e)]?.['filter'](_0x5c5426=>_0x5c5426[_0x34f97a(0x159)]?.[_0x34f97a(0x17d)](_0x34f97a(0x137)))||[];if(_0x426227[_0x34f97a(0x16f)]>0x0){const _0x3e8356=_0x426227[_0x34f97a(0x119)](_0x504582=>_0x504582[_0x34f97a(0x159)])[_0x34f97a(0x10a)](';\x20');reportMorphError({'error_message':_0x3e8356,'error_type':_0x34f97a(0x188),'context':{'tool':'codebase_search','repo_path':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)],'query':_0x16d6fe[_0x34f97a(0x1b9)]['search_string'],'model':_0x34f97a(0x17a),'termination_reason':'completed_with_file_errors','error_count':_0x426227[_0x34f97a(0x16f)],'is_timeout':![],'timings':_0x3e1812[_0x34f97a(0x10e)],'files_attempted':_0x5753c4[_0x34f97a(0x119)](_0xc0f159=>({'path':_0xc0f159['path'],'lines':_0xc0f159[_0x34f97a(0x1ad)]})),'tool_calls':_0x1fa086(_0x3e1812[_0x34f97a(0x1d6)]),'messages':_0x3e1812[_0x34f97a(0x1d6)]?.[_0x34f97a(0x119)](_0x5da345=>({'role':_0x5da345[_0x34f97a(0x1e2)],'content':_0x5da345[_0x34f97a(0x1c3)]})),'request_content':{'query':_0x16d6fe['data'][_0x34f97a(0x145)],'repo_path':_0x16d6fe['data'][_0x34f97a(0x151)],'repoRoot':a0_0x36dc60['resolve'](_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)]),'model':_0x34f97a(0x17a)}},'source':_0x34f97a(0x181)})[_0x34f97a(0x19b)](()=>{});}}else{if(_0x3e1812[_0x34f97a(0x1da)]===_0x34f97a(0xdf)&&_0x3e1812[_0x34f97a(0x18e)]['length']>0x0){const _0x44f9e9=_0x3e1812[_0x34f97a(0x18e)]['map'](_0x51082a=>_0x51082a[_0x34f97a(0x159)])[_0x34f97a(0x10a)](';\x20');_0x57f032=_0x34f97a(0xf9)+_0x44f9e9;const _0x1fa17f=_0x44f9e9[_0x34f97a(0x17b)]()[_0x34f97a(0x1e1)]('timeout')||_0x44f9e9[_0x34f97a(0x17b)]()['includes'](_0x34f97a(0x164))||_0x44f9e9[_0x34f97a(0x17b)]()[_0x34f97a(0x1e1)](_0x34f97a(0xe3)),_0x3a9afd=_0x3e1812[_0x34f97a(0x146)]?.[_0x34f97a(0x15b)]?.[_0x34f97a(0x1b2)],_0x1dd180=_0x3e1812[_0x34f97a(0x18e)][0x0];reportMorphError({'error_message':_0x44f9e9,'error_type':_0x1fa17f?_0x34f97a(0x17e):_0x1dd180?.[_0x34f97a(0xff)]?.['name']||'WarpGrepError','context':{'tool':_0x34f97a(0x1b6),'repo_path':_0x16d6fe['data'][_0x34f97a(0x151)],'query':_0x16d6fe['data'][_0x34f97a(0x145)],'model':_0x34f97a(0x17a),'termination_reason':_0x3e1812[_0x34f97a(0x1da)],'error_count':_0x3e1812[_0x34f97a(0x18e)][_0x34f97a(0x16f)],'is_timeout':_0x1fa17f,'timings':_0x3e1812['timings'],'files_attempted':_0x3a9afd?.['map'](_0x41c0a3=>({'path':_0x41c0a3['path'],'lines':_0x41c0a3[_0x34f97a(0x1ad)]})),'tool_calls':_0x1fa086(_0x3e1812['messages']),'messages':_0x3e1812['messages']?.[_0x34f97a(0x119)](_0x1b69ee=>({'role':_0x1b69ee[_0x34f97a(0x1e2)],'content':_0x1b69ee[_0x34f97a(0x1c3)]})),'request_content':{'query':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x145)],'repo_path':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)],'repoRoot':a0_0x36dc60['resolve'](_0x16d6fe['data']['repo_path']),'model':_0x34f97a(0x17a)}},'stack_trace':_0x1dd180?.['stack']||undefined,'source':_0x34f97a(0x181)})[_0x34f97a(0x19b)](()=>{});}else _0x57f032=_0x34f97a(0x13b);}return{'content':[{'type':_0x34f97a(0xe1),'text':_0x57f032}]};}catch(_0x88a395){const _0x49921b=_0x88a395 instanceof Error?_0x88a395[_0x34f97a(0x159)]:String(_0x88a395),_0x54457c=_0x49921b[_0x34f97a(0x17b)]()[_0x34f97a(0x1e1)](_0x34f97a(0x176))||_0x49921b[_0x34f97a(0x17b)]()[_0x34f97a(0x1e1)]('timed\x20out')||_0x49921b[_0x34f97a(0x17b)]()[_0x34f97a(0x1e1)](_0x34f97a(0xe3))||_0x88a395 instanceof Error&&_0x88a395['name']===_0x34f97a(0x17e);return reportMorphError({'error_message':_0x49921b,'error_type':_0x54457c?_0x34f97a(0x17e):_0x88a395 instanceof Error?_0x88a395[_0x34f97a(0xff)][_0x34f97a(0x1ce)]:_0x34f97a(0x123),'context':{'tool':_0x34f97a(0x1b6),'repo_path':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)],'query':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x145)],'model':'morph-warp-grep-v1-1111v0','is_timeout':_0x54457c,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x16d6fe['data'][_0x34f97a(0x145)],'repo_path':_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)],'repoRoot':a0_0x36dc60['resolve'](_0x16d6fe[_0x34f97a(0x1b9)][_0x34f97a(0x151)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x88a395 instanceof Error?_0x88a395[_0x34f97a(0x197)]:undefined,'source':_0x34f97a(0x181)})[_0x34f97a(0x19b)](()=>{}),{'content':[{'type':_0x34f97a(0xe1),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x49921b}],'isError':![]};}}case _0x34f97a(0x1c8):{const _0x358198=WarpGrepGitHubArgsSchema[_0x34f97a(0x184)](_0x3cc748);if(!_0x358198[_0x34f97a(0x17f)])return{'content':[{'type':'text','text':_0x34f97a(0x101)+_0x358198[_0x34f97a(0x128)]}],'isError':!![]};const _0x45b10c=_0x358198[_0x34f97a(0x1b9)][_0x34f97a(0x182)]||_0x358198[_0x34f97a(0x1b9)]['owner_repo'];if(!_0x45b10c)return{'content':[{'type':'text','text':_0x34f97a(0xf8)}],'isError':!![]};const _0x25f834=MORPH_API_KEY;if(!_0x25f834)throw new Error(_0x34f97a(0xf4));const _0x4c8ebb=Date[_0x34f97a(0xf0)]();logMcpStderr(_0x34f97a(0xf3)+_0x45b10c+_0x34f97a(0x108)+_0x358198[_0x34f97a(0x1b9)][_0x34f97a(0x145)]+'\x22');try{const _0x192bf5=new WarpGrepClient({'morphApiKey':_0x25f834,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x20eb88=await searchGitHubWithSearchRequest(_0x192bf5,{'searchRequest':_0x358198[_0x34f97a(0x1b9)]['search_string'],'github':_0x45b10c,'branch':_0x358198[_0x34f97a(0x1b9)][_0x34f97a(0x1cb)]}),_0x30b467=Date[_0x34f97a(0xf0)]()-_0x4c8ebb;logMcpStderr(_0x34f97a(0x1bd)+_0x30b467+_0x34f97a(0x118)+_0x20eb88[_0x34f97a(0x17f)]);const _0x9acd62=formatResult(_0x20eb88);return{'content':[{'type':_0x34f97a(0xe1),'text':_0x9acd62}]};}catch(_0x500bee){const _0x5192ab=Date[_0x34f97a(0xf0)]()-_0x4c8ebb,_0x978add=_0x500bee instanceof Error?_0x500bee[_0x34f97a(0x159)]:String(_0x500bee);return logMcpStderr('[warpgrep_github_search]\x20Failed\x20in\x20'+_0x5192ab+_0x34f97a(0x1b5),_0x978add),reportMorphError({'error_message':_0x978add,'error_type':_0x500bee instanceof Error?_0x500bee[_0x34f97a(0xff)][_0x34f97a(0x1ce)]:'UnknownError','context':{'tool':_0x34f97a(0x1c8),'github_url':_0x45b10c,'search_string':_0x358198[_0x34f97a(0x1b9)][_0x34f97a(0x145)],'branch':_0x358198[_0x34f97a(0x1b9)][_0x34f97a(0x1cb)]},'stack_trace':_0x500bee instanceof Error?_0x500bee[_0x34f97a(0x197)]:undefined,'source':_0x34f97a(0x181),'tool':_0x34f97a(0x1c8),'latency_ms':_0x5192ab})[_0x34f97a(0x19b)](()=>{}),{'content':[{'type':'text','text':'GitHub\x20search\x20failed:\x20'+_0x978add}],'isError':![]};}}default:throw new Error(_0x34f97a(0x11e)+_0x13db57);}}catch(_0x1f6ad3){const _0x299feb=_0x1f6ad3 instanceof Error?_0x1f6ad3[_0x34f97a(0x159)]:String(_0x1f6ad3);return reportMorphError({'error_message':_0x299feb,'error_type':_0x1f6ad3 instanceof Error?_0x1f6ad3['constructor'][_0x34f97a(0x1ce)]:_0x34f97a(0x123),'context':{'tool':_0x13db57,'arguments':_0x3cc748?JSON['stringify'](_0x3cc748)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x34f97a(0x1bb)},'stack_trace':_0x1f6ad3 instanceof Error?_0x1f6ad3[_0x34f97a(0x197)]:undefined,'source':_0x34f97a(0x181)})[_0x34f97a(0x19b)](()=>{}),{'content':[{'type':_0x34f97a(0xe1),'text':_0x34f97a(0xf9)+_0x299feb}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5bc52e){const _0x4febdd=a0_0x487fa1,_0x3d2ddf=await getValidRootDirectories(_0x5bc52e);if(_0x3d2ddf[_0x4febdd(0x16f)]>0x0)allowedDirectories=[..._0x3d2ddf],logMcpStderr(_0x4febdd(0x1a9)+_0x3d2ddf[_0x4febdd(0x16f)]+_0x4febdd(0x121));else{logMcpStderr(_0x4febdd(0x19f));if(ENABLE_WORKSPACE_MODE)try{const _0x55e2fe=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x55e2fe&&(allowedDirectories=[_0x55e2fe],logMcpStderr(_0x4febdd(0x192)+_0x55e2fe));}catch(_0xe34760){logMcpStderr(_0x4febdd(0x189)+_0xe34760);}}}server[a0_0x487fa1(0xf6)](RootsListChangedNotificationSchema,async()=>{const _0x45e207=a0_0x487fa1;try{const _0x43db36=await server[_0x45e207(0x1c1)]();_0x43db36&&_0x45e207(0x127)in _0x43db36&&await updateAllowedDirectoriesFromRoots(_0x43db36[_0x45e207(0x127)]);}catch(_0xfef7ac){logMcpStderr(_0x45e207(0x162),_0xfef7ac instanceof Error?_0xfef7ac[_0x45e207(0x159)]:String(_0xfef7ac));}}),server['oninitialized']=async()=>{const _0x309524=a0_0x487fa1,_0x3900bf=server['getClientCapabilities']();if(_0x3900bf?.[_0x309524(0x127)])try{const _0xf5a8=await server[_0x309524(0x1c1)]();_0xf5a8&&_0x309524(0x127)in _0xf5a8?await updateAllowedDirectoriesFromRoots(_0xf5a8[_0x309524(0x127)]):logMcpStderr(_0x309524(0x161));}catch(_0xd3f665){logMcpStderr(_0x309524(0x12a),_0xd3f665 instanceof Error?_0xd3f665[_0x309524(0x159)]:String(_0xd3f665));}else{if(allowedDirectories[_0x309524(0x16f)]>0x0)logMcpStderr(_0x309524(0x12c),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x309524(0xe2));}}};async function runServer(){const _0x2b1144=a0_0x487fa1,_0x43af85=new StdioServerTransport();await server[_0x2b1144(0x190)](_0x43af85),logMcpStderr(_0x2b1144(0x107)),allowedDirectories['length']===0x0&&logMcpStderr(_0x2b1144(0x126));}runServer()['catch'](_0x46b128=>{const _0x4a494c=a0_0x487fa1;logMcpStderr(_0x4a494c(0x1aa),_0x46b128),process[_0x4a494c(0x14e)](0x1);});
@@ -0,0 +1,4 @@
1
+ export type OperatingSystemType = 'macOS' | 'Windows' | 'Linux' | 'Unknown';
2
+ export declare function getOperatingSystemType(platform?: NodeJS.Platform): OperatingSystemType;
3
+ export declare function formatMcpLogMessage(message: string, platform?: NodeJS.Platform): string;
4
+ export declare function logMcpStderr(message: string, ...args: unknown[]): void;
@@ -0,0 +1 @@
1
+ var a1_0x49b486=a1_0x4ef2;(function(_0x37bd50,_0x631410){var _0x298612=a1_0x4ef2,_0x184f4f=_0x37bd50();while(!![]){try{var _0x2e89b5=-parseInt(_0x298612(0x1d0))/0x1*(-parseInt(_0x298612(0x1cd))/0x2)+parseInt(_0x298612(0x1bf))/0x3+parseInt(_0x298612(0x1c7))/0x4+parseInt(_0x298612(0x1cb))/0x5+-parseInt(_0x298612(0x1c1))/0x6*(parseInt(_0x298612(0x1cf))/0x7)+parseInt(_0x298612(0x1ce))/0x8*(parseInt(_0x298612(0x1c5))/0x9)+-parseInt(_0x298612(0x1ca))/0xa;if(_0x2e89b5===_0x631410)break;else _0x184f4f['push'](_0x184f4f['shift']());}catch(_0x5923ee){_0x184f4f['push'](_0x184f4f['shift']());}}}(a1_0x2f52,0x5a0c2));import a1_0x3981ff from'os';function a1_0x2f52(){var _0x5ee9b7=['72zdoGcd','800842lvnAmR','2ZSrGsN','1357659DSHkcT','Linux','6hvuFSq','[os=','macOS','platform','659565CUkrmH','linux','2702188LPqweo','Unknown','win32','19658620WwkKXO','2602355RsXPAh','error','140966ymKqYe'];a1_0x2f52=function(){return _0x5ee9b7;};return a1_0x2f52();}export function getOperatingSystemType(_0x4ca1a7=a1_0x3981ff[a1_0x49b486(0x1c4)]()){var _0x788708=a1_0x49b486;switch(_0x4ca1a7){case'darwin':return _0x788708(0x1c3);case _0x788708(0x1c9):return'Windows';case _0x788708(0x1c6):return _0x788708(0x1c0);default:return _0x788708(0x1c8);}}export function formatMcpLogMessage(_0x3e1f29,_0x50730b=a1_0x3981ff[a1_0x49b486(0x1c4)]()){var _0x1764ac=a1_0x49b486;return _0x1764ac(0x1c2)+getOperatingSystemType(_0x50730b)+']\x20'+_0x3e1f29;}function a1_0x4ef2(_0x49568a,_0x102e1c){_0x49568a=_0x49568a-0x1bf;var _0x2f5271=a1_0x2f52();var _0x4ef2a2=_0x2f5271[_0x49568a];return _0x4ef2a2;}export function logMcpStderr(_0x1203f1,..._0x170f23){var _0x51193e=a1_0x49b486;console[_0x51193e(0x1cc)](formatMcpLogMessage(_0x1203f1),..._0x170f23);}
@@ -1 +1 @@
1
- (function(_0x296823,_0x1971c1){const _0x5469ac=a1_0x3a68,_0x957aa1=_0x296823();while(!![]){try{const _0xe9f47b=parseInt(_0x5469ac(0x1e5))/0x1*(parseInt(_0x5469ac(0x1e4))/0x2)+-parseInt(_0x5469ac(0x1f1))/0x3*(parseInt(_0x5469ac(0x1f4))/0x4)+parseInt(_0x5469ac(0x1f6))/0x5*(parseInt(_0x5469ac(0x1ef))/0x6)+-parseInt(_0x5469ac(0x1f3))/0x7+-parseInt(_0x5469ac(0x1f8))/0x8*(-parseInt(_0x5469ac(0x1ea))/0x9)+parseInt(_0x5469ac(0x1ee))/0xa*(-parseInt(_0x5469ac(0x1fb))/0xb)+parseInt(_0x5469ac(0x1e7))/0xc*(parseInt(_0x5469ac(0x1fa))/0xd);if(_0xe9f47b===_0x1971c1)break;else _0x957aa1['push'](_0x957aa1['shift']());}catch(_0x573d10){_0x957aa1['push'](_0x957aa1['shift']());}}}(a1_0x25c8,0x809eb));import a1_0x6416ed from'path';import a1_0x4cceb0 from'os';export function convertToWindowsPath(_0x260b2c){const _0x209ad2=a1_0x3a68;if(_0x260b2c[_0x209ad2(0x1f2)](_0x209ad2(0x1eb))){const _0x2ea652=_0x260b2c[_0x209ad2(0x1e9)](0x5)[_0x209ad2(0x1e8)](),_0x1e9787=_0x260b2c[_0x209ad2(0x1f9)](0x6)['replace'](/\//g,'\x5c');return _0x2ea652+':'+_0x1e9787;}if(_0x260b2c[_0x209ad2(0x1e3)](/^\/[a-zA-Z]\//)){const _0x132ec6=_0x260b2c[_0x209ad2(0x1e9)](0x1)[_0x209ad2(0x1e8)](),_0x501a82=_0x260b2c[_0x209ad2(0x1f9)](0x2)['replace'](/\//g,'\x5c');return _0x132ec6+':'+_0x501a82;}if(_0x260b2c[_0x209ad2(0x1e3)](/^[a-zA-Z]:/))return _0x260b2c[_0x209ad2(0x1e6)](/\//g,'\x5c');return _0x260b2c;}export function normalizePath(_0x2298d9){const _0x41be80=a1_0x3a68;_0x2298d9=_0x2298d9[_0x41be80(0x1ed)]()[_0x41be80(0x1e6)](/^["']|["']$/g,'');const _0x5a3d82=_0x2298d9[_0x41be80(0x1f2)]('/')&&!_0x2298d9[_0x41be80(0x1e3)](/^\/mnt\/[a-z]\//i)&&!_0x2298d9[_0x41be80(0x1e3)](/^\/[a-zA-Z]\//);if(_0x5a3d82)return _0x2298d9[_0x41be80(0x1e6)](/\/+/g,'/')['replace'](/\/+$/,'');_0x2298d9=convertToWindowsPath(_0x2298d9);if(_0x2298d9[_0x41be80(0x1f2)]('\x5c\x5c')){let _0x22a75b=_0x2298d9;_0x22a75b=_0x22a75b[_0x41be80(0x1e6)](/^\\{2,}/,'\x5c\x5c');const _0x54a8dd=_0x22a75b[_0x41be80(0x1e2)](0x2)[_0x41be80(0x1e6)](/\\\\/g,'\x5c');_0x2298d9='\x5c\x5c'+_0x54a8dd;}else _0x2298d9=_0x2298d9[_0x41be80(0x1e6)](/\\\\/g,'\x5c');let _0x44bf24=a1_0x6416ed[_0x41be80(0x1f7)](_0x2298d9);_0x2298d9['startsWith']('\x5c\x5c')&&!_0x44bf24[_0x41be80(0x1f2)]('\x5c\x5c')&&(_0x44bf24='\x5c'+_0x44bf24);if(_0x44bf24[_0x41be80(0x1e3)](/^[a-zA-Z]:/)){let _0x5d31af=_0x44bf24[_0x41be80(0x1e6)](/\//g,'\x5c');return/^[a-z]:/[_0x41be80(0x1f0)](_0x5d31af)&&(_0x5d31af=_0x5d31af[_0x41be80(0x1e9)](0x0)['toUpperCase']()+_0x5d31af[_0x41be80(0x1f9)](0x1)),_0x5d31af;}return _0x44bf24['replace'](/\//g,'\x5c');}function a1_0x25c8(){const _0x334c81=['slice','16312283DbbebB','11RrqsNG','substring','match','515822aseQlp','3NdWPap','replace','12dRyVJg','toUpperCase','charAt','4263444RFSjNk','/mnt/','join','trim','8668500ZuxhbG','30cxDiOg','test','1855878WIVfkU','startsWith','5109874IaElUG','4GdfDld','homedir','240045HwhuUS','normalize','8bikCJC'];a1_0x25c8=function(){return _0x334c81;};return a1_0x25c8();}function a1_0x3a68(_0x1e9125,_0x3d701f){_0x1e9125=_0x1e9125-0x1e2;const _0x25c831=a1_0x25c8();let _0x3a68ab=_0x25c831[_0x1e9125];return _0x3a68ab;}export function expandHome(_0x551600){const _0x4e5510=a1_0x3a68;if(_0x551600[_0x4e5510(0x1f2)]('~/')||_0x551600==='~')return a1_0x6416ed[_0x4e5510(0x1ec)](a1_0x4cceb0[_0x4e5510(0x1f5)](),_0x551600[_0x4e5510(0x1f9)](0x1));return _0x551600;}
1
+ (function(_0x50f4d6,_0x15201a){const _0x5c869a=a2_0x1af6,_0x4a59cb=_0x50f4d6();while(!![]){try{const _0x3d894a=parseInt(_0x5c869a(0x179))/0x1+-parseInt(_0x5c869a(0x178))/0x2+-parseInt(_0x5c869a(0x175))/0x3+parseInt(_0x5c869a(0x186))/0x4+-parseInt(_0x5c869a(0x182))/0x5*(-parseInt(_0x5c869a(0x177))/0x6)+parseInt(_0x5c869a(0x187))/0x7*(-parseInt(_0x5c869a(0x188))/0x8)+parseInt(_0x5c869a(0x17f))/0x9;if(_0x3d894a===_0x15201a)break;else _0x4a59cb['push'](_0x4a59cb['shift']());}catch(_0x1677fa){_0x4a59cb['push'](_0x4a59cb['shift']());}}}(a2_0x5b96,0xbe890));function a2_0x5b96(){const _0x595e4e=['2199822ChIlcn','1107530QaOIvr','32153FjmpBS','match','startsWith','replace','charAt','slice','6086709VFuont','/mnt/','toUpperCase','5gHYEfb','homedir','test','join','5683996zBKSnP','7XtLbyf','3346064wrJous','2230905fgKHwl','normalize'];a2_0x5b96=function(){return _0x595e4e;};return a2_0x5b96();}import a2_0x1ea9c3 from'path';function a2_0x1af6(_0x423daf,_0x1f710c){_0x423daf=_0x423daf-0x175;const _0x5b96e6=a2_0x5b96();let _0x1af608=_0x5b96e6[_0x423daf];return _0x1af608;}import a2_0x16201e from'os';export function convertToWindowsPath(_0x4bb945){const _0x2ed4f2=a2_0x1af6;if(_0x4bb945[_0x2ed4f2(0x17b)](_0x2ed4f2(0x180))){const _0x41cef6=_0x4bb945[_0x2ed4f2(0x17d)](0x5)[_0x2ed4f2(0x181)](),_0x11bb95=_0x4bb945[_0x2ed4f2(0x17e)](0x6)[_0x2ed4f2(0x17c)](/\//g,'\x5c');return _0x41cef6+':'+_0x11bb95;}if(_0x4bb945[_0x2ed4f2(0x17a)](/^\/[a-zA-Z]\//)){const _0xbbff2c=_0x4bb945[_0x2ed4f2(0x17d)](0x1)[_0x2ed4f2(0x181)](),_0x294c38=_0x4bb945['slice'](0x2)[_0x2ed4f2(0x17c)](/\//g,'\x5c');return _0xbbff2c+':'+_0x294c38;}if(_0x4bb945[_0x2ed4f2(0x17a)](/^[a-zA-Z]:/))return _0x4bb945[_0x2ed4f2(0x17c)](/\//g,'\x5c');return _0x4bb945;}export function normalizePath(_0x17f379){const _0x21c1ea=a2_0x1af6;_0x17f379=_0x17f379['trim']()['replace'](/^["']|["']$/g,'');const _0x19769d=_0x17f379[_0x21c1ea(0x17b)]('/')&&!_0x17f379[_0x21c1ea(0x17a)](/^\/mnt\/[a-z]\//i)&&!_0x17f379[_0x21c1ea(0x17a)](/^\/[a-zA-Z]\//);if(_0x19769d)return _0x17f379[_0x21c1ea(0x17c)](/\/+/g,'/')[_0x21c1ea(0x17c)](/\/+$/,'');_0x17f379=convertToWindowsPath(_0x17f379);if(_0x17f379[_0x21c1ea(0x17b)]('\x5c\x5c')){let _0x4c3c73=_0x17f379;_0x4c3c73=_0x4c3c73['replace'](/^\\{2,}/,'\x5c\x5c');const _0x30f3c2=_0x4c3c73['substring'](0x2)['replace'](/\\\\/g,'\x5c');_0x17f379='\x5c\x5c'+_0x30f3c2;}else _0x17f379=_0x17f379[_0x21c1ea(0x17c)](/\\\\/g,'\x5c');let _0x203cf3=a2_0x1ea9c3[_0x21c1ea(0x176)](_0x17f379);_0x17f379['startsWith']('\x5c\x5c')&&!_0x203cf3[_0x21c1ea(0x17b)]('\x5c\x5c')&&(_0x203cf3='\x5c'+_0x203cf3);if(_0x203cf3[_0x21c1ea(0x17a)](/^[a-zA-Z]:/)){let _0x2b5f76=_0x203cf3['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x21c1ea(0x184)](_0x2b5f76)&&(_0x2b5f76=_0x2b5f76[_0x21c1ea(0x17d)](0x0)[_0x21c1ea(0x181)]()+_0x2b5f76[_0x21c1ea(0x17e)](0x1)),_0x2b5f76;}return _0x203cf3[_0x21c1ea(0x17c)](/\//g,'\x5c');}export function expandHome(_0x226ad2){const _0x152f7d=a2_0x1af6;if(_0x226ad2[_0x152f7d(0x17b)]('~/')||_0x226ad2==='~')return a2_0x1ea9c3[_0x152f7d(0x185)](a2_0x16201e[_0x152f7d(0x183)](),_0x226ad2[_0x152f7d(0x17e)](0x1));return _0x226ad2;}
@@ -1 +1 @@
1
- (function(_0x4b2fda,_0x209079){const _0x81b48d=a2_0x539b,_0x422e75=_0x4b2fda();while(!![]){try{const _0x141b6f=parseInt(_0x81b48d(0x15d))/0x1+-parseInt(_0x81b48d(0x153))/0x2+-parseInt(_0x81b48d(0x154))/0x3+-parseInt(_0x81b48d(0x15a))/0x4+parseInt(_0x81b48d(0x151))/0x5*(parseInt(_0x81b48d(0x152))/0x6)+-parseInt(_0x81b48d(0x156))/0x7*(parseInt(_0x81b48d(0x15c))/0x8)+-parseInt(_0x81b48d(0x150))/0x9*(-parseInt(_0x81b48d(0x163))/0xa);if(_0x141b6f===_0x209079)break;else _0x422e75['push'](_0x422e75['shift']());}catch(_0x35978f){_0x422e75['push'](_0x422e75['shift']());}}}(a2_0x25d9,0xc8eae));import a2_0x487f12 from'path';function a2_0x539b(_0x46f7b7,_0x1bbbaf){_0x46f7b7=_0x46f7b7-0x150;const _0x25d9a5=a2_0x25d9();let _0x539b04=_0x25d9a5[_0x46f7b7];return _0x539b04;}export function isPathWithinAllowedDirectories(_0x121c4d,_0x4a7327){const _0x30b615=a2_0x539b;if(typeof _0x121c4d!=='string'||!Array[_0x30b615(0x155)](_0x4a7327))return![];if(!_0x121c4d||_0x4a7327[_0x30b615(0x164)]===0x0)return![];if(_0x121c4d[_0x30b615(0x160)]('\x00'))return![];let _0x59d2e2;try{_0x59d2e2=a2_0x487f12['resolve'](a2_0x487f12[_0x30b615(0x15e)](_0x121c4d));}catch{return![];}if(!a2_0x487f12[_0x30b615(0x15f)](_0x59d2e2))throw new Error(_0x30b615(0x161));return _0x4a7327[_0x30b615(0x162)](_0x5959b2=>{const _0x57303c=_0x30b615;if(typeof _0x5959b2!=='string'||!_0x5959b2)return![];if(_0x5959b2[_0x57303c(0x160)]('\x00'))return![];let _0x2b2c10;try{_0x2b2c10=a2_0x487f12[_0x57303c(0x157)](a2_0x487f12[_0x57303c(0x15e)](_0x5959b2));}catch{return![];}if(!a2_0x487f12[_0x57303c(0x15f)](_0x2b2c10))throw new Error(_0x57303c(0x159));if(_0x59d2e2===_0x2b2c10)return!![];if(_0x2b2c10===a2_0x487f12[_0x57303c(0x15b)])return _0x59d2e2[_0x57303c(0x158)](a2_0x487f12[_0x57303c(0x15b)]);return _0x59d2e2[_0x57303c(0x158)](_0x2b2c10+a2_0x487f12[_0x57303c(0x15b)]);});}function a2_0x25d9(){const _0x153d1a=['5hNCFnF','264738raHQpM','142054PTDRKQ','3544515ZHBghn','isArray','568694qQLjNn','resolve','startsWith','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','5303748JAnLOz','sep','136EOmIVH','1281571elabrJ','normalize','isAbsolute','includes','Path\x20must\x20be\x20absolute\x20after\x20normalization','some','34568470NtofaI','length','9HgFUsb'];a2_0x25d9=function(){return _0x153d1a;};return a2_0x25d9();}
1
+ (function(_0x2964a7,_0x48f8f8){const _0x153813=a3_0x20ec,_0x451193=_0x2964a7();while(!![]){try{const _0x4dbc61=-parseInt(_0x153813(0x150))/0x1+-parseInt(_0x153813(0x156))/0x2*(-parseInt(_0x153813(0x14e))/0x3)+parseInt(_0x153813(0x149))/0x4*(parseInt(_0x153813(0x157))/0x5)+parseInt(_0x153813(0x152))/0x6+-parseInt(_0x153813(0x154))/0x7+-parseInt(_0x153813(0x14d))/0x8*(parseInt(_0x153813(0x153))/0x9)+-parseInt(_0x153813(0x14c))/0xa;if(_0x4dbc61===_0x48f8f8)break;else _0x451193['push'](_0x451193['shift']());}catch(_0x435306){_0x451193['push'](_0x451193['shift']());}}}(a3_0x3cb3,0x9a128));import a3_0x369623 from'path';function a3_0x20ec(_0xb1b488,_0xd45010){_0xb1b488=_0xb1b488-0x143;const _0x3cb3d9=a3_0x3cb3();let _0x20ec52=_0x3cb3d9[_0xb1b488];return _0x20ec52;}export function isPathWithinAllowedDirectories(_0x2051cb,_0x1bdf7e){const _0x58c273=a3_0x20ec;if(typeof _0x2051cb!=='string'||!Array[_0x58c273(0x14a)](_0x1bdf7e))return![];if(!_0x2051cb||_0x1bdf7e[_0x58c273(0x151)]===0x0)return![];if(_0x2051cb[_0x58c273(0x146)]('\x00'))return![];let _0x457608;try{_0x457608=a3_0x369623[_0x58c273(0x143)](a3_0x369623[_0x58c273(0x144)](_0x2051cb));}catch{return![];}if(!a3_0x369623[_0x58c273(0x14b)](_0x457608))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x1bdf7e[_0x58c273(0x145)](_0x306b46=>{const _0x179a45=_0x58c273;if(typeof _0x306b46!==_0x179a45(0x147)||!_0x306b46)return![];if(_0x306b46[_0x179a45(0x146)]('\x00'))return![];let _0x6cbe79;try{_0x6cbe79=a3_0x369623[_0x179a45(0x143)](a3_0x369623[_0x179a45(0x144)](_0x306b46));}catch{return![];}if(!a3_0x369623['isAbsolute'](_0x6cbe79))throw new Error(_0x179a45(0x14f));if(_0x457608===_0x6cbe79)return!![];if(_0x6cbe79===a3_0x369623[_0x179a45(0x155)])return _0x457608[_0x179a45(0x148)](a3_0x369623[_0x179a45(0x155)]);return _0x457608[_0x179a45(0x148)](_0x6cbe79+a3_0x369623[_0x179a45(0x155)]);});}function a3_0x3cb3(){const _0x455c0e=['Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1110031STMRyi','length','7415796Rufcgy','5391FDkYNj','3188724RDRYOc','sep','504074ikMZiY','465515wyaUZQ','resolve','normalize','some','includes','string','startsWith','44DSiBfv','isArray','isAbsolute','2130640LZEaqJ','1368PhyWBe','3CVIIvJ'];a3_0x3cb3=function(){return _0x455c0e;};return a3_0x3cb3();}
@@ -1 +1 @@
1
- (function(_0x302d29,_0x46ced0){const _0x542c4c=a3_0x5783,_0x23682b=_0x302d29();while(!![]){try{const _0x136fcf=parseInt(_0x542c4c(0x1c1))/0x1+-parseInt(_0x542c4c(0x1b8))/0x2*(-parseInt(_0x542c4c(0x1b4))/0x3)+-parseInt(_0x542c4c(0x1bc))/0x4*(parseInt(_0x542c4c(0x1c0))/0x5)+parseInt(_0x542c4c(0x1ad))/0x6*(-parseInt(_0x542c4c(0x1b7))/0x7)+-parseInt(_0x542c4c(0x1ac))/0x8*(-parseInt(_0x542c4c(0x1b0))/0x9)+-parseInt(_0x542c4c(0x1ba))/0xa+parseInt(_0x542c4c(0x1ab))/0xb;if(_0x136fcf===_0x46ced0)break;else _0x23682b['push'](_0x23682b['shift']());}catch(_0x43bdc5){_0x23682b['push'](_0x23682b['shift']());}}}(a3_0x4e24,0xe278f));function a3_0x5783(_0xceb5d9,_0xd13b62){_0xceb5d9=_0xceb5d9-0x1ab;const _0x4e24cb=a3_0x4e24();let _0x5783e2=_0x4e24cb[_0xceb5d9];return _0x5783e2;}import{promises as a3_0x5ab531}from'fs';import a3_0x247757 from'path';import a3_0x282917 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x5aa076){const _0x403227=a3_0x5783;try{const _0x398473=_0x5aa076[_0x403227(0x1b3)](_0x403227(0x1b2))?_0x5aa076[_0x403227(0x1bd)](0x7):_0x5aa076,_0x2860f3=_0x398473[_0x403227(0x1b3)]('~/')||_0x398473==='~'?a3_0x247757[_0x403227(0x1b9)](a3_0x282917[_0x403227(0x1b6)](),_0x398473['slice'](0x1)):_0x398473,_0x35882a=a3_0x247757['resolve'](_0x2860f3),_0x142b4f=await a3_0x5ab531['realpath'](_0x35882a);return normalizePath(_0x142b4f);}catch{return null;}}function formatDirectoryError(_0x4b3dd5,_0x2de305,_0x163359){const _0xf25f65=a3_0x5783;if(_0x163359)return _0xf25f65(0x1bf)+_0x163359+':\x20'+_0x4b3dd5;const _0x3540c4=_0x2de305 instanceof Error?_0x2de305['message']:String(_0x2de305);return _0xf25f65(0x1ae)+_0x4b3dd5+_0xf25f65(0x1be)+_0x3540c4;}export async function getValidRootDirectories(_0xf17611){const _0x2427e8=a3_0x5783,_0x3e3d56=[];for(const _0x14d9de of _0xf17611){const _0x439e5a=await parseRootUri(_0x14d9de['uri']);if(!_0x439e5a){console[_0x2427e8(0x1b1)](formatDirectoryError(_0x14d9de[_0x2427e8(0x1af)],undefined,_0x2427e8(0x1bb)));continue;}try{const _0x31dd26=await a3_0x5ab531['stat'](_0x439e5a);_0x31dd26['isDirectory']()?_0x3e3d56[_0x2427e8(0x1b5)](_0x439e5a):console[_0x2427e8(0x1b1)](formatDirectoryError(_0x439e5a,undefined,'non-directory\x20root'));}catch(_0x51ff0a){console[_0x2427e8(0x1b1)](formatDirectoryError(_0x439e5a,_0x51ff0a));}}return _0x3e3d56;}function a3_0x4e24(){const _0x59c57f=['homedir','437458iGNUYs','452ETDDal','join','9824360Aaxubu','invalid\x20path\x20or\x20inaccessible','233196qtiiIO','slice','\x20due\x20to\x20error:\x20','Skipping\x20','15CajjBF','1320670hoaTzP','16251686tjOLqB','1260760vlivNu','162NGhvsF','Skipping\x20invalid\x20directory:\x20','uri','18OhltGD','error','file://','startsWith','8748OKFaWh','push'];a3_0x4e24=function(){return _0x59c57f;};return a3_0x4e24();}
1
+ (function(_0x3f36a1,_0x30d393){const _0x18f14d=a4_0x4e2c,_0x936890=_0x3f36a1();while(!![]){try{const _0x574a97=-parseInt(_0x18f14d(0x16d))/0x1+-parseInt(_0x18f14d(0x17d))/0x2*(parseInt(_0x18f14d(0x173))/0x3)+parseInt(_0x18f14d(0x175))/0x4+-parseInt(_0x18f14d(0x176))/0x5+parseInt(_0x18f14d(0x178))/0x6+-parseInt(_0x18f14d(0x17b))/0x7*(-parseInt(_0x18f14d(0x16e))/0x8)+-parseInt(_0x18f14d(0x17c))/0x9;if(_0x574a97===_0x30d393)break;else _0x936890['push'](_0x936890['shift']());}catch(_0x12d050){_0x936890['push'](_0x936890['shift']());}}}(a4_0x1f09,0xdfe65));import{promises as a4_0x85bbbd}from'fs';function a4_0x1f09(){const _0x3dd276=['Skipping\x20invalid\x20directory:\x20','1137000EIAflO','19888reGhyy','uri','\x20due\x20to\x20error:\x20','isDirectory','file://','51ZNWJuw','homedir','4836448KpUljR','7209310KsoZsq','slice','8461140EnaiLk','push','Skipping\x20','3563fvUGaK','3035970YgbuHb','6046sHwSRo','resolve','non-directory\x20root','message','invalid\x20path\x20or\x20inaccessible','stat','startsWith','join'];a4_0x1f09=function(){return _0x3dd276;};return a4_0x1f09();}import a4_0x502db9 from'path';import a4_0x4d6882 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';function a4_0x4e2c(_0x45cf10,_0x5ed873){_0x45cf10=_0x45cf10-0x16c;const _0x1f0917=a4_0x1f09();let _0x4e2c9d=_0x1f0917[_0x45cf10];return _0x4e2c9d;}async function parseRootUri(_0x2befa8){const _0x740cb0=a4_0x4e2c;try{const _0x3153c2=_0x2befa8[_0x740cb0(0x183)](_0x740cb0(0x172))?_0x2befa8[_0x740cb0(0x177)](0x7):_0x2befa8,_0x1c9385=_0x3153c2[_0x740cb0(0x183)]('~/')||_0x3153c2==='~'?a4_0x502db9[_0x740cb0(0x184)](a4_0x4d6882[_0x740cb0(0x174)](),_0x3153c2[_0x740cb0(0x177)](0x1)):_0x3153c2,_0x3e0959=a4_0x502db9[_0x740cb0(0x17e)](_0x1c9385),_0x425e4e=await a4_0x85bbbd['realpath'](_0x3e0959);return normalizePath(_0x425e4e);}catch{return null;}}function formatDirectoryError(_0x1ff387,_0x33c9c8,_0x518fdc){const _0x46daf1=a4_0x4e2c;if(_0x518fdc)return _0x46daf1(0x17a)+_0x518fdc+':\x20'+_0x1ff387;const _0x52b3ee=_0x33c9c8 instanceof Error?_0x33c9c8[_0x46daf1(0x180)]:String(_0x33c9c8);return _0x46daf1(0x16c)+_0x1ff387+_0x46daf1(0x170)+_0x52b3ee;}export async function getValidRootDirectories(_0x1bdd64){const _0x416678=a4_0x4e2c,_0x183a1b=[];for(const _0x417bab of _0x1bdd64){const _0x28bda6=await parseRootUri(_0x417bab['uri']);if(!_0x28bda6){logMcpStderr(formatDirectoryError(_0x417bab[_0x416678(0x16f)],undefined,_0x416678(0x181)));continue;}try{const _0x2fd58f=await a4_0x85bbbd[_0x416678(0x182)](_0x28bda6);_0x2fd58f[_0x416678(0x171)]()?_0x183a1b[_0x416678(0x179)](_0x28bda6):logMcpStderr(formatDirectoryError(_0x28bda6,undefined,_0x416678(0x17f)));}catch(_0x4a904a){logMcpStderr(formatDirectoryError(_0x28bda6,_0x4a904a));}}return _0x183a1b;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.123",
3
+ "version": "0.8.125",
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)",