@morphllm/morphmcp 0.8.151 → 0.8.152
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 +1 -1
- package/dist/log-utils.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x4156c2=a0_0x4280;(function(_0x3b4c4e,_0x4d93dd){const _0x30c2ee=a0_0x4280,_0x49e3f4=_0x3b4c4e();while(!![]){try{const _0x56cba8=-parseInt(_0x30c2ee(0x158))/0x1*(-parseInt(_0x30c2ee(0x15d))/0x2)+parseInt(_0x30c2ee(0x193))/0x3*(-parseInt(_0x30c2ee(0x175))/0x4)+-parseInt(_0x30c2ee(0x178))/0x5+-parseInt(_0x30c2ee(0x125))/0x6*(parseInt(_0x30c2ee(0x1f7))/0x7)+-parseInt(_0x30c2ee(0x176))/0x8*(-parseInt(_0x30c2ee(0x156))/0x9)+-parseInt(_0x30c2ee(0x11c))/0xa*(parseInt(_0x30c2ee(0x210))/0xb)+parseInt(_0x30c2ee(0x1a4))/0xc;if(_0x56cba8===_0x4d93dd)break;else _0x49e3f4['push'](_0x49e3f4['shift']());}catch(_0x2dddb3){_0x49e3f4['push'](_0x49e3f4['shift']());}}}(a0_0x2052,0xeecb2));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';function a0_0x4280(_0x9c0ce1,_0xe24550){_0x9c0ce1=_0x9c0ce1-0x10f;const _0x205212=a0_0x2052();let _0x4280d6=_0x205212[_0x9c0ce1];return _0x4280d6;}import a0_0x1447fd from'fs/promises';function a0_0x2052(){const _0x59f872=['Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','dryRun','dirname','MORPH_API_KEY','search_string','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','resolve','Warning:\x20','requiresApiKey','MORPH_WARP_GREP_TIMEOUT','description','timed\x20out','File\x20read\x20error:','linesAdded','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','unknown','user','\x20for:\x20\x22','7584010VFCpUu','-\x20Grepped\x20\x27','string','Failed\x20to\x20read\x20file:\x20','pattern','Preview\x20changes\x20without\x20applying\x20them.','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','\x22.\x20Known\x20tools:\x20','completed_with_file_errors','tool_calls','composer.json','\x20error(s)','\x27\x20in\x20`','floor','roots','0.2.0','Error\x20accessing\x20directory\x20','log','repo_path','sep','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','files','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','warn','ENOENT','79354TokSWO','-\x20Listed\x20directory\x20`','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','code','etimedout','Benefits:\x0a','utf-8','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','includes','Error\x20running\x20fast\x20context\x20search:\x20','readFile','@morphllm/morphmcp\x20','boolean','Here\x20is\x20the\x20content\x20of\x20files:\x0a','startsWith','stack','[codebase_search]\x20compaction\x20failed','metadata','[github_codebase_search]\x20Searching\x20','safeParse','WarpGrep\x20sub-tool\x20errors:\x20','code_edit','1630icyAkQ','env','constructor','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','.\x20Changes:\x20','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','stat','substring','6HigHiB','morph-warp-grep-v2.1','role','array','instructions','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','catch','https://morphllm.com/api/error-report','completed','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Disabled\x20tools:\x20','messages','push','Bearer\x20','describe','Cargo.toml','path','\x0a...\x20(truncated,\x20total:\x20','searchGitHub','listRoots','every','basename','read\x20','function','WORKSPACE_ROOT','join','list_directory\x20','lines','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','grep','pyproject.toml','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','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.','.cursor','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','number','-\x20Read\x20file\x20`','message','errors','arguments','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','default','\x20\x20morph-mcp','has',',\x20modified\x20','setRequestHandler','homedir','262422AXrxUZ','.\x20Path:\x20','40153YRflQD','glob','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.','ms:','some','24dfNnZh','instruction','finish','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','TimeoutError',',\x20removed\x20','timings','unknown\x20error','[could\x20not\x20read\x20file:\x20','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Specific\x20commit\x20hash\x20to\x20search','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','indexOf','mcp-filesystem','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','optional','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Unknown\x20error','grep_search','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','\x20disabled\x20via\x20DISABLED_TOOLS','application/json','44rsYhWw','424NtuYZo','codebase_search','433885rFutyS','api-key','Repository\x20identifier','data','all','ReadError','length','\x20-\x20','Tool\x20','success','WarpGrepError','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','UnknownError','--version','\x0a</file>','package.json','\x20(new\x20file)','now','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','exit','access','content','[github_codebase_search]\x20Failed\x20in\x20','FileReadError','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','edit_file','425349aHbdHc','error','Morph\x20Edit\x20Preview','read','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','parse','`\x20in\x20`','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','branch','map','toLowerCase','Error:\x20','list_directory','assistant','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','FileNotFound','min','34279080MUfMPk','source','-\x20Glob\x20search\x20`','tool','slice','\x22>\x0a','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','match','\x20valid\x20directories','Invalid\x20arguments:\x20','object','\x20is\x20not\x20a\x20directory','filter','text','glob\x20\x27','realpath','tool_call_id','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','Applied','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','<file\x20path=\x22','false','../package.json','Relevant\x20context\x20found:','trim','split','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','SubToolError','morph-v3-fast','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','name','Max\x20results\x20to\x20return','node_modules','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Rules:\x0a','oninitialized','SymlinkError','terminationReason','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','toISOString','.git','version','isArray','BinaryFile','❌\x20Morph\x20Edit\x20Failed:\x20','argv','\x20chars)','[github_codebase_search]\x20Done\x20in\x20','github_codebase_search','Tool\x20\x22','RipgrepError','isDirectory','payload','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','post','context','Fatal\x20error\x20running\x20server:','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','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','runWarpGrep_call','Created\x20File','DISABLED_TOOLS','timeout'];a0_0x2052=function(){return _0x59f872;};return a0_0x2052();}import a0_0x14f3ce from'path';import a0_0x4008c1 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{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x3ac5d5 from'axios';function fixPathRepetition(_0x1eb9a6){const _0x24266d=a0_0x4280,_0x2c16c8=_0x1eb9a6[_0x24266d(0x1be)](a0_0x14f3ce[_0x24266d(0x20a)])[_0x24266d(0x1b0)](Boolean);if(_0x2c16c8[_0x24266d(0x17e)]<0x2)return null;for(let _0x357651=Math[_0x24266d(0x204)](_0x2c16c8[_0x24266d(0x17e)]/0x2);_0x357651>=0x1;_0x357651--){for(let _0x33df63=0x0;_0x33df63<=_0x2c16c8[_0x24266d(0x17e)]-0x2*_0x357651;_0x33df63++){const _0x45d5ff=_0x2c16c8[_0x24266d(0x1a8)](_0x33df63,_0x33df63+_0x357651),_0xfe21f1=_0x2c16c8['slice'](_0x33df63+_0x357651,_0x33df63+0x2*_0x357651);if(_0x45d5ff[_0x24266d(0x139)]((_0x17d85b,_0x5298d6)=>_0x17d85b===_0xfe21f1[_0x5298d6])){const _0x21d648=[..._0x2c16c8[_0x24266d(0x1a8)](0x0,_0x33df63),..._0x2c16c8['slice'](_0x33df63+_0x357651)];return a0_0x14f3ce[_0x24266d(0x20a)]+_0x21d648[_0x24266d(0x13e)](a0_0x14f3ce[_0x24266d(0x20a)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xef69b9=a0_0x4280;try{const _0xe53463=require(_0xef69b9(0x1bb));return _0xe53463[_0xef69b9(0x1ce)]??_0xef69b9(0x1f4);}catch(_0x2eb3bf){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x2eb3bf),_0xef69b9(0x1f4);}}function printHelp(){const _0x5cd305=a0_0x4280;console[_0x5cd305(0x208)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x5cd305(0x208)](_0x5cd305(0x1da)),console[_0x5cd305(0x208)]('\x0aOptions:'),console[_0x5cd305(0x208)](_0x5cd305(0x1aa)),console['log'](_0x5cd305(0x172)),console[_0x5cd305(0x208)](_0x5cd305(0x147)),console[_0x5cd305(0x208)]('\x0aExamples:'),console['log'](_0x5cd305(0x151)),console['log'](_0x5cd305(0x1c6));}const cliArgs=process[a0_0x4156c2(0x1d2)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x4156c2(0x185),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x4156c2(0x15c)](_0x15d50f=>VERSION_FLAGS['has'](_0x15d50f))&&(console[a0_0x4156c2(0x208)](a0_0x4156c2(0x111)+getPackageVersion()),process[a0_0x4156c2(0x18c)](0x0));cliArgs[a0_0x4156c2(0x15c)](_0x526802=>HELP_FLAGS[a0_0x4156c2(0x152)](_0x526802))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x20be01){const _0x278ec0=a0_0x4156c2;for(let _0x4674d2=0x0;_0x4674d2<cliArgs[_0x278ec0(0x17e)];_0x4674d2++){const _0x48b8be=cliArgs[_0x4674d2];if(_0x48b8be[_0x278ec0(0x114)]('--'+_0x20be01+'='))return _0x48b8be[_0x278ec0(0x1a8)](('--'+_0x20be01+'=')[_0x278ec0(0x17e)]);if(_0x48b8be==='--'+_0x20be01&&_0x4674d2+0x1<cliArgs['length'])return cliArgs[_0x4674d2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x4156c2(0x17e)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4156c2(0x152)](arg)||HELP_FLAGS[a0_0x4156c2(0x152)](arg))continue;if(arg[a0_0x4156c2(0x114)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x13d)]||process[a0_0x4156c2(0x11d)]['PWD']||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x4156c2(0x11d)]['ENABLE_WORKSPACE_MODE']!==a0_0x4156c2(0x1ba),MORPH_API_KEY=getCliArg(a0_0x4156c2(0x179))??process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1e7)],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1ee)]?parseInt(process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1ee)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x4156c2(0x192),a0_0x4156c2(0x177),a0_0x4156c2(0x1d5)]),DISABLED_TOOLS=process['env'][a0_0x4156c2(0x1e2)]?new Set(process[a0_0x4156c2(0x11d)][a0_0x4156c2(0x1e2)][a0_0x4156c2(0x1be)](',')['map'](_0x1d83ea=>_0x1d83ea[a0_0x4156c2(0x1bd)]())['filter'](_0x5384bf=>_0x5384bf['length']>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x4156c2(0x152)](tool)&&console[a0_0x4156c2(0x194)](a0_0x4156c2(0x1b8)+tool+a0_0x4156c2(0x1fe)+[...KNOWN_TOOL_NAMES][a0_0x4156c2(0x13e)](',\x20'));}console['error'](a0_0x4156c2(0x12f)+[...DISABLED_TOOLS][a0_0x4156c2(0x13e)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x4156c2(0x114)]('sk-')&&!MORPH_API_KEY[a0_0x4156c2(0x114)]('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(_0x6571a5){const _0x3253a3=a0_0x4156c2;try{await a0_0x3ac5d5[_0x3253a3(0x1db)](_0x3253a3(0x12c),{..._0x6571a5,'timestamp':new Date()[_0x3253a3(0x1cc)](),'source':_0x6571a5[_0x3253a3(0x1a5)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x6571a5[_0x3253a3(0x1dc)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3253a3(0x174),'Authorization':_0x3253a3(0x132)+MORPH_API_KEY}});}catch{}}args[a0_0x4156c2(0x17e)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x4156c2(0x141)),logMcpStderr(a0_0x4156c2(0x11f)),logMcpStderr(a0_0x4156c2(0x183)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x4156c2(0x218)));function normalizePath(_0x58e25f){return a0_0x14f3ce['normalize'](_0x58e25f);}function expandHome(_0x31d7a4){const _0x58744f=a0_0x4156c2;if(_0x31d7a4[_0x58744f(0x114)]('~/')||_0x31d7a4==='~')return a0_0x14f3ce[_0x58744f(0x13e)](a0_0x4008c1[_0x58744f(0x155)](),_0x31d7a4[_0x58744f(0x1a8)](0x1));return _0x31d7a4;}let allowedDirectories=await Promise[a0_0x4156c2(0x17c)](args[a0_0x4156c2(0x19c)](async _0x3f6291=>{const _0xdad4dc=a0_0x4156c2,_0x4f912c=expandHome(_0x3f6291),_0x2e501a=a0_0x14f3ce['resolve'](_0x4f912c);try{const _0x2ed0e9=await a0_0x1447fd[_0xdad4dc(0x1b3)](_0x2e501a);return normalizePath(_0x2ed0e9);}catch(_0x4b5601){return normalizePath(_0x2e501a);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4156c2(0x17e)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4156c2(0x131)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x5c2791){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x5c2791);}async function detectWorkspaceRoot(_0x4bc802){const _0x3e15a1=a0_0x4156c2;let _0xc23afc=a0_0x14f3ce[_0x3e15a1(0x1eb)](_0x4bc802);const _0x1aff2f=[_0x3e15a1(0x1cd),'.vscode',_0x3e15a1(0x187),_0x3e15a1(0x134),_0x3e15a1(0x143),'go.mod',_0x3e15a1(0x146),'tsconfig.json',_0x3e15a1(0x201)];while(_0xc23afc!==a0_0x14f3ce[_0x3e15a1(0x1e6)](_0xc23afc)){for(const _0x232736 of _0x1aff2f){const _0x298411=a0_0x14f3ce[_0x3e15a1(0x13e)](_0xc23afc,_0x232736);try{return await a0_0x1447fd[_0x3e15a1(0x18d)](_0x298411),normalizePath(_0xc23afc);}catch{}}_0xc23afc=a0_0x14f3ce[_0x3e15a1(0x1e6)](_0xc23afc);}return normalizePath(_0x4bc802);}await Promise[a0_0x4156c2(0x17c)](args[a0_0x4156c2(0x19c)](async _0x4a1034=>{const _0x29809d=a0_0x4156c2;try{const _0x2088d7=await a0_0x1447fd[_0x29809d(0x123)](expandHome(_0x4a1034));!_0x2088d7[_0x29809d(0x1d8)]()&&(logMcpStderr(_0x29809d(0x19e)+_0x4a1034+_0x29809d(0x1af)),process[_0x29809d(0x18c)](0x1));}catch(_0x179fce){logMcpStderr(_0x29809d(0x207)+_0x4a1034+':',_0x179fce),process[_0x29809d(0x18c)](0x1);}}));async function validatePath(_0x214321){const _0xa01c0d=a0_0x4156c2,_0x9ade45=expandHome(_0x214321),_0x285745=a0_0x14f3ce[_0xa01c0d(0x1eb)](_0x9ade45);try{const _0x3ff01b=await a0_0x1447fd[_0xa01c0d(0x1b3)](_0x285745);return _0x3ff01b;}catch(_0x18468f){if(_0x18468f[_0xa01c0d(0x213)]===_0xa01c0d(0x20f)){const _0x19c2dd=a0_0x14f3ce['dirname'](_0x285745);try{const _0x1d1bd=await a0_0x1447fd['realpath'](_0x19c2dd);return a0_0x14f3ce['join'](_0x1d1bd,a0_0x14f3ce[_0xa01c0d(0x13a)](_0x285745));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x19c2dd);}}throw _0x18468f;}}const MorphEditFileArgsSchema=z[a0_0x4156c2(0x1ae)]({'path':z[a0_0x4156c2(0x1f9)](),'code_edit':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1e9)),'instruction':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x16f)),'dryRun':z[a0_0x4156c2(0x112)]()[a0_0x4156c2(0x150)](![])['describe'](a0_0x4156c2(0x1fc))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x4156c2(0x145),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1b5)),'search_type':z['enum'](['default','node_modules'])['optional']()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1e4))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x4156c2(0x1f9)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x4156c2(0x1f9)]()['optional']()[a0_0x4156c2(0x133)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1de)),'branch':z['string']()['optional']()[a0_0x4156c2(0x133)](a0_0x4156c2(0x12e))}),CodebaseSearchArgsSchema=z[a0_0x4156c2(0x1ae)]({'query':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x17a)),'branch':z['string']()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x1ea)),'commitHash':z[a0_0x4156c2(0x1f9)]()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x133)](a0_0x4156c2(0x169)),'targetDirectories':z[a0_0x4156c2(0x128)](z['string']())[a0_0x4156c2(0x150)]([])['describe'](a0_0x4156c2(0x1b7)),'limit':z[a0_0x4156c2(0x149)]()[a0_0x4156c2(0x16e)]()[a0_0x4156c2(0x150)](0xa)[a0_0x4156c2(0x133)](a0_0x4156c2(0x1c4))}),server=new Server({'name':'morph-mcp','version':a0_0x4156c2(0x206)},{'capabilities':{'tools':{}}});server[a0_0x4156c2(0x154)](ListToolsRequestSchema,async()=>{const _0x531cbe=a0_0x4156c2,_0x5105fc=[{'name':_0x531cbe(0x192),'description':_0x531cbe(0x1fd)+_0x531cbe(0x191)+_0x531cbe(0x1cb)+_0x531cbe(0x19a)+_0x531cbe(0x215)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x531cbe(0x161)+_0x531cbe(0x1bf)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x531cbe(0x167)+'For\x20deletions:\x0a'+_0x531cbe(0x120)+_0x531cbe(0x160)+_0x531cbe(0x1c7)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x531cbe(0x20d)+_0x531cbe(0x168)+_0x531cbe(0x18b)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+_0x531cbe(0x1c2)+_0x531cbe(0x20b),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x531cbe(0x177),'description':_0x531cbe(0x1df)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x531cbe(0x14f)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3abcdb=_0x5105fc[_0x531cbe(0x1b0)](_0x53941d=>{const _0x4ea788=_0x531cbe;if(DISABLED_TOOLS[_0x4ea788(0x152)](_0x53941d['name']))return console[_0x4ea788(0x194)](_0x4ea788(0x180)+_0x53941d['name']+_0x4ea788(0x173)),![];if(_0x4ea788(0x1ed)in _0x53941d&&_0x53941d['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x4ea788(0x1ec)+_0x53941d['name']+_0x4ea788(0x1a1)),![];return!![];});return{'tools':_0x3abcdb[_0x531cbe(0x19c)](_0x4b1d00=>({'name':_0x4b1d00['name'],'description':_0x4b1d00[_0x531cbe(0x1ef)],'inputSchema':_0x4b1d00['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x1cf084=>{const _0x23274c=a0_0x4156c2,{name:_0x275d4e,arguments:_0x33842c}=_0x1cf084['params'];try{if(DISABLED_TOOLS[_0x23274c(0x152)](_0x275d4e))throw new Error(_0x23274c(0x1d6)+_0x275d4e+'\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable');switch(_0x275d4e){case _0x23274c(0x192):{const _0x50c27c=_0x33842c&&typeof _0x33842c==='object'&&_0x23274c(0x129)in _0x33842c&&!(_0x23274c(0x15e)in _0x33842c)?{..._0x33842c,'instruction':_0x33842c[_0x23274c(0x129)],'instructions':undefined}:_0x33842c,_0x2c7a9d=MorphEditFileArgsSchema[_0x23274c(0x119)](_0x50c27c);if(!_0x2c7a9d[_0x23274c(0x181)])throw new Error(_0x23274c(0x148)+_0x2c7a9d[_0x23274c(0x194)]);const _0x38153a=await validatePath(_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x135)]);let _0x4adbad=null,_0x421468=!![],_0x30485d=null;try{_0x4adbad=await a0_0x1447fd[_0x23274c(0x110)](_0x38153a,_0x23274c(0x216));}catch(_0x1623cb){const _0x44ebd0=_0x1623cb[_0x23274c(0x213)];_0x44ebd0===_0x23274c(0x20f)?(_0x421468=![],_0x4adbad=''):(_0x30485d=_0x23274c(0x1fa)+(_0x44ebd0||_0x23274c(0x1f4))+_0x23274c(0x17f)+(_0x1623cb instanceof Error?_0x1623cb[_0x23274c(0x14b)]:String(_0x1623cb)),logMcpStderr(_0x23274c(0x1ec)+_0x30485d));}let _0x1c4392;try{const _0x55a3ba=MORPH_API_KEY;if(!_0x55a3ba)throw new Error(_0x23274c(0x212));const _0x3bcb9a=a0_0x14f3ce['dirname'](_0x38153a),_0xa1197b=a0_0x14f3ce['basename'](_0x38153a),_0x39f737=await executeEditFile({'target_filepath':_0xa1197b,'code_edit':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x11b)],'instruction':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x15e)]},{'morphApiKey':_0x55a3ba,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3bcb9a,'autoWrite':!_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)],'generateUdiff':![],'debug':![]});_0x1c4392=_0x39f737['completionId'];if(!_0x39f737[_0x23274c(0x181)])throw new Error(_0x39f737[_0x23274c(0x194)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x43c0e6=_0x39f737['changes'],_0x5ac8be='added\x20'+_0x43c0e6[_0x23274c(0x1f2)]+_0x23274c(0x163)+_0x43c0e6['linesRemoved']+_0x23274c(0x153)+_0x43c0e6['linesModified'];if(_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)])return{'content':[{'type':'text','text':_0x23274c(0x195)+(_0x421468?'':_0x23274c(0x188))+':\x20'+_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x15e)]+_0x23274c(0x121)+_0x5ac8be+_0x23274c(0x157)+_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x135)]+'.'}]};return{'content':[{'type':_0x23274c(0x1b1),'text':'Morph\x20Edit\x20'+(_0x421468?_0x23274c(0x1b6):_0x23274c(0x1e1))+':\x20'+_0x2c7a9d['data'][_0x23274c(0x15e)]+_0x23274c(0x121)+_0x5ac8be+_0x23274c(0x157)+_0x2c7a9d['data'][_0x23274c(0x135)]+'.'}]};}catch(_0x5e0a4a){const _0x206ef5=_0x5e0a4a instanceof Error?_0x5e0a4a[_0x23274c(0x14b)]:String(_0x5e0a4a);return reportMorphError({'error_message':_0x206ef5,'error_type':_0x5e0a4a instanceof Error?_0x5e0a4a['constructor'][_0x23274c(0x1c3)]:_0x23274c(0x184),'context':{'tool':_0x23274c(0x192),'completion_id':_0x1c4392,'file_path':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x135)],'validated_path':_0x38153a,'instruction':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x15e)],'model':_0x23274c(0x1c1),'dry_run':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)],'file_exists':_0x421468,'file_read_error':_0x30485d,'file_readable':_0x4adbad!==null,'request_content':{'path':_0x2c7a9d['data']['path'],'code_edit':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x11b)],'instruction':_0x2c7a9d[_0x23274c(0x17b)]['instruction'],'original_code':_0x4adbad!==null?_0x4adbad[_0x23274c(0x17e)]>0xc350?_0x4adbad['substring'](0x0,0xc350)+_0x23274c(0x136)+_0x4adbad['length']+_0x23274c(0x1d3):_0x4adbad:_0x23274c(0x166)+(_0x30485d||_0x23274c(0x165))+']','original_code_length':_0x4adbad?.['length']??0x0,'model':_0x23274c(0x1c1),'dry_run':_0x2c7a9d[_0x23274c(0x17b)][_0x23274c(0x1e5)]}},'stack_trace':_0x5e0a4a instanceof Error?_0x5e0a4a[_0x23274c(0x115)]:undefined,'source':_0x23274c(0x16c)})['catch'](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x1d1)+_0x206ef5}],'isError':!![]};}}case _0x23274c(0x177):{const _0x4219d1=WarpGrepArgsSchema[_0x23274c(0x119)](_0x33842c);if(!_0x4219d1['success'])return{'content':[{'type':'text','text':_0x23274c(0x1ad)+_0x4219d1[_0x23274c(0x194)]}],'isError':!![]};const _0x3351a7=_0x47b3de=>{const _0x54e1f0=_0x23274c,_0x10e8d2=[];for(const _0x466869 of _0x47b3de||[]){if(_0x466869[_0x54e1f0(0x127)]===_0x54e1f0(0x1a0)&&Array[_0x54e1f0(0x1cf)](_0x466869[_0x54e1f0(0x200)]))for(const _0x5ae960 of _0x466869[_0x54e1f0(0x200)]){try{const _0x1bd3aa=_0x5ae960[_0x54e1f0(0x13c)]?.[_0x54e1f0(0x1c3)],_0x293402=JSON[_0x54e1f0(0x198)](_0x5ae960['function']?.[_0x54e1f0(0x14d)]||'{}');if(_0x1bd3aa===_0x54e1f0(0x171))_0x10e8d2[_0x54e1f0(0x131)]('grep\x20\x27'+_0x293402[_0x54e1f0(0x1fb)]+'\x27\x20'+(_0x293402[_0x54e1f0(0x135)]||'.'));else{if(_0x1bd3aa===_0x54e1f0(0x196))_0x10e8d2['push'](_0x54e1f0(0x13b)+_0x293402['path']);else{if(_0x1bd3aa===_0x54e1f0(0x19f))_0x10e8d2[_0x54e1f0(0x131)](_0x54e1f0(0x13f)+(_0x293402['command']||'.'));else{if(_0x1bd3aa===_0x54e1f0(0x159))_0x10e8d2[_0x54e1f0(0x131)](_0x54e1f0(0x1b2)+_0x293402[_0x54e1f0(0x1fb)]+'\x27\x20'+(_0x293402[_0x54e1f0(0x135)]||'.'));else _0x1bd3aa===_0x54e1f0(0x15f)&&_0x10e8d2[_0x54e1f0(0x131)](_0x54e1f0(0x15f));}}}}catch{}}}return _0x10e8d2;},_0x58bddd=_0x41d8f2=>{const _0x15d023=_0x23274c,_0x1c6c98=[];if(!_0x41d8f2||!Array[_0x15d023(0x1cf)](_0x41d8f2))return _0x1c6c98;const _0x368f23=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x15d023(0x1a2),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x15d023(0x17d),'tool':_0x15d023(0x196)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x15d023(0x196)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x15d023(0x1d7),'tool':_0x15d023(0x142)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x15d023(0x142)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x15d023(0x1d0),'tool':_0x15d023(0x196)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x15d023(0x196)},{'pattern':/not a text file/,'error_type':_0x15d023(0x1d0),'tool':_0x15d023(0x196)},{'pattern':/symbolic link/,'error_type':_0x15d023(0x1c9),'tool':_0x15d023(0x196)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x15d023(0x196)},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x15d023(0x1f4)}];let _0x1b5f78=0x0;for(const _0x54fd2b of _0x41d8f2){_0x54fd2b[_0x15d023(0x127)]===_0x15d023(0x1a0)&&Array[_0x15d023(0x1cf)](_0x54fd2b[_0x15d023(0x200)])&&_0x1b5f78++;const _0x3baf2e=_0x54fd2b[_0x15d023(0x18e)];if((_0x54fd2b[_0x15d023(0x127)]===_0x15d023(0x1a7)||_0x54fd2b[_0x15d023(0x127)]===_0x15d023(0x1f5))&&_0x3baf2e&&typeof _0x3baf2e==='string')for(const {pattern:_0x4e789c,error_type:_0x5482cb,tool:_0x3b6b10}of _0x368f23){const _0x527c87=_0x3baf2e[_0x15d023(0x1ab)](new RegExp(_0x4e789c[_0x15d023(0x1a5)],'g'));if(_0x527c87)for(const _0x2f238e of _0x527c87){const _0x39c2f2=_0x3baf2e[_0x15d023(0x16b)](_0x2f238e),_0x1ed514=_0x3baf2e[_0x15d023(0x124)](_0x39c2f2,Math[_0x15d023(0x1a3)](_0x39c2f2+0xc8,_0x3baf2e[_0x15d023(0x17e)]));_0x1c6c98[_0x15d023(0x131)]({'tool':_0x3b6b10,'error_type':_0x5482cb,'error_message':_0x1ed514[_0x15d023(0x1be)]('\x0a')[0x0],'turn':_0x1b5f78});}}}return _0x1c6c98;};try{const _0x55ae8e=a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)]),_0x279a40=_0x4219d1[_0x23274c(0x17b)]['search_type'],_0x2c7ce0=_0x279a40===_0x23274c(0x1c5)?{'allowNames':[_0x23274c(0x1c5)]}:undefined,_0x13024d=new LocalRipgrepProvider(_0x55ae8e,undefined,_0x2c7ce0),_0x273a1a=await runWarpGrep({'searchTerm':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'repoRoot':_0x55ae8e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x13024d,'search_type':_0x279a40}),_0x3a1d00=_0x58bddd(_0x273a1a[_0x23274c(0x130)]);_0x3a1d00['length']>0x0&&reportMorphError({'error_message':_0x23274c(0x11a)+_0x3a1d00[_0x23274c(0x17e)]+_0x23274c(0x202),'error_type':_0x23274c(0x1c0),'level':_0x23274c(0x20e),'tool':_0x23274c(0x177),'context':{'repo_path':_0x4219d1['data'][_0x23274c(0x209)],'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'model':_0x23274c(0x126),'termination_reason':_0x273a1a[_0x23274c(0x1ca)],'sub_tool_errors':_0x3a1d00,'timings':_0x273a1a['timings'],'tool_calls':_0x3351a7(_0x273a1a[_0x23274c(0x130)]),'messages':_0x273a1a[_0x23274c(0x130)]?.[_0x23274c(0x19c)](_0x37c104=>({'role':_0x37c104[_0x23274c(0x127)],'content':_0x37c104[_0x23274c(0x18e)],..._0x37c104['tool_calls']?{'tool_calls':_0x37c104[_0x23274c(0x200)]['length']}:{},..._0x37c104[_0x23274c(0x1b4)]?{'tool_call_id':_0x37c104['tool_call_id']}:{}}))},'source':_0x23274c(0x16c)})[_0x23274c(0x12b)](()=>{});let _0x2d6f05='';if(_0x273a1a[_0x23274c(0x1ca)]===_0x23274c(0x12d)&&_0x273a1a[_0x23274c(0x15f)]?.['metadata']?.[_0x23274c(0x20c)]){const _0x2c7bd8=_0x273a1a['finish'][_0x23274c(0x117)][_0x23274c(0x20c)];if(_0x2c7bd8[_0x23274c(0x17e)]===0x0)return _0x2d6f05=_0x273a1a[_0x23274c(0x15f)][_0x23274c(0x1d9)]||_0x23274c(0x197),{'content':[{'type':'text','text':_0x2d6f05}]};const _0x18cfce=[],_0x4e8493=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x46f683 of _0x273a1a[_0x23274c(0x130)]){if(_0x46f683[_0x23274c(0x127)]===_0x23274c(0x1a0)&&Array[_0x23274c(0x1cf)](_0x46f683[_0x23274c(0x200)]))for(const _0x12c11c of _0x46f683[_0x23274c(0x200)]){try{const _0x24e00d=_0x12c11c['function']?.[_0x23274c(0x1c3)],_0x235b2b=JSON[_0x23274c(0x198)](_0x12c11c[_0x23274c(0x13c)]?.['arguments']||'{}');if(_0x24e00d===_0x23274c(0x171))_0x4e8493[_0x23274c(0x131)](_0x23274c(0x1f8)+_0x235b2b[_0x23274c(0x1fb)]+_0x23274c(0x203)+(_0x235b2b[_0x23274c(0x135)]||'.')+'`');else{if(_0x24e00d==='read')_0x4e8493[_0x23274c(0x131)](_0x23274c(0x14a)+_0x235b2b[_0x23274c(0x135)]+'`');else{if(_0x24e00d==='list_directory')_0x4e8493[_0x23274c(0x131)](_0x23274c(0x211)+(_0x235b2b['command']||'.')+'`');else _0x24e00d===_0x23274c(0x159)&&_0x4e8493[_0x23274c(0x131)](_0x23274c(0x1a6)+_0x235b2b['pattern']+_0x23274c(0x199)+(_0x235b2b['path']||'.')+'`');}}}catch{}}}_0x18cfce[_0x23274c(0x131)](_0x4e8493['join']('\x0a'));const _0x3fe4e6=['',_0x23274c(0x1bc)];for(const _0x5e4248 of _0x2c7bd8){if(_0x5e4248[_0x23274c(0x140)]==='*')_0x3fe4e6[_0x23274c(0x131)]('-\x20'+_0x5e4248[_0x23274c(0x135)]+':*');else{if(Array[_0x23274c(0x1cf)](_0x5e4248['lines'])){const _0x43d4b9=_0x5e4248[_0x23274c(0x140)][_0x23274c(0x19c)](([_0x322744,_0x3b527d])=>{if(_0x322744===_0x3b527d)return''+_0x322744;return _0x322744+'-'+_0x3b527d;});_0x3fe4e6[_0x23274c(0x131)]('-\x20'+_0x5e4248[_0x23274c(0x135)]+':'+_0x43d4b9['join'](','));}else _0x3fe4e6[_0x23274c(0x131)]('-\x20'+_0x5e4248[_0x23274c(0x135)]+':*');}}_0x3fe4e6['push'](''),_0x18cfce['push'](_0x3fe4e6['join']('\x0a')),_0x18cfce['push'](_0x23274c(0x113));const _0x117a52=[],_0x30d0ab=[];for(const _0xcb6027 of _0x2c7bd8){let _0x10a978=a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1['data']['repo_path'],_0xcb6027['path']),_0xb87f76=null,_0x1deca9=null;try{_0xb87f76=await a0_0x1447fd[_0x23274c(0x110)](_0x10a978,{'encoding':'utf-8'});}catch(_0x3b90cd){const _0x7ffcbc=fixPathRepetition(_0x10a978);if(_0x7ffcbc)try{_0xb87f76=await a0_0x1447fd[_0x23274c(0x110)](_0x7ffcbc,{'encoding':_0x23274c(0x216)}),_0x10a978=_0x7ffcbc;}catch{_0x1deca9=_0x3b90cd instanceof Error?_0x3b90cd:new Error(String(_0x3b90cd));}else _0x1deca9=_0x3b90cd instanceof Error?_0x3b90cd:new Error(String(_0x3b90cd));}if(_0xb87f76!==null){const _0x5ebe84=_0xb87f76['split'](/\r?\n/),_0x15fca8=[];if(_0xcb6027['lines']==='*'||!Array[_0x23274c(0x1cf)](_0xcb6027['lines']))for(let _0x3cacf4=0x1;_0x3cacf4<=_0x5ebe84[_0x23274c(0x17e)];_0x3cacf4++){const _0x3aa996=_0x5ebe84[_0x3cacf4-0x1];_0x15fca8[_0x23274c(0x131)](_0x3cacf4+'|\x20'+_0x3aa996);}else for(const [_0x5df4c5,_0x507c3b]of _0xcb6027[_0x23274c(0x140)]){_0x15fca8[_0x23274c(0x17e)]>0x0&&_0x15fca8['push']('');for(let _0x41b39a=_0x5df4c5;_0x41b39a<=_0x507c3b&&_0x41b39a<=_0x5ebe84['length'];_0x41b39a++){const _0x28573a=_0x5ebe84[_0x41b39a-0x1];_0x15fca8[_0x23274c(0x131)](_0x41b39a+'|\x20'+_0x28573a);}}_0x30d0ab['push']({'path':_0xcb6027[_0x23274c(0x135)],'content':_0x15fca8[_0x23274c(0x13e)]('\x0a')});}else _0x117a52[_0x23274c(0x131)](_0x23274c(0x1b9)+_0xcb6027[_0x23274c(0x135)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x1deca9?.[_0x23274c(0x14b)]||_0x23274c(0x170))+_0x23274c(0x186));}try{const _0x3b3ade=await compactFileContexts(_0x30d0ab,_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],MORPH_API_KEY,MORPH_API_URL);for(const _0x178a97 of _0x3b3ade){_0x117a52['push'](_0x23274c(0x1b9)+_0x178a97[_0x23274c(0x135)]+_0x23274c(0x1a9)+_0x178a97[_0x23274c(0x18e)]+'\x0a</file>');}}catch(_0x376666){console['error'](_0x23274c(0x116),_0x376666);for(const _0x413d7a of _0x30d0ab){_0x117a52['push'](_0x23274c(0x1b9)+_0x413d7a[_0x23274c(0x135)]+_0x23274c(0x1a9)+_0x413d7a[_0x23274c(0x18e)]+'\x0a</file>');}}_0x18cfce[_0x23274c(0x131)](_0x117a52[_0x23274c(0x13e)]('\x0a\x0a')),_0x2d6f05=_0x18cfce[_0x23274c(0x13e)]('\x0a');const _0x4023ee=_0x273a1a['errors']?.['filter'](_0x2d93fd=>_0x2d93fd[_0x23274c(0x14b)]?.['startsWith'](_0x23274c(0x1f1)))||[];if(_0x4023ee['length']>0x0){const _0x275c1a=_0x4023ee['map'](_0x1f81fb=>_0x1f81fb['message'])[_0x23274c(0x13e)](';\x20');reportMorphError({'error_message':_0x275c1a,'error_type':_0x23274c(0x190),'context':{'tool':'codebase_search','repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'query':_0x4219d1['data'][_0x23274c(0x1e8)],'model':_0x23274c(0x126),'termination_reason':_0x23274c(0x1ff),'error_count':_0x4023ee[_0x23274c(0x17e)],'is_timeout':![],'timings':_0x273a1a[_0x23274c(0x164)],'files_attempted':_0x2c7bd8[_0x23274c(0x19c)](_0xa153be=>({'path':_0xa153be[_0x23274c(0x135)],'lines':_0xa153be[_0x23274c(0x140)]})),'tool_calls':_0x3351a7(_0x273a1a[_0x23274c(0x130)]),'messages':_0x273a1a[_0x23274c(0x130)]?.[_0x23274c(0x19c)](_0x258a86=>({'role':_0x258a86['role'],'content':_0x258a86[_0x23274c(0x18e)],..._0x258a86[_0x23274c(0x200)]?{'tool_calls':_0x258a86[_0x23274c(0x200)]['length']}:{},..._0x258a86[_0x23274c(0x1b4)]?{'tool_call_id':_0x258a86['tool_call_id']}:{}})),'request_content':{'query':_0x4219d1['data'][_0x23274c(0x1e8)],'repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'repoRoot':a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1['data'][_0x23274c(0x209)]),'model':_0x23274c(0x126)}},'source':_0x23274c(0x16c)})['catch'](()=>{});}}else{if(_0x273a1a['terminationReason']==='terminated'&&_0x273a1a[_0x23274c(0x14c)][_0x23274c(0x17e)]>0x0){const _0x5639f4=_0x273a1a[_0x23274c(0x14c)][_0x23274c(0x19c)](_0x119eec=>_0x119eec['message'])[_0x23274c(0x13e)](';\x20');_0x2d6f05=_0x23274c(0x19e)+_0x5639f4;const _0x334203=_0x5639f4[_0x23274c(0x19d)]()[_0x23274c(0x219)](_0x23274c(0x1e3))||_0x5639f4[_0x23274c(0x19d)]()['includes'](_0x23274c(0x1f0))||_0x5639f4['toLowerCase']()['includes'](_0x23274c(0x214)),_0x185edb=_0x273a1a[_0x23274c(0x15f)]?.[_0x23274c(0x117)]?.['files'],_0x2912ac=_0x273a1a[_0x23274c(0x14c)][0x0];reportMorphError({'error_message':_0x5639f4,'error_type':_0x334203?'TimeoutError':_0x2912ac?.['constructor']?.[_0x23274c(0x1c3)]||_0x23274c(0x182),'context':{'tool':_0x23274c(0x177),'repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'model':_0x23274c(0x126),'termination_reason':_0x273a1a[_0x23274c(0x1ca)],'error_count':_0x273a1a[_0x23274c(0x14c)][_0x23274c(0x17e)],'is_timeout':_0x334203,'timings':_0x273a1a[_0x23274c(0x164)],'files_attempted':_0x185edb?.[_0x23274c(0x19c)](_0x551fca=>({'path':_0x551fca[_0x23274c(0x135)],'lines':_0x551fca[_0x23274c(0x140)]})),'tool_calls':_0x3351a7(_0x273a1a[_0x23274c(0x130)]),'messages':_0x273a1a[_0x23274c(0x130)]?.[_0x23274c(0x19c)](_0x1c8f15=>({'role':_0x1c8f15[_0x23274c(0x127)],'content':_0x1c8f15[_0x23274c(0x18e)],..._0x1c8f15[_0x23274c(0x200)]?{'tool_calls':_0x1c8f15[_0x23274c(0x200)][_0x23274c(0x17e)]}:{},..._0x1c8f15[_0x23274c(0x1b4)]?{'tool_call_id':_0x1c8f15[_0x23274c(0x1b4)]}:{}})),'request_content':{'query':_0x4219d1['data'][_0x23274c(0x1e8)],'repo_path':_0x4219d1['data']['repo_path'],'repoRoot':a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)]),'model':_0x23274c(0x126)}},'stack_trace':_0x2912ac?.[_0x23274c(0x115)]||undefined,'source':_0x23274c(0x16c)})[_0x23274c(0x12b)](()=>{});}else _0x2d6f05=_0x23274c(0x122);}return{'content':[{'type':'text','text':_0x2d6f05}]};}catch(_0x25ddf4){const _0x133338=_0x25ddf4 instanceof Error?_0x25ddf4[_0x23274c(0x14b)]:String(_0x25ddf4),_0x781a6a=_0x133338[_0x23274c(0x19d)]()[_0x23274c(0x219)](_0x23274c(0x1e3))||_0x133338[_0x23274c(0x19d)]()['includes'](_0x23274c(0x1f0))||_0x133338[_0x23274c(0x19d)]()[_0x23274c(0x219)](_0x23274c(0x214))||_0x25ddf4 instanceof Error&&_0x25ddf4[_0x23274c(0x1c3)]===_0x23274c(0x162);return reportMorphError({'error_message':_0x133338,'error_type':_0x781a6a?'TimeoutError':_0x25ddf4 instanceof Error?_0x25ddf4[_0x23274c(0x11e)]['name']:_0x23274c(0x184),'context':{'tool':_0x23274c(0x177),'repo_path':_0x4219d1[_0x23274c(0x17b)]['repo_path'],'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'model':'morph-warp-grep-v2.1','is_timeout':_0x781a6a,'exception_phase':_0x23274c(0x1e0),'request_content':{'query':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'repo_path':_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)],'repoRoot':a0_0x14f3ce[_0x23274c(0x1eb)](_0x4219d1[_0x23274c(0x17b)][_0x23274c(0x209)]),'model':_0x23274c(0x126)}},'stack_trace':_0x25ddf4 instanceof Error?_0x25ddf4[_0x23274c(0x115)]:undefined,'source':'mcp-filesystem'})[_0x23274c(0x12b)](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x10f)+_0x133338}],'isError':![]};}}case _0x23274c(0x1d5):{const _0x1140b1=WarpGrepGitHubArgsSchema[_0x23274c(0x119)](_0x33842c);if(!_0x1140b1[_0x23274c(0x181)])return{'content':[{'type':'text','text':_0x23274c(0x1ad)+_0x1140b1[_0x23274c(0x194)]}],'isError':!![]};const _0x294ced=_0x1140b1[_0x23274c(0x17b)]['github_url']||_0x1140b1[_0x23274c(0x17b)]['owner_repo'];if(!_0x294ced)return{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x12a)}],'isError':!![]};const _0x1a7df1=MORPH_API_KEY;if(!_0x1a7df1)throw new Error(_0x23274c(0x212));const _0x2ac8f9=Date[_0x23274c(0x189)]();logMcpStderr(_0x23274c(0x118)+_0x294ced+_0x23274c(0x1f6)+_0x1140b1[_0x23274c(0x17b)][_0x23274c(0x1e8)]+'\x22');try{const _0x5d59f4=new WarpGrepClient({'morphApiKey':_0x1a7df1,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x278ecf=await _0x5d59f4[_0x23274c(0x137)]({'searchTerm':_0x1140b1[_0x23274c(0x17b)][_0x23274c(0x1e8)],'github':_0x294ced,'branch':_0x1140b1[_0x23274c(0x17b)][_0x23274c(0x19b)]}),_0x30cde6=Date['now']()-_0x2ac8f9;logMcpStderr(_0x23274c(0x1d4)+_0x30cde6+'ms.\x20Success:\x20'+_0x278ecf[_0x23274c(0x181)]);const _0x1fc184=formatResult(_0x278ecf);return{'content':[{'type':_0x23274c(0x1b1),'text':_0x1fc184}]};}catch(_0x175549){const _0x44e5c1=Date[_0x23274c(0x189)]()-_0x2ac8f9,_0x564a83=_0x175549 instanceof Error?_0x175549[_0x23274c(0x14b)]:String(_0x175549);return logMcpStderr(_0x23274c(0x18f)+_0x44e5c1+_0x23274c(0x15b),_0x564a83),reportMorphError({'error_message':_0x564a83,'error_type':_0x175549 instanceof Error?_0x175549['constructor'][_0x23274c(0x1c3)]:_0x23274c(0x184),'context':{'tool':_0x23274c(0x1d5),'github_url':_0x294ced,'search_string':_0x1140b1[_0x23274c(0x17b)]['search_string'],'branch':_0x1140b1[_0x23274c(0x17b)]['branch']},'stack_trace':_0x175549 instanceof Error?_0x175549[_0x23274c(0x115)]:undefined,'source':'mcp-filesystem','tool':_0x23274c(0x1d5),'latency_ms':_0x44e5c1})[_0x23274c(0x12b)](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':'GitHub\x20search\x20failed:\x20'+_0x564a83}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x275d4e);}}catch(_0x11a753){const _0x27d613=_0x11a753 instanceof Error?_0x11a753['message']:String(_0x11a753);return reportMorphError({'error_message':_0x27d613,'error_type':_0x11a753 instanceof Error?_0x11a753[_0x23274c(0x11e)]['name']:'UnknownError','context':{'tool':_0x275d4e,'arguments':_0x33842c?JSON['stringify'](_0x33842c)[_0x23274c(0x124)](0x0,0x1f4):undefined,'mcp_server_version':_0x23274c(0x206)},'stack_trace':_0x11a753 instanceof Error?_0x11a753[_0x23274c(0x115)]:undefined,'source':'mcp-filesystem'})[_0x23274c(0x12b)](()=>{}),{'content':[{'type':_0x23274c(0x1b1),'text':_0x23274c(0x19e)+_0x27d613}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x540fe8){const _0x5c57ea=a0_0x4156c2,_0x309028=await getValidRootDirectories(_0x540fe8);if(_0x309028['length']>0x0)allowedDirectories=[..._0x309028],logMcpStderr(_0x5c57ea(0x16a)+_0x309028[_0x5c57ea(0x17e)]+_0x5c57ea(0x1ac));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x15be26=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x15be26&&(allowedDirectories=[_0x15be26],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x15be26));}catch(_0x2b816c){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2b816c);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x36db49=a0_0x4156c2;try{const _0x34523c=await server[_0x36db49(0x138)]();_0x34523c&&_0x36db49(0x205)in _0x34523c&&await updateAllowedDirectoriesFromRoots(_0x34523c[_0x36db49(0x205)]);}catch(_0x569399){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x569399 instanceof Error?_0x569399[_0x36db49(0x14b)]:String(_0x569399));}}),server[a0_0x4156c2(0x1c8)]=async()=>{const _0x5c7ceb=a0_0x4156c2,_0x39b417=server['getClientCapabilities']();if(_0x39b417?.[_0x5c7ceb(0x205)])try{const _0x28ced7=await server[_0x5c7ceb(0x138)]();_0x28ced7&&_0x5c7ceb(0x205)in _0x28ced7?await updateAllowedDirectoriesFromRoots(_0x28ced7['roots']):logMcpStderr(_0x5c7ceb(0x14e));}catch(_0x22c70e){logMcpStderr(_0x5c7ceb(0x1f3),_0x22c70e instanceof Error?_0x22c70e[_0x5c7ceb(0x14b)]:String(_0x22c70e));}else{if(allowedDirectories[_0x5c7ceb(0x17e)]>0x0)logMcpStderr(_0x5c7ceb(0x16d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5c7ceb(0x18a));else throw new Error(_0x5c7ceb(0x15a));}}};async function runServer(){const _0x127d86=a0_0x4156c2,_0x5787e6=new StdioServerTransport();await server['connect'](_0x5787e6),logMcpStderr(_0x127d86(0x217)),allowedDirectories[_0x127d86(0x17e)]===0x0&&logMcpStderr(_0x127d86(0x144));}runServer()[a0_0x4156c2(0x12b)](_0x313bf0=>{const _0x167beb=a0_0x4156c2;logMcpStderr(_0x167beb(0x1dd),_0x313bf0),process[_0x167beb(0x18c)](0x1);});
|
|
2
|
+
const a0_0x553a3a=a0_0x2765;(function(_0x240d28,_0x258483){const _0x55fe07=a0_0x2765,_0x43adc7=_0x240d28();while(!![]){try{const _0x5ed4a6=parseInt(_0x55fe07(0x1e4))/0x1*(parseInt(_0x55fe07(0x14f))/0x2)+-parseInt(_0x55fe07(0x22f))/0x3*(parseInt(_0x55fe07(0x200))/0x4)+parseInt(_0x55fe07(0x231))/0x5+parseInt(_0x55fe07(0x132))/0x6*(-parseInt(_0x55fe07(0x143))/0x7)+-parseInt(_0x55fe07(0x21d))/0x8*(-parseInt(_0x55fe07(0x21e))/0x9)+-parseInt(_0x55fe07(0x203))/0xa+-parseInt(_0x55fe07(0x19e))/0xb*(-parseInt(_0x55fe07(0x230))/0xc);if(_0x5ed4a6===_0x258483)break;else _0x43adc7['push'](_0x43adc7['shift']());}catch(_0x12d146){_0x43adc7['push'](_0x43adc7['shift']());}}}(a0_0x4b51,0x8880b));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_0x16a0fb from'fs/promises';import a0_0x48e43f from'path';import a0_0x2760a4 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{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x115047 from'axios';function fixPathRepetition(_0x195e0f){const _0x4f7891=a0_0x2765,_0x1b79c2=_0x195e0f[_0x4f7891(0x128)](a0_0x48e43f[_0x4f7891(0x179)])[_0x4f7891(0x1b8)](Boolean);if(_0x1b79c2[_0x4f7891(0x167)]<0x2)return null;for(let _0x4df550=Math['floor'](_0x1b79c2[_0x4f7891(0x167)]/0x2);_0x4df550>=0x1;_0x4df550--){for(let _0x515c2e=0x0;_0x515c2e<=_0x1b79c2['length']-0x2*_0x4df550;_0x515c2e++){const _0x10b514=_0x1b79c2[_0x4f7891(0x22d)](_0x515c2e,_0x515c2e+_0x4df550),_0x3c999a=_0x1b79c2[_0x4f7891(0x22d)](_0x515c2e+_0x4df550,_0x515c2e+0x2*_0x4df550);if(_0x10b514[_0x4f7891(0x1c7)]((_0x60b6a8,_0x5d004f)=>_0x60b6a8===_0x3c999a[_0x5d004f])){const _0x4f0749=[..._0x1b79c2[_0x4f7891(0x22d)](0x0,_0x515c2e),..._0x1b79c2[_0x4f7891(0x22d)](_0x515c2e+_0x4df550)];return a0_0x48e43f[_0x4f7891(0x179)]+_0x4f0749[_0x4f7891(0x176)](a0_0x48e43f[_0x4f7891(0x179)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x3108d9=a0_0x2765;try{const _0x56911c=require(_0x3108d9(0x121));return _0x56911c['version']??_0x3108d9(0x227);}catch(_0x1f5775){return logMcpStderr(_0x3108d9(0x232),_0x1f5775),_0x3108d9(0x227);}}function printHelp(){const _0x2d069f=a0_0x2765;console['log'](_0x2d069f(0x161)+getPackageVersion()),console['log'](_0x2d069f(0x182)),console[_0x2d069f(0x1e1)](_0x2d069f(0x17b)),console['log'](_0x2d069f(0x133)),console[_0x2d069f(0x1e1)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x2d069f(0x1e1)](_0x2d069f(0x1ad)),console['log']('\x0aExamples:'),console['log'](_0x2d069f(0x1c1)),console[_0x2d069f(0x1e1)](_0x2d069f(0x138));}const cliArgs=process[a0_0x553a3a(0x12f)]['slice'](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x553a3a(0x1a0),'-h']);cliArgs[a0_0x553a3a(0x210)](_0x138acb=>VERSION_FLAGS['has'](_0x138acb))&&(console[a0_0x553a3a(0x1e1)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x38942c=>HELP_FLAGS[a0_0x553a3a(0x202)](_0x38942c))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x1029fd){const _0x2f0244=a0_0x553a3a;for(let _0x4ae86c=0x0;_0x4ae86c<cliArgs[_0x2f0244(0x167)];_0x4ae86c++){const _0x1981de=cliArgs[_0x4ae86c];if(_0x1981de['startsWith']('--'+_0x1029fd+'='))return _0x1981de[_0x2f0244(0x22d)](('--'+_0x1029fd+'=')['length']);if(_0x1981de==='--'+_0x1029fd&&_0x4ae86c+0x1<cliArgs[_0x2f0244(0x167)])return cliArgs[_0x4ae86c+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x553a3a(0x167)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x553a3a(0x202)](arg)||HELP_FLAGS[a0_0x553a3a(0x202)](arg))continue;if(arg[a0_0x553a3a(0x225)](a0_0x553a3a(0x141)))continue;if(arg===a0_0x553a3a(0x11d)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x553a3a(0x1f7)][a0_0x553a3a(0x191)]||process[a0_0x553a3a(0x1f7)]['PWD']||process[a0_0x553a3a(0x1a8)](),ENABLE_WORKSPACE_MODE=process[a0_0x553a3a(0x1f7)][a0_0x553a3a(0x1d1)]!==a0_0x553a3a(0x189),MORPH_API_KEY=getCliArg(a0_0x553a3a(0x193))??process[a0_0x553a3a(0x1f7)][a0_0x553a3a(0x1a7)],MORPH_API_URL=process['env'][a0_0x553a3a(0x16a)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x553a3a(0x1f7)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x553a3a(0x1f7)][a0_0x553a3a(0x151)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x553a3a(0x159),a0_0x553a3a(0x192),a0_0x553a3a(0x1b5)]),DISABLED_TOOLS=process[a0_0x553a3a(0x1f7)]['DISABLED_TOOLS']?new Set(process[a0_0x553a3a(0x1f7)][a0_0x553a3a(0x1ff)][a0_0x553a3a(0x128)](',')[a0_0x553a3a(0x18a)](_0x489519=>_0x489519['trim']())[a0_0x553a3a(0x1b8)](_0x11c3d9=>_0x11c3d9['length']>0x0)):new Set();function a0_0x4b51(){const _0x2ad713=['.vscode','Fatal\x20error\x20running\x20server:','function','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','messages','context','4124703uoqORC','Relevant\x20context\x20found:','--help','etimedout','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','toISOString','Workspace\x20mode\x20enabled:\x20Using\x20','morph-v3-fast','-\x20Grepped\x20\x27','MORPH_API_KEY','cwd','sk-','ms.\x20Success:\x20','Failed\x20to\x20read\x20file:\x20','For\x20deletions:\x0a','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Applied','dryRun','Tool\x20\x22','user','description','Parent\x20directory\x20does\x20not\x20exist:\x20','github_codebase_search','BinaryFile','success','filter','isDirectory','.\x20Changes:\x20','\x22.\x20Known\x20tools:\x20','File\x20read\x20error:','readFile','timeout','error','grep_search','\x20\x20morph-mcp','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','metadata','string','.cursor','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','every','\x20is\x20not\x20a\x20directory','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','❌\x20Morph\x20Edit\x20Failed:\x20','go.mod','basename','ReadError','role','completed_with_file_errors','code','ENABLE_WORKSPACE_MODE','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','message','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','`\x20in\x20`','safeParse','all','listRoots','resolve','completionId','tool_call_id','\x27\x20in\x20`','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','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','\x20as\x20allowed\x20directory','read','log',',\x20removed\x20','number','1WVXBOg','timed\x20out','Morph\x20Edit\x20Preview','morph-warp-grep-v2.1','list_directory\x20','normalize','data','.git','Invalid\x20arguments:\x20','warn','tool_calls','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','object','source','\x20disabled\x20via\x20DISABLED_TOOLS','assistant','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','text','env','connect','mcp-filesystem','branch','name','content','\x20error(s)','describe','DISABLED_TOOLS','124BSnyDN','FileReadError','has','4142340JGajGr','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','added\x20','isArray','<file\x20path=\x22','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.','\x20-\x20','roots','default','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','parse','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','application/json','some','\x20chars)','Cargo.toml','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','array','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','timings',',\x20modified\x20','owner_repo','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','.\x20Path:\x20','utf-8','34096GClXWx','1548dQUwcz','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','dirname','-\x20Glob\x20search\x20`','realpath','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','toLowerCase','startsWith','search_string','unknown','getClientCapabilities','Error\x20running\x20fast\x20context\x20search:\x20','command','Specific\x20commit\x20hash\x20to\x20search','arguments','slice','completed','82854nFNfVO','24KSXsTZ','2268770xDXvnX','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','boolean','https://morphllm.com/api/error-report','constructor','substring','--api-key','Disabled\x20tools:\x20','TimeoutError','repo_path','../package.json','SymlinkError','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','WarpGrepError','inputSchema','size','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','split','PathError','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','now','setRequestHandler','searchGitHub','match','argv','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','78azFTHd','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','homedir','Warning:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','0.2.0','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','stat','RipgrepError','tool','stack','Error:\x20','read\x20','--api-key=','catch','286755BJTLXr','pattern','WarpGrep\x20sub-tool\x20errors:\x20','search_type','\x0a</file>','Max\x20results\x20to\x20return','\x0a...\x20(truncated,\x20total:\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','path','setNotificationHandler','UnknownError','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','850576SCohxX','\x20(new\x20file)','MORPH_WARP_GREP_TIMEOUT','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','morph-','\x22>\x0a','Rules:\x0a','code_edit','Preview\x20changes\x20without\x20applying\x20them.','Repository\x20identifier','edit_file','FileNotFound','changes','\x22>\x0aError\x20reading\x20file:\x20','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.','errors','requiresApiKey','instruction','@morphllm/morphmcp\x20','Unknown\x20error','min','finish','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','enum','length','[github_codebase_search]\x20Done\x20in\x20','list_directory','MORPH_API_URL','package.json','-\x20Listed\x20directory\x20`','github_url','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','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','lines','[could\x20not\x20read\x20file:\x20','terminationReason','push','SubToolError','post','join','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','files','sep','Here\x20is\x20the\x20content\x20of\x20files:\x0a','\x0aOptions:','Warning:\x20Workspace\x20fallback\x20failed:\x20','node_modules','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','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.','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','grep','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','ENOENT','optional','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','GitHub\x20search\x20failed:\x20','ms:','false','map','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','tsconfig.json','[github_codebase_search]\x20Failed\x20in\x20','linesRemoved','glob\x20\x27','includes','WORKSPACE_ROOT','codebase_search','api-key','Created\x20File','stringify','terminated','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'];a0_0x4b51=function(){return _0x2ad713;};return a0_0x4b51();}if(DISABLED_TOOLS[a0_0x553a3a(0x126)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x553a3a(0x1bf)](a0_0x553a3a(0x204)+tool+a0_0x553a3a(0x1bb)+[...KNOWN_TOOL_NAMES][a0_0x553a3a(0x176)](',\x20'));}console['error'](a0_0x553a3a(0x11e)+[...DISABLED_TOOLS][a0_0x553a3a(0x176)](',\x20'));}function a0_0x2765(_0xb9c9ba,_0x557d57){_0xb9c9ba=_0xb9c9ba-0x11a;const _0x4b51f7=a0_0x4b51();let _0x276504=_0x4b51f7[_0xb9c9ba];return _0x276504;}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x553a3a(0x225)](a0_0x553a3a(0x1a9))&&!MORPH_API_KEY[a0_0x553a3a(0x225)](a0_0x553a3a(0x153))&&logMcpStderr(a0_0x553a3a(0x1d2));async function reportMorphError(_0x58372d){const _0x5865e0=a0_0x553a3a;try{await a0_0x115047[_0x5865e0(0x175)](_0x5865e0(0x11a),{..._0x58372d,'timestamp':new Date()[_0x5865e0(0x1a3)](),'source':_0x58372d['source']||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x58372d[_0x5865e0(0x19d)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x5865e0(0x20f),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x553a3a(0x1c2)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x37a049){const _0x4b7d14=a0_0x553a3a;return a0_0x48e43f[_0x4b7d14(0x1e9)](_0x37a049);}function expandHome(_0x41eb7b){const _0x250dd3=a0_0x553a3a;if(_0x41eb7b[_0x250dd3(0x225)]('~/')||_0x41eb7b==='~')return a0_0x48e43f[_0x250dd3(0x176)](a0_0x2760a4[_0x250dd3(0x135)](),_0x41eb7b[_0x250dd3(0x22d)](0x1));return _0x41eb7b;}let allowedDirectories=await Promise[a0_0x553a3a(0x1d7)](args['map'](async _0x4f9220=>{const _0x53c921=a0_0x553a3a,_0x281e59=expandHome(_0x4f9220),_0x21501c=a0_0x48e43f[_0x53c921(0x1d9)](_0x281e59);try{const _0x3165be=await a0_0x16a0fb['realpath'](_0x21501c);return normalizePath(_0x3165be);}catch(_0x318b1f){return normalizePath(_0x21501c);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x553a3a(0x167)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x553a3a(0x173)](workspaceDir),logMcpStderr(a0_0x553a3a(0x1a4)+workspaceDir+a0_0x553a3a(0x1df)));}catch(a0_0x3dc50c){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x3dc50c);}async function detectWorkspaceRoot(_0x3dcb66){const _0x5eeb93=a0_0x553a3a;let _0x12e8ed=a0_0x48e43f[_0x5eeb93(0x1d9)](_0x3dcb66);const _0xf6b1d7=[_0x5eeb93(0x1eb),_0x5eeb93(0x198),_0x5eeb93(0x16b),_0x5eeb93(0x212),'pyproject.toml',_0x5eeb93(0x1cb),_0x5eeb93(0x1c5),_0x5eeb93(0x18c),'composer.json'];while(_0x12e8ed!==a0_0x48e43f[_0x5eeb93(0x220)](_0x12e8ed)){for(const _0x28d860 of _0xf6b1d7){const _0x3fc3e9=a0_0x48e43f['join'](_0x12e8ed,_0x28d860);try{return await a0_0x16a0fb['access'](_0x3fc3e9),normalizePath(_0x12e8ed);}catch{}}_0x12e8ed=a0_0x48e43f[_0x5eeb93(0x220)](_0x12e8ed);}return normalizePath(_0x3dcb66);}await Promise['all'](args['map'](async _0x58a329=>{const _0x528acc=a0_0x553a3a;try{const _0xe66c90=await a0_0x16a0fb[_0x528acc(0x13b)](expandHome(_0x58a329));!_0xe66c90[_0x528acc(0x1b9)]()&&(logMcpStderr('Error:\x20'+_0x58a329+_0x528acc(0x1c8)),process['exit'](0x1));}catch(_0x64a0cf){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x58a329+':',_0x64a0cf),process['exit'](0x1);}}));async function validatePath(_0x176617){const _0x48eddf=a0_0x553a3a,_0x24f016=expandHome(_0x176617),_0x350407=a0_0x48e43f['resolve'](_0x24f016);try{const _0x299222=await a0_0x16a0fb[_0x48eddf(0x222)](_0x350407);return _0x299222;}catch(_0x14635e){if(_0x14635e[_0x48eddf(0x1d0)]==='ENOENT'){const _0x54791c=a0_0x48e43f['dirname'](_0x350407);try{const _0x482cfc=await a0_0x16a0fb[_0x48eddf(0x222)](_0x54791c);return a0_0x48e43f[_0x48eddf(0x176)](_0x482cfc,a0_0x48e43f[_0x48eddf(0x1cc)](_0x350407));}catch{throw new Error(_0x48eddf(0x1b4)+_0x54791c);}}throw _0x14635e;}}const MorphEditFileArgsSchema=z[a0_0x553a3a(0x1f0)]({'path':z[a0_0x553a3a(0x1c4)](),'code_edit':z[a0_0x553a3a(0x1c4)]()['describe'](a0_0x553a3a(0x233)),'instruction':z[a0_0x553a3a(0x1c4)]()['describe'](a0_0x553a3a(0x130)),'dryRun':z[a0_0x553a3a(0x234)]()[a0_0x553a3a(0x20b)](![])[a0_0x553a3a(0x1fe)](a0_0x553a3a(0x157))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x553a3a(0x208),WarpGrepArgsSchema=z[a0_0x553a3a(0x1f0)]({'search_string':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x1fe)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x1fe)](a0_0x553a3a(0x1de)),'search_type':z[a0_0x553a3a(0x166)]([a0_0x553a3a(0x20b),a0_0x553a3a(0x17d)])[a0_0x553a3a(0x185)]()[a0_0x553a3a(0x1fe)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x553a3a(0x1f0)]({'search_string':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x1fe)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x185)]()[a0_0x553a3a(0x1fe)](a0_0x553a3a(0x15d)),'owner_repo':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x185)]()[a0_0x553a3a(0x1fe)](a0_0x553a3a(0x223)),'branch':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x185)]()['describe'](a0_0x553a3a(0x14e))}),CodebaseSearchArgsSchema=z[a0_0x553a3a(0x1f0)]({'query':z['string']()[a0_0x553a3a(0x1fe)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x553a3a(0x1fe)](a0_0x553a3a(0x158)),'branch':z['string']()[a0_0x553a3a(0x185)]()['describe'](a0_0x553a3a(0x19b)),'commitHash':z[a0_0x553a3a(0x1c4)]()[a0_0x553a3a(0x185)]()['describe'](a0_0x553a3a(0x22b)),'targetDirectories':z[a0_0x553a3a(0x214)](z[a0_0x553a3a(0x1c4)]())[a0_0x553a3a(0x20b)]([])[a0_0x553a3a(0x1fe)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x553a3a(0x1e3)]()[a0_0x553a3a(0x185)]()[a0_0x553a3a(0x20b)](0xa)[a0_0x553a3a(0x1fe)](a0_0x553a3a(0x148))}),server=new Server({'name':'morph-mcp','version':a0_0x553a3a(0x139)},{'capabilities':{'tools':{}}});server[a0_0x553a3a(0x12c)](ListToolsRequestSchema,async()=>{const _0x3d5a4b=a0_0x553a3a,_0x629512=[{'name':_0x3d5a4b(0x159),'description':_0x3d5a4b(0x197)+_0x3d5a4b(0x17e)+_0x3d5a4b(0x186)+_0x3d5a4b(0x1f4)+'Benefits:\x0a'+_0x3d5a4b(0x177)+_0x3d5a4b(0x1d4)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x3d5a4b(0x123)+_0x3d5a4b(0x21a)+_0x3d5a4b(0x20c)+_0x3d5a4b(0x131)+_0x3d5a4b(0x1ac)+_0x3d5a4b(0x134)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x3d5a4b(0x155)+_0x3d5a4b(0x21f)+_0x3d5a4b(0x14a)+_0x3d5a4b(0x152)+_0x3d5a4b(0x12a)+_0x3d5a4b(0x20e)+_0x3d5a4b(0x18b)+_0x3d5a4b(0x1dd),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x3d5a4b(0x192),'description':_0x3d5a4b(0x16f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3d5a4b(0x1c6)+_0x3d5a4b(0x165)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x2165ad=_0x629512['filter'](_0x354899=>{const _0x435842=_0x3d5a4b;if(DISABLED_TOOLS[_0x435842(0x202)](_0x354899[_0x435842(0x1fb)]))return console['error']('Tool\x20'+_0x354899[_0x435842(0x1fb)]+_0x435842(0x1f2)),![];if(_0x435842(0x15f)in _0x354899&&_0x354899[_0x435842(0x15f)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x354899[_0x435842(0x1fb)]+_0x435842(0x1f5)),![];return!![];});return{'tools':_0x2165ad['map'](_0x5159c7=>({'name':_0x5159c7[_0x3d5a4b(0x1fb)],'description':_0x5159c7[_0x3d5a4b(0x1b3)],'inputSchema':_0x5159c7[_0x3d5a4b(0x125)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x50801b=>{const _0x37f499=a0_0x553a3a,{name:_0x450a55,arguments:_0x45d79c}=_0x50801b['params'];try{if(DISABLED_TOOLS['has'](_0x450a55))throw new Error(_0x37f499(0x1b1)+_0x450a55+_0x37f499(0x16e));switch(_0x450a55){case _0x37f499(0x159):{const _0x334f07=_0x45d79c&&typeof _0x45d79c===_0x37f499(0x1f0)&&'instructions'in _0x45d79c&&!(_0x37f499(0x160)in _0x45d79c)?{..._0x45d79c,'instruction':_0x45d79c['instructions'],'instructions':undefined}:_0x45d79c,_0x2eeea3=MorphEditFileArgsSchema['safeParse'](_0x334f07);if(!_0x2eeea3['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x2eeea3[_0x37f499(0x1bf)]);const _0xf92cf3=await validatePath(_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x14b)]);let _0x26c327=null,_0x34717f=!![],_0x2f87dd=null;try{_0x26c327=await a0_0x16a0fb[_0x37f499(0x1bd)](_0xf92cf3,'utf-8');}catch(_0x161335){const _0x3d2085=_0x161335[_0x37f499(0x1d0)];_0x3d2085===_0x37f499(0x184)?(_0x34717f=![],_0x26c327=''):(_0x2f87dd=_0x37f499(0x1ab)+(_0x3d2085||_0x37f499(0x227))+_0x37f499(0x209)+(_0x161335 instanceof Error?_0x161335[_0x37f499(0x1d3)]:String(_0x161335)),logMcpStderr(_0x37f499(0x136)+_0x2f87dd));}let _0x571974;try{const _0x19282b=MORPH_API_KEY;if(!_0x19282b)throw new Error(_0x37f499(0x213));const _0x12ad63=a0_0x48e43f[_0x37f499(0x220)](_0xf92cf3),_0x145f77=a0_0x48e43f[_0x37f499(0x1cc)](_0xf92cf3),_0x25111d=await executeEditFile({'target_filepath':_0x145f77,'code_edit':_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x156)],'instruction':_0x2eeea3[_0x37f499(0x1ea)]['instruction']},{'morphApiKey':_0x19282b,'morphApiUrl':MORPH_API_URL,'baseDir':_0x12ad63,'autoWrite':!_0x2eeea3[_0x37f499(0x1ea)]['dryRun'],'generateUdiff':![],'debug':![]});_0x571974=_0x25111d[_0x37f499(0x1da)];if(!_0x25111d[_0x37f499(0x1b7)])throw new Error(_0x25111d[_0x37f499(0x1bf)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x3adc5f=_0x25111d[_0x37f499(0x15b)],_0x250415=_0x37f499(0x205)+_0x3adc5f['linesAdded']+_0x37f499(0x1e2)+_0x3adc5f[_0x37f499(0x18e)]+_0x37f499(0x217)+_0x3adc5f['linesModified'];if(_0x2eeea3['data'][_0x37f499(0x1b0)])return{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x1e6)+(_0x34717f?'':_0x37f499(0x150))+':\x20'+_0x2eeea3['data'][_0x37f499(0x160)]+_0x37f499(0x1ba)+_0x250415+_0x37f499(0x21b)+_0x2eeea3[_0x37f499(0x1ea)]['path']+'.'}]};return{'content':[{'type':'text','text':'Morph\x20Edit\x20'+(_0x34717f?_0x37f499(0x1af):_0x37f499(0x194))+':\x20'+_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x160)]+_0x37f499(0x1ba)+_0x250415+_0x37f499(0x21b)+_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x14b)]+'.'}]};}catch(_0x5beb47){const _0x4427c4=_0x5beb47 instanceof Error?_0x5beb47[_0x37f499(0x1d3)]:String(_0x5beb47);return reportMorphError({'error_message':_0x4427c4,'error_type':_0x5beb47 instanceof Error?_0x5beb47[_0x37f499(0x11b)][_0x37f499(0x1fb)]:_0x37f499(0x14d),'context':{'tool':_0x37f499(0x159),'completion_id':_0x571974,'file_path':_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x14b)],'validated_path':_0xf92cf3,'instruction':_0x2eeea3['data'][_0x37f499(0x160)],'model':_0x37f499(0x1a5),'dry_run':_0x2eeea3['data'][_0x37f499(0x1b0)],'file_exists':_0x34717f,'file_read_error':_0x2f87dd,'file_readable':_0x26c327!==null,'request_content':{'path':_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x14b)],'code_edit':_0x2eeea3[_0x37f499(0x1ea)]['code_edit'],'instruction':_0x2eeea3[_0x37f499(0x1ea)][_0x37f499(0x160)],'original_code':_0x26c327!==null?_0x26c327[_0x37f499(0x167)]>0xc350?_0x26c327[_0x37f499(0x11c)](0x0,0xc350)+_0x37f499(0x149)+_0x26c327[_0x37f499(0x167)]+_0x37f499(0x211):_0x26c327:_0x37f499(0x171)+(_0x2f87dd||'unknown\x20error')+']','original_code_length':_0x26c327?.[_0x37f499(0x167)]??0x0,'model':_0x37f499(0x1a5),'dry_run':_0x2eeea3['data'][_0x37f499(0x1b0)]}},'stack_trace':_0x5beb47 instanceof Error?_0x5beb47[_0x37f499(0x13e)]:undefined,'source':'mcp-filesystem'})[_0x37f499(0x142)](()=>{}),{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x1ca)+_0x4427c4}],'isError':!![]};}}case _0x37f499(0x192):{const _0x27de95=WarpGrepArgsSchema[_0x37f499(0x1d6)](_0x45d79c);if(!_0x27de95[_0x37f499(0x1b7)])return{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x1ec)+_0x27de95[_0x37f499(0x1bf)]}],'isError':!![]};const _0x391c1=_0x2ec8f7=>{const _0x173bc3=_0x37f499,_0x357de2=[];for(const _0x3ba175 of _0x2ec8f7||[]){if(_0x3ba175[_0x173bc3(0x1ce)]===_0x173bc3(0x1f3)&&Array[_0x173bc3(0x206)](_0x3ba175['tool_calls']))for(const _0x3f0d7d of _0x3ba175[_0x173bc3(0x1ee)]){try{const _0x331ec7=_0x3f0d7d[_0x173bc3(0x19a)]?.[_0x173bc3(0x1fb)],_0x1936b6=JSON[_0x173bc3(0x20d)](_0x3f0d7d[_0x173bc3(0x19a)]?.[_0x173bc3(0x22c)]||'{}');if(_0x331ec7===_0x173bc3(0x1c0))_0x357de2['push']('grep\x20\x27'+_0x1936b6[_0x173bc3(0x144)]+'\x27\x20'+(_0x1936b6[_0x173bc3(0x14b)]||'.'));else{if(_0x331ec7==='read')_0x357de2[_0x173bc3(0x173)](_0x173bc3(0x140)+_0x1936b6[_0x173bc3(0x14b)]);else{if(_0x331ec7===_0x173bc3(0x169))_0x357de2['push'](_0x173bc3(0x1e8)+(_0x1936b6[_0x173bc3(0x22a)]||'.'));else{if(_0x331ec7==='glob')_0x357de2[_0x173bc3(0x173)](_0x173bc3(0x18f)+_0x1936b6[_0x173bc3(0x144)]+'\x27\x20'+(_0x1936b6[_0x173bc3(0x14b)]||'.'));else _0x331ec7===_0x173bc3(0x164)&&_0x357de2[_0x173bc3(0x173)](_0x173bc3(0x164));}}}}catch{}}}return _0x357de2;},_0x2be59b=_0x54e7a9=>{const _0x2cfcdf=_0x37f499,_0x214717=[];if(!_0x54e7a9||!Array[_0x2cfcdf(0x206)](_0x54e7a9))return _0x214717;const _0x50fe3b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2cfcdf(0x15a),'tool':_0x2cfcdf(0x1e0)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x2cfcdf(0x129),'tool':_0x2cfcdf(0x1e0)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x2cfcdf(0x1e0)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2cfcdf(0x1b6),'tool':_0x2cfcdf(0x1e0)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2cfcdf(0x13c),'tool':_0x2cfcdf(0x181)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x2cfcdf(0x181)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2cfcdf(0x1b6),'tool':_0x2cfcdf(0x1e0)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x2cfcdf(0x1e0)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x2cfcdf(0x1e0)},{'pattern':/symbolic link/,'error_type':_0x2cfcdf(0x122),'tool':_0x2cfcdf(0x1e0)},{'pattern':/Error reading file:/,'error_type':_0x2cfcdf(0x1cd),'tool':_0x2cfcdf(0x1e0)},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x2cfcdf(0x227)}];let _0x3733d4=0x0;for(const _0x54acb0 of _0x54e7a9){_0x54acb0[_0x2cfcdf(0x1ce)]==='assistant'&&Array[_0x2cfcdf(0x206)](_0x54acb0[_0x2cfcdf(0x1ee)])&&_0x3733d4++;const _0xac5aca=_0x54acb0['content'];if((_0x54acb0[_0x2cfcdf(0x1ce)]===_0x2cfcdf(0x13d)||_0x54acb0['role']===_0x2cfcdf(0x1b2))&&_0xac5aca&&typeof _0xac5aca===_0x2cfcdf(0x1c4))for(const {pattern:_0x1fff2f,error_type:_0x20a9e4,tool:_0x49ced6}of _0x50fe3b){const _0x20b6d6=_0xac5aca[_0x2cfcdf(0x12e)](new RegExp(_0x1fff2f[_0x2cfcdf(0x1f1)],'g'));if(_0x20b6d6)for(const _0x5beaac of _0x20b6d6){const _0x42b7f2=_0xac5aca['indexOf'](_0x5beaac),_0x3dc011=_0xac5aca[_0x2cfcdf(0x11c)](_0x42b7f2,Math[_0x2cfcdf(0x163)](_0x42b7f2+0xc8,_0xac5aca['length']));_0x214717[_0x2cfcdf(0x173)]({'tool':_0x49ced6,'error_type':_0x20a9e4,'error_message':_0x3dc011[_0x2cfcdf(0x128)]('\x0a')[0x0],'turn':_0x3733d4});}}}return _0x214717;};try{const _0x5d8d98=a0_0x48e43f[_0x37f499(0x1d9)](_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)]),_0x511fb8=_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x146)],_0x41fbeb=_0x511fb8===_0x37f499(0x17d)?{'allowNames':[_0x37f499(0x17d)]}:undefined,_0x1b0ef2=new LocalRipgrepProvider(_0x5d8d98,undefined,_0x41fbeb),_0x1212ae=await runWarpGrep({'searchTerm':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x226)],'repoRoot':_0x5d8d98,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1b0ef2,'search_type':_0x511fb8}),_0x7cce17=_0x2be59b(_0x1212ae['messages']);_0x7cce17[_0x37f499(0x167)]>0x0&&reportMorphError({'error_message':_0x37f499(0x145)+_0x7cce17[_0x37f499(0x167)]+_0x37f499(0x1fd),'error_type':_0x37f499(0x174),'level':_0x37f499(0x1ed),'tool':_0x37f499(0x192),'context':{'repo_path':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)],'query':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x226)],'model':_0x37f499(0x1e7),'termination_reason':_0x1212ae[_0x37f499(0x172)],'sub_tool_errors':_0x7cce17,'timings':_0x1212ae[_0x37f499(0x216)],'tool_calls':_0x391c1(_0x1212ae[_0x37f499(0x19c)]),'messages':_0x1212ae[_0x37f499(0x19c)]?.[_0x37f499(0x18a)](_0x2bcfe9=>({'role':_0x2bcfe9[_0x37f499(0x1ce)],'content':_0x2bcfe9[_0x37f499(0x1fc)],..._0x2bcfe9['tool_calls']?{'tool_calls':_0x2bcfe9[_0x37f499(0x1ee)]['length']}:{},..._0x2bcfe9[_0x37f499(0x1db)]?{'tool_call_id':_0x2bcfe9[_0x37f499(0x1db)]}:{}}))},'source':_0x37f499(0x1f9)})[_0x37f499(0x142)](()=>{});let _0x2b61a5='';if(_0x1212ae['terminationReason']===_0x37f499(0x22e)&&_0x1212ae['finish']?.['metadata']?.['files']){const _0xe5f17f=_0x1212ae[_0x37f499(0x164)][_0x37f499(0x1c3)]['files'];if(_0xe5f17f['length']===0x0)return _0x2b61a5=_0x1212ae[_0x37f499(0x164)]['payload']||_0x37f499(0x219),{'content':[{'type':_0x37f499(0x1f6),'text':_0x2b61a5}]};const _0x37fb51=[],_0x2ad60d=[_0x37f499(0x215)];for(const _0x17b61e of _0x1212ae[_0x37f499(0x19c)]){if(_0x17b61e[_0x37f499(0x1ce)]===_0x37f499(0x1f3)&&Array[_0x37f499(0x206)](_0x17b61e['tool_calls']))for(const _0x9a2ce0 of _0x17b61e['tool_calls']){try{const _0x300265=_0x9a2ce0[_0x37f499(0x19a)]?.[_0x37f499(0x1fb)],_0x35342c=JSON['parse'](_0x9a2ce0[_0x37f499(0x19a)]?.[_0x37f499(0x22c)]||'{}');if(_0x300265===_0x37f499(0x1c0))_0x2ad60d['push'](_0x37f499(0x1a6)+_0x35342c[_0x37f499(0x144)]+_0x37f499(0x1dc)+(_0x35342c['path']||'.')+'`');else{if(_0x300265===_0x37f499(0x1e0))_0x2ad60d[_0x37f499(0x173)]('-\x20Read\x20file\x20`'+_0x35342c[_0x37f499(0x14b)]+'`');else{if(_0x300265===_0x37f499(0x169))_0x2ad60d[_0x37f499(0x173)](_0x37f499(0x16c)+(_0x35342c['command']||'.')+'`');else _0x300265==='glob'&&_0x2ad60d[_0x37f499(0x173)](_0x37f499(0x221)+_0x35342c['pattern']+_0x37f499(0x1d5)+(_0x35342c[_0x37f499(0x14b)]||'.')+'`');}}}catch{}}}_0x37fb51[_0x37f499(0x173)](_0x2ad60d[_0x37f499(0x176)]('\x0a'));const _0x503f40=['',_0x37f499(0x19f)];for(const _0x176459 of _0xe5f17f){if(_0x176459['lines']==='*')_0x503f40[_0x37f499(0x173)]('-\x20'+_0x176459['path']+':*');else{if(Array[_0x37f499(0x206)](_0x176459[_0x37f499(0x170)])){const _0x2ab743=_0x176459[_0x37f499(0x170)][_0x37f499(0x18a)](([_0x3d68e8,_0x45bee0])=>{if(_0x3d68e8===_0x45bee0)return''+_0x3d68e8;return _0x3d68e8+'-'+_0x45bee0;});_0x503f40[_0x37f499(0x173)]('-\x20'+_0x176459['path']+':'+_0x2ab743[_0x37f499(0x176)](','));}else _0x503f40[_0x37f499(0x173)]('-\x20'+_0x176459[_0x37f499(0x14b)]+':*');}}_0x503f40[_0x37f499(0x173)](''),_0x37fb51['push'](_0x503f40['join']('\x0a')),_0x37fb51[_0x37f499(0x173)](_0x37f499(0x17a));const _0x29e400=[],_0x4f6ef8=[];for(const _0x40dd48 of _0xe5f17f){let _0x5c07a2=a0_0x48e43f[_0x37f499(0x1d9)](_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)],_0x40dd48[_0x37f499(0x14b)]),_0x382f1b=null,_0x44bf02=null;try{_0x382f1b=await a0_0x16a0fb[_0x37f499(0x1bd)](_0x5c07a2,{'encoding':'utf-8'});}catch(_0x2e682d){const _0x3e191a=fixPathRepetition(_0x5c07a2);if(_0x3e191a)try{_0x382f1b=await a0_0x16a0fb['readFile'](_0x3e191a,{'encoding':_0x37f499(0x21c)}),_0x5c07a2=_0x3e191a;}catch{_0x44bf02=_0x2e682d instanceof Error?_0x2e682d:new Error(String(_0x2e682d));}else _0x44bf02=_0x2e682d instanceof Error?_0x2e682d:new Error(String(_0x2e682d));}if(_0x382f1b!==null){const _0x806285=_0x382f1b['split'](/\r?\n/),_0x407381=[];if(_0x40dd48['lines']==='*'||!Array['isArray'](_0x40dd48['lines']))for(let _0x5b2563=0x1;_0x5b2563<=_0x806285[_0x37f499(0x167)];_0x5b2563++){const _0x59799e=_0x806285[_0x5b2563-0x1];_0x407381[_0x37f499(0x173)](_0x5b2563+'|\x20'+_0x59799e);}else for(const [_0x529a66,_0x2ab45b]of _0x40dd48['lines']){_0x407381[_0x37f499(0x167)]>0x0&&_0x407381[_0x37f499(0x173)]('');for(let _0x59c892=_0x529a66;_0x59c892<=_0x2ab45b&&_0x59c892<=_0x806285['length'];_0x59c892++){const _0x2f65a7=_0x806285[_0x59c892-0x1];_0x407381['push'](_0x59c892+'|\x20'+_0x2f65a7);}}_0x4f6ef8[_0x37f499(0x173)]({'path':_0x40dd48[_0x37f499(0x14b)],'content':_0x407381[_0x37f499(0x176)]('\x0a')});}else _0x29e400[_0x37f499(0x173)](_0x37f499(0x207)+_0x40dd48[_0x37f499(0x14b)]+_0x37f499(0x15c)+(_0x44bf02?.['message']||_0x37f499(0x162))+'\x0a</file>');}try{const _0x196608=await compactFileContexts(_0x4f6ef8,_0x27de95[_0x37f499(0x1ea)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x237654 of _0x196608){_0x29e400[_0x37f499(0x173)](_0x37f499(0x207)+_0x237654[_0x37f499(0x14b)]+_0x37f499(0x154)+_0x237654[_0x37f499(0x1fc)]+_0x37f499(0x147));}}catch(_0x3503ba){console[_0x37f499(0x1bf)]('[codebase_search]\x20compaction\x20failed',_0x3503ba);for(const _0x1b84fd of _0x4f6ef8){_0x29e400[_0x37f499(0x173)](_0x37f499(0x207)+_0x1b84fd[_0x37f499(0x14b)]+'\x22>\x0a'+_0x1b84fd[_0x37f499(0x1fc)]+_0x37f499(0x147));}}_0x37fb51['push'](_0x29e400[_0x37f499(0x176)]('\x0a\x0a')),_0x2b61a5=_0x37fb51[_0x37f499(0x176)]('\x0a');const _0x32ac31=_0x1212ae[_0x37f499(0x15e)]?.['filter'](_0x2b795e=>_0x2b795e[_0x37f499(0x1d3)]?.['startsWith'](_0x37f499(0x1bc)))||[];if(_0x32ac31[_0x37f499(0x167)]>0x0){const _0xbc3c42=_0x32ac31['map'](_0xc5e8b5=>_0xc5e8b5[_0x37f499(0x1d3)])[_0x37f499(0x176)](';\x20');reportMorphError({'error_message':_0xbc3c42,'error_type':_0x37f499(0x201),'context':{'tool':'codebase_search','repo_path':_0x27de95[_0x37f499(0x1ea)]['repo_path'],'query':_0x27de95[_0x37f499(0x1ea)]['search_string'],'model':_0x37f499(0x1e7),'termination_reason':_0x37f499(0x1cf),'error_count':_0x32ac31[_0x37f499(0x167)],'is_timeout':![],'timings':_0x1212ae[_0x37f499(0x216)],'files_attempted':_0xe5f17f[_0x37f499(0x18a)](_0x30adbb=>({'path':_0x30adbb[_0x37f499(0x14b)],'lines':_0x30adbb[_0x37f499(0x170)]})),'tool_calls':_0x391c1(_0x1212ae[_0x37f499(0x19c)]),'messages':_0x1212ae['messages']?.['map'](_0x1bd410=>({'role':_0x1bd410[_0x37f499(0x1ce)],'content':_0x1bd410['content'],..._0x1bd410[_0x37f499(0x1ee)]?{'tool_calls':_0x1bd410['tool_calls']['length']}:{},..._0x1bd410[_0x37f499(0x1db)]?{'tool_call_id':_0x1bd410[_0x37f499(0x1db)]}:{}})),'request_content':{'query':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x226)],'repo_path':_0x27de95[_0x37f499(0x1ea)]['repo_path'],'repoRoot':a0_0x48e43f[_0x37f499(0x1d9)](_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)]),'model':_0x37f499(0x1e7)}},'source':'mcp-filesystem'})[_0x37f499(0x142)](()=>{});}}else{if(_0x1212ae['terminationReason']===_0x37f499(0x196)&&_0x1212ae[_0x37f499(0x15e)][_0x37f499(0x167)]>0x0){const _0x1b2d00=_0x1212ae['errors'][_0x37f499(0x18a)](_0xe3b1e6=>_0xe3b1e6['message'])[_0x37f499(0x176)](';\x20');_0x2b61a5=_0x37f499(0x13f)+_0x1b2d00;const _0x1d1b45=_0x1b2d00[_0x37f499(0x224)]()[_0x37f499(0x190)](_0x37f499(0x1be))||_0x1b2d00[_0x37f499(0x224)]()[_0x37f499(0x190)](_0x37f499(0x1e5))||_0x1b2d00[_0x37f499(0x224)]()[_0x37f499(0x190)](_0x37f499(0x1a1)),_0x486071=_0x1212ae[_0x37f499(0x164)]?.['metadata']?.[_0x37f499(0x178)],_0x4b7688=_0x1212ae['errors'][0x0];reportMorphError({'error_message':_0x1b2d00,'error_type':_0x1d1b45?'TimeoutError':_0x4b7688?.[_0x37f499(0x11b)]?.['name']||_0x37f499(0x124),'context':{'tool':_0x37f499(0x192),'repo_path':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)],'query':_0x27de95[_0x37f499(0x1ea)]['search_string'],'model':_0x37f499(0x1e7),'termination_reason':_0x1212ae[_0x37f499(0x172)],'error_count':_0x1212ae[_0x37f499(0x15e)][_0x37f499(0x167)],'is_timeout':_0x1d1b45,'timings':_0x1212ae['timings'],'files_attempted':_0x486071?.[_0x37f499(0x18a)](_0x5b822d=>({'path':_0x5b822d[_0x37f499(0x14b)],'lines':_0x5b822d[_0x37f499(0x170)]})),'tool_calls':_0x391c1(_0x1212ae[_0x37f499(0x19c)]),'messages':_0x1212ae[_0x37f499(0x19c)]?.[_0x37f499(0x18a)](_0x4abe17=>({'role':_0x4abe17[_0x37f499(0x1ce)],'content':_0x4abe17[_0x37f499(0x1fc)],..._0x4abe17[_0x37f499(0x1ee)]?{'tool_calls':_0x4abe17[_0x37f499(0x1ee)][_0x37f499(0x167)]}:{},..._0x4abe17[_0x37f499(0x1db)]?{'tool_call_id':_0x4abe17['tool_call_id']}:{}})),'request_content':{'query':_0x27de95['data']['search_string'],'repo_path':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)],'repoRoot':a0_0x48e43f['resolve'](_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)]),'model':_0x37f499(0x1e7)}},'stack_trace':_0x4b7688?.['stack']||undefined,'source':_0x37f499(0x1f9)})[_0x37f499(0x142)](()=>{});}else _0x2b61a5=_0x37f499(0x1c9);}return{'content':[{'type':_0x37f499(0x1f6),'text':_0x2b61a5}]};}catch(_0x2d267f){const _0x19ba5f=_0x2d267f instanceof Error?_0x2d267f['message']:String(_0x2d267f),_0x1490f3=_0x19ba5f[_0x37f499(0x224)]()['includes'](_0x37f499(0x1be))||_0x19ba5f[_0x37f499(0x224)]()[_0x37f499(0x190)](_0x37f499(0x1e5))||_0x19ba5f['toLowerCase']()[_0x37f499(0x190)]('etimedout')||_0x2d267f instanceof Error&&_0x2d267f[_0x37f499(0x1fb)]==='TimeoutError';return reportMorphError({'error_message':_0x19ba5f,'error_type':_0x1490f3?_0x37f499(0x11f):_0x2d267f instanceof Error?_0x2d267f[_0x37f499(0x11b)][_0x37f499(0x1fb)]:_0x37f499(0x14d),'context':{'tool':_0x37f499(0x192),'repo_path':_0x27de95[_0x37f499(0x1ea)]['repo_path'],'query':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x226)],'model':_0x37f499(0x1e7),'is_timeout':_0x1490f3,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x27de95[_0x37f499(0x1ea)]['search_string'],'repo_path':_0x27de95[_0x37f499(0x1ea)][_0x37f499(0x120)],'repoRoot':a0_0x48e43f[_0x37f499(0x1d9)](_0x27de95['data'][_0x37f499(0x120)]),'model':_0x37f499(0x1e7)}},'stack_trace':_0x2d267f instanceof Error?_0x2d267f[_0x37f499(0x13e)]:undefined,'source':_0x37f499(0x1f9)})['catch'](()=>{}),{'content':[{'type':'text','text':_0x37f499(0x229)+_0x19ba5f}],'isError':![]};}}case _0x37f499(0x1b5):{const _0x371d11=WarpGrepGitHubArgsSchema['safeParse'](_0x45d79c);if(!_0x371d11[_0x37f499(0x1b7)])return{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x1ec)+_0x371d11[_0x37f499(0x1bf)]}],'isError':!![]};const _0x12c109=_0x371d11[_0x37f499(0x1ea)][_0x37f499(0x16d)]||_0x371d11['data'][_0x37f499(0x218)];if(!_0x12c109)return{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x183)}],'isError':!![]};const _0x21e0fe=MORPH_API_KEY;if(!_0x21e0fe)throw new Error(_0x37f499(0x213));const _0x59253c=Date[_0x37f499(0x12b)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x12c109+'\x20for:\x20\x22'+_0x371d11[_0x37f499(0x1ea)]['search_string']+'\x22');try{const _0x185f48=new WarpGrepClient({'morphApiKey':_0x21e0fe,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x5a45d6=await _0x185f48[_0x37f499(0x12d)]({'searchTerm':_0x371d11[_0x37f499(0x1ea)][_0x37f499(0x226)],'github':_0x12c109,'branch':_0x371d11[_0x37f499(0x1ea)][_0x37f499(0x1fa)]}),_0x511b57=Date[_0x37f499(0x12b)]()-_0x59253c;logMcpStderr(_0x37f499(0x168)+_0x511b57+_0x37f499(0x1aa)+_0x5a45d6['success']);const _0x3cf196=formatResult(_0x5a45d6);return{'content':[{'type':'text','text':_0x3cf196}]};}catch(_0x4924b8){const _0x556a39=Date['now']()-_0x59253c,_0x4892da=_0x4924b8 instanceof Error?_0x4924b8['message']:String(_0x4924b8);return logMcpStderr(_0x37f499(0x18d)+_0x556a39+_0x37f499(0x188),_0x4892da),reportMorphError({'error_message':_0x4892da,'error_type':_0x4924b8 instanceof Error?_0x4924b8['constructor'][_0x37f499(0x1fb)]:_0x37f499(0x14d),'context':{'tool':'github_codebase_search','github_url':_0x12c109,'search_string':_0x371d11[_0x37f499(0x1ea)]['search_string'],'branch':_0x371d11[_0x37f499(0x1ea)][_0x37f499(0x1fa)]},'stack_trace':_0x4924b8 instanceof Error?_0x4924b8[_0x37f499(0x13e)]:undefined,'source':_0x37f499(0x1f9),'tool':_0x37f499(0x1b5),'latency_ms':_0x556a39})[_0x37f499(0x142)](()=>{}),{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x187)+_0x4892da}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x450a55);}}catch(_0x7dadb0){const _0xaf1e5d=_0x7dadb0 instanceof Error?_0x7dadb0[_0x37f499(0x1d3)]:String(_0x7dadb0);return reportMorphError({'error_message':_0xaf1e5d,'error_type':_0x7dadb0 instanceof Error?_0x7dadb0['constructor'][_0x37f499(0x1fb)]:_0x37f499(0x14d),'context':{'tool':_0x450a55,'arguments':_0x45d79c?JSON[_0x37f499(0x195)](_0x45d79c)[_0x37f499(0x11c)](0x0,0x1f4):undefined,'mcp_server_version':_0x37f499(0x139)},'stack_trace':_0x7dadb0 instanceof Error?_0x7dadb0[_0x37f499(0x13e)]:undefined,'source':_0x37f499(0x1f9)})[_0x37f499(0x142)](()=>{}),{'content':[{'type':_0x37f499(0x1f6),'text':_0x37f499(0x13f)+_0xaf1e5d}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4bbafe){const _0x5483ad=a0_0x553a3a,_0x555de2=await getValidRootDirectories(_0x4bbafe);if(_0x555de2[_0x5483ad(0x167)]>0x0)allowedDirectories=[..._0x555de2],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x555de2['length']+'\x20valid\x20directories');else{logMcpStderr(_0x5483ad(0x1ef));if(ENABLE_WORKSPACE_MODE)try{const _0x4f4e99=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4f4e99&&(allowedDirectories=[_0x4f4e99],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4f4e99));}catch(_0x449c1a){logMcpStderr(_0x5483ad(0x17c)+_0x449c1a);}}}server[a0_0x553a3a(0x14c)](RootsListChangedNotificationSchema,async()=>{const _0x10c914=a0_0x553a3a;try{const _0x359a07=await server[_0x10c914(0x1d8)]();_0x359a07&&_0x10c914(0x20a)in _0x359a07&&await updateAllowedDirectoriesFromRoots(_0x359a07[_0x10c914(0x20a)]);}catch(_0x5a3b61){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x5a3b61 instanceof Error?_0x5a3b61[_0x10c914(0x1d3)]:String(_0x5a3b61));}}),server['oninitialized']=async()=>{const _0x1006ad=a0_0x553a3a,_0x47505f=server[_0x1006ad(0x228)]();if(_0x47505f?.[_0x1006ad(0x20a)])try{const _0x3a2581=await server['listRoots']();_0x3a2581&&_0x1006ad(0x20a)in _0x3a2581?await updateAllowedDirectoriesFromRoots(_0x3a2581['roots']):logMcpStderr(_0x1006ad(0x13a));}catch(_0x109476){logMcpStderr(_0x1006ad(0x1a2),_0x109476 instanceof Error?_0x109476[_0x1006ad(0x1d3)]:String(_0x109476));}else{if(allowedDirectories[_0x1006ad(0x167)]>0x0)logMcpStderr(_0x1006ad(0x180),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1006ad(0x137));else throw new Error(_0x1006ad(0x17f));}}};async function runServer(){const _0x4cab9f=a0_0x553a3a,_0x4b9db2=new StdioServerTransport();await server[_0x4cab9f(0x1f8)](_0x4b9db2),logMcpStderr(_0x4cab9f(0x127)),allowedDirectories[_0x4cab9f(0x167)]===0x0&&logMcpStderr(_0x4cab9f(0x1ae));}runServer()['catch'](_0x10c263=>{const _0x129d72=a0_0x553a3a;logMcpStderr(_0x129d72(0x199),_0x10c263),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
var a1_0x32716a=a1_0x209d;function a1_0x5c00(){var _0x1b976d=['linux','1170801xBtSqT','darwin','[os=','7RrYfSs','macOS','Windows','1680932YJTUGM','8fZRJdZ','1369749YSylby','error','641449zbbYIC','3478015vmWWOF','1051164rEuRkg','3778524iieqIN','platform','Unknown'];a1_0x5c00=function(){return _0x1b976d;};return a1_0x5c00();}(function(_0x572d67,_0x132849){var _0x38479e=a1_0x209d,_0x505ffa=_0x572d67();while(!![]){try{var _0x101149=parseInt(_0x38479e(0x1b7))/0x1+parseInt(_0x38479e(0x1b9))/0x2+-parseInt(_0x38479e(0x1b5))/0x3+-parseInt(_0x38479e(0x1b3))/0x4+-parseInt(_0x38479e(0x1b8))/0x5+-parseInt(_0x38479e(0x1ba))/0x6*(-parseInt(_0x38479e(0x1b0))/0x7)+-parseInt(_0x38479e(0x1b4))/0x8*(-parseInt(_0x38479e(0x1ad))/0x9);if(_0x101149===_0x132849)break;else _0x505ffa['push'](_0x505ffa['shift']());}catch(_0x332d11){_0x505ffa['push'](_0x505ffa['shift']());}}}(a1_0x5c00,0x56897));import a1_0x3f6b27 from'os';export function getOperatingSystemType(_0x3029ab=a1_0x3f6b27[a1_0x32716a(0x1bb)]()){var _0x138f40=a1_0x32716a;switch(_0x3029ab){case _0x138f40(0x1ae):return _0x138f40(0x1b1);case'win32':return _0x138f40(0x1b2);case _0x138f40(0x1ac):return'Linux';default:return _0x138f40(0x1ab);}}function a1_0x209d(_0x18c1c0,_0x2e71b4){_0x18c1c0=_0x18c1c0-0x1ab;var _0x5c00f5=a1_0x5c00();var _0x209dde=_0x5c00f5[_0x18c1c0];return _0x209dde;}export function formatMcpLogMessage(_0x1c1361,_0x21a798=a1_0x3f6b27['platform']()){var _0x116a88=a1_0x32716a;return _0x116a88(0x1af)+getOperatingSystemType(_0x21a798)+']\x20'+_0x1c1361;}export function logMcpStderr(_0x2ed1b1,..._0x4e19bd){var _0x4daa1f=a1_0x32716a;console[_0x4daa1f(0x1b6)](formatMcpLogMessage(_0x2ed1b1),..._0x4e19bd);}
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3db51b,_0x481cb9){const _0xa93a1b=a2_0x21d9,_0x477c11=_0x3db51b();while(!![]){try{const _0x48dd21=parseInt(_0xa93a1b(0xe3))/0x1*(parseInt(_0xa93a1b(0xe8))/0x2)+-parseInt(_0xa93a1b(0xe6))/0x3*(parseInt(_0xa93a1b(0xea))/0x4)+-parseInt(_0xa93a1b(0xef))/0x5*(parseInt(_0xa93a1b(0xed))/0x6)+parseInt(_0xa93a1b(0xe5))/0x7+-parseInt(_0xa93a1b(0xe2))/0x8+-parseInt(_0xa93a1b(0xde))/0x9+parseInt(_0xa93a1b(0xdd))/0xa;if(_0x48dd21===_0x481cb9)break;else _0x477c11['push'](_0x477c11['shift']());}catch(_0x21f716){_0x477c11['push'](_0x477c11['shift']());}}}(a2_0x8f09,0x864f6));import a2_0x181cd1 from'path';import a2_0x4e86a1 from'os';function a2_0x21d9(_0x461069,_0x23bb36){_0x461069=_0x461069-0xdd;const _0x8f09e6=a2_0x8f09();let _0x21d9d5=_0x8f09e6[_0x461069];return _0x21d9d5;}export function convertToWindowsPath(_0x31d808){const _0x5a83c4=a2_0x21d9;if(_0x31d808[_0x5a83c4(0xdf)](_0x5a83c4(0xe1))){const _0xd53c89=_0x31d808[_0x5a83c4(0xe4)](0x5)[_0x5a83c4(0xe7)](),_0x2857c3=_0x31d808[_0x5a83c4(0xeb)](0x6)[_0x5a83c4(0xe0)](/\//g,'\x5c');return _0xd53c89+':'+_0x2857c3;}if(_0x31d808[_0x5a83c4(0xf0)](/^\/[a-zA-Z]\//)){const _0xd68b40=_0x31d808[_0x5a83c4(0xe4)](0x1)['toUpperCase'](),_0x2d8734=_0x31d808['slice'](0x2)[_0x5a83c4(0xe0)](/\//g,'\x5c');return _0xd68b40+':'+_0x2d8734;}if(_0x31d808['match'](/^[a-zA-Z]:/))return _0x31d808['replace'](/\//g,'\x5c');return _0x31d808;}export function normalizePath(_0xd7dd43){const _0x2b76f5=a2_0x21d9;_0xd7dd43=_0xd7dd43['trim']()[_0x2b76f5(0xe0)](/^["']|["']$/g,'');const _0x3ebd48=_0xd7dd43['startsWith']('/')&&!_0xd7dd43[_0x2b76f5(0xf0)](/^\/mnt\/[a-z]\//i)&&!_0xd7dd43[_0x2b76f5(0xf0)](/^\/[a-zA-Z]\//);if(_0x3ebd48)return _0xd7dd43['replace'](/\/+/g,'/')[_0x2b76f5(0xe0)](/\/+$/,'');_0xd7dd43=convertToWindowsPath(_0xd7dd43);if(_0xd7dd43[_0x2b76f5(0xdf)]('\x5c\x5c')){let _0x9c95d6=_0xd7dd43;_0x9c95d6=_0x9c95d6['replace'](/^\\{2,}/,'\x5c\x5c');const _0xeaaaea=_0x9c95d6['substring'](0x2)[_0x2b76f5(0xe0)](/\\\\/g,'\x5c');_0xd7dd43='\x5c\x5c'+_0xeaaaea;}else _0xd7dd43=_0xd7dd43['replace'](/\\\\/g,'\x5c');let _0x25318f=a2_0x181cd1[_0x2b76f5(0xec)](_0xd7dd43);_0xd7dd43[_0x2b76f5(0xdf)]('\x5c\x5c')&&!_0x25318f['startsWith']('\x5c\x5c')&&(_0x25318f='\x5c'+_0x25318f);if(_0x25318f[_0x2b76f5(0xf0)](/^[a-zA-Z]:/)){let _0x4ea000=_0x25318f[_0x2b76f5(0xe0)](/\//g,'\x5c');return/^[a-z]:/[_0x2b76f5(0xe9)](_0x4ea000)&&(_0x4ea000=_0x4ea000[_0x2b76f5(0xe4)](0x0)[_0x2b76f5(0xe7)]()+_0x4ea000[_0x2b76f5(0xeb)](0x1)),_0x4ea000;}return _0x25318f[_0x2b76f5(0xe0)](/\//g,'\x5c');}function a2_0x8f09(){const _0x3d8e7b=['5AKHafa','match','16484860FfXuMC','5950980JrDxRL','startsWith','replace','/mnt/','6574824FPWMEs','389gfBTqy','charAt','6890114IJTnZw','189843IImhzF','toUpperCase','4402ssrAKC','test','44ssmHMO','slice','normalize','4558074lmMEgF','join'];a2_0x8f09=function(){return _0x3d8e7b;};return a2_0x8f09();}export function expandHome(_0x17267d){const _0x504266=a2_0x21d9;if(_0x17267d[_0x504266(0xdf)]('~/')||_0x17267d==='~')return a2_0x181cd1[_0x504266(0xee)](a2_0x4e86a1['homedir'](),_0x17267d[_0x504266(0xeb)](0x1));return _0x17267d;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x254b38,_0x36b1f3){const _0x30204e=a3_0x128d,_0x2be88d=_0x254b38();while(!![]){try{const _0x3f2d51=-parseInt(_0x30204e(0x11e))/0x1*(parseInt(_0x30204e(0x114))/0x2)+parseInt(_0x30204e(0x112))/0x3+parseInt(_0x30204e(0x11d))/0x4+parseInt(_0x30204e(0x126))/0x5*(parseInt(_0x30204e(0x11b))/0x6)+-parseInt(_0x30204e(0x124))/0x7*(parseInt(_0x30204e(0x119))/0x8)+parseInt(_0x30204e(0x123))/0x9+-parseInt(_0x30204e(0x116))/0xa*(parseInt(_0x30204e(0x117))/0xb);if(_0x3f2d51===_0x36b1f3)break;else _0x2be88d['push'](_0x2be88d['shift']());}catch(_0x3dbc96){_0x2be88d['push'](_0x2be88d['shift']());}}}(a3_0xef0a,0x1e764));import a3_0x5634b5 from'path';function a3_0x128d(_0x39e1ee,_0x19472b){_0x39e1ee=_0x39e1ee-0x111;const _0xef0aff=a3_0xef0a();let _0x128d80=_0xef0aff[_0x39e1ee];return _0x128d80;}export function isPathWithinAllowedDirectories(_0x3a2dbb,_0x13bf18){const _0x4c6fc1=a3_0x128d;if(typeof _0x3a2dbb!==_0x4c6fc1(0x11a)||!Array[_0x4c6fc1(0x121)](_0x13bf18))return![];if(!_0x3a2dbb||_0x13bf18['length']===0x0)return![];if(_0x3a2dbb[_0x4c6fc1(0x118)]('\x00'))return![];let _0x2dc472;try{_0x2dc472=a3_0x5634b5[_0x4c6fc1(0x111)](a3_0x5634b5[_0x4c6fc1(0x122)](_0x3a2dbb));}catch{return![];}if(!a3_0x5634b5[_0x4c6fc1(0x125)](_0x2dc472))throw new Error(_0x4c6fc1(0x11c));return _0x13bf18[_0x4c6fc1(0x115)](_0x13d7e6=>{const _0x214945=_0x4c6fc1;if(typeof _0x13d7e6!=='string'||!_0x13d7e6)return![];if(_0x13d7e6[_0x214945(0x118)]('\x00'))return![];let _0x5ad4db;try{_0x5ad4db=a3_0x5634b5['resolve'](a3_0x5634b5[_0x214945(0x122)](_0x13d7e6));}catch{return![];}if(!a3_0x5634b5['isAbsolute'](_0x5ad4db))throw new Error(_0x214945(0x11f));if(_0x2dc472===_0x5ad4db)return!![];if(_0x5ad4db===a3_0x5634b5[_0x214945(0x120)])return _0x2dc472['startsWith'](a3_0x5634b5[_0x214945(0x120)]);return _0x2dc472[_0x214945(0x113)](_0x5ad4db+a3_0x5634b5[_0x214945(0x120)]);});}function a3_0xef0a(){const _0x4a670d=['807891FeKapV','isAbsolute','5TMGXdV','resolve','478596mXCIqE','startsWith','2RpcZEO','some','3646830OCiwfY','11rSWjVQ','includes','8mXpnSL','string','1363764pXIwDn','Path\x20must\x20be\x20absolute\x20after\x20normalization','861072fCMfTI','194286sOybSq','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','isArray','normalize','1773540NaAcKR'];a3_0xef0a=function(){return _0x4a670d;};return a3_0xef0a();}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2771e7,_0x4ce973){const _0x4aa45b=a4_0x4c9f,_0x5b1d1d=_0x2771e7();while(!![]){try{const _0x23dd04=-parseInt(_0x4aa45b(0xb0))/0x1*(-parseInt(_0x4aa45b(0xb4))/0x2)+-parseInt(_0x4aa45b(0xb3))/0x3+parseInt(_0x4aa45b(0xa2))/0x4*(-parseInt(_0x4aa45b(0xac))/0x5)+parseInt(_0x4aa45b(0xaf))/0x6+-parseInt(_0x4aa45b(0xb5))/0x7+parseInt(_0x4aa45b(0xa6))/0x8*(parseInt(_0x4aa45b(0xa3))/0x9)+parseInt(_0x4aa45b(0xb2))/0xa;if(_0x23dd04===_0x4ce973)break;else _0x5b1d1d['push'](_0x5b1d1d['shift']());}catch(_0x244f27){_0x5b1d1d['push'](_0x5b1d1d['shift']());}}}(a4_0x198d,0xa450e));import{promises as a4_0x547121}from'fs';import a4_0x575fd9 from'path';import a4_0x6c39d from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';function a4_0x4c9f(_0x3afcf8,_0x4db003){_0x3afcf8=_0x3afcf8-0x9e;const _0x198d92=a4_0x198d();let _0x4c9fee=_0x198d92[_0x3afcf8];return _0x4c9fee;}async function parseRootUri(_0x2efcfb){const _0x364f44=a4_0x4c9f;try{const _0x4bc216=_0x2efcfb[_0x364f44(0xab)](_0x364f44(0xaa))?_0x2efcfb[_0x364f44(0xa7)](0x7):_0x2efcfb,_0x27fb10=_0x4bc216[_0x364f44(0xab)]('~/')||_0x4bc216==='~'?a4_0x575fd9[_0x364f44(0xad)](a4_0x6c39d[_0x364f44(0x9e)](),_0x4bc216[_0x364f44(0xa7)](0x1)):_0x4bc216,_0x4497b8=a4_0x575fd9[_0x364f44(0xa8)](_0x27fb10),_0x49f295=await a4_0x547121['realpath'](_0x4497b8);return normalizePath(_0x49f295);}catch{return null;}}function a4_0x198d(){const _0x1eef8a=['Skipping\x20','\x20due\x20to\x20error:\x20','2223728JbGfSK','slice','resolve','push','file://','startsWith','14465sqcmmE','join','message','2535408GggGiB','1fhiIBV','isDirectory','8350260wqjuau','1611867DHGffv','229960IoFzfi','1486660POBjZP','homedir','uri','invalid\x20path\x20or\x20inaccessible','non-directory\x20root','1468DYcHbe','36OKZLOl'];a4_0x198d=function(){return _0x1eef8a;};return a4_0x198d();}function formatDirectoryError(_0x2e5bbd,_0x729010,_0x1f98e3){const _0x5a75d1=a4_0x4c9f;if(_0x1f98e3)return _0x5a75d1(0xa4)+_0x1f98e3+':\x20'+_0x2e5bbd;const _0x3ce4b1=_0x729010 instanceof Error?_0x729010[_0x5a75d1(0xae)]:String(_0x729010);return'Skipping\x20invalid\x20directory:\x20'+_0x2e5bbd+_0x5a75d1(0xa5)+_0x3ce4b1;}export async function getValidRootDirectories(_0x344fe7){const _0x5215aa=a4_0x4c9f,_0x22a6f2=[];for(const _0x1469f9 of _0x344fe7){const _0x13d8f1=await parseRootUri(_0x1469f9[_0x5215aa(0x9f)]);if(!_0x13d8f1){logMcpStderr(formatDirectoryError(_0x1469f9[_0x5215aa(0x9f)],undefined,_0x5215aa(0xa0)));continue;}try{const _0x36acf3=await a4_0x547121['stat'](_0x13d8f1);_0x36acf3[_0x5215aa(0xb1)]()?_0x22a6f2[_0x5215aa(0xa9)](_0x13d8f1):logMcpStderr(formatDirectoryError(_0x13d8f1,undefined,_0x5215aa(0xa1)));}catch(_0x26c095){logMcpStderr(formatDirectoryError(_0x13d8f1,_0x26c095));}}return _0x22a6f2;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.152",
|
|
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.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.156",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|