@morphllm/morphmcp 0.8.143 → 0.8.144

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_0x5f59de=a0_0x888c;(function(_0x443375,_0x45777a){const _0x54e325=a0_0x888c,_0x2ff9ae=_0x443375();while(!![]){try{const _0x187edb=parseInt(_0x54e325(0x276))/0x1+parseInt(_0x54e325(0x1db))/0x2*(-parseInt(_0x54e325(0x24d))/0x3)+-parseInt(_0x54e325(0x224))/0x4*(parseInt(_0x54e325(0x2c8))/0x5)+parseInt(_0x54e325(0x25c))/0x6+-parseInt(_0x54e325(0x1f9))/0x7+-parseInt(_0x54e325(0x239))/0x8*(parseInt(_0x54e325(0x260))/0x9)+parseInt(_0x54e325(0x2b2))/0xa;if(_0x187edb===_0x45777a)break;else _0x2ff9ae['push'](_0x2ff9ae['shift']());}catch(_0x30e928){_0x2ff9ae['push'](_0x2ff9ae['shift']());}}}(a0_0x33a9,0xd12c0));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_0xf525bc from'fs/promises';import a0_0xfcf33 from'path';import a0_0x4bb44b 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_0xb3c996 from'axios';function fixPathRepetition(_0x58769f){const _0x3c47c0=a0_0x888c,_0x5bdbae=_0x58769f[_0x3c47c0(0x273)](a0_0xfcf33[_0x3c47c0(0x297)])[_0x3c47c0(0x1b8)](Boolean);if(_0x5bdbae[_0x3c47c0(0x242)]<0x2)return null;for(let _0x416380=Math[_0x3c47c0(0x1f4)](_0x5bdbae['length']/0x2);_0x416380>=0x1;_0x416380--){for(let _0x3d4d35=0x0;_0x3d4d35<=_0x5bdbae[_0x3c47c0(0x242)]-0x2*_0x416380;_0x3d4d35++){const _0x109e8c=_0x5bdbae[_0x3c47c0(0x2c5)](_0x3d4d35,_0x3d4d35+_0x416380),_0x43a9b3=_0x5bdbae[_0x3c47c0(0x2c5)](_0x3d4d35+_0x416380,_0x3d4d35+0x2*_0x416380);if(_0x109e8c[_0x3c47c0(0x23e)]((_0x1b3833,_0x5c745b)=>_0x1b3833===_0x43a9b3[_0x5c745b])){const _0x2055d3=[..._0x5bdbae[_0x3c47c0(0x2c5)](0x0,_0x3d4d35),..._0x5bdbae[_0x3c47c0(0x2c5)](_0x3d4d35+_0x416380)];return a0_0xfcf33[_0x3c47c0(0x297)]+_0x2055d3[_0x3c47c0(0x1d3)](a0_0xfcf33[_0x3c47c0(0x297)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4303f1=a0_0x888c;try{const _0x4a6b19=require('../package.json');return _0x4a6b19[_0x4303f1(0x22b)]??_0x4303f1(0x26e);}catch(_0x37a3b4){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x37a3b4),_0x4303f1(0x26e);}}function printHelp(){const _0x5be90c=a0_0x888c;console[_0x5be90c(0x201)](_0x5be90c(0x2a4)+getPackageVersion()),console['log']('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x5be90c(0x201)](_0x5be90c(0x1ce)),console[_0x5be90c(0x201)](_0x5be90c(0x277)),console[_0x5be90c(0x201)](_0x5be90c(0x27f)),console['log'](_0x5be90c(0x248)),console[_0x5be90c(0x201)](_0x5be90c(0x282)),console['log']('\x20\x20morph-mcp'),console[_0x5be90c(0x201)](_0x5be90c(0x219));}const cliArgs=process['argv'][a0_0x5f59de(0x2c5)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x5f59de(0x213),'-h']);cliArgs[a0_0x5f59de(0x1c7)](_0x831a4f=>VERSION_FLAGS['has'](_0x831a4f))&&(console['log'](a0_0x5f59de(0x2a4)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x5f59de(0x1c7)](_0x5c74fb=>HELP_FLAGS[a0_0x5f59de(0x2a7)](_0x5c74fb))&&(printHelp(),process[a0_0x5f59de(0x25a)](0x0));function getCliArg(_0x3c48e5){const _0x26bddd=a0_0x5f59de;for(let _0x1381dd=0x0;_0x1381dd<cliArgs[_0x26bddd(0x242)];_0x1381dd++){const _0xe63ec4=cliArgs[_0x1381dd];if(_0xe63ec4[_0x26bddd(0x29a)]('--'+_0x3c48e5+'='))return _0xe63ec4[_0x26bddd(0x2c5)](('--'+_0x3c48e5+'=')['length']);if(_0xe63ec4==='--'+_0x3c48e5&&_0x1381dd+0x1<cliArgs[_0x26bddd(0x242)])return cliArgs[_0x1381dd+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5f59de(0x242)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x5f59de(0x2a7)](arg)||HELP_FLAGS[a0_0x5f59de(0x2a7)](arg))continue;if(arg[a0_0x5f59de(0x29a)]('--api-key='))continue;if(arg===a0_0x5f59de(0x296)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x28e)]||process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x1f6)]||process[a0_0x5f59de(0x267)](),ENABLE_WORKSPACE_MODE=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x235)]!==a0_0x5f59de(0x1d9),MORPH_API_KEY=getCliArg(a0_0x5f59de(0x211))??process['env'][a0_0x5f59de(0x1ba)],MORPH_API_URL=process['env'][a0_0x5f59de(0x24b)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x262)]?parseInt(process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x262)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x5f59de(0x299),a0_0x5f59de(0x250),a0_0x5f59de(0x1d6)]),DISABLED_TOOLS=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x1d1)]?new Set(process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x1d1)][a0_0x5f59de(0x273)](',')['map'](_0x2281e9=>_0x2281e9[a0_0x5f59de(0x1ff)]())[a0_0x5f59de(0x1b8)](_0x5ef55b=>_0x5ef55b[a0_0x5f59de(0x242)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x5f59de(0x24e)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x5f59de(0x264)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x5f59de(0x1df)+[...KNOWN_TOOL_NAMES][a0_0x5f59de(0x1d3)](',\x20'));}console['error'](a0_0x5f59de(0x216)+[...DISABLED_TOOLS][a0_0x5f59de(0x1d3)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x5f59de(0x2b3))&&!MORPH_API_KEY[a0_0x5f59de(0x29a)](a0_0x5f59de(0x1d8))&&logMcpStderr(a0_0x5f59de(0x2b4));async function reportMorphError(_0x554e6d){const _0xfc5a34=a0_0x5f59de;try{await a0_0xb3c996[_0xfc5a34(0x28f)](_0xfc5a34(0x1e2),{..._0x554e6d,'timestamp':new Date()[_0xfc5a34(0x1e0)](),'source':_0x554e6d[_0xfc5a34(0x291)]||_0xfc5a34(0x24f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x554e6d[_0xfc5a34(0x20f)]}},{'timeout':0x1388,'headers':{'Content-Type':_0xfc5a34(0x278),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5f59de(0x1d0)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x5f59de(0x236)),logMcpStderr(a0_0x5f59de(0x298)),logMcpStderr(a0_0x5f59de(0x253)),logMcpStderr(a0_0x5f59de(0x271)));function normalizePath(_0x4ddcbb){const _0x367c79=a0_0x5f59de;return a0_0xfcf33[_0x367c79(0x233)](_0x4ddcbb);}function expandHome(_0x2b8bc2){const _0x9d6643=a0_0x5f59de;if(_0x2b8bc2[_0x9d6643(0x29a)]('~/')||_0x2b8bc2==='~')return a0_0xfcf33[_0x9d6643(0x1d3)](a0_0x4bb44b[_0x9d6643(0x1b3)](),_0x2b8bc2[_0x9d6643(0x2c5)](0x1));return _0x2b8bc2;}let allowedDirectories=await Promise[a0_0x5f59de(0x2af)](args['map'](async _0x587fbc=>{const _0x8144b3=a0_0x5f59de,_0x1d1986=expandHome(_0x587fbc),_0x13120d=a0_0xfcf33[_0x8144b3(0x1cd)](_0x1d1986);try{const _0x5e6ab5=await a0_0xf525bc[_0x8144b3(0x2a2)](_0x13120d);return normalizePath(_0x5e6ab5);}catch(_0x27bff6){return normalizePath(_0x13120d);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x5f59de(0x202)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x3fe7c6){logMcpStderr(a0_0x5f59de(0x1b5)+a0_0x3fe7c6);}function a0_0x33a9(){const _0x35afd3=['--help','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.','BinaryFile','Disabled\x20tools:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x27\x20in\x20`','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','oninitialized','Failed\x20to\x20request\x20roots\x20from\x20client:','Tool\x20','added\x20','Error\x20accessing\x20directory\x20','role','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','function','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','48TiDMUb','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Rules:\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','changes','access','map','version','-\x20Glob\x20search\x20`','array','-\x20Grepped\x20\x27','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','path','constructor','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','normalize','-\x20Listed\x20directory\x20`','ENABLE_WORKSPACE_MODE','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','grep_search','glob','6152936sJbcvg','Specific\x20commit\x20hash\x20to\x20search','[github_codebase_search]\x20Failed\x20in\x20','repo_path','name','every','requiresApiKey','files','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','length','Unknown\x20tool:\x20','package.json','Invalid\x20arguments:\x20','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','dirname','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','success','catch','MORPH_API_URL','ms:','15UmLxag','size','mcp-filesystem','codebase_search','assistant','RipgrepNotAvailable','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','roots','command','includes','linesRemoved','</file>','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','exit','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','6551838LAhUfD',',\x20modified\x20','text','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','9fFeZzx','pattern','MORPH_WARP_GREP_TIMEOUT','tsconfig.json','error','<file\x20path=\x22','search_type','cwd','WarpGrepError','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','min','TimeoutError','search_string','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','unknown','safeParse','FileNotFound','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','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','split','user','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','1085760iKUsoh','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','application/json','utf-8','timeout','Max\x20results\x20to\x20return','lines','completed_with_file_errors','parse','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','stringify','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x0aExamples:','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','setRequestHandler','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','[github_codebase_search]\x20Done\x20in\x20','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','object','morph-v3-fast','env','node_modules','[could\x20not\x20read\x20file:\x20','readFile','WORKSPACE_ROOT','post','metadata','source','basename','ENOENT','morph-warp-grep-v2.1','Morph\x20Edit\x20Preview','--api-key','sep','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','edit_file','startsWith','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Relevant\x20context\x20found:','boolean','isDirectory','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','data','tool','realpath','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','@morphllm/morphmcp\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x0a...\x20(truncated,\x20total:\x20','has','timed\x20out','instruction','content','Applied','Fallback:\x20Using\x20workspace\x20root\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','FileReadError','all','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','0.2.0','15974200crOwvH','sk-','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','code','linesModified','dryRun','unknown\x20error','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','list_directory\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','listRoots','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','code_edit','GitHub\x20search\x20failed:\x20','default','UnknownError','pyproject.toml','etimedout','errors','slice','Unknown\x20error','Fatal\x20error\x20running\x20server:','16145rXdfCS','read','\x22>\x0aError\x20reading\x20file:\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','homedir','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','filter','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','MORPH_API_KEY','optional','grep\x20\x27','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','glob\x20\x27','Parent\x20directory\x20does\x20not\x20exist:\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','.\x20Path:\x20','ms.\x20Success:\x20','\x20chars)','go.mod','read\x20','SubToolError','some','\x20(new\x20file)','runWarpGrep_call','tool_calls','toLowerCase','Morph\x20Edit\x20','resolve','\x0aOptions:','-\x20Read\x20file\x20`','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','DISABLED_TOOLS','isArray','join','payload','Warning:\x20Workspace\x20fallback\x20failed:\x20','github_codebase_search','`\x20in\x20`','morph-','false','grep','673078ueZqwS','match','ToolException','Warning:\x20','\x22.\x20Known\x20tools:\x20','toISOString','terminationReason','https://morphllm.com/api/error-report','WarpGrep\x20sub-tool\x20errors:\x20','messages','branch','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','ReadError','Error:\x20','github_url','searchGitHub','.\x20Changes:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','[github_codebase_search]\x20Searching\x20','string','arguments','message','morph-mcp','tool_call_id','enum','floor','list_directory','PWD','finish','owner_repo','2994775jZpcam','now','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','stat','description','stack','trim','describe','log','push','Repository\x20identifier','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Created\x20File','.git','substring','connect','params','File\x20read\x20error:','Tool\x20\x22','completionId','timings','\x20valid\x20directories','context','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','api-key','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'];a0_0x33a9=function(){return _0x35afd3;};return a0_0x33a9();}async function detectWorkspaceRoot(_0x422fef){const _0x27692b=a0_0x5f59de;let _0x385bf7=a0_0xfcf33[_0x27692b(0x1cd)](_0x422fef);const _0x2ad0e9=[_0x27692b(0x206),'.vscode',_0x27692b(0x244),'Cargo.toml',_0x27692b(0x2c2),_0x27692b(0x1c4),'.cursor',_0x27692b(0x263),'composer.json'];while(_0x385bf7!==a0_0xfcf33['dirname'](_0x385bf7)){for(const _0x549e57 of _0x2ad0e9){const _0x363e91=a0_0xfcf33[_0x27692b(0x1d3)](_0x385bf7,_0x549e57);try{return await a0_0xf525bc[_0x27692b(0x229)](_0x363e91),normalizePath(_0x385bf7);}catch{}}_0x385bf7=a0_0xfcf33['dirname'](_0x385bf7);}return normalizePath(_0x422fef);}await Promise['all'](args[a0_0x5f59de(0x22a)](async _0xccdc33=>{const _0x2377c7=a0_0x5f59de;try{const _0x1f3840=await a0_0xf525bc[_0x2377c7(0x1fc)](expandHome(_0xccdc33));!_0x1f3840[_0x2377c7(0x29e)]()&&(logMcpStderr(_0x2377c7(0x1e8)+_0xccdc33+'\x20is\x20not\x20a\x20directory'),process[_0x2377c7(0x25a)](0x1));}catch(_0x3699d2){logMcpStderr(_0x2377c7(0x21f)+_0xccdc33+':',_0x3699d2),process['exit'](0x1);}}));async function validatePath(_0x522c7b){const _0x1db53e=a0_0x5f59de,_0x34d5a2=expandHome(_0x522c7b),_0x2bb8a2=a0_0xfcf33[_0x1db53e(0x1cd)](_0x34d5a2);try{const _0x5faa69=await a0_0xf525bc[_0x1db53e(0x2a2)](_0x2bb8a2);return _0x5faa69;}catch(_0x568ded){if(_0x568ded[_0x1db53e(0x2b5)]===_0x1db53e(0x293)){const _0x2eb23a=a0_0xfcf33[_0x1db53e(0x247)](_0x2bb8a2);try{const _0x345e6a=await a0_0xf525bc['realpath'](_0x2eb23a);return a0_0xfcf33['join'](_0x345e6a,a0_0xfcf33[_0x1db53e(0x292)](_0x2bb8a2));}catch{throw new Error(_0x1db53e(0x1bf)+_0x2eb23a);}}throw _0x568ded;}}const MorphEditFileArgsSchema=z[a0_0x5f59de(0x288)]({'path':z[a0_0x5f59de(0x1ee)](),'code_edit':z['string']()[a0_0x5f59de(0x200)](a0_0x5f59de(0x2bd)),'instruction':z[a0_0x5f59de(0x1ee)]()['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_0x5f59de(0x29d)]()['default'](![])[a0_0x5f59de(0x200)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5f59de(0x2b9),WarpGrepArgsSchema=z[a0_0x5f59de(0x288)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x5f59de(0x1ee)]()['describe'](a0_0x5f59de(0x275)),'search_type':z[a0_0x5f59de(0x1f3)]([a0_0x5f59de(0x2c0),a0_0x5f59de(0x28b)])[a0_0x5f59de(0x1bb)]()[a0_0x5f59de(0x200)](a0_0x5f59de(0x225))}),WarpGrepGitHubArgsSchema=z[a0_0x5f59de(0x288)]({'search_string':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x200)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x5f59de(0x1bb)]()[a0_0x5f59de(0x200)](a0_0x5f59de(0x214)),'owner_repo':z[a0_0x5f59de(0x1ee)]()['optional']()[a0_0x5f59de(0x200)](a0_0x5f59de(0x2a5)),'branch':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x1bb)]()['describe'](a0_0x5f59de(0x204))}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x5f59de(0x200)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x200)](a0_0x5f59de(0x203)),'branch':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x1bb)]()['describe'](a0_0x5f59de(0x29f)),'commitHash':z[a0_0x5f59de(0x1ee)]()['optional']()[a0_0x5f59de(0x200)](a0_0x5f59de(0x23a)),'targetDirectories':z[a0_0x5f59de(0x22d)](z['string']())['default']([])[a0_0x5f59de(0x200)](a0_0x5f59de(0x287)),'limit':z['number']()['optional']()['default'](0xa)[a0_0x5f59de(0x200)](a0_0x5f59de(0x27b))}),server=new Server({'name':a0_0x5f59de(0x1f1),'version':a0_0x5f59de(0x2b1)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x5ca4d1=a0_0x5f59de,_0x99479b=[{'name':_0x5ca4d1(0x299),'description':_0x5ca4d1(0x232)+_0x5ca4d1(0x21a)+_0x5ca4d1(0x2bb)+_0x5ca4d1(0x26d)+'Benefits:\x0a'+_0x5ca4d1(0x25b)+_0x5ca4d1(0x227)+_0x5ca4d1(0x1fb)+_0x5ca4d1(0x1b6)+_0x5ca4d1(0x29b)+_0x5ca4d1(0x1b9)+_0x5ca4d1(0x241)+'For\x20deletions:\x0a'+_0x5ca4d1(0x223)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x5ca4d1(0x226)+_0x5ca4d1(0x259)+_0x5ca4d1(0x1b7)+_0x5ca4d1(0x269)+_0x5ca4d1(0x221)+_0x5ca4d1(0x2b0)+_0x5ca4d1(0x1b4)+_0x5ca4d1(0x272),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x5ca4d1(0x250),'description':_0x5ca4d1(0x25f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x5ca4d1(0x283)+_0x5ca4d1(0x212)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x17aa86=_0x99479b[_0x5ca4d1(0x1b8)](_0x348b79=>{const _0x1afaa9=_0x5ca4d1;if(DISABLED_TOOLS[_0x1afaa9(0x2a7)](_0x348b79['name']))return console['error'](_0x1afaa9(0x21d)+_0x348b79[_0x1afaa9(0x23d)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x1afaa9(0x23f)in _0x348b79&&_0x348b79['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x1afaa9(0x1de)+_0x348b79['name']+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x17aa86[_0x5ca4d1(0x22a)](_0x3b3bcd=>({'name':_0x3b3bcd[_0x5ca4d1(0x23d)],'description':_0x3b3bcd[_0x5ca4d1(0x1fd)],'inputSchema':_0x3b3bcd['inputSchema']}))};}),server[a0_0x5f59de(0x284)](CallToolRequestSchema,async _0x1bee5e=>{const _0x1f2901=a0_0x5f59de,{name:_0x59c8cf,arguments:_0x97636a}=_0x1bee5e[_0x1f2901(0x209)];try{if(DISABLED_TOOLS[_0x1f2901(0x2a7)](_0x59c8cf))throw new Error(_0x1f2901(0x20b)+_0x59c8cf+_0x1f2901(0x2a3));switch(_0x59c8cf){case _0x1f2901(0x299):{const _0xc89203=MorphEditFileArgsSchema[_0x1f2901(0x26f)](_0x97636a);if(!_0xc89203[_0x1f2901(0x249)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0xc89203[_0x1f2901(0x264)]);const _0x513055=await validatePath(_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x230)]);let _0x5fd354=null,_0x6357c6=!![],_0x4dd398=null;try{_0x5fd354=await a0_0xf525bc[_0x1f2901(0x28d)](_0x513055,_0x1f2901(0x279));}catch(_0x575550){const _0x163b20=_0x575550['code'];_0x163b20===_0x1f2901(0x293)?(_0x6357c6=![],_0x5fd354=''):(_0x4dd398='Failed\x20to\x20read\x20file:\x20'+(_0x163b20||'unknown')+'\x20-\x20'+(_0x575550 instanceof Error?_0x575550[_0x1f2901(0x1f0)]:String(_0x575550)),logMcpStderr(_0x1f2901(0x1de)+_0x4dd398));}let _0x428977;try{const _0x442434=MORPH_API_KEY;if(!_0x442434)throw new Error(_0x1f2901(0x1bd));const _0x3a5fef=a0_0xfcf33[_0x1f2901(0x247)](_0x513055),_0x160222=a0_0xfcf33[_0x1f2901(0x292)](_0x513055),_0x2fe272=await executeEditFile({'target_filepath':_0x160222,'code_edit':_0xc89203[_0x1f2901(0x2a0)]['code_edit'],'instructions':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2a9)]},{'morphApiKey':_0x442434,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3a5fef,'autoWrite':!_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2b7)],'generateUdiff':![],'debug':![]});_0x428977=_0x2fe272[_0x1f2901(0x20c)];if(!_0x2fe272['success'])throw new Error(_0x2fe272['error']||_0x1f2901(0x1c0));const _0x28c1ce=_0x2fe272[_0x1f2901(0x228)],_0x2e3761=_0x1f2901(0x21e)+_0x28c1ce['linesAdded']+',\x20removed\x20'+_0x28c1ce[_0x1f2901(0x257)]+_0x1f2901(0x25d)+_0x28c1ce[_0x1f2901(0x2b6)];if(_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2b7)])return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x295)+(_0x6357c6?'':_0x1f2901(0x1c8))+':\x20'+_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2a9)]+_0x1f2901(0x1eb)+_0x2e3761+_0x1f2901(0x1c1)+_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x230)]+'.'}]};return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x1cc)+(_0x6357c6?_0x1f2901(0x2ab):_0x1f2901(0x205))+':\x20'+_0xc89203['data'][_0x1f2901(0x2a9)]+_0x1f2901(0x1eb)+_0x2e3761+'.\x20Path:\x20'+_0xc89203[_0x1f2901(0x2a0)]['path']+'.'}]};}catch(_0x1e75fa){const _0x10ab4b=_0x1e75fa instanceof Error?_0x1e75fa[_0x1f2901(0x1f0)]:String(_0x1e75fa);return reportMorphError({'error_message':_0x10ab4b,'error_type':_0x1e75fa instanceof Error?_0x1e75fa['constructor'][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':'edit_file','completion_id':_0x428977,'file_path':_0xc89203[_0x1f2901(0x2a0)]['path'],'validated_path':_0x513055,'instruction':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2a9)],'model':_0x1f2901(0x289),'dry_run':_0xc89203[_0x1f2901(0x2a0)]['dryRun'],'file_exists':_0x6357c6,'file_read_error':_0x4dd398,'file_readable':_0x5fd354!==null,'request_content':{'path':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x230)],'code_edit':_0xc89203['data'][_0x1f2901(0x2be)],'instruction':_0xc89203['data'][_0x1f2901(0x2a9)],'original_code':_0x5fd354!==null?_0x5fd354[_0x1f2901(0x242)]>0xc350?_0x5fd354[_0x1f2901(0x207)](0x0,0xc350)+_0x1f2901(0x2a6)+_0x5fd354['length']+_0x1f2901(0x1c3):_0x5fd354:_0x1f2901(0x28c)+(_0x4dd398||_0x1f2901(0x2b8))+']','original_code_length':_0x5fd354?.['length']??0x0,'model':_0x1f2901(0x289),'dry_run':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2b7)]}},'stack_trace':_0x1e75fa instanceof Error?_0x1e75fa['stack']:undefined,'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x10ab4b}],'isError':!![]};}}case'codebase_search':{const _0x153c86=WarpGrepArgsSchema[_0x1f2901(0x26f)](_0x97636a);if(!_0x153c86[_0x1f2901(0x249)])return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x245)+_0x153c86[_0x1f2901(0x264)]}],'isError':!![]};const _0x3af8a7=_0x20af8d=>{const _0x300468=_0x1f2901,_0x50b6fa=[];for(const _0x542c24 of _0x20af8d||[]){if(_0x542c24[_0x300468(0x220)]==='assistant'&&Array[_0x300468(0x1d2)](_0x542c24[_0x300468(0x1ca)]))for(const _0x2d0b61 of _0x542c24[_0x300468(0x1ca)]){try{const _0x15288a=_0x2d0b61['function']?.[_0x300468(0x23d)],_0x3e469f=JSON[_0x300468(0x27e)](_0x2d0b61['function']?.[_0x300468(0x1ef)]||'{}');if(_0x15288a==='grep_search')_0x50b6fa['push'](_0x300468(0x1bc)+_0x3e469f[_0x300468(0x261)]+'\x27\x20'+(_0x3e469f[_0x300468(0x230)]||'.'));else{if(_0x15288a===_0x300468(0x2c9))_0x50b6fa[_0x300468(0x202)](_0x300468(0x1c5)+_0x3e469f[_0x300468(0x230)]);else{if(_0x15288a===_0x300468(0x1f5))_0x50b6fa[_0x300468(0x202)](_0x300468(0x2ba)+(_0x3e469f[_0x300468(0x255)]||'.'));else{if(_0x15288a===_0x300468(0x238))_0x50b6fa['push'](_0x300468(0x1be)+_0x3e469f[_0x300468(0x261)]+'\x27\x20'+(_0x3e469f[_0x300468(0x230)]||'.'));else _0x15288a===_0x300468(0x1f7)&&_0x50b6fa[_0x300468(0x202)]('finish');}}}}catch{}}}return _0x50b6fa;},_0x19b0ba=_0xe50d64=>{const _0x170a10=_0x1f2901,_0x41abd6=[];if(!_0xe50d64||!Array['isArray'](_0xe50d64))return _0x41abd6;const _0x20148c=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x170a10(0x270),'tool':_0x170a10(0x2c9)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x170a10(0x2c9)},{'pattern':/\[READ ERROR\]/,'error_type':_0x170a10(0x1e7),'tool':_0x170a10(0x2c9)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x170a10(0x2c9)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x170a10(0x1da)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x170a10(0x252),'tool':_0x170a10(0x1da)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x170a10(0x215),'tool':_0x170a10(0x2c9)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x170a10(0x2c9)},{'pattern':/not a text file/,'error_type':_0x170a10(0x215),'tool':_0x170a10(0x2c9)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x170a10(0x2c9)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x170a10(0x2c9)},{'pattern':/status="error"/,'error_type':_0x170a10(0x1dd),'tool':_0x170a10(0x26e)}];let _0x23f0ec=0x0;for(const _0x58bba8 of _0xe50d64){_0x58bba8[_0x170a10(0x220)]===_0x170a10(0x251)&&Array[_0x170a10(0x1d2)](_0x58bba8[_0x170a10(0x1ca)])&&_0x23f0ec++;const _0x26f807=_0x58bba8[_0x170a10(0x2aa)];if((_0x58bba8[_0x170a10(0x220)]===_0x170a10(0x2a1)||_0x58bba8[_0x170a10(0x220)]===_0x170a10(0x274))&&_0x26f807&&typeof _0x26f807===_0x170a10(0x1ee))for(const {pattern:_0x26fc49,error_type:_0x393c0d,tool:_0x392eeb}of _0x20148c){const _0x5b8735=_0x26f807[_0x170a10(0x1dc)](new RegExp(_0x26fc49['source'],'g'));if(_0x5b8735)for(const _0x3b28d7 of _0x5b8735){const _0xa14b47=_0x26f807['indexOf'](_0x3b28d7),_0x6f998f=_0x26f807[_0x170a10(0x207)](_0xa14b47,Math[_0x170a10(0x26a)](_0xa14b47+0xc8,_0x26f807['length']));_0x41abd6['push']({'tool':_0x392eeb,'error_type':_0x393c0d,'error_message':_0x6f998f[_0x170a10(0x273)]('\x0a')[0x0],'turn':_0x23f0ec});}}}return _0x41abd6;};try{const _0x258399=a0_0xfcf33['resolve'](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)]),_0x50850e=_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x266)],_0x456725=_0x50850e===_0x1f2901(0x28b)?{'allowNames':[_0x1f2901(0x28b)]}:undefined,_0x5f02e9=new LocalRipgrepProvider(_0x258399,undefined,_0x456725),_0x33400e=await runWarpGrep({'searchTerm':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'repoRoot':_0x258399,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x5f02e9,'search_type':_0x50850e}),_0x4b2b8e=_0x19b0ba(_0x33400e[_0x1f2901(0x1e4)]);_0x4b2b8e[_0x1f2901(0x242)]>0x0&&reportMorphError({'error_message':_0x1f2901(0x1e3)+_0x4b2b8e[_0x1f2901(0x242)]+'\x20error(s)','error_type':_0x1f2901(0x1c6),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)]['search_string'],'model':_0x1f2901(0x294),'termination_reason':_0x33400e[_0x1f2901(0x1e1)],'sub_tool_errors':_0x4b2b8e,'timings':_0x33400e[_0x1f2901(0x20d)],'tool_calls':_0x3af8a7(_0x33400e[_0x1f2901(0x1e4)]),'messages':_0x33400e['messages']?.[_0x1f2901(0x22a)](_0x562f56=>({'role':_0x562f56[_0x1f2901(0x220)],'content':_0x562f56['content'],..._0x562f56[_0x1f2901(0x1ca)]?{'tool_calls':_0x562f56[_0x1f2901(0x1ca)][_0x1f2901(0x242)]}:{},..._0x562f56[_0x1f2901(0x1f2)]?{'tool_call_id':_0x562f56[_0x1f2901(0x1f2)]}:{}}))},'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{});let _0x5a7765='';if(_0x33400e[_0x1f2901(0x1e1)]==='completed'&&_0x33400e[_0x1f2901(0x1f7)]?.['metadata']?.[_0x1f2901(0x240)]){const _0x8bd088=_0x33400e[_0x1f2901(0x1f7)][_0x1f2901(0x290)]['files'];if(_0x8bd088['length']===0x0)return _0x5a7765=_0x33400e[_0x1f2901(0x1f7)][_0x1f2901(0x1d4)]||_0x1f2901(0x246),{'content':[{'type':_0x1f2901(0x25e),'text':_0x5a7765}]};const _0x3ce8f7=[],_0x316c0b=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x1890ec of _0x33400e[_0x1f2901(0x1e4)]){if(_0x1890ec[_0x1f2901(0x220)]===_0x1f2901(0x251)&&Array[_0x1f2901(0x1d2)](_0x1890ec[_0x1f2901(0x1ca)]))for(const _0x3a2d3b of _0x1890ec['tool_calls']){try{const _0x530f10=_0x3a2d3b['function']?.[_0x1f2901(0x23d)],_0x265cba=JSON[_0x1f2901(0x27e)](_0x3a2d3b[_0x1f2901(0x222)]?.[_0x1f2901(0x1ef)]||'{}');if(_0x530f10===_0x1f2901(0x237))_0x316c0b['push'](_0x1f2901(0x22e)+_0x265cba[_0x1f2901(0x261)]+_0x1f2901(0x218)+(_0x265cba[_0x1f2901(0x230)]||'.')+'`');else{if(_0x530f10===_0x1f2901(0x2c9))_0x316c0b['push'](_0x1f2901(0x1cf)+_0x265cba[_0x1f2901(0x230)]+'`');else{if(_0x530f10===_0x1f2901(0x1f5))_0x316c0b[_0x1f2901(0x202)](_0x1f2901(0x234)+(_0x265cba[_0x1f2901(0x255)]||'.')+'`');else _0x530f10===_0x1f2901(0x238)&&_0x316c0b[_0x1f2901(0x202)](_0x1f2901(0x22c)+_0x265cba[_0x1f2901(0x261)]+_0x1f2901(0x1d7)+(_0x265cba[_0x1f2901(0x230)]||'.')+'`');}}}catch{}}}_0x3ce8f7[_0x1f2901(0x202)](_0x316c0b['join']('\x0a'));const _0x1dc409=['',_0x1f2901(0x29c)];for(const _0x102dc8 of _0x8bd088){if(_0x102dc8[_0x1f2901(0x27c)]==='*')_0x1dc409['push']('-\x20'+_0x102dc8[_0x1f2901(0x230)]+':*');else{if(Array['isArray'](_0x102dc8['lines'])){const _0xeb223f=_0x102dc8[_0x1f2901(0x27c)][_0x1f2901(0x22a)](([_0x2b38e5,_0x1d4c1f])=>{if(_0x2b38e5===_0x1d4c1f)return''+_0x2b38e5;return _0x2b38e5+'-'+_0x1d4c1f;});_0x1dc409[_0x1f2901(0x202)]('-\x20'+_0x102dc8[_0x1f2901(0x230)]+':'+_0xeb223f['join'](','));}else _0x1dc409[_0x1f2901(0x202)]('-\x20'+_0x102dc8[_0x1f2901(0x230)]+':*');}}_0x1dc409[_0x1f2901(0x202)](''),_0x3ce8f7['push'](_0x1dc409[_0x1f2901(0x1d3)]('\x0a')),_0x3ce8f7[_0x1f2901(0x202)](_0x1f2901(0x1ec));const _0x514992=[];for(const _0x4b9d4b of _0x8bd088){let _0x107eee=a0_0xfcf33['resolve'](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],_0x4b9d4b[_0x1f2901(0x230)]),_0x1356f6=null,_0x3e0fbc=null;try{_0x1356f6=await a0_0xf525bc['readFile'](_0x107eee,{'encoding':_0x1f2901(0x279)});}catch(_0x5652e3){const _0x490e5d=fixPathRepetition(_0x107eee);if(_0x490e5d)try{_0x1356f6=await a0_0xf525bc[_0x1f2901(0x28d)](_0x490e5d,{'encoding':_0x1f2901(0x279)}),_0x107eee=_0x490e5d;}catch{_0x3e0fbc=_0x5652e3 instanceof Error?_0x5652e3:new Error(String(_0x5652e3));}else _0x3e0fbc=_0x5652e3 instanceof Error?_0x5652e3:new Error(String(_0x5652e3));}if(_0x1356f6!==null){const _0x43f6b1=_0x1356f6[_0x1f2901(0x273)](/\r?\n/),_0x1ea301=['<file\x20path=\x22'+_0x4b9d4b['path']+'\x22>'];if(_0x4b9d4b['lines']==='*'||!Array[_0x1f2901(0x1d2)](_0x4b9d4b[_0x1f2901(0x27c)]))for(let _0x47e5c8=0x1;_0x47e5c8<=_0x43f6b1[_0x1f2901(0x242)];_0x47e5c8++){const _0x2ce11d=_0x43f6b1[_0x47e5c8-0x1];_0x1ea301[_0x1f2901(0x202)](_0x47e5c8+'|\x20'+_0x2ce11d);}else for(const [_0x28e708,_0x1cbe76]of _0x4b9d4b['lines']){_0x1ea301[_0x1f2901(0x242)]>0x1&&_0x1ea301['push']('');for(let _0x246091=_0x28e708;_0x246091<=_0x1cbe76&&_0x246091<=_0x43f6b1[_0x1f2901(0x242)];_0x246091++){const _0x7a2f28=_0x43f6b1[_0x246091-0x1];_0x1ea301['push'](_0x246091+'|\x20'+_0x7a2f28);}}_0x1ea301[_0x1f2901(0x202)](_0x1f2901(0x258)),_0x514992[_0x1f2901(0x202)](_0x1ea301[_0x1f2901(0x1d3)]('\x0a'));}else _0x514992['push'](_0x1f2901(0x265)+_0x4b9d4b[_0x1f2901(0x230)]+_0x1f2901(0x2ca)+(_0x3e0fbc?.[_0x1f2901(0x1f0)]||_0x1f2901(0x2c6))+'\x0a</file>');}_0x3ce8f7['push'](_0x514992[_0x1f2901(0x1d3)]('\x0a\x0a')),_0x5a7765=_0x3ce8f7['join']('\x0a');const _0x577b4a=_0x33400e['errors']?.[_0x1f2901(0x1b8)](_0x4b2342=>_0x4b2342[_0x1f2901(0x1f0)]?.[_0x1f2901(0x29a)](_0x1f2901(0x20a)))||[];if(_0x577b4a[_0x1f2901(0x242)]>0x0){const _0x2619de=_0x577b4a[_0x1f2901(0x22a)](_0xd5f8fa=>_0xd5f8fa[_0x1f2901(0x1f0)])['join'](';\x20');reportMorphError({'error_message':_0x2619de,'error_type':_0x1f2901(0x2ae),'context':{'tool':'codebase_search','repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'model':_0x1f2901(0x294),'termination_reason':_0x1f2901(0x27d),'error_count':_0x577b4a[_0x1f2901(0x242)],'is_timeout':![],'timings':_0x33400e[_0x1f2901(0x20d)],'files_attempted':_0x8bd088[_0x1f2901(0x22a)](_0x4ce2e2=>({'path':_0x4ce2e2[_0x1f2901(0x230)],'lines':_0x4ce2e2['lines']})),'tool_calls':_0x3af8a7(_0x33400e[_0x1f2901(0x1e4)]),'messages':_0x33400e[_0x1f2901(0x1e4)]?.[_0x1f2901(0x22a)](_0x19812a=>({'role':_0x19812a[_0x1f2901(0x220)],'content':_0x19812a[_0x1f2901(0x2aa)],..._0x19812a[_0x1f2901(0x1ca)]?{'tool_calls':_0x19812a[_0x1f2901(0x1ca)][_0x1f2901(0x242)]}:{},..._0x19812a[_0x1f2901(0x1f2)]?{'tool_call_id':_0x19812a[_0x1f2901(0x1f2)]}:{}})),'request_content':{'query':_0x153c86['data'][_0x1f2901(0x26c)],'repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'repoRoot':a0_0xfcf33[_0x1f2901(0x1cd)](_0x153c86[_0x1f2901(0x2a0)]['repo_path']),'model':_0x1f2901(0x294)}},'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{});}}else{if(_0x33400e[_0x1f2901(0x1e1)]==='terminated'&&_0x33400e['errors'][_0x1f2901(0x242)]>0x0){const _0x4b1692=_0x33400e[_0x1f2901(0x2c4)][_0x1f2901(0x22a)](_0x6d07d7=>_0x6d07d7['message'])[_0x1f2901(0x1d3)](';\x20');_0x5a7765='Error:\x20'+_0x4b1692;const _0x1ab5a8=_0x4b1692['toLowerCase']()[_0x1f2901(0x256)](_0x1f2901(0x27a))||_0x4b1692[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)](_0x1f2901(0x2a8))||_0x4b1692[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)](_0x1f2901(0x2c3)),_0x22b148=_0x33400e[_0x1f2901(0x1f7)]?.[_0x1f2901(0x290)]?.[_0x1f2901(0x240)],_0x408640=_0x33400e['errors'][0x0];reportMorphError({'error_message':_0x4b1692,'error_type':_0x1ab5a8?_0x1f2901(0x26b):_0x408640?.[_0x1f2901(0x231)]?.[_0x1f2901(0x23d)]||_0x1f2901(0x268),'context':{'tool':_0x1f2901(0x250),'repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'model':_0x1f2901(0x294),'termination_reason':_0x33400e[_0x1f2901(0x1e1)],'error_count':_0x33400e[_0x1f2901(0x2c4)][_0x1f2901(0x242)],'is_timeout':_0x1ab5a8,'timings':_0x33400e['timings'],'files_attempted':_0x22b148?.[_0x1f2901(0x22a)](_0xe17e8c=>({'path':_0xe17e8c[_0x1f2901(0x230)],'lines':_0xe17e8c[_0x1f2901(0x27c)]})),'tool_calls':_0x3af8a7(_0x33400e[_0x1f2901(0x1e4)]),'messages':_0x33400e['messages']?.[_0x1f2901(0x22a)](_0x240453=>({'role':_0x240453['role'],'content':_0x240453['content'],..._0x240453[_0x1f2901(0x1ca)]?{'tool_calls':_0x240453[_0x1f2901(0x1ca)][_0x1f2901(0x242)]}:{},..._0x240453['tool_call_id']?{'tool_call_id':_0x240453[_0x1f2901(0x1f2)]}:{}})),'request_content':{'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'repo_path':_0x153c86[_0x1f2901(0x2a0)]['repo_path'],'repoRoot':a0_0xfcf33['resolve'](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)]),'model':_0x1f2901(0x294)}},'stack_trace':_0x408640?.[_0x1f2901(0x1fe)]||undefined,'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{});}else _0x5a7765=_0x1f2901(0x22f);}return{'content':[{'type':_0x1f2901(0x25e),'text':_0x5a7765}]};}catch(_0x1be035){const _0x5148ce=_0x1be035 instanceof Error?_0x1be035[_0x1f2901(0x1f0)]:String(_0x1be035),_0xe0fa7=_0x5148ce[_0x1f2901(0x1cb)]()['includes'](_0x1f2901(0x27a))||_0x5148ce[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)]('timed\x20out')||_0x5148ce[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)]('etimedout')||_0x1be035 instanceof Error&&_0x1be035[_0x1f2901(0x23d)]==='TimeoutError';return reportMorphError({'error_message':_0x5148ce,'error_type':_0xe0fa7?'TimeoutError':_0x1be035 instanceof Error?_0x1be035[_0x1f2901(0x231)][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':'codebase_search','repo_path':_0x153c86['data'][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'model':_0x1f2901(0x294),'is_timeout':_0xe0fa7,'exception_phase':_0x1f2901(0x1c9),'request_content':{'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'repo_path':_0x153c86['data']['repo_path'],'repoRoot':a0_0xfcf33[_0x1f2901(0x1cd)](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)]),'model':_0x1f2901(0x294)}},'stack_trace':_0x1be035 instanceof Error?_0x1be035[_0x1f2901(0x1fe)]:undefined,'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x5148ce}],'isError':![]};}}case _0x1f2901(0x1d6):{const _0x4dfeb2=WarpGrepGitHubArgsSchema[_0x1f2901(0x26f)](_0x97636a);if(!_0x4dfeb2[_0x1f2901(0x249)])return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x245)+_0x4dfeb2['error']}],'isError':!![]};const _0x512878=_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1e9)]||_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1f8)];if(!_0x512878)return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x281)}],'isError':!![]};const _0x3287eb=MORPH_API_KEY;if(!_0x3287eb)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x1b6530=Date['now']();logMcpStderr(_0x1f2901(0x1ed)+_0x512878+'\x20for:\x20\x22'+_0x4dfeb2[_0x1f2901(0x2a0)]['search_string']+'\x22');try{const _0x4fc41a=new WarpGrepClient({'morphApiKey':_0x3287eb,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x44d559=await _0x4fc41a[_0x1f2901(0x1ea)]({'searchTerm':_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'github':_0x512878,'branch':_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1e5)]}),_0x1947f1=Date[_0x1f2901(0x1fa)]()-_0x1b6530;logMcpStderr(_0x1f2901(0x286)+_0x1947f1+_0x1f2901(0x1c2)+_0x44d559[_0x1f2901(0x249)]);const _0x3f6f42=formatResult(_0x44d559);return{'content':[{'type':_0x1f2901(0x25e),'text':_0x3f6f42}]};}catch(_0x2486ff){const _0x318507=Date[_0x1f2901(0x1fa)]()-_0x1b6530,_0x118a64=_0x2486ff instanceof Error?_0x2486ff[_0x1f2901(0x1f0)]:String(_0x2486ff);return logMcpStderr(_0x1f2901(0x23b)+_0x318507+_0x1f2901(0x24c),_0x118a64),reportMorphError({'error_message':_0x118a64,'error_type':_0x2486ff instanceof Error?_0x2486ff[_0x1f2901(0x231)][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':_0x1f2901(0x1d6),'github_url':_0x512878,'search_string':_0x4dfeb2['data'][_0x1f2901(0x26c)],'branch':_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1e5)]},'stack_trace':_0x2486ff instanceof Error?_0x2486ff[_0x1f2901(0x1fe)]:undefined,'source':'mcp-filesystem','tool':_0x1f2901(0x1d6),'latency_ms':_0x318507})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x2bf)+_0x118a64}],'isError':![]};}}default:throw new Error(_0x1f2901(0x243)+_0x59c8cf);}}catch(_0x1a505e){const _0x1de5c7=_0x1a505e instanceof Error?_0x1a505e['message']:String(_0x1a505e);return reportMorphError({'error_message':_0x1de5c7,'error_type':_0x1a505e instanceof Error?_0x1a505e[_0x1f2901(0x231)][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':_0x59c8cf,'arguments':_0x97636a?JSON[_0x1f2901(0x280)](_0x97636a)[_0x1f2901(0x207)](0x0,0x1f4):undefined,'mcp_server_version':_0x1f2901(0x2b1)},'stack_trace':_0x1a505e instanceof Error?_0x1a505e[_0x1f2901(0x1fe)]:undefined,'source':'mcp-filesystem'})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x1e8)+_0x1de5c7}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5ddfa4){const _0x491f7c=a0_0x5f59de,_0x17bf1e=await getValidRootDirectories(_0x5ddfa4);if(_0x17bf1e['length']>0x0)allowedDirectories=[..._0x17bf1e],logMcpStderr(_0x491f7c(0x210)+_0x17bf1e[_0x491f7c(0x242)]+_0x491f7c(0x20e));else{logMcpStderr(_0x491f7c(0x2cb));if(ENABLE_WORKSPACE_MODE)try{const _0x4e056d=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4e056d&&(allowedDirectories=[_0x4e056d],logMcpStderr(_0x491f7c(0x2ac)+_0x4e056d));}catch(_0x455aa1){logMcpStderr(_0x491f7c(0x1d5)+_0x455aa1);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x4b10d8=a0_0x5f59de;try{const _0x12281d=await server[_0x4b10d8(0x2bc)]();_0x12281d&&_0x4b10d8(0x254)in _0x12281d&&await updateAllowedDirectoriesFromRoots(_0x12281d['roots']);}catch(_0x4ed3f5){logMcpStderr(_0x4b10d8(0x21c),_0x4ed3f5 instanceof Error?_0x4ed3f5['message']:String(_0x4ed3f5));}}),server[a0_0x5f59de(0x21b)]=async()=>{const _0x21a11b=a0_0x5f59de,_0x54a30c=server['getClientCapabilities']();if(_0x54a30c?.['roots'])try{const _0x431a09=await server[_0x21a11b(0x2bc)]();_0x431a09&&_0x21a11b(0x254)in _0x431a09?await updateAllowedDirectoriesFromRoots(_0x431a09[_0x21a11b(0x254)]):logMcpStderr(_0x21a11b(0x285));}catch(_0x43a74d){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x43a74d instanceof Error?_0x43a74d[_0x21a11b(0x1f0)]:String(_0x43a74d));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x21a11b(0x2ad),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');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 _0x155682=a0_0x5f59de,_0x5eaa39=new StdioServerTransport();await server[_0x155682(0x208)](_0x5eaa39),logMcpStderr(_0x155682(0x217)),allowedDirectories[_0x155682(0x242)]===0x0&&logMcpStderr(_0x155682(0x1e6));}function a0_0x888c(_0x2211f0,_0x9443c1){_0x2211f0=_0x2211f0-0x1b3;const _0x33a961=a0_0x33a9();let _0x888c82=_0x33a961[_0x2211f0];return _0x888c82;}runServer()[a0_0x5f59de(0x24a)](_0x291447=>{const _0xe90716=a0_0x5f59de;logMcpStderr(_0xe90716(0x2c7),_0x291447),process[_0xe90716(0x25a)](0x1);});
2
+ const a0_0x4261fe=a0_0x1d2d;function a0_0x6a63(){const _0x389217=['Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','has','Tool\x20\x22','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.','Morph\x20Edit\x20Preview','PathError','.vscode','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','[github_codebase_search]\x20Searching\x20','code','etimedout','ENABLE_WORKSPACE_MODE','--api-key=','stringify','requiresApiKey','branch','\x20for:\x20\x22','--api-key','RipgrepNotAvailable','user','arguments','runWarpGrep_call','read\x20','list_directory','github_url','[could\x20not\x20read\x20file:\x20','sep','inputSchema','morph-v3-fast','0.2.0','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','boolean','ReadError','code_edit','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Tool\x20','\x0aOptions:','warn','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','enum','morph-warp-grep-v2.1','description','Workspace\x20mode\x20enabled:\x20Using\x20','match','dirname','\x0a</file>','resolve','Cargo.toml','../package.json','data','Preview\x20changes\x20without\x20applying\x20them.','toISOString','timings','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','\x20as\x20allowed\x20directory','env','[github_codebase_search]\x20Failed\x20in\x20','FileNotFound','role','grep','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','\x20(new\x20file)','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.',',\x20removed\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Fatal\x20error\x20running\x20server:','name','trim','context','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','array','false','stat','4bHHkTG','@morphllm/morphmcp\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','Repository\x20identifier','<file\x20path=\x22','8204024evlTko','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','completed','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','realpath','Rules:\x0a','WarpGrep\x20sub-tool\x20errors:\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','isArray','connect','glob\x20\x27','lines','node_modules','Parent\x20directory\x20does\x20not\x20exist:\x20','Relevant\x20context\x20found:','Max\x20results\x20to\x20return','tool_call_id','listRoots','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x22>\x0aError\x20reading\x20file:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Bearer\x20','ToolException','finish','string','post','exit','search_type','owner_repo','changes','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','terminated','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Created\x20File','BinaryFile','searchGitHub','531984oXMTIM','some','stack','tool','dryRun','every','timeout','parse','codebase_search','split','MORPH_WARP_GREP_TIMEOUT','linesModified','SubToolError','\x20is\x20not\x20a\x20directory','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','push','files','mcp-filesystem','roots','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','errors','default','Unknown\x20error','\x0a...\x20(truncated,\x20total:\x20','package.json','Morph\x20Edit\x20','\x20\x20morph-mcp','text','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','optional','version','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','ms:','payload','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','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','join','catch','log','\x27\x20in\x20`','terminationReason','100SnEHjT','content','-\x20Glob\x20search\x20`','DISABLED_TOOLS','UnknownError','github_codebase_search','readFile','\x20disabled\x20via\x20DISABLED_TOOLS','success','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','completed_with_file_errors','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Error\x20accessing\x20directory\x20','metadata','utf-8','size','515226TosXKD','sk-','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','glob','message','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','homedir','api-key','Warning:\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','isDirectory','now','tool_calls','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','PWD','linesAdded','application/json','instruction','getClientCapabilities','`\x20in\x20`','Failed\x20to\x20request\x20roots\x20from\x20client:','setRequestHandler','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','assistant','substring','Warning:\x20Workspace\x20fallback\x20failed:\x20','For\x20deletions:\x0a','timed\x20out','slice','error','oninitialized','edit_file','all','constructor','--help','Error:\x20','function','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','messages','path','search_string','number','-\x20Read\x20file\x20`','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','TimeoutError','toLowerCase','repo_path','describe','pattern','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','-\x20Grepped\x20\x27','1193463mUHcMX','setNotificationHandler','Invalid\x20arguments:\x20','Failed\x20to\x20read\x20file:\x20','Benefits:\x0a','safeParse','WORKSPACE_ROOT','Disabled\x20tools:\x20','.\x20Changes:\x20','grep_search','tsconfig.json','--version','command','ENOENT','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','object','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27',',\x20modified\x20','Specific\x20commit\x20hash\x20to\x20search','includes','startsWith','length','argv','unknown','map','filter','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','composer.json','2456865EnnVLq','morph-mcp','SymlinkError','read','indexOf','7DdByPs','[github_codebase_search]\x20Done\x20in\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','RipgrepError','4234335aXynsp','WarpGrepError','Error\x20running\x20fast\x20context\x20search:\x20','.\x20Path:\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20error(s)','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','min','go.mod','265212kSzdOi'];a0_0x6a63=function(){return _0x389217;};return a0_0x6a63();}(function(_0x3ad9c0,_0xba8f7e){const _0x4f7327=a0_0x1d2d,_0x3112b7=_0x3ad9c0();while(!![]){try{const _0x46e907=-parseInt(_0x4f7327(0x261))/0x1+-parseInt(_0x4f7327(0x29b))/0x2+parseInt(_0x4f7327(0x1d7))/0x3+-parseInt(_0x4f7327(0x237))/0x4*(-parseInt(_0x4f7327(0x1e0))/0x5)+-parseInt(_0x4f7327(0x1ea))/0x6+-parseInt(_0x4f7327(0x1dc))/0x7*(-parseInt(_0x4f7327(0x23c))/0x8)+-parseInt(_0x4f7327(0x1ba))/0x9*(parseInt(_0x4f7327(0x28b))/0xa);if(_0x46e907===_0xba8f7e)break;else _0x3112b7['push'](_0x3112b7['shift']());}catch(_0x183926){_0x3112b7['push'](_0x3112b7['shift']());}}}(a0_0x6a63,0x81c00));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_0x2e9590 from'fs/promises';import a0_0x299f38 from'path';import a0_0x569f82 from'os';import{createRequire}from'module';function a0_0x1d2d(_0x40c8f8,_0x4e568c){_0x40c8f8=_0x40c8f8-0x1b7;const _0x6a63fb=a0_0x6a63();let _0x1d2d34=_0x6a63fb[_0x40c8f8];return _0x1d2d34;}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_0x2a9174 from'axios';function fixPathRepetition(_0x548774){const _0x1ae6ee=a0_0x1d2d,_0x3ac962=_0x548774[_0x1ae6ee(0x26a)](a0_0x299f38[_0x1ae6ee(0x206)])[_0x1ae6ee(0x1d4)](Boolean);if(_0x3ac962[_0x1ae6ee(0x1d0)]<0x2)return null;for(let _0xdafe65=Math['floor'](_0x3ac962[_0x1ae6ee(0x1d0)]/0x2);_0xdafe65>=0x1;_0xdafe65--){for(let _0x355deb=0x0;_0x355deb<=_0x3ac962[_0x1ae6ee(0x1d0)]-0x2*_0xdafe65;_0x355deb++){const _0x561f47=_0x3ac962[_0x1ae6ee(0x2b7)](_0x355deb,_0x355deb+_0xdafe65),_0x1bd74b=_0x3ac962[_0x1ae6ee(0x2b7)](_0x355deb+_0xdafe65,_0x355deb+0x2*_0xdafe65);if(_0x561f47[_0x1ae6ee(0x266)]((_0xfa6db1,_0x10f5cb)=>_0xfa6db1===_0x1bd74b[_0x10f5cb])){const _0x5ac454=[..._0x3ac962[_0x1ae6ee(0x2b7)](0x0,_0x355deb),..._0x3ac962[_0x1ae6ee(0x2b7)](_0x355deb+_0xdafe65)];return a0_0x299f38[_0x1ae6ee(0x206)]+_0x5ac454[_0x1ae6ee(0x286)](a0_0x299f38[_0x1ae6ee(0x206)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x5e3c62=a0_0x1d2d;try{const _0x5c6400=require(_0x5e3c62(0x21c));return _0x5c6400[_0x5e3c62(0x280)]??_0x5e3c62(0x1d2);}catch(_0x571498){return logMcpStderr(_0x5e3c62(0x231),_0x571498),_0x5e3c62(0x1d2);}}function printHelp(){const _0x3a7c1d=a0_0x1d2d;console[_0x3a7c1d(0x288)](_0x3a7c1d(0x238)+getPackageVersion()),console[_0x3a7c1d(0x288)](_0x3a7c1d(0x20e)),console['log'](_0x3a7c1d(0x210)),console['log']('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x3a7c1d(0x288)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x3a7c1d(0x288)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x3a7c1d(0x288)]('\x0aExamples:'),console[_0x3a7c1d(0x288)](_0x3a7c1d(0x27c)),console[_0x3a7c1d(0x288)](_0x3a7c1d(0x1d5));}const cliArgs=process[a0_0x4261fe(0x1d1)][a0_0x4261fe(0x2b7)](0x2),VERSION_FLAGS=new Set([a0_0x4261fe(0x1c5),'-v','-V']),HELP_FLAGS=new Set([a0_0x4261fe(0x2bd),'-h']);cliArgs['some'](_0x22be71=>VERSION_FLAGS[a0_0x4261fe(0x1ed)](_0x22be71))&&(console[a0_0x4261fe(0x288)](a0_0x4261fe(0x238)+getPackageVersion()),process[a0_0x4261fe(0x257)](0x0));cliArgs[a0_0x4261fe(0x262)](_0x300e91=>HELP_FLAGS[a0_0x4261fe(0x1ed)](_0x300e91))&&(printHelp(),process[a0_0x4261fe(0x257)](0x0));function getCliArg(_0x1c56c4){const _0x4033a2=a0_0x4261fe;for(let _0x1c659e=0x0;_0x1c659e<cliArgs[_0x4033a2(0x1d0)];_0x1c659e++){const _0xeb98c7=cliArgs[_0x1c659e];if(_0xeb98c7[_0x4033a2(0x1cf)]('--'+_0x1c56c4+'='))return _0xeb98c7[_0x4033a2(0x2b7)](('--'+_0x1c56c4+'=')[_0x4033a2(0x1d0)]);if(_0xeb98c7==='--'+_0x1c56c4&&_0x1c659e+0x1<cliArgs[_0x4033a2(0x1d0)])return cliArgs[_0x1c659e+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4261fe(0x1ed)](arg)||HELP_FLAGS[a0_0x4261fe(0x1ed)](arg))continue;if(arg[a0_0x4261fe(0x1cf)](a0_0x4261fe(0x1f8)))continue;if(arg===a0_0x4261fe(0x1fd)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x4261fe(0x223)][a0_0x4261fe(0x1c0)]||process[a0_0x4261fe(0x223)][a0_0x4261fe(0x2a9)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x4261fe(0x1f7)]!==a0_0x4261fe(0x235),MORPH_API_KEY=getCliArg(a0_0x4261fe(0x2a2))??process[a0_0x4261fe(0x223)]['MORPH_API_KEY'],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x4261fe(0x223)][a0_0x4261fe(0x26b)]?parseInt(process[a0_0x4261fe(0x223)][a0_0x4261fe(0x26b)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set(['edit_file','codebase_search',a0_0x4261fe(0x290)]),DISABLED_TOOLS=process[a0_0x4261fe(0x223)][a0_0x4261fe(0x28e)]?new Set(process[a0_0x4261fe(0x223)]['DISABLED_TOOLS'][a0_0x4261fe(0x26a)](',')['map'](_0x133413=>_0x133413[a0_0x4261fe(0x22f)]())['filter'](_0x394776=>_0x394776[a0_0x4261fe(0x1d0)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x4261fe(0x29a)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x4261fe(0x1ed)](tool)&&console['error'](a0_0x4261fe(0x240)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console['error'](a0_0x4261fe(0x1c1)+[...DISABLED_TOOLS][a0_0x4261fe(0x286)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x4261fe(0x29c))&&!MORPH_API_KEY[a0_0x4261fe(0x1cf)]('morph-')&&logMcpStderr(a0_0x4261fe(0x1cb));async function reportMorphError(_0x513858){const _0x57b9f7=a0_0x4261fe;try{await a0_0x2a9174[_0x57b9f7(0x256)]('https://morphllm.com/api/error-report',{..._0x513858,'timestamp':new Date()[_0x57b9f7(0x21f)](),'source':_0x513858['source']||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x513858[_0x57b9f7(0x230)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x57b9f7(0x2ab),'Authorization':_0x57b9f7(0x252)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x4261fe(0x2a0)),logMcpStderr(a0_0x4261fe(0x284)),logMcpStderr(a0_0x4261fe(0x2a4)),logMcpStderr(a0_0x4261fe(0x239)),logMcpStderr(a0_0x4261fe(0x296)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x19dff9){return a0_0x299f38['normalize'](_0x19dff9);}function expandHome(_0x3f2241){const _0x2e3bda=a0_0x4261fe;if(_0x3f2241[_0x2e3bda(0x1cf)]('~/')||_0x3f2241==='~')return a0_0x299f38[_0x2e3bda(0x286)](a0_0x569f82[_0x2e3bda(0x2a1)](),_0x3f2241[_0x2e3bda(0x2b7)](0x1));return _0x3f2241;}let allowedDirectories=await Promise['all'](args[a0_0x4261fe(0x1d3)](async _0x521b5f=>{const _0x34822f=expandHome(_0x521b5f),_0x549299=a0_0x299f38['resolve'](_0x34822f);try{const _0x30e9e7=await a0_0x2e9590['realpath'](_0x549299);return normalizePath(_0x30e9e7);}catch(_0x5581ed){return normalizePath(_0x549299);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4261fe(0x1d0)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4261fe(0x270)](workspaceDir),logMcpStderr(a0_0x4261fe(0x216)+workspaceDir+a0_0x4261fe(0x222)));}catch(a0_0x27c122){logMcpStderr(a0_0x4261fe(0x244)+a0_0x27c122);}async function detectWorkspaceRoot(_0x14c272){const _0x31e7ab=a0_0x4261fe;let _0x33e72e=a0_0x299f38[_0x31e7ab(0x21a)](_0x14c272);const _0x5853e9=['.git',_0x31e7ab(0x1f2),_0x31e7ab(0x27a),_0x31e7ab(0x21b),'pyproject.toml',_0x31e7ab(0x1e9),'.cursor',_0x31e7ab(0x1c4),_0x31e7ab(0x1d6)];while(_0x33e72e!==a0_0x299f38['dirname'](_0x33e72e)){for(const _0x3fe1c7 of _0x5853e9){const _0x5a31b6=a0_0x299f38[_0x31e7ab(0x286)](_0x33e72e,_0x3fe1c7);try{return await a0_0x2e9590['access'](_0x5a31b6),normalizePath(_0x33e72e);}catch{}}_0x33e72e=a0_0x299f38['dirname'](_0x33e72e);}return normalizePath(_0x14c272);}await Promise[a0_0x4261fe(0x2bb)](args[a0_0x4261fe(0x1d3)](async _0x249b7c=>{const _0x52df89=a0_0x4261fe;try{const _0x50cff3=await a0_0x2e9590[_0x52df89(0x236)](expandHome(_0x249b7c));!_0x50cff3[_0x52df89(0x2a5)]()&&(logMcpStderr('Error:\x20'+_0x249b7c+_0x52df89(0x26e)),process[_0x52df89(0x257)](0x1));}catch(_0x371c9d){logMcpStderr(_0x52df89(0x297)+_0x249b7c+':',_0x371c9d),process['exit'](0x1);}}));async function validatePath(_0x479244){const _0x1f3381=a0_0x4261fe,_0x499f05=expandHome(_0x479244),_0x317d84=a0_0x299f38[_0x1f3381(0x21a)](_0x499f05);try{const _0x86891a=await a0_0x2e9590['realpath'](_0x317d84);return _0x86891a;}catch(_0x237003){if(_0x237003['code']==='ENOENT'){const _0xfcfee8=a0_0x299f38['dirname'](_0x317d84);try{const _0x19294f=await a0_0x2e9590[_0x1f3381(0x241)](_0xfcfee8);return a0_0x299f38[_0x1f3381(0x286)](_0x19294f,a0_0x299f38['basename'](_0x317d84));}catch{throw new Error(_0x1f3381(0x24a)+_0xfcfee8);}}throw _0x237003;}}const MorphEditFileArgsSchema=z[a0_0x4261fe(0x1c9)]({'path':z['string'](),'code_edit':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x27e)),'instruction':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x22a)),'dryRun':z[a0_0x4261fe(0x20b)]()[a0_0x4261fe(0x277)](![])[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x21e))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x4261fe(0x1f3),WarpGrepArgsSchema=z[a0_0x4261fe(0x1c9)]({'search_string':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x4261fe(0x255)]()['describe'](a0_0x4261fe(0x285)),'search_type':z[a0_0x4261fe(0x213)]([a0_0x4261fe(0x277),a0_0x4261fe(0x249)])[a0_0x4261fe(0x27f)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x2c0))}),WarpGrepGitHubArgsSchema=z[a0_0x4261fe(0x1c9)]({'search_string':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x27f)]()['describe'](a0_0x4261fe(0x20a)),'owner_repo':z[a0_0x4261fe(0x255)]()['optional']()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x25b)),'branch':z['string']()[a0_0x4261fe(0x27f)]()['describe'](a0_0x4261fe(0x1ec))}),CodebaseSearchArgsSchema=z[a0_0x4261fe(0x1c9)]({'query':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x4261fe(0x255)]()['describe'](a0_0x4261fe(0x23a)),'branch':z[a0_0x4261fe(0x255)]()['optional']()[a0_0x4261fe(0x2ca)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x27f)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x1cd)),'targetDirectories':z[a0_0x4261fe(0x234)](z[a0_0x4261fe(0x255)]())[a0_0x4261fe(0x277)]([])[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x2a8)),'limit':z[a0_0x4261fe(0x2c4)]()[a0_0x4261fe(0x27f)]()['default'](0xa)[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x24c))}),server=new Server({'name':a0_0x4261fe(0x1d8),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x3b92ed=a0_0x4261fe,_0x33b3cb=[{'name':_0x3b92ed(0x2ba),'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'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x3b92ed(0x26f)+_0x3b92ed(0x1be)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x3b92ed(0x23d)+_0x3b92ed(0x251)+_0x3b92ed(0x2c6)+_0x3b92ed(0x1ca)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x3b92ed(0x2b5)+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+_0x3b92ed(0x281)+_0x3b92ed(0x242)+_0x3b92ed(0x212)+_0x3b92ed(0x1e4)+_0x3b92ed(0x23e)+_0x3b92ed(0x221)+_0x3b92ed(0x29d)+_0x3b92ed(0x228)+_0x3b92ed(0x2b1),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x3b92ed(0x269),'description':'A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3b92ed(0x275)+_0x3b92ed(0x22c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3b7cc9=_0x33b3cb[_0x3b92ed(0x1d4)](_0x285fe7=>{const _0x1581ca=_0x3b92ed;if(DISABLED_TOOLS[_0x1581ca(0x1ed)](_0x285fe7['name']))return console[_0x1581ca(0x2b8)](_0x1581ca(0x20f)+_0x285fe7[_0x1581ca(0x22e)]+_0x1581ca(0x292)),![];if(_0x1581ca(0x1fa)in _0x285fe7&&_0x285fe7[_0x1581ca(0x1fa)]&&!MORPH_API_KEY)return logMcpStderr(_0x1581ca(0x2a3)+_0x285fe7[_0x1581ca(0x22e)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x3b7cc9[_0x3b92ed(0x1d3)](_0xa3b31a=>({'name':_0xa3b31a['name'],'description':_0xa3b31a[_0x3b92ed(0x215)],'inputSchema':_0xa3b31a[_0x3b92ed(0x207)]}))};}),server[a0_0x4261fe(0x2b0)](CallToolRequestSchema,async _0x10dbc5=>{const _0x2c6ba3=a0_0x4261fe,{name:_0x54ac54,arguments:_0x25c399}=_0x10dbc5['params'];try{if(DISABLED_TOOLS['has'](_0x54ac54))throw new Error(_0x2c6ba3(0x1ee)+_0x54ac54+_0x2c6ba3(0x1e7));switch(_0x54ac54){case _0x2c6ba3(0x2ba):{const _0x2ce499=MorphEditFileArgsSchema['safeParse'](_0x25c399);if(!_0x2ce499[_0x2c6ba3(0x293)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x2ce499[_0x2c6ba3(0x2b8)]);const _0x3966fa=await validatePath(_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c2)]);let _0x48f852=null,_0x506843=!![],_0x2f797d=null;try{_0x48f852=await a0_0x2e9590[_0x2c6ba3(0x291)](_0x3966fa,_0x2c6ba3(0x299));}catch(_0x2d1c6a){const _0x47eab1=_0x2d1c6a[_0x2c6ba3(0x1f5)];_0x47eab1===_0x2c6ba3(0x1c7)?(_0x506843=![],_0x48f852=''):(_0x2f797d=_0x2c6ba3(0x1bd)+(_0x47eab1||_0x2c6ba3(0x1d2))+'\x20-\x20'+(_0x2d1c6a instanceof Error?_0x2d1c6a[_0x2c6ba3(0x29f)]:String(_0x2d1c6a)),logMcpStderr('Warning:\x20'+_0x2f797d));}let _0xe862de;try{const _0x4b19d5=MORPH_API_KEY;if(!_0x4b19d5)throw new Error(_0x2c6ba3(0x294));const _0x37ca0d=a0_0x299f38[_0x2c6ba3(0x218)](_0x3966fa),_0x11a17d=a0_0x299f38['basename'](_0x3966fa),_0x26bc7f=await executeEditFile({'target_filepath':_0x11a17d,'code_edit':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x20d)],'instructions':_0x2ce499[_0x2c6ba3(0x21d)]['instruction']},{'morphApiKey':_0x4b19d5,'morphApiUrl':MORPH_API_URL,'baseDir':_0x37ca0d,'autoWrite':!_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)],'generateUdiff':![],'debug':![]});_0xe862de=_0x26bc7f['completionId'];if(!_0x26bc7f[_0x2c6ba3(0x293)])throw new Error(_0x26bc7f['error']||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x2cb68e=_0x26bc7f[_0x2c6ba3(0x25a)],_0x5f1ae2='added\x20'+_0x2cb68e[_0x2c6ba3(0x2aa)]+_0x2c6ba3(0x22b)+_0x2cb68e['linesRemoved']+_0x2c6ba3(0x1cc)+_0x2cb68e[_0x2c6ba3(0x26c)];if(_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)])return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1f0)+(_0x506843?'':_0x2c6ba3(0x229))+':\x20'+_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)]+'.\x20Changes:\x20'+_0x5f1ae2+_0x2c6ba3(0x1e3)+_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c2)]+'.'}]};return{'content':[{'type':'text','text':_0x2c6ba3(0x27b)+(_0x506843?'Applied':_0x2c6ba3(0x25e))+':\x20'+_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)]+_0x2c6ba3(0x1c2)+_0x5f1ae2+'.\x20Path:\x20'+_0x2ce499[_0x2c6ba3(0x21d)]['path']+'.'}]};}catch(_0x47c529){const _0x37f76c=_0x47c529 instanceof Error?_0x47c529[_0x2c6ba3(0x29f)]:String(_0x47c529);return reportMorphError({'error_message':_0x37f76c,'error_type':_0x47c529 instanceof Error?_0x47c529[_0x2c6ba3(0x2bc)][_0x2c6ba3(0x22e)]:_0x2c6ba3(0x28f),'context':{'tool':_0x2c6ba3(0x2ba),'completion_id':_0xe862de,'file_path':_0x2ce499['data'][_0x2c6ba3(0x2c2)],'validated_path':_0x3966fa,'instruction':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)],'model':_0x2c6ba3(0x208),'dry_run':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)],'file_exists':_0x506843,'file_read_error':_0x2f797d,'file_readable':_0x48f852!==null,'request_content':{'path':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c2)],'code_edit':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x20d)],'instruction':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)],'original_code':_0x48f852!==null?_0x48f852[_0x2c6ba3(0x1d0)]>0xc350?_0x48f852[_0x2c6ba3(0x2b3)](0x0,0xc350)+_0x2c6ba3(0x279)+_0x48f852[_0x2c6ba3(0x1d0)]+'\x20chars)':_0x48f852:_0x2c6ba3(0x205)+(_0x2f797d||'unknown\x20error')+']','original_code_length':_0x48f852?.[_0x2c6ba3(0x1d0)]??0x0,'model':_0x2c6ba3(0x208),'dry_run':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)]}},'stack_trace':_0x47c529 instanceof Error?_0x47c529[_0x2c6ba3(0x263)]:undefined,'source':'mcp-filesystem'})[_0x2c6ba3(0x287)](()=>{}),{'content':[{'type':_0x2c6ba3(0x27d),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x37f76c}],'isError':!![]};}}case'codebase_search':{const _0x2f866f=WarpGrepArgsSchema[_0x2c6ba3(0x1bf)](_0x25c399);if(!_0x2f866f[_0x2c6ba3(0x293)])return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1bc)+_0x2f866f['error']}],'isError':!![]};const _0x449cd1=_0x676a36=>{const _0x35871d=_0x2c6ba3,_0x89d1c6=[];for(const _0x4b621e of _0x676a36||[]){if(_0x4b621e['role']==='assistant'&&Array[_0x35871d(0x245)](_0x4b621e[_0x35871d(0x2a7)]))for(const _0xc1fc6d of _0x4b621e[_0x35871d(0x2a7)]){try{const _0x2cdff7=_0xc1fc6d[_0x35871d(0x2bf)]?.['name'],_0xfff64f=JSON[_0x35871d(0x268)](_0xc1fc6d[_0x35871d(0x2bf)]?.[_0x35871d(0x200)]||'{}');if(_0x2cdff7==='grep_search')_0x89d1c6[_0x35871d(0x270)]('grep\x20\x27'+_0xfff64f[_0x35871d(0x1b7)]+'\x27\x20'+(_0xfff64f[_0x35871d(0x2c2)]||'.'));else{if(_0x2cdff7===_0x35871d(0x1da))_0x89d1c6[_0x35871d(0x270)](_0x35871d(0x202)+_0xfff64f[_0x35871d(0x2c2)]);else{if(_0x2cdff7===_0x35871d(0x203))_0x89d1c6[_0x35871d(0x270)]('list_directory\x20'+(_0xfff64f[_0x35871d(0x1c6)]||'.'));else{if(_0x2cdff7===_0x35871d(0x29e))_0x89d1c6[_0x35871d(0x270)](_0x35871d(0x247)+_0xfff64f['pattern']+'\x27\x20'+(_0xfff64f[_0x35871d(0x2c2)]||'.'));else _0x2cdff7==='finish'&&_0x89d1c6[_0x35871d(0x270)](_0x35871d(0x254));}}}}catch{}}}return _0x89d1c6;},_0x7e106d=_0x28453f=>{const _0x1ef069=_0x2c6ba3,_0x553553=[];if(!_0x28453f||!Array[_0x1ef069(0x245)](_0x28453f))return _0x553553;const _0x262d7f=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1ef069(0x225),'tool':_0x1ef069(0x1da)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1ef069(0x1f1),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x1ef069(0x20c),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1ef069(0x25f),'tool':_0x1ef069(0x1da)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1ef069(0x1df),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1ef069(0x1fe),'tool':_0x1ef069(0x227)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x1ef069(0x1da)},{'pattern':/\[SYMLINK\]/,'error_type':_0x1ef069(0x1d9),'tool':_0x1ef069(0x1da)},{'pattern':/not a text file/,'error_type':_0x1ef069(0x25f),'tool':_0x1ef069(0x1da)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x1ef069(0x1da)},{'pattern':/Error reading file:/,'error_type':_0x1ef069(0x20c),'tool':_0x1ef069(0x1da)},{'pattern':/status="error"/,'error_type':_0x1ef069(0x253),'tool':_0x1ef069(0x1d2)}];let _0x387524=0x0;for(const _0x3a20c2 of _0x28453f){_0x3a20c2[_0x1ef069(0x226)]===_0x1ef069(0x2b2)&&Array[_0x1ef069(0x245)](_0x3a20c2[_0x1ef069(0x2a7)])&&_0x387524++;const _0x1ebf14=_0x3a20c2[_0x1ef069(0x28c)];if((_0x3a20c2[_0x1ef069(0x226)]===_0x1ef069(0x264)||_0x3a20c2[_0x1ef069(0x226)]===_0x1ef069(0x1ff))&&_0x1ebf14&&typeof _0x1ebf14===_0x1ef069(0x255))for(const {pattern:_0x10e246,error_type:_0x17ce43,tool:_0x512fe2}of _0x262d7f){const _0x5d4e70=_0x1ebf14[_0x1ef069(0x217)](new RegExp(_0x10e246['source'],'g'));if(_0x5d4e70)for(const _0x15edaf of _0x5d4e70){const _0x2b8355=_0x1ebf14[_0x1ef069(0x1db)](_0x15edaf),_0x8de57a=_0x1ebf14[_0x1ef069(0x2b3)](_0x2b8355,Math[_0x1ef069(0x1e8)](_0x2b8355+0xc8,_0x1ebf14['length']));_0x553553[_0x1ef069(0x270)]({'tool':_0x512fe2,'error_type':_0x17ce43,'error_message':_0x8de57a[_0x1ef069(0x26a)]('\x0a')[0x0],'turn':_0x387524});}}}return _0x553553;};try{const _0x47a37b=a0_0x299f38[_0x2c6ba3(0x21a)](_0x2f866f['data'][_0x2c6ba3(0x2c9)]),_0xed4dd3=_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x258)],_0x4d86e8=_0xed4dd3==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x4364a7=new LocalRipgrepProvider(_0x47a37b,undefined,_0x4d86e8),_0x51eac1=await runWarpGrep({'searchTerm':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'repoRoot':_0x47a37b,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4364a7,'search_type':_0xed4dd3}),_0x3e9049=_0x7e106d(_0x51eac1[_0x2c6ba3(0x2c1)]);_0x3e9049['length']>0x0&&reportMorphError({'error_message':_0x2c6ba3(0x243)+_0x3e9049[_0x2c6ba3(0x1d0)]+_0x2c6ba3(0x1e6),'error_type':_0x2c6ba3(0x26d),'level':_0x2c6ba3(0x211),'tool':_0x2c6ba3(0x269),'context':{'repo_path':_0x2f866f['data']['repo_path'],'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'model':'morph-warp-grep-v2.1','termination_reason':_0x51eac1['terminationReason'],'sub_tool_errors':_0x3e9049,'timings':_0x51eac1[_0x2c6ba3(0x220)],'tool_calls':_0x449cd1(_0x51eac1[_0x2c6ba3(0x2c1)]),'messages':_0x51eac1[_0x2c6ba3(0x2c1)]?.[_0x2c6ba3(0x1d3)](_0x3bb0b9=>({'role':_0x3bb0b9['role'],'content':_0x3bb0b9['content'],..._0x3bb0b9[_0x2c6ba3(0x2a7)]?{'tool_calls':_0x3bb0b9[_0x2c6ba3(0x2a7)][_0x2c6ba3(0x1d0)]}:{},..._0x3bb0b9['tool_call_id']?{'tool_call_id':_0x3bb0b9[_0x2c6ba3(0x24d)]}:{}}))},'source':'mcp-filesystem'})[_0x2c6ba3(0x287)](()=>{});let _0x1c4e26='';if(_0x51eac1['terminationReason']===_0x2c6ba3(0x23f)&&_0x51eac1[_0x2c6ba3(0x254)]?.['metadata']?.[_0x2c6ba3(0x271)]){const _0x383aa2=_0x51eac1['finish'][_0x2c6ba3(0x298)]['files'];if(_0x383aa2[_0x2c6ba3(0x1d0)]===0x0)return _0x1c4e26=_0x51eac1[_0x2c6ba3(0x254)][_0x2c6ba3(0x283)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x1c4e26}]};const _0x39998b=[],_0x554174=[_0x2c6ba3(0x1e5)];for(const _0x4c3cff of _0x51eac1[_0x2c6ba3(0x2c1)]){if(_0x4c3cff['role']===_0x2c6ba3(0x2b2)&&Array[_0x2c6ba3(0x245)](_0x4c3cff[_0x2c6ba3(0x2a7)]))for(const _0x5d975a of _0x4c3cff[_0x2c6ba3(0x2a7)]){try{const _0x42f7b7=_0x5d975a[_0x2c6ba3(0x2bf)]?.[_0x2c6ba3(0x22e)],_0x5313e5=JSON[_0x2c6ba3(0x268)](_0x5d975a['function']?.[_0x2c6ba3(0x200)]||'{}');if(_0x42f7b7===_0x2c6ba3(0x1c3))_0x554174['push'](_0x2c6ba3(0x1b9)+_0x5313e5[_0x2c6ba3(0x1b7)]+_0x2c6ba3(0x289)+(_0x5313e5[_0x2c6ba3(0x2c2)]||'.')+'`');else{if(_0x42f7b7===_0x2c6ba3(0x1da))_0x554174['push'](_0x2c6ba3(0x2c5)+_0x5313e5[_0x2c6ba3(0x2c2)]+'`');else{if(_0x42f7b7===_0x2c6ba3(0x203))_0x554174[_0x2c6ba3(0x270)]('-\x20Listed\x20directory\x20`'+(_0x5313e5[_0x2c6ba3(0x1c6)]||'.')+'`');else _0x42f7b7==='glob'&&_0x554174[_0x2c6ba3(0x270)](_0x2c6ba3(0x28d)+_0x5313e5[_0x2c6ba3(0x1b7)]+_0x2c6ba3(0x2ae)+(_0x5313e5['path']||'.')+'`');}}}catch{}}}_0x39998b[_0x2c6ba3(0x270)](_0x554174[_0x2c6ba3(0x286)]('\x0a'));const _0xcc52dc=['',_0x2c6ba3(0x24b)];for(const _0x11bfac of _0x383aa2){if(_0x11bfac[_0x2c6ba3(0x248)]==='*')_0xcc52dc['push']('-\x20'+_0x11bfac[_0x2c6ba3(0x2c2)]+':*');else{if(Array[_0x2c6ba3(0x245)](_0x11bfac[_0x2c6ba3(0x248)])){const _0x88cf1c=_0x11bfac[_0x2c6ba3(0x248)][_0x2c6ba3(0x1d3)](([_0x122f07,_0xdb4195])=>{if(_0x122f07===_0xdb4195)return''+_0x122f07;return _0x122f07+'-'+_0xdb4195;});_0xcc52dc[_0x2c6ba3(0x270)]('-\x20'+_0x11bfac[_0x2c6ba3(0x2c2)]+':'+_0x88cf1c[_0x2c6ba3(0x286)](','));}else _0xcc52dc[_0x2c6ba3(0x270)]('-\x20'+_0x11bfac['path']+':*');}}_0xcc52dc[_0x2c6ba3(0x270)](''),_0x39998b['push'](_0xcc52dc[_0x2c6ba3(0x286)]('\x0a')),_0x39998b['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0xeeb23d=[];for(const _0x231bf6 of _0x383aa2){let _0x1be5e0=a0_0x299f38[_0x2c6ba3(0x21a)](_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)],_0x231bf6[_0x2c6ba3(0x2c2)]),_0x2feda4=null,_0x43d8ff=null;try{_0x2feda4=await a0_0x2e9590[_0x2c6ba3(0x291)](_0x1be5e0,{'encoding':_0x2c6ba3(0x299)});}catch(_0x5061c8){const _0x2d90ba=fixPathRepetition(_0x1be5e0);if(_0x2d90ba)try{_0x2feda4=await a0_0x2e9590[_0x2c6ba3(0x291)](_0x2d90ba,{'encoding':'utf-8'}),_0x1be5e0=_0x2d90ba;}catch{_0x43d8ff=_0x5061c8 instanceof Error?_0x5061c8:new Error(String(_0x5061c8));}else _0x43d8ff=_0x5061c8 instanceof Error?_0x5061c8:new Error(String(_0x5061c8));}if(_0x2feda4!==null){const _0x3c3348=_0x2feda4['split'](/\r?\n/),_0x5eee6d=['<file\x20path=\x22'+_0x231bf6['path']+'\x22>'];if(_0x231bf6[_0x2c6ba3(0x248)]==='*'||!Array['isArray'](_0x231bf6[_0x2c6ba3(0x248)]))for(let _0x128e8e=0x1;_0x128e8e<=_0x3c3348[_0x2c6ba3(0x1d0)];_0x128e8e++){const _0x574f8f=_0x3c3348[_0x128e8e-0x1];_0x5eee6d['push'](_0x128e8e+'|\x20'+_0x574f8f);}else for(const [_0x324bc9,_0x30e8b4]of _0x231bf6[_0x2c6ba3(0x248)]){_0x5eee6d[_0x2c6ba3(0x1d0)]>0x1&&_0x5eee6d['push']('');for(let _0x28cd7f=_0x324bc9;_0x28cd7f<=_0x30e8b4&&_0x28cd7f<=_0x3c3348['length'];_0x28cd7f++){const _0x585fa1=_0x3c3348[_0x28cd7f-0x1];_0x5eee6d[_0x2c6ba3(0x270)](_0x28cd7f+'|\x20'+_0x585fa1);}}_0x5eee6d[_0x2c6ba3(0x270)]('</file>'),_0xeeb23d['push'](_0x5eee6d[_0x2c6ba3(0x286)]('\x0a'));}else _0xeeb23d['push'](_0x2c6ba3(0x23b)+_0x231bf6[_0x2c6ba3(0x2c2)]+_0x2c6ba3(0x250)+(_0x43d8ff?.[_0x2c6ba3(0x29f)]||_0x2c6ba3(0x278))+_0x2c6ba3(0x219));}_0x39998b['push'](_0xeeb23d['join']('\x0a\x0a')),_0x1c4e26=_0x39998b[_0x2c6ba3(0x286)]('\x0a');const _0x4679e9=_0x51eac1[_0x2c6ba3(0x276)]?.[_0x2c6ba3(0x1d4)](_0x296f1f=>_0x296f1f['message']?.[_0x2c6ba3(0x1cf)]('File\x20read\x20error:'))||[];if(_0x4679e9[_0x2c6ba3(0x1d0)]>0x0){const _0x5ac241=_0x4679e9[_0x2c6ba3(0x1d3)](_0x31cbf6=>_0x31cbf6[_0x2c6ba3(0x29f)])[_0x2c6ba3(0x286)](';\x20');reportMorphError({'error_message':_0x5ac241,'error_type':'FileReadError','context':{'tool':_0x2c6ba3(0x269),'repo_path':_0x2f866f[_0x2c6ba3(0x21d)]['repo_path'],'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'model':_0x2c6ba3(0x214),'termination_reason':_0x2c6ba3(0x295),'error_count':_0x4679e9[_0x2c6ba3(0x1d0)],'is_timeout':![],'timings':_0x51eac1[_0x2c6ba3(0x220)],'files_attempted':_0x383aa2[_0x2c6ba3(0x1d3)](_0x2faefd=>({'path':_0x2faefd['path'],'lines':_0x2faefd['lines']})),'tool_calls':_0x449cd1(_0x51eac1[_0x2c6ba3(0x2c1)]),'messages':_0x51eac1[_0x2c6ba3(0x2c1)]?.['map'](_0x585589=>({'role':_0x585589[_0x2c6ba3(0x226)],'content':_0x585589[_0x2c6ba3(0x28c)],..._0x585589[_0x2c6ba3(0x2a7)]?{'tool_calls':_0x585589['tool_calls'][_0x2c6ba3(0x1d0)]}:{},..._0x585589[_0x2c6ba3(0x24d)]?{'tool_call_id':_0x585589[_0x2c6ba3(0x24d)]}:{}})),'request_content':{'query':_0x2f866f[_0x2c6ba3(0x21d)]['search_string'],'repo_path':_0x2f866f['data'][_0x2c6ba3(0x2c9)],'repoRoot':a0_0x299f38[_0x2c6ba3(0x21a)](_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)]),'model':_0x2c6ba3(0x214)}},'source':'mcp-filesystem'})['catch'](()=>{});}}else{if(_0x51eac1[_0x2c6ba3(0x28a)]===_0x2c6ba3(0x25c)&&_0x51eac1['errors'][_0x2c6ba3(0x1d0)]>0x0){const _0x2f82a9=_0x51eac1[_0x2c6ba3(0x276)][_0x2c6ba3(0x1d3)](_0x58c2e6=>_0x58c2e6[_0x2c6ba3(0x29f)])[_0x2c6ba3(0x286)](';\x20');_0x1c4e26='Error:\x20'+_0x2f82a9;const _0x4d91a9=_0x2f82a9[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x267))||_0x2f82a9['toLowerCase']()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x2b6))||_0x2f82a9[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x1f6)),_0xe523ab=_0x51eac1[_0x2c6ba3(0x254)]?.[_0x2c6ba3(0x298)]?.['files'],_0x424239=_0x51eac1[_0x2c6ba3(0x276)][0x0];reportMorphError({'error_message':_0x2f82a9,'error_type':_0x4d91a9?_0x2c6ba3(0x2c7):_0x424239?.[_0x2c6ba3(0x2bc)]?.[_0x2c6ba3(0x22e)]||_0x2c6ba3(0x1e1),'context':{'tool':_0x2c6ba3(0x269),'repo_path':_0x2f866f['data'][_0x2c6ba3(0x2c9)],'query':_0x2f866f[_0x2c6ba3(0x21d)]['search_string'],'model':_0x2c6ba3(0x214),'termination_reason':_0x51eac1[_0x2c6ba3(0x28a)],'error_count':_0x51eac1[_0x2c6ba3(0x276)][_0x2c6ba3(0x1d0)],'is_timeout':_0x4d91a9,'timings':_0x51eac1[_0x2c6ba3(0x220)],'files_attempted':_0xe523ab?.[_0x2c6ba3(0x1d3)](_0x1f8492=>({'path':_0x1f8492[_0x2c6ba3(0x2c2)],'lines':_0x1f8492[_0x2c6ba3(0x248)]})),'tool_calls':_0x449cd1(_0x51eac1[_0x2c6ba3(0x2c1)]),'messages':_0x51eac1[_0x2c6ba3(0x2c1)]?.[_0x2c6ba3(0x1d3)](_0x356a94=>({'role':_0x356a94[_0x2c6ba3(0x226)],'content':_0x356a94['content'],..._0x356a94[_0x2c6ba3(0x2a7)]?{'tool_calls':_0x356a94['tool_calls'][_0x2c6ba3(0x1d0)]}:{},..._0x356a94[_0x2c6ba3(0x24d)]?{'tool_call_id':_0x356a94[_0x2c6ba3(0x24d)]}:{}})),'request_content':{'query':_0x2f866f['data'][_0x2c6ba3(0x2c3)],'repo_path':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)],'repoRoot':a0_0x299f38['resolve'](_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)]),'model':_0x2c6ba3(0x214)}},'stack_trace':_0x424239?.[_0x2c6ba3(0x263)]||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0x1c4e26=_0x2c6ba3(0x232);}return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x1c4e26}]};}catch(_0x396844){const _0x2864d0=_0x396844 instanceof Error?_0x396844['message']:String(_0x396844),_0xa4154e=_0x2864d0[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x267))||_0x2864d0['toLowerCase']()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x2b6))||_0x2864d0[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)]('etimedout')||_0x396844 instanceof Error&&_0x396844['name']==='TimeoutError';return reportMorphError({'error_message':_0x2864d0,'error_type':_0xa4154e?_0x2c6ba3(0x2c7):_0x396844 instanceof Error?_0x396844[_0x2c6ba3(0x2bc)][_0x2c6ba3(0x22e)]:_0x2c6ba3(0x28f),'context':{'tool':'codebase_search','repo_path':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)],'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'model':_0x2c6ba3(0x214),'is_timeout':_0xa4154e,'exception_phase':_0x2c6ba3(0x201),'request_content':{'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'repo_path':_0x2f866f['data'][_0x2c6ba3(0x2c9)],'repoRoot':a0_0x299f38['resolve'](_0x2f866f['data'][_0x2c6ba3(0x2c9)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x396844 instanceof Error?_0x396844[_0x2c6ba3(0x263)]:undefined,'source':'mcp-filesystem'})[_0x2c6ba3(0x287)](()=>{}),{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1e2)+_0x2864d0}],'isError':![]};}}case _0x2c6ba3(0x290):{const _0x5dacb8=WarpGrepGitHubArgsSchema[_0x2c6ba3(0x1bf)](_0x25c399);if(!_0x5dacb8[_0x2c6ba3(0x293)])return{'content':[{'type':'text','text':_0x2c6ba3(0x1bc)+_0x5dacb8['error']}],'isError':!![]};const _0x320151=_0x5dacb8[_0x2c6ba3(0x21d)][_0x2c6ba3(0x204)]||_0x5dacb8[_0x2c6ba3(0x21d)][_0x2c6ba3(0x259)];if(!_0x320151)return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1c8)}],'isError':!![]};const _0x3f4ae6=MORPH_API_KEY;if(!_0x3f4ae6)throw new Error(_0x2c6ba3(0x294));const _0x3d90ac=Date[_0x2c6ba3(0x2a6)]();logMcpStderr(_0x2c6ba3(0x1f4)+_0x320151+_0x2c6ba3(0x1fc)+_0x5dacb8[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)]+'\x22');try{const _0x5c6324=new WarpGrepClient({'morphApiKey':_0x3f4ae6,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4e78c6=await _0x5c6324[_0x2c6ba3(0x260)]({'searchTerm':_0x5dacb8[_0x2c6ba3(0x21d)]['search_string'],'github':_0x320151,'branch':_0x5dacb8['data'][_0x2c6ba3(0x1fb)]}),_0x3a8fe2=Date[_0x2c6ba3(0x2a6)]()-_0x3d90ac;logMcpStderr(_0x2c6ba3(0x1dd)+_0x3a8fe2+'ms.\x20Success:\x20'+_0x4e78c6[_0x2c6ba3(0x293)]);const _0x438f10=formatResult(_0x4e78c6);return{'content':[{'type':'text','text':_0x438f10}]};}catch(_0x2d7c6e){const _0x34b347=Date['now']()-_0x3d90ac,_0x3d8165=_0x2d7c6e instanceof Error?_0x2d7c6e[_0x2c6ba3(0x29f)]:String(_0x2d7c6e);return logMcpStderr(_0x2c6ba3(0x224)+_0x34b347+_0x2c6ba3(0x282),_0x3d8165),reportMorphError({'error_message':_0x3d8165,'error_type':_0x2d7c6e instanceof Error?_0x2d7c6e[_0x2c6ba3(0x2bc)][_0x2c6ba3(0x22e)]:'UnknownError','context':{'tool':_0x2c6ba3(0x290),'github_url':_0x320151,'search_string':_0x5dacb8[_0x2c6ba3(0x21d)]['search_string'],'branch':_0x5dacb8['data'][_0x2c6ba3(0x1fb)]},'stack_trace':_0x2d7c6e instanceof Error?_0x2d7c6e['stack']:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x34b347})[_0x2c6ba3(0x287)](()=>{}),{'content':[{'type':'text','text':'GitHub\x20search\x20failed:\x20'+_0x3d8165}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x54ac54);}}catch(_0x2d4971){const _0x1d2735=_0x2d4971 instanceof Error?_0x2d4971[_0x2c6ba3(0x29f)]:String(_0x2d4971);return reportMorphError({'error_message':_0x1d2735,'error_type':_0x2d4971 instanceof Error?_0x2d4971[_0x2c6ba3(0x2bc)]['name']:'UnknownError','context':{'tool':_0x54ac54,'arguments':_0x25c399?JSON[_0x2c6ba3(0x1f9)](_0x25c399)[_0x2c6ba3(0x2b3)](0x0,0x1f4):undefined,'mcp_server_version':_0x2c6ba3(0x209)},'stack_trace':_0x2d4971 instanceof Error?_0x2d4971[_0x2c6ba3(0x263)]:undefined,'source':_0x2c6ba3(0x272)})['catch'](()=>{}),{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x2be)+_0x1d2735}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2fa2d3){const _0x4b4e79=a0_0x4261fe,_0x3120a5=await getValidRootDirectories(_0x2fa2d3);if(_0x3120a5[_0x4b4e79(0x1d0)]>0x0)allowedDirectories=[..._0x3120a5],logMcpStderr(_0x4b4e79(0x25d)+_0x3120a5[_0x4b4e79(0x1d0)]+'\x20valid\x20directories');else{logMcpStderr(_0x4b4e79(0x1b8));if(ENABLE_WORKSPACE_MODE)try{const _0x453190=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x453190&&(allowedDirectories=[_0x453190],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x453190));}catch(_0x4eb3f6){logMcpStderr(_0x4b4e79(0x2b4)+_0x4eb3f6);}}}server[a0_0x4261fe(0x1bb)](RootsListChangedNotificationSchema,async()=>{const _0xa18c0f=a0_0x4261fe;try{const _0x192890=await server[_0xa18c0f(0x24e)]();_0x192890&&_0xa18c0f(0x273)in _0x192890&&await updateAllowedDirectoriesFromRoots(_0x192890['roots']);}catch(_0x2c6168){logMcpStderr(_0xa18c0f(0x2af),_0x2c6168 instanceof Error?_0x2c6168[_0xa18c0f(0x29f)]:String(_0x2c6168));}}),server[a0_0x4261fe(0x2b9)]=async()=>{const _0x32ac6e=a0_0x4261fe,_0x4c6c0f=server[_0x32ac6e(0x2ad)]();if(_0x4c6c0f?.['roots'])try{const _0x438f39=await server['listRoots']();_0x438f39&&_0x32ac6e(0x273)in _0x438f39?await updateAllowedDirectoriesFromRoots(_0x438f39[_0x32ac6e(0x273)]):logMcpStderr(_0x32ac6e(0x1de));}catch(_0x2cece8){logMcpStderr(_0x32ac6e(0x274),_0x2cece8 instanceof Error?_0x2cece8[_0x32ac6e(0x29f)]:String(_0x2cece8));}else{if(allowedDirectories[_0x32ac6e(0x1d0)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x32ac6e(0x1eb));else throw new Error(_0x32ac6e(0x1ef));}}};async function runServer(){const _0x222ea5=a0_0x4261fe,_0x24b1dd=new StdioServerTransport();await server[_0x222ea5(0x246)](_0x24b1dd),logMcpStderr(_0x222ea5(0x233)),allowedDirectories[_0x222ea5(0x1d0)]===0x0&&logMcpStderr(_0x222ea5(0x24f));}runServer()[a0_0x4261fe(0x287)](_0x101f75=>{const _0x53dc92=a0_0x4261fe;logMcpStderr(_0x53dc92(0x22d),_0x101f75),process[_0x53dc92(0x257)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x2d9731=a1_0x8e4a;(function(_0x32b949,_0x42a102){var _0x3f48b3=a1_0x8e4a,_0x3d40cd=_0x32b949();while(!![]){try{var _0x409063=parseInt(_0x3f48b3(0x128))/0x1*(-parseInt(_0x3f48b3(0x120))/0x2)+-parseInt(_0x3f48b3(0x129))/0x3+parseInt(_0x3f48b3(0x127))/0x4*(parseInt(_0x3f48b3(0x123))/0x5)+parseInt(_0x3f48b3(0x124))/0x6+parseInt(_0x3f48b3(0x11f))/0x7+parseInt(_0x3f48b3(0x125))/0x8+-parseInt(_0x3f48b3(0x122))/0x9;if(_0x409063===_0x42a102)break;else _0x3d40cd['push'](_0x3d40cd['shift']());}catch(_0x5b845f){_0x3d40cd['push'](_0x3d40cd['shift']());}}}(a1_0x1f52,0x3a420));import a1_0x57072c from'os';function a1_0x1f52(){var _0x496b38=['564584QaIZUV','[os=','28Aoaerr','8101nJzgXf','74811zwLPct','platform','win32','error','linux','darwin','Windows','1489614aDodHD','2cArehp','macOS','6980643DfnvQW','272035quQKML','2298390sfLccW'];a1_0x1f52=function(){return _0x496b38;};return a1_0x1f52();}export function getOperatingSystemType(_0x8e5965=a1_0x57072c[a1_0x2d9731(0x12a)]()){var _0x508383=a1_0x2d9731;switch(_0x8e5965){case _0x508383(0x11d):return _0x508383(0x121);case _0x508383(0x12b):return _0x508383(0x11e);case _0x508383(0x11c):return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0x49c5fb,_0x366a17=a1_0x57072c['platform']()){var _0x5dccc4=a1_0x2d9731;return _0x5dccc4(0x126)+getOperatingSystemType(_0x366a17)+']\x20'+_0x49c5fb;}function a1_0x8e4a(_0xaccaa5,_0x248465){_0xaccaa5=_0xaccaa5-0x11b;var _0x1f528d=a1_0x1f52();var _0x8e4af3=_0x1f528d[_0xaccaa5];return _0x8e4af3;}export function logMcpStderr(_0x1a365e,..._0x1eca94){var _0x254910=a1_0x2d9731;console[_0x254910(0x11b)](formatMcpLogMessage(_0x1a365e),..._0x1eca94);}
1
+ function a1_0xab1b(){var _0x271021=['11044408bEVHrb','4030779DCCWeB','911601TJayjy','Linux','2bjvIEW','5601676EbmvLd','510pkJVuS','macOS','linux','25iHaVQe','darwin','5577194cxCPUi','error','[os=','621902arytao','win32','platform','88482HTaQFy'];a1_0xab1b=function(){return _0x271021;};return a1_0xab1b();}var a1_0x3e160b=a1_0x554a;(function(_0x331154,_0x16c076){var _0x4675e7=a1_0x554a,_0x3687a3=_0x331154();while(!![]){try{var _0x278ab7=parseInt(_0x4675e7(0x119))/0x1+parseInt(_0x4675e7(0x121))/0x2*(-parseInt(_0x4675e7(0x11e))/0x3)+-parseInt(_0x4675e7(0x122))/0x4+parseInt(_0x4675e7(0x114))/0x5*(-parseInt(_0x4675e7(0x11c))/0x6)+-parseInt(_0x4675e7(0x116))/0x7+-parseInt(_0x4675e7(0x11d))/0x8+-parseInt(_0x4675e7(0x11f))/0x9*(-parseInt(_0x4675e7(0x111))/0xa);if(_0x278ab7===_0x16c076)break;else _0x3687a3['push'](_0x3687a3['shift']());}catch(_0x533db9){_0x3687a3['push'](_0x3687a3['shift']());}}}(a1_0xab1b,0xc1819));import a1_0x30ef81 from'os';function a1_0x554a(_0x1eb678,_0x5c9fc1){_0x1eb678=_0x1eb678-0x111;var _0xab1bf4=a1_0xab1b();var _0x554a68=_0xab1bf4[_0x1eb678];return _0x554a68;}export function getOperatingSystemType(_0x298d8f=a1_0x30ef81[a1_0x3e160b(0x11b)]()){var _0x3f6e8e=a1_0x3e160b;switch(_0x298d8f){case _0x3f6e8e(0x115):return _0x3f6e8e(0x112);case _0x3f6e8e(0x11a):return'Windows';case _0x3f6e8e(0x113):return _0x3f6e8e(0x120);default:return'Unknown';}}export function formatMcpLogMessage(_0x192ff5,_0x116687=a1_0x30ef81['platform']()){var _0x3a0ea7=a1_0x3e160b;return _0x3a0ea7(0x118)+getOperatingSystemType(_0x116687)+']\x20'+_0x192ff5;}export function logMcpStderr(_0x57b4da,..._0x4ec23d){var _0x42eee3=a1_0x3e160b;console[_0x42eee3(0x117)](formatMcpLogMessage(_0x57b4da),..._0x4ec23d);}
@@ -1 +1 @@
1
- function a2_0x2659(){const _0x283a3f=['join','1264606riBzqA','charAt','8194194jYZwUy','normalize','/mnt/','356497JrNBZa','4528230zqneNC','266568UjerAc','startsWith','5176cKNpPG','match','trim','105SnRHjb','602740OMpaJP','2619hoAlsI','replace','slice','homedir','3MRyyqY','253gstkmd'];a2_0x2659=function(){return _0x283a3f;};return a2_0x2659();}(function(_0x3a40e5,_0x36db5f){const _0x34c6fc=a2_0xcf9c,_0x5e29eb=_0x3a40e5();while(!![]){try{const _0x2e13bc=-parseInt(_0x34c6fc(0xa5))/0x1+parseInt(_0x34c6fc(0xa0))/0x2*(parseInt(_0x34c6fc(0x9d))/0x3)+-parseInt(_0x34c6fc(0xa7))/0x4*(-parseInt(_0x34c6fc(0xac))/0x5)+-parseInt(_0x34c6fc(0xa2))/0x6+-parseInt(_0x34c6fc(0xa6))/0x7+-parseInt(_0x34c6fc(0xa9))/0x8*(parseInt(_0x34c6fc(0xae))/0x9)+parseInt(_0x34c6fc(0xad))/0xa*(parseInt(_0x34c6fc(0x9e))/0xb);if(_0x2e13bc===_0x36db5f)break;else _0x5e29eb['push'](_0x5e29eb['shift']());}catch(_0x432d4e){_0x5e29eb['push'](_0x5e29eb['shift']());}}}(a2_0x2659,0xd2234));import a2_0xd925cc from'path';import a2_0x3ed0c0 from'os';export function convertToWindowsPath(_0x48046d){const _0x262126=a2_0xcf9c;if(_0x48046d[_0x262126(0xa8)](_0x262126(0xa4))){const _0x561846=_0x48046d[_0x262126(0xa1)](0x5)['toUpperCase'](),_0x33208f=_0x48046d[_0x262126(0x9b)](0x6)['replace'](/\//g,'\x5c');return _0x561846+':'+_0x33208f;}if(_0x48046d[_0x262126(0xaa)](/^\/[a-zA-Z]\//)){const _0x2f810b=_0x48046d[_0x262126(0xa1)](0x1)['toUpperCase'](),_0x374b12=_0x48046d[_0x262126(0x9b)](0x2)[_0x262126(0xaf)](/\//g,'\x5c');return _0x2f810b+':'+_0x374b12;}if(_0x48046d[_0x262126(0xaa)](/^[a-zA-Z]:/))return _0x48046d[_0x262126(0xaf)](/\//g,'\x5c');return _0x48046d;}function a2_0xcf9c(_0x132105,_0x1d8306){_0x132105=_0x132105-0x9b;const _0x2659ec=a2_0x2659();let _0xcf9ce=_0x2659ec[_0x132105];return _0xcf9ce;}export function normalizePath(_0x329b00){const _0x5523e9=a2_0xcf9c;_0x329b00=_0x329b00[_0x5523e9(0xab)]()[_0x5523e9(0xaf)](/^["']|["']$/g,'');const _0x2aa9bd=_0x329b00['startsWith']('/')&&!_0x329b00['match'](/^\/mnt\/[a-z]\//i)&&!_0x329b00[_0x5523e9(0xaa)](/^\/[a-zA-Z]\//);if(_0x2aa9bd)return _0x329b00[_0x5523e9(0xaf)](/\/+/g,'/')['replace'](/\/+$/,'');_0x329b00=convertToWindowsPath(_0x329b00);if(_0x329b00[_0x5523e9(0xa8)]('\x5c\x5c')){let _0x23c5a7=_0x329b00;_0x23c5a7=_0x23c5a7[_0x5523e9(0xaf)](/^\\{2,}/,'\x5c\x5c');const _0x30fc3d=_0x23c5a7['substring'](0x2)[_0x5523e9(0xaf)](/\\\\/g,'\x5c');_0x329b00='\x5c\x5c'+_0x30fc3d;}else _0x329b00=_0x329b00[_0x5523e9(0xaf)](/\\\\/g,'\x5c');let _0x3b8aba=a2_0xd925cc[_0x5523e9(0xa3)](_0x329b00);_0x329b00[_0x5523e9(0xa8)]('\x5c\x5c')&&!_0x3b8aba[_0x5523e9(0xa8)]('\x5c\x5c')&&(_0x3b8aba='\x5c'+_0x3b8aba);if(_0x3b8aba[_0x5523e9(0xaa)](/^[a-zA-Z]:/)){let _0x579b3e=_0x3b8aba[_0x5523e9(0xaf)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x579b3e)&&(_0x579b3e=_0x579b3e[_0x5523e9(0xa1)](0x0)['toUpperCase']()+_0x579b3e[_0x5523e9(0x9b)](0x1)),_0x579b3e;}return _0x3b8aba[_0x5523e9(0xaf)](/\//g,'\x5c');}export function expandHome(_0x2bb352){const _0x215321=a2_0xcf9c;if(_0x2bb352[_0x215321(0xa8)]('~/')||_0x2bb352==='~')return a2_0xd925cc[_0x215321(0x9f)](a2_0x3ed0c0[_0x215321(0x9c)](),_0x2bb352[_0x215321(0x9b)](0x1));return _0x2bb352;}
1
+ (function(_0x52beb4,_0x33b9d6){const _0x5eb30a=a2_0x376f,_0x13fa7c=_0x52beb4();while(!![]){try{const _0x2011c9=-parseInt(_0x5eb30a(0xe1))/0x1+-parseInt(_0x5eb30a(0xe3))/0x2*(-parseInt(_0x5eb30a(0xd4))/0x3)+parseInt(_0x5eb30a(0xe2))/0x4+-parseInt(_0x5eb30a(0xe0))/0x5*(parseInt(_0x5eb30a(0xd1))/0x6)+parseInt(_0x5eb30a(0xd2))/0x7+parseInt(_0x5eb30a(0xda))/0x8+-parseInt(_0x5eb30a(0xde))/0x9;if(_0x2011c9===_0x33b9d6)break;else _0x13fa7c['push'](_0x13fa7c['shift']());}catch(_0x39716c){_0x13fa7c['push'](_0x13fa7c['shift']());}}}(a2_0x4308,0xe1c9b));import a2_0x2de3af from'path';import a2_0x3db464 from'os';function a2_0x376f(_0x1a7004,_0x32d8c0){_0x1a7004=_0x1a7004-0xd1;const _0x4308b8=a2_0x4308();let _0x376f23=_0x4308b8[_0x1a7004];return _0x376f23;}export function convertToWindowsPath(_0x3026b8){const _0x29e060=a2_0x376f;if(_0x3026b8[_0x29e060(0xd6)](_0x29e060(0xd8))){const _0x50cc3d=_0x3026b8[_0x29e060(0xd3)](0x5)[_0x29e060(0xd7)](),_0x152c50=_0x3026b8['slice'](0x6)['replace'](/\//g,'\x5c');return _0x50cc3d+':'+_0x152c50;}if(_0x3026b8[_0x29e060(0xdd)](/^\/[a-zA-Z]\//)){const _0x256433=_0x3026b8['charAt'](0x1)[_0x29e060(0xd7)](),_0x130397=_0x3026b8[_0x29e060(0xd5)](0x2)[_0x29e060(0xdb)](/\//g,'\x5c');return _0x256433+':'+_0x130397;}if(_0x3026b8[_0x29e060(0xdd)](/^[a-zA-Z]:/))return _0x3026b8[_0x29e060(0xdb)](/\//g,'\x5c');return _0x3026b8;}export function normalizePath(_0x4eba17){const _0x4e6340=a2_0x376f;_0x4eba17=_0x4eba17[_0x4e6340(0xdf)]()['replace'](/^["']|["']$/g,'');const _0x5f04ae=_0x4eba17[_0x4e6340(0xd6)]('/')&&!_0x4eba17[_0x4e6340(0xdd)](/^\/mnt\/[a-z]\//i)&&!_0x4eba17[_0x4e6340(0xdd)](/^\/[a-zA-Z]\//);if(_0x5f04ae)return _0x4eba17[_0x4e6340(0xdb)](/\/+/g,'/')[_0x4e6340(0xdb)](/\/+$/,'');_0x4eba17=convertToWindowsPath(_0x4eba17);if(_0x4eba17['startsWith']('\x5c\x5c')){let _0x2ffedc=_0x4eba17;_0x2ffedc=_0x2ffedc[_0x4e6340(0xdb)](/^\\{2,}/,'\x5c\x5c');const _0x7f6353=_0x2ffedc[_0x4e6340(0xd9)](0x2)['replace'](/\\\\/g,'\x5c');_0x4eba17='\x5c\x5c'+_0x7f6353;}else _0x4eba17=_0x4eba17[_0x4e6340(0xdb)](/\\\\/g,'\x5c');let _0x51b432=a2_0x2de3af['normalize'](_0x4eba17);_0x4eba17['startsWith']('\x5c\x5c')&&!_0x51b432[_0x4e6340(0xd6)]('\x5c\x5c')&&(_0x51b432='\x5c'+_0x51b432);if(_0x51b432['match'](/^[a-zA-Z]:/)){let _0x76095a=_0x51b432[_0x4e6340(0xdb)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x76095a)&&(_0x76095a=_0x76095a['charAt'](0x0)[_0x4e6340(0xd7)]()+_0x76095a[_0x4e6340(0xd5)](0x1)),_0x76095a;}return _0x51b432[_0x4e6340(0xdb)](/\//g,'\x5c');}function a2_0x4308(){const _0x25b1da=['replace','homedir','match','23339691vfbJEn','trim','1031505MemdGY','54580BYyPiV','5418920ylgBCc','736298EAuWnj','36eMzfSr','7523397KggBjA','charAt','9pKreje','slice','startsWith','toUpperCase','/mnt/','substring','10212512ELwSMH'];a2_0x4308=function(){return _0x25b1da;};return a2_0x4308();}export function expandHome(_0x20e4a5){const _0x2b598b=a2_0x376f;if(_0x20e4a5['startsWith']('~/')||_0x20e4a5==='~')return a2_0x2de3af['join'](a2_0x3db464[_0x2b598b(0xdc)](),_0x20e4a5['slice'](0x1));return _0x20e4a5;}
@@ -1 +1 @@
1
- (function(_0x2122c2,_0x5a3e70){const _0x5e9e25=a3_0x1aa6,_0x2d438a=_0x2122c2();while(!![]){try{const _0x4d6eb1=parseInt(_0x5e9e25(0x97))/0x1*(parseInt(_0x5e9e25(0x9c))/0x2)+parseInt(_0x5e9e25(0x8f))/0x3*(-parseInt(_0x5e9e25(0x9b))/0x4)+parseInt(_0x5e9e25(0x95))/0x5+parseInt(_0x5e9e25(0x93))/0x6+-parseInt(_0x5e9e25(0x90))/0x7+-parseInt(_0x5e9e25(0x8b))/0x8+-parseInt(_0x5e9e25(0x92))/0x9*(parseInt(_0x5e9e25(0x99))/0xa);if(_0x4d6eb1===_0x5a3e70)break;else _0x2d438a['push'](_0x2d438a['shift']());}catch(_0x183685){_0x2d438a['push'](_0x2d438a['shift']());}}}(a3_0x2326,0x62764));import a3_0x1ccfb3 from'path';function a3_0x1aa6(_0x2c4a1b,_0x386ca4){_0x2c4a1b=_0x2c4a1b-0x89;const _0x23260d=a3_0x2326();let _0x1aa606=_0x23260d[_0x2c4a1b];return _0x1aa606;}export function isPathWithinAllowedDirectories(_0x4f8085,_0xdc1ac9){const _0x1a25ed=a3_0x1aa6;if(typeof _0x4f8085!=='string'||!Array['isArray'](_0xdc1ac9))return![];if(!_0x4f8085||_0xdc1ac9['length']===0x0)return![];if(_0x4f8085['includes']('\x00'))return![];let _0x9e7f8;try{_0x9e7f8=a3_0x1ccfb3['resolve'](a3_0x1ccfb3['normalize'](_0x4f8085));}catch{return![];}if(!a3_0x1ccfb3[_0x1a25ed(0x8c)](_0x9e7f8))throw new Error(_0x1a25ed(0x91));return _0xdc1ac9[_0x1a25ed(0x8e)](_0x241e62=>{const _0x26a3c6=_0x1a25ed;if(typeof _0x241e62!==_0x26a3c6(0x8a)||!_0x241e62)return![];if(_0x241e62[_0x26a3c6(0x89)]('\x00'))return![];let _0x2f8997;try{_0x2f8997=a3_0x1ccfb3[_0x26a3c6(0x9a)](a3_0x1ccfb3[_0x26a3c6(0x98)](_0x241e62));}catch{return![];}if(!a3_0x1ccfb3[_0x26a3c6(0x8c)](_0x2f8997))throw new Error(_0x26a3c6(0x94));if(_0x9e7f8===_0x2f8997)return!![];if(_0x2f8997===a3_0x1ccfb3[_0x26a3c6(0x96)])return _0x9e7f8[_0x26a3c6(0x8d)](a3_0x1ccfb3['sep']);return _0x9e7f8[_0x26a3c6(0x8d)](_0x2f8997+a3_0x1ccfb3[_0x26a3c6(0x96)]);});}function a3_0x2326(){const _0x3b3704=['4hQOGxu','1576522trKkOG','includes','string','3018280JQPtKY','isAbsolute','startsWith','some','1933644ioDjBp','2593885rWEfVh','Path\x20must\x20be\x20absolute\x20after\x20normalization','78984YnTQeI','3228330kEEbJM','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','3180580WQOgMz','sep','1HdIOdP','normalize','190FhbgEw','resolve'];a3_0x2326=function(){return _0x3b3704;};return a3_0x2326();}
1
+ function a3_0x3491(_0x2201f4,_0x3b9568){_0x2201f4=_0x2201f4-0x86;const _0x17da24=a3_0x17da();let _0x3491a5=_0x17da24[_0x2201f4];return _0x3491a5;}function a3_0x17da(){const _0x4e415c=['normalize','2422352HIFBZi','6oNHftZ','string','includes','isAbsolute','701566nbTcHs','316500hTfqXK','5732142hsMPVm','resolve','3062625RQwGZV','3774790hpZuBy','7IJYmyX','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','545115uSWCgq','sep','some','isArray','9RWBuBR'];a3_0x17da=function(){return _0x4e415c;};return a3_0x17da();}(function(_0x475373,_0x12d60f){const _0x524631=a3_0x3491,_0x53e64c=_0x475373();while(!![]){try{const _0x52c185=parseInt(_0x524631(0x92))/0x1+-parseInt(_0x524631(0x8e))/0x2*(parseInt(_0x524631(0x87))/0x3)+parseInt(_0x524631(0x93))/0x4+-parseInt(_0x524631(0x96))/0x5+parseInt(_0x524631(0x94))/0x6+-parseInt(_0x524631(0x98))/0x7*(-parseInt(_0x524631(0x8d))/0x8)+-parseInt(_0x524631(0x8b))/0x9*(parseInt(_0x524631(0x97))/0xa);if(_0x52c185===_0x12d60f)break;else _0x53e64c['push'](_0x53e64c['shift']());}catch(_0x5164ee){_0x53e64c['push'](_0x53e64c['shift']());}}}(a3_0x17da,0x7afab));import a3_0x336f89 from'path';export function isPathWithinAllowedDirectories(_0x1183fd,_0x406ac6){const _0x5e3ad5=a3_0x3491;if(typeof _0x1183fd!==_0x5e3ad5(0x8f)||!Array[_0x5e3ad5(0x8a)](_0x406ac6))return![];if(!_0x1183fd||_0x406ac6['length']===0x0)return![];if(_0x1183fd[_0x5e3ad5(0x90)]('\x00'))return![];let _0x495476;try{_0x495476=a3_0x336f89[_0x5e3ad5(0x95)](a3_0x336f89[_0x5e3ad5(0x8c)](_0x1183fd));}catch{return![];}if(!a3_0x336f89[_0x5e3ad5(0x91)](_0x495476))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x406ac6[_0x5e3ad5(0x89)](_0x1e16c4=>{const _0x16c5bb=_0x5e3ad5;if(typeof _0x1e16c4!==_0x16c5bb(0x8f)||!_0x1e16c4)return![];if(_0x1e16c4[_0x16c5bb(0x90)]('\x00'))return![];let _0x3530fe;try{_0x3530fe=a3_0x336f89[_0x16c5bb(0x95)](a3_0x336f89[_0x16c5bb(0x8c)](_0x1e16c4));}catch{return![];}if(!a3_0x336f89[_0x16c5bb(0x91)](_0x3530fe))throw new Error(_0x16c5bb(0x86));if(_0x495476===_0x3530fe)return!![];if(_0x3530fe===a3_0x336f89[_0x16c5bb(0x88)])return _0x495476['startsWith'](a3_0x336f89[_0x16c5bb(0x88)]);return _0x495476['startsWith'](_0x3530fe+a3_0x336f89[_0x16c5bb(0x88)]);});}
@@ -1 +1 @@
1
- (function(_0x283ce2,_0x3391ef){const _0x54e668=a4_0x5e5f,_0x5d3e8a=_0x283ce2();while(!![]){try{const _0x2a3299=parseInt(_0x54e668(0x106))/0x1*(-parseInt(_0x54e668(0xf4))/0x2)+parseInt(_0x54e668(0xfb))/0x3*(-parseInt(_0x54e668(0xf8))/0x4)+parseInt(_0x54e668(0xf0))/0x5*(parseInt(_0x54e668(0xf1))/0x6)+-parseInt(_0x54e668(0xf6))/0x7*(-parseInt(_0x54e668(0x100))/0x8)+parseInt(_0x54e668(0xff))/0x9+parseInt(_0x54e668(0x107))/0xa*(-parseInt(_0x54e668(0xfa))/0xb)+parseInt(_0x54e668(0x104))/0xc;if(_0x2a3299===_0x3391ef)break;else _0x5d3e8a['push'](_0x5d3e8a['shift']());}catch(_0x33aea8){_0x5d3e8a['push'](_0x5d3e8a['shift']());}}}(a4_0x5a84,0x47775));import{promises as a4_0x44068c}from'fs';import a4_0x5c779f from'path';import a4_0x2141b2 from'os';function a4_0x5a84(){const _0x9a772b=['invalid\x20path\x20or\x20inaccessible','34354YgcJfY','1510780YQaBph','7680NZzUtz','954TtHLxq','isDirectory','non-directory\x20root','34FtEwCc','join','2375261nHEYlQ','\x20due\x20to\x20error:\x20','870772NBFqzV','slice','22zxCJAM','6ddVNfR','message','uri','file://','2599524yxmrul','8ABeZFN','startsWith','realpath','stat','8902824FnZwpu'];a4_0x5a84=function(){return _0x9a772b;};return a4_0x5a84();}function a4_0x5e5f(_0x5aabfa,_0x43c563){_0x5aabfa=_0x5aabfa-0xf0;const _0x5a8404=a4_0x5a84();let _0x5e5fd6=_0x5a8404[_0x5aabfa];return _0x5e5fd6;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x3924af){const _0x334428=a4_0x5e5f;try{const _0x3c936f=_0x3924af[_0x334428(0x101)](_0x334428(0xfe))?_0x3924af[_0x334428(0xf9)](0x7):_0x3924af,_0x3a0dd1=_0x3c936f[_0x334428(0x101)]('~/')||_0x3c936f==='~'?a4_0x5c779f[_0x334428(0xf5)](a4_0x2141b2['homedir'](),_0x3c936f[_0x334428(0xf9)](0x1)):_0x3c936f,_0x264bb2=a4_0x5c779f['resolve'](_0x3a0dd1),_0x1d45db=await a4_0x44068c[_0x334428(0x102)](_0x264bb2);return normalizePath(_0x1d45db);}catch{return null;}}function formatDirectoryError(_0x36dc34,_0x4f4375,_0x414d40){const _0x3c38fe=a4_0x5e5f;if(_0x414d40)return'Skipping\x20'+_0x414d40+':\x20'+_0x36dc34;const _0x34c783=_0x4f4375 instanceof Error?_0x4f4375[_0x3c38fe(0xfc)]:String(_0x4f4375);return'Skipping\x20invalid\x20directory:\x20'+_0x36dc34+_0x3c38fe(0xf7)+_0x34c783;}export async function getValidRootDirectories(_0x5afe93){const _0x15ef28=a4_0x5e5f,_0x512519=[];for(const _0x54b4b4 of _0x5afe93){const _0x298a77=await parseRootUri(_0x54b4b4['uri']);if(!_0x298a77){logMcpStderr(formatDirectoryError(_0x54b4b4[_0x15ef28(0xfd)],undefined,_0x15ef28(0x105)));continue;}try{const _0x4576d8=await a4_0x44068c[_0x15ef28(0x103)](_0x298a77);_0x4576d8[_0x15ef28(0xf2)]()?_0x512519['push'](_0x298a77):logMcpStderr(formatDirectoryError(_0x298a77,undefined,_0x15ef28(0xf3)));}catch(_0x3ec46e){logMcpStderr(formatDirectoryError(_0x298a77,_0x3ec46e));}}return _0x512519;}
1
+ (function(_0x3dc691,_0x4c799f){const _0x988750=a4_0x96de,_0x3e5d2e=_0x3dc691();while(!![]){try{const _0xa9ed94=-parseInt(_0x988750(0x11b))/0x1*(-parseInt(_0x988750(0x109))/0x2)+parseInt(_0x988750(0x118))/0x3+parseInt(_0x988750(0x10e))/0x4*(-parseInt(_0x988750(0x10c))/0x5)+parseInt(_0x988750(0x11a))/0x6*(-parseInt(_0x988750(0x111))/0x7)+-parseInt(_0x988750(0x11f))/0x8+parseInt(_0x988750(0x114))/0x9*(-parseInt(_0x988750(0x107))/0xa)+parseInt(_0x988750(0x10a))/0xb;if(_0xa9ed94===_0x4c799f)break;else _0x3e5d2e['push'](_0x3e5d2e['shift']());}catch(_0x2d8657){_0x3e5d2e['push'](_0x3e5d2e['shift']());}}}(a4_0x3fc3,0xc86db));import{promises as a4_0x3c59b8}from'fs';import a4_0x1cc8e2 from'path';import a4_0x54153e from'os';function a4_0x3fc3(){const _0x463b46=['33017655kUZnGd','non-directory\x20root','1701465SQFLcW','join','4SNIIBJ','isDirectory','\x20due\x20to\x20error:\x20','2980586XcnKIU','push','startsWith','837lxoQRT','realpath','message','invalid\x20path\x20or\x20inaccessible','4495248pUdaoZ','uri','18bINmtI','335WXxYqm','slice','Skipping\x20','Skipping\x20invalid\x20directory:\x20','10066056gnrSHL','resolve','107790PqDxOA','homedir','1190yxEtvk'];a4_0x3fc3=function(){return _0x463b46;};return a4_0x3fc3();}import{normalizePath}from'./path-utils.js';function a4_0x96de(_0x522acc,_0x3e87eb){_0x522acc=_0x522acc-0x106;const _0x3fc331=a4_0x3fc3();let _0x96dedc=_0x3fc331[_0x522acc];return _0x96dedc;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x20cef3){const _0x494e8f=a4_0x96de;try{const _0x8649e=_0x20cef3[_0x494e8f(0x113)]('file://')?_0x20cef3[_0x494e8f(0x11c)](0x7):_0x20cef3,_0x209a8b=_0x8649e['startsWith']('~/')||_0x8649e==='~'?a4_0x1cc8e2[_0x494e8f(0x10d)](a4_0x54153e[_0x494e8f(0x108)](),_0x8649e[_0x494e8f(0x11c)](0x1)):_0x8649e,_0x17577e=a4_0x1cc8e2[_0x494e8f(0x106)](_0x209a8b),_0x38d697=await a4_0x3c59b8[_0x494e8f(0x115)](_0x17577e);return normalizePath(_0x38d697);}catch{return null;}}function formatDirectoryError(_0xca2a9c,_0x18a16b,_0x5615ad){const _0x22606e=a4_0x96de;if(_0x5615ad)return _0x22606e(0x11d)+_0x5615ad+':\x20'+_0xca2a9c;const _0x5c23a5=_0x18a16b instanceof Error?_0x18a16b[_0x22606e(0x116)]:String(_0x18a16b);return _0x22606e(0x11e)+_0xca2a9c+_0x22606e(0x110)+_0x5c23a5;}export async function getValidRootDirectories(_0x3a8c6f){const _0x32cb1c=a4_0x96de,_0x4c64a5=[];for(const _0x289046 of _0x3a8c6f){const _0x5cf771=await parseRootUri(_0x289046['uri']);if(!_0x5cf771){logMcpStderr(formatDirectoryError(_0x289046[_0x32cb1c(0x119)],undefined,_0x32cb1c(0x117)));continue;}try{const _0xb7689a=await a4_0x3c59b8['stat'](_0x5cf771);_0xb7689a[_0x32cb1c(0x10f)]()?_0x4c64a5[_0x32cb1c(0x112)](_0x5cf771):logMcpStderr(formatDirectoryError(_0x5cf771,undefined,_0x32cb1c(0x10b)));}catch(_0x5bb10d){logMcpStderr(formatDirectoryError(_0x5cf771,_0x5bb10d));}}return _0x4c64a5;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.143",
3
+ "version": "0.8.144",
4
4
  "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@google/generative-ai": "^0.21.0",
37
37
  "@modelcontextprotocol/sdk": "^1.12.3",
38
- "@morphllm/morphsdk": "0.2.148",
38
+ "@morphllm/morphsdk": "0.2.149",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",