@morphllm/morphmcp 0.8.145 → 0.8.146

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_0x23a6f4=a0_0x6cf3;(function(_0x3aed29,_0xfd87f1){const _0xda0b95=a0_0x6cf3,_0x3c754e=_0x3aed29();while(!![]){try{const _0xdf2052=-parseInt(_0xda0b95(0x20a))/0x1*(-parseInt(_0xda0b95(0x25b))/0x2)+parseInt(_0xda0b95(0x198))/0x3+parseInt(_0xda0b95(0x1ab))/0x4*(parseInt(_0xda0b95(0x159))/0x5)+-parseInt(_0xda0b95(0x1db))/0x6*(-parseInt(_0xda0b95(0x18c))/0x7)+-parseInt(_0xda0b95(0x18d))/0x8+-parseInt(_0xda0b95(0x1f6))/0x9+-parseInt(_0xda0b95(0x257))/0xa*(-parseInt(_0xda0b95(0x183))/0xb);if(_0xdf2052===_0xfd87f1)break;else _0x3c754e['push'](_0x3c754e['shift']());}catch(_0x3caade){_0x3c754e['push'](_0x3c754e['shift']());}}}(a0_0x2f57,0xc8afb));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_0x372d7a from'fs/promises';import a0_0x388e0f from'path';import a0_0x477f98 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_0x2d5c68 from'axios';function fixPathRepetition(_0x1aa7f9){const _0x1f577c=a0_0x6cf3,_0x1317e5=_0x1aa7f9['split'](a0_0x388e0f['sep'])[_0x1f577c(0x1d0)](Boolean);if(_0x1317e5['length']<0x2)return null;for(let _0x3e6be1=Math['floor'](_0x1317e5[_0x1f577c(0x187)]/0x2);_0x3e6be1>=0x1;_0x3e6be1--){for(let _0x1dd63d=0x0;_0x1dd63d<=_0x1317e5[_0x1f577c(0x187)]-0x2*_0x3e6be1;_0x1dd63d++){const _0x3c82de=_0x1317e5['slice'](_0x1dd63d,_0x1dd63d+_0x3e6be1),_0x59bd09=_0x1317e5[_0x1f577c(0x173)](_0x1dd63d+_0x3e6be1,_0x1dd63d+0x2*_0x3e6be1);if(_0x3c82de[_0x1f577c(0x1d6)]((_0x4a5ee4,_0x2f80b4)=>_0x4a5ee4===_0x59bd09[_0x2f80b4])){const _0x3c484a=[..._0x1317e5[_0x1f577c(0x173)](0x0,_0x1dd63d),..._0x1317e5['slice'](_0x1dd63d+_0x3e6be1)];return a0_0x388e0f['sep']+_0x3c484a['join'](a0_0x388e0f[_0x1f577c(0x1ae)]);}}}return null;}const require=createRequire(import.meta.url);function a0_0x2f57(){const _0x23fea6=['default','edit_file','setNotificationHandler','user','realpath','unknown\x20error','map','changes','-\x20Glob\x20search\x20`','composer.json','RipgrepError','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','string','[github_codebase_search]\x20Done\x20in\x20','mcp-filesystem','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','indexOf','\x0a</file>','grep\x20\x27','Relevant\x20context\x20found:','etimedout','completionId','[could\x20not\x20read\x20file:\x20','Cargo.toml','cwd','finish','argv','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','pyproject.toml','has','stringify','requiresApiKey','tool_calls','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','linesRemoved','dirname','`\x20in\x20`','Fatal\x20error\x20running\x20server:','820gaEeXi','Unknown\x20error','code_edit','search_string','2335706ZMfUWR','messages','search_type','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','version','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Max\x20results\x20to\x20return',',\x20removed\x20','node_modules','sk-','\x20\x20morph-mcp','getClientCapabilities','errors','instruction','Applied','45DhZJib','github_codebase_search','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','roots','function','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','params','isArray','all','Morph\x20Edit\x20Preview','timed\x20out','success','morph-v3-fast','message','PWD','glob\x20\x27','ToolException','Workspace\x20mode\x20enabled:\x20Using\x20','WarpGrepError','\x22.\x20Known\x20tools:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x0aExamples:','.\x20Path:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Listed\x20directory\x20`','payload','slice','branch','Failed\x20to\x20read\x20file:\x20','FileReadError','catch','completed','\x22>\x0aError\x20reading\x20file:\x20','.\x20Changes:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','glob','source','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','\x20error(s)','stack','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','https://morphllm.com/api/error-report','140657jCMdKw','go.mod','Warning:\x20','ms:','length','GitHub\x20search\x20failed:\x20','list_directory\x20','<file\x20path=\x22','substring','1911049JvKJGj','11684144uQVCmK','[github_codebase_search]\x20Failed\x20in\x20','utf-8','-\x20Read\x20file\x20`','role','\x20-\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','ReadError','package.json','parse','1009749SJqcNb','metadata','repo_path','match','read','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','\x20as\x20allowed\x20directory','.vscode','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','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','UnknownError','pattern','\x20is\x20not\x20a\x20directory','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','lines','dryRun','TimeoutError','timeout','startsWith','211920UcdRaE','\x27\x20in\x20`','0.2.0','sep','tool_call_id','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','FileNotFound','env','application/json','includes','grep','--help','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','resolve','@morphllm/morphmcp\x20','Repository\x20identifier','name','Disabled\x20tools:\x20','\x20valid\x20directories','Preview\x20changes\x20without\x20applying\x20them.','assistant','Error\x20running\x20fast\x20context\x20search:\x20','code','morph-warp-grep-v2.1','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','--version','arguments','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','some','ENOENT','\x20for:\x20\x22','join','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','connect','split','RipgrepNotAvailable','Error:\x20','filter','ENABLE_WORKSPACE_MODE','now','content','SubToolError','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','every','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','description','added\x20','ms.\x20Success:\x20','6tQlOPi','toLowerCase','min','readFile','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Rules:\x0a','Morph\x20FastApply\x20failed\x20without\x20error\x20message','BinaryFile','enum','boolean','morph-','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','MORPH_API_KEY','-\x20Grepped\x20\x27','\x0aOptions:','files','optional','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','DISABLED_TOOLS','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','setRequestHandler','Morph\x20Edit\x20','unknown','SymlinkError','command','error','❌\x20Morph\x20Edit\x20Failed:\x20','9182412BPXthr','MORPH_WARP_GREP_TIMEOUT','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','path','../package.json','oninitialized','trim','warn','completed_with_file_errors','morph-mcp','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','normalize','toISOString','codebase_search','searchGitHub','data','runWarpGrep_call','exit','1nqcHkd','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','constructor','basename','File\x20read\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.','linesAdded','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','--api-key=','log','isDirectory','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','Fallback:\x20Using\x20workspace\x20root\x20','linesModified','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','text','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','Warning:\x20Workspace\x20fallback\x20failed:\x20','push','Here\x20is\x20the\x20content\x20of\x20files:\x0a','listRoots','WORKSPACE_ROOT','Tool\x20\x22','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','.git','timings','object','terminationReason','access','safeParse','Unknown\x20tool:\x20','describe','Error\x20accessing\x20directory\x20','tool'];a0_0x2f57=function(){return _0x23fea6;};return a0_0x2f57();}function getPackageVersion(){const _0x3b30ce=a0_0x6cf3;try{const _0x239e90=require(_0x3b30ce(0x1fc));return _0x239e90[_0x3b30ce(0x25f)]??_0x3b30ce(0x1f1);}catch(_0x3b2336){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x3b2336),'unknown';}}function printHelp(){const _0x2a2c73=a0_0x6cf3;console[_0x2a2c73(0x216)](_0x2a2c73(0x1b9)+getPackageVersion()),console[_0x2a2c73(0x216)](_0x2a2c73(0x25e)),console['log'](_0x2a2c73(0x1e9)),console['log'](_0x2a2c73(0x1cb)),console[_0x2a2c73(0x216)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x2a2c73(0x216)](_0x2a2c73(0x23b)),console[_0x2a2c73(0x216)](_0x2a2c73(0x16e)),console['log'](_0x2a2c73(0x266)),console[_0x2a2c73(0x216)](_0x2a2c73(0x252));}const cliArgs=process[a0_0x23a6f4(0x24b)][a0_0x23a6f4(0x173)](0x2),VERSION_FLAGS=new Set([a0_0x23a6f4(0x1c4),'-v','-V']),HELP_FLAGS=new Set([a0_0x23a6f4(0x1b6),'-h']);cliArgs[a0_0x23a6f4(0x1c7)](_0x2b09ba=>VERSION_FLAGS['has'](_0x2b09ba))&&(console[a0_0x23a6f4(0x216)](a0_0x23a6f4(0x1b9)+getPackageVersion()),process[a0_0x23a6f4(0x209)](0x0));cliArgs[a0_0x23a6f4(0x1c7)](_0x670684=>HELP_FLAGS[a0_0x23a6f4(0x24e)](_0x670684))&&(printHelp(),process[a0_0x23a6f4(0x209)](0x0));function getCliArg(_0xb8b05b){const _0xcd5c2b=a0_0x23a6f4;for(let _0x519995=0x0;_0x519995<cliArgs[_0xcd5c2b(0x187)];_0x519995++){const _0x190f03=cliArgs[_0x519995];if(_0x190f03['startsWith']('--'+_0xb8b05b+'='))return _0x190f03[_0xcd5c2b(0x173)](('--'+_0xb8b05b+'=')[_0xcd5c2b(0x187)]);if(_0x190f03==='--'+_0xb8b05b&&_0x519995+0x1<cliArgs[_0xcd5c2b(0x187)])return cliArgs[_0x519995+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x23a6f4(0x187)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x23a6f4(0x24e)](arg)||HELP_FLAGS[a0_0x23a6f4(0x24e)](arg))continue;if(arg[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x215)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process['env'][a0_0x23a6f4(0x222)]||process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x167)]||process[a0_0x23a6f4(0x249)](),ENABLE_WORKSPACE_MODE=process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1d1)]!=='false',MORPH_API_KEY=getCliArg('api-key')??process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1e7)],MORPH_API_URL=process[a0_0x23a6f4(0x1b2)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x23a6f4(0x1f7)]?parseInt(process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1f7)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x23a6f4(0x231),a0_0x23a6f4(0x205),a0_0x23a6f4(0x15a)]),DISABLED_TOOLS=process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1ed)]?new Set(process[a0_0x23a6f4(0x1b2)]['DISABLED_TOOLS'][a0_0x23a6f4(0x1cd)](',')[a0_0x23a6f4(0x236)](_0x577a1b=>_0x577a1b[a0_0x23a6f4(0x1fe)]())[a0_0x23a6f4(0x1d0)](_0x832cb=>_0x832cb[a0_0x23a6f4(0x187)]>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x23a6f4(0x24e)](tool)&&console['error'](a0_0x23a6f4(0x20c)+tool+a0_0x23a6f4(0x16c)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x23a6f4(0x1f4)](a0_0x23a6f4(0x1bc)+[...DISABLED_TOOLS][a0_0x23a6f4(0x1ca)](',\x20'));}function a0_0x6cf3(_0x392938,_0x3ef6eb){_0x392938=_0x392938-0x157;const _0x2f5768=a0_0x2f57();let _0x6cf34f=_0x2f5768[_0x392938];return _0x6cf34f;}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x265))&&!MORPH_API_KEY[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x1e5))&&logMcpStderr(a0_0x23a6f4(0x1a0));async function reportMorphError(_0x21b85c){const _0x2226e2=a0_0x23a6f4;try{await a0_0x2d5c68['post'](_0x2226e2(0x182),{..._0x21b85c,'timestamp':new Date()[_0x2226e2(0x204)](),'source':_0x21b85c[_0x2226e2(0x17d)]||_0x2226e2(0x23f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x21b85c['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x2226e2(0x1b3),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x23a6f4(0x240)),logMcpStderr(a0_0x23a6f4(0x24c)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x23a6f4(0x1d7)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x23a6f4(0x224)));function normalizePath(_0x12114b){const _0x306574=a0_0x23a6f4;return a0_0x388e0f[_0x306574(0x203)](_0x12114b);}function expandHome(_0x515d8d){const _0x409be7=a0_0x23a6f4;if(_0x515d8d[_0x409be7(0x1aa)]('~/')||_0x515d8d==='~')return a0_0x388e0f[_0x409be7(0x1ca)](a0_0x477f98['homedir'](),_0x515d8d[_0x409be7(0x173)](0x1));return _0x515d8d;}let allowedDirectories=await Promise['all'](args[a0_0x23a6f4(0x236)](async _0x1fda58=>{const _0x353f0c=expandHome(_0x1fda58),_0x35b7ba=a0_0x388e0f['resolve'](_0x353f0c);try{const _0x406947=await a0_0x372d7a['realpath'](_0x35b7ba);return normalizePath(_0x406947);}catch(_0x263e33){return normalizePath(_0x35b7ba);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x23a6f4(0x187)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x23a6f4(0x21f)](workspaceDir),logMcpStderr(a0_0x23a6f4(0x16a)+workspaceDir+a0_0x23a6f4(0x19e)));}catch(a0_0x7084ff){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x7084ff);}async function detectWorkspaceRoot(_0x3c2420){const _0xd369d8=a0_0x23a6f4;let _0x4bd508=a0_0x388e0f['resolve'](_0x3c2420);const _0x1870cb=[_0xd369d8(0x226),_0xd369d8(0x19f),_0xd369d8(0x196),_0xd369d8(0x248),_0xd369d8(0x24d),_0xd369d8(0x184),'.cursor','tsconfig.json',_0xd369d8(0x239)];while(_0x4bd508!==a0_0x388e0f[_0xd369d8(0x254)](_0x4bd508)){for(const _0x34bd4e of _0x1870cb){const _0x8c06e2=a0_0x388e0f['join'](_0x4bd508,_0x34bd4e);try{return await a0_0x372d7a[_0xd369d8(0x22a)](_0x8c06e2),normalizePath(_0x4bd508);}catch{}}_0x4bd508=a0_0x388e0f[_0xd369d8(0x254)](_0x4bd508);}return normalizePath(_0x3c2420);}await Promise[a0_0x23a6f4(0x161)](args[a0_0x23a6f4(0x236)](async _0x5705e3=>{const _0x4b3042=a0_0x23a6f4;try{const _0x2e6beb=await a0_0x372d7a['stat'](expandHome(_0x5705e3));!_0x2e6beb[_0x4b3042(0x217)]()&&(logMcpStderr(_0x4b3042(0x1cf)+_0x5705e3+_0x4b3042(0x1a4)),process[_0x4b3042(0x209)](0x1));}catch(_0x5c1aee){logMcpStderr(_0x4b3042(0x22e)+_0x5705e3+':',_0x5c1aee),process[_0x4b3042(0x209)](0x1);}}));async function validatePath(_0x4f52ea){const _0x2b73f7=a0_0x23a6f4,_0x18abda=expandHome(_0x4f52ea),_0x1566fc=a0_0x388e0f[_0x2b73f7(0x1b8)](_0x18abda);try{const _0xc00ac1=await a0_0x372d7a[_0x2b73f7(0x234)](_0x1566fc);return _0xc00ac1;}catch(_0x43dbf8){if(_0x43dbf8[_0x2b73f7(0x1c1)]===_0x2b73f7(0x1c8)){const _0x37b159=a0_0x388e0f[_0x2b73f7(0x254)](_0x1566fc);try{const _0x30491e=await a0_0x372d7a[_0x2b73f7(0x234)](_0x37b159);return a0_0x388e0f['join'](_0x30491e,a0_0x388e0f[_0x2b73f7(0x20e)](_0x1566fc));}catch{throw new Error(_0x2b73f7(0x170)+_0x37b159);}}throw _0x43dbf8;}}const MorphEditFileArgsSchema=z[a0_0x23a6f4(0x228)]({'path':z[a0_0x23a6f4(0x23d)](),'code_edit':z['string']()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x260)),'dryRun':z[a0_0x23a6f4(0x1e4)]()[a0_0x23a6f4(0x230)](![])[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x1be))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x23a6f4(0x210),WarpGrepArgsSchema=z[a0_0x23a6f4(0x228)]({'search_string':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x23a6f4(0x23d)]()['describe'](a0_0x23a6f4(0x17e)),'search_type':z[a0_0x23a6f4(0x1e3)]([a0_0x23a6f4(0x230),a0_0x23a6f4(0x264)])['optional']()['describe'](a0_0x23a6f4(0x21b))}),WarpGrepGitHubArgsSchema=z[a0_0x23a6f4(0x228)]({'search_string':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x22d)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()['describe'](a0_0x23a6f4(0x212)),'branch':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x22d)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x23a6f4(0x23d)]()['describe'](a0_0x23a6f4(0x1ba)),'branch':z[a0_0x23a6f4(0x23d)]()['optional']()['describe'](a0_0x23a6f4(0x1ee)),'commitHash':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x23a6f4(0x23d)]())[a0_0x23a6f4(0x230)]([])[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x202)),'limit':z['number']()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x230)](0xa)[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x262))}),server=new Server({'name':a0_0x23a6f4(0x201),'version':a0_0x23a6f4(0x1ad)},{'capabilities':{'tools':{}}});server[a0_0x23a6f4(0x1ef)](ListToolsRequestSchema,async()=>{const _0x292d00=a0_0x23a6f4,_0x26a311=[{'name':_0x292d00(0x231),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x292d00(0x1ec)+_0x292d00(0x193)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+_0x292d00(0x1c6)+_0x292d00(0x23c)+_0x292d00(0x17b)+_0x292d00(0x15b)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x292d00(0x15e)+_0x292d00(0x214)+'For\x20deletions:\x0a'+_0x292d00(0x1f8)+_0x292d00(0x1d5)+_0x292d00(0x1e0)+_0x292d00(0x21d)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x292d00(0x19d)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x292d00(0x225)+_0x292d00(0x1c3)+'IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x292d00(0x205),'description':_0x292d00(0x1a1)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x292d00(0x1fa)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x34fe8f=_0x26a311[_0x292d00(0x1d0)](_0x19d560=>{const _0x47bf7c=_0x292d00;if(DISABLED_TOOLS[_0x47bf7c(0x24e)](_0x19d560[_0x47bf7c(0x1bb)]))return console['error']('Tool\x20'+_0x19d560['name']+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x47bf7c(0x250)in _0x19d560&&_0x19d560[_0x47bf7c(0x250)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x19d560[_0x47bf7c(0x1bb)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x34fe8f['map'](_0x551b22=>({'name':_0x551b22[_0x292d00(0x1bb)],'description':_0x551b22[_0x292d00(0x1d8)],'inputSchema':_0x551b22['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0xe153fb=>{const _0x3e4c67=a0_0x23a6f4,{name:_0x4dc166,arguments:_0x125058}=_0xe153fb[_0x3e4c67(0x15f)];try{if(DISABLED_TOOLS[_0x3e4c67(0x24e)](_0x4dc166))throw new Error(_0x3e4c67(0x223)+_0x4dc166+_0x3e4c67(0x218));switch(_0x4dc166){case _0x3e4c67(0x231):{const _0x579491=MorphEditFileArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x579491[_0x3e4c67(0x164)])throw new Error(_0x3e4c67(0x261)+_0x579491['error']);const _0x46e233=await validatePath(_0x579491[_0x3e4c67(0x207)]['path']);let _0x2764a8=null,_0x27deb6=!![],_0xbd2a63=null;try{_0x2764a8=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x46e233,_0x3e4c67(0x18f));}catch(_0x32fcac){const _0x35e6b6=_0x32fcac[_0x3e4c67(0x1c1)];_0x35e6b6===_0x3e4c67(0x1c8)?(_0x27deb6=![],_0x2764a8=''):(_0xbd2a63=_0x3e4c67(0x175)+(_0x35e6b6||_0x3e4c67(0x1f1))+_0x3e4c67(0x192)+(_0x32fcac instanceof Error?_0x32fcac[_0x3e4c67(0x166)]:String(_0x32fcac)),logMcpStderr(_0x3e4c67(0x185)+_0xbd2a63));}let _0x5cc0b3;try{const _0x1572d5=MORPH_API_KEY;if(!_0x1572d5)throw new Error(_0x3e4c67(0x213));const _0xcc0734=a0_0x388e0f[_0x3e4c67(0x254)](_0x46e233),_0x1c1770=a0_0x388e0f[_0x3e4c67(0x20e)](_0x46e233),_0x10b9fa=await executeEditFile({'target_filepath':_0x1c1770,'code_edit':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x259)],'instructions':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)]},{'morphApiKey':_0x1572d5,'morphApiUrl':MORPH_API_URL,'baseDir':_0xcc0734,'autoWrite':!_0x579491[_0x3e4c67(0x207)]['dryRun'],'generateUdiff':![],'debug':![]});_0x5cc0b3=_0x10b9fa[_0x3e4c67(0x246)];if(!_0x10b9fa[_0x3e4c67(0x164)])throw new Error(_0x10b9fa['error']||_0x3e4c67(0x1e1));const _0x293050=_0x10b9fa[_0x3e4c67(0x237)],_0x8e61b5=_0x3e4c67(0x1d9)+_0x293050[_0x3e4c67(0x211)]+_0x3e4c67(0x263)+_0x293050[_0x3e4c67(0x253)]+',\x20modified\x20'+_0x293050[_0x3e4c67(0x21a)];if(_0x579491[_0x3e4c67(0x207)]['dryRun'])return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x162)+(_0x27deb6?'':'\x20(new\x20file)')+':\x20'+_0x579491['data'][_0x3e4c67(0x157)]+_0x3e4c67(0x17a)+_0x8e61b5+'.\x20Path:\x20'+_0x579491['data'][_0x3e4c67(0x1fb)]+'.'}]};return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1f0)+(_0x27deb6?_0x3e4c67(0x158):'Created\x20File')+':\x20'+_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)]+_0x3e4c67(0x17a)+_0x8e61b5+_0x3e4c67(0x16f)+_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1fb)]+'.'}]};}catch(_0x42f1f9){const _0x5d2c40=_0x42f1f9 instanceof Error?_0x42f1f9[_0x3e4c67(0x166)]:String(_0x42f1f9);return reportMorphError({'error_message':_0x5d2c40,'error_type':_0x42f1f9 instanceof Error?_0x42f1f9['constructor']['name']:'UnknownError','context':{'tool':_0x3e4c67(0x231),'completion_id':_0x5cc0b3,'file_path':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1fb)],'validated_path':_0x46e233,'instruction':_0x579491['data'][_0x3e4c67(0x157)],'model':_0x3e4c67(0x165),'dry_run':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1a7)],'file_exists':_0x27deb6,'file_read_error':_0xbd2a63,'file_readable':_0x2764a8!==null,'request_content':{'path':_0x579491['data']['path'],'code_edit':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x259)],'instruction':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)],'original_code':_0x2764a8!==null?_0x2764a8['length']>0xc350?_0x2764a8[_0x3e4c67(0x18b)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x2764a8[_0x3e4c67(0x187)]+'\x20chars)':_0x2764a8:_0x3e4c67(0x247)+(_0xbd2a63||_0x3e4c67(0x235))+']','original_code_length':_0x2764a8?.[_0x3e4c67(0x187)]??0x0,'model':_0x3e4c67(0x165),'dry_run':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1a7)]}},'stack_trace':_0x42f1f9 instanceof Error?_0x42f1f9['stack']:undefined,'source':_0x3e4c67(0x23f)})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1f5)+_0x5d2c40}],'isError':!![]};}}case _0x3e4c67(0x205):{const _0x32f81a=WarpGrepArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x32f81a['success'])return{'content':[{'type':_0x3e4c67(0x21c),'text':'Invalid\x20arguments:\x20'+_0x32f81a[_0x3e4c67(0x1f4)]}],'isError':!![]};const _0x4710a2=_0x30396d=>{const _0x5cf2f6=_0x3e4c67,_0x4581de=[];for(const _0x333390 of _0x30396d||[]){if(_0x333390[_0x5cf2f6(0x191)]===_0x5cf2f6(0x1bf)&&Array['isArray'](_0x333390[_0x5cf2f6(0x251)]))for(const _0x59da43 of _0x333390[_0x5cf2f6(0x251)]){try{const _0x429988=_0x59da43[_0x5cf2f6(0x15d)]?.[_0x5cf2f6(0x1bb)],_0x10cb85=JSON[_0x5cf2f6(0x197)](_0x59da43['function']?.[_0x5cf2f6(0x1c5)]||'{}');if(_0x429988==='grep_search')_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x243)+_0x10cb85['pattern']+'\x27\x20'+(_0x10cb85[_0x5cf2f6(0x1fb)]||'.'));else{if(_0x429988===_0x5cf2f6(0x19c))_0x4581de[_0x5cf2f6(0x21f)]('read\x20'+_0x10cb85['path']);else{if(_0x429988==='list_directory')_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x189)+(_0x10cb85[_0x5cf2f6(0x1f3)]||'.'));else{if(_0x429988===_0x5cf2f6(0x17c))_0x4581de['push'](_0x5cf2f6(0x168)+_0x10cb85[_0x5cf2f6(0x1a3)]+'\x27\x20'+(_0x10cb85['path']||'.'));else _0x429988==='finish'&&_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x24a));}}}}catch{}}}return _0x4581de;},_0x450d45=_0x3abe52=>{const _0x14e55f=_0x3e4c67,_0x2f5015=[];if(!_0x3abe52||!Array[_0x14e55f(0x160)](_0x3abe52))return _0x2f5015;const _0x1407ff=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x14e55f(0x1b1),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x14e55f(0x195),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x14e55f(0x1e2),'tool':_0x14e55f(0x19c)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x14e55f(0x23a),'tool':_0x14e55f(0x1b5)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x14e55f(0x1ce),'tool':_0x14e55f(0x1b5)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x14e55f(0x1e2),'tool':_0x14e55f(0x19c)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x14e55f(0x19c)},{'pattern':/not a text file/,'error_type':_0x14e55f(0x1e2),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x14e55f(0x1f2),'tool':_0x14e55f(0x19c)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x14e55f(0x19c)},{'pattern':/status="error"/,'error_type':_0x14e55f(0x169),'tool':_0x14e55f(0x1f1)}];let _0x4a0557=0x0;for(const _0x4fde3f of _0x3abe52){_0x4fde3f[_0x14e55f(0x191)]===_0x14e55f(0x1bf)&&Array[_0x14e55f(0x160)](_0x4fde3f[_0x14e55f(0x251)])&&_0x4a0557++;const _0x3b9992=_0x4fde3f[_0x14e55f(0x1d3)];if((_0x4fde3f['role']===_0x14e55f(0x22f)||_0x4fde3f['role']===_0x14e55f(0x233))&&_0x3b9992&&typeof _0x3b9992===_0x14e55f(0x23d))for(const {pattern:_0x2f8b6f,error_type:_0x2b1594,tool:_0x11f69e}of _0x1407ff){const _0x42c768=_0x3b9992[_0x14e55f(0x19b)](new RegExp(_0x2f8b6f[_0x14e55f(0x17d)],'g'));if(_0x42c768)for(const _0x367f7c of _0x42c768){const _0x5c9a06=_0x3b9992[_0x14e55f(0x241)](_0x367f7c),_0x28da35=_0x3b9992[_0x14e55f(0x18b)](_0x5c9a06,Math[_0x14e55f(0x1dd)](_0x5c9a06+0xc8,_0x3b9992[_0x14e55f(0x187)]));_0x2f5015[_0x14e55f(0x21f)]({'tool':_0x11f69e,'error_type':_0x2b1594,'error_message':_0x28da35['split']('\x0a')[0x0],'turn':_0x4a0557});}}}return _0x2f5015;};try{const _0x5d6553=a0_0x388e0f['resolve'](_0x32f81a['data'][_0x3e4c67(0x19a)]),_0xf5e966=_0x32f81a['data'][_0x3e4c67(0x25d)],_0x17d9b8=_0xf5e966===_0x3e4c67(0x264)?{'allowNames':[_0x3e4c67(0x264)]}:undefined,_0x33f375=new LocalRipgrepProvider(_0x5d6553,undefined,_0x17d9b8),_0x524c58=await runWarpGrep({'searchTerm':_0x32f81a[_0x3e4c67(0x207)]['search_string'],'repoRoot':_0x5d6553,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x33f375,'search_type':_0xf5e966}),_0x24e387=_0x450d45(_0x524c58['messages']);_0x24e387[_0x3e4c67(0x187)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x24e387[_0x3e4c67(0x187)]+_0x3e4c67(0x17f),'error_type':_0x3e4c67(0x1d4),'level':_0x3e4c67(0x1ff),'tool':_0x3e4c67(0x205),'context':{'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x524c58[_0x3e4c67(0x229)],'sub_tool_errors':_0x24e387,'timings':_0x524c58[_0x3e4c67(0x227)],'tool_calls':_0x4710a2(_0x524c58[_0x3e4c67(0x25c)]),'messages':_0x524c58[_0x3e4c67(0x25c)]?.[_0x3e4c67(0x236)](_0x506d83=>({'role':_0x506d83[_0x3e4c67(0x191)],'content':_0x506d83[_0x3e4c67(0x1d3)],..._0x506d83[_0x3e4c67(0x251)]?{'tool_calls':_0x506d83[_0x3e4c67(0x251)][_0x3e4c67(0x187)]}:{},..._0x506d83['tool_call_id']?{'tool_call_id':_0x506d83[_0x3e4c67(0x1af)]}:{}}))},'source':_0x3e4c67(0x23f)})['catch'](()=>{});let _0x50fda5='';if(_0x524c58[_0x3e4c67(0x229)]===_0x3e4c67(0x178)&&_0x524c58[_0x3e4c67(0x24a)]?.['metadata']?.[_0x3e4c67(0x1ea)]){const _0x591545=_0x524c58[_0x3e4c67(0x24a)][_0x3e4c67(0x199)][_0x3e4c67(0x1ea)];if(_0x591545[_0x3e4c67(0x187)]===0x0)return _0x50fda5=_0x524c58['finish'][_0x3e4c67(0x172)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':'text','text':_0x50fda5}]};const _0xd395a2=[],_0x11c5a2=[_0x3e4c67(0x1b7)];for(const _0x1b489e of _0x524c58[_0x3e4c67(0x25c)]){if(_0x1b489e[_0x3e4c67(0x191)]===_0x3e4c67(0x1bf)&&Array[_0x3e4c67(0x160)](_0x1b489e[_0x3e4c67(0x251)]))for(const _0xd7c578 of _0x1b489e[_0x3e4c67(0x251)]){try{const _0xb4845b=_0xd7c578['function']?.['name'],_0x436d21=JSON['parse'](_0xd7c578[_0x3e4c67(0x15d)]?.['arguments']||'{}');if(_0xb4845b==='grep_search')_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x1e8)+_0x436d21[_0x3e4c67(0x1a3)]+_0x3e4c67(0x1ac)+(_0x436d21[_0x3e4c67(0x1fb)]||'.')+'`');else{if(_0xb4845b===_0x3e4c67(0x19c))_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x190)+_0x436d21[_0x3e4c67(0x1fb)]+'`');else{if(_0xb4845b==='list_directory')_0x11c5a2['push'](_0x3e4c67(0x171)+(_0x436d21[_0x3e4c67(0x1f3)]||'.')+'`');else _0xb4845b===_0x3e4c67(0x17c)&&_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x238)+_0x436d21['pattern']+_0x3e4c67(0x255)+(_0x436d21['path']||'.')+'`');}}}catch{}}}_0xd395a2[_0x3e4c67(0x21f)](_0x11c5a2[_0x3e4c67(0x1ca)]('\x0a'));const _0x1e9937=['',_0x3e4c67(0x244)];for(const _0x196c38 of _0x591545){if(_0x196c38[_0x3e4c67(0x1a6)]==='*')_0x1e9937[_0x3e4c67(0x21f)]('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':*');else{if(Array['isArray'](_0x196c38[_0x3e4c67(0x1a6)])){const _0x2c7d51=_0x196c38[_0x3e4c67(0x1a6)][_0x3e4c67(0x236)](([_0x4ef144,_0x23d34d])=>{if(_0x4ef144===_0x23d34d)return''+_0x4ef144;return _0x4ef144+'-'+_0x23d34d;});_0x1e9937['push']('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':'+_0x2c7d51[_0x3e4c67(0x1ca)](','));}else _0x1e9937[_0x3e4c67(0x21f)]('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':*');}}_0x1e9937['push'](''),_0xd395a2[_0x3e4c67(0x21f)](_0x1e9937['join']('\x0a')),_0xd395a2[_0x3e4c67(0x21f)](_0x3e4c67(0x220));const _0x57f3ad=[];for(const _0x363f63 of _0x591545){let _0x1c345b=a0_0x388e0f['resolve'](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],_0x363f63[_0x3e4c67(0x1fb)]),_0x1d5d09=null,_0x49ef77=null;try{_0x1d5d09=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x1c345b,{'encoding':_0x3e4c67(0x18f)});}catch(_0x1ad704){const _0x1ba6f6=fixPathRepetition(_0x1c345b);if(_0x1ba6f6)try{_0x1d5d09=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x1ba6f6,{'encoding':_0x3e4c67(0x18f)}),_0x1c345b=_0x1ba6f6;}catch{_0x49ef77=_0x1ad704 instanceof Error?_0x1ad704:new Error(String(_0x1ad704));}else _0x49ef77=_0x1ad704 instanceof Error?_0x1ad704:new Error(String(_0x1ad704));}if(_0x1d5d09!==null){const _0x30623f=_0x1d5d09[_0x3e4c67(0x1cd)](/\r?\n/),_0x30f839=[_0x3e4c67(0x18a)+_0x363f63[_0x3e4c67(0x1fb)]+'\x22>'];if(_0x363f63[_0x3e4c67(0x1a6)]==='*'||!Array[_0x3e4c67(0x160)](_0x363f63[_0x3e4c67(0x1a6)]))for(let _0x45b319=0x1;_0x45b319<=_0x30623f['length'];_0x45b319++){const _0x1237d1=_0x30623f[_0x45b319-0x1];_0x30f839[_0x3e4c67(0x21f)](_0x45b319+'|\x20'+_0x1237d1);}else for(const [_0x843ca1,_0x4ff3ec]of _0x363f63[_0x3e4c67(0x1a6)]){_0x30f839[_0x3e4c67(0x187)]>0x1&&_0x30f839[_0x3e4c67(0x21f)]('');for(let _0x586858=_0x843ca1;_0x586858<=_0x4ff3ec&&_0x586858<=_0x30623f['length'];_0x586858++){const _0x15eeac=_0x30623f[_0x586858-0x1];_0x30f839['push'](_0x586858+'|\x20'+_0x15eeac);}}_0x30f839['push']('</file>'),_0x57f3ad[_0x3e4c67(0x21f)](_0x30f839['join']('\x0a'));}else _0x57f3ad['push'](_0x3e4c67(0x18a)+_0x363f63[_0x3e4c67(0x1fb)]+_0x3e4c67(0x179)+(_0x49ef77?.['message']||_0x3e4c67(0x258))+_0x3e4c67(0x242));}_0xd395a2[_0x3e4c67(0x21f)](_0x57f3ad[_0x3e4c67(0x1ca)]('\x0a\x0a')),_0x50fda5=_0xd395a2[_0x3e4c67(0x1ca)]('\x0a');const _0xc4470a=_0x524c58[_0x3e4c67(0x268)]?.[_0x3e4c67(0x1d0)](_0x4d95dc=>_0x4d95dc[_0x3e4c67(0x166)]?.[_0x3e4c67(0x1aa)](_0x3e4c67(0x20f)))||[];if(_0xc4470a['length']>0x0){const _0x3dacd8=_0xc4470a[_0x3e4c67(0x236)](_0x4df51d=>_0x4df51d['message'])['join'](';\x20');reportMorphError({'error_message':_0x3dacd8,'error_type':_0x3e4c67(0x176),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x3e4c67(0x200),'error_count':_0xc4470a['length'],'is_timeout':![],'timings':_0x524c58[_0x3e4c67(0x227)],'files_attempted':_0x591545['map'](_0x3a7eac=>({'path':_0x3a7eac[_0x3e4c67(0x1fb)],'lines':_0x3a7eac[_0x3e4c67(0x1a6)]})),'tool_calls':_0x4710a2(_0x524c58[_0x3e4c67(0x25c)]),'messages':_0x524c58['messages']?.[_0x3e4c67(0x236)](_0x5dab11=>({'role':_0x5dab11[_0x3e4c67(0x191)],'content':_0x5dab11['content'],..._0x5dab11[_0x3e4c67(0x251)]?{'tool_calls':_0x5dab11['tool_calls'][_0x3e4c67(0x187)]}:{},..._0x5dab11['tool_call_id']?{'tool_call_id':_0x5dab11[_0x3e4c67(0x1af)]}:{}})),'request_content':{'query':_0x32f81a[_0x3e4c67(0x207)]['search_string'],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)]['repo_path']),'model':_0x3e4c67(0x1c2)}},'source':_0x3e4c67(0x23f)})['catch'](()=>{});}}else{if(_0x524c58[_0x3e4c67(0x229)]==='terminated'&&_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x187)]>0x0){const _0x512ccd=_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x236)](_0x1134ea=>_0x1134ea[_0x3e4c67(0x166)])['join'](';\x20');_0x50fda5='Error:\x20'+_0x512ccd;const _0xc7701c=_0x512ccd['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x1a9))||_0x512ccd['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x163))||_0x512ccd[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x245)),_0x3a3edb=_0x524c58[_0x3e4c67(0x24a)]?.['metadata']?.[_0x3e4c67(0x1ea)],_0xcf0738=_0x524c58[_0x3e4c67(0x268)][0x0];reportMorphError({'error_message':_0x512ccd,'error_type':_0xc7701c?_0x3e4c67(0x1a8):_0xcf0738?.[_0x3e4c67(0x20d)]?.[_0x3e4c67(0x1bb)]||_0x3e4c67(0x16b),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a['data'][_0x3e4c67(0x19a)],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x524c58['terminationReason'],'error_count':_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x187)],'is_timeout':_0xc7701c,'timings':_0x524c58[_0x3e4c67(0x227)],'files_attempted':_0x3a3edb?.[_0x3e4c67(0x236)](_0x1cd144=>({'path':_0x1cd144[_0x3e4c67(0x1fb)],'lines':_0x1cd144['lines']})),'tool_calls':_0x4710a2(_0x524c58['messages']),'messages':_0x524c58['messages']?.['map'](_0x5b29d2=>({'role':_0x5b29d2[_0x3e4c67(0x191)],'content':_0x5b29d2['content'],..._0x5b29d2[_0x3e4c67(0x251)]?{'tool_calls':_0x5b29d2[_0x3e4c67(0x251)]['length']}:{},..._0x5b29d2['tool_call_id']?{'tool_call_id':_0x5b29d2[_0x3e4c67(0x1af)]}:{}})),'request_content':{'query':_0x32f81a['data']['search_string'],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)]),'model':_0x3e4c67(0x1c2)}},'stack_trace':_0xcf0738?.[_0x3e4c67(0x180)]||undefined,'source':_0x3e4c67(0x23f)})['catch'](()=>{});}else _0x50fda5=_0x3e4c67(0x1f9);}return{'content':[{'type':'text','text':_0x50fda5}]};}catch(_0x284ee1){const _0x17658a=_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x166)]:String(_0x284ee1),_0x381601=_0x17658a['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x1a9))||_0x17658a[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x163))||_0x17658a[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x245))||_0x284ee1 instanceof Error&&_0x284ee1['name']===_0x3e4c67(0x1a8);return reportMorphError({'error_message':_0x17658a,'error_type':_0x381601?_0x3e4c67(0x1a8):_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'is_timeout':_0x381601,'exception_phase':_0x3e4c67(0x208),'request_content':{'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)]),'model':_0x3e4c67(0x1c2)}},'stack_trace':_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x180)]:undefined,'source':_0x3e4c67(0x23f)})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1c0)+_0x17658a}],'isError':![]};}}case _0x3e4c67(0x15a):{const _0x58cd5f=WarpGrepGitHubArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x58cd5f[_0x3e4c67(0x164)])return{'content':[{'type':_0x3e4c67(0x21c),'text':'Invalid\x20arguments:\x20'+_0x58cd5f[_0x3e4c67(0x1f4)]}],'isError':!![]};const _0x12374b=_0x58cd5f[_0x3e4c67(0x207)]['github_url']||_0x58cd5f[_0x3e4c67(0x207)]['owner_repo'];if(!_0x12374b)return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1b0)}],'isError':!![]};const _0x42bda8=MORPH_API_KEY;if(!_0x42bda8)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x272149=Date[_0x3e4c67(0x1d2)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x12374b+_0x3e4c67(0x1c9)+_0x58cd5f[_0x3e4c67(0x207)]['search_string']+'\x22');try{const _0xbe4cb9=new WarpGrepClient({'morphApiKey':_0x42bda8,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x31ea58=await _0xbe4cb9[_0x3e4c67(0x206)]({'searchTerm':_0x58cd5f['data'][_0x3e4c67(0x25a)],'github':_0x12374b,'branch':_0x58cd5f[_0x3e4c67(0x207)][_0x3e4c67(0x174)]}),_0x397be0=Date[_0x3e4c67(0x1d2)]()-_0x272149;logMcpStderr(_0x3e4c67(0x23e)+_0x397be0+_0x3e4c67(0x1da)+_0x31ea58['success']);const _0x5acd50=formatResult(_0x31ea58);return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x5acd50}]};}catch(_0x171d63){const _0x5ef0da=Date[_0x3e4c67(0x1d2)]()-_0x272149,_0x46bd95=_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x166)]:String(_0x171d63);return logMcpStderr(_0x3e4c67(0x18e)+_0x5ef0da+_0x3e4c67(0x186),_0x46bd95),reportMorphError({'error_message':_0x46bd95,'error_type':_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':'github_codebase_search','github_url':_0x12374b,'search_string':_0x58cd5f[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'branch':_0x58cd5f[_0x3e4c67(0x207)]['branch']},'stack_trace':_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x180)]:undefined,'source':_0x3e4c67(0x23f),'tool':_0x3e4c67(0x15a),'latency_ms':_0x5ef0da})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x188)+_0x46bd95}],'isError':![]};}}default:throw new Error(_0x3e4c67(0x22c)+_0x4dc166);}}catch(_0x5abe02){const _0x142684=_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x166)]:String(_0x5abe02);return reportMorphError({'error_message':_0x142684,'error_type':_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':_0x4dc166,'arguments':_0x125058?JSON[_0x3e4c67(0x24f)](_0x125058)[_0x3e4c67(0x18b)](0x0,0x1f4):undefined,'mcp_server_version':_0x3e4c67(0x1ad)},'stack_trace':_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x180)]:undefined,'source':'mcp-filesystem'})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1cf)+_0x142684}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2571de){const _0x56867a=a0_0x23a6f4,_0x5df25c=await getValidRootDirectories(_0x2571de);if(_0x5df25c[_0x56867a(0x187)]>0x0)allowedDirectories=[..._0x5df25c],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x5df25c[_0x56867a(0x187)]+_0x56867a(0x1bd));else{logMcpStderr(_0x56867a(0x1e6));if(ENABLE_WORKSPACE_MODE)try{const _0x268a5a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x268a5a&&(allowedDirectories=[_0x268a5a],logMcpStderr(_0x56867a(0x219)+_0x268a5a));}catch(_0xeac7a3){logMcpStderr(_0x56867a(0x21e)+_0xeac7a3);}}}server[a0_0x23a6f4(0x232)](RootsListChangedNotificationSchema,async()=>{const _0x39add3=a0_0x23a6f4;try{const _0x23518b=await server[_0x39add3(0x221)]();_0x23518b&&_0x39add3(0x15c)in _0x23518b&&await updateAllowedDirectoriesFromRoots(_0x23518b[_0x39add3(0x15c)]);}catch(_0x398086){logMcpStderr(_0x39add3(0x194),_0x398086 instanceof Error?_0x398086[_0x39add3(0x166)]:String(_0x398086));}}),server[a0_0x23a6f4(0x1fd)]=async()=>{const _0xf602e5=a0_0x23a6f4,_0x56b837=server[_0xf602e5(0x267)]();if(_0x56b837?.[_0xf602e5(0x15c)])try{const _0x4540d6=await server[_0xf602e5(0x221)]();_0x4540d6&&_0xf602e5(0x15c)in _0x4540d6?await updateAllowedDirectoriesFromRoots(_0x4540d6[_0xf602e5(0x15c)]):logMcpStderr(_0xf602e5(0x181));}catch(_0x32d77f){logMcpStderr(_0xf602e5(0x1a5),_0x32d77f instanceof Error?_0x32d77f['message']:String(_0x32d77f));}else{if(allowedDirectories[_0xf602e5(0x187)]>0x0)logMcpStderr(_0xf602e5(0x1df),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0xf602e5(0x20b));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 _0x340fd3=a0_0x23a6f4,_0x39d48f=new StdioServerTransport();await server[_0x340fd3(0x1cc)](_0x39d48f),logMcpStderr(_0x340fd3(0x16d)),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x23a6f4(0x177)](_0x319a74=>{const _0x3c635d=a0_0x23a6f4;logMcpStderr(_0x3c635d(0x256),_0x319a74),process['exit'](0x1);});
2
+ const a0_0x5e2a04=a0_0x3b11;(function(_0x5b032a,_0x4309e2){const _0x25a32c=a0_0x3b11,_0x206cab=_0x5b032a();while(!![]){try{const _0x4ea0ce=-parseInt(_0x25a32c(0x1cf))/0x1*(parseInt(_0x25a32c(0x1e5))/0x2)+parseInt(_0x25a32c(0x1b5))/0x3*(-parseInt(_0x25a32c(0x28a))/0x4)+-parseInt(_0x25a32c(0x289))/0x5+parseInt(_0x25a32c(0x25d))/0x6+parseInt(_0x25a32c(0x246))/0x7*(parseInt(_0x25a32c(0x26f))/0x8)+parseInt(_0x25a32c(0x227))/0x9+parseInt(_0x25a32c(0x25f))/0xa;if(_0x4ea0ce===_0x4309e2)break;else _0x206cab['push'](_0x206cab['shift']());}catch(_0x3766fa){_0x206cab['push'](_0x206cab['shift']());}}}(a0_0x6c03,0xc817f));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_0x46b046 from'fs/promises';import a0_0x56ec11 from'path';import a0_0xb265c3 from'os';import{createRequire}from'module';function a0_0x3b11(_0x3de71e,_0x9f5b86){_0x3de71e=_0x3de71e-0x191;const _0x6c03db=a0_0x6c03();let _0x3b1122=_0x6c03db[_0x3de71e];return _0x3b1122;}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_0x2d1474 from'axios';function fixPathRepetition(_0x312cd8){const _0x5bc744=a0_0x3b11,_0xdfd0ce=_0x312cd8[_0x5bc744(0x1f5)](a0_0x56ec11[_0x5bc744(0x23e)])[_0x5bc744(0x2aa)](Boolean);if(_0xdfd0ce[_0x5bc744(0x205)]<0x2)return null;for(let _0x192f4c=Math[_0x5bc744(0x1c0)](_0xdfd0ce[_0x5bc744(0x205)]/0x2);_0x192f4c>=0x1;_0x192f4c--){for(let _0x49da1d=0x0;_0x49da1d<=_0xdfd0ce['length']-0x2*_0x192f4c;_0x49da1d++){const _0x2c6df2=_0xdfd0ce['slice'](_0x49da1d,_0x49da1d+_0x192f4c),_0x57fc1d=_0xdfd0ce['slice'](_0x49da1d+_0x192f4c,_0x49da1d+0x2*_0x192f4c);if(_0x2c6df2[_0x5bc744(0x232)]((_0x4e0efb,_0x291a5f)=>_0x4e0efb===_0x57fc1d[_0x291a5f])){const _0x11d943=[..._0xdfd0ce['slice'](0x0,_0x49da1d),..._0xdfd0ce['slice'](_0x49da1d+_0x192f4c)];return a0_0x56ec11['sep']+_0x11d943[_0x5bc744(0x1c6)](a0_0x56ec11[_0x5bc744(0x23e)]);}}}return null;}const require=createRequire(import.meta.url);function a0_0x6c03(){const _0x169faf=['\x20disabled\x20via\x20DISABLED_TOOLS','Created\x20File','Morph\x20Edit\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Applied','message','pattern','mcp-filesystem','context','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','search_string','Warning:\x20','utf-8','source','Specific\x20commit\x20hash\x20to\x20search','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.','PathError','requiresApiKey','parse','messages','Error\x20accessing\x20directory\x20','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','code_edit','MORPH_WARP_GREP_TIMEOUT','read','1319292ygHcKc','getClientCapabilities','Bearer\x20','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','inputSchema','indexOf','Error\x20running\x20fast\x20context\x20search:\x20','.cursor','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','tsconfig.json','every',',\x20modified\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','payload','UnknownError','unknown','\x0aOptions:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','repo_path','node_modules','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','package.json','sep','timeout','terminated','FileReadError','realpath','\x20error(s)','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','\x20\x20morph-mcp','168nNeINM','describe','RipgrepNotAvailable','owner_repo','\x0aExamples:','number','has','application/json','\x20valid\x20directories','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','user','dryRun','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','linesModified','morph-warp-grep-v2.1','completionId','codebase_search','toISOString','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','Invalid\x20arguments:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','-\x20Grepped\x20\x27','255774LAKSKh','all','1446880aNNupH','terminationReason','stack','searchGitHub','grep\x20\x27','-\x20Listed\x20directory\x20`','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','false','glob','PWD','constructor','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','path','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','timings','502512GYlRhP','@morphllm/morphmcp\x20','argv','edit_file','\x20as\x20allowed\x20directory','metadata','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','arguments','roots','changes','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','branch','code','[github_codebase_search]\x20Failed\x20in\x20','grep','Parent\x20directory\x20does\x20not\x20exist:\x20','--version','trim','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','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.','content','Tool\x20\x22','GitHub\x20search\x20failed:\x20','lines','.vscode','MORPH_API_URL','147635OACASc','2071048YwGLpm','Disabled\x20tools:\x20','\x20is\x20not\x20a\x20directory','read\x20','Workspace\x20mode\x20enabled:\x20Using\x20','\x20(new\x20file)','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','some','warn','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','search_type','push','DISABLED_TOOLS','ToolException','[github_codebase_search]\x20Done\x20in\x20','Rules:\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','glob\x20\x27','dirname','description','now','grep_search','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','list_directory\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','map','Cargo.toml','optional','tool','github_codebase_search','Unknown\x20tool:\x20','completed_with_file_errors','filter','timed\x20out','tool_calls','function','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','WORKSPACE_ROOT','success','\x20chars)','connect','listRoots','catch','../package.json','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','pyproject.toml','oninitialized','</file>','File\x20read\x20error:','startsWith','command','exit','-\x20Read\x20file\x20`','string','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','TimeoutError','log','WarpGrep\x20sub-tool\x20errors:\x20','\x20-\x20','object','size','Morph\x20Edit\x20Preview','Warning:\x20Workspace\x20fallback\x20failed:\x20','access','0.2.0','basename','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','boolean','added\x20','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\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.','3zKEAAX','readFile','Max\x20results\x20to\x20return','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','name','Preview\x20changes\x20without\x20applying\x20them.','errors','\x22.\x20Known\x20tools:\x20','\x0a...\x20(truncated,\x20total:\x20','BinaryFile','includes','floor','RipgrepError','ReadError','error','min','github_url','join','instruction','\x22>\x0aError\x20reading\x20file:\x20','post','Relevant\x20context\x20found:','unknown\x20error','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','text','files','474569bObkmh','setRequestHandler','etimedout','ENOENT','role','list_directory','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','morph-mcp','FileNotFound','assistant','`\x20in\x20`','SymlinkError','finish','array','.\x20Changes:\x20','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','stat','morph-v3-fast','go.mod','2HEKyAS','data','resolve','Error:\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','version','isArray','SubToolError','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Repository\x20identifier','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','completed','isDirectory','sk-','linesAdded','split','https://morphllm.com/api/error-report','stringify','tool_call_id','env','For\x20deletions:\x0a','linesRemoved','morph-','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','toLowerCase','safeParse','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','normalize','Tool\x20','slice','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','length','[could\x20not\x20read\x20file:\x20','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','substring','default','homedir','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','WarpGrepError','<file\x20path=\x22'];a0_0x6c03=function(){return _0x169faf;};return a0_0x6c03();}function getPackageVersion(){const _0x98081d=a0_0x3b11;try{const _0x2f903f=require(_0x98081d(0x199));return _0x2f903f[_0x98081d(0x1eb)]??_0x98081d(0x237);}catch(_0x14e6e5){return logMcpStderr(_0x98081d(0x252),_0x14e6e5),_0x98081d(0x237);}}function printHelp(){const _0x134202=a0_0x3b11;console['log'](_0x134202(0x270)+getPackageVersion()),console[_0x134202(0x1a7)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x134202(0x1a7)](_0x134202(0x238)),console['log']('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x134202(0x1a7)](_0x134202(0x1de)),console[_0x134202(0x1a7)](_0x134202(0x281)),console[_0x134202(0x1a7)](_0x134202(0x24a)),console['log'](_0x134202(0x245)),console[_0x134202(0x1a7)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x5e2a04(0x271)][a0_0x5e2a04(0x203)](0x2),VERSION_FLAGS=new Set([a0_0x5e2a04(0x27f),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x5e2a04(0x291)](_0x3cc670=>VERSION_FLAGS['has'](_0x3cc670))&&(console['log'](a0_0x5e2a04(0x270)+getPackageVersion()),process[a0_0x5e2a04(0x1a1)](0x0));cliArgs[a0_0x5e2a04(0x291)](_0x2fd54b=>HELP_FLAGS['has'](_0x2fd54b))&&(printHelp(),process[a0_0x5e2a04(0x1a1)](0x0));function getCliArg(_0x113015){const _0x1df9d7=a0_0x5e2a04;for(let _0x49bd8e=0x0;_0x49bd8e<cliArgs[_0x1df9d7(0x205)];_0x49bd8e++){const _0x562578=cliArgs[_0x49bd8e];if(_0x562578[_0x1df9d7(0x19f)]('--'+_0x113015+'='))return _0x562578[_0x1df9d7(0x203)](('--'+_0x113015+'=')['length']);if(_0x562578==='--'+_0x113015&&_0x49bd8e+0x1<cliArgs[_0x1df9d7(0x205)])return cliArgs[_0x49bd8e+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5e2a04(0x205)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x5e2a04(0x24c)](arg))continue;if(arg[a0_0x5e2a04(0x19f)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x5e2a04(0x295)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x5e2a04(0x193)]||process[a0_0x5e2a04(0x1f9)][a0_0x5e2a04(0x268)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x5e2a04(0x1f9)]['ENABLE_WORKSPACE_MODE']!==a0_0x5e2a04(0x266),MORPH_API_KEY=getCliArg('api-key')??process['env']['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x5e2a04(0x1f9)][a0_0x5e2a04(0x288)],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x5e2a04(0x225)]?parseInt(process['env']['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x5e2a04(0x272),a0_0x5e2a04(0x256),a0_0x5e2a04(0x2a7)]),DISABLED_TOOLS=process[a0_0x5e2a04(0x1f9)][a0_0x5e2a04(0x296)]?new Set(process[a0_0x5e2a04(0x1f9)][a0_0x5e2a04(0x296)][a0_0x5e2a04(0x1f5)](',')['map'](_0x362ae6=>_0x362ae6[a0_0x5e2a04(0x280)]())['filter'](_0x533d0c=>_0x533d0c[a0_0x5e2a04(0x205)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x5e2a04(0x1ab)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x5e2a04(0x1c3)](a0_0x5e2a04(0x23c)+tool+a0_0x5e2a04(0x1bc)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x5e2a04(0x1c3)](a0_0x5e2a04(0x28b)+[...DISABLED_TOOLS][a0_0x5e2a04(0x1c6)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x5e2a04(0x19f)](a0_0x5e2a04(0x1f3))&&!MORPH_API_KEY[a0_0x5e2a04(0x19f)](a0_0x5e2a04(0x1fc))&&logMcpStderr(a0_0x5e2a04(0x29a));async function reportMorphError(_0x4659b){const _0x1135b1=a0_0x5e2a04;try{await a0_0x2d1474[_0x1135b1(0x1c9)](_0x1135b1(0x1f6),{..._0x4659b,'timestamp':new Date()[_0x1135b1(0x257)](),'source':_0x4659b[_0x1135b1(0x21b)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4659b[_0x1135b1(0x216)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x1135b1(0x24d),'Authorization':_0x1135b1(0x229)+MORPH_API_KEY}});}catch{}}args[a0_0x5e2a04(0x205)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5e2a04(0x1f0)),logMcpStderr(a0_0x5e2a04(0x258)),logMcpStderr(a0_0x5e2a04(0x2a2)),logMcpStderr(a0_0x5e2a04(0x1a5)),logMcpStderr(a0_0x5e2a04(0x22f)),logMcpStderr(a0_0x5e2a04(0x234)));function normalizePath(_0x36adf7){const _0x4a7ef3=a0_0x5e2a04;return a0_0x56ec11[_0x4a7ef3(0x201)](_0x36adf7);}function expandHome(_0x2120d7){const _0x2f431a=a0_0x5e2a04;if(_0x2120d7[_0x2f431a(0x19f)]('~/')||_0x2120d7==='~')return a0_0x56ec11[_0x2f431a(0x1c6)](a0_0xb265c3[_0x2f431a(0x20a)](),_0x2120d7['slice'](0x1));return _0x2120d7;}let allowedDirectories=await Promise[a0_0x5e2a04(0x25e)](args['map'](async _0x1c68b5=>{const _0x583fa9=a0_0x5e2a04,_0x2e117c=expandHome(_0x1c68b5),_0x22661d=a0_0x56ec11[_0x583fa9(0x1e7)](_0x2e117c);try{const _0x2881c2=await a0_0x46b046['realpath'](_0x22661d);return normalizePath(_0x2881c2);}catch(_0x57cc6f){return normalizePath(_0x22661d);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x5e2a04(0x205)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x5e2a04(0x295)](workspaceDir),logMcpStderr(a0_0x5e2a04(0x28e)+workspaceDir+a0_0x5e2a04(0x273)));}catch(a0_0x25447a){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x25447a);}async function detectWorkspaceRoot(_0x25afd6){const _0x13b4ba=a0_0x5e2a04;let _0x311de0=a0_0x56ec11['resolve'](_0x25afd6);const _0x1987d6=['.git',_0x13b4ba(0x287),_0x13b4ba(0x23d),_0x13b4ba(0x2a4),_0x13b4ba(0x19b),_0x13b4ba(0x1e4),_0x13b4ba(0x22e),_0x13b4ba(0x231),'composer.json'];while(_0x311de0!==a0_0x56ec11['dirname'](_0x311de0)){for(const _0x49fa92 of _0x1987d6){const _0x124220=a0_0x56ec11[_0x13b4ba(0x1c6)](_0x311de0,_0x49fa92);try{return await a0_0x46b046[_0x13b4ba(0x1ae)](_0x124220),normalizePath(_0x311de0);}catch{}}_0x311de0=a0_0x56ec11[_0x13b4ba(0x29c)](_0x311de0);}return normalizePath(_0x25afd6);}await Promise[a0_0x5e2a04(0x25e)](args[a0_0x5e2a04(0x2a3)](async _0x1c336a=>{const _0x3ef9b0=a0_0x5e2a04;try{const _0x1d829e=await a0_0x46b046[_0x3ef9b0(0x1e2)](expandHome(_0x1c336a));!_0x1d829e[_0x3ef9b0(0x1f2)]()&&(logMcpStderr('Error:\x20'+_0x1c336a+_0x3ef9b0(0x28c)),process[_0x3ef9b0(0x1a1)](0x1));}catch(_0x3a2780){logMcpStderr(_0x3ef9b0(0x222)+_0x1c336a+':',_0x3a2780),process[_0x3ef9b0(0x1a1)](0x1);}}));async function validatePath(_0x394865){const _0x341b6c=a0_0x5e2a04,_0xba4841=expandHome(_0x394865),_0x34208e=a0_0x56ec11[_0x341b6c(0x1e7)](_0xba4841);try{const _0x2cfbc5=await a0_0x46b046[_0x341b6c(0x242)](_0x34208e);return _0x2cfbc5;}catch(_0x2abf20){if(_0x2abf20[_0x341b6c(0x27b)]===_0x341b6c(0x1d2)){const _0x101492=a0_0x56ec11[_0x341b6c(0x29c)](_0x34208e);try{const _0x470932=await a0_0x46b046[_0x341b6c(0x242)](_0x101492);return a0_0x56ec11[_0x341b6c(0x1c6)](_0x470932,a0_0x56ec11[_0x341b6c(0x1b0)](_0x34208e));}catch{throw new Error(_0x341b6c(0x27e)+_0x101492);}}throw _0x2abf20;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x5e2a04(0x1a3)](),'code_edit':z[a0_0x5e2a04(0x1a3)]()['describe'](a0_0x5e2a04(0x20b)),'instruction':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x265)),'dryRun':z[a0_0x5e2a04(0x1b2)]()[a0_0x5e2a04(0x209)](![])[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x1ba))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5e2a04(0x1b4),WarpGrepArgsSchema=z[a0_0x5e2a04(0x1aa)]({'search_string':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x247)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x5e2a04(0x247)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z['enum'](['default',a0_0x5e2a04(0x23b)])['optional']()['describe'](a0_0x5e2a04(0x207))}),WarpGrepGitHubArgsSchema=z[a0_0x5e2a04(0x1aa)]({'search_string':z[a0_0x5e2a04(0x1a3)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x282)),'owner_repo':z[a0_0x5e2a04(0x1a3)]()['optional']()[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x293)),'branch':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x2a5)]()[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x279))}),CodebaseSearchArgsSchema=z[a0_0x5e2a04(0x1aa)]({'query':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x247)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x1ef)),'branch':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x2a5)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x5e2a04(0x1a3)]()[a0_0x5e2a04(0x2a5)]()[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x21c)),'targetDirectories':z[a0_0x5e2a04(0x1dc)](z[a0_0x5e2a04(0x1a3)]())[a0_0x5e2a04(0x209)]([])[a0_0x5e2a04(0x247)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x5e2a04(0x24b)]()[a0_0x5e2a04(0x2a5)]()[a0_0x5e2a04(0x209)](0xa)[a0_0x5e2a04(0x247)](a0_0x5e2a04(0x1b7))}),server=new Server({'name':a0_0x5e2a04(0x1d6),'version':a0_0x5e2a04(0x1af)},{'capabilities':{'tools':{}}});server[a0_0x5e2a04(0x1d0)](ListToolsRequestSchema,async()=>{const _0x3bb92c=a0_0x5e2a04,_0x60a466=[{'name':_0x3bb92c(0x272),'description':_0x3bb92c(0x1b1)+_0x3bb92c(0x1cc)+_0x3bb92c(0x26b)+_0x3bb92c(0x1b8)+'Benefits:\x0a'+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x3bb92c(0x259)+_0x3bb92c(0x1a4)+_0x3bb92c(0x230)+_0x3bb92c(0x290)+_0x3bb92c(0x244)+_0x3bb92c(0x223)+_0x3bb92c(0x1fa)+_0x3bb92c(0x239)+_0x3bb92c(0x22a)+_0x3bb92c(0x299)+_0x3bb92c(0x204)+_0x3bb92c(0x192)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x3bb92c(0x24f)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+_0x3bb92c(0x200)+'IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x3bb92c(0x256),'description':_0x3bb92c(0x1fd)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3bb92c(0x1d5)+_0x3bb92c(0x1e0)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x2a4d3b=_0x60a466[_0x3bb92c(0x2aa)](_0x2b8a02=>{const _0x5c8a0c=_0x3bb92c;if(DISABLED_TOOLS[_0x5c8a0c(0x24c)](_0x2b8a02[_0x5c8a0c(0x1b9)]))return console[_0x5c8a0c(0x1c3)](_0x5c8a0c(0x202)+_0x2b8a02[_0x5c8a0c(0x1b9)]+_0x5c8a0c(0x20e)),![];if('requiresApiKey'in _0x2b8a02&&_0x2b8a02[_0x5c8a0c(0x21f)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x2b8a02['name']+_0x5c8a0c(0x211)),![];return!![];});return{'tools':_0x2a4d3b[_0x3bb92c(0x2a3)](_0x53da4b=>({'name':_0x53da4b[_0x3bb92c(0x1b9)],'description':_0x53da4b[_0x3bb92c(0x29d)],'inputSchema':_0x53da4b[_0x3bb92c(0x22b)]}))};}),server[a0_0x5e2a04(0x1d0)](CallToolRequestSchema,async _0x5058d7=>{const _0x2f9b86=a0_0x5e2a04,{name:_0x2dd778,arguments:_0x53ba2}=_0x5058d7['params'];try{if(DISABLED_TOOLS[_0x2f9b86(0x24c)](_0x2dd778))throw new Error(_0x2f9b86(0x284)+_0x2dd778+_0x2f9b86(0x1e1));switch(_0x2dd778){case _0x2f9b86(0x272):{const _0xe988d1=MorphEditFileArgsSchema['safeParse'](_0x53ba2);if(!_0xe988d1['success'])throw new Error(_0x2f9b86(0x2a0)+_0xe988d1['error']);const _0x59204b=await validatePath(_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x26c)]);let _0x2e2906=null,_0x1da874=!![],_0x4dd4fc=null;try{_0x2e2906=await a0_0x46b046[_0x2f9b86(0x1b6)](_0x59204b,'utf-8');}catch(_0x3419aa){const _0x32aff5=_0x3419aa[_0x2f9b86(0x27b)];_0x32aff5==='ENOENT'?(_0x1da874=![],_0x2e2906=''):(_0x4dd4fc='Failed\x20to\x20read\x20file:\x20'+(_0x32aff5||_0x2f9b86(0x237))+_0x2f9b86(0x1a9)+(_0x3419aa instanceof Error?_0x3419aa['message']:String(_0x3419aa)),logMcpStderr(_0x2f9b86(0x219)+_0x4dd4fc));}let _0x807472;try{const _0x27fcde=MORPH_API_KEY;if(!_0x27fcde)throw new Error(_0x2f9b86(0x1e9));const _0x58fa4e=a0_0x56ec11[_0x2f9b86(0x29c)](_0x59204b),_0x3b41d0=a0_0x56ec11[_0x2f9b86(0x1b0)](_0x59204b),_0x5ae0f2=await executeEditFile({'target_filepath':_0x3b41d0,'code_edit':_0xe988d1['data'][_0x2f9b86(0x224)],'instructions':_0xe988d1['data'][_0x2f9b86(0x1c7)]},{'morphApiKey':_0x27fcde,'morphApiUrl':MORPH_API_URL,'baseDir':_0x58fa4e,'autoWrite':!_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x251)],'generateUdiff':![],'debug':![]});_0x807472=_0x5ae0f2[_0x2f9b86(0x255)];if(!_0x5ae0f2[_0x2f9b86(0x194)])throw new Error(_0x5ae0f2[_0x2f9b86(0x1c3)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x279a16=_0x5ae0f2[_0x2f9b86(0x278)],_0x7d73d7=_0x2f9b86(0x1b3)+_0x279a16[_0x2f9b86(0x1f4)]+',\x20removed\x20'+_0x279a16[_0x2f9b86(0x1fb)]+_0x2f9b86(0x233)+_0x279a16[_0x2f9b86(0x253)];if(_0xe988d1['data'][_0x2f9b86(0x251)])return{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x2f9b86(0x1ac)+(_0x1da874?'':_0x2f9b86(0x28f))+':\x20'+_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x1c7)]+_0x2f9b86(0x1dd)+_0x7d73d7+'.\x20Path:\x20'+_0xe988d1['data'][_0x2f9b86(0x26c)]+'.'}]};return{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x2f9b86(0x210)+(_0x1da874?_0x2f9b86(0x212):_0x2f9b86(0x20f))+':\x20'+_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x1c7)]+'.\x20Changes:\x20'+_0x7d73d7+'.\x20Path:\x20'+_0xe988d1['data'][_0x2f9b86(0x26c)]+'.'}]};}catch(_0xcb02ad){const _0x4a70bf=_0xcb02ad instanceof Error?_0xcb02ad[_0x2f9b86(0x213)]:String(_0xcb02ad);return reportMorphError({'error_message':_0x4a70bf,'error_type':_0xcb02ad instanceof Error?_0xcb02ad[_0x2f9b86(0x269)][_0x2f9b86(0x1b9)]:_0x2f9b86(0x236),'context':{'tool':'edit_file','completion_id':_0x807472,'file_path':_0xe988d1['data']['path'],'validated_path':_0x59204b,'instruction':_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x1c7)],'model':_0x2f9b86(0x1e3),'dry_run':_0xe988d1['data'][_0x2f9b86(0x251)],'file_exists':_0x1da874,'file_read_error':_0x4dd4fc,'file_readable':_0x2e2906!==null,'request_content':{'path':_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x26c)],'code_edit':_0xe988d1['data']['code_edit'],'instruction':_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x1c7)],'original_code':_0x2e2906!==null?_0x2e2906[_0x2f9b86(0x205)]>0xc350?_0x2e2906[_0x2f9b86(0x208)](0x0,0xc350)+_0x2f9b86(0x1bd)+_0x2e2906[_0x2f9b86(0x205)]+_0x2f9b86(0x195):_0x2e2906:_0x2f9b86(0x206)+(_0x4dd4fc||_0x2f9b86(0x1cb))+']','original_code_length':_0x2e2906?.[_0x2f9b86(0x205)]??0x0,'model':_0x2f9b86(0x1e3),'dry_run':_0xe988d1[_0x2f9b86(0x1e6)][_0x2f9b86(0x251)]}},'stack_trace':_0xcb02ad instanceof Error?_0xcb02ad[_0x2f9b86(0x261)]:undefined,'source':_0x2f9b86(0x215)})[_0x2f9b86(0x198)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x4a70bf}],'isError':!![]};}}case _0x2f9b86(0x256):{const _0x16d9dd=WarpGrepArgsSchema[_0x2f9b86(0x1ff)](_0x53ba2);if(!_0x16d9dd[_0x2f9b86(0x194)])return{'content':[{'type':'text','text':_0x2f9b86(0x25a)+_0x16d9dd[_0x2f9b86(0x1c3)]}],'isError':!![]};const _0x81452f=_0x1bc553=>{const _0x45403b=_0x2f9b86,_0x58526b=[];for(const _0x14acb5 of _0x1bc553||[]){if(_0x14acb5[_0x45403b(0x1d3)]==='assistant'&&Array[_0x45403b(0x1ec)](_0x14acb5[_0x45403b(0x2ac)]))for(const _0x3872ee of _0x14acb5[_0x45403b(0x2ac)]){try{const _0x3f769c=_0x3872ee[_0x45403b(0x191)]?.['name'],_0x5732cd=JSON[_0x45403b(0x220)](_0x3872ee[_0x45403b(0x191)]?.[_0x45403b(0x276)]||'{}');if(_0x3f769c===_0x45403b(0x29f))_0x58526b[_0x45403b(0x295)](_0x45403b(0x263)+_0x5732cd[_0x45403b(0x214)]+'\x27\x20'+(_0x5732cd[_0x45403b(0x26c)]||'.'));else{if(_0x3f769c==='read')_0x58526b[_0x45403b(0x295)](_0x45403b(0x28d)+_0x5732cd[_0x45403b(0x26c)]);else{if(_0x3f769c===_0x45403b(0x1d4))_0x58526b[_0x45403b(0x295)](_0x45403b(0x2a1)+(_0x5732cd[_0x45403b(0x1a0)]||'.'));else{if(_0x3f769c==='glob')_0x58526b[_0x45403b(0x295)](_0x45403b(0x29b)+_0x5732cd[_0x45403b(0x214)]+'\x27\x20'+(_0x5732cd[_0x45403b(0x26c)]||'.'));else _0x3f769c===_0x45403b(0x1db)&&_0x58526b[_0x45403b(0x295)](_0x45403b(0x1db));}}}}catch{}}}return _0x58526b;},_0x59c961=_0x1f7908=>{const _0x13cb91=_0x2f9b86,_0x191812=[];if(!_0x1f7908||!Array[_0x13cb91(0x1ec)](_0x1f7908))return _0x191812;const _0x5bdf13=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x13cb91(0x1d7),'tool':_0x13cb91(0x226)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x13cb91(0x21e),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x13cb91(0x1c2),'tool':_0x13cb91(0x226)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x13cb91(0x1c1),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x13cb91(0x248),'tool':_0x13cb91(0x27d)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x13cb91(0x1be),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x13cb91(0x1da),'tool':_0x13cb91(0x226)},{'pattern':/not a text file/,'error_type':_0x13cb91(0x1be),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x13cb91(0x1da),'tool':_0x13cb91(0x226)},{'pattern':/Error reading file:/,'error_type':_0x13cb91(0x1c2),'tool':_0x13cb91(0x226)},{'pattern':/status="error"/,'error_type':_0x13cb91(0x297),'tool':_0x13cb91(0x237)}];let _0x6ac323=0x0;for(const _0xe51061 of _0x1f7908){_0xe51061[_0x13cb91(0x1d3)]===_0x13cb91(0x1d8)&&Array[_0x13cb91(0x1ec)](_0xe51061[_0x13cb91(0x2ac)])&&_0x6ac323++;const _0x3f894f=_0xe51061['content'];if((_0xe51061[_0x13cb91(0x1d3)]===_0x13cb91(0x2a6)||_0xe51061[_0x13cb91(0x1d3)]===_0x13cb91(0x250))&&_0x3f894f&&typeof _0x3f894f===_0x13cb91(0x1a3))for(const {pattern:_0x3ba0af,error_type:_0x4d2451,tool:_0x2984d9}of _0x5bdf13){const _0x3937c4=_0x3f894f['match'](new RegExp(_0x3ba0af[_0x13cb91(0x21b)],'g'));if(_0x3937c4)for(const _0x5b2c0b of _0x3937c4){const _0x512d83=_0x3f894f[_0x13cb91(0x22c)](_0x5b2c0b),_0x3ec289=_0x3f894f['substring'](_0x512d83,Math[_0x13cb91(0x1c4)](_0x512d83+0xc8,_0x3f894f[_0x13cb91(0x205)]));_0x191812[_0x13cb91(0x295)]({'tool':_0x2984d9,'error_type':_0x4d2451,'error_message':_0x3ec289[_0x13cb91(0x1f5)]('\x0a')[0x0],'turn':_0x6ac323});}}}return _0x191812;};try{const _0x17b212=a0_0x56ec11[_0x2f9b86(0x1e7)](_0x16d9dd['data'][_0x2f9b86(0x23a)]),_0x59a62e=_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x294)],_0xb3acaf=_0x59a62e==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x3139d9=new LocalRipgrepProvider(_0x17b212,undefined,_0xb3acaf),_0x492ed2=await runWarpGrep({'searchTerm':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'repoRoot':_0x17b212,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x3139d9,'search_type':_0x59a62e}),_0x5b0b77=_0x59c961(_0x492ed2[_0x2f9b86(0x221)]);_0x5b0b77['length']>0x0&&reportMorphError({'error_message':_0x2f9b86(0x1a8)+_0x5b0b77[_0x2f9b86(0x205)]+_0x2f9b86(0x243),'error_type':_0x2f9b86(0x1ed),'level':_0x2f9b86(0x292),'tool':'codebase_search','context':{'repo_path':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x23a)],'query':_0x16d9dd['data'][_0x2f9b86(0x218)],'model':'morph-warp-grep-v2.1','termination_reason':_0x492ed2[_0x2f9b86(0x260)],'sub_tool_errors':_0x5b0b77,'timings':_0x492ed2[_0x2f9b86(0x26e)],'tool_calls':_0x81452f(_0x492ed2[_0x2f9b86(0x221)]),'messages':_0x492ed2[_0x2f9b86(0x221)]?.[_0x2f9b86(0x2a3)](_0x71161e=>({'role':_0x71161e[_0x2f9b86(0x1d3)],'content':_0x71161e[_0x2f9b86(0x283)],..._0x71161e[_0x2f9b86(0x2ac)]?{'tool_calls':_0x71161e[_0x2f9b86(0x2ac)][_0x2f9b86(0x205)]}:{},..._0x71161e[_0x2f9b86(0x1f8)]?{'tool_call_id':_0x71161e[_0x2f9b86(0x1f8)]}:{}}))},'source':'mcp-filesystem'})[_0x2f9b86(0x198)](()=>{});let _0x44a4d3='';if(_0x492ed2[_0x2f9b86(0x260)]===_0x2f9b86(0x1f1)&&_0x492ed2[_0x2f9b86(0x1db)]?.[_0x2f9b86(0x274)]?.[_0x2f9b86(0x1ce)]){const _0x44782d=_0x492ed2[_0x2f9b86(0x1db)][_0x2f9b86(0x274)][_0x2f9b86(0x1ce)];if(_0x44782d[_0x2f9b86(0x205)]===0x0)return _0x44a4d3=_0x492ed2[_0x2f9b86(0x1db)][_0x2f9b86(0x235)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x44a4d3}]};const _0x180a64=[],_0x175622=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x353e87 of _0x492ed2['messages']){if(_0x353e87[_0x2f9b86(0x1d3)]===_0x2f9b86(0x1d8)&&Array['isArray'](_0x353e87[_0x2f9b86(0x2ac)]))for(const _0x3eeacb of _0x353e87[_0x2f9b86(0x2ac)]){try{const _0x11f8c6=_0x3eeacb[_0x2f9b86(0x191)]?.['name'],_0x43a8c1=JSON[_0x2f9b86(0x220)](_0x3eeacb[_0x2f9b86(0x191)]?.[_0x2f9b86(0x276)]||'{}');if(_0x11f8c6===_0x2f9b86(0x29f))_0x175622[_0x2f9b86(0x295)](_0x2f9b86(0x25c)+_0x43a8c1['pattern']+'\x27\x20in\x20`'+(_0x43a8c1['path']||'.')+'`');else{if(_0x11f8c6===_0x2f9b86(0x226))_0x175622[_0x2f9b86(0x295)](_0x2f9b86(0x1a2)+_0x43a8c1[_0x2f9b86(0x26c)]+'`');else{if(_0x11f8c6===_0x2f9b86(0x1d4))_0x175622[_0x2f9b86(0x295)](_0x2f9b86(0x264)+(_0x43a8c1[_0x2f9b86(0x1a0)]||'.')+'`');else _0x11f8c6===_0x2f9b86(0x267)&&_0x175622[_0x2f9b86(0x295)]('-\x20Glob\x20search\x20`'+_0x43a8c1[_0x2f9b86(0x214)]+_0x2f9b86(0x1d9)+(_0x43a8c1[_0x2f9b86(0x26c)]||'.')+'`');}}}catch{}}}_0x180a64[_0x2f9b86(0x295)](_0x175622['join']('\x0a'));const _0x40eee8=['',_0x2f9b86(0x1ca)];for(const _0x2beaac of _0x44782d){if(_0x2beaac[_0x2f9b86(0x286)]==='*')_0x40eee8[_0x2f9b86(0x295)]('-\x20'+_0x2beaac[_0x2f9b86(0x26c)]+':*');else{if(Array[_0x2f9b86(0x1ec)](_0x2beaac['lines'])){const _0x33efb4=_0x2beaac[_0x2f9b86(0x286)][_0x2f9b86(0x2a3)](([_0x2963b6,_0x16ff39])=>{if(_0x2963b6===_0x16ff39)return''+_0x2963b6;return _0x2963b6+'-'+_0x16ff39;});_0x40eee8[_0x2f9b86(0x295)]('-\x20'+_0x2beaac['path']+':'+_0x33efb4['join'](','));}else _0x40eee8[_0x2f9b86(0x295)]('-\x20'+_0x2beaac['path']+':*');}}_0x40eee8[_0x2f9b86(0x295)](''),_0x180a64[_0x2f9b86(0x295)](_0x40eee8[_0x2f9b86(0x1c6)]('\x0a')),_0x180a64[_0x2f9b86(0x295)](_0x2f9b86(0x25b));const _0x36e9ef=[];for(const _0x672858 of _0x44782d){let _0x1bd31e=a0_0x56ec11[_0x2f9b86(0x1e7)](_0x16d9dd['data']['repo_path'],_0x672858[_0x2f9b86(0x26c)]),_0x37b5fd=null,_0xbb993e=null;try{_0x37b5fd=await a0_0x46b046[_0x2f9b86(0x1b6)](_0x1bd31e,{'encoding':_0x2f9b86(0x21a)});}catch(_0x3718ae){const _0x4e8dbd=fixPathRepetition(_0x1bd31e);if(_0x4e8dbd)try{_0x37b5fd=await a0_0x46b046['readFile'](_0x4e8dbd,{'encoding':_0x2f9b86(0x21a)}),_0x1bd31e=_0x4e8dbd;}catch{_0xbb993e=_0x3718ae instanceof Error?_0x3718ae:new Error(String(_0x3718ae));}else _0xbb993e=_0x3718ae instanceof Error?_0x3718ae:new Error(String(_0x3718ae));}if(_0x37b5fd!==null){const _0x142ca2=_0x37b5fd[_0x2f9b86(0x1f5)](/\r?\n/),_0x77d4d7=[_0x2f9b86(0x20d)+_0x672858[_0x2f9b86(0x26c)]+'\x22>'];if(_0x672858[_0x2f9b86(0x286)]==='*'||!Array['isArray'](_0x672858[_0x2f9b86(0x286)]))for(let _0x254489=0x1;_0x254489<=_0x142ca2['length'];_0x254489++){const _0x389943=_0x142ca2[_0x254489-0x1];_0x77d4d7[_0x2f9b86(0x295)](_0x254489+'|\x20'+_0x389943);}else for(const [_0x3eb974,_0x424ad6]of _0x672858[_0x2f9b86(0x286)]){_0x77d4d7[_0x2f9b86(0x205)]>0x1&&_0x77d4d7[_0x2f9b86(0x295)]('');for(let _0x5926b0=_0x3eb974;_0x5926b0<=_0x424ad6&&_0x5926b0<=_0x142ca2['length'];_0x5926b0++){const _0x474657=_0x142ca2[_0x5926b0-0x1];_0x77d4d7['push'](_0x5926b0+'|\x20'+_0x474657);}}_0x77d4d7[_0x2f9b86(0x295)](_0x2f9b86(0x19d)),_0x36e9ef['push'](_0x77d4d7[_0x2f9b86(0x1c6)]('\x0a'));}else _0x36e9ef['push']('<file\x20path=\x22'+_0x672858['path']+_0x2f9b86(0x1c8)+(_0xbb993e?.[_0x2f9b86(0x213)]||'Unknown\x20error')+'\x0a</file>');}_0x180a64[_0x2f9b86(0x295)](_0x36e9ef[_0x2f9b86(0x1c6)]('\x0a\x0a')),_0x44a4d3=_0x180a64['join']('\x0a');const _0x3c3a09=_0x492ed2['errors']?.[_0x2f9b86(0x2aa)](_0x2acab5=>_0x2acab5[_0x2f9b86(0x213)]?.[_0x2f9b86(0x19f)](_0x2f9b86(0x19e)))||[];if(_0x3c3a09[_0x2f9b86(0x205)]>0x0){const _0x5b7af9=_0x3c3a09['map'](_0x5d7f55=>_0x5d7f55[_0x2f9b86(0x213)])[_0x2f9b86(0x1c6)](';\x20');reportMorphError({'error_message':_0x5b7af9,'error_type':_0x2f9b86(0x241),'context':{'tool':_0x2f9b86(0x256),'repo_path':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x23a)],'query':_0x16d9dd['data'][_0x2f9b86(0x218)],'model':_0x2f9b86(0x254),'termination_reason':_0x2f9b86(0x2a9),'error_count':_0x3c3a09[_0x2f9b86(0x205)],'is_timeout':![],'timings':_0x492ed2[_0x2f9b86(0x26e)],'files_attempted':_0x44782d[_0x2f9b86(0x2a3)](_0x356c3b=>({'path':_0x356c3b[_0x2f9b86(0x26c)],'lines':_0x356c3b[_0x2f9b86(0x286)]})),'tool_calls':_0x81452f(_0x492ed2[_0x2f9b86(0x221)]),'messages':_0x492ed2[_0x2f9b86(0x221)]?.[_0x2f9b86(0x2a3)](_0x4c55ce=>({'role':_0x4c55ce[_0x2f9b86(0x1d3)],'content':_0x4c55ce[_0x2f9b86(0x283)],..._0x4c55ce['tool_calls']?{'tool_calls':_0x4c55ce[_0x2f9b86(0x2ac)][_0x2f9b86(0x205)]}:{},..._0x4c55ce[_0x2f9b86(0x1f8)]?{'tool_call_id':_0x4c55ce[_0x2f9b86(0x1f8)]}:{}})),'request_content':{'query':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'repo_path':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x23a)],'repoRoot':a0_0x56ec11[_0x2f9b86(0x1e7)](_0x16d9dd['data']['repo_path']),'model':_0x2f9b86(0x254)}},'source':_0x2f9b86(0x215)})['catch'](()=>{});}}else{if(_0x492ed2[_0x2f9b86(0x260)]===_0x2f9b86(0x240)&&_0x492ed2[_0x2f9b86(0x1bb)][_0x2f9b86(0x205)]>0x0){const _0x1825ee=_0x492ed2[_0x2f9b86(0x1bb)]['map'](_0x659365=>_0x659365[_0x2f9b86(0x213)])[_0x2f9b86(0x1c6)](';\x20');_0x44a4d3=_0x2f9b86(0x1e8)+_0x1825ee;const _0x1977be=_0x1825ee[_0x2f9b86(0x1fe)]()[_0x2f9b86(0x1bf)](_0x2f9b86(0x23f))||_0x1825ee['toLowerCase']()[_0x2f9b86(0x1bf)](_0x2f9b86(0x2ab))||_0x1825ee['toLowerCase']()['includes'](_0x2f9b86(0x1d1)),_0x5de7c7=_0x492ed2[_0x2f9b86(0x1db)]?.[_0x2f9b86(0x274)]?.[_0x2f9b86(0x1ce)],_0x4a3737=_0x492ed2[_0x2f9b86(0x1bb)][0x0];reportMorphError({'error_message':_0x1825ee,'error_type':_0x1977be?_0x2f9b86(0x1a6):_0x4a3737?.[_0x2f9b86(0x269)]?.['name']||_0x2f9b86(0x20c),'context':{'tool':_0x2f9b86(0x256),'repo_path':_0x16d9dd[_0x2f9b86(0x1e6)]['repo_path'],'query':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'model':_0x2f9b86(0x254),'termination_reason':_0x492ed2[_0x2f9b86(0x260)],'error_count':_0x492ed2[_0x2f9b86(0x1bb)][_0x2f9b86(0x205)],'is_timeout':_0x1977be,'timings':_0x492ed2[_0x2f9b86(0x26e)],'files_attempted':_0x5de7c7?.[_0x2f9b86(0x2a3)](_0x4eae8a=>({'path':_0x4eae8a[_0x2f9b86(0x26c)],'lines':_0x4eae8a['lines']})),'tool_calls':_0x81452f(_0x492ed2[_0x2f9b86(0x221)]),'messages':_0x492ed2[_0x2f9b86(0x221)]?.[_0x2f9b86(0x2a3)](_0x676794=>({'role':_0x676794[_0x2f9b86(0x1d3)],'content':_0x676794[_0x2f9b86(0x283)],..._0x676794['tool_calls']?{'tool_calls':_0x676794[_0x2f9b86(0x2ac)][_0x2f9b86(0x205)]}:{},..._0x676794['tool_call_id']?{'tool_call_id':_0x676794[_0x2f9b86(0x1f8)]}:{}})),'request_content':{'query':_0x16d9dd['data'][_0x2f9b86(0x218)],'repo_path':_0x16d9dd[_0x2f9b86(0x1e6)]['repo_path'],'repoRoot':a0_0x56ec11[_0x2f9b86(0x1e7)](_0x16d9dd['data'][_0x2f9b86(0x23a)]),'model':_0x2f9b86(0x254)}},'stack_trace':_0x4a3737?.[_0x2f9b86(0x261)]||undefined,'source':_0x2f9b86(0x215)})[_0x2f9b86(0x198)](()=>{});}else _0x44a4d3=_0x2f9b86(0x1ee);}return{'content':[{'type':'text','text':_0x44a4d3}]};}catch(_0xd1692e){const _0x33382d=_0xd1692e instanceof Error?_0xd1692e[_0x2f9b86(0x213)]:String(_0xd1692e),_0x6ffcb9=_0x33382d[_0x2f9b86(0x1fe)]()['includes'](_0x2f9b86(0x23f))||_0x33382d[_0x2f9b86(0x1fe)]()[_0x2f9b86(0x1bf)](_0x2f9b86(0x2ab))||_0x33382d[_0x2f9b86(0x1fe)]()[_0x2f9b86(0x1bf)](_0x2f9b86(0x1d1))||_0xd1692e instanceof Error&&_0xd1692e[_0x2f9b86(0x1b9)]===_0x2f9b86(0x1a6);return reportMorphError({'error_message':_0x33382d,'error_type':_0x6ffcb9?_0x2f9b86(0x1a6):_0xd1692e instanceof Error?_0xd1692e['constructor'][_0x2f9b86(0x1b9)]:_0x2f9b86(0x236),'context':{'tool':_0x2f9b86(0x256),'repo_path':_0x16d9dd['data'][_0x2f9b86(0x23a)],'query':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'model':_0x2f9b86(0x254),'is_timeout':_0x6ffcb9,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'repo_path':_0x16d9dd[_0x2f9b86(0x1e6)][_0x2f9b86(0x23a)],'repoRoot':a0_0x56ec11['resolve'](_0x16d9dd[_0x2f9b86(0x1e6)]['repo_path']),'model':_0x2f9b86(0x254)}},'stack_trace':_0xd1692e instanceof Error?_0xd1692e[_0x2f9b86(0x261)]:undefined,'source':_0x2f9b86(0x215)})[_0x2f9b86(0x198)](()=>{}),{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x2f9b86(0x22d)+_0x33382d}],'isError':![]};}}case _0x2f9b86(0x2a7):{const _0x615929=WarpGrepGitHubArgsSchema[_0x2f9b86(0x1ff)](_0x53ba2);if(!_0x615929['success'])return{'content':[{'type':'text','text':_0x2f9b86(0x25a)+_0x615929[_0x2f9b86(0x1c3)]}],'isError':!![]};const _0x2ba4e1=_0x615929[_0x2f9b86(0x1e6)][_0x2f9b86(0x1c5)]||_0x615929[_0x2f9b86(0x1e6)][_0x2f9b86(0x249)];if(!_0x2ba4e1)return{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x2f9b86(0x275)}],'isError':!![]};const _0x30c88d=MORPH_API_KEY;if(!_0x30c88d)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x29f07e=Date[_0x2f9b86(0x29e)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x2ba4e1+'\x20for:\x20\x22'+_0x615929[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)]+'\x22');try{const _0x103925=new WarpGrepClient({'morphApiKey':_0x30c88d,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x1dad7c=await _0x103925[_0x2f9b86(0x262)]({'searchTerm':_0x615929[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'github':_0x2ba4e1,'branch':_0x615929['data'][_0x2f9b86(0x27a)]}),_0x150323=Date['now']()-_0x29f07e;logMcpStderr(_0x2f9b86(0x298)+_0x150323+'ms.\x20Success:\x20'+_0x1dad7c[_0x2f9b86(0x194)]);const _0x557ee8=formatResult(_0x1dad7c);return{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x557ee8}]};}catch(_0x5557dc){const _0x20512e=Date['now']()-_0x29f07e,_0x4c136c=_0x5557dc instanceof Error?_0x5557dc[_0x2f9b86(0x213)]:String(_0x5557dc);return logMcpStderr(_0x2f9b86(0x27c)+_0x20512e+'ms:',_0x4c136c),reportMorphError({'error_message':_0x4c136c,'error_type':_0x5557dc instanceof Error?_0x5557dc[_0x2f9b86(0x269)]['name']:_0x2f9b86(0x236),'context':{'tool':_0x2f9b86(0x2a7),'github_url':_0x2ba4e1,'search_string':_0x615929[_0x2f9b86(0x1e6)][_0x2f9b86(0x218)],'branch':_0x615929[_0x2f9b86(0x1e6)][_0x2f9b86(0x27a)]},'stack_trace':_0x5557dc instanceof Error?_0x5557dc[_0x2f9b86(0x261)]:undefined,'source':_0x2f9b86(0x215),'tool':'github_codebase_search','latency_ms':_0x20512e})[_0x2f9b86(0x198)](()=>{}),{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x2f9b86(0x285)+_0x4c136c}],'isError':![]};}}default:throw new Error(_0x2f9b86(0x2a8)+_0x2dd778);}}catch(_0x3680a1){const _0x2b915b=_0x3680a1 instanceof Error?_0x3680a1[_0x2f9b86(0x213)]:String(_0x3680a1);return reportMorphError({'error_message':_0x2b915b,'error_type':_0x3680a1 instanceof Error?_0x3680a1[_0x2f9b86(0x269)][_0x2f9b86(0x1b9)]:_0x2f9b86(0x236),'context':{'tool':_0x2dd778,'arguments':_0x53ba2?JSON[_0x2f9b86(0x1f7)](_0x53ba2)[_0x2f9b86(0x208)](0x0,0x1f4):undefined,'mcp_server_version':_0x2f9b86(0x1af)},'stack_trace':_0x3680a1 instanceof Error?_0x3680a1[_0x2f9b86(0x261)]:undefined,'source':_0x2f9b86(0x215)})[_0x2f9b86(0x198)](()=>{}),{'content':[{'type':_0x2f9b86(0x1cd),'text':_0x2f9b86(0x1e8)+_0x2b915b}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x33aa5a){const _0x1c42de=a0_0x5e2a04,_0x246bb0=await getValidRootDirectories(_0x33aa5a);if(_0x246bb0['length']>0x0)allowedDirectories=[..._0x246bb0],logMcpStderr(_0x1c42de(0x1df)+_0x246bb0['length']+_0x1c42de(0x24e));else{logMcpStderr(_0x1c42de(0x217));if(ENABLE_WORKSPACE_MODE)try{const _0x4fd9ce=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4fd9ce&&(allowedDirectories=[_0x4fd9ce],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4fd9ce));}catch(_0x464eba){logMcpStderr(_0x1c42de(0x1ad)+_0x464eba);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x1b1da5=a0_0x5e2a04;try{const _0xe57aba=await server[_0x1b1da5(0x197)]();_0xe57aba&&'roots'in _0xe57aba&&await updateAllowedDirectoriesFromRoots(_0xe57aba[_0x1b1da5(0x277)]);}catch(_0x5c0c0a){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x5c0c0a instanceof Error?_0x5c0c0a[_0x1b1da5(0x213)]:String(_0x5c0c0a));}}),server[a0_0x5e2a04(0x19c)]=async()=>{const _0x172adf=a0_0x5e2a04,_0x1474d1=server[_0x172adf(0x228)]();if(_0x1474d1?.['roots'])try{const _0x1fae06=await server[_0x172adf(0x197)]();_0x1fae06&&_0x172adf(0x277)in _0x1fae06?await updateAllowedDirectoriesFromRoots(_0x1fae06[_0x172adf(0x277)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x5aeadf){logMcpStderr(_0x172adf(0x19a),_0x5aeadf instanceof Error?_0x5aeadf[_0x172adf(0x213)]:String(_0x5aeadf));}else{if(allowedDirectories[_0x172adf(0x205)]>0x0)logMcpStderr(_0x172adf(0x26a),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x172adf(0x1ea));else throw new Error(_0x172adf(0x21d));}}};async function runServer(){const _0x368cc1=a0_0x5e2a04,_0x1ff740=new StdioServerTransport();await server[_0x368cc1(0x196)](_0x1ff740),logMcpStderr(_0x368cc1(0x26d)),allowedDirectories[_0x368cc1(0x205)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x5e2a04(0x198)](_0x1259ef=>{const _0x5e6426=a0_0x5e2a04;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x1259ef),process[_0x5e6426(0x1a1)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- function a1_0x144c(_0x233157,_0x2f157d){_0x233157=_0x233157-0x1b5;var _0x4c1caa=a1_0x4c1c();var _0x144ce3=_0x4c1caa[_0x233157];return _0x144ce3;}(function(_0x9f4f08,_0x17db69){var _0x2ee89a=a1_0x144c,_0x5b4cde=_0x9f4f08();while(!![]){try{var _0x3d976d=parseInt(_0x2ee89a(0x1c0))/0x1+-parseInt(_0x2ee89a(0x1bc))/0x2+-parseInt(_0x2ee89a(0x1c3))/0x3+parseInt(_0x2ee89a(0x1bf))/0x4+parseInt(_0x2ee89a(0x1c5))/0x5*(-parseInt(_0x2ee89a(0x1b5))/0x6)+-parseInt(_0x2ee89a(0x1b9))/0x7+parseInt(_0x2ee89a(0x1c1))/0x8*(parseInt(_0x2ee89a(0x1c2))/0x9);if(_0x3d976d===_0x17db69)break;else _0x5b4cde['push'](_0x5b4cde['shift']());}catch(_0x4eaa89){_0x5b4cde['push'](_0x5b4cde['shift']());}}}(a1_0x4c1c,0xab01c));import a1_0x372b4d from'os';export function getOperatingSystemType(_0x34b2ff=a1_0x372b4d['platform']()){var _0x18bc08=a1_0x144c;switch(_0x34b2ff){case'darwin':return _0x18bc08(0x1b8);case _0x18bc08(0x1bb):return _0x18bc08(0x1b7);case _0x18bc08(0x1be):return _0x18bc08(0x1c4);default:return _0x18bc08(0x1ba);}}export function formatMcpLogMessage(_0x2db969,_0x527d2b=a1_0x372b4d['platform']()){var _0x33bb3d=a1_0x144c;return _0x33bb3d(0x1bd)+getOperatingSystemType(_0x527d2b)+']\x20'+_0x2db969;}export function logMcpStderr(_0x496d6e,..._0x48afbc){var _0x2b7ca4=a1_0x144c;console[_0x2b7ca4(0x1b6)](formatMcpLogMessage(_0x496d6e),..._0x48afbc);}function a1_0x4c1c(){var _0x1b0a81=['linux','2435336SZeSsV','393406VdzqAN','8bkDzpp','26220303gMORoq','3934107XZuJhE','Linux','1525sokFbB','4122hpbVrx','error','Windows','macOS','3356402wwuUlE','Unknown','win32','2429546YHFrav','[os='];a1_0x4c1c=function(){return _0x1b0a81;};return a1_0x4c1c();}
1
+ var a1_0x4d19ba=a1_0x4846;function a1_0x4846(_0x288fcb,_0x54bda0){_0x288fcb=_0x288fcb-0xa6;var _0x3266ad=a1_0x3266();var _0x484692=_0x3266ad[_0x288fcb];return _0x484692;}(function(_0x3ac69d,_0x567a7e){var _0x8179de=a1_0x4846,_0x23b6c0=_0x3ac69d();while(!![]){try{var _0x42a015=-parseInt(_0x8179de(0xad))/0x1*(-parseInt(_0x8179de(0xaf))/0x2)+parseInt(_0x8179de(0xb1))/0x3+-parseInt(_0x8179de(0xae))/0x4*(parseInt(_0x8179de(0xb5))/0x5)+-parseInt(_0x8179de(0xaa))/0x6*(parseInt(_0x8179de(0xa6))/0x7)+-parseInt(_0x8179de(0xb2))/0x8*(parseInt(_0x8179de(0xba))/0x9)+parseInt(_0x8179de(0xb0))/0xa+-parseInt(_0x8179de(0xa8))/0xb*(-parseInt(_0x8179de(0xb9))/0xc);if(_0x42a015===_0x567a7e)break;else _0x23b6c0['push'](_0x23b6c0['shift']());}catch(_0x50aaf0){_0x23b6c0['push'](_0x23b6c0['shift']());}}}(a1_0x3266,0x2035b));function a1_0x3266(){var _0x419d9a=['8OphCao','macOS','linux','5IXoopo','darwin','error','Windows','1704bLICAj','1257570ZaAnUZ','50344CwhJlt','Unknown','24981zTIXxS','Linux','162HDvCmR','platform','win32','1477TcMxrh','1054748TttWEs','348enTvPJ','1441680srNlnm','17652YtBUSM'];a1_0x3266=function(){return _0x419d9a;};return a1_0x3266();}import a1_0x2f93cf from'os';export function getOperatingSystemType(_0x377f1e=a1_0x2f93cf[a1_0x4d19ba(0xab)]()){var _0x4cc182=a1_0x4d19ba;switch(_0x377f1e){case _0x4cc182(0xb6):return _0x4cc182(0xb3);case _0x4cc182(0xac):return _0x4cc182(0xb8);case _0x4cc182(0xb4):return _0x4cc182(0xa9);default:return _0x4cc182(0xa7);}}export function formatMcpLogMessage(_0x4c0c4d,_0xb3451f=a1_0x2f93cf[a1_0x4d19ba(0xab)]()){return'[os='+getOperatingSystemType(_0xb3451f)+']\x20'+_0x4c0c4d;}export function logMcpStderr(_0x4324be,..._0x5a4c1d){var _0x82082a=a1_0x4d19ba;console[_0x82082a(0xb7)](formatMcpLogMessage(_0x4324be),..._0x5a4c1d);}
@@ -1 +1 @@
1
- (function(_0x1e7fe6,_0x4a2c6a){const _0x2a2c9f=a2_0x16cc,_0x215bd1=_0x1e7fe6();while(!![]){try{const _0xd606d4=-parseInt(_0x2a2c9f(0x1ab))/0x1*(parseInt(_0x2a2c9f(0x1a4))/0x2)+parseInt(_0x2a2c9f(0x1a9))/0x3*(parseInt(_0x2a2c9f(0x1a0))/0x4)+parseInt(_0x2a2c9f(0x1af))/0x5+parseInt(_0x2a2c9f(0x1a8))/0x6*(parseInt(_0x2a2c9f(0x1ae))/0x7)+parseInt(_0x2a2c9f(0x19e))/0x8+-parseInt(_0x2a2c9f(0x19d))/0x9+parseInt(_0x2a2c9f(0x1a3))/0xa;if(_0xd606d4===_0x4a2c6a)break;else _0x215bd1['push'](_0x215bd1['shift']());}catch(_0x69c594){_0x215bd1['push'](_0x215bd1['shift']());}}}(a2_0x114b,0xbeeea));function a2_0x16cc(_0x32e09d,_0x456eaf){_0x32e09d=_0x32e09d-0x19d;const _0x114b4b=a2_0x114b();let _0x16ccc1=_0x114b4b[_0x32e09d];return _0x16ccc1;}import a2_0x213326 from'path';function a2_0x114b(){const _0x53b53f=['5434855lcPhvP','9333558jNeAYZ','6256104kTjWUt','charAt','1652556puiKAo','replace','homedir','1745370CmrDCH','1792174IOLEne','trim','join','startsWith','1551282fbWLrG','3COldDC','slice','1KJNGwK','toUpperCase','match','7JeMlKE'];a2_0x114b=function(){return _0x53b53f;};return a2_0x114b();}import a2_0x5af5e4 from'os';export function convertToWindowsPath(_0x50ce00){const _0x3ee15a=a2_0x16cc;if(_0x50ce00['startsWith']('/mnt/')){const _0x3780d3=_0x50ce00[_0x3ee15a(0x19f)](0x5)[_0x3ee15a(0x1ac)](),_0x3f871c=_0x50ce00[_0x3ee15a(0x1aa)](0x6)['replace'](/\//g,'\x5c');return _0x3780d3+':'+_0x3f871c;}if(_0x50ce00[_0x3ee15a(0x1ad)](/^\/[a-zA-Z]\//)){const _0x18d589=_0x50ce00[_0x3ee15a(0x19f)](0x1)[_0x3ee15a(0x1ac)](),_0x2bc061=_0x50ce00['slice'](0x2)[_0x3ee15a(0x1a1)](/\//g,'\x5c');return _0x18d589+':'+_0x2bc061;}if(_0x50ce00[_0x3ee15a(0x1ad)](/^[a-zA-Z]:/))return _0x50ce00[_0x3ee15a(0x1a1)](/\//g,'\x5c');return _0x50ce00;}export function normalizePath(_0x44fe75){const _0x489f56=a2_0x16cc;_0x44fe75=_0x44fe75[_0x489f56(0x1a5)]()[_0x489f56(0x1a1)](/^["']|["']$/g,'');const _0x112858=_0x44fe75['startsWith']('/')&&!_0x44fe75[_0x489f56(0x1ad)](/^\/mnt\/[a-z]\//i)&&!_0x44fe75[_0x489f56(0x1ad)](/^\/[a-zA-Z]\//);if(_0x112858)return _0x44fe75[_0x489f56(0x1a1)](/\/+/g,'/')[_0x489f56(0x1a1)](/\/+$/,'');_0x44fe75=convertToWindowsPath(_0x44fe75);if(_0x44fe75[_0x489f56(0x1a7)]('\x5c\x5c')){let _0x4b7be0=_0x44fe75;_0x4b7be0=_0x4b7be0[_0x489f56(0x1a1)](/^\\{2,}/,'\x5c\x5c');const _0x22fa1e=_0x4b7be0['substring'](0x2)[_0x489f56(0x1a1)](/\\\\/g,'\x5c');_0x44fe75='\x5c\x5c'+_0x22fa1e;}else _0x44fe75=_0x44fe75[_0x489f56(0x1a1)](/\\\\/g,'\x5c');let _0x35ced0=a2_0x213326['normalize'](_0x44fe75);_0x44fe75[_0x489f56(0x1a7)]('\x5c\x5c')&&!_0x35ced0[_0x489f56(0x1a7)]('\x5c\x5c')&&(_0x35ced0='\x5c'+_0x35ced0);if(_0x35ced0['match'](/^[a-zA-Z]:/)){let _0x3f5610=_0x35ced0[_0x489f56(0x1a1)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x3f5610)&&(_0x3f5610=_0x3f5610[_0x489f56(0x19f)](0x0)[_0x489f56(0x1ac)]()+_0x3f5610[_0x489f56(0x1aa)](0x1)),_0x3f5610;}return _0x35ced0['replace'](/\//g,'\x5c');}export function expandHome(_0x25e372){const _0xb51537=a2_0x16cc;if(_0x25e372[_0xb51537(0x1a7)]('~/')||_0x25e372==='~')return a2_0x213326[_0xb51537(0x1a6)](a2_0x5af5e4[_0xb51537(0x1a2)](),_0x25e372[_0xb51537(0x1aa)](0x1));return _0x25e372;}
1
+ (function(_0x3ac869,_0x32739b){const _0x27acac=a2_0xb204,_0x54a881=_0x3ac869();while(!![]){try{const _0x6fc25c=-parseInt(_0x27acac(0x6e))/0x1*(parseInt(_0x27acac(0x6c))/0x2)+parseInt(_0x27acac(0x65))/0x3+parseInt(_0x27acac(0x6d))/0x4*(parseInt(_0x27acac(0x76))/0x5)+parseInt(_0x27acac(0x68))/0x6*(-parseInt(_0x27acac(0x73))/0x7)+parseInt(_0x27acac(0x77))/0x8+-parseInt(_0x27acac(0x64))/0x9*(-parseInt(_0x27acac(0x78))/0xa)+-parseInt(_0x27acac(0x6f))/0xb;if(_0x6fc25c===_0x32739b)break;else _0x54a881['push'](_0x54a881['shift']());}catch(_0xbf1cf0){_0x54a881['push'](_0x54a881['shift']());}}}(a2_0x168e,0x87ca3));import a2_0x268765 from'path';import a2_0x31601b from'os';export function convertToWindowsPath(_0x5721fa){const _0x22c6d8=a2_0xb204;if(_0x5721fa[_0x22c6d8(0x69)]('/mnt/')){const _0x41eaf0=_0x5721fa['charAt'](0x5)[_0x22c6d8(0x67)](),_0x172cbb=_0x5721fa['slice'](0x6)[_0x22c6d8(0x6b)](/\//g,'\x5c');return _0x41eaf0+':'+_0x172cbb;}if(_0x5721fa['match'](/^\/[a-zA-Z]\//)){const _0x4ffd5c=_0x5721fa[_0x22c6d8(0x72)](0x1)[_0x22c6d8(0x67)](),_0x2c758b=_0x5721fa['slice'](0x2)[_0x22c6d8(0x6b)](/\//g,'\x5c');return _0x4ffd5c+':'+_0x2c758b;}if(_0x5721fa[_0x22c6d8(0x7a)](/^[a-zA-Z]:/))return _0x5721fa[_0x22c6d8(0x6b)](/\//g,'\x5c');return _0x5721fa;}function a2_0x168e(){const _0x210940=['56812dOLcCs','normalize','substring','4495QnMPwW','4509240heilAY','144680xRxqZo','slice','match','396aiibQp','83316nimmgg','homedir','toUpperCase','318uTXbwU','startsWith','test','replace','10BZUbpt','3436tskDhP','44378EtBCZs','8712297WgrpNi','join','trim','charAt'];a2_0x168e=function(){return _0x210940;};return a2_0x168e();}export function normalizePath(_0x229f63){const _0x36f569=a2_0xb204;_0x229f63=_0x229f63[_0x36f569(0x71)]()[_0x36f569(0x6b)](/^["']|["']$/g,'');const _0x6a86e6=_0x229f63[_0x36f569(0x69)]('/')&&!_0x229f63[_0x36f569(0x7a)](/^\/mnt\/[a-z]\//i)&&!_0x229f63[_0x36f569(0x7a)](/^\/[a-zA-Z]\//);if(_0x6a86e6)return _0x229f63[_0x36f569(0x6b)](/\/+/g,'/')['replace'](/\/+$/,'');_0x229f63=convertToWindowsPath(_0x229f63);if(_0x229f63[_0x36f569(0x69)]('\x5c\x5c')){let _0x33d8d1=_0x229f63;_0x33d8d1=_0x33d8d1[_0x36f569(0x6b)](/^\\{2,}/,'\x5c\x5c');const _0x3e94eb=_0x33d8d1[_0x36f569(0x75)](0x2)[_0x36f569(0x6b)](/\\\\/g,'\x5c');_0x229f63='\x5c\x5c'+_0x3e94eb;}else _0x229f63=_0x229f63[_0x36f569(0x6b)](/\\\\/g,'\x5c');let _0x758701=a2_0x268765[_0x36f569(0x74)](_0x229f63);_0x229f63['startsWith']('\x5c\x5c')&&!_0x758701['startsWith']('\x5c\x5c')&&(_0x758701='\x5c'+_0x758701);if(_0x758701[_0x36f569(0x7a)](/^[a-zA-Z]:/)){let _0x5ee4cd=_0x758701['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x36f569(0x6a)](_0x5ee4cd)&&(_0x5ee4cd=_0x5ee4cd[_0x36f569(0x72)](0x0)[_0x36f569(0x67)]()+_0x5ee4cd[_0x36f569(0x79)](0x1)),_0x5ee4cd;}return _0x758701[_0x36f569(0x6b)](/\//g,'\x5c');}function a2_0xb204(_0xefc562,_0x2f2044){_0xefc562=_0xefc562-0x64;const _0x168eaf=a2_0x168e();let _0xb204c5=_0x168eaf[_0xefc562];return _0xb204c5;}export function expandHome(_0x57f1fa){const _0x260502=a2_0xb204;if(_0x57f1fa[_0x260502(0x69)]('~/')||_0x57f1fa==='~')return a2_0x268765[_0x260502(0x70)](a2_0x31601b[_0x260502(0x66)](),_0x57f1fa[_0x260502(0x79)](0x1));return _0x57f1fa;}
@@ -1 +1 @@
1
- (function(_0xa3537d,_0x55a440){const _0x1378b4=a3_0x5a3b,_0x1e7ee3=_0xa3537d();while(!![]){try{const _0x379829=parseInt(_0x1378b4(0x127))/0x1+parseInt(_0x1378b4(0x124))/0x2+-parseInt(_0x1378b4(0x119))/0x3+-parseInt(_0x1378b4(0x11e))/0x4+parseInt(_0x1378b4(0x126))/0x5+-parseInt(_0x1378b4(0x120))/0x6+-parseInt(_0x1378b4(0x117))/0x7*(-parseInt(_0x1378b4(0x11c))/0x8);if(_0x379829===_0x55a440)break;else _0x1e7ee3['push'](_0x1e7ee3['shift']());}catch(_0x22f1b1){_0x1e7ee3['push'](_0x1e7ee3['shift']());}}}(a3_0x4f87,0xefb86));function a3_0x5a3b(_0x1cb8c9,_0x2b9262){_0x1cb8c9=_0x1cb8c9-0x116;const _0x4f875a=a3_0x4f87();let _0x5a3b74=_0x4f875a[_0x1cb8c9];return _0x5a3b74;}function a3_0x4f87(){const _0x115f88=['6322324CLWmUR','startsWith','10763400HCGthN','normalize','includes','some','2842850RKFQaP','isAbsolute','5050765MmQpKQ','405257DyEYvJ','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','28343PaixwO','string','3106137FBIiFd','length','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','5048inbZxJ','isArray'];a3_0x4f87=function(){return _0x115f88;};return a3_0x4f87();}import a3_0x1dff72 from'path';export function isPathWithinAllowedDirectories(_0x590e02,_0x43bf9a){const _0x5cf7f2=a3_0x5a3b;if(typeof _0x590e02!==_0x5cf7f2(0x118)||!Array[_0x5cf7f2(0x11d)](_0x43bf9a))return![];if(!_0x590e02||_0x43bf9a[_0x5cf7f2(0x11a)]===0x0)return![];if(_0x590e02[_0x5cf7f2(0x122)]('\x00'))return![];let _0x639be8;try{_0x639be8=a3_0x1dff72[_0x5cf7f2(0x128)](a3_0x1dff72['normalize'](_0x590e02));}catch{return![];}if(!a3_0x1dff72['isAbsolute'](_0x639be8))throw new Error(_0x5cf7f2(0x116));return _0x43bf9a[_0x5cf7f2(0x123)](_0x1a5a4d=>{const _0xc31f39=_0x5cf7f2;if(typeof _0x1a5a4d!==_0xc31f39(0x118)||!_0x1a5a4d)return![];if(_0x1a5a4d[_0xc31f39(0x122)]('\x00'))return![];let _0x9ab975;try{_0x9ab975=a3_0x1dff72[_0xc31f39(0x128)](a3_0x1dff72[_0xc31f39(0x121)](_0x1a5a4d));}catch{return![];}if(!a3_0x1dff72[_0xc31f39(0x125)](_0x9ab975))throw new Error(_0xc31f39(0x11b));if(_0x639be8===_0x9ab975)return!![];if(_0x9ab975===a3_0x1dff72['sep'])return _0x639be8[_0xc31f39(0x11f)](a3_0x1dff72['sep']);return _0x639be8[_0xc31f39(0x11f)](_0x9ab975+a3_0x1dff72['sep']);});}
1
+ (function(_0x1d8c6b,_0x35c047){const _0xf1763f=a3_0x34ed,_0x54d4ec=_0x1d8c6b();while(!![]){try{const _0x6380eb=-parseInt(_0xf1763f(0x19e))/0x1+parseInt(_0xf1763f(0x19b))/0x2+-parseInt(_0xf1763f(0x19c))/0x3+parseInt(_0xf1763f(0x1a0))/0x4*(-parseInt(_0xf1763f(0x1a4))/0x5)+-parseInt(_0xf1763f(0x1a8))/0x6*(parseInt(_0xf1763f(0x197))/0x7)+parseInt(_0xf1763f(0x1a3))/0x8*(-parseInt(_0xf1763f(0x1a2))/0x9)+parseInt(_0xf1763f(0x1a7))/0xa*(parseInt(_0xf1763f(0x19a))/0xb);if(_0x6380eb===_0x35c047)break;else _0x54d4ec['push'](_0x54d4ec['shift']());}catch(_0x22eaa9){_0x54d4ec['push'](_0x54d4ec['shift']());}}}(a3_0x4677,0x4a1e9));function a3_0x4677(){const _0x4001af=['10zCbSBl','10188XskUGM','string','includes','1841ciKGoV','isAbsolute','resolve','13857239xCjNbh','645740yFxIsU','404610byybhy','sep','56275uZibXY','Path\x20must\x20be\x20absolute\x20after\x20normalization','458092GmXKvC','length','2142fSCHCO','10008yUTJzD','15wkmASV','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some'];a3_0x4677=function(){return _0x4001af;};return a3_0x4677();}import a3_0x239dde from'path';function a3_0x34ed(_0x54bddb,_0x17677b){_0x54bddb=_0x54bddb-0x196;const _0x467738=a3_0x4677();let _0x34edf1=_0x467738[_0x54bddb];return _0x34edf1;}export function isPathWithinAllowedDirectories(_0x11bb55,_0x3b91a4){const _0x3073ce=a3_0x34ed;if(typeof _0x11bb55!==_0x3073ce(0x1a9)||!Array['isArray'](_0x3b91a4))return![];if(!_0x11bb55||_0x3b91a4[_0x3073ce(0x1a1)]===0x0)return![];if(_0x11bb55[_0x3073ce(0x196)]('\x00'))return![];let _0x2ac9ef;try{_0x2ac9ef=a3_0x239dde['resolve'](a3_0x239dde['normalize'](_0x11bb55));}catch{return![];}if(!a3_0x239dde['isAbsolute'](_0x2ac9ef))throw new Error(_0x3073ce(0x19f));return _0x3b91a4[_0x3073ce(0x1a6)](_0x2a32d9=>{const _0x1e087d=_0x3073ce;if(typeof _0x2a32d9!=='string'||!_0x2a32d9)return![];if(_0x2a32d9['includes']('\x00'))return![];let _0x340747;try{_0x340747=a3_0x239dde[_0x1e087d(0x199)](a3_0x239dde['normalize'](_0x2a32d9));}catch{return![];}if(!a3_0x239dde[_0x1e087d(0x198)](_0x340747))throw new Error(_0x1e087d(0x1a5));if(_0x2ac9ef===_0x340747)return!![];if(_0x340747===a3_0x239dde[_0x1e087d(0x19d)])return _0x2ac9ef['startsWith'](a3_0x239dde[_0x1e087d(0x19d)]);return _0x2ac9ef['startsWith'](_0x340747+a3_0x239dde[_0x1e087d(0x19d)]);});}
@@ -1 +1 @@
1
- (function(_0x293950,_0x9503bb){const _0x178fc4=a4_0x477f,_0x57c898=_0x293950();while(!![]){try{const _0xee9dfb=-parseInt(_0x178fc4(0x18f))/0x1+parseInt(_0x178fc4(0x18c))/0x2*(parseInt(_0x178fc4(0x195))/0x3)+-parseInt(_0x178fc4(0x189))/0x4+-parseInt(_0x178fc4(0x18b))/0x5*(-parseInt(_0x178fc4(0x199))/0x6)+-parseInt(_0x178fc4(0x19b))/0x7+parseInt(_0x178fc4(0x198))/0x8+parseInt(_0x178fc4(0x18d))/0x9;if(_0xee9dfb===_0x9503bb)break;else _0x57c898['push'](_0x57c898['shift']());}catch(_0x3a69d3){_0x57c898['push'](_0x57c898['shift']());}}}(a4_0x1241,0x98e06));import{promises as a4_0x1740ca}from'fs';import a4_0x110c77 from'path';import a4_0x34da83 from'os';function a4_0x477f(_0x525a42,_0xbb98){_0x525a42=_0x525a42-0x187;const _0x124173=a4_0x1241();let _0x477f24=_0x124173[_0x525a42];return _0x477f24;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x16bd04){const _0x433351=a4_0x477f;try{const _0x28c398=_0x16bd04[_0x433351(0x18e)]('file://')?_0x16bd04[_0x433351(0x187)](0x7):_0x16bd04,_0x21fcff=_0x28c398['startsWith']('~/')||_0x28c398==='~'?a4_0x110c77['join'](a4_0x34da83[_0x433351(0x188)](),_0x28c398[_0x433351(0x187)](0x1)):_0x28c398,_0x1f7fa7=a4_0x110c77['resolve'](_0x21fcff),_0x3833d8=await a4_0x1740ca[_0x433351(0x193)](_0x1f7fa7);return normalizePath(_0x3833d8);}catch{return null;}}function a4_0x1241(){const _0x116650=['3lvFdhh','invalid\x20path\x20or\x20inaccessible','Skipping\x20invalid\x20directory:\x20','2369888EhasbP','4475886vChqvP','\x20due\x20to\x20error:\x20','5109741SIftQR','slice','homedir','1073044DfllgH','uri','5YRBMQQ','1201694yFUlSG','8988714mgZipK','startsWith','1017404AKclhp','push','isDirectory','non-directory\x20root','realpath','stat'];a4_0x1241=function(){return _0x116650;};return a4_0x1241();}function formatDirectoryError(_0xfab1a1,_0xb70d96,_0x597fa0){const _0x1096c9=a4_0x477f;if(_0x597fa0)return'Skipping\x20'+_0x597fa0+':\x20'+_0xfab1a1;const _0x277697=_0xb70d96 instanceof Error?_0xb70d96['message']:String(_0xb70d96);return _0x1096c9(0x197)+_0xfab1a1+_0x1096c9(0x19a)+_0x277697;}export async function getValidRootDirectories(_0x152b85){const _0x58176f=a4_0x477f,_0x1caa63=[];for(const _0xf415f2 of _0x152b85){const _0x259df0=await parseRootUri(_0xf415f2['uri']);if(!_0x259df0){logMcpStderr(formatDirectoryError(_0xf415f2[_0x58176f(0x18a)],undefined,_0x58176f(0x196)));continue;}try{const _0xf7626=await a4_0x1740ca[_0x58176f(0x194)](_0x259df0);_0xf7626[_0x58176f(0x191)]()?_0x1caa63[_0x58176f(0x190)](_0x259df0):logMcpStderr(formatDirectoryError(_0x259df0,undefined,_0x58176f(0x192)));}catch(_0x56339f){logMcpStderr(formatDirectoryError(_0x259df0,_0x56339f));}}return _0x1caa63;}
1
+ (function(_0x5d2422,_0x32c8fb){const _0x12350c=a4_0x1430,_0x3830a7=_0x5d2422();while(!![]){try{const _0x1a5aac=parseInt(_0x12350c(0x184))/0x1+-parseInt(_0x12350c(0x18a))/0x2+-parseInt(_0x12350c(0x17f))/0x3+parseInt(_0x12350c(0x18b))/0x4*(parseInt(_0x12350c(0x183))/0x5)+-parseInt(_0x12350c(0x198))/0x6*(parseInt(_0x12350c(0x196))/0x7)+parseInt(_0x12350c(0x187))/0x8*(-parseInt(_0x12350c(0x189))/0x9)+-parseInt(_0x12350c(0x190))/0xa*(-parseInt(_0x12350c(0x181))/0xb);if(_0x1a5aac===_0x32c8fb)break;else _0x3830a7['push'](_0x3830a7['shift']());}catch(_0x261c5e){_0x3830a7['push'](_0x3830a7['shift']());}}}(a4_0x59ea,0x90a45));import{promises as a4_0x5c4f22}from'fs';function a4_0x59ea(){const _0x216eb0=['146702zrHLTi','isDirectory','realpath','738600IKXdip','non-directory\x20root','9HjSPIU','1615956RYEgKS','610876fsZwRE','homedir','invalid\x20path\x20or\x20inaccessible','\x20due\x20to\x20error:\x20','join','140kTbZfu','stat','push','startsWith','message','Skipping\x20invalid\x20directory:\x20','143822fhIIKW','resolve','36lmlDZF','uri','527871WajThZ','slice','1172732YBlAHt','Skipping\x20','5PaItUC'];a4_0x59ea=function(){return _0x216eb0;};return a4_0x59ea();}import a4_0x3ea344 from'path';import a4_0x2d09bd from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x1c40ab){const _0x36c77d=a4_0x1430;try{const _0x5dd8a1=_0x1c40ab[_0x36c77d(0x193)]('file://')?_0x1c40ab['slice'](0x7):_0x1c40ab,_0x6d75b6=_0x5dd8a1[_0x36c77d(0x193)]('~/')||_0x5dd8a1==='~'?a4_0x3ea344[_0x36c77d(0x18f)](a4_0x2d09bd[_0x36c77d(0x18c)](),_0x5dd8a1[_0x36c77d(0x180)](0x1)):_0x5dd8a1,_0x10ac08=a4_0x3ea344[_0x36c77d(0x197)](_0x6d75b6),_0x49ba8e=await a4_0x5c4f22[_0x36c77d(0x186)](_0x10ac08);return normalizePath(_0x49ba8e);}catch{return null;}}function formatDirectoryError(_0x11ba2d,_0xbb7f51,_0x10c1f2){const _0x50f70b=a4_0x1430;if(_0x10c1f2)return _0x50f70b(0x182)+_0x10c1f2+':\x20'+_0x11ba2d;const _0x1ccbc2=_0xbb7f51 instanceof Error?_0xbb7f51[_0x50f70b(0x194)]:String(_0xbb7f51);return _0x50f70b(0x195)+_0x11ba2d+_0x50f70b(0x18e)+_0x1ccbc2;}function a4_0x1430(_0x39aba6,_0x429648){_0x39aba6=_0x39aba6-0x17f;const _0x59eac7=a4_0x59ea();let _0x1430ed=_0x59eac7[_0x39aba6];return _0x1430ed;}export async function getValidRootDirectories(_0x4dd809){const _0x18e20b=a4_0x1430,_0x32ce70=[];for(const _0x560faf of _0x4dd809){const _0x55072b=await parseRootUri(_0x560faf[_0x18e20b(0x199)]);if(!_0x55072b){logMcpStderr(formatDirectoryError(_0x560faf[_0x18e20b(0x199)],undefined,_0x18e20b(0x18d)));continue;}try{const _0x319216=await a4_0x5c4f22[_0x18e20b(0x191)](_0x55072b);_0x319216[_0x18e20b(0x185)]()?_0x32ce70[_0x18e20b(0x192)](_0x55072b):logMcpStderr(formatDirectoryError(_0x55072b,undefined,_0x18e20b(0x188)));}catch(_0x4dc809){logMcpStderr(formatDirectoryError(_0x55072b,_0x4dc809));}}return _0x32ce70;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.145",
3
+ "version": "0.8.146",
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.150",
38
+ "@morphllm/morphsdk": "0.2.151",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",