@morphllm/morphmcp 0.8.135 → 0.8.137

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_0x24f4fc=a0_0x1af8;(function(_0x1fed90,_0x24f63d){const _0xb08ec9=a0_0x1af8,_0x27ba0e=_0x1fed90();while(!![]){try{const _0xb27535=-parseInt(_0xb08ec9(0x141))/0x1+parseInt(_0xb08ec9(0x11f))/0x2+-parseInt(_0xb08ec9(0x1da))/0x3*(parseInt(_0xb08ec9(0x1d9))/0x4)+-parseInt(_0xb08ec9(0x13c))/0x5+parseInt(_0xb08ec9(0x1d8))/0x6*(parseInt(_0xb08ec9(0x1d4))/0x7)+parseInt(_0xb08ec9(0x139))/0x8*(-parseInt(_0xb08ec9(0x131))/0x9)+-parseInt(_0xb08ec9(0x1f9))/0xa*(-parseInt(_0xb08ec9(0x15b))/0xb);if(_0xb27535===_0x24f63d)break;else _0x27ba0e['push'](_0x27ba0e['shift']());}catch(_0x213145){_0x27ba0e['push'](_0x27ba0e['shift']());}}}(a0_0x2eb0,0x5e98a));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_0x2fab1f from'fs/promises';import a0_0x1856a9 from'path';import a0_0x1cbd52 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_0x3d8d65 from'axios';function fixPathRepetition(_0x508d19){const _0x2ccefe=a0_0x1af8,_0x5c05bb=_0x508d19[_0x2ccefe(0x19e)](a0_0x1856a9[_0x2ccefe(0x148)])[_0x2ccefe(0x1d0)](Boolean);if(_0x5c05bb[_0x2ccefe(0x206)]<0x2)return null;for(let _0x4b3ab0=Math[_0x2ccefe(0x146)](_0x5c05bb[_0x2ccefe(0x206)]/0x2);_0x4b3ab0>=0x1;_0x4b3ab0--){for(let _0x1e4a33=0x0;_0x1e4a33<=_0x5c05bb[_0x2ccefe(0x206)]-0x2*_0x4b3ab0;_0x1e4a33++){const _0x4d1c74=_0x5c05bb[_0x2ccefe(0x199)](_0x1e4a33,_0x1e4a33+_0x4b3ab0),_0x57f95e=_0x5c05bb[_0x2ccefe(0x199)](_0x1e4a33+_0x4b3ab0,_0x1e4a33+0x2*_0x4b3ab0);if(_0x4d1c74['every']((_0x205a33,_0x1988c3)=>_0x205a33===_0x57f95e[_0x1988c3])){const _0x3c03da=[..._0x5c05bb[_0x2ccefe(0x199)](0x0,_0x1e4a33),..._0x5c05bb[_0x2ccefe(0x199)](_0x1e4a33+_0x4b3ab0)];return a0_0x1856a9['sep']+_0x3c03da[_0x2ccefe(0x118)](a0_0x1856a9[_0x2ccefe(0x148)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x42012b=a0_0x1af8;try{const _0x491b2b=require(_0x42012b(0x162));return _0x491b2b['version']??_0x42012b(0x13a);}catch(_0x41febc){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x41febc),'unknown';}}function printHelp(){const _0x2ecb6f=a0_0x1af8;console[_0x2ecb6f(0x215)](_0x2ecb6f(0x16e)+getPackageVersion()),console[_0x2ecb6f(0x215)](_0x2ecb6f(0x1ac)),console[_0x2ecb6f(0x215)](_0x2ecb6f(0x1d1)),console['log'](_0x2ecb6f(0x194)),console[_0x2ecb6f(0x215)](_0x2ecb6f(0x160)),console['log']('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log'](_0x2ecb6f(0x152)),console[_0x2ecb6f(0x215)](_0x2ecb6f(0x13e)),console['log'](_0x2ecb6f(0x121));}const cliArgs=process[a0_0x24f4fc(0x1bf)][a0_0x24f4fc(0x199)](0x2),VERSION_FLAGS=new Set([a0_0x24f4fc(0x1a9),'-v','-V']),HELP_FLAGS=new Set([a0_0x24f4fc(0x17a),'-h']);cliArgs[a0_0x24f4fc(0x214)](_0x51dd07=>VERSION_FLAGS['has'](_0x51dd07))&&(console[a0_0x24f4fc(0x215)](a0_0x24f4fc(0x16e)+getPackageVersion()),process[a0_0x24f4fc(0x16d)](0x0));cliArgs[a0_0x24f4fc(0x214)](_0xc2f04f=>HELP_FLAGS[a0_0x24f4fc(0x202)](_0xc2f04f))&&(printHelp(),process[a0_0x24f4fc(0x16d)](0x0));function getCliArg(_0x3199aa){const _0x539a38=a0_0x24f4fc;for(let _0x28d431=0x0;_0x28d431<cliArgs['length'];_0x28d431++){const _0x3262cb=cliArgs[_0x28d431];if(_0x3262cb[_0x539a38(0x210)]('--'+_0x3199aa+'='))return _0x3262cb[_0x539a38(0x199)](('--'+_0x3199aa+'=')[_0x539a38(0x206)]);if(_0x3262cb==='--'+_0x3199aa&&_0x28d431+0x1<cliArgs[_0x539a38(0x206)])return cliArgs[_0x28d431+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x24f4fc(0x206)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x24f4fc(0x202)](arg)||HELP_FLAGS[a0_0x24f4fc(0x202)](arg))continue;if(arg[a0_0x24f4fc(0x210)]('--api-key='))continue;if(arg===a0_0x24f4fc(0x1af)){i++;continue;}args[a0_0x24f4fc(0x1c9)](arg);}const WORKSPACE_ROOT=process[a0_0x24f4fc(0x1fe)]['WORKSPACE_ROOT']||process['env'][a0_0x24f4fc(0x1ab)]||process[a0_0x24f4fc(0x1e2)](),ENABLE_WORKSPACE_MODE=process[a0_0x24f4fc(0x1fe)][a0_0x24f4fc(0x1bc)]!=='false',MORPH_API_KEY=getCliArg(a0_0x24f4fc(0x19b))??process['env'][a0_0x24f4fc(0x12b)],MORPH_API_URL=process[a0_0x24f4fc(0x1fe)][a0_0x24f4fc(0x1b4)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x24f4fc(0x1fe)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x24f4fc(0x1fe)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x24f4fc(0x189),'codebase_search','github_codebase_search']),DISABLED_TOOLS=process[a0_0x24f4fc(0x1fe)][a0_0x24f4fc(0x181)]?new Set(process[a0_0x24f4fc(0x1fe)][a0_0x24f4fc(0x181)][a0_0x24f4fc(0x19e)](',')[a0_0x24f4fc(0x14c)](_0x5115c7=>_0x5115c7[a0_0x24f4fc(0x1cd)]())[a0_0x24f4fc(0x1d0)](_0x244674=>_0x244674[a0_0x24f4fc(0x206)]>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x24f4fc(0x17b)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x24f4fc(0x11b)+[...KNOWN_TOOL_NAMES][a0_0x24f4fc(0x118)](',\x20'));}console[a0_0x24f4fc(0x17b)](a0_0x24f4fc(0x15e)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x24f4fc(0x210)](a0_0x24f4fc(0x126))&&!MORPH_API_KEY[a0_0x24f4fc(0x210)]('morph-')&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x1afc09){const _0x11b7b3=a0_0x24f4fc;try{await a0_0x3d8d65['post'](_0x11b7b3(0x212),{..._0x1afc09,'timestamp':new Date()[_0x11b7b3(0x1b7)](),'source':_0x1afc09[_0x11b7b3(0x1e1)]||_0x11b7b3(0x136),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x1afc09['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x11b7b3(0x190),'Authorization':_0x11b7b3(0x16f)+MORPH_API_KEY}});}catch{}}args[a0_0x24f4fc(0x206)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x24f4fc(0x1c4)),logMcpStderr(a0_0x24f4fc(0x20c)),logMcpStderr(a0_0x24f4fc(0x186)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x24f4fc(0x19f)),logMcpStderr(a0_0x24f4fc(0x20b)));function normalizePath(_0x35e6b7){return a0_0x1856a9['normalize'](_0x35e6b7);}function expandHome(_0x47e3ff){const _0x5c265e=a0_0x24f4fc;if(_0x47e3ff[_0x5c265e(0x210)]('~/')||_0x47e3ff==='~')return a0_0x1856a9['join'](a0_0x1cbd52[_0x5c265e(0x17c)](),_0x47e3ff['slice'](0x1));return _0x47e3ff;}let allowedDirectories=await Promise[a0_0x24f4fc(0x18a)](args[a0_0x24f4fc(0x14c)](async _0x324f7d=>{const _0x546948=a0_0x24f4fc,_0x4c98f2=expandHome(_0x324f7d),_0x12d7c9=a0_0x1856a9[_0x546948(0x1c1)](_0x4c98f2);try{const _0x8eaca3=await a0_0x2fab1f['realpath'](_0x12d7c9);return normalizePath(_0x8eaca3);}catch(_0xfe44a5){return normalizePath(_0x12d7c9);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x24f4fc(0x206)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x24f4fc(0x11d)));}catch(a0_0x543d3c){logMcpStderr(a0_0x24f4fc(0x184)+a0_0x543d3c);}async function detectWorkspaceRoot(_0x46132f){const _0x4f4cfc=a0_0x24f4fc;let _0x3d73b7=a0_0x1856a9['resolve'](_0x46132f);const _0x49e4aa=[_0x4f4cfc(0x209),_0x4f4cfc(0x1e7),'package.json',_0x4f4cfc(0x166),_0x4f4cfc(0x1e3),_0x4f4cfc(0x1f6),_0x4f4cfc(0x1d3),_0x4f4cfc(0x137),'composer.json'];while(_0x3d73b7!==a0_0x1856a9[_0x4f4cfc(0x12c)](_0x3d73b7)){for(const _0x4d1a4e of _0x49e4aa){const _0xbc62=a0_0x1856a9[_0x4f4cfc(0x118)](_0x3d73b7,_0x4d1a4e);try{return await a0_0x2fab1f['access'](_0xbc62),normalizePath(_0x3d73b7);}catch{}}_0x3d73b7=a0_0x1856a9[_0x4f4cfc(0x12c)](_0x3d73b7);}return normalizePath(_0x46132f);}function a0_0x2eb0(){const _0x1dd007=['Bearer\x20','Benefits:\x0a','linesAdded','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Preview\x20changes\x20without\x20applying\x20them.','\x20(new\x20file)','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','message','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','finish','\x20is\x20not\x20a\x20directory','--help','error','homedir','UnknownError','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','\x20-\x20','safeParse','DISABLED_TOOLS','match','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','setRequestHandler','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)',',\x20modified\x20','Fallback:\x20Using\x20workspace\x20root\x20','edit_file','all','default','connect','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','lines','params','application/json','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','completionId','catch','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','enum','Failed\x20to\x20request\x20roots\x20from\x20client:','slice','user','api-key','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Fatal\x20error\x20running\x20server:','split','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','roots','stat','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','Repository\x20identifier','describe','terminated','FileReadError','linesModified','setNotificationHandler','--version','codebase_search','PWD','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','completed_with_file_errors','string','--api-key','0.2.0','SubToolError','Warning:\x20Workspace\x20fallback\x20failed:\x20','dryRun','MORPH_API_URL','Error:\x20','Error\x20running\x20fast\x20context\x20search:\x20','toISOString','Tool\x20','requiresApiKey','timings','\x20disabled\x20via\x20DISABLED_TOOLS','ENABLE_WORKSPACE_MODE','ToolException','Here\x20is\x20the\x20content\x20of\x20files:\x0a','argv','Morph\x20Edit\x20Preview','resolve','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','list_directory\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','stack','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Morph\x20FastApply\x20failed\x20without\x20error\x20message','push','code','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','unknown\x20error','trim','utf-8','BinaryFile','filter','\x0aOptions:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','.cursor','41594OHlmxT','Failed\x20to\x20read\x20file:\x20','branch',',\x20removed\x20','708FBQcRO','1412872XonWEo','6xrCGKy','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.','GitHub\x20search\x20failed:\x20','WarpGrepError','Warning:\x20','now','changes','source','cwd','pyproject.toml','getClientCapabilities','name','completed','.vscode','.\x20Path:\x20','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','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','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','object','files','.\x20Changes:\x20','payload','search_string','github_codebase_search','ENOENT','etimedout','morph-warp-grep-v1-1111v0','terminationReason','go.mod','content','❌\x20Morph\x20Edit\x20Failed:\x20','64660kPJooi','Applied','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Created\x20File','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','env','grep\x20\x27','Rules:\x0a','Parent\x20directory\x20does\x20not\x20exist:\x20','has','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','realpath','inputSchema','length','\x20error(s)','-\x20Read\x20file\x20`','.git','readFile','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','optional','success','startsWith','includes','https://morphllm.com/api/error-report','metadata','some','log','join','\x20chars)','Invalid\x20arguments:\x20','\x22.\x20Known\x20tools:\x20','ReadError','\x20as\x20allowed\x20directory','node_modules','815992VtZEGk','read','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','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.','SymlinkError','toLowerCase','substring','sk-','linesRemoved','FileNotFound','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','PathError','MORPH_API_KEY','dirname','role','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','For\x20deletions:\x0a','errors','336834MmCYPc','number','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','array','RipgrepError','mcp-filesystem','tsconfig.json','path','104iqUCWo','unknown','owner_repo','1900025ZWZLpd','boolean','\x20\x20morph-mcp','data','timed\x20out','435441AJpsex','isArray','instruction','morph-mcp','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','floor','added\x20','sep','runWarpGrep_call','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','grep','map','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Max\x20results\x20to\x20return','morph-v3-fast','RipgrepNotAvailable','\x0aExamples:','listRoots','File\x20read\x20error:','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','repo_path','stringify','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x0a</file>','2189fAFuCw','constructor','<file\x20path=\x22','Disabled\x20tools:\x20','isDirectory','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','basename','../package.json','text','Specific\x20commit\x20hash\x20to\x20search','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Cargo.toml','TimeoutError','messages','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','timeout','[github_codebase_search]\x20Failed\x20in\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.','exit','@morphllm/morphmcp\x20'];a0_0x2eb0=function(){return _0x1dd007;};return a0_0x2eb0();}await Promise['all'](args[a0_0x24f4fc(0x14c)](async _0x336f10=>{const _0x38b3c5=a0_0x24f4fc;try{const _0x3eea9a=await a0_0x2fab1f[_0x38b3c5(0x1a1)](expandHome(_0x336f10));!_0x3eea9a[_0x38b3c5(0x15f)]()&&(logMcpStderr('Error:\x20'+_0x336f10+_0x38b3c5(0x179)),process['exit'](0x1));}catch(_0x264620){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x336f10+':',_0x264620),process[_0x38b3c5(0x16d)](0x1);}}));async function validatePath(_0x36e94d){const _0x5583db=a0_0x24f4fc,_0x2fe265=expandHome(_0x36e94d),_0x170389=a0_0x1856a9['resolve'](_0x2fe265);try{const _0x500b2b=await a0_0x2fab1f[_0x5583db(0x204)](_0x170389);return _0x500b2b;}catch(_0x58fdd5){if(_0x58fdd5[_0x5583db(0x1ca)]===_0x5583db(0x1f2)){const _0x4dd629=a0_0x1856a9[_0x5583db(0x12c)](_0x170389);try{const _0x22cf59=await a0_0x2fab1f['realpath'](_0x4dd629);return a0_0x1856a9[_0x5583db(0x118)](_0x22cf59,a0_0x1856a9[_0x5583db(0x161)](_0x170389));}catch{throw new Error(_0x5583db(0x201)+_0x4dd629);}}throw _0x58fdd5;}}const MorphEditFileArgsSchema=z[a0_0x24f4fc(0x1ec)]({'path':z[a0_0x24f4fc(0x1ae)](),'code_edit':z[a0_0x24f4fc(0x1ae)]()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x14e)),'instruction':z[a0_0x24f4fc(0x1ae)]()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x17e)),'dryRun':z[a0_0x24f4fc(0x13d)]()['default'](![])[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x173))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x24f4fc(0x16c),WarpGrepArgsSchema=z[a0_0x24f4fc(0x1ec)]({'search_string':z[a0_0x24f4fc(0x1ae)]()[a0_0x24f4fc(0x1a4)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()['describe'](a0_0x24f4fc(0x1ea)),'search_type':z[a0_0x24f4fc(0x197)]([a0_0x24f4fc(0x18b),'node_modules'])[a0_0x24f4fc(0x20e)]()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x14d))}),WarpGrepGitHubArgsSchema=z[a0_0x24f4fc(0x1ec)]({'search_string':z[a0_0x24f4fc(0x1ae)]()[a0_0x24f4fc(0x1a4)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x1db)),'owner_repo':z[a0_0x24f4fc(0x1ae)]()[a0_0x24f4fc(0x20e)]()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x158)),'branch':z[a0_0x24f4fc(0x1ae)]()[a0_0x24f4fc(0x20e)]()[a0_0x24f4fc(0x1a4)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x24f4fc(0x1ec)]({'query':z[a0_0x24f4fc(0x1ae)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x1a3)),'branch':z['string']()['optional']()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x1fb)),'commitHash':z['string']()[a0_0x24f4fc(0x20e)]()[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x164)),'targetDirectories':z[a0_0x24f4fc(0x134)](z[a0_0x24f4fc(0x1ae)]())[a0_0x24f4fc(0x18b)]([])[a0_0x24f4fc(0x1a4)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x24f4fc(0x132)]()['optional']()[a0_0x24f4fc(0x18b)](0xa)[a0_0x24f4fc(0x1a4)](a0_0x24f4fc(0x14f))}),server=new Server({'name':a0_0x24f4fc(0x144),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x24f4fc(0x185)](ListToolsRequestSchema,async()=>{const _0x7ebc7d=a0_0x24f4fc,_0x2a2fa5=[{'name':'edit_file','description':_0x7ebc7d(0x175)+_0x7ebc7d(0x18d)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x7ebc7d(0x1eb)+_0x7ebc7d(0x170)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x7ebc7d(0x12e)+_0x7ebc7d(0x1cb)+_0x7ebc7d(0x1c2)+_0x7ebc7d(0x1e9)+_0x7ebc7d(0x145)+_0x7ebc7d(0x12f)+_0x7ebc7d(0x1d2)+_0x7ebc7d(0x1a2)+_0x7ebc7d(0x200)+_0x7ebc7d(0x129)+_0x7ebc7d(0x14a)+_0x7ebc7d(0x133)+_0x7ebc7d(0x172)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x7ebc7d(0x1fd),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x7ebc7d(0x1aa),'description':_0x7ebc7d(0x177)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x7ebc7d(0x20d)+_0x7ebc7d(0x169)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x2122af=_0x2a2fa5[_0x7ebc7d(0x1d0)](_0x227830=>{const _0x62147d=_0x7ebc7d;if(DISABLED_TOOLS[_0x62147d(0x202)](_0x227830[_0x62147d(0x1e5)]))return console[_0x62147d(0x17b)](_0x62147d(0x1b8)+_0x227830['name']+_0x62147d(0x1bb)),![];if('requiresApiKey'in _0x227830&&_0x227830[_0x62147d(0x1b9)]&&!MORPH_API_KEY)return logMcpStderr(_0x62147d(0x1de)+_0x227830['name']+_0x62147d(0x159)),![];return!![];});return{'tools':_0x2122af[_0x7ebc7d(0x14c)](_0x89e957=>({'name':_0x89e957[_0x7ebc7d(0x1e5)],'description':_0x89e957['description'],'inputSchema':_0x89e957[_0x7ebc7d(0x205)]}))};}),server[a0_0x24f4fc(0x185)](CallToolRequestSchema,async _0x4e7bab=>{const _0xf46622=a0_0x24f4fc,{name:_0x19350a,arguments:_0x213eae}=_0x4e7bab[_0xf46622(0x18f)];try{if(DISABLED_TOOLS['has'](_0x19350a))throw new Error('Tool\x20\x22'+_0x19350a+_0xf46622(0x195));switch(_0x19350a){case'edit_file':{const _0x3d6a49=MorphEditFileArgsSchema[_0xf46622(0x180)](_0x213eae);if(!_0x3d6a49[_0xf46622(0x20f)])throw new Error(_0xf46622(0x155)+_0x3d6a49[_0xf46622(0x17b)]);const _0x43a72b=await validatePath(_0x3d6a49['data']['path']);let _0x2ced4f=null,_0x10a9fd=!![],_0x132999=null;try{_0x2ced4f=await a0_0x2fab1f[_0xf46622(0x20a)](_0x43a72b,_0xf46622(0x1ce));}catch(_0x2a8dc3){const _0x5dbc53=_0x2a8dc3[_0xf46622(0x1ca)];_0x5dbc53===_0xf46622(0x1f2)?(_0x10a9fd=![],_0x2ced4f=''):(_0x132999=_0xf46622(0x1d5)+(_0x5dbc53||_0xf46622(0x13a))+_0xf46622(0x17f)+(_0x2a8dc3 instanceof Error?_0x2a8dc3[_0xf46622(0x176)]:String(_0x2a8dc3)),logMcpStderr(_0xf46622(0x1de)+_0x132999));}let _0x12fdcb;try{const _0x37bdbd=MORPH_API_KEY;if(!_0x37bdbd)throw new Error(_0xf46622(0x183));const _0x16fd9c=a0_0x1856a9[_0xf46622(0x12c)](_0x43a72b),_0x7ef1fb=a0_0x1856a9['basename'](_0x43a72b),_0xe59739=await executeEditFile({'target_filepath':_0x7ef1fb,'code_edit':_0x3d6a49['data']['code_edit'],'instructions':_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x143)]},{'morphApiKey':_0x37bdbd,'morphApiUrl':MORPH_API_URL,'baseDir':_0x16fd9c,'autoWrite':!_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x1b3)],'generateUdiff':![],'debug':![]});_0x12fdcb=_0xe59739[_0xf46622(0x192)];if(!_0xe59739[_0xf46622(0x20f)])throw new Error(_0xe59739[_0xf46622(0x17b)]||_0xf46622(0x1c8));const _0xb01492=_0xe59739[_0xf46622(0x1e0)],_0x48a915=_0xf46622(0x147)+_0xb01492[_0xf46622(0x171)]+_0xf46622(0x1d7)+_0xb01492[_0xf46622(0x127)]+_0xf46622(0x187)+_0xb01492[_0xf46622(0x1a7)];if(_0x3d6a49['data'][_0xf46622(0x1b3)])return{'content':[{'type':_0xf46622(0x163),'text':_0xf46622(0x1c0)+(_0x10a9fd?'':_0xf46622(0x174))+':\x20'+_0x3d6a49[_0xf46622(0x13f)]['instruction']+_0xf46622(0x1ee)+_0x48a915+_0xf46622(0x1e8)+_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x138)]+'.'}]};return{'content':[{'type':_0xf46622(0x163),'text':'Morph\x20Edit\x20'+(_0x10a9fd?_0xf46622(0x1fa):_0xf46622(0x1fc))+':\x20'+_0x3d6a49['data'][_0xf46622(0x143)]+'.\x20Changes:\x20'+_0x48a915+_0xf46622(0x1e8)+_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x138)]+'.'}]};}catch(_0x23d0a7){const _0x34e5ea=_0x23d0a7 instanceof Error?_0x23d0a7[_0xf46622(0x176)]:String(_0x23d0a7);return reportMorphError({'error_message':_0x34e5ea,'error_type':_0x23d0a7 instanceof Error?_0x23d0a7[_0xf46622(0x15c)][_0xf46622(0x1e5)]:'UnknownError','context':{'tool':_0xf46622(0x189),'completion_id':_0x12fdcb,'file_path':_0x3d6a49['data'][_0xf46622(0x138)],'validated_path':_0x43a72b,'instruction':_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x143)],'model':_0xf46622(0x150),'dry_run':_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x1b3)],'file_exists':_0x10a9fd,'file_read_error':_0x132999,'file_readable':_0x2ced4f!==null,'request_content':{'path':_0x3d6a49[_0xf46622(0x13f)]['path'],'code_edit':_0x3d6a49[_0xf46622(0x13f)]['code_edit'],'instruction':_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x143)],'original_code':_0x2ced4f!==null?_0x2ced4f[_0xf46622(0x206)]>0xc350?_0x2ced4f[_0xf46622(0x125)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x2ced4f[_0xf46622(0x206)]+_0xf46622(0x119):_0x2ced4f:'[could\x20not\x20read\x20file:\x20'+(_0x132999||_0xf46622(0x1cc))+']','original_code_length':_0x2ced4f?.['length']??0x0,'model':'morph-v3-fast','dry_run':_0x3d6a49[_0xf46622(0x13f)][_0xf46622(0x1b3)]}},'stack_trace':_0x23d0a7 instanceof Error?_0x23d0a7[_0xf46622(0x1c5)]:undefined,'source':_0xf46622(0x136)})['catch'](()=>{}),{'content':[{'type':_0xf46622(0x163),'text':_0xf46622(0x1f8)+_0x34e5ea}],'isError':!![]};}}case _0xf46622(0x1aa):{const _0x388d6a=WarpGrepArgsSchema['safeParse'](_0x213eae);if(!_0x388d6a[_0xf46622(0x20f)])return{'content':[{'type':_0xf46622(0x163),'text':_0xf46622(0x11a)+_0x388d6a[_0xf46622(0x17b)]}],'isError':!![]};const _0x440d6f=_0x1ee3f8=>{const _0x2069cf=_0xf46622,_0x13c288=[];for(const _0x997fc6 of _0x1ee3f8||[]){const _0x5cf31c=_0x997fc6[_0x2069cf(0x12d)],_0x88e708=_0x997fc6[_0x2069cf(0x1f7)];if(_0x5cf31c==='assistant'&&_0x88e708){const _0x4454ed=_0x88e708['split']('\x0a')[_0x2069cf(0x1d0)](_0x23a451=>_0x23a451[_0x2069cf(0x1cd)]());for(const _0x22e7ee of _0x4454ed){const _0x45252f=_0x22e7ee[_0x2069cf(0x182)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x45252f){_0x13c288['push'](_0x2069cf(0x1ff)+_0x45252f[0x1]+'\x27\x20'+_0x45252f[0x2]);continue;}const _0x284d09=_0x22e7ee[_0x2069cf(0x182)](/^read\s+(.+)$/);if(_0x284d09){_0x13c288[_0x2069cf(0x1c9)]('read\x20'+_0x284d09[0x1]);continue;}const _0xe2e094=_0x22e7ee[_0x2069cf(0x182)](/^list_directory\s+(.+)$/);if(_0xe2e094){_0x13c288[_0x2069cf(0x1c9)](_0x2069cf(0x1c3)+_0xe2e094[0x1]);continue;}}}}return _0x13c288;},_0x135398=_0x4b5759=>{const _0xa380c3=_0xf46622,_0x2ed745=[];if(!_0x4b5759||!Array[_0xa380c3(0x142)](_0x4b5759))return _0x2ed745;const _0x1d49df=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0xa380c3(0x128),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0xa380c3(0x12a),'tool':_0xa380c3(0x120)},{'pattern':/\[READ ERROR\]/,'error_type':_0xa380c3(0x11c),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0xa380c3(0x1cf),'tool':_0xa380c3(0x120)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0xa380c3(0x135),'tool':_0xa380c3(0x14b)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0xa380c3(0x151),'tool':_0xa380c3(0x14b)},{'pattern':/\[BINARY FILE\]/,'error_type':_0xa380c3(0x1cf),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0xa380c3(0x123),'tool':_0xa380c3(0x120)},{'pattern':/not a text file/,'error_type':_0xa380c3(0x1cf),'tool':_0xa380c3(0x120)},{'pattern':/symbolic link/,'error_type':_0xa380c3(0x123),'tool':_0xa380c3(0x120)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':'read'},{'pattern':/status="error"/,'error_type':_0xa380c3(0x1bd),'tool':'unknown'}];let _0x5d500d=0x0;for(const _0x31d07b of _0x4b5759){if(_0x31d07b[_0xa380c3(0x12d)]===_0xa380c3(0x19a)){_0x5d500d++;const _0x494ace=_0x31d07b[_0xa380c3(0x1f7)];if(!_0x494ace||typeof _0x494ace!==_0xa380c3(0x1ae))continue;for(const {pattern:_0x3f5dff,error_type:_0x32e488,tool:_0x408d78}of _0x1d49df){const _0x515ff8=_0x494ace[_0xa380c3(0x182)](new RegExp(_0x3f5dff[_0xa380c3(0x1e1)],'g'));if(_0x515ff8)for(const _0x3bd6f1 of _0x515ff8){const _0x12c5d3=_0x494ace['indexOf'](_0x3bd6f1),_0x5f4247=_0x494ace[_0xa380c3(0x125)](_0x12c5d3,Math['min'](_0x12c5d3+0xc8,_0x494ace['length']));_0x2ed745[_0xa380c3(0x1c9)]({'tool':_0x408d78,'error_type':_0x32e488,'error_message':_0x5f4247[_0xa380c3(0x19e)]('\x0a')[0x0],'turn':_0x5d500d});}}}}return _0x2ed745;};try{const _0x2e6ed9=a0_0x1856a9['resolve'](_0x388d6a[_0xf46622(0x13f)]['repo_path']),_0x2cbb03=_0x388d6a[_0xf46622(0x13f)]['search_type'],_0x5c6212=_0x2cbb03===_0xf46622(0x11e)?{'allowNames':[_0xf46622(0x11e)]}:undefined,_0x28e08a=new LocalRipgrepProvider(_0x2e6ed9,undefined,_0x5c6212),_0x30ebec=await runWarpGrep({'searchTerm':_0x388d6a[_0xf46622(0x13f)]['search_string'],'repoRoot':_0x2e6ed9,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x28e08a,'search_type':_0x2cbb03}),_0x18d41a=_0x135398(_0x30ebec[_0xf46622(0x168)]);_0x18d41a[_0xf46622(0x206)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x18d41a[_0xf46622(0x206)]+_0xf46622(0x207),'error_type':_0xf46622(0x1b1),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x156)],'query':_0x388d6a['data'][_0xf46622(0x1f0)],'model':_0xf46622(0x1f4),'termination_reason':_0x30ebec[_0xf46622(0x1f5)],'sub_tool_errors':_0x18d41a,'timings':_0x30ebec['timings'],'tool_calls':_0x440d6f(_0x30ebec[_0xf46622(0x168)]),'messages':_0x30ebec[_0xf46622(0x168)]?.[_0xf46622(0x14c)](_0x4173b3=>({'role':_0x4173b3[_0xf46622(0x12d)],'content':_0x4173b3[_0xf46622(0x1f7)]}))},'source':_0xf46622(0x136)})[_0xf46622(0x193)](()=>{});let _0x51e08c='';if(_0x30ebec['terminationReason']===_0xf46622(0x1e6)&&_0x30ebec[_0xf46622(0x178)]?.[_0xf46622(0x213)]?.['files']){const _0x2848a1=_0x30ebec[_0xf46622(0x178)][_0xf46622(0x213)][_0xf46622(0x1ed)];if(_0x2848a1[_0xf46622(0x206)]===0x0)return _0x51e08c=_0x30ebec['finish'][_0xf46622(0x1ef)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0xf46622(0x163),'text':_0x51e08c}]};const _0x3058cd=[],_0x128659=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x331f48 of _0x30ebec[_0xf46622(0x168)]){const _0x130e69=_0x331f48['role'],_0x45ef21=_0x331f48[_0xf46622(0x1f7)];if(_0x130e69==='assistant'&&_0x45ef21){const _0x21362a=_0x45ef21[_0xf46622(0x19e)]('\x0a')['filter'](_0x542a1a=>_0x542a1a[_0xf46622(0x1cd)]());for(const _0x47c52c of _0x21362a){const _0xb848a7=_0x47c52c['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0xb848a7){_0x128659[_0xf46622(0x1c9)]('-\x20Grepped\x20\x27'+_0xb848a7[0x1]+'\x27\x20in\x20`'+_0xb848a7[0x2]+'`');continue;}const _0x58d988=_0x47c52c[_0xf46622(0x182)](/^read\s+(.+)$/);if(_0x58d988){_0x128659[_0xf46622(0x1c9)](_0xf46622(0x208)+_0x58d988[0x1]+'`');continue;}const _0x3faa9c=_0x47c52c[_0xf46622(0x182)](/^list_directory\s+(.+)$/);if(_0x3faa9c){_0x128659['push']('-\x20Listed\x20directory\x20`'+_0x3faa9c[0x1]+'`');continue;}}}}_0x3058cd[_0xf46622(0x1c9)](_0x128659[_0xf46622(0x118)]('\x0a'));const _0x72dcbf=['','Relevant\x20context\x20found:'];for(const _0x489a82 of _0x2848a1){if(_0x489a82[_0xf46622(0x18e)]==='*')_0x72dcbf['push']('-\x20'+_0x489a82[_0xf46622(0x138)]+':*');else{if(Array[_0xf46622(0x142)](_0x489a82['lines'])){const _0x2f0395=_0x489a82[_0xf46622(0x18e)][_0xf46622(0x14c)](([_0x1543c5,_0x7ca556])=>{if(_0x1543c5===_0x7ca556)return''+_0x1543c5;return _0x1543c5+'-'+_0x7ca556;});_0x72dcbf['push']('-\x20'+_0x489a82[_0xf46622(0x138)]+':'+_0x2f0395[_0xf46622(0x118)](','));}else _0x72dcbf['push']('-\x20'+_0x489a82[_0xf46622(0x138)]+':*');}}_0x72dcbf[_0xf46622(0x1c9)](''),_0x3058cd['push'](_0x72dcbf[_0xf46622(0x118)]('\x0a')),_0x3058cd[_0xf46622(0x1c9)](_0xf46622(0x1be));const _0x2c5cec=[];for(const _0x42e125 of _0x2848a1){let _0x2a1039=a0_0x1856a9[_0xf46622(0x1c1)](_0x388d6a['data']['repo_path'],_0x42e125[_0xf46622(0x138)]),_0x5575aa=null,_0x3c027d=null;try{_0x5575aa=await a0_0x2fab1f[_0xf46622(0x20a)](_0x2a1039,{'encoding':_0xf46622(0x1ce)});}catch(_0x7db693){const _0x4ae889=fixPathRepetition(_0x2a1039);if(_0x4ae889)try{_0x5575aa=await a0_0x2fab1f[_0xf46622(0x20a)](_0x4ae889,{'encoding':_0xf46622(0x1ce)}),_0x2a1039=_0x4ae889;}catch{_0x3c027d=_0x7db693 instanceof Error?_0x7db693:new Error(String(_0x7db693));}else _0x3c027d=_0x7db693 instanceof Error?_0x7db693:new Error(String(_0x7db693));}if(_0x5575aa!==null){const _0x4ad501=_0x5575aa[_0xf46622(0x19e)](/\r?\n/),_0x3aa3db=[_0xf46622(0x15d)+_0x42e125[_0xf46622(0x138)]+'\x22>'];if(_0x42e125[_0xf46622(0x18e)]==='*'||!Array[_0xf46622(0x142)](_0x42e125[_0xf46622(0x18e)]))for(let _0x4001f6=0x1;_0x4001f6<=_0x4ad501['length'];_0x4001f6++){const _0x2984fe=_0x4ad501[_0x4001f6-0x1];_0x3aa3db[_0xf46622(0x1c9)](_0x4001f6+'|\x20'+_0x2984fe);}else for(const [_0x4d4ca4,_0x39822f]of _0x42e125['lines']){_0x3aa3db[_0xf46622(0x206)]>0x1&&_0x3aa3db['push']('');for(let _0x5e9fcb=_0x4d4ca4;_0x5e9fcb<=_0x39822f&&_0x5e9fcb<=_0x4ad501[_0xf46622(0x206)];_0x5e9fcb++){const _0x4815ee=_0x4ad501[_0x5e9fcb-0x1];_0x3aa3db[_0xf46622(0x1c9)](_0x5e9fcb+'|\x20'+_0x4815ee);}}_0x3aa3db[_0xf46622(0x1c9)]('</file>'),_0x2c5cec[_0xf46622(0x1c9)](_0x3aa3db['join']('\x0a'));}else _0x2c5cec[_0xf46622(0x1c9)](_0xf46622(0x15d)+_0x42e125['path']+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x3c027d?.[_0xf46622(0x176)]||'Unknown\x20error')+_0xf46622(0x15a));}_0x3058cd[_0xf46622(0x1c9)](_0x2c5cec[_0xf46622(0x118)]('\x0a\x0a')),_0x51e08c=_0x3058cd[_0xf46622(0x118)]('\x0a');const _0x2be346=_0x30ebec[_0xf46622(0x130)]?.[_0xf46622(0x1d0)](_0x42aa14=>_0x42aa14[_0xf46622(0x176)]?.[_0xf46622(0x210)](_0xf46622(0x154)))||[];if(_0x2be346[_0xf46622(0x206)]>0x0){const _0x4cf538=_0x2be346[_0xf46622(0x14c)](_0x4e2744=>_0x4e2744[_0xf46622(0x176)])[_0xf46622(0x118)](';\x20');reportMorphError({'error_message':_0x4cf538,'error_type':_0xf46622(0x1a6),'context':{'tool':_0xf46622(0x1aa),'repo_path':_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x156)],'query':_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x1f0)],'model':_0xf46622(0x1f4),'termination_reason':_0xf46622(0x1ad),'error_count':_0x2be346[_0xf46622(0x206)],'is_timeout':![],'timings':_0x30ebec[_0xf46622(0x1ba)],'files_attempted':_0x2848a1[_0xf46622(0x14c)](_0x172fb1=>({'path':_0x172fb1[_0xf46622(0x138)],'lines':_0x172fb1[_0xf46622(0x18e)]})),'tool_calls':_0x440d6f(_0x30ebec[_0xf46622(0x168)]),'messages':_0x30ebec['messages']?.[_0xf46622(0x14c)](_0x20efbd=>({'role':_0x20efbd[_0xf46622(0x12d)],'content':_0x20efbd[_0xf46622(0x1f7)]})),'request_content':{'query':_0x388d6a[_0xf46622(0x13f)]['search_string'],'repo_path':_0x388d6a['data']['repo_path'],'repoRoot':a0_0x1856a9[_0xf46622(0x1c1)](_0x388d6a[_0xf46622(0x13f)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'source':_0xf46622(0x136)})[_0xf46622(0x193)](()=>{});}}else{if(_0x30ebec[_0xf46622(0x1f5)]===_0xf46622(0x1a5)&&_0x30ebec[_0xf46622(0x130)]['length']>0x0){const _0xfb7bac=_0x30ebec[_0xf46622(0x130)][_0xf46622(0x14c)](_0x351395=>_0x351395[_0xf46622(0x176)])[_0xf46622(0x118)](';\x20');_0x51e08c=_0xf46622(0x1b5)+_0xfb7bac;const _0x18ece7=_0xfb7bac[_0xf46622(0x124)]()[_0xf46622(0x211)](_0xf46622(0x16a))||_0xfb7bac['toLowerCase']()[_0xf46622(0x211)](_0xf46622(0x140))||_0xfb7bac[_0xf46622(0x124)]()[_0xf46622(0x211)]('etimedout'),_0x44637a=_0x30ebec[_0xf46622(0x178)]?.[_0xf46622(0x213)]?.[_0xf46622(0x1ed)],_0x80cf52=_0x30ebec['errors'][0x0];reportMorphError({'error_message':_0xfb7bac,'error_type':_0x18ece7?_0xf46622(0x167):_0x80cf52?.[_0xf46622(0x15c)]?.['name']||_0xf46622(0x1dd),'context':{'tool':_0xf46622(0x1aa),'repo_path':_0x388d6a[_0xf46622(0x13f)]['repo_path'],'query':_0x388d6a[_0xf46622(0x13f)]['search_string'],'model':_0xf46622(0x1f4),'termination_reason':_0x30ebec[_0xf46622(0x1f5)],'error_count':_0x30ebec[_0xf46622(0x130)][_0xf46622(0x206)],'is_timeout':_0x18ece7,'timings':_0x30ebec['timings'],'files_attempted':_0x44637a?.['map'](_0x20fe2c=>({'path':_0x20fe2c['path'],'lines':_0x20fe2c['lines']})),'tool_calls':_0x440d6f(_0x30ebec[_0xf46622(0x168)]),'messages':_0x30ebec[_0xf46622(0x168)]?.[_0xf46622(0x14c)](_0x8325f3=>({'role':_0x8325f3[_0xf46622(0x12d)],'content':_0x8325f3[_0xf46622(0x1f7)]})),'request_content':{'query':_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x1f0)],'repo_path':_0x388d6a[_0xf46622(0x13f)]['repo_path'],'repoRoot':a0_0x1856a9[_0xf46622(0x1c1)](_0x388d6a['data'][_0xf46622(0x156)]),'model':_0xf46622(0x1f4)}},'stack_trace':_0x80cf52?.[_0xf46622(0x1c5)]||undefined,'source':_0xf46622(0x136)})['catch'](()=>{});}else _0x51e08c=_0xf46622(0x1c6);}return{'content':[{'type':_0xf46622(0x163),'text':_0x51e08c}]};}catch(_0x4a8079){const _0x25e40e=_0x4a8079 instanceof Error?_0x4a8079['message']:String(_0x4a8079),_0x583056=_0x25e40e[_0xf46622(0x124)]()['includes'](_0xf46622(0x16a))||_0x25e40e[_0xf46622(0x124)]()[_0xf46622(0x211)](_0xf46622(0x140))||_0x25e40e[_0xf46622(0x124)]()[_0xf46622(0x211)](_0xf46622(0x1f3))||_0x4a8079 instanceof Error&&_0x4a8079[_0xf46622(0x1e5)]===_0xf46622(0x167);return reportMorphError({'error_message':_0x25e40e,'error_type':_0x583056?_0xf46622(0x167):_0x4a8079 instanceof Error?_0x4a8079[_0xf46622(0x15c)][_0xf46622(0x1e5)]:_0xf46622(0x17d),'context':{'tool':_0xf46622(0x1aa),'repo_path':_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x156)],'query':_0x388d6a['data'][_0xf46622(0x1f0)],'model':'morph-warp-grep-v1-1111v0','is_timeout':_0x583056,'exception_phase':_0xf46622(0x149),'request_content':{'query':_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x1f0)],'repo_path':_0x388d6a['data'][_0xf46622(0x156)],'repoRoot':a0_0x1856a9[_0xf46622(0x1c1)](_0x388d6a[_0xf46622(0x13f)][_0xf46622(0x156)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x4a8079 instanceof Error?_0x4a8079[_0xf46622(0x1c5)]:undefined,'source':_0xf46622(0x136)})['catch'](()=>{}),{'content':[{'type':_0xf46622(0x163),'text':_0xf46622(0x1b6)+_0x25e40e}],'isError':![]};}}case'github_codebase_search':{const _0x5b8d94=WarpGrepGitHubArgsSchema[_0xf46622(0x180)](_0x213eae);if(!_0x5b8d94['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x5b8d94[_0xf46622(0x17b)]}],'isError':!![]};const _0x55c6e6=_0x5b8d94['data']['github_url']||_0x5b8d94['data'][_0xf46622(0x13b)];if(!_0x55c6e6)return{'content':[{'type':'text','text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x42aa94=MORPH_API_KEY;if(!_0x42aa94)throw new Error(_0xf46622(0x183));const _0x59db8a=Date[_0xf46622(0x1df)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x55c6e6+'\x20for:\x20\x22'+_0x5b8d94[_0xf46622(0x13f)]['search_string']+'\x22');try{const _0x2aaec4=new WarpGrepClient({'morphApiKey':_0x42aa94,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x55a47a=await _0x2aaec4['searchGitHub']({'searchTerm':_0x5b8d94[_0xf46622(0x13f)][_0xf46622(0x1f0)],'github':_0x55c6e6,'branch':_0x5b8d94['data']['branch']}),_0x49cd8d=Date['now']()-_0x59db8a;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x49cd8d+'ms.\x20Success:\x20'+_0x55a47a['success']);const _0x317388=formatResult(_0x55a47a);return{'content':[{'type':_0xf46622(0x163),'text':_0x317388}]};}catch(_0x3cbd96){const _0xaf962c=Date[_0xf46622(0x1df)]()-_0x59db8a,_0x36c577=_0x3cbd96 instanceof Error?_0x3cbd96[_0xf46622(0x176)]:String(_0x3cbd96);return logMcpStderr(_0xf46622(0x16b)+_0xaf962c+'ms:',_0x36c577),reportMorphError({'error_message':_0x36c577,'error_type':_0x3cbd96 instanceof Error?_0x3cbd96[_0xf46622(0x15c)]['name']:_0xf46622(0x17d),'context':{'tool':_0xf46622(0x1f1),'github_url':_0x55c6e6,'search_string':_0x5b8d94['data'][_0xf46622(0x1f0)],'branch':_0x5b8d94[_0xf46622(0x13f)][_0xf46622(0x1d6)]},'stack_trace':_0x3cbd96 instanceof Error?_0x3cbd96[_0xf46622(0x1c5)]:undefined,'source':_0xf46622(0x136),'tool':_0xf46622(0x1f1),'latency_ms':_0xaf962c})[_0xf46622(0x193)](()=>{}),{'content':[{'type':_0xf46622(0x163),'text':_0xf46622(0x1dc)+_0x36c577}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x19350a);}}catch(_0x52068b){const _0x33f900=_0x52068b instanceof Error?_0x52068b['message']:String(_0x52068b);return reportMorphError({'error_message':_0x33f900,'error_type':_0x52068b instanceof Error?_0x52068b[_0xf46622(0x15c)]['name']:_0xf46622(0x17d),'context':{'tool':_0x19350a,'arguments':_0x213eae?JSON[_0xf46622(0x157)](_0x213eae)[_0xf46622(0x125)](0x0,0x1f4):undefined,'mcp_server_version':_0xf46622(0x1b0)},'stack_trace':_0x52068b instanceof Error?_0x52068b[_0xf46622(0x1c5)]:undefined,'source':_0xf46622(0x136)})['catch'](()=>{}),{'content':[{'type':'text','text':_0xf46622(0x1b5)+_0x33f900}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4887d9){const _0x341f1f=a0_0x24f4fc,_0xdadbd2=await getValidRootDirectories(_0x4887d9);if(_0xdadbd2['length']>0x0)allowedDirectories=[..._0xdadbd2],logMcpStderr(_0x341f1f(0x196)+_0xdadbd2[_0x341f1f(0x206)]+'\x20valid\x20directories');else{logMcpStderr(_0x341f1f(0x19c));if(ENABLE_WORKSPACE_MODE)try{const _0x330ae0=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x330ae0&&(allowedDirectories=[_0x330ae0],logMcpStderr(_0x341f1f(0x188)+_0x330ae0));}catch(_0x455f85){logMcpStderr(_0x341f1f(0x1b2)+_0x455f85);}}}server[a0_0x24f4fc(0x1a8)](RootsListChangedNotificationSchema,async()=>{const _0x4b6ba5=a0_0x24f4fc;try{const _0x45d8b5=await server[_0x4b6ba5(0x153)]();_0x45d8b5&&_0x4b6ba5(0x1a0)in _0x45d8b5&&await updateAllowedDirectoriesFromRoots(_0x45d8b5[_0x4b6ba5(0x1a0)]);}catch(_0x5598bb){logMcpStderr(_0x4b6ba5(0x198),_0x5598bb instanceof Error?_0x5598bb[_0x4b6ba5(0x176)]:String(_0x5598bb));}}),server['oninitialized']=async()=>{const _0x163b15=a0_0x24f4fc,_0x15af19=server[_0x163b15(0x1e4)]();if(_0x15af19?.[_0x163b15(0x1a0)])try{const _0x384326=await server[_0x163b15(0x153)]();_0x384326&&'roots'in _0x384326?await updateAllowedDirectoriesFromRoots(_0x384326['roots']):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x5eed53){logMcpStderr(_0x163b15(0x191),_0x5eed53 instanceof Error?_0x5eed53['message']:String(_0x5eed53));}else{if(allowedDirectories[_0x163b15(0x206)]>0x0)logMcpStderr(_0x163b15(0x165),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x163b15(0x122));}}};function a0_0x1af8(_0x4e4708,_0x1fabdf){_0x4e4708=_0x4e4708-0x118;const _0x2eb029=a0_0x2eb0();let _0x1af8b8=_0x2eb029[_0x4e4708];return _0x1af8b8;}async function runServer(){const _0x19a6d2=a0_0x24f4fc,_0x3c5bdb=new StdioServerTransport();await server[_0x19a6d2(0x18c)](_0x3c5bdb),logMcpStderr(_0x19a6d2(0x1c7)),allowedDirectories[_0x19a6d2(0x206)]===0x0&&logMcpStderr(_0x19a6d2(0x203));}runServer()[a0_0x24f4fc(0x193)](_0x3cf08c=>{const _0x3f2796=a0_0x24f4fc;logMcpStderr(_0x3f2796(0x19d),_0x3cf08c),process['exit'](0x1);});
2
+ const a0_0x3512ec=a0_0x2e5c;(function(_0x3de28b,_0x517f2b){const _0x65b3c=a0_0x2e5c,_0x1db5a5=_0x3de28b();while(!![]){try{const _0x5c59af=parseInt(_0x65b3c(0x241))/0x1+-parseInt(_0x65b3c(0x230))/0x2+-parseInt(_0x65b3c(0x215))/0x3+parseInt(_0x65b3c(0x1ed))/0x4+parseInt(_0x65b3c(0x219))/0x5*(-parseInt(_0x65b3c(0x1d1))/0x6)+-parseInt(_0x65b3c(0x20f))/0x7*(parseInt(_0x65b3c(0x1ea))/0x8)+parseInt(_0x65b3c(0x24e))/0x9;if(_0x5c59af===_0x517f2b)break;else _0x1db5a5['push'](_0x1db5a5['shift']());}catch(_0x1457f6){_0x1db5a5['push'](_0x1db5a5['shift']());}}}(a0_0x3407,0x9b5a1));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x2e5c(_0x344b04,_0x19c3d6){_0x344b04=_0x344b04-0x1a0;const _0x340796=a0_0x3407();let _0x2e5c01=_0x340796[_0x344b04];return _0x2e5c01;}import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x2d6057 from'fs/promises';import a0_0x2702b4 from'path';import a0_0x1417b4 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_0x29e789 from'axios';function fixPathRepetition(_0x588396){const _0x1c99e2=a0_0x2e5c,_0x3b256c=_0x588396[_0x1c99e2(0x1e4)](a0_0x2702b4[_0x1c99e2(0x225)])[_0x1c99e2(0x1d6)](Boolean);if(_0x3b256c[_0x1c99e2(0x1be)]<0x2)return null;for(let _0xc31305=Math[_0x1c99e2(0x1aa)](_0x3b256c[_0x1c99e2(0x1be)]/0x2);_0xc31305>=0x1;_0xc31305--){for(let _0x1fff4e=0x0;_0x1fff4e<=_0x3b256c[_0x1c99e2(0x1be)]-0x2*_0xc31305;_0x1fff4e++){const _0x31c985=_0x3b256c[_0x1c99e2(0x251)](_0x1fff4e,_0x1fff4e+_0xc31305),_0x5156e5=_0x3b256c[_0x1c99e2(0x251)](_0x1fff4e+_0xc31305,_0x1fff4e+0x2*_0xc31305);if(_0x31c985[_0x1c99e2(0x244)]((_0x197f38,_0x5db400)=>_0x197f38===_0x5156e5[_0x5db400])){const _0x6dcf5e=[..._0x3b256c[_0x1c99e2(0x251)](0x0,_0x1fff4e),..._0x3b256c[_0x1c99e2(0x251)](_0x1fff4e+_0xc31305)];return a0_0x2702b4['sep']+_0x6dcf5e[_0x1c99e2(0x2a8)](a0_0x2702b4[_0x1c99e2(0x225)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x5aa119=a0_0x2e5c;try{const _0x543bc9=require(_0x5aa119(0x1ac));return _0x543bc9[_0x5aa119(0x20e)]??_0x5aa119(0x28f);}catch(_0x3bd878){return logMcpStderr(_0x5aa119(0x23d),_0x3bd878),_0x5aa119(0x28f);}}function printHelp(){const _0xbfa1af=a0_0x2e5c;console[_0xbfa1af(0x1b0)](_0xbfa1af(0x295)+getPackageVersion()),console[_0xbfa1af(0x1b0)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0xbfa1af(0x1b0)](_0xbfa1af(0x267)),console[_0xbfa1af(0x1b0)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0xbfa1af(0x1b0)](_0xbfa1af(0x28e)),console[_0xbfa1af(0x1b0)](_0xbfa1af(0x2a9)),console[_0xbfa1af(0x1b0)](_0xbfa1af(0x2aa)),console[_0xbfa1af(0x1b0)](_0xbfa1af(0x203)),console[_0xbfa1af(0x1b0)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0x3512ec(0x251)](0x2),VERSION_FLAGS=new Set([a0_0x3512ec(0x24d),'-v','-V']),HELP_FLAGS=new Set([a0_0x3512ec(0x1e3),'-h']);cliArgs[a0_0x3512ec(0x22a)](_0x21ff35=>VERSION_FLAGS[a0_0x3512ec(0x1bf)](_0x21ff35))&&(console[a0_0x3512ec(0x1b0)]('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x3512ec(0x28c)](0x0));cliArgs[a0_0x3512ec(0x22a)](_0x42b9a3=>HELP_FLAGS[a0_0x3512ec(0x1bf)](_0x42b9a3))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x278123){const _0x55916b=a0_0x3512ec;for(let _0x17984c=0x0;_0x17984c<cliArgs['length'];_0x17984c++){const _0x259fda=cliArgs[_0x17984c];if(_0x259fda['startsWith']('--'+_0x278123+'='))return _0x259fda[_0x55916b(0x251)](('--'+_0x278123+'=')[_0x55916b(0x1be)]);if(_0x259fda==='--'+_0x278123&&_0x17984c+0x1<cliArgs[_0x55916b(0x1be)])return cliArgs[_0x17984c+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x3512ec(0x1be)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x3512ec(0x1bf)](arg)||HELP_FLAGS[a0_0x3512ec(0x1bf)](arg))continue;if(arg[a0_0x3512ec(0x1ec)](a0_0x3512ec(0x2af)))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x3512ec(0x1dd)](arg);}function a0_0x3407(){const _0x47e8c5=['added\x20','normalize','WORKSPACE_ROOT','message','lines','morph-','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','includes','version','35BdFkec','setNotificationHandler','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','basename','PathError','unknown\x20error','368103dICpwB','size','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','catch','2239195PZDzAZ','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','glob\x20\x27','ms.\x20Success:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','homedir','indexOf','code','ms:','code_edit','assistant','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','sep','Error\x20running\x20fast\x20context\x20search:\x20','codebase_search','Fatal\x20error\x20running\x20server:','-\x20Listed\x20directory\x20`','some','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','terminated','Invalid\x20arguments:\x20','source','timings','882986kjpZhM','Failed\x20to\x20request\x20roots\x20from\x20client:','array','Tool\x20\x22','Morph\x20Edit\x20','\x20-\x20','composer.json','requiresApiKey','morph-v3-fast','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x27\x20in\x20`','metadata','data','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','stringify','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','225252nLYwCn','GitHub\x20search\x20failed:\x20','BinaryFile','every','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','path','Morph\x20Edit\x20Preview','tool','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.','stat','pyproject.toml','files','--version','15338700WXPkLW','min','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','slice','.git','branch','utf-8','params','ReadError','timeout','dirname','glob','description','parse','boolean','\x20chars)','object','[github_codebase_search]\x20Done\x20in\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','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','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','success','https://morphllm.com/api/error-report','completed_with_file_errors','\x20for:\x20\x22','\x0aOptions:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','access','Bearer\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','default','MORPH_API_URL','edit_file','application/json','error','repo_path','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','instruction','`\x20in\x20`','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','realpath','File\x20read\x20error:','function','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','MORPH_API_KEY','Workspace\x20mode\x20enabled:\x20Using\x20','setRequestHandler','WarpGrep\x20sub-tool\x20errors:\x20','command','morph-warp-grep-v2.1','terminationReason','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.','sk-','read','all','timed\x20out','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','read\x20','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','node_modules','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','exit','roots','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','unknown','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','dryRun','mcp-filesystem','Failed\x20to\x20read\x20file:\x20','For\x20deletions:\x0a','@morphllm/morphmcp\x20','Repository\x20identifier','.\x20Path:\x20','Warning:\x20','false','linesAdded','name','oninitialized','Here\x20is\x20the\x20content\x20of\x20files:\x0a','.vscode','tsconfig.json','tool_calls','payload','describe','package.json','inputSchema','ToolException','PWD','readFile','join','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','\x0aExamples:','runWarpGrep_call','searchGitHub','role','\x22>\x0aError\x20reading\x20file:\x20','--api-key=','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','listRoots','content','-\x20Grepped\x20\x27','\x20disabled\x20via\x20DISABLED_TOOLS','optional','getClientCapabilities',',\x20removed\x20','github_codebase_search','<file\x20path=\x22','floor','MORPH_WARP_GREP_TIMEOUT','../package.json','isDirectory','Preview\x20changes\x20without\x20applying\x20them.','FileNotFound','log','0.2.0','resolve','completed','changes','RipgrepError','Disabled\x20tools:\x20','finish','errors','stack','DISABLED_TOOLS','Error:\x20','</file>','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','length','has','enum','[could\x20not\x20read\x20file:\x20','UnknownError','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','morph-mcp','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','substring','tool_call_id','Specific\x20commit\x20hash\x20to\x20search','[github_codebase_search]\x20Failed\x20in\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','messages','Tool\x20','list_directory','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','12fJXxcM','isArray','text','ENOENT','toLowerCase','filter','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','ENABLE_WORKSPACE_MODE','search_type','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','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.','push','github_url','Rules:\x0a','\x22.\x20Known\x20tools:\x20','grep_search','Error\x20accessing\x20directory\x20','--help','split','completionId','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','map','now','Max\x20results\x20to\x20return','377632oyYSUg','string','startsWith','1610644YVftiN','warn','grep','safeParse','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','linesModified','.\x20Changes:\x20','\x0a</file>','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','\x20as\x20allowed\x20directory','TimeoutError','SymlinkError','etimedout','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','env','Warning:\x20Workspace\x20fallback\x20failed:\x20','constructor','Morph\x20FastApply\x20failed\x20without\x20error\x20message','search_string','go.mod','\x0a...\x20(truncated,\x20total:\x20','user','\x20\x20morph-mcp','pattern','Branch\x20to\x20search\x20(uses\x20latest\x20commit)'];a0_0x3407=function(){return _0x47e8c5;};return a0_0x3407();}const WORKSPACE_ROOT=process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x208)]||process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x2a6)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x1d9)]!==a0_0x3512ec(0x299),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x27b)],MORPH_API_URL=process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x26d)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x1ab)]?parseInt(process['env']['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x3512ec(0x26e),'codebase_search',a0_0x3512ec(0x1a8)]),DISABLED_TOOLS=process[a0_0x3512ec(0x1fb)][a0_0x3512ec(0x1ba)]?new Set(process[a0_0x3512ec(0x1fb)]['DISABLED_TOOLS'][a0_0x3512ec(0x1e4)](',')[a0_0x3512ec(0x1e7)](_0x49d660=>_0x49d660['trim']())[a0_0x3512ec(0x1d6)](_0x46c63b=>_0x46c63b[a0_0x3512ec(0x1be)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x3512ec(0x216)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console['error'](a0_0x3512ec(0x1a0)+tool+a0_0x3512ec(0x1e0)+[...KNOWN_TOOL_NAMES][a0_0x3512ec(0x2a8)](',\x20'));}console[a0_0x3512ec(0x270)](a0_0x3512ec(0x1b6)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x3512ec(0x283))&&!MORPH_API_KEY[a0_0x3512ec(0x1ec)](a0_0x3512ec(0x20b))&&logMcpStderr(a0_0x3512ec(0x287));async function reportMorphError(_0x4594aa){const _0x36fa28=a0_0x3512ec;try{await a0_0x29e789['post'](_0x36fa28(0x264),{..._0x4594aa,'timestamp':new Date()['toISOString'](),'source':_0x4594aa[_0x36fa28(0x22e)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4594aa['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x36fa28(0x26f),'Authorization':_0x36fa28(0x26a)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x3512ec(0x1f1)),logMcpStderr(a0_0x3512ec(0x275)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x3512ec(0x1bd)),logMcpStderr(a0_0x3512ec(0x1cb)));function normalizePath(_0x344ccb){const _0x115d22=a0_0x3512ec;return a0_0x2702b4[_0x115d22(0x207)](_0x344ccb);}function expandHome(_0x18b1d1){const _0xb3c2c4=a0_0x3512ec;if(_0x18b1d1[_0xb3c2c4(0x1ec)]('~/')||_0x18b1d1==='~')return a0_0x2702b4[_0xb3c2c4(0x2a8)](a0_0x1417b4[_0xb3c2c4(0x21e)](),_0x18b1d1['slice'](0x1));return _0x18b1d1;}let allowedDirectories=await Promise['all'](args[a0_0x3512ec(0x1e7)](async _0xfcf2b=>{const _0x21aeef=a0_0x3512ec,_0x558ac1=expandHome(_0xfcf2b),_0x2a6733=a0_0x2702b4[_0x21aeef(0x1b2)](_0x558ac1);try{const _0x111339=await a0_0x2d6057[_0x21aeef(0x277)](_0x2a6733);return normalizePath(_0x111339);}catch(_0xc8e4a7){return normalizePath(_0x2a6733);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x3512ec(0x1dd)](workspaceDir),logMcpStderr(a0_0x3512ec(0x27c)+workspaceDir+a0_0x3512ec(0x1f6)));}catch(a0_0x3a98b7){logMcpStderr(a0_0x3512ec(0x1d7)+a0_0x3a98b7);}async function detectWorkspaceRoot(_0x15f620){const _0x5058da=a0_0x3512ec;let _0x3754c3=a0_0x2702b4['resolve'](_0x15f620);const _0xbb0c2b=[_0x5058da(0x252),_0x5058da(0x29e),_0x5058da(0x2a3),'Cargo.toml',_0x5058da(0x24b),_0x5058da(0x200),'.cursor',_0x5058da(0x29f),_0x5058da(0x236)];while(_0x3754c3!==a0_0x2702b4[_0x5058da(0x258)](_0x3754c3)){for(const _0x5d227a of _0xbb0c2b){const _0x2920f0=a0_0x2702b4[_0x5058da(0x2a8)](_0x3754c3,_0x5d227a);try{return await a0_0x2d6057[_0x5058da(0x269)](_0x2920f0),normalizePath(_0x3754c3);}catch{}}_0x3754c3=a0_0x2702b4[_0x5058da(0x258)](_0x3754c3);}return normalizePath(_0x15f620);}await Promise[a0_0x3512ec(0x285)](args[a0_0x3512ec(0x1e7)](async _0x588b1c=>{const _0x2b14aa=a0_0x3512ec;try{const _0xfc212f=await a0_0x2d6057[_0x2b14aa(0x24a)](expandHome(_0x588b1c));!_0xfc212f[_0x2b14aa(0x1ad)]()&&(logMcpStderr(_0x2b14aa(0x1bb)+_0x588b1c+'\x20is\x20not\x20a\x20directory'),process[_0x2b14aa(0x28c)](0x1));}catch(_0x1d6c28){logMcpStderr(_0x2b14aa(0x1e2)+_0x588b1c+':',_0x1d6c28),process[_0x2b14aa(0x28c)](0x1);}}));async function validatePath(_0x2ab5a0){const _0x39aa7b=a0_0x3512ec,_0xa1e87b=expandHome(_0x2ab5a0),_0x541e79=a0_0x2702b4[_0x39aa7b(0x1b2)](_0xa1e87b);try{const _0x12243b=await a0_0x2d6057[_0x39aa7b(0x277)](_0x541e79);return _0x12243b;}catch(_0x31ef22){if(_0x31ef22[_0x39aa7b(0x220)]==='ENOENT'){const _0x4abd2a=a0_0x2702b4[_0x39aa7b(0x258)](_0x541e79);try{const _0x22bd0d=await a0_0x2d6057[_0x39aa7b(0x277)](_0x4abd2a);return a0_0x2702b4[_0x39aa7b(0x2a8)](_0x22bd0d,a0_0x2702b4['basename'](_0x541e79));}catch{throw new Error(_0x39aa7b(0x1d0)+_0x4abd2a);}}throw _0x31ef22;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x3512ec(0x1eb)](),'code_edit':z[a0_0x3512ec(0x1eb)]()[a0_0x3512ec(0x2a2)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x3512ec(0x1eb)]()[a0_0x3512ec(0x2a2)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0x3512ec(0x25c)]()['default'](![])[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x1ae))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x3512ec(0x1dc),WarpGrepArgsSchema=z[a0_0x3512ec(0x25e)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x28b)),'search_type':z[a0_0x3512ec(0x1c0)]([a0_0x3512ec(0x26c),'node_modules'])[a0_0x3512ec(0x1a5)]()[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x289))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x3512ec(0x1eb)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x3512ec(0x1a5)]()['describe'](a0_0x3512ec(0x249)),'owner_repo':z[a0_0x3512ec(0x1eb)]()[a0_0x3512ec(0x1a5)]()[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x21d)),'branch':z['string']()['optional']()['describe'](a0_0x3512ec(0x26b))}),CodebaseSearchArgsSchema=z[a0_0x3512ec(0x25e)]({'query':z['string']()[a0_0x3512ec(0x2a2)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x3512ec(0x1eb)]()[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x296)),'branch':z['string']()[a0_0x3512ec(0x1a5)]()['describe'](a0_0x3512ec(0x205)),'commitHash':z['string']()['optional']()[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x1c9)),'targetDirectories':z[a0_0x3512ec(0x232)](z['string']())[a0_0x3512ec(0x26c)]([])['describe'](a0_0x3512ec(0x240)),'limit':z['number']()[a0_0x3512ec(0x1a5)]()[a0_0x3512ec(0x26c)](0xa)[a0_0x3512ec(0x2a2)](a0_0x3512ec(0x1e9))}),server=new Server({'name':a0_0x3512ec(0x1c5),'version':a0_0x3512ec(0x1b1)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x68f5fd=a0_0x3512ec,_0x3fdee3=[{'name':_0x68f5fd(0x26e),'description':_0x68f5fd(0x1c4)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x68f5fd(0x211)+'Benefits:\x0a'+_0x68f5fd(0x1c3)+_0x68f5fd(0x1fa)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x68f5fd(0x276)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x68f5fd(0x20c)+_0x68f5fd(0x294)+_0x68f5fd(0x268)+_0x68f5fd(0x1f5)+_0x68f5fd(0x1df)+_0x68f5fd(0x1d8)+_0x68f5fd(0x23f)+_0x68f5fd(0x1e6)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x68f5fd(0x22b),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x68f5fd(0x261)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x68f5fd(0x239)+_0x68f5fd(0x21a)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x194fc6=_0x3fdee3[_0x68f5fd(0x1d6)](_0x1a6b80=>{const _0x340005=_0x68f5fd;if(DISABLED_TOOLS[_0x340005(0x1bf)](_0x1a6b80[_0x340005(0x29b)]))return console[_0x340005(0x270)](_0x340005(0x1cd)+_0x1a6b80[_0x340005(0x29b)]+_0x340005(0x1a4)),![];if('requiresApiKey'in _0x1a6b80&&_0x1a6b80[_0x340005(0x237)]&&!MORPH_API_KEY)return logMcpStderr(_0x340005(0x298)+_0x1a6b80['name']+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x194fc6['map'](_0x14f4c9=>({'name':_0x14f4c9[_0x68f5fd(0x29b)],'description':_0x14f4c9[_0x68f5fd(0x25a)],'inputSchema':_0x14f4c9[_0x68f5fd(0x2a4)]}))};}),server[a0_0x3512ec(0x27d)](CallToolRequestSchema,async _0xca5944=>{const _0x26b23e=a0_0x3512ec,{name:_0x494eb9,arguments:_0x1a732a}=_0xca5944[_0x26b23e(0x255)];try{if(DISABLED_TOOLS[_0x26b23e(0x1bf)](_0x494eb9))throw new Error(_0x26b23e(0x233)+_0x494eb9+_0x26b23e(0x245));switch(_0x494eb9){case _0x26b23e(0x26e):{const _0x32abab=MorphEditFileArgsSchema[_0x26b23e(0x1f0)](_0x1a732a);if(!_0x32abab[_0x26b23e(0x263)])throw new Error(_0x26b23e(0x1cf)+_0x32abab['error']);const _0x227eb9=await validatePath(_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x246)]);let _0x5c8a98=null,_0x4794ce=!![],_0x584cfa=null;try{_0x5c8a98=await a0_0x2d6057[_0x26b23e(0x2a7)](_0x227eb9,_0x26b23e(0x254));}catch(_0x21e094){const _0x334780=_0x21e094[_0x26b23e(0x220)];_0x334780===_0x26b23e(0x1d4)?(_0x4794ce=![],_0x5c8a98=''):(_0x584cfa=_0x26b23e(0x293)+(_0x334780||_0x26b23e(0x28f))+_0x26b23e(0x235)+(_0x21e094 instanceof Error?_0x21e094[_0x26b23e(0x209)]:String(_0x21e094)),logMcpStderr(_0x26b23e(0x298)+_0x584cfa));}let _0x5327a3;try{const _0xeeed7c=MORPH_API_KEY;if(!_0xeeed7c)throw new Error(_0x26b23e(0x27a));const _0x836616=a0_0x2702b4[_0x26b23e(0x258)](_0x227eb9),_0x2f447b=a0_0x2702b4[_0x26b23e(0x212)](_0x227eb9),_0x95628e=await executeEditFile({'target_filepath':_0x2f447b,'code_edit':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x222)],'instructions':_0x32abab['data']['instruction']},{'morphApiKey':_0xeeed7c,'morphApiUrl':MORPH_API_URL,'baseDir':_0x836616,'autoWrite':!_0x32abab['data'][_0x26b23e(0x291)],'generateUdiff':![],'debug':![]});_0x5327a3=_0x95628e[_0x26b23e(0x1e5)];if(!_0x95628e['success'])throw new Error(_0x95628e[_0x26b23e(0x270)]||_0x26b23e(0x1fe));const _0x7200dc=_0x95628e[_0x26b23e(0x1b4)],_0x381d2d=_0x26b23e(0x206)+_0x7200dc[_0x26b23e(0x29a)]+_0x26b23e(0x1a7)+_0x7200dc['linesRemoved']+',\x20modified\x20'+_0x7200dc[_0x26b23e(0x1f2)];if(_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x291)])return{'content':[{'type':'text','text':_0x26b23e(0x247)+(_0x4794ce?'':'\x20(new\x20file)')+':\x20'+_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x273)]+'.\x20Changes:\x20'+_0x381d2d+'.\x20Path:\x20'+_0x32abab['data'][_0x26b23e(0x246)]+'.'}]};return{'content':[{'type':_0x26b23e(0x1d3),'text':_0x26b23e(0x234)+(_0x4794ce?'Applied':'Created\x20File')+':\x20'+_0x32abab['data'][_0x26b23e(0x273)]+_0x26b23e(0x1f3)+_0x381d2d+_0x26b23e(0x297)+_0x32abab['data'][_0x26b23e(0x246)]+'.'}]};}catch(_0x13f5b5){const _0x3ed1f6=_0x13f5b5 instanceof Error?_0x13f5b5[_0x26b23e(0x209)]:String(_0x13f5b5);return reportMorphError({'error_message':_0x3ed1f6,'error_type':_0x13f5b5 instanceof Error?_0x13f5b5['constructor'][_0x26b23e(0x29b)]:_0x26b23e(0x1c2),'context':{'tool':'edit_file','completion_id':_0x5327a3,'file_path':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x246)],'validated_path':_0x227eb9,'instruction':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x273)],'model':_0x26b23e(0x238),'dry_run':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x291)],'file_exists':_0x4794ce,'file_read_error':_0x584cfa,'file_readable':_0x5c8a98!==null,'request_content':{'path':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x246)],'code_edit':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x222)],'instruction':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x273)],'original_code':_0x5c8a98!==null?_0x5c8a98['length']>0xc350?_0x5c8a98[_0x26b23e(0x1c7)](0x0,0xc350)+_0x26b23e(0x201)+_0x5c8a98[_0x26b23e(0x1be)]+_0x26b23e(0x25d):_0x5c8a98:_0x26b23e(0x1c1)+(_0x584cfa||_0x26b23e(0x214))+']','original_code_length':_0x5c8a98?.['length']??0x0,'model':'morph-v3-fast','dry_run':_0x32abab[_0x26b23e(0x23c)][_0x26b23e(0x291)]}},'stack_trace':_0x13f5b5 instanceof Error?_0x13f5b5['stack']:undefined,'source':_0x26b23e(0x292)})['catch'](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x3ed1f6}],'isError':!![]};}}case _0x26b23e(0x227):{const _0x5f139c=WarpGrepArgsSchema[_0x26b23e(0x1f0)](_0x1a732a);if(!_0x5f139c[_0x26b23e(0x263)])return{'content':[{'type':_0x26b23e(0x1d3),'text':_0x26b23e(0x22d)+_0x5f139c[_0x26b23e(0x270)]}],'isError':!![]};const _0x372e56=_0x2c3a9a=>{const _0xbef308=_0x26b23e,_0xc20e0f=[];for(const _0x49e470 of _0x2c3a9a||[]){if(_0x49e470['role']===_0xbef308(0x223)&&Array[_0xbef308(0x1d2)](_0x49e470[_0xbef308(0x2a0)]))for(const _0x56833a of _0x49e470[_0xbef308(0x2a0)]){try{const _0x3906ed=_0x56833a[_0xbef308(0x279)]?.[_0xbef308(0x29b)],_0x362910=JSON[_0xbef308(0x25b)](_0x56833a['function']?.['arguments']||'{}');if(_0x3906ed===_0xbef308(0x1e1))_0xc20e0f[_0xbef308(0x1dd)]('grep\x20\x27'+_0x362910[_0xbef308(0x204)]+'\x27\x20'+(_0x362910[_0xbef308(0x246)]||'.'));else{if(_0x3906ed===_0xbef308(0x284))_0xc20e0f['push'](_0xbef308(0x288)+_0x362910[_0xbef308(0x246)]);else{if(_0x3906ed==='list_directory')_0xc20e0f[_0xbef308(0x1dd)]('list_directory\x20'+(_0x362910[_0xbef308(0x27f)]||'.'));else{if(_0x3906ed==='glob')_0xc20e0f[_0xbef308(0x1dd)](_0xbef308(0x21b)+_0x362910['pattern']+'\x27\x20'+(_0x362910[_0xbef308(0x246)]||'.'));else _0x3906ed===_0xbef308(0x1b7)&&_0xc20e0f[_0xbef308(0x1dd)](_0xbef308(0x1b7));}}}}catch{}}}return _0xc20e0f;},_0x2b852e=_0x54ef3b=>{const _0x58cf76=_0x26b23e,_0x5d65b9=[];if(!_0x54ef3b||!Array['isArray'](_0x54ef3b))return _0x5d65b9;const _0x17ac4f=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x58cf76(0x1af),'tool':_0x58cf76(0x284)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x58cf76(0x213),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x58cf76(0x256),'tool':_0x58cf76(0x284)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x58cf76(0x284)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x58cf76(0x1b5),'tool':_0x58cf76(0x1ef)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x58cf76(0x1ef)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x58cf76(0x243),'tool':_0x58cf76(0x284)},{'pattern':/\[SYMLINK\]/,'error_type':_0x58cf76(0x1f8),'tool':_0x58cf76(0x284)},{'pattern':/not a text file/,'error_type':_0x58cf76(0x243),'tool':_0x58cf76(0x284)},{'pattern':/symbolic link/,'error_type':_0x58cf76(0x1f8),'tool':'read'},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x58cf76(0x284)},{'pattern':/status="error"/,'error_type':_0x58cf76(0x2a5),'tool':_0x58cf76(0x28f)}];let _0x390478=0x0;for(const _0x516442 of _0x54ef3b){_0x516442['role']===_0x58cf76(0x223)&&Array['isArray'](_0x516442['tool_calls'])&&_0x390478++;const _0x4d19f7=_0x516442[_0x58cf76(0x1a2)];if((_0x516442[_0x58cf76(0x2ad)]===_0x58cf76(0x248)||_0x516442[_0x58cf76(0x2ad)]===_0x58cf76(0x202))&&_0x4d19f7&&typeof _0x4d19f7===_0x58cf76(0x1eb))for(const {pattern:_0x55a21f,error_type:_0x50c757,tool:_0x127eb9}of _0x17ac4f){const _0x3916ad=_0x4d19f7['match'](new RegExp(_0x55a21f[_0x58cf76(0x22e)],'g'));if(_0x3916ad)for(const _0x10958a of _0x3916ad){const _0x881db0=_0x4d19f7[_0x58cf76(0x21f)](_0x10958a),_0x250be2=_0x4d19f7[_0x58cf76(0x1c7)](_0x881db0,Math[_0x58cf76(0x24f)](_0x881db0+0xc8,_0x4d19f7[_0x58cf76(0x1be)]));_0x5d65b9[_0x58cf76(0x1dd)]({'tool':_0x127eb9,'error_type':_0x50c757,'error_message':_0x250be2['split']('\x0a')[0x0],'turn':_0x390478});}}}return _0x5d65b9;};try{const _0x3fbfec=a0_0x2702b4['resolve'](_0x5f139c['data'][_0x26b23e(0x271)]),_0x1becff=_0x5f139c['data'][_0x26b23e(0x1da)],_0x2ef5cd=_0x1becff==='node_modules'?{'allowNames':[_0x26b23e(0x28a)]}:undefined,_0x340ed5=new LocalRipgrepProvider(_0x3fbfec,undefined,_0x2ef5cd),_0x279a7e=await runWarpGrep({'searchTerm':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'repoRoot':_0x3fbfec,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x340ed5,'search_type':_0x1becff}),_0x3159fa=_0x2b852e(_0x279a7e[_0x26b23e(0x1cc)]);_0x3159fa['length']>0x0&&reportMorphError({'error_message':_0x26b23e(0x27e)+_0x3159fa[_0x26b23e(0x1be)]+'\x20error(s)','error_type':'SubToolError','level':_0x26b23e(0x1ee),'tool':_0x26b23e(0x227),'context':{'repo_path':_0x5f139c[_0x26b23e(0x23c)]['repo_path'],'query':_0x5f139c[_0x26b23e(0x23c)]['search_string'],'model':_0x26b23e(0x280),'termination_reason':_0x279a7e[_0x26b23e(0x281)],'sub_tool_errors':_0x3159fa,'timings':_0x279a7e[_0x26b23e(0x22f)],'tool_calls':_0x372e56(_0x279a7e[_0x26b23e(0x1cc)]),'messages':_0x279a7e[_0x26b23e(0x1cc)]?.[_0x26b23e(0x1e7)](_0x2a0c62=>({'role':_0x2a0c62[_0x26b23e(0x2ad)],'content':_0x2a0c62[_0x26b23e(0x1a2)],..._0x2a0c62[_0x26b23e(0x2a0)]?{'tool_calls':_0x2a0c62[_0x26b23e(0x2a0)][_0x26b23e(0x1be)]}:{},..._0x2a0c62['tool_call_id']?{'tool_call_id':_0x2a0c62['tool_call_id']}:{}}))},'source':_0x26b23e(0x292)})[_0x26b23e(0x218)](()=>{});let _0x107f40='';if(_0x279a7e['terminationReason']===_0x26b23e(0x1b3)&&_0x279a7e[_0x26b23e(0x1b7)]?.['metadata']?.['files']){const _0x1a6e37=_0x279a7e[_0x26b23e(0x1b7)]['metadata'][_0x26b23e(0x24c)];if(_0x1a6e37[_0x26b23e(0x1be)]===0x0)return _0x107f40=_0x279a7e[_0x26b23e(0x1b7)][_0x26b23e(0x2a1)]||_0x26b23e(0x224),{'content':[{'type':_0x26b23e(0x1d3),'text':_0x107f40}]};const _0xc24e75=[],_0x2e32e3=[_0x26b23e(0x262)];for(const _0x5ae03b of _0x279a7e[_0x26b23e(0x1cc)]){if(_0x5ae03b[_0x26b23e(0x2ad)]===_0x26b23e(0x223)&&Array[_0x26b23e(0x1d2)](_0x5ae03b[_0x26b23e(0x2a0)]))for(const _0x30c872 of _0x5ae03b[_0x26b23e(0x2a0)]){try{const _0x2c49ee=_0x30c872['function']?.['name'],_0x3f05e9=JSON[_0x26b23e(0x25b)](_0x30c872[_0x26b23e(0x279)]?.['arguments']||'{}');if(_0x2c49ee===_0x26b23e(0x1e1))_0x2e32e3['push'](_0x26b23e(0x1a3)+_0x3f05e9[_0x26b23e(0x204)]+_0x26b23e(0x23a)+(_0x3f05e9[_0x26b23e(0x246)]||'.')+'`');else{if(_0x2c49ee===_0x26b23e(0x284))_0x2e32e3[_0x26b23e(0x1dd)]('-\x20Read\x20file\x20`'+_0x3f05e9[_0x26b23e(0x246)]+'`');else{if(_0x2c49ee===_0x26b23e(0x1ce))_0x2e32e3[_0x26b23e(0x1dd)](_0x26b23e(0x229)+(_0x3f05e9['command']||'.')+'`');else _0x2c49ee===_0x26b23e(0x259)&&_0x2e32e3['push']('-\x20Glob\x20search\x20`'+_0x3f05e9[_0x26b23e(0x204)]+_0x26b23e(0x274)+(_0x3f05e9[_0x26b23e(0x246)]||'.')+'`');}}}catch{}}}_0xc24e75['push'](_0x2e32e3['join']('\x0a'));const _0x5f4aad=['','Relevant\x20context\x20found:'];for(const _0x47f344 of _0x1a6e37){if(_0x47f344['lines']==='*')_0x5f4aad[_0x26b23e(0x1dd)]('-\x20'+_0x47f344[_0x26b23e(0x246)]+':*');else{if(Array[_0x26b23e(0x1d2)](_0x47f344[_0x26b23e(0x20a)])){const _0xcb351c=_0x47f344[_0x26b23e(0x20a)][_0x26b23e(0x1e7)](([_0x2020ef,_0x54c11e])=>{if(_0x2020ef===_0x54c11e)return''+_0x2020ef;return _0x2020ef+'-'+_0x54c11e;});_0x5f4aad[_0x26b23e(0x1dd)]('-\x20'+_0x47f344[_0x26b23e(0x246)]+':'+_0xcb351c['join'](','));}else _0x5f4aad[_0x26b23e(0x1dd)]('-\x20'+_0x47f344[_0x26b23e(0x246)]+':*');}}_0x5f4aad[_0x26b23e(0x1dd)](''),_0xc24e75[_0x26b23e(0x1dd)](_0x5f4aad[_0x26b23e(0x2a8)]('\x0a')),_0xc24e75['push'](_0x26b23e(0x29d));const _0x2a927b=[];for(const _0x4d8250 of _0x1a6e37){let _0xe4567b=a0_0x2702b4[_0x26b23e(0x1b2)](_0x5f139c['data'][_0x26b23e(0x271)],_0x4d8250['path']),_0xca3225=null,_0x3ec52c=null;try{_0xca3225=await a0_0x2d6057[_0x26b23e(0x2a7)](_0xe4567b,{'encoding':'utf-8'});}catch(_0x36c917){const _0x3f28f5=fixPathRepetition(_0xe4567b);if(_0x3f28f5)try{_0xca3225=await a0_0x2d6057[_0x26b23e(0x2a7)](_0x3f28f5,{'encoding':_0x26b23e(0x254)}),_0xe4567b=_0x3f28f5;}catch{_0x3ec52c=_0x36c917 instanceof Error?_0x36c917:new Error(String(_0x36c917));}else _0x3ec52c=_0x36c917 instanceof Error?_0x36c917:new Error(String(_0x36c917));}if(_0xca3225!==null){const _0x149de5=_0xca3225[_0x26b23e(0x1e4)](/\r?\n/),_0x16afb4=[_0x26b23e(0x1a9)+_0x4d8250[_0x26b23e(0x246)]+'\x22>'];if(_0x4d8250[_0x26b23e(0x20a)]==='*'||!Array['isArray'](_0x4d8250['lines']))for(let _0x257cce=0x1;_0x257cce<=_0x149de5['length'];_0x257cce++){const _0x296811=_0x149de5[_0x257cce-0x1];_0x16afb4['push'](_0x257cce+'|\x20'+_0x296811);}else for(const [_0xa78a1,_0x5524d4]of _0x4d8250['lines']){_0x16afb4[_0x26b23e(0x1be)]>0x1&&_0x16afb4[_0x26b23e(0x1dd)]('');for(let _0x145814=_0xa78a1;_0x145814<=_0x5524d4&&_0x145814<=_0x149de5[_0x26b23e(0x1be)];_0x145814++){const _0x52221b=_0x149de5[_0x145814-0x1];_0x16afb4[_0x26b23e(0x1dd)](_0x145814+'|\x20'+_0x52221b);}}_0x16afb4[_0x26b23e(0x1dd)](_0x26b23e(0x1bc)),_0x2a927b[_0x26b23e(0x1dd)](_0x16afb4[_0x26b23e(0x2a8)]('\x0a'));}else _0x2a927b[_0x26b23e(0x1dd)](_0x26b23e(0x1a9)+_0x4d8250['path']+_0x26b23e(0x2ae)+(_0x3ec52c?.[_0x26b23e(0x209)]||'Unknown\x20error')+_0x26b23e(0x1f4));}_0xc24e75[_0x26b23e(0x1dd)](_0x2a927b[_0x26b23e(0x2a8)]('\x0a\x0a')),_0x107f40=_0xc24e75['join']('\x0a');const _0x50c1e6=_0x279a7e[_0x26b23e(0x1b8)]?.[_0x26b23e(0x1d6)](_0x3582ca=>_0x3582ca[_0x26b23e(0x209)]?.['startsWith'](_0x26b23e(0x278)))||[];if(_0x50c1e6[_0x26b23e(0x1be)]>0x0){const _0x55b4d0=_0x50c1e6['map'](_0x5b4433=>_0x5b4433[_0x26b23e(0x209)])[_0x26b23e(0x2a8)](';\x20');reportMorphError({'error_message':_0x55b4d0,'error_type':'FileReadError','context':{'tool':_0x26b23e(0x227),'repo_path':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x271)],'query':_0x5f139c['data'][_0x26b23e(0x1ff)],'model':_0x26b23e(0x280),'termination_reason':_0x26b23e(0x265),'error_count':_0x50c1e6[_0x26b23e(0x1be)],'is_timeout':![],'timings':_0x279a7e[_0x26b23e(0x22f)],'files_attempted':_0x1a6e37[_0x26b23e(0x1e7)](_0x3b1007=>({'path':_0x3b1007[_0x26b23e(0x246)],'lines':_0x3b1007[_0x26b23e(0x20a)]})),'tool_calls':_0x372e56(_0x279a7e[_0x26b23e(0x1cc)]),'messages':_0x279a7e[_0x26b23e(0x1cc)]?.[_0x26b23e(0x1e7)](_0x1662fa=>({'role':_0x1662fa['role'],'content':_0x1662fa[_0x26b23e(0x1a2)],..._0x1662fa[_0x26b23e(0x2a0)]?{'tool_calls':_0x1662fa['tool_calls'][_0x26b23e(0x1be)]}:{},..._0x1662fa['tool_call_id']?{'tool_call_id':_0x1662fa['tool_call_id']}:{}})),'request_content':{'query':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'repo_path':_0x5f139c['data'][_0x26b23e(0x271)],'repoRoot':a0_0x2702b4[_0x26b23e(0x1b2)](_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x271)]),'model':_0x26b23e(0x280)}},'source':_0x26b23e(0x292)})[_0x26b23e(0x218)](()=>{});}}else{if(_0x279a7e[_0x26b23e(0x281)]===_0x26b23e(0x22c)&&_0x279a7e[_0x26b23e(0x1b8)][_0x26b23e(0x1be)]>0x0){const _0x1a2279=_0x279a7e['errors'][_0x26b23e(0x1e7)](_0x412460=>_0x412460[_0x26b23e(0x209)])[_0x26b23e(0x2a8)](';\x20');_0x107f40=_0x26b23e(0x1bb)+_0x1a2279;const _0x196bb2=_0x1a2279[_0x26b23e(0x1d5)]()[_0x26b23e(0x20d)](_0x26b23e(0x257))||_0x1a2279[_0x26b23e(0x1d5)]()[_0x26b23e(0x20d)](_0x26b23e(0x286))||_0x1a2279['toLowerCase']()[_0x26b23e(0x20d)](_0x26b23e(0x1f9)),_0x575209=_0x279a7e[_0x26b23e(0x1b7)]?.[_0x26b23e(0x23b)]?.[_0x26b23e(0x24c)],_0x2b683e=_0x279a7e['errors'][0x0];reportMorphError({'error_message':_0x1a2279,'error_type':_0x196bb2?_0x26b23e(0x1f7):_0x2b683e?.[_0x26b23e(0x1fd)]?.[_0x26b23e(0x29b)]||'WarpGrepError','context':{'tool':_0x26b23e(0x227),'repo_path':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x271)],'query':_0x5f139c[_0x26b23e(0x23c)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x279a7e[_0x26b23e(0x281)],'error_count':_0x279a7e['errors'][_0x26b23e(0x1be)],'is_timeout':_0x196bb2,'timings':_0x279a7e[_0x26b23e(0x22f)],'files_attempted':_0x575209?.['map'](_0x3b946e=>({'path':_0x3b946e[_0x26b23e(0x246)],'lines':_0x3b946e[_0x26b23e(0x20a)]})),'tool_calls':_0x372e56(_0x279a7e[_0x26b23e(0x1cc)]),'messages':_0x279a7e[_0x26b23e(0x1cc)]?.[_0x26b23e(0x1e7)](_0x3daee3=>({'role':_0x3daee3[_0x26b23e(0x2ad)],'content':_0x3daee3['content'],..._0x3daee3[_0x26b23e(0x2a0)]?{'tool_calls':_0x3daee3[_0x26b23e(0x2a0)][_0x26b23e(0x1be)]}:{},..._0x3daee3[_0x26b23e(0x1c8)]?{'tool_call_id':_0x3daee3[_0x26b23e(0x1c8)]}:{}})),'request_content':{'query':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'repo_path':_0x5f139c[_0x26b23e(0x23c)]['repo_path'],'repoRoot':a0_0x2702b4[_0x26b23e(0x1b2)](_0x5f139c[_0x26b23e(0x23c)]['repo_path']),'model':_0x26b23e(0x280)}},'stack_trace':_0x2b683e?.['stack']||undefined,'source':_0x26b23e(0x292)})[_0x26b23e(0x218)](()=>{});}else _0x107f40=_0x26b23e(0x272);}return{'content':[{'type':'text','text':_0x107f40}]};}catch(_0x3bc922){const _0x1f7d5a=_0x3bc922 instanceof Error?_0x3bc922['message']:String(_0x3bc922),_0x184507=_0x1f7d5a[_0x26b23e(0x1d5)]()[_0x26b23e(0x20d)]('timeout')||_0x1f7d5a[_0x26b23e(0x1d5)]()[_0x26b23e(0x20d)](_0x26b23e(0x286))||_0x1f7d5a[_0x26b23e(0x1d5)]()['includes'](_0x26b23e(0x1f9))||_0x3bc922 instanceof Error&&_0x3bc922[_0x26b23e(0x29b)]===_0x26b23e(0x1f7);return reportMorphError({'error_message':_0x1f7d5a,'error_type':_0x184507?_0x26b23e(0x1f7):_0x3bc922 instanceof Error?_0x3bc922[_0x26b23e(0x1fd)][_0x26b23e(0x29b)]:'UnknownError','context':{'tool':_0x26b23e(0x227),'repo_path':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x271)],'query':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'model':'morph-warp-grep-v2.1','is_timeout':_0x184507,'exception_phase':_0x26b23e(0x2ab),'request_content':{'query':_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'repo_path':_0x5f139c['data'][_0x26b23e(0x271)],'repoRoot':a0_0x2702b4[_0x26b23e(0x1b2)](_0x5f139c[_0x26b23e(0x23c)][_0x26b23e(0x271)]),'model':_0x26b23e(0x280)}},'stack_trace':_0x3bc922 instanceof Error?_0x3bc922[_0x26b23e(0x1b9)]:undefined,'source':_0x26b23e(0x292)})[_0x26b23e(0x218)](()=>{}),{'content':[{'type':_0x26b23e(0x1d3),'text':_0x26b23e(0x226)+_0x1f7d5a}],'isError':![]};}}case _0x26b23e(0x1a8):{const _0x4c4f85=WarpGrepGitHubArgsSchema[_0x26b23e(0x1f0)](_0x1a732a);if(!_0x4c4f85['success'])return{'content':[{'type':_0x26b23e(0x1d3),'text':'Invalid\x20arguments:\x20'+_0x4c4f85[_0x26b23e(0x270)]}],'isError':!![]};const _0x468af=_0x4c4f85['data'][_0x26b23e(0x1de)]||_0x4c4f85[_0x26b23e(0x23c)]['owner_repo'];if(!_0x468af)return{'content':[{'type':'text','text':_0x26b23e(0x250)}],'isError':!![]};const _0x125453=MORPH_API_KEY;if(!_0x125453)throw new Error(_0x26b23e(0x27a));const _0xba88f5=Date[_0x26b23e(0x1e8)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x468af+_0x26b23e(0x266)+_0x4c4f85[_0x26b23e(0x23c)][_0x26b23e(0x1ff)]+'\x22');try{const _0x7f7245=new WarpGrepClient({'morphApiKey':_0x125453,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3bc31a=await _0x7f7245[_0x26b23e(0x2ac)]({'searchTerm':_0x4c4f85[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'github':_0x468af,'branch':_0x4c4f85[_0x26b23e(0x23c)][_0x26b23e(0x253)]}),_0x41298d=Date[_0x26b23e(0x1e8)]()-_0xba88f5;logMcpStderr(_0x26b23e(0x25f)+_0x41298d+_0x26b23e(0x21c)+_0x3bc31a[_0x26b23e(0x263)]);const _0x54fb16=formatResult(_0x3bc31a);return{'content':[{'type':_0x26b23e(0x1d3),'text':_0x54fb16}]};}catch(_0x2935f2){const _0x2583ad=Date[_0x26b23e(0x1e8)]()-_0xba88f5,_0xb23e5f=_0x2935f2 instanceof Error?_0x2935f2['message']:String(_0x2935f2);return logMcpStderr(_0x26b23e(0x1ca)+_0x2583ad+_0x26b23e(0x221),_0xb23e5f),reportMorphError({'error_message':_0xb23e5f,'error_type':_0x2935f2 instanceof Error?_0x2935f2[_0x26b23e(0x1fd)]['name']:_0x26b23e(0x1c2),'context':{'tool':_0x26b23e(0x1a8),'github_url':_0x468af,'search_string':_0x4c4f85[_0x26b23e(0x23c)][_0x26b23e(0x1ff)],'branch':_0x4c4f85[_0x26b23e(0x23c)]['branch']},'stack_trace':_0x2935f2 instanceof Error?_0x2935f2[_0x26b23e(0x1b9)]:undefined,'source':_0x26b23e(0x292),'tool':_0x26b23e(0x1a8),'latency_ms':_0x2583ad})['catch'](()=>{}),{'content':[{'type':_0x26b23e(0x1d3),'text':_0x26b23e(0x242)+_0xb23e5f}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x494eb9);}}catch(_0x81aaa2){const _0x2e11a3=_0x81aaa2 instanceof Error?_0x81aaa2[_0x26b23e(0x209)]:String(_0x81aaa2);return reportMorphError({'error_message':_0x2e11a3,'error_type':_0x81aaa2 instanceof Error?_0x81aaa2[_0x26b23e(0x1fd)][_0x26b23e(0x29b)]:_0x26b23e(0x1c2),'context':{'tool':_0x494eb9,'arguments':_0x1a732a?JSON[_0x26b23e(0x23e)](_0x1a732a)[_0x26b23e(0x1c7)](0x0,0x1f4):undefined,'mcp_server_version':_0x26b23e(0x1b1)},'stack_trace':_0x81aaa2 instanceof Error?_0x81aaa2['stack']:undefined,'source':_0x26b23e(0x292)})[_0x26b23e(0x218)](()=>{}),{'content':[{'type':_0x26b23e(0x1d3),'text':_0x26b23e(0x1bb)+_0x2e11a3}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4b6954){const _0x328f87=a0_0x3512ec,_0x46f9cb=await getValidRootDirectories(_0x4b6954);if(_0x46f9cb[_0x328f87(0x1be)]>0x0)allowedDirectories=[..._0x46f9cb],logMcpStderr(_0x328f87(0x1c6)+_0x46f9cb['length']+'\x20valid\x20directories');else{logMcpStderr(_0x328f87(0x260));if(ENABLE_WORKSPACE_MODE)try{const _0x332d87=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x332d87&&(allowedDirectories=[_0x332d87],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x332d87));}catch(_0x1f02da){logMcpStderr(_0x328f87(0x1fc)+_0x1f02da);}}}server[a0_0x3512ec(0x210)](RootsListChangedNotificationSchema,async()=>{const _0x3bb4d9=a0_0x3512ec;try{const _0x5b8e24=await server[_0x3bb4d9(0x1a1)]();_0x5b8e24&&_0x3bb4d9(0x28d)in _0x5b8e24&&await updateAllowedDirectoriesFromRoots(_0x5b8e24[_0x3bb4d9(0x28d)]);}catch(_0x292bd2){logMcpStderr(_0x3bb4d9(0x231),_0x292bd2 instanceof Error?_0x292bd2[_0x3bb4d9(0x209)]:String(_0x292bd2));}}),server[a0_0x3512ec(0x29c)]=async()=>{const _0x45c459=a0_0x3512ec,_0x156060=server[_0x45c459(0x1a6)]();if(_0x156060?.[_0x45c459(0x28d)])try{const _0x327a9a=await server[_0x45c459(0x1a1)]();_0x327a9a&&_0x45c459(0x28d)in _0x327a9a?await updateAllowedDirectoriesFromRoots(_0x327a9a[_0x45c459(0x28d)]):logMcpStderr(_0x45c459(0x290));}catch(_0x238b6a){logMcpStderr(_0x45c459(0x1db),_0x238b6a instanceof Error?_0x238b6a[_0x45c459(0x209)]:String(_0x238b6a));}else{if(allowedDirectories[_0x45c459(0x1be)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x45c459(0x217));else throw new Error(_0x45c459(0x282));}}};async function runServer(){const _0x37ce5b=a0_0x3512ec,_0x1eaacb=new StdioServerTransport();await server['connect'](_0x1eaacb),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x37ce5b(0x1be)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x3512ec(0x218)](_0x4b471c=>{const _0x6b22f2=a0_0x3512ec;logMcpStderr(_0x6b22f2(0x228),_0x4b471c),process[_0x6b22f2(0x28c)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0xbac8eb=a1_0x3e16;(function(_0x20ffd1,_0x5d1af8){var _0x3e690b=a1_0x3e16,_0x28500a=_0x20ffd1();while(!![]){try{var _0xbc7a54=-parseInt(_0x3e690b(0x1ef))/0x1*(-parseInt(_0x3e690b(0x1fb))/0x2)+-parseInt(_0x3e690b(0x1f0))/0x3*(-parseInt(_0x3e690b(0x1ee))/0x4)+-parseInt(_0x3e690b(0x1f5))/0x5*(parseInt(_0x3e690b(0x1fa))/0x6)+parseInt(_0x3e690b(0x1f7))/0x7*(parseInt(_0x3e690b(0x1f8))/0x8)+parseInt(_0x3e690b(0x1f6))/0x9+parseInt(_0x3e690b(0x1fc))/0xa+-parseInt(_0x3e690b(0x1ec))/0xb*(parseInt(_0x3e690b(0x1ea))/0xc);if(_0xbc7a54===_0x5d1af8)break;else _0x28500a['push'](_0x28500a['shift']());}catch(_0x117ba1){_0x28500a['push'](_0x28500a['shift']());}}}(a1_0x6741,0xc9f48));import a1_0x2bd6f5 from'os';export function getOperatingSystemType(_0x55bdb8=a1_0x2bd6f5[a1_0xbac8eb(0x1e8)]()){var _0x1c0317=a1_0xbac8eb;switch(_0x55bdb8){case _0x1c0317(0x1ed):return _0x1c0317(0x1f4);case _0x1c0317(0x1f9):return'Windows';case _0x1c0317(0x1e9):return _0x1c0317(0x1f1);default:return _0x1c0317(0x1eb);}}function a1_0x3e16(_0x6259de,_0x1230d9){_0x6259de=_0x6259de-0x1e8;var _0x674115=a1_0x6741();var _0x3e16c6=_0x674115[_0x6259de];return _0x3e16c6;}export function formatMcpLogMessage(_0x5c9d9b,_0x207292=a1_0x2bd6f5[a1_0xbac8eb(0x1e8)]()){var _0x2f2dea=a1_0xbac8eb;return _0x2f2dea(0x1f3)+getOperatingSystemType(_0x207292)+']\x20'+_0x5c9d9b;}function a1_0x6741(){var _0x3d98fa=['72OBAeUe','win32','6iGUiva','15638PosaIg','9507000PYlHOP','platform','linux','12tUPsQz','Unknown','14612653vYxbOB','darwin','4jqXcOW','177CEsWVZ','2487222vKwAtQ','Linux','error','[os=','macOS','6019285KVLJfT','101664BScUJi','143465WYVEws'];a1_0x6741=function(){return _0x3d98fa;};return a1_0x6741();}export function logMcpStderr(_0x420af8,..._0x3abf1e){var _0x28c00c=a1_0xbac8eb;console[_0x28c00c(0x1f2)](formatMcpLogMessage(_0x420af8),..._0x3abf1e);}
1
+ function a1_0x25f1(_0x18bf76,_0x1f0770){_0x18bf76=_0x18bf76-0x133;var _0x4eac6a=a1_0x4eac();var _0x25f1ea=_0x4eac6a[_0x18bf76];return _0x25f1ea;}(function(_0x3076aa,_0x3888a8){var _0x546c90=a1_0x25f1,_0x526c77=_0x3076aa();while(!![]){try{var _0x43d2e2=parseInt(_0x546c90(0x13a))/0x1*(parseInt(_0x546c90(0x135))/0x2)+parseInt(_0x546c90(0x137))/0x3*(-parseInt(_0x546c90(0x143))/0x4)+-parseInt(_0x546c90(0x140))/0x5+-parseInt(_0x546c90(0x13c))/0x6*(-parseInt(_0x546c90(0x142))/0x7)+parseInt(_0x546c90(0x144))/0x8*(parseInt(_0x546c90(0x13b))/0x9)+-parseInt(_0x546c90(0x136))/0xa*(parseInt(_0x546c90(0x145))/0xb)+-parseInt(_0x546c90(0x133))/0xc*(-parseInt(_0x546c90(0x13e))/0xd);if(_0x43d2e2===_0x3888a8)break;else _0x526c77['push'](_0x526c77['shift']());}catch(_0x589fcb){_0x526c77['push'](_0x526c77['shift']());}}}(a1_0x4eac,0xd9d27));import a1_0x1b15b1 from'os';function a1_0x4eac(){var _0x14aded=['2951650YIpMBV','win32','44779YjzQsl','5089688bHpFjk','2499176NGbMMZ','35365AxNrJl','6892716IBPIRl','Windows','2uRSMHn','1850jzVcsN','3bbGlst','Linux','macOS','649918qNKaSv','18odpvMB','330BVZOdK','linux','39jqeCEH','Unknown'];a1_0x4eac=function(){return _0x14aded;};return a1_0x4eac();}export function getOperatingSystemType(_0x193382=a1_0x1b15b1['platform']()){var _0x295e5b=a1_0x25f1;switch(_0x193382){case'darwin':return _0x295e5b(0x139);case _0x295e5b(0x141):return _0x295e5b(0x134);case _0x295e5b(0x13d):return _0x295e5b(0x138);default:return _0x295e5b(0x13f);}}export function formatMcpLogMessage(_0x25127f,_0xe8cb38=a1_0x1b15b1['platform']()){return'[os='+getOperatingSystemType(_0xe8cb38)+']\x20'+_0x25127f;}export function logMcpStderr(_0x43b30d,..._0x3e6dec){console['error'](formatMcpLogMessage(_0x43b30d),..._0x3e6dec);}
@@ -1 +1 @@
1
- function a2_0x4dc0(_0x53cb98,_0x2536bf){_0x53cb98=_0x53cb98-0x75;const _0x4862fd=a2_0x4862();let _0x4dc0c3=_0x4862fd[_0x53cb98];return _0x4dc0c3;}(function(_0x190073,_0xfeb448){const _0x5bec32=a2_0x4dc0,_0x305252=_0x190073();while(!![]){try{const _0x54f194=parseInt(_0x5bec32(0x84))/0x1+parseInt(_0x5bec32(0x78))/0x2+parseInt(_0x5bec32(0x81))/0x3+-parseInt(_0x5bec32(0x80))/0x4*(parseInt(_0x5bec32(0x79))/0x5)+parseInt(_0x5bec32(0x7a))/0x6+-parseInt(_0x5bec32(0x8a))/0x7*(parseInt(_0x5bec32(0x75))/0x8)+parseInt(_0x5bec32(0x86))/0x9*(-parseInt(_0x5bec32(0x87))/0xa);if(_0x54f194===_0xfeb448)break;else _0x305252['push'](_0x305252['shift']());}catch(_0x2601ba){_0x305252['push'](_0x305252['shift']());}}}(a2_0x4862,0x826e5));import a2_0x1e627c from'path';import a2_0xc46b6b from'os';export function convertToWindowsPath(_0x56cc6a){const _0x25f726=a2_0x4dc0;if(_0x56cc6a[_0x25f726(0x7c)](_0x25f726(0x82))){const _0x5ee5d7=_0x56cc6a[_0x25f726(0x88)](0x5)[_0x25f726(0x76)](),_0x2eb92b=_0x56cc6a[_0x25f726(0x7f)](0x6)['replace'](/\//g,'\x5c');return _0x5ee5d7+':'+_0x2eb92b;}if(_0x56cc6a['match'](/^\/[a-zA-Z]\//)){const _0x3c6fb7=_0x56cc6a[_0x25f726(0x88)](0x1)['toUpperCase'](),_0x29e207=_0x56cc6a['slice'](0x2)[_0x25f726(0x85)](/\//g,'\x5c');return _0x3c6fb7+':'+_0x29e207;}if(_0x56cc6a[_0x25f726(0x83)](/^[a-zA-Z]:/))return _0x56cc6a[_0x25f726(0x85)](/\//g,'\x5c');return _0x56cc6a;}export function normalizePath(_0x19aa5f){const _0x24d5f3=a2_0x4dc0;_0x19aa5f=_0x19aa5f[_0x24d5f3(0x77)]()['replace'](/^["']|["']$/g,'');const _0x297185=_0x19aa5f[_0x24d5f3(0x7c)]('/')&&!_0x19aa5f['match'](/^\/mnt\/[a-z]\//i)&&!_0x19aa5f[_0x24d5f3(0x83)](/^\/[a-zA-Z]\//);if(_0x297185)return _0x19aa5f[_0x24d5f3(0x85)](/\/+/g,'/')[_0x24d5f3(0x85)](/\/+$/,'');_0x19aa5f=convertToWindowsPath(_0x19aa5f);if(_0x19aa5f[_0x24d5f3(0x7c)]('\x5c\x5c')){let _0x217058=_0x19aa5f;_0x217058=_0x217058[_0x24d5f3(0x85)](/^\\{2,}/,'\x5c\x5c');const _0x28c7cf=_0x217058[_0x24d5f3(0x7d)](0x2)[_0x24d5f3(0x85)](/\\\\/g,'\x5c');_0x19aa5f='\x5c\x5c'+_0x28c7cf;}else _0x19aa5f=_0x19aa5f['replace'](/\\\\/g,'\x5c');let _0x5f3d3b=a2_0x1e627c[_0x24d5f3(0x7e)](_0x19aa5f);_0x19aa5f[_0x24d5f3(0x7c)]('\x5c\x5c')&&!_0x5f3d3b[_0x24d5f3(0x7c)]('\x5c\x5c')&&(_0x5f3d3b='\x5c'+_0x5f3d3b);if(_0x5f3d3b['match'](/^[a-zA-Z]:/)){let _0x58a1c=_0x5f3d3b['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x24d5f3(0x89)](_0x58a1c)&&(_0x58a1c=_0x58a1c[_0x24d5f3(0x88)](0x0)['toUpperCase']()+_0x58a1c[_0x24d5f3(0x7f)](0x1)),_0x58a1c;}return _0x5f3d3b[_0x24d5f3(0x85)](/\//g,'\x5c');}export function expandHome(_0x513322){const _0x361900=a2_0x4dc0;if(_0x513322[_0x361900(0x7c)]('~/')||_0x513322==='~')return a2_0x1e627c['join'](a2_0xc46b6b[_0x361900(0x7b)](),_0x513322[_0x361900(0x7f)](0x1));return _0x513322;}function a2_0x4862(){const _0x516bb8=['1603398IJRPpS','2449825gLpZuz','5626848JgubHy','homedir','startsWith','substring','normalize','slice','8athEfu','453447ycGLlT','/mnt/','match','538292vtLLZu','replace','18nhqKwS','277430KnxncY','charAt','test','77qNkFpr','624936onBrlF','toUpperCase','trim'];a2_0x4862=function(){return _0x516bb8;};return a2_0x4862();}
1
+ (function(_0x5e14be,_0x11e250){const _0x5acdaf=a2_0x40e3,_0x2d05da=_0x5e14be();while(!![]){try{const _0xcba694=-parseInt(_0x5acdaf(0x178))/0x1*(parseInt(_0x5acdaf(0x170))/0x2)+-parseInt(_0x5acdaf(0x16c))/0x3+parseInt(_0x5acdaf(0x16a))/0x4*(-parseInt(_0x5acdaf(0x166))/0x5)+-parseInt(_0x5acdaf(0x16d))/0x6*(-parseInt(_0x5acdaf(0x174))/0x7)+-parseInt(_0x5acdaf(0x167))/0x8+-parseInt(_0x5acdaf(0x171))/0x9*(parseInt(_0x5acdaf(0x172))/0xa)+parseInt(_0x5acdaf(0x164))/0xb*(parseInt(_0x5acdaf(0x179))/0xc);if(_0xcba694===_0x11e250)break;else _0x2d05da['push'](_0x2d05da['shift']());}catch(_0x4fb924){_0x2d05da['push'](_0x2d05da['shift']());}}}(a2_0x2f6d,0x41981));import a2_0x316d45 from'path';import a2_0x489cbb from'os';export function convertToWindowsPath(_0x41a0cc){const _0x5757d2=a2_0x40e3;if(_0x41a0cc['startsWith'](_0x5757d2(0x16e))){const _0xec5677=_0x41a0cc[_0x5757d2(0x177)](0x5)[_0x5757d2(0x16f)](),_0x5a5220=_0x41a0cc[_0x5757d2(0x16b)](0x6)[_0x5757d2(0x165)](/\//g,'\x5c');return _0xec5677+':'+_0x5a5220;}if(_0x41a0cc[_0x5757d2(0x168)](/^\/[a-zA-Z]\//)){const _0x1455d6=_0x41a0cc[_0x5757d2(0x177)](0x1)['toUpperCase'](),_0x109c69=_0x41a0cc[_0x5757d2(0x16b)](0x2)[_0x5757d2(0x165)](/\//g,'\x5c');return _0x1455d6+':'+_0x109c69;}if(_0x41a0cc['match'](/^[a-zA-Z]:/))return _0x41a0cc[_0x5757d2(0x165)](/\//g,'\x5c');return _0x41a0cc;}function a2_0x40e3(_0x4d0c9c,_0x483764){_0x4d0c9c=_0x4d0c9c-0x162;const _0x2f6da6=a2_0x2f6d();let _0x40e3bc=_0x2f6da6[_0x4d0c9c];return _0x40e3bc;}export function normalizePath(_0x4f8c86){const _0x5d81a4=a2_0x40e3;_0x4f8c86=_0x4f8c86[_0x5d81a4(0x169)]()[_0x5d81a4(0x165)](/^["']|["']$/g,'');const _0x4fe2df=_0x4f8c86[_0x5d81a4(0x176)]('/')&&!_0x4f8c86[_0x5d81a4(0x168)](/^\/mnt\/[a-z]\//i)&&!_0x4f8c86[_0x5d81a4(0x168)](/^\/[a-zA-Z]\//);if(_0x4fe2df)return _0x4f8c86['replace'](/\/+/g,'/')['replace'](/\/+$/,'');_0x4f8c86=convertToWindowsPath(_0x4f8c86);if(_0x4f8c86[_0x5d81a4(0x176)]('\x5c\x5c')){let _0x45e441=_0x4f8c86;_0x45e441=_0x45e441['replace'](/^\\{2,}/,'\x5c\x5c');const _0x118c39=_0x45e441[_0x5d81a4(0x175)](0x2)[_0x5d81a4(0x165)](/\\\\/g,'\x5c');_0x4f8c86='\x5c\x5c'+_0x118c39;}else _0x4f8c86=_0x4f8c86['replace'](/\\\\/g,'\x5c');let _0x3951df=a2_0x316d45['normalize'](_0x4f8c86);_0x4f8c86['startsWith']('\x5c\x5c')&&!_0x3951df['startsWith']('\x5c\x5c')&&(_0x3951df='\x5c'+_0x3951df);if(_0x3951df[_0x5d81a4(0x168)](/^[a-zA-Z]:/)){let _0x528c76=_0x3951df['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x5d81a4(0x163)](_0x528c76)&&(_0x528c76=_0x528c76[_0x5d81a4(0x177)](0x0)[_0x5d81a4(0x16f)]()+_0x528c76['slice'](0x1)),_0x528c76;}return _0x3951df['replace'](/\//g,'\x5c');}function a2_0x2f6d(){const _0x4da91f=['/mnt/','toUpperCase','148XeflOc','1398753rGdRxl','10aOOKsi','join','8764JHMWdg','substring','startsWith','charAt','4143npvfhC','6251352gmbaIu','homedir','test','22uljWoY','replace','5SigFvY','952224DwGLoX','match','trim','735516cUsGjL','slice','967695dqXDPL','1506RnQtYR'];a2_0x2f6d=function(){return _0x4da91f;};return a2_0x2f6d();}export function expandHome(_0x1c4223){const _0x4181ae=a2_0x40e3;if(_0x1c4223[_0x4181ae(0x176)]('~/')||_0x1c4223==='~')return a2_0x316d45[_0x4181ae(0x173)](a2_0x489cbb[_0x4181ae(0x162)](),_0x1c4223[_0x4181ae(0x16b)](0x1));return _0x1c4223;}
@@ -1 +1 @@
1
- function a3_0x1e8f(_0x4ead9e,_0x1858d9){_0x4ead9e=_0x4ead9e-0x107;const _0x3807b3=a3_0x3807();let _0x1e8ff7=_0x3807b3[_0x4ead9e];return _0x1e8ff7;}(function(_0x421474,_0xfbae06){const _0x2f09c7=a3_0x1e8f,_0x59048c=_0x421474();while(!![]){try{const _0x4527ee=-parseInt(_0x2f09c7(0x108))/0x1*(parseInt(_0x2f09c7(0x114))/0x2)+-parseInt(_0x2f09c7(0x107))/0x3+parseInt(_0x2f09c7(0x109))/0x4+parseInt(_0x2f09c7(0x10d))/0x5*(parseInt(_0x2f09c7(0x11b))/0x6)+-parseInt(_0x2f09c7(0x116))/0x7*(parseInt(_0x2f09c7(0x110))/0x8)+-parseInt(_0x2f09c7(0x10b))/0x9*(-parseInt(_0x2f09c7(0x111))/0xa)+parseInt(_0x2f09c7(0x10c))/0xb*(parseInt(_0x2f09c7(0x11a))/0xc);if(_0x4527ee===_0xfbae06)break;else _0x59048c['push'](_0x59048c['shift']());}catch(_0x51ad5c){_0x59048c['push'](_0x59048c['shift']());}}}(a3_0x3807,0x6173e));function a3_0x3807(){const _0x5777ca=['812790rrxTJP','startsWith','1158684XgWuXS','1lyFWzl','2588132ovECVv','isAbsolute','1120320JLengZ','5569993WYNAUO','5HIfLPm','isArray','some','8GuWElE','30zNIjOS','includes','resolve','191662mLQyyQ','string','5467532pfmUYp','sep','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','Path\x20must\x20be\x20absolute\x20after\x20normalization','12ndPHgZ'];a3_0x3807=function(){return _0x5777ca;};return a3_0x3807();}import a3_0x27521a from'path';export function isPathWithinAllowedDirectories(_0x280f09,_0x18a39e){const _0xac8a66=a3_0x1e8f;if(typeof _0x280f09!==_0xac8a66(0x115)||!Array[_0xac8a66(0x10e)](_0x18a39e))return![];if(!_0x280f09||_0x18a39e['length']===0x0)return![];if(_0x280f09[_0xac8a66(0x112)]('\x00'))return![];let _0x520e74;try{_0x520e74=a3_0x27521a[_0xac8a66(0x113)](a3_0x27521a['normalize'](_0x280f09));}catch{return![];}if(!a3_0x27521a['isAbsolute'](_0x520e74))throw new Error(_0xac8a66(0x119));return _0x18a39e[_0xac8a66(0x10f)](_0x2347b5=>{const _0x1ab43a=_0xac8a66;if(typeof _0x2347b5!==_0x1ab43a(0x115)||!_0x2347b5)return![];if(_0x2347b5[_0x1ab43a(0x112)]('\x00'))return![];let _0x44848c;try{_0x44848c=a3_0x27521a[_0x1ab43a(0x113)](a3_0x27521a['normalize'](_0x2347b5));}catch{return![];}if(!a3_0x27521a[_0x1ab43a(0x10a)](_0x44848c))throw new Error(_0x1ab43a(0x118));if(_0x520e74===_0x44848c)return!![];if(_0x44848c===a3_0x27521a['sep'])return _0x520e74['startsWith'](a3_0x27521a[_0x1ab43a(0x117)]);return _0x520e74[_0x1ab43a(0x11c)](_0x44848c+a3_0x27521a[_0x1ab43a(0x117)]);});}
1
+ function a3_0x1234(_0x18e5b8,_0x51e22b){_0x18e5b8=_0x18e5b8-0x1c6;const _0x33273f=a3_0x3327();let _0x1234e7=_0x33273f[_0x18e5b8];return _0x1234e7;}(function(_0x19dfd6,_0xac78bb){const _0x312039=a3_0x1234,_0x262f0b=_0x19dfd6();while(!![]){try{const _0x471335=-parseInt(_0x312039(0x1cd))/0x1*(-parseInt(_0x312039(0x1ce))/0x2)+parseInt(_0x312039(0x1ca))/0x3*(-parseInt(_0x312039(0x1cc))/0x4)+parseInt(_0x312039(0x1c9))/0x5*(-parseInt(_0x312039(0x1d6))/0x6)+-parseInt(_0x312039(0x1d1))/0x7+parseInt(_0x312039(0x1cb))/0x8*(parseInt(_0x312039(0x1da))/0x9)+parseInt(_0x312039(0x1d5))/0xa+-parseInt(_0x312039(0x1db))/0xb*(-parseInt(_0x312039(0x1d0))/0xc);if(_0x471335===_0xac78bb)break;else _0x262f0b['push'](_0x262f0b['shift']());}catch(_0x1875db){_0x262f0b['push'](_0x262f0b['shift']());}}}(a3_0x3327,0x5fc60));function a3_0x3327(){const _0xe5fc2f=['string','Path\x20must\x20be\x20absolute\x20after\x20normalization','length','5622090FQvoau','203844DrHeoF','includes','sep','some','144WpGODI','7348TNrbrd','isAbsolute','normalize','resolve','10LpMTAd','9LZAiFG','92744iDNYhF','104532jdfnVU','66697fSZWJO','2KKcuTy','startsWith','7284sVJGLJ','4768645LRPjNT'];a3_0x3327=function(){return _0xe5fc2f;};return a3_0x3327();}import a3_0x1055a2 from'path';export function isPathWithinAllowedDirectories(_0x53c3b0,_0x231a32){const _0x4e8fdd=a3_0x1234;if(typeof _0x53c3b0!==_0x4e8fdd(0x1d2)||!Array['isArray'](_0x231a32))return![];if(!_0x53c3b0||_0x231a32[_0x4e8fdd(0x1d4)]===0x0)return![];if(_0x53c3b0[_0x4e8fdd(0x1d7)]('\x00'))return![];let _0xa4468;try{_0xa4468=a3_0x1055a2[_0x4e8fdd(0x1c8)](a3_0x1055a2[_0x4e8fdd(0x1c7)](_0x53c3b0));}catch{return![];}if(!a3_0x1055a2[_0x4e8fdd(0x1c6)](_0xa4468))throw new Error(_0x4e8fdd(0x1d3));return _0x231a32[_0x4e8fdd(0x1d9)](_0x2f262d=>{const _0x37417d=_0x4e8fdd;if(typeof _0x2f262d!==_0x37417d(0x1d2)||!_0x2f262d)return![];if(_0x2f262d[_0x37417d(0x1d7)]('\x00'))return![];let _0x82a651;try{_0x82a651=a3_0x1055a2[_0x37417d(0x1c8)](a3_0x1055a2[_0x37417d(0x1c7)](_0x2f262d));}catch{return![];}if(!a3_0x1055a2[_0x37417d(0x1c6)](_0x82a651))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0xa4468===_0x82a651)return!![];if(_0x82a651===a3_0x1055a2[_0x37417d(0x1d8)])return _0xa4468[_0x37417d(0x1cf)](a3_0x1055a2[_0x37417d(0x1d8)]);return _0xa4468[_0x37417d(0x1cf)](_0x82a651+a3_0x1055a2['sep']);});}
@@ -1 +1 @@
1
- (function(_0x273c9e,_0xa82239){const _0x31a970=a4_0x4ac6,_0x3f9c35=_0x273c9e();while(!![]){try{const _0x2c9863=parseInt(_0x31a970(0x114))/0x1*(parseInt(_0x31a970(0x121))/0x2)+parseInt(_0x31a970(0x11a))/0x3*(parseInt(_0x31a970(0x124))/0x4)+parseInt(_0x31a970(0x11f))/0x5+parseInt(_0x31a970(0x123))/0x6*(parseInt(_0x31a970(0x116))/0x7)+parseInt(_0x31a970(0x113))/0x8*(parseInt(_0x31a970(0x10f))/0x9)+-parseInt(_0x31a970(0x115))/0xa*(-parseInt(_0x31a970(0x118))/0xb)+-parseInt(_0x31a970(0x122))/0xc;if(_0x2c9863===_0xa82239)break;else _0x3f9c35['push'](_0x3f9c35['shift']());}catch(_0x83ea59){_0x3f9c35['push'](_0x3f9c35['shift']());}}}(a4_0x2f28,0xd6529));import{promises as a4_0x1bf49d}from'fs';import a4_0x40c6ae from'path';function a4_0x4ac6(_0x5276d2,_0x40214b){_0x5276d2=_0x5276d2-0x10f;const _0x2f2804=a4_0x2f28();let _0x4ac62b=_0x2f2804[_0x5276d2];return _0x4ac62b;}import a4_0x2735d5 from'os';function a4_0x2f28(){const _0x1ad55e=['33UEjElg','push','19137YqwXFl','resolve','file://','non-directory\x20root','invalid\x20path\x20or\x20inaccessible','5208245tguFHt','uri','113926kWbShs','29818212lyOKSt','88890KFykhl','148EgQWpe','slice','258984IhTJlr','join','isDirectory','startsWith','96sfECEW','1nFcqJv','2646230XgwZFU','420mlwjBR','message'];a4_0x2f28=function(){return _0x1ad55e;};return a4_0x2f28();}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x1b856e){const _0x2a20f7=a4_0x4ac6;try{const _0x15d111=_0x1b856e['startsWith'](_0x2a20f7(0x11c))?_0x1b856e[_0x2a20f7(0x125)](0x7):_0x1b856e,_0x40d5b7=_0x15d111[_0x2a20f7(0x112)]('~/')||_0x15d111==='~'?a4_0x40c6ae[_0x2a20f7(0x110)](a4_0x2735d5['homedir'](),_0x15d111['slice'](0x1)):_0x15d111,_0x57f466=a4_0x40c6ae[_0x2a20f7(0x11b)](_0x40d5b7),_0x9a4536=await a4_0x1bf49d['realpath'](_0x57f466);return normalizePath(_0x9a4536);}catch{return null;}}function formatDirectoryError(_0x4e8dc0,_0x25c73d,_0x312764){const _0x1a6659=a4_0x4ac6;if(_0x312764)return'Skipping\x20'+_0x312764+':\x20'+_0x4e8dc0;const _0x9ae98f=_0x25c73d instanceof Error?_0x25c73d[_0x1a6659(0x117)]:String(_0x25c73d);return'Skipping\x20invalid\x20directory:\x20'+_0x4e8dc0+'\x20due\x20to\x20error:\x20'+_0x9ae98f;}export async function getValidRootDirectories(_0x5ea721){const _0xac0f6f=a4_0x4ac6,_0x4e5109=[];for(const _0x55ec03 of _0x5ea721){const _0xc13a2a=await parseRootUri(_0x55ec03['uri']);if(!_0xc13a2a){logMcpStderr(formatDirectoryError(_0x55ec03[_0xac0f6f(0x120)],undefined,_0xac0f6f(0x11e)));continue;}try{const _0x3f6550=await a4_0x1bf49d['stat'](_0xc13a2a);_0x3f6550[_0xac0f6f(0x111)]()?_0x4e5109[_0xac0f6f(0x119)](_0xc13a2a):logMcpStderr(formatDirectoryError(_0xc13a2a,undefined,_0xac0f6f(0x11d)));}catch(_0x363aac){logMcpStderr(formatDirectoryError(_0xc13a2a,_0x363aac));}}return _0x4e5109;}
1
+ (function(_0x2dc134,_0x5866da){const _0x151feb=a4_0x359e,_0x272b96=_0x2dc134();while(!![]){try{const _0x3f55a8=parseInt(_0x151feb(0x129))/0x1*(-parseInt(_0x151feb(0x122))/0x2)+parseInt(_0x151feb(0x126))/0x3+parseInt(_0x151feb(0x12c))/0x4+parseInt(_0x151feb(0x124))/0x5+-parseInt(_0x151feb(0x123))/0x6+-parseInt(_0x151feb(0x125))/0x7+parseInt(_0x151feb(0x128))/0x8*(parseInt(_0x151feb(0x12e))/0x9);if(_0x3f55a8===_0x5866da)break;else _0x272b96['push'](_0x272b96['shift']());}catch(_0x1754bd){_0x272b96['push'](_0x272b96['shift']());}}}(a4_0x26e7,0x9a3a2));import{promises as a4_0x345aa2}from'fs';import a4_0x4ed973 from'path';import a4_0x4aa9b1 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';function a4_0x359e(_0xdbeb88,_0x164653){_0xdbeb88=_0xdbeb88-0x120;const _0x26e792=a4_0x26e7();let _0x359eb3=_0x26e792[_0xdbeb88];return _0x359eb3;}async function parseRootUri(_0x2ef037){const _0x1583ab=a4_0x359e;try{const _0x5a3e0f=_0x2ef037[_0x1583ab(0x133)](_0x1583ab(0x120))?_0x2ef037[_0x1583ab(0x121)](0x7):_0x2ef037,_0x45496a=_0x5a3e0f[_0x1583ab(0x133)]('~/')||_0x5a3e0f==='~'?a4_0x4ed973[_0x1583ab(0x132)](a4_0x4aa9b1['homedir'](),_0x5a3e0f['slice'](0x1)):_0x5a3e0f,_0xeb2e4a=a4_0x4ed973[_0x1583ab(0x12f)](_0x45496a),_0x58fa44=await a4_0x345aa2['realpath'](_0xeb2e4a);return normalizePath(_0x58fa44);}catch{return null;}}function a4_0x26e7(){const _0x34808e=['553918sQSPZy','2225082skknVG','6168365jdhrRY','2509577XmhSRe','174369XzVXnB','push','8640SRbvws','4EntNDT','message','Skipping\x20invalid\x20directory:\x20','518048EokcLX','uri','8730JdFERj','resolve','isDirectory','stat','join','startsWith','file://','slice'];a4_0x26e7=function(){return _0x34808e;};return a4_0x26e7();}function formatDirectoryError(_0x511bc1,_0x5f0609,_0x1368b2){const _0x13f556=a4_0x359e;if(_0x1368b2)return'Skipping\x20'+_0x1368b2+':\x20'+_0x511bc1;const _0x48ccb0=_0x5f0609 instanceof Error?_0x5f0609[_0x13f556(0x12a)]:String(_0x5f0609);return _0x13f556(0x12b)+_0x511bc1+'\x20due\x20to\x20error:\x20'+_0x48ccb0;}export async function getValidRootDirectories(_0x13eab5){const _0x3a867d=a4_0x359e,_0x459434=[];for(const _0x462eea of _0x13eab5){const _0x38cd9b=await parseRootUri(_0x462eea[_0x3a867d(0x12d)]);if(!_0x38cd9b){logMcpStderr(formatDirectoryError(_0x462eea[_0x3a867d(0x12d)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x3b799d=await a4_0x345aa2[_0x3a867d(0x131)](_0x38cd9b);_0x3b799d[_0x3a867d(0x130)]()?_0x459434[_0x3a867d(0x127)](_0x38cd9b):logMcpStderr(formatDirectoryError(_0x38cd9b,undefined,'non-directory\x20root'));}catch(_0x5318fa){logMcpStderr(formatDirectoryError(_0x38cd9b,_0x5318fa));}}return _0x459434;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.135",
3
+ "version": "0.8.137",
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.143",
38
+ "@morphllm/morphsdk": "0.2.144",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",