@morphllm/morphmcp 0.8.199 → 0.8.200

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x104249=a0_0x312c;(function(_0x1eceda,_0x5aac8f){const _0x5c2fae=a0_0x312c,_0x3e36b6=_0x1eceda();while(!![]){try{const _0x375da5=-parseInt(_0x5c2fae(0x106))/0x1+parseInt(_0x5c2fae(0x167))/0x2*(parseInt(_0x5c2fae(0xa8))/0x3)+-parseInt(_0x5c2fae(0xf3))/0x4*(-parseInt(_0x5c2fae(0xbc))/0x5)+parseInt(_0x5c2fae(0xec))/0x6+-parseInt(_0x5c2fae(0x18b))/0x7+-parseInt(_0x5c2fae(0x182))/0x8+parseInt(_0x5c2fae(0x19e))/0x9;if(_0x375da5===_0x5aac8f)break;else _0x3e36b6['push'](_0x3e36b6['shift']());}catch(_0x19d695){_0x3e36b6['push'](_0x3e36b6['shift']());}}}(a0_0x12a6,0x4777e));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x312c(_0x3ac145,_0x2c3cb2){_0x3ac145=_0x3ac145-0x86;const _0x12a6b9=a0_0x12a6();let _0x312c24=_0x12a6b9[_0x3ac145];return _0x312c24;}import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x1abd9e from'fs/promises';import a0_0x2f511b from'path';import a0_0x3c7415 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{logger}from'./logger.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_0x41924f from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x234501){const _0x1c2a5a=a0_0x312c,_0x1adb29=_0x234501['split'](a0_0x2f511b['sep'])[_0x1c2a5a(0x108)](Boolean);if(_0x1adb29[_0x1c2a5a(0x14d)]<0x2)return null;for(let _0x1a9aa3=Math[_0x1c2a5a(0x169)](_0x1adb29[_0x1c2a5a(0x14d)]/0x2);_0x1a9aa3>=0x1;_0x1a9aa3--){for(let _0x149d0a=0x0;_0x149d0a<=_0x1adb29[_0x1c2a5a(0x14d)]-0x2*_0x1a9aa3;_0x149d0a++){const _0x330b97=_0x1adb29['slice'](_0x149d0a,_0x149d0a+_0x1a9aa3),_0x3ebdc5=_0x1adb29[_0x1c2a5a(0x149)](_0x149d0a+_0x1a9aa3,_0x149d0a+0x2*_0x1a9aa3);if(_0x330b97[_0x1c2a5a(0xdc)]((_0x396202,_0x709ccb)=>_0x396202===_0x3ebdc5[_0x709ccb])){const _0x26ffee=[..._0x1adb29['slice'](0x0,_0x149d0a),..._0x1adb29[_0x1c2a5a(0x149)](_0x149d0a+_0x1a9aa3)];return a0_0x2f511b['sep']+_0x26ffee['join'](a0_0x2f511b[_0x1c2a5a(0x1a3)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x47ab60=a0_0x312c;try{const _0x52b525=require(_0x47ab60(0xba));return _0x52b525[_0x47ab60(0xf0)]??_0x47ab60(0x191);}catch(_0x18db0b){return logMcpStderr(_0x47ab60(0x174),_0x18db0b),_0x47ab60(0x191);}}function printHelp(){const _0x5a97b7=a0_0x312c;console[_0x5a97b7(0x197)](_0x5a97b7(0x1a1)+getPackageVersion()),console[_0x5a97b7(0x197)](_0x5a97b7(0x121)),console['log'](_0x5a97b7(0x10c)),console[_0x5a97b7(0x197)](_0x5a97b7(0xd0)),console['log'](_0x5a97b7(0x188)),console[_0x5a97b7(0x197)](_0x5a97b7(0xfe)),console[_0x5a97b7(0x197)]('\x0aExamples:'),console[_0x5a97b7(0x197)]('\x20\x20morph-mcp'),console[_0x5a97b7(0x197)](_0x5a97b7(0xb9));}const cliArgs=process[a0_0x104249(0xee)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x104249(0x11c),'-v','-V']),HELP_FLAGS=new Set([a0_0x104249(0x14c),'-h']);cliArgs['some'](_0x565ae2=>VERSION_FLAGS['has'](_0x565ae2))&&(console['log'](a0_0x104249(0x1a1)+getPackageVersion()),process[a0_0x104249(0x168)](0x0));cliArgs[a0_0x104249(0x102)](_0xe4394a=>HELP_FLAGS[a0_0x104249(0x99)](_0xe4394a))&&(printHelp(),process[a0_0x104249(0x168)](0x0));function a0_0x12a6(){const _0x85255b=['Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','tool_call_received','repo_path','map','arguments','added\x20','path_validation_failed','tsconfig.json','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Failed\x20to\x20request\x20roots\x20from\x20client:','utf-8','Tool\x20','[could\x20not\x20read\x20file:\x20','number','parse','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','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','payload','Fatal\x20error\x20running\x20server:','<file\x20path=\x22','PWD','array','\x20error(s)','\x0a</file>','[github_codebase_search]\x20Done\x20in\x20','slice','connect','pyproject.toml','--help','length','path','terminated','dirname','mcp-filesystem','now','size','Error\x20running\x20fast\x20context\x20search:\x20','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.','roots','isDirectory','linesRemoved','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','changes','search_string','tool_call_complete','warp_grep_complete','Error\x20accessing\x20directory\x20','morph-v3-large','.vscode','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.','completionId','optional','target_filepath','tool_calls','min','62102CqEGKh','exit','floor','package.json','file_read_complete','errors','string','edit_file','metadata','path_validation_start','Repository\x20identifier','SubToolError','\x0a...\x20(truncated,\x20total:\x20','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','listRoots','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','WarpGrepError','catch','messages','ENOENT','glob','code_edit','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Rules:\x0a','Fallback:\x20Using\x20workspace\x20root\x20','target_file','UnknownError','3609016QzkOeJ','MORPH_LARGE_APPLY','unknown\x20error','.\x20Path:\x20','timings','terminationReason','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','TimeoutError','realpath','3826606cyxmFc','instruction','error','-\x20Listed\x20directory\x20`','\x22>\x0aError\x20reading\x20file:\x20','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','unknown','join','-\x20Grepped\x20\x27','substring','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','function','log','code','owner_repo','Bearer\x20','\x20-\x20','enum','startsWith','13407948RYiHse','includes','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','@morphllm/morphmcp\x20','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','sep','pattern','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','github_codebase_search','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','.\x20Changes:\x20','SymlinkError','context','EDIT_FILE','`\x20in\x20`','oninitialized','WarpGrep\x20sub-tool\x20errors:\x20','boolean','normalize','FileNotFound','toLowerCase','linesModified','grep','push','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x22.\x20Known\x20tools:\x20','object','default','files','grep_search','ReadError','Failed\x20to\x20read\x20file:\x20','has','BinaryFile','grep\x20\x27','all','Cargo.toml','env','Error:\x20','Applied','instructions','toISOString','finish','warn','tool_call_error','response','morph-warp-grep-v2.1','3peBoKE','requiresApiKey','Morph\x20FastApply\x20failed\x20without\x20error\x20message','DISABLED_TOOLS','morph-mcp','\x20chars)','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','Invalid\x20arguments:\x20','description','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','text','content','source','cwd','runWarpGrep_call','Example\x20format:\x0a','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','../package.json','node_modules','8830IjSBwq','RipgrepNotAvailable','dryRun','Morph\x20Edit\x20Preview','compaction_failed','searchGitHub','0.2.0','command','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','isArray','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','Specific\x20commit\x20hash\x20to\x20search','\x20valid\x20directories','turns','match','etimedout','warp_grep_start','homedir','MORPH_WARP_GREP_TIMEOUT','data','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','resolve','\x27\x20in\x20`','sk-','basename','stack','success','safeParse','split','\x22>\x0a','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','every','constructor','https://morphllm.com/api/error-report','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','inputSchema','github_search_start','ToolException','list_directory','codebase_search','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Warning:\x20Workspace\x20fallback\x20failed:\x20','Disabled\x20tools:\x20','path_validation_resolved','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','setRequestHandler','PathError','328998Xnfmgl','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','argv','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','version','list_directory\x20','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','392ldZGby','Here\x20is\x20the\x20content\x20of\x20files:\x0a','timeout','getClientCapabilities','stat','filePath','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','describe','readFile','MCP','morph-','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','API\x20error\x20(auth/rate-limit)','Max\x20results\x20to\x20return','Workspace\x20mode\x20enabled:\x20Using\x20','some','debug','Created\x20File','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','458205qzvSRD','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','filter','read','assistant','status','\x0aOptions:','branch','setNotificationHandler','LocalRipgrepProvider','Relevant\x20context\x20found:','name','Parent\x20directory\x20does\x20not\x20exist:\x20','MORPH_API_URL','GitHub\x20search\x20failed:\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','trim','[github_codebase_search]\x20Failed\x20in\x20','tool_call_id','-\x20Glob\x20search\x20`','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','--version','\x20disabled\x20via\x20DISABLED_TOOLS','CODEBASE_SEARCH','user','File\x20read\x20error:','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','ENABLE_WORKSPACE_MODE','\x20is\x20not\x20a\x20directory','--api-key','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','message','go.mod','Unknown\x20tool:\x20','role','-\x20Preserve\x20exact\x20indentation\x0a','RipgrepError','MORPH_API_KEY','lines'];a0_0x12a6=function(){return _0x85255b;};return a0_0x12a6();}function getCliArg(_0x3fafd3){const _0x4862f1=a0_0x104249;for(let _0x4b9021=0x0;_0x4b9021<cliArgs['length'];_0x4b9021++){const _0x4ae5f6=cliArgs[_0x4b9021];if(_0x4ae5f6[_0x4862f1(0x19d)]('--'+_0x3fafd3+'='))return _0x4ae5f6['slice'](('--'+_0x3fafd3+'=')[_0x4862f1(0x14d)]);if(_0x4ae5f6==='--'+_0x3fafd3&&_0x4b9021+0x1<cliArgs[_0x4862f1(0x14d)])return cliArgs[_0x4b9021+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x104249(0x99)](arg)||HELP_FLAGS['has'](arg))continue;if(arg['startsWith']('--api-key='))continue;if(arg===a0_0x104249(0x126)){i++;continue;}args[a0_0x104249(0x8f)](arg);}const WORKSPACE_ROOT=process[a0_0x104249(0x9e)]['WORKSPACE_ROOT']||process[a0_0x104249(0x9e)][a0_0x104249(0x144)]||process[a0_0x104249(0xb6)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x104249(0x124)]!=='false',MORPH_API_KEY=getCliArg('api-key')??process[a0_0x104249(0x9e)][a0_0x104249(0x12e)],MORPH_API_URL=process[a0_0x104249(0x9e)][a0_0x104249(0x113)],MORPH_LARGE_APPLY=process[a0_0x104249(0x9e)][a0_0x104249(0x183)]!=='false',MORPH_WARP_GREP_TIMEOUT=process[a0_0x104249(0x9e)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x104249(0x9e)][a0_0x104249(0xce)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process['env'][a0_0x104249(0xab)]?new Set(process[a0_0x104249(0x9e)][a0_0x104249(0xab)][a0_0x104249(0xd9)](',')[a0_0x104249(0x133)](_0x28de8f=>_0x28de8f[a0_0x104249(0x116)]())[a0_0x104249(0x108)](_0x2350be=>_0x2350be[a0_0x104249(0x14d)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x104249(0x153)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x104249(0x99)](tool)&&console[a0_0x104249(0x18d)](a0_0x104249(0xdb)+tool+a0_0x104249(0x92)+[...KNOWN_TOOL_NAMES][a0_0x104249(0x192)](',\x20'));}console[a0_0x104249(0x18d)](a0_0x104249(0xe7)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x104249(0x19d)](a0_0x104249(0xd4))&&!MORPH_API_KEY[a0_0x104249(0x19d)](a0_0x104249(0xfd))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x558865){const _0x350f1f=a0_0x104249;try{await a0_0x41924f['post'](_0x350f1f(0xde),{..._0x558865,'timestamp':new Date()[_0x350f1f(0xa2)](),'source':_0x558865[_0x350f1f(0xb5)]||_0x350f1f(0x151),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x558865[_0x350f1f(0x1aa)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x350f1f(0x19a)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1f9ea5,_0x316269){const _0x49c92d=a0_0x104249;if(_0x1f9ea5&&typeof _0x1f9ea5===_0x49c92d(0x93)&&_0x49c92d(0x10b)in _0x1f9ea5)return _0x1f9ea5['status'];if(_0x1f9ea5&&typeof _0x1f9ea5===_0x49c92d(0x93)&&_0x49c92d(0xa6)in _0x1f9ea5)return _0x1f9ea5[_0x49c92d(0xa6)]?.[_0x49c92d(0x10b)];const _0x40c65d=_0x316269[_0x49c92d(0xca)](/\b(401|429)\b/);return _0x40c65d?parseInt(_0x40c65d[0x1],0xa):null;}function handleMorphAPIError(_0x42cf88){const _0x11cf49=a0_0x104249,_0x25557a=_0x42cf88 instanceof Error?_0x42cf88['message']:String(_0x42cf88),_0x13743b=extractStatusCode(_0x42cf88,_0x25557a);switch(_0x13743b){case 0x191:return{'content':[{'type':_0x11cf49(0xb3),'text':_0x11cf49(0x1a7)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x11cf49(0xe9)}],'isError':!![]};default:return null;}}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(a0_0x104249(0xf9)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x104249(0x107)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x1f3333){const _0x386186=a0_0x104249;return a0_0x2f511b[_0x386186(0x8a)](_0x1f3333);}function expandHome(_0x3d58fb){const _0x485624=a0_0x104249;if(_0x3d58fb[_0x485624(0x19d)]('~/')||_0x3d58fb==='~')return a0_0x2f511b[_0x485624(0x192)](a0_0x3c7415[_0x485624(0xcd)](),_0x3d58fb[_0x485624(0x149)](0x1));return _0x3d58fb;}let allowedDirectories=await Promise[a0_0x104249(0x9c)](args[a0_0x104249(0x133)](async _0x2e1364=>{const _0x4e895a=a0_0x104249,_0x55be25=expandHome(_0x2e1364),_0x3d7ecf=a0_0x2f511b[_0x4e895a(0xd2)](_0x55be25);try{const _0x504010=await a0_0x1abd9e['realpath'](_0x3d7ecf);return normalizePath(_0x504010);}catch(_0x184ef9){return normalizePath(_0x3d7ecf);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x104249(0x14d)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x104249(0x101)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x29a207){logMcpStderr(a0_0x104249(0x176)+a0_0x29a207);}async function detectWorkspaceRoot(_0x5a78b7){const _0x173952=a0_0x104249;let _0x161089=a0_0x2f511b[_0x173952(0xd2)](_0x5a78b7);const _0x52a083=['.git',_0x173952(0x160),_0x173952(0x16a),_0x173952(0x9d),_0x173952(0x14b),_0x173952(0x129),'.cursor',_0x173952(0x137),'composer.json'];while(_0x161089!==a0_0x2f511b[_0x173952(0x150)](_0x161089)){for(const _0x471170 of _0x52a083){const _0x3f72bb=a0_0x2f511b[_0x173952(0x192)](_0x161089,_0x471170);try{return await a0_0x1abd9e['access'](_0x3f72bb),normalizePath(_0x161089);}catch{}}_0x161089=a0_0x2f511b[_0x173952(0x150)](_0x161089);}return normalizePath(_0x5a78b7);}await Promise[a0_0x104249(0x9c)](args[a0_0x104249(0x133)](async _0x5a8802=>{const _0x5077a5=a0_0x104249;try{const _0x37185b=await a0_0x1abd9e[_0x5077a5(0xf7)](expandHome(_0x5a8802));!_0x37185b[_0x5077a5(0x157)]()&&(logMcpStderr(_0x5077a5(0x9f)+_0x5a8802+_0x5077a5(0x125)),process['exit'](0x1));}catch(_0x43ec71){logMcpStderr(_0x5077a5(0x15e)+_0x5a8802+':',_0x43ec71),process[_0x5077a5(0x168)](0x1);}}));async function validatePath(_0x3d73a6){const _0x396587=a0_0x104249,_0x263077=expandHome(_0x3d73a6),_0x2fc694=a0_0x2f511b[_0x396587(0xd2)](_0x263077);logger['debug'](_0x396587(0xfc),_0x396587(0x170),{'raw_path':_0x3d73a6,'absolute':_0x2fc694});try{const _0x38a541=await a0_0x1abd9e[_0x396587(0x18a)](_0x2fc694);return logger['debug']('MCP','path_validation_resolved',{'resolved':_0x38a541,'symlink':_0x38a541!==_0x2fc694}),_0x38a541;}catch(_0x2776cd){if(_0x2776cd[_0x396587(0x198)]===_0x396587(0x17a)){const _0x4522da=a0_0x2f511b[_0x396587(0x150)](_0x2fc694);try{const _0x142aad=await a0_0x1abd9e[_0x396587(0x18a)](_0x4522da),_0x32e4ed=a0_0x2f511b['join'](_0x142aad,a0_0x2f511b['basename'](_0x2fc694));return logger[_0x396587(0x103)]('MCP',_0x396587(0xe8),{'resolved':_0x32e4ed,'new_file':!![]}),_0x32e4ed;}catch{logger[_0x396587(0x18d)](_0x396587(0xfc),_0x396587(0x136),{'raw_path':_0x3d73a6,'error':_0x396587(0x112)+_0x4522da});throw new Error(_0x396587(0x112)+_0x4522da);}}logger[_0x396587(0x18d)](_0x396587(0xfc),'path_validation_failed',{'raw_path':_0x3d73a6,'error':_0x2776cd[_0x396587(0x128)]});throw _0x2776cd;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x104249(0x16d)](),'code_edit':z[a0_0x104249(0x16d)]()[a0_0x104249(0xfa)](a0_0x104249(0x1a2)),'instruction':z[a0_0x104249(0x16d)]()[a0_0x104249(0xfa)](a0_0x104249(0x11b)),'dryRun':z[a0_0x104249(0x89)]()[a0_0x104249(0x94)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION='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.',WarpGrepArgsSchema=z[a0_0x104249(0x93)]({'search_string':z['string']()[a0_0x104249(0xfa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x104249(0x16d)]()[a0_0x104249(0xfa)](a0_0x104249(0x13f)),'search_type':z[a0_0x104249(0x19c)]([a0_0x104249(0x94),'node_modules'])['optional']()[a0_0x104249(0xfa)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x104249(0x93)]({'search_string':z[a0_0x104249(0x16d)]()[a0_0x104249(0xfa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x104249(0x16d)]()[a0_0x104249(0x163)]()[a0_0x104249(0xfa)](a0_0x104249(0x161)),'owner_repo':z[a0_0x104249(0x16d)]()[a0_0x104249(0x163)]()['describe'](a0_0x104249(0xdf)),'branch':z[a0_0x104249(0x16d)]()['optional']()[a0_0x104249(0xfa)](a0_0x104249(0xb2))}),CodebaseSearchArgsSchema=z[a0_0x104249(0x93)]({'query':z[a0_0x104249(0x16d)]()[a0_0x104249(0xfa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x104249(0x16d)]()[a0_0x104249(0xfa)](a0_0x104249(0x171)),'branch':z[a0_0x104249(0x16d)]()[a0_0x104249(0x163)]()[a0_0x104249(0xfa)](a0_0x104249(0x17d)),'commitHash':z['string']()['optional']()['describe'](a0_0x104249(0xc7)),'targetDirectories':z[a0_0x104249(0x145)](z[a0_0x104249(0x16d)]())['default']([])[a0_0x104249(0xfa)](a0_0x104249(0x1a0)),'limit':z[a0_0x104249(0x13d)]()[a0_0x104249(0x163)]()[a0_0x104249(0x94)](0xa)[a0_0x104249(0xfa)](a0_0x104249(0x100))}),server=new Server({'name':a0_0x104249(0xac),'version':a0_0x104249(0xc2)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x376169=a0_0x104249,_0x8ee404=[{'name':TOOL_NAMES[_0x376169(0x1ab)],'description':_0x376169(0x140)+_0x376169(0xae)+'Parameters:\x0a'+_0x376169(0xc6)+_0x376169(0x105)+_0x376169(0x90)+_0x376169(0x195)+_0x376169(0xb8)+_0x376169(0xed)+_0x376169(0x17e)+_0x376169(0x1a5)+_0x376169(0x12c)+_0x376169(0xc4)+_0x376169(0x127),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x376169(0x11e)],'description':_0x376169(0x190)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20'+_0x376169(0x115)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x5dde74=_0x8ee404[_0x376169(0x108)](_0x46d642=>{const _0x4f2b65=_0x376169;if(DISABLED_TOOLS[_0x4f2b65(0x99)](_0x46d642[_0x4f2b65(0x111)]))return console[_0x4f2b65(0x18d)](_0x4f2b65(0x13b)+_0x46d642[_0x4f2b65(0x111)]+_0x4f2b65(0x11d)),![];if(_0x4f2b65(0xa9)in _0x46d642&&_0x46d642['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x46d642[_0x4f2b65(0x111)]+_0x4f2b65(0xb1)),![];return!![];});return{'tools':_0x5dde74[_0x376169(0x133)](_0x12e647=>({'name':_0x12e647[_0x376169(0x111)],'description':_0x12e647[_0x376169(0xb0)],'inputSchema':_0x12e647[_0x376169(0xe0)]}))};}),server[a0_0x104249(0xea)](CallToolRequestSchema,async _0xf33704=>{const _0xa94536=a0_0x104249,{name:_0x43da34,arguments:_0x3d9cdd}=_0xf33704['params'],_0x307c28=Date[_0xa94536(0x152)]();logger['debug'](_0xa94536(0xfc),_0xa94536(0x131),{'tool':_0x43da34,'args':_0x43da34==='edit_file'?{'path':_0x3d9cdd?.[_0xa94536(0x14e)],'instruction':_0x3d9cdd?.[_0xa94536(0x18c)]||_0x3d9cdd?.[_0xa94536(0xa1)],'dryRun':_0x3d9cdd?.[_0xa94536(0xbe)]}:_0x3d9cdd});try{if(!MORPH_API_KEY)return{'content':[{'type':_0xa94536(0xb3),'text':_0xa94536(0x11a)}],'isError':!![]};if(!MORPH_API_KEY[_0xa94536(0x19d)](_0xa94536(0xd4))&&!MORPH_API_KEY[_0xa94536(0x19d)]('morph-'))return{'content':[{'type':_0xa94536(0xb3),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0xa94536(0x99)](_0x43da34))return{'content':[{'type':'text','text':'Tool\x20\x22'+_0x43da34+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x43da34){case TOOL_NAMES['EDIT_FILE']:{let _0x3a1a7b=_0x3d9cdd;if(_0x3a1a7b&&typeof _0x3a1a7b==='object'){if(!(_0xa94536(0x14e)in _0x3a1a7b)){const _0xf7f7bd=_0x3a1a7b[_0xa94536(0x180)]??_0x3a1a7b[_0xa94536(0xf8)]??_0x3a1a7b[_0xa94536(0x164)]??_0x3a1a7b['file_path']??_0x3a1a7b['file'];if(_0xf7f7bd)_0x3a1a7b={..._0x3a1a7b,'path':_0xf7f7bd};}_0xa94536(0xa1)in _0x3a1a7b&&!('instruction'in _0x3a1a7b)&&(_0x3a1a7b={..._0x3a1a7b,'instruction':_0x3a1a7b['instructions']});if(!(_0xa94536(0x17c)in _0x3a1a7b)){const _0x4a56a=_0x3a1a7b[_0xa94536(0x198)]??_0x3a1a7b['new_string']??_0x3a1a7b[_0xa94536(0xb4)]??_0x3a1a7b['edit'];if(_0x4a56a)_0x3a1a7b={..._0x3a1a7b,'code_edit':_0x4a56a};}}const _0x2cbebd=MorphEditFileArgsSchema[_0xa94536(0xd8)](_0x3a1a7b);if(!_0x2cbebd[_0xa94536(0xd7)])throw new Error(_0xa94536(0xd1)+_0x2cbebd['error']);const _0x30b8f1=await validatePath(_0x2cbebd[_0xa94536(0xcf)]['path']);let _0x56a6b7=null,_0x325eab=!![],_0x4b0f6=null;try{_0x56a6b7=await a0_0x1abd9e[_0xa94536(0xfb)](_0x30b8f1,_0xa94536(0x13a)),logger['debug'](_0xa94536(0xfc),'file_read_complete',{'path':_0x30b8f1,'size_bytes':_0x56a6b7[_0xa94536(0x14d)]});}catch(_0xc27ea0){const _0x577776=_0xc27ea0['code'];_0x577776===_0xa94536(0x17a)?(_0x325eab=![],_0x56a6b7='',logger[_0xa94536(0x103)]('MCP',_0xa94536(0x16b),{'path':_0x30b8f1,'exists':![]})):(_0x4b0f6=_0xa94536(0x98)+(_0x577776||_0xa94536(0x191))+_0xa94536(0x19b)+(_0xc27ea0 instanceof Error?_0xc27ea0[_0xa94536(0x128)]:String(_0xc27ea0)),logger[_0xa94536(0x18d)](_0xa94536(0xfc),'file_read_failed',{'path':_0x30b8f1,'error':_0x4b0f6}),logMcpStderr('Warning:\x20'+_0x4b0f6));}let _0x7c0788;try{const _0x1b86e7=MORPH_API_KEY;if(!_0x1b86e7)throw new Error(_0xa94536(0x123));const _0x4eea07=a0_0x2f511b[_0xa94536(0x150)](_0x30b8f1),_0x4f9aca=a0_0x2f511b[_0xa94536(0xd5)](_0x30b8f1);logger[_0xa94536(0x103)]('MCP','api_request_start',{'model':'morph-v3-fast','path':_0x2cbebd['data'][_0xa94536(0x14e)],'instruction_len':_0x2cbebd[_0xa94536(0xcf)]['instruction'][_0xa94536(0x14d)],'code_edit_len':_0x2cbebd['data'][_0xa94536(0x17c)][_0xa94536(0x14d)],'original_code_len':_0x56a6b7?.[_0xa94536(0x14d)]??0x0,'dry_run':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0xbe)]});const _0x57d63e=Date[_0xa94536(0x152)](),_0x5d60ee=await executeEditFile({'target_filepath':_0x4f9aca,'code_edit':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x17c)],'instruction':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x18c)]},{'morphApiKey':_0x1b86e7,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x4eea07,'autoWrite':!_0x2cbebd['data']['dryRun'],'generateUdiff':![],'debug':![]}),_0x2c3bf1=Date[_0xa94536(0x152)]()-_0x57d63e;_0x7c0788=_0x5d60ee[_0xa94536(0x162)];if(!_0x5d60ee[_0xa94536(0xd7)])throw new Error(_0x5d60ee[_0xa94536(0x18d)]||_0xa94536(0xaa));const _0x2e8f96=_0x5d60ee[_0xa94536(0x15a)],_0x51d82b=_0xa94536(0x135)+_0x2e8f96['linesAdded']+',\x20removed\x20'+_0x2e8f96[_0xa94536(0x158)]+',\x20modified\x20'+_0x2e8f96[_0xa94536(0x8d)];logger['debug'](_0xa94536(0xfc),_0xa94536(0x15c),{'tool':_0xa94536(0x16e),'success':!![],'latency_ms':Date[_0xa94536(0x152)]()-_0x307c28,'edit_latency_ms':_0x2c3bf1,'changes':{'added':_0x2e8f96['linesAdded'],'removed':_0x2e8f96[_0xa94536(0x158)],'modified':_0x2e8f96[_0xa94536(0x8d)]},'completion_id':_0x7c0788});if(_0x2cbebd['data']['dryRun'])return{'content':[{'type':'text','text':_0xa94536(0xbf)+(_0x325eab?'':'\x20(new\x20file)')+':\x20'+_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x18c)]+_0xa94536(0x1a8)+_0x51d82b+'.\x20Path:\x20'+_0x2cbebd['data'][_0xa94536(0x14e)]+'.'}]};return{'content':[{'type':'text','text':'Morph\x20Edit\x20'+(_0x325eab?_0xa94536(0xa0):_0xa94536(0x104))+':\x20'+_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x18c)]+'.\x20Changes:\x20'+_0x51d82b+_0xa94536(0x185)+_0x2cbebd['data'][_0xa94536(0x14e)]+'.'}]};}catch(_0x51b2dc){const _0x44c2ea=handleMorphAPIError(_0x51b2dc);if(_0x44c2ea)return logger[_0xa94536(0x18d)](_0xa94536(0xfc),_0xa94536(0xa5),{'tool':_0xa94536(0x16e),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0xa94536(0x152)]()-_0x307c28}),_0x44c2ea;const _0x28f106=_0x51b2dc instanceof Error?_0x51b2dc[_0xa94536(0x128)]:String(_0x51b2dc);return logger[_0xa94536(0x18d)](_0xa94536(0xfc),'tool_call_error',{'tool':'edit_file','error':_0x28f106,'path':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x14e)],'validated_path':_0x30b8f1,'latency_ms':Date['now']()-_0x307c28,'stack':_0x51b2dc instanceof Error?_0x51b2dc[_0xa94536(0xd6)]:undefined}),reportMorphError({'error_message':_0x28f106,'error_type':_0x51b2dc instanceof Error?_0x51b2dc[_0xa94536(0xdd)][_0xa94536(0x111)]:'UnknownError','context':{'tool':_0xa94536(0x16e),'completion_id':_0x7c0788,'file_path':_0x2cbebd[_0xa94536(0xcf)]['path'],'validated_path':_0x30b8f1,'instruction':_0x2cbebd[_0xa94536(0xcf)]['instruction'],'model':MORPH_LARGE_APPLY?'morph-v3-large':'morph-v3-fast','dry_run':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0xbe)],'file_exists':_0x325eab,'file_read_error':_0x4b0f6,'file_readable':_0x56a6b7!==null,'request_content':{'path':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x14e)],'code_edit':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x17c)],'instruction':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0x18c)],'original_code':_0x56a6b7!==null?_0x56a6b7[_0xa94536(0x14d)]>0xc350?_0x56a6b7[_0xa94536(0x194)](0x0,0xc350)+_0xa94536(0x173)+_0x56a6b7[_0xa94536(0x14d)]+_0xa94536(0xad):_0x56a6b7:_0xa94536(0x13c)+(_0x4b0f6||_0xa94536(0x184))+']','original_code_length':_0x56a6b7?.[_0xa94536(0x14d)]??0x0,'model':MORPH_LARGE_APPLY?_0xa94536(0x15f):'morph-v3-fast','dry_run':_0x2cbebd[_0xa94536(0xcf)][_0xa94536(0xbe)]}},'stack_trace':_0x51b2dc instanceof Error?_0x51b2dc[_0xa94536(0xd6)]:undefined,'source':'mcp-filesystem'})[_0xa94536(0x178)](()=>{}),{'content':[{'type':_0xa94536(0xb3),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x28f106}],'isError':!![]};}}case TOOL_NAMES[_0xa94536(0x11e)]:{const _0x31fb29=WarpGrepArgsSchema[_0xa94536(0xd8)](_0x3d9cdd);if(!_0x31fb29[_0xa94536(0xd7)])return{'content':[{'type':_0xa94536(0xb3),'text':_0xa94536(0xaf)+_0x31fb29[_0xa94536(0x18d)]}],'isError':!![]};const _0x4c8f01=_0x4d9d3f=>{const _0x1197a4=_0xa94536,_0x93fe58=[];for(const _0x1b7f1f of _0x4d9d3f||[]){if(_0x1b7f1f[_0x1197a4(0x12b)]===_0x1197a4(0x10a)&&Array[_0x1197a4(0xc5)](_0x1b7f1f[_0x1197a4(0x165)]))for(const _0x583fed of _0x1b7f1f[_0x1197a4(0x165)]){try{const _0x292830=_0x583fed[_0x1197a4(0x196)]?.[_0x1197a4(0x111)],_0x478073=JSON[_0x1197a4(0x13e)](_0x583fed[_0x1197a4(0x196)]?.[_0x1197a4(0x134)]||'{}');if(_0x292830===_0x1197a4(0x96))_0x93fe58[_0x1197a4(0x8f)](_0x1197a4(0x9b)+_0x478073[_0x1197a4(0x1a4)]+'\x27\x20'+(_0x478073[_0x1197a4(0x14e)]||'.'));else{if(_0x292830===_0x1197a4(0x109))_0x93fe58['push']('read\x20'+_0x478073['path']);else{if(_0x292830===_0x1197a4(0xe3))_0x93fe58[_0x1197a4(0x8f)](_0x1197a4(0xf1)+(_0x478073[_0x1197a4(0xc3)]||'.'));else{if(_0x292830===_0x1197a4(0x17b))_0x93fe58[_0x1197a4(0x8f)]('glob\x20\x27'+_0x478073[_0x1197a4(0x1a4)]+'\x27\x20'+(_0x478073['path']||'.'));else _0x292830===_0x1197a4(0xa3)&&_0x93fe58[_0x1197a4(0x8f)]('finish');}}}}catch{}}}return _0x93fe58;},_0x1b08f2=_0x27e4c4=>{const _0x2351a0=_0xa94536,_0xa27665=[];if(!_0x27e4c4||!Array['isArray'](_0x27e4c4))return _0xa27665;const _0x490a05=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2351a0(0x8b),'tool':_0x2351a0(0x109)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x2351a0(0xeb),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2351a0(0x9a),'tool':_0x2351a0(0x109)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2351a0(0x12d),'tool':_0x2351a0(0x8e)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2351a0(0xbd),'tool':_0x2351a0(0x8e)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2351a0(0x9a),'tool':_0x2351a0(0x109)},{'pattern':/\[SYMLINK\]/,'error_type':_0x2351a0(0x1a9),'tool':_0x2351a0(0x109)},{'pattern':/not a text file/,'error_type':_0x2351a0(0x9a),'tool':_0x2351a0(0x109)},{'pattern':/symbolic link/,'error_type':_0x2351a0(0x1a9),'tool':_0x2351a0(0x109)},{'pattern':/Error reading file:/,'error_type':_0x2351a0(0x97),'tool':_0x2351a0(0x109)},{'pattern':/status="error"/,'error_type':_0x2351a0(0xe2),'tool':_0x2351a0(0x191)}];let _0xbc974=0x0;for(const _0x3f21b2 of _0x27e4c4){_0x3f21b2[_0x2351a0(0x12b)]===_0x2351a0(0x10a)&&Array[_0x2351a0(0xc5)](_0x3f21b2[_0x2351a0(0x165)])&&_0xbc974++;const _0x2dec93=_0x3f21b2[_0x2351a0(0xb4)];if((_0x3f21b2['role']==='tool'||_0x3f21b2[_0x2351a0(0x12b)]===_0x2351a0(0x11f))&&_0x2dec93&&typeof _0x2dec93==='string')for(const {pattern:_0x1bc4ef,error_type:_0x57e58b,tool:_0x17af61}of _0x490a05){const _0x5c0d33=_0x2dec93['match'](new RegExp(_0x1bc4ef[_0x2351a0(0xb5)],'g'));if(_0x5c0d33)for(const _0x4ffc12 of _0x5c0d33){const _0x1d9c0f=_0x2dec93['indexOf'](_0x4ffc12),_0x6d8c60=_0x2dec93[_0x2351a0(0x194)](_0x1d9c0f,Math[_0x2351a0(0x166)](_0x1d9c0f+0xc8,_0x2dec93['length']));_0xa27665[_0x2351a0(0x8f)]({'tool':_0x17af61,'error_type':_0x57e58b,'error_message':_0x6d8c60[_0x2351a0(0xd9)]('\x0a')[0x0],'turn':_0xbc974});}}}return _0xa27665;};try{const _0x557e6e=a0_0x2f511b[_0xa94536(0xd2)](_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)]),_0x136493=_0x31fb29[_0xa94536(0xcf)]['search_type'],_0x219c9a=_0x136493===_0xa94536(0xbb)?{'allowNames':['node_modules']}:undefined,_0x1496a=new LocalRipgrepProvider(_0x557e6e,undefined,_0x219c9a);logger['debug'](_0xa94536(0xfc),'provider_created',{'type':_0xa94536(0x10f),'repo_root':_0x557e6e,'search_type':_0x136493||_0xa94536(0x94)}),logger[_0xa94536(0x103)](_0xa94536(0xfc),_0xa94536(0xcc),{'query':_0x31fb29['data'][_0xa94536(0x15b)],'repo_root':_0x557e6e,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x233740=Date[_0xa94536(0x152)](),_0xd48d15=await runWarpGrep({'searchTerm':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x15b)],'repoRoot':_0x557e6e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1496a,'search_type':_0x136493}),_0x420555=Date[_0xa94536(0x152)]()-_0x233740,_0x3452d4=_0xd48d15[_0xa94536(0xa3)]?.[_0xa94536(0x16f)]?.[_0xa94536(0x95)]?.[_0xa94536(0x14d)]??0x0;logger[_0xa94536(0x103)]('MCP',_0xa94536(0x15d),{'termination':_0xd48d15[_0xa94536(0x187)],'turns':_0xd48d15['timings']?.[_0xa94536(0xc9)]??0x0,'files_found':_0x3452d4,'latency_ms':_0x420555});const _0x3cc472=_0x1b08f2(_0xd48d15[_0xa94536(0x179)]);_0x3cc472[_0xa94536(0x14d)]>0x0&&reportMorphError({'error_message':_0xa94536(0x88)+_0x3cc472[_0xa94536(0x14d)]+_0xa94536(0x146),'error_type':_0xa94536(0x172),'level':_0xa94536(0xa4),'tool':_0xa94536(0xe4),'context':{'repo_path':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],'query':_0x31fb29['data'][_0xa94536(0x15b)],'model':_0xa94536(0xa7),'termination_reason':_0xd48d15[_0xa94536(0x187)],'sub_tool_errors':_0x3cc472,'timings':_0xd48d15[_0xa94536(0x186)],'tool_calls':_0x4c8f01(_0xd48d15[_0xa94536(0x179)]),'messages':_0xd48d15['messages']?.[_0xa94536(0x133)](_0x5aa8a6=>({'role':_0x5aa8a6[_0xa94536(0x12b)],'content':_0x5aa8a6[_0xa94536(0xb4)],..._0x5aa8a6['tool_calls']?{'tool_calls':_0x5aa8a6['tool_calls'][_0xa94536(0x14d)]}:{},..._0x5aa8a6[_0xa94536(0x118)]?{'tool_call_id':_0x5aa8a6[_0xa94536(0x118)]}:{}}))},'source':_0xa94536(0x151)})[_0xa94536(0x178)](()=>{});let _0x58438a='';if(_0xd48d15['terminationReason']==='completed'&&_0xd48d15[_0xa94536(0xa3)]?.[_0xa94536(0x16f)]?.['files']){const _0x559c73=_0xd48d15[_0xa94536(0xa3)][_0xa94536(0x16f)]['files'];if(_0x559c73[_0xa94536(0x14d)]===0x0)return _0x58438a=_0xd48d15[_0xa94536(0xa3)][_0xa94536(0x141)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0xa94536(0xb3),'text':_0x58438a}]};const _0x2962d4=[],_0x479fcb=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x2953c8 of _0xd48d15[_0xa94536(0x179)]){if(_0x2953c8[_0xa94536(0x12b)]===_0xa94536(0x10a)&&Array['isArray'](_0x2953c8['tool_calls']))for(const _0x355a99 of _0x2953c8[_0xa94536(0x165)]){try{const _0x297e25=_0x355a99[_0xa94536(0x196)]?.[_0xa94536(0x111)],_0x2cb15a=JSON['parse'](_0x355a99['function']?.[_0xa94536(0x134)]||'{}');if(_0x297e25===_0xa94536(0x96))_0x479fcb[_0xa94536(0x8f)](_0xa94536(0x193)+_0x2cb15a[_0xa94536(0x1a4)]+_0xa94536(0xd3)+(_0x2cb15a[_0xa94536(0x14e)]||'.')+'`');else{if(_0x297e25===_0xa94536(0x109))_0x479fcb['push']('-\x20Read\x20file\x20`'+_0x2cb15a[_0xa94536(0x14e)]+'`');else{if(_0x297e25===_0xa94536(0xe3))_0x479fcb['push'](_0xa94536(0x18e)+(_0x2cb15a[_0xa94536(0xc3)]||'.')+'`');else _0x297e25===_0xa94536(0x17b)&&_0x479fcb[_0xa94536(0x8f)](_0xa94536(0x119)+_0x2cb15a[_0xa94536(0x1a4)]+_0xa94536(0x86)+(_0x2cb15a['path']||'.')+'`');}}}catch{}}}_0x2962d4[_0xa94536(0x8f)](_0x479fcb[_0xa94536(0x192)]('\x0a'));const _0x4abbfe=['',_0xa94536(0x110)];for(const _0x10a154 of _0x559c73){if(_0x10a154[_0xa94536(0x12f)]==='*')_0x4abbfe[_0xa94536(0x8f)]('-\x20'+_0x10a154[_0xa94536(0x14e)]+':*');else{if(Array[_0xa94536(0xc5)](_0x10a154['lines'])){const _0x22ac3c=_0x10a154['lines'][_0xa94536(0x133)](([_0x18d6b5,_0x1a946e])=>{if(_0x18d6b5===_0x1a946e)return''+_0x18d6b5;return _0x18d6b5+'-'+_0x1a946e;});_0x4abbfe[_0xa94536(0x8f)]('-\x20'+_0x10a154['path']+':'+_0x22ac3c[_0xa94536(0x192)](','));}else _0x4abbfe[_0xa94536(0x8f)]('-\x20'+_0x10a154[_0xa94536(0x14e)]+':*');}}_0x4abbfe[_0xa94536(0x8f)](''),_0x2962d4[_0xa94536(0x8f)](_0x4abbfe[_0xa94536(0x192)]('\x0a')),_0x2962d4[_0xa94536(0x8f)](_0xa94536(0xf4));const _0x1a917e=[],_0x361587=[];for(const _0xfb75b0 of _0x559c73){let _0x13a360=a0_0x2f511b['resolve'](_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],_0xfb75b0[_0xa94536(0x14e)]),_0x1a6e23=null,_0x40eec7=null;try{_0x1a6e23=await a0_0x1abd9e[_0xa94536(0xfb)](_0x13a360,{'encoding':_0xa94536(0x13a)});}catch(_0x23f2dc){const _0x45941e=fixPathRepetition(_0x13a360);if(_0x45941e)try{_0x1a6e23=await a0_0x1abd9e['readFile'](_0x45941e,{'encoding':'utf-8'}),_0x13a360=_0x45941e;}catch{_0x40eec7=_0x23f2dc instanceof Error?_0x23f2dc:new Error(String(_0x23f2dc));}else _0x40eec7=_0x23f2dc instanceof Error?_0x23f2dc:new Error(String(_0x23f2dc));}if(_0x1a6e23!==null){const _0x304834=_0x1a6e23['split'](/\r?\n/),_0x5bb039=[];if(_0xfb75b0[_0xa94536(0x12f)]==='*'||!Array[_0xa94536(0xc5)](_0xfb75b0[_0xa94536(0x12f)]))for(let _0x192584=0x1;_0x192584<=_0x304834[_0xa94536(0x14d)];_0x192584++){const _0x3f60b1=_0x304834[_0x192584-0x1];_0x5bb039[_0xa94536(0x8f)](_0x192584+'|\x20'+_0x3f60b1);}else for(const [_0x1fb372,_0x270b61]of _0xfb75b0['lines']){_0x5bb039['length']>0x0&&_0x5bb039[_0xa94536(0x8f)]('');for(let _0x221f85=_0x1fb372;_0x221f85<=_0x270b61&&_0x221f85<=_0x304834['length'];_0x221f85++){const _0x34d1c7=_0x304834[_0x221f85-0x1];_0x5bb039[_0xa94536(0x8f)](_0x221f85+'|\x20'+_0x34d1c7);}}_0x361587[_0xa94536(0x8f)]({'path':_0xfb75b0['path'],'content':_0x5bb039[_0xa94536(0x192)]('\x0a')});}else _0x1a917e['push']('<file\x20path=\x22'+_0xfb75b0['path']+_0xa94536(0x18f)+(_0x40eec7?.[_0xa94536(0x128)]||'Unknown\x20error')+_0xa94536(0x147));}try{const _0x5a1a32=await compactFileContexts(_0x361587,_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x15b)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3587a4 of _0x5a1a32){_0x1a917e['push']('<file\x20path=\x22'+_0x3587a4[_0xa94536(0x14e)]+_0xa94536(0xda)+_0x3587a4['content']+'\x0a</file>');}}catch(_0x2ed781){logger[_0xa94536(0xa4)]('MCP',_0xa94536(0xc0),{'error':_0x2ed781 instanceof Error?_0x2ed781[_0xa94536(0x128)]:String(_0x2ed781),'files_count':_0x361587[_0xa94536(0x14d)]});for(const _0x3de63a of _0x361587){_0x1a917e['push'](_0xa94536(0x143)+_0x3de63a['path']+_0xa94536(0xda)+_0x3de63a[_0xa94536(0xb4)]+_0xa94536(0x147));}}_0x2962d4[_0xa94536(0x8f)](_0x1a917e[_0xa94536(0x192)]('\x0a\x0a')),_0x58438a=_0x2962d4['join']('\x0a');const _0x20f7ec=_0xd48d15['errors']?.[_0xa94536(0x108)](_0x223519=>_0x223519[_0xa94536(0x128)]?.[_0xa94536(0x19d)](_0xa94536(0x120)))||[];if(_0x20f7ec[_0xa94536(0x14d)]>0x0){const _0xbe9167=_0x20f7ec[_0xa94536(0x133)](_0x24b6a2=>_0x24b6a2['message'])[_0xa94536(0x192)](';\x20');reportMorphError({'error_message':_0xbe9167,'error_type':'FileReadError','context':{'tool':_0xa94536(0xe4),'repo_path':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],'query':_0x31fb29['data'][_0xa94536(0x15b)],'model':_0xa94536(0xa7),'termination_reason':'completed_with_file_errors','error_count':_0x20f7ec['length'],'is_timeout':![],'timings':_0xd48d15['timings'],'files_attempted':_0x559c73['map'](_0x332802=>({'path':_0x332802['path'],'lines':_0x332802[_0xa94536(0x12f)]})),'tool_calls':_0x4c8f01(_0xd48d15[_0xa94536(0x179)]),'messages':_0xd48d15[_0xa94536(0x179)]?.['map'](_0x4daf5d=>({'role':_0x4daf5d[_0xa94536(0x12b)],'content':_0x4daf5d[_0xa94536(0xb4)],..._0x4daf5d[_0xa94536(0x165)]?{'tool_calls':_0x4daf5d[_0xa94536(0x165)][_0xa94536(0x14d)]}:{},..._0x4daf5d[_0xa94536(0x118)]?{'tool_call_id':_0x4daf5d['tool_call_id']}:{}})),'request_content':{'query':_0x31fb29[_0xa94536(0xcf)]['search_string'],'repo_path':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],'repoRoot':a0_0x2f511b[_0xa94536(0xd2)](_0x31fb29['data'][_0xa94536(0x132)]),'model':_0xa94536(0xa7)}},'source':_0xa94536(0x151)})[_0xa94536(0x178)](()=>{});}}else{if(_0xd48d15[_0xa94536(0x187)]===_0xa94536(0x14f)&&_0xd48d15[_0xa94536(0x16c)][_0xa94536(0x14d)]>0x0){const _0x2224a9=_0xd48d15[_0xa94536(0x16c)][_0xa94536(0x133)](_0x1f6571=>_0x1f6571[_0xa94536(0x128)])[_0xa94536(0x192)](';\x20');_0x58438a=_0xa94536(0x9f)+_0x2224a9;const _0x3dde7c=_0x2224a9[_0xa94536(0x8c)]()[_0xa94536(0x19f)](_0xa94536(0xf5))||_0x2224a9[_0xa94536(0x8c)]()[_0xa94536(0x19f)]('timed\x20out')||_0x2224a9[_0xa94536(0x8c)]()[_0xa94536(0x19f)]('etimedout'),_0x23d00f=_0xd48d15[_0xa94536(0xa3)]?.['metadata']?.[_0xa94536(0x95)],_0x27cf72=_0xd48d15['errors'][0x0];reportMorphError({'error_message':_0x2224a9,'error_type':_0x3dde7c?'TimeoutError':_0x27cf72?.[_0xa94536(0xdd)]?.[_0xa94536(0x111)]||_0xa94536(0x177),'context':{'tool':'codebase_search','repo_path':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],'query':_0x31fb29['data'][_0xa94536(0x15b)],'model':_0xa94536(0xa7),'termination_reason':_0xd48d15['terminationReason'],'error_count':_0xd48d15[_0xa94536(0x16c)][_0xa94536(0x14d)],'is_timeout':_0x3dde7c,'timings':_0xd48d15[_0xa94536(0x186)],'files_attempted':_0x23d00f?.[_0xa94536(0x133)](_0x28ac3a=>({'path':_0x28ac3a[_0xa94536(0x14e)],'lines':_0x28ac3a[_0xa94536(0x12f)]})),'tool_calls':_0x4c8f01(_0xd48d15[_0xa94536(0x179)]),'messages':_0xd48d15['messages']?.[_0xa94536(0x133)](_0x335766=>({'role':_0x335766[_0xa94536(0x12b)],'content':_0x335766[_0xa94536(0xb4)],..._0x335766['tool_calls']?{'tool_calls':_0x335766[_0xa94536(0x165)][_0xa94536(0x14d)]}:{},..._0x335766[_0xa94536(0x118)]?{'tool_call_id':_0x335766[_0xa94536(0x118)]}:{}})),'request_content':{'query':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x15b)],'repo_path':_0x31fb29[_0xa94536(0xcf)]['repo_path'],'repoRoot':a0_0x2f511b['resolve'](_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x27cf72?.[_0xa94536(0xd6)]||undefined,'source':_0xa94536(0x151)})[_0xa94536(0x178)](()=>{});}else _0x58438a=_0xa94536(0xf2);}return{'content':[{'type':'text','text':_0x58438a}]};}catch(_0x150559){const _0x14973d=handleMorphAPIError(_0x150559);if(_0x14973d)return logger[_0xa94536(0x18d)]('MCP',_0xa94536(0xa5),{'tool':_0xa94536(0xe4),'error':_0xa94536(0xff),'latency_ms':Date['now']()-_0x307c28}),_0x14973d;const _0x93e522=_0x150559 instanceof Error?_0x150559[_0xa94536(0x128)]:String(_0x150559);logger[_0xa94536(0x18d)]('MCP',_0xa94536(0xa5),{'tool':_0xa94536(0xe4),'error':_0x93e522,'repo_path':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],'query':_0x31fb29['data'][_0xa94536(0x15b)],'latency_ms':Date[_0xa94536(0x152)]()-_0x307c28});const _0x5870c0=_0x93e522[_0xa94536(0x8c)]()['includes'](_0xa94536(0xf5))||_0x93e522['toLowerCase']()['includes']('timed\x20out')||_0x93e522['toLowerCase']()['includes'](_0xa94536(0xcb))||_0x150559 instanceof Error&&_0x150559['name']===_0xa94536(0x189);return reportMorphError({'error_message':_0x93e522,'error_type':_0x5870c0?'TimeoutError':_0x150559 instanceof Error?_0x150559[_0xa94536(0xdd)]['name']:_0xa94536(0x181),'context':{'tool':_0xa94536(0xe4),'repo_path':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x132)],'query':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x15b)],'model':_0xa94536(0xa7),'is_timeout':_0x5870c0,'exception_phase':_0xa94536(0xb7),'request_content':{'query':_0x31fb29[_0xa94536(0xcf)][_0xa94536(0x15b)],'repo_path':_0x31fb29['data'][_0xa94536(0x132)],'repoRoot':a0_0x2f511b[_0xa94536(0xd2)](_0x31fb29['data'][_0xa94536(0x132)]),'model':_0xa94536(0xa7)}},'stack_trace':_0x150559 instanceof Error?_0x150559[_0xa94536(0xd6)]:undefined,'source':_0xa94536(0x151)})[_0xa94536(0x178)](()=>{}),{'content':[{'type':_0xa94536(0xb3),'text':_0xa94536(0x154)+_0x93e522}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x51666b=WarpGrepGitHubArgsSchema[_0xa94536(0xd8)](_0x3d9cdd);if(!_0x51666b['success'])return{'content':[{'type':_0xa94536(0xb3),'text':_0xa94536(0xaf)+_0x51666b['error']}],'isError':!![]};const _0x373134=_0x51666b[_0xa94536(0xcf)]['github_url']||_0x51666b[_0xa94536(0xcf)][_0xa94536(0x199)];if(!_0x373134)return{'content':[{'type':_0xa94536(0xb3),'text':_0xa94536(0x91)}],'isError':!![]};const _0x54ec8f=MORPH_API_KEY;if(!_0x54ec8f)throw new Error(_0xa94536(0x123));const _0x304fc9=Date[_0xa94536(0x152)]();logger[_0xa94536(0x103)](_0xa94536(0xfc),_0xa94536(0xe1),{'identifier':_0x373134,'query':_0x51666b[_0xa94536(0xcf)][_0xa94536(0x15b)],'branch':_0x51666b[_0xa94536(0xcf)][_0xa94536(0x10d)]});try{const _0x5b9440=new WarpGrepClient({'morphApiKey':_0x54ec8f,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3079e0=await _0x5b9440[_0xa94536(0xc1)]({'searchTerm':_0x51666b['data'][_0xa94536(0x15b)],'github':_0x373134,'branch':_0x51666b['data'][_0xa94536(0x10d)]}),_0xd8cce0=Date[_0xa94536(0x152)]()-_0x304fc9;logMcpStderr(_0xa94536(0x148)+_0xd8cce0+'ms.\x20Success:\x20'+_0x3079e0[_0xa94536(0xd7)]);const _0x3c4c3d=formatResult(_0x3079e0);return{'content':[{'type':_0xa94536(0xb3),'text':_0x3c4c3d}]};}catch(_0x1a7e36){const _0x11841b=handleMorphAPIError(_0x1a7e36);if(_0x11841b)return _0x11841b;const _0x2ea1dc=Date['now']()-_0x304fc9,_0x470d9a=_0x1a7e36 instanceof Error?_0x1a7e36['message']:String(_0x1a7e36);return logMcpStderr(_0xa94536(0x117)+_0x2ea1dc+'ms:',_0x470d9a),reportMorphError({'error_message':_0x470d9a,'error_type':_0x1a7e36 instanceof Error?_0x1a7e36[_0xa94536(0xdd)][_0xa94536(0x111)]:'UnknownError','context':{'tool':_0xa94536(0x1a6),'github_url':_0x373134,'search_string':_0x51666b[_0xa94536(0xcf)][_0xa94536(0x15b)],'branch':_0x51666b['data'][_0xa94536(0x10d)]},'stack_trace':_0x1a7e36 instanceof Error?_0x1a7e36[_0xa94536(0xd6)]:undefined,'source':_0xa94536(0x151),'tool':_0xa94536(0x1a6),'latency_ms':_0x2ea1dc})[_0xa94536(0x178)](()=>{}),{'content':[{'type':_0xa94536(0xb3),'text':_0xa94536(0x114)+_0x470d9a}],'isError':![]};}}default:throw new Error(_0xa94536(0x12a)+_0x43da34);}}catch(_0x3a6aa3){const _0x2d1639=_0x3a6aa3 instanceof Error?_0x3a6aa3[_0xa94536(0x128)]:String(_0x3a6aa3);return reportMorphError({'error_message':_0x2d1639,'error_type':_0x3a6aa3 instanceof Error?_0x3a6aa3[_0xa94536(0xdd)][_0xa94536(0x111)]:_0xa94536(0x181),'context':{'tool':_0x43da34,'arguments':_0x3d9cdd?JSON['stringify'](_0x3d9cdd)[_0xa94536(0x194)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x3a6aa3 instanceof Error?_0x3a6aa3[_0xa94536(0xd6)]:undefined,'source':_0xa94536(0x151)})[_0xa94536(0x178)](()=>{}),{'content':[{'type':_0xa94536(0xb3),'text':'Error:\x20'+_0x2d1639}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4975f2){const _0x4107d9=a0_0x104249,_0x3db85e=await getValidRootDirectories(_0x4975f2);if(_0x3db85e[_0x4107d9(0x14d)]>0x0)allowedDirectories=[..._0x3db85e],logMcpStderr(_0x4107d9(0x122)+_0x3db85e['length']+_0x4107d9(0xc8));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x187736=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x187736&&(allowedDirectories=[_0x187736],logMcpStderr(_0x4107d9(0x17f)+_0x187736));}catch(_0x3f2b26){logMcpStderr(_0x4107d9(0xe6)+_0x3f2b26);}}}server[a0_0x104249(0x10e)](RootsListChangedNotificationSchema,async()=>{const _0x363f50=a0_0x104249;try{const _0x399e4b=await server[_0x363f50(0x175)]();_0x399e4b&&'roots'in _0x399e4b&&await updateAllowedDirectoriesFromRoots(_0x399e4b[_0x363f50(0x156)]);}catch(_0x1d7890){logMcpStderr(_0x363f50(0x139),_0x1d7890 instanceof Error?_0x1d7890[_0x363f50(0x128)]:String(_0x1d7890));}}),server[a0_0x104249(0x87)]=async()=>{const _0x10845e=a0_0x104249,_0x1eb1fc=server[_0x10845e(0xf6)]();if(_0x1eb1fc?.[_0x10845e(0x156)])try{const _0x54f3ac=await server[_0x10845e(0x175)]();_0x54f3ac&&_0x10845e(0x156)in _0x54f3ac?await updateAllowedDirectoriesFromRoots(_0x54f3ac[_0x10845e(0x156)]):logMcpStderr(_0x10845e(0x159));}catch(_0x3f1c70){logMcpStderr(_0x10845e(0x130),_0x3f1c70 instanceof Error?_0x3f1c70[_0x10845e(0x128)]:String(_0x3f1c70));}else{if(allowedDirectories[_0x10845e(0x14d)]>0x0)logMcpStderr(_0x10845e(0xef),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x10845e(0x155));}}};async function runServer(){const _0x272889=a0_0x104249,_0x3351e1=new StdioServerTransport();await server[_0x272889(0x14a)](_0x3351e1),logMcpStderr(_0x272889(0x138)),allowedDirectories['length']===0x0&&logMcpStderr(_0x272889(0xe5));}runServer()[a0_0x104249(0x178)](_0x472fae=>{const _0x3c5083=a0_0x104249;logMcpStderr(_0x3c5083(0x142),_0x472fae),process[_0x3c5083(0x168)](0x1);});
2
+ const a0_0x503392=a0_0x4413;(function(_0x252f3d,_0x1b6d7d){const _0x478250=a0_0x4413,_0x321c61=_0x252f3d();while(!![]){try{const _0x65e96e=parseInt(_0x478250(0x1aa))/0x1*(parseInt(_0x478250(0x1c6))/0x2)+-parseInt(_0x478250(0x158))/0x3+parseInt(_0x478250(0x19e))/0x4*(-parseInt(_0x478250(0x120))/0x5)+parseInt(_0x478250(0x1fe))/0x6+parseInt(_0x478250(0x186))/0x7+-parseInt(_0x478250(0x13c))/0x8+-parseInt(_0x478250(0x1d1))/0x9;if(_0x65e96e===_0x1b6d7d)break;else _0x321c61['push'](_0x321c61['shift']());}catch(_0x399097){_0x321c61['push'](_0x321c61['shift']());}}}(a0_0x4338,0xd31dd));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_0x306e16 from'fs/promises';import a0_0x43e623 from'path';import a0_0x28c33c 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{logger}from'./logger.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_0x21726c from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x85e325){const _0x593c37=a0_0x4413,_0x3875ba=_0x85e325['split'](a0_0x43e623[_0x593c37(0x1e7)])['filter'](Boolean);if(_0x3875ba[_0x593c37(0x13b)]<0x2)return null;for(let _0x30c086=Math[_0x593c37(0x224)](_0x3875ba[_0x593c37(0x13b)]/0x2);_0x30c086>=0x1;_0x30c086--){for(let _0x55d748=0x0;_0x55d748<=_0x3875ba[_0x593c37(0x13b)]-0x2*_0x30c086;_0x55d748++){const _0x168d18=_0x3875ba[_0x593c37(0x1d3)](_0x55d748,_0x55d748+_0x30c086),_0x12ea2e=_0x3875ba[_0x593c37(0x1d3)](_0x55d748+_0x30c086,_0x55d748+0x2*_0x30c086);if(_0x168d18[_0x593c37(0x189)]((_0x1ec3da,_0x36eb9d)=>_0x1ec3da===_0x12ea2e[_0x36eb9d])){const _0x48904c=[..._0x3875ba[_0x593c37(0x1d3)](0x0,_0x55d748),..._0x3875ba[_0x593c37(0x1d3)](_0x55d748+_0x30c086)];return a0_0x43e623['sep']+_0x48904c[_0x593c37(0x22f)](a0_0x43e623[_0x593c37(0x1e7)]);}}}return null;}function a0_0x4413(_0x26709a,_0x375164){_0x26709a=_0x26709a-0x11a;const _0x433850=a0_0x4338();let _0x441354=_0x433850[_0x26709a];return _0x441354;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x28c33d=a0_0x4413;try{const _0x33856d=require('../package.json');return _0x33856d['version']??_0x28c33d(0x171);}catch(_0x5d8731){return logMcpStderr(_0x28c33d(0x139),_0x5d8731),_0x28c33d(0x171);}}function printHelp(){const _0x4b8811=a0_0x4413;console[_0x4b8811(0x214)](_0x4b8811(0x192)+getPackageVersion()),console[_0x4b8811(0x214)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x4b8811(0x214)](_0x4b8811(0x163)),console[_0x4b8811(0x214)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x4b8811(0x214)](_0x4b8811(0x22d)),console['log']('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log']('\x0aExamples:'),console[_0x4b8811(0x214)](_0x4b8811(0x235)),console[_0x4b8811(0x214)](_0x4b8811(0x196));}const cliArgs=process['argv'][a0_0x503392(0x1d3)](0x2),VERSION_FLAGS=new Set([a0_0x503392(0x169),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x503392(0x1ab)](_0x470989=>VERSION_FLAGS[a0_0x503392(0x206)](_0x470989))&&(console[a0_0x503392(0x214)](a0_0x503392(0x192)+getPackageVersion()),process[a0_0x503392(0x131)](0x0));cliArgs[a0_0x503392(0x1ab)](_0x4be42a=>HELP_FLAGS[a0_0x503392(0x206)](_0x4be42a))&&(printHelp(),process[a0_0x503392(0x131)](0x0));function getCliArg(_0x3579cf){const _0x3d2301=a0_0x503392;for(let _0x470ea3=0x0;_0x470ea3<cliArgs[_0x3d2301(0x13b)];_0x470ea3++){const _0x5775bb=cliArgs[_0x470ea3];if(_0x5775bb[_0x3d2301(0x12d)]('--'+_0x3579cf+'='))return _0x5775bb[_0x3d2301(0x1d3)](('--'+_0x3579cf+'=')[_0x3d2301(0x13b)]);if(_0x5775bb==='--'+_0x3579cf&&_0x470ea3+0x1<cliArgs[_0x3d2301(0x13b)])return cliArgs[_0x470ea3+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x503392(0x206)](arg)||HELP_FLAGS[a0_0x503392(0x206)](arg))continue;if(arg[a0_0x503392(0x12d)](a0_0x503392(0x193)))continue;if(arg===a0_0x503392(0x207)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x503392(0x22c)][a0_0x503392(0x175)]||process[a0_0x503392(0x22c)][a0_0x503392(0x22b)]||process[a0_0x503392(0x129)](),ENABLE_WORKSPACE_MODE=process[a0_0x503392(0x22c)][a0_0x503392(0x160)]!==a0_0x503392(0x145),MORPH_API_KEY=getCliArg(a0_0x503392(0x146))??process[a0_0x503392(0x22c)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x503392(0x22c)][a0_0x503392(0x127)],MORPH_LARGE_APPLY=process['env'][a0_0x503392(0x20c)]!==a0_0x503392(0x145),MORPH_WARP_GREP_TIMEOUT=process[a0_0x503392(0x22c)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x503392(0x22c)][a0_0x503392(0x132)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x503392(0x22c)][a0_0x503392(0x1bb)]?new Set(process[a0_0x503392(0x22c)][a0_0x503392(0x1bb)][a0_0x503392(0x172)](',')['map'](_0x51e4d2=>_0x51e4d2[a0_0x503392(0x1a0)]())[a0_0x503392(0x14a)](_0x88b6e=>_0x88b6e[a0_0x503392(0x13b)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x503392(0x1e9)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x503392(0x206)](tool)&&console[a0_0x503392(0x180)](a0_0x503392(0x20a)+tool+a0_0x503392(0x228)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x503392(0x180)](a0_0x503392(0x216)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x503392(0x12d)](a0_0x503392(0x195))&&!MORPH_API_KEY[a0_0x503392(0x12d)](a0_0x503392(0x1ce))&&logMcpStderr(a0_0x503392(0x15e));async function reportMorphError(_0x5ce6c1){const _0x26af4c=a0_0x503392;try{await a0_0x21726c[_0x26af4c(0x1e2)](_0x26af4c(0x170),{..._0x5ce6c1,'timestamp':new Date()[_0x26af4c(0x20f)](),'source':_0x5ce6c1[_0x26af4c(0x191)]||_0x26af4c(0x11e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x5ce6c1[_0x26af4c(0x1a3)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x26af4c(0x15c),'Authorization':_0x26af4c(0x12b)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x24ed1f,_0x11ba83){const _0x517c9b=a0_0x503392;if(_0x24ed1f&&typeof _0x24ed1f===_0x517c9b(0x1c9)&&'status'in _0x24ed1f)return _0x24ed1f['status'];if(_0x24ed1f&&typeof _0x24ed1f==='object'&&_0x517c9b(0x13f)in _0x24ed1f)return _0x24ed1f[_0x517c9b(0x13f)]?.[_0x517c9b(0x1e6)];const _0x1c4211=_0x11ba83[_0x517c9b(0x1d9)](/\b(401|429)\b/);return _0x1c4211?parseInt(_0x1c4211[0x1],0xa):null;}function handleMorphAPIError(_0x4a328f){const _0x2c989d=a0_0x503392,_0x21d0fc=_0x4a328f instanceof Error?_0x4a328f[_0x2c989d(0x164)]:String(_0x4a328f),_0x19d946=extractStatusCode(_0x4a328f,_0x21d0fc);switch(_0x19d946){case 0x191:return{'content':[{'type':_0x2c989d(0x176),'text':'Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x2c989d(0x12e)}],'isError':!![]};default:return null;}}args[a0_0x503392(0x13b)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x503392(0x138)),logMcpStderr(a0_0x503392(0x1b5)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x503392(0x213)),logMcpStderr(a0_0x503392(0x1c3)),logMcpStderr(a0_0x503392(0x1d2)));function normalizePath(_0x50fc79){const _0x33f268=a0_0x503392;return a0_0x43e623[_0x33f268(0x14b)](_0x50fc79);}function expandHome(_0xf28e5){const _0x620887=a0_0x503392;if(_0xf28e5['startsWith']('~/')||_0xf28e5==='~')return a0_0x43e623[_0x620887(0x22f)](a0_0x28c33c[_0x620887(0x1cd)](),_0xf28e5[_0x620887(0x1d3)](0x1));return _0xf28e5;}let allowedDirectories=await Promise['all'](args[a0_0x503392(0x197)](async _0x5811cb=>{const _0x1f6819=a0_0x503392,_0x26198a=expandHome(_0x5811cb),_0x23cbb1=a0_0x43e623[_0x1f6819(0x23b)](_0x26198a);try{const _0x274595=await a0_0x306e16['realpath'](_0x23cbb1);return normalizePath(_0x274595);}catch(_0x4cad51){return normalizePath(_0x23cbb1);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x503392(0x1bd)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x503392(0x1bc)));}catch(a0_0x158b75){logMcpStderr(a0_0x503392(0x1df)+a0_0x158b75);}async function detectWorkspaceRoot(_0x10b65c){const _0x386378=a0_0x503392;let _0x96bd7f=a0_0x43e623[_0x386378(0x23b)](_0x10b65c);const _0x421246=[_0x386378(0x1e4),_0x386378(0x179),_0x386378(0x124),_0x386378(0x1f1),_0x386378(0x11a),_0x386378(0x165),_0x386378(0x1dd),_0x386378(0x137),_0x386378(0x16c)];while(_0x96bd7f!==a0_0x43e623['dirname'](_0x96bd7f)){for(const _0x32a925 of _0x421246){const _0x1a8881=a0_0x43e623[_0x386378(0x22f)](_0x96bd7f,_0x32a925);try{return await a0_0x306e16[_0x386378(0x156)](_0x1a8881),normalizePath(_0x96bd7f);}catch{}}_0x96bd7f=a0_0x43e623[_0x386378(0x209)](_0x96bd7f);}return normalizePath(_0x10b65c);}await Promise[a0_0x503392(0x223)](args[a0_0x503392(0x197)](async _0xcf79ec=>{const _0x564aa9=a0_0x503392;try{const _0x4b46df=await a0_0x306e16[_0x564aa9(0x23d)](expandHome(_0xcf79ec));!_0x4b46df[_0x564aa9(0x1fd)]()&&(logMcpStderr(_0x564aa9(0x198)+_0xcf79ec+_0x564aa9(0x13e)),process[_0x564aa9(0x131)](0x1));}catch(_0x2ded06){logMcpStderr(_0x564aa9(0x15b)+_0xcf79ec+':',_0x2ded06),process['exit'](0x1);}}));async function validatePath(_0x18f76f){const _0x18c8aa=a0_0x503392,_0x45cff9=expandHome(_0x18f76f),_0x381818=a0_0x43e623[_0x18c8aa(0x23b)](_0x45cff9);logger[_0x18c8aa(0x226)](_0x18c8aa(0x128),_0x18c8aa(0x1ed),{'raw_path':_0x18f76f,'absolute':_0x381818});try{const _0xeb7a51=await a0_0x306e16[_0x18c8aa(0x1c0)](_0x381818);return logger[_0x18c8aa(0x226)](_0x18c8aa(0x128),_0x18c8aa(0x159),{'resolved':_0xeb7a51,'symlink':_0xeb7a51!==_0x381818}),_0xeb7a51;}catch(_0xabbef8){if(_0xabbef8[_0x18c8aa(0x194)]===_0x18c8aa(0x1e0)){const _0x33e5fd=a0_0x43e623[_0x18c8aa(0x209)](_0x381818);try{const _0x397ec3=await a0_0x306e16[_0x18c8aa(0x1c0)](_0x33e5fd),_0x516f00=a0_0x43e623[_0x18c8aa(0x22f)](_0x397ec3,a0_0x43e623[_0x18c8aa(0x222)](_0x381818));return logger[_0x18c8aa(0x226)](_0x18c8aa(0x128),_0x18c8aa(0x159),{'resolved':_0x516f00,'new_file':!![]}),_0x516f00;}catch{logger[_0x18c8aa(0x180)](_0x18c8aa(0x128),_0x18c8aa(0x1b9),{'raw_path':_0x18f76f,'error':_0x18c8aa(0x238)+_0x33e5fd});throw new Error(_0x18c8aa(0x238)+_0x33e5fd);}}logger[_0x18c8aa(0x180)](_0x18c8aa(0x128),_0x18c8aa(0x1b9),{'raw_path':_0x18f76f,'error':_0xabbef8[_0x18c8aa(0x164)]});throw _0xabbef8;}}const MorphEditFileArgsSchema=z[a0_0x503392(0x1c9)]({'path':z[a0_0x503392(0x18e)](),'code_edit':z[a0_0x503392(0x18e)]()[a0_0x503392(0x187)](a0_0x503392(0x1b6)),'instruction':z[a0_0x503392(0x18e)]()[a0_0x503392(0x187)](a0_0x503392(0x1e1)),'dryRun':z[a0_0x503392(0x22e)]()[a0_0x503392(0x14c)](![])[a0_0x503392(0x187)](a0_0x503392(0x153))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x503392(0x140),WarpGrepArgsSchema=z[a0_0x503392(0x1c9)]({'search_string':z[a0_0x503392(0x18e)]()[a0_0x503392(0x187)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x503392(0x18e)]()[a0_0x503392(0x187)](a0_0x503392(0x182)),'search_type':z[a0_0x503392(0x1eb)]([a0_0x503392(0x14c),a0_0x503392(0x221)])[a0_0x503392(0x141)]()['describe'](a0_0x503392(0x230))}),WarpGrepGitHubArgsSchema=z[a0_0x503392(0x1c9)]({'search_string':z['string']()[a0_0x503392(0x187)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x503392(0x18e)]()['optional']()[a0_0x503392(0x187)](a0_0x503392(0x1a4)),'owner_repo':z['string']()[a0_0x503392(0x141)]()[a0_0x503392(0x187)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x503392(0x18e)]()[a0_0x503392(0x141)]()[a0_0x503392(0x187)](a0_0x503392(0x23a))}),CodebaseSearchArgsSchema=z['object']({'query':z[a0_0x503392(0x18e)]()[a0_0x503392(0x187)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x503392(0x18e)]()[a0_0x503392(0x187)](a0_0x503392(0x144)),'branch':z[a0_0x503392(0x18e)]()[a0_0x503392(0x141)]()[a0_0x503392(0x187)](a0_0x503392(0x1d7)),'commitHash':z[a0_0x503392(0x18e)]()[a0_0x503392(0x141)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x503392(0x16a)](z[a0_0x503392(0x18e)]())['default']([])['describe'](a0_0x503392(0x202)),'limit':z[a0_0x503392(0x122)]()[a0_0x503392(0x141)]()['default'](0xa)[a0_0x503392(0x187)](a0_0x503392(0x21d))}),server=new Server({'name':a0_0x503392(0x148),'version':a0_0x503392(0x147)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x20a212=a0_0x503392,_0x44c72a=[{'name':TOOL_NAMES[_0x20a212(0x143)],'description':_0x20a212(0x1ca)+_0x20a212(0x1a1)+'Parameters:\x0a'+_0x20a212(0x1b7)+_0x20a212(0x174)+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+_0x20a212(0x1a6)+_0x20a212(0x155)+_0x20a212(0x21f)+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x20a212(0x177)+_0x20a212(0x1d8)+'-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0x20a212(0x16e)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x20a212(0x237)+_0x20a212(0x1d4)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3d303d=_0x44c72a[_0x20a212(0x14a)](_0x321c74=>{const _0x2ed925=_0x20a212;if(DISABLED_TOOLS['has'](_0x321c74[_0x2ed925(0x1b4)]))return console[_0x2ed925(0x180)](_0x2ed925(0x1c2)+_0x321c74[_0x2ed925(0x1b4)]+_0x2ed925(0x1fc)),![];if(_0x2ed925(0x11c)in _0x321c74&&_0x321c74[_0x2ed925(0x11c)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x321c74[_0x2ed925(0x1b4)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x3d303d[_0x20a212(0x197)](_0x2c08e9=>({'name':_0x2c08e9[_0x20a212(0x1b4)],'description':_0x2c08e9[_0x20a212(0x135)],'inputSchema':_0x2c08e9['inputSchema']}))};}),server[a0_0x503392(0x1b3)](CallToolRequestSchema,async _0x5429f6=>{const _0x22f1cc=a0_0x503392,{name:_0x1897bb,arguments:_0x3b0c99}=_0x5429f6[_0x22f1cc(0x1a8)],_0x3fcabd=Date[_0x22f1cc(0x200)]();logger[_0x22f1cc(0x226)](_0x22f1cc(0x128),_0x22f1cc(0x1be),{'tool':_0x1897bb,'args':_0x1897bb===_0x22f1cc(0x1ac)?{'path':_0x3b0c99?.[_0x22f1cc(0x1a2)],'instruction':_0x3b0c99?.[_0x22f1cc(0x185)]||_0x3b0c99?.['instructions'],'dryRun':_0x3b0c99?.[_0x22f1cc(0x134)]}:_0x3b0c99});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x22f1cc(0x176),'text':_0x22f1cc(0x1ff)}],'isError':!![]};if(!MORPH_API_KEY[_0x22f1cc(0x12d)](_0x22f1cc(0x195))&&!MORPH_API_KEY[_0x22f1cc(0x12d)](_0x22f1cc(0x1ce)))return{'content':[{'type':_0x22f1cc(0x176),'text':_0x22f1cc(0x219)}],'isError':!![]};if(DISABLED_TOOLS[_0x22f1cc(0x206)](_0x1897bb))return{'content':[{'type':_0x22f1cc(0x176),'text':'Tool\x20\x22'+_0x1897bb+_0x22f1cc(0x1fa)}],'isError':![]};switch(_0x1897bb){case TOOL_NAMES[_0x22f1cc(0x143)]:{let _0x505e72=_0x3b0c99;if(_0x505e72&&typeof _0x505e72===_0x22f1cc(0x1c9)){if(!(_0x22f1cc(0x1a2)in _0x505e72)){const _0x32bcc4=_0x505e72['target_file']??_0x505e72['filePath']??_0x505e72['target_filepath']??_0x505e72[_0x22f1cc(0x11f)]??_0x505e72[_0x22f1cc(0x1e8)];if(_0x32bcc4)_0x505e72={..._0x505e72,'path':_0x32bcc4};}'instructions'in _0x505e72&&!(_0x22f1cc(0x185)in _0x505e72)&&(_0x505e72={..._0x505e72,'instruction':_0x505e72[_0x22f1cc(0x229)]});if(!(_0x22f1cc(0x21c)in _0x505e72)){const _0x299ea3=_0x505e72[_0x22f1cc(0x194)]??_0x505e72[_0x22f1cc(0x236)]??_0x505e72[_0x22f1cc(0x240)]??_0x505e72[_0x22f1cc(0x11d)];if(_0x299ea3)_0x505e72={..._0x505e72,'code_edit':_0x299ea3};}}const _0x210a2d=MorphEditFileArgsSchema['safeParse'](_0x505e72);if(!_0x210a2d[_0x22f1cc(0x227)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x210a2d['error']);const _0x9a06bb=await validatePath(_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x1a2)]);let _0x1e58f0=null,_0x3360df=!![],_0x1d867f=null;try{_0x1e58f0=await a0_0x306e16[_0x22f1cc(0x1af)](_0x9a06bb,'utf-8'),logger[_0x22f1cc(0x226)]('MCP',_0x22f1cc(0x1c8),{'path':_0x9a06bb,'size_bytes':_0x1e58f0[_0x22f1cc(0x13b)]});}catch(_0x480bae){const _0x3e6ed1=_0x480bae[_0x22f1cc(0x194)];_0x3e6ed1===_0x22f1cc(0x1e0)?(_0x3360df=![],_0x1e58f0='',logger[_0x22f1cc(0x226)](_0x22f1cc(0x128),_0x22f1cc(0x1c8),{'path':_0x9a06bb,'exists':![]})):(_0x1d867f='Failed\x20to\x20read\x20file:\x20'+(_0x3e6ed1||'unknown')+_0x22f1cc(0x12a)+(_0x480bae instanceof Error?_0x480bae['message']:String(_0x480bae)),logger[_0x22f1cc(0x180)]('MCP','file_read_failed',{'path':_0x9a06bb,'error':_0x1d867f}),logMcpStderr(_0x22f1cc(0x233)+_0x1d867f));}let _0x1ab077;try{const _0x1f0976=MORPH_API_KEY;if(!_0x1f0976)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x21a7d3=a0_0x43e623[_0x22f1cc(0x209)](_0x9a06bb),_0x58ad1d=a0_0x43e623['basename'](_0x9a06bb);logger['debug'](_0x22f1cc(0x128),'api_request_start',{'model':_0x22f1cc(0x162),'path':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x1a2)],'instruction_len':_0x210a2d['data'][_0x22f1cc(0x185)]['length'],'code_edit_len':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x21c)][_0x22f1cc(0x13b)],'original_code_len':_0x1e58f0?.[_0x22f1cc(0x13b)]??0x0,'dry_run':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x134)]});const _0x3395ea=Date[_0x22f1cc(0x200)](),_0xb39f2=await executeEditFile({'target_filepath':_0x58ad1d,'code_edit':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x21c)],'instruction':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x185)]},{'morphApiKey':_0x1f0976,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x21a7d3,'autoWrite':!_0x210a2d['data'][_0x22f1cc(0x134)],'generateUdiff':![],'debug':![]}),_0x55d849=Date[_0x22f1cc(0x200)]()-_0x3395ea;_0x1ab077=_0xb39f2[_0x22f1cc(0x1f4)];if(!_0xb39f2[_0x22f1cc(0x227)])throw new Error(_0xb39f2[_0x22f1cc(0x180)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x1257d2=_0xb39f2[_0x22f1cc(0x136)],_0x440ce2=_0x22f1cc(0x1e5)+_0x1257d2[_0x22f1cc(0x188)]+',\x20removed\x20'+_0x1257d2[_0x22f1cc(0x1db)]+_0x22f1cc(0x21b)+_0x1257d2[_0x22f1cc(0x19f)];logger[_0x22f1cc(0x226)](_0x22f1cc(0x128),_0x22f1cc(0x142),{'tool':_0x22f1cc(0x1ac),'success':!![],'latency_ms':Date['now']()-_0x3fcabd,'edit_latency_ms':_0x55d849,'changes':{'added':_0x1257d2['linesAdded'],'removed':_0x1257d2[_0x22f1cc(0x1db)],'modified':_0x1257d2['linesModified']},'completion_id':_0x1ab077});if(_0x210a2d['data']['dryRun'])return{'content':[{'type':'text','text':_0x22f1cc(0x16d)+(_0x3360df?'':_0x22f1cc(0x130))+':\x20'+_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x185)]+_0x22f1cc(0x190)+_0x440ce2+_0x22f1cc(0x199)+_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x1a2)]+'.'}]};return{'content':[{'type':_0x22f1cc(0x176),'text':'Morph\x20Edit\x20'+(_0x3360df?_0x22f1cc(0x1f8):_0x22f1cc(0x1dc))+':\x20'+_0x210a2d['data']['instruction']+_0x22f1cc(0x190)+_0x440ce2+_0x22f1cc(0x199)+_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x1a2)]+'.'}]};}catch(_0x2e2b4){const _0xf7f391=handleMorphAPIError(_0x2e2b4);if(_0xf7f391)return logger[_0x22f1cc(0x180)]('MCP','tool_call_error',{'tool':_0x22f1cc(0x1ac),'error':_0x22f1cc(0x157),'latency_ms':Date[_0x22f1cc(0x200)]()-_0x3fcabd}),_0xf7f391;const _0x591b8a=_0x2e2b4 instanceof Error?_0x2e2b4[_0x22f1cc(0x164)]:String(_0x2e2b4);return logger[_0x22f1cc(0x180)]('MCP',_0x22f1cc(0x1e3),{'tool':_0x22f1cc(0x1ac),'error':_0x591b8a,'path':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x1a2)],'validated_path':_0x9a06bb,'latency_ms':Date['now']()-_0x3fcabd,'stack':_0x2e2b4 instanceof Error?_0x2e2b4['stack']:undefined}),reportMorphError({'error_message':_0x591b8a,'error_type':_0x2e2b4 instanceof Error?_0x2e2b4[_0x22f1cc(0x17c)][_0x22f1cc(0x1b4)]:_0x22f1cc(0x1bf),'context':{'tool':'edit_file','completion_id':_0x1ab077,'file_path':_0x210a2d['data'][_0x22f1cc(0x1a2)],'validated_path':_0x9a06bb,'instruction':_0x210a2d['data'][_0x22f1cc(0x185)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x22f1cc(0x162),'dry_run':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x134)],'file_exists':_0x3360df,'file_read_error':_0x1d867f,'file_readable':_0x1e58f0!==null,'request_content':{'path':_0x210a2d[_0x22f1cc(0x17a)]['path'],'code_edit':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x21c)],'instruction':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x185)],'original_code':_0x1e58f0!==null?_0x1e58f0[_0x22f1cc(0x13b)]>0xc350?_0x1e58f0['substring'](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x1e58f0['length']+'\x20chars)':_0x1e58f0:_0x22f1cc(0x20b)+(_0x1d867f||_0x22f1cc(0x17f))+']','original_code_length':_0x1e58f0?.[_0x22f1cc(0x13b)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':'morph-v3-fast','dry_run':_0x210a2d[_0x22f1cc(0x17a)][_0x22f1cc(0x134)]}},'stack_trace':_0x2e2b4 instanceof Error?_0x2e2b4[_0x22f1cc(0x1ba)]:undefined,'source':_0x22f1cc(0x11e)})['catch'](()=>{}),{'content':[{'type':_0x22f1cc(0x176),'text':_0x22f1cc(0x21e)+_0x591b8a}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x2038da=WarpGrepArgsSchema[_0x22f1cc(0x1cb)](_0x3b0c99);if(!_0x2038da['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x2038da[_0x22f1cc(0x180)]}],'isError':!![]};const _0x1791c9=_0x54f5a9=>{const _0xcab09e=_0x22f1cc,_0x2c7ec0=[];for(const _0x43deb5 of _0x54f5a9||[]){if(_0x43deb5[_0xcab09e(0x121)]===_0xcab09e(0x1ea)&&Array[_0xcab09e(0x217)](_0x43deb5[_0xcab09e(0x126)]))for(const _0x421959 of _0x43deb5[_0xcab09e(0x126)]){try{const _0x4a5c3d=_0x421959[_0xcab09e(0x203)]?.['name'],_0x42bca0=JSON[_0xcab09e(0x19a)](_0x421959[_0xcab09e(0x203)]?.[_0xcab09e(0x1a5)]||'{}');if(_0x4a5c3d===_0xcab09e(0x21a))_0x2c7ec0[_0xcab09e(0x1bd)](_0xcab09e(0x225)+_0x42bca0[_0xcab09e(0x166)]+'\x27\x20'+(_0x42bca0[_0xcab09e(0x1a2)]||'.'));else{if(_0x4a5c3d===_0xcab09e(0x215))_0x2c7ec0[_0xcab09e(0x1bd)](_0xcab09e(0x23c)+_0x42bca0[_0xcab09e(0x1a2)]);else{if(_0x4a5c3d===_0xcab09e(0x17b))_0x2c7ec0[_0xcab09e(0x1bd)](_0xcab09e(0x1cc)+(_0x42bca0[_0xcab09e(0x1f7)]||'.'));else{if(_0x4a5c3d==='glob')_0x2c7ec0[_0xcab09e(0x1bd)](_0xcab09e(0x16f)+_0x42bca0['pattern']+'\x27\x20'+(_0x42bca0[_0xcab09e(0x1a2)]||'.'));else _0x4a5c3d===_0xcab09e(0x1b2)&&_0x2c7ec0[_0xcab09e(0x1bd)](_0xcab09e(0x1b2));}}}}catch{}}}return _0x2c7ec0;},_0x235f34=_0x4c55da=>{const _0x7a3019=_0x22f1cc,_0xe75cb4=[];if(!_0x4c55da||!Array['isArray'](_0x4c55da))return _0xe75cb4;const _0x3fe444=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x7a3019(0x1c5),'tool':_0x7a3019(0x215)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x7a3019(0x150),'tool':_0x7a3019(0x215)},{'pattern':/\[READ ERROR\]/,'error_type':_0x7a3019(0x1a9),'tool':_0x7a3019(0x215)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x7a3019(0x1c4),'tool':_0x7a3019(0x215)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x7a3019(0x151),'tool':_0x7a3019(0x1a7)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x7a3019(0x218),'tool':_0x7a3019(0x1a7)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x7a3019(0x1c4),'tool':_0x7a3019(0x215)},{'pattern':/\[SYMLINK\]/,'error_type':_0x7a3019(0x17e),'tool':_0x7a3019(0x215)},{'pattern':/not a text file/,'error_type':_0x7a3019(0x1c4),'tool':_0x7a3019(0x215)},{'pattern':/symbolic link/,'error_type':_0x7a3019(0x17e),'tool':_0x7a3019(0x215)},{'pattern':/Error reading file:/,'error_type':_0x7a3019(0x1a9),'tool':_0x7a3019(0x215)},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x7a3019(0x171)}];let _0x18c317=0x0;for(const _0x16a333 of _0x4c55da){_0x16a333['role']===_0x7a3019(0x1ea)&&Array[_0x7a3019(0x217)](_0x16a333[_0x7a3019(0x126)])&&_0x18c317++;const _0x272cee=_0x16a333[_0x7a3019(0x240)];if((_0x16a333[_0x7a3019(0x121)]===_0x7a3019(0x13a)||_0x16a333['role']===_0x7a3019(0x14e))&&_0x272cee&&typeof _0x272cee===_0x7a3019(0x18e))for(const {pattern:_0x3e5458,error_type:_0x167070,tool:_0x1d1a3c}of _0x3fe444){const _0x1bb93b=_0x272cee[_0x7a3019(0x1d9)](new RegExp(_0x3e5458[_0x7a3019(0x191)],'g'));if(_0x1bb93b)for(const _0xfde4cb of _0x1bb93b){const _0x213bb5=_0x272cee[_0x7a3019(0x1f5)](_0xfde4cb),_0x13b855=_0x272cee['substring'](_0x213bb5,Math[_0x7a3019(0x201)](_0x213bb5+0xc8,_0x272cee[_0x7a3019(0x13b)]));_0xe75cb4[_0x7a3019(0x1bd)]({'tool':_0x1d1a3c,'error_type':_0x167070,'error_message':_0x13b855[_0x7a3019(0x172)]('\x0a')[0x0],'turn':_0x18c317});}}}return _0xe75cb4;};try{const _0x36e883=a0_0x43e623[_0x22f1cc(0x23b)](_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)]),_0x38ac37=_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x1ae)],_0x3dea03=_0x38ac37===_0x22f1cc(0x221)?{'allowNames':['node_modules']}:undefined,_0x593979=new LocalRipgrepProvider(_0x36e883,undefined,_0x3dea03);logger['debug'](_0x22f1cc(0x128),_0x22f1cc(0x178),{'type':_0x22f1cc(0x11b),'repo_root':_0x36e883,'search_type':_0x38ac37||_0x22f1cc(0x14c)}),logger[_0x22f1cc(0x226)](_0x22f1cc(0x128),'warp_grep_start',{'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'repo_root':_0x36e883,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1a0a08=Date[_0x22f1cc(0x200)](),_0x4edcae=await runWarpGrep({'searchTerm':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'repoRoot':_0x36e883,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x593979,'search_type':_0x38ac37}),_0x2d9a33=Date[_0x22f1cc(0x200)]()-_0x1a0a08,_0x1592e9=_0x4edcae['finish']?.[_0x22f1cc(0x208)]?.[_0x22f1cc(0x12f)]?.[_0x22f1cc(0x13b)]??0x0;logger[_0x22f1cc(0x226)](_0x22f1cc(0x128),'warp_grep_complete',{'termination':_0x4edcae['terminationReason'],'turns':_0x4edcae[_0x22f1cc(0x154)]?.[_0x22f1cc(0x231)]??0x0,'files_found':_0x1592e9,'latency_ms':_0x2d9a33});const _0x399005=_0x235f34(_0x4edcae[_0x22f1cc(0x1f9)]);_0x399005[_0x22f1cc(0x13b)]>0x0&&reportMorphError({'error_message':_0x22f1cc(0x205)+_0x399005[_0x22f1cc(0x13b)]+'\x20error(s)','error_type':_0x22f1cc(0x184),'level':_0x22f1cc(0x152),'tool':'codebase_search','context':{'repo_path':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)],'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'model':_0x22f1cc(0x18c),'termination_reason':_0x4edcae['terminationReason'],'sub_tool_errors':_0x399005,'timings':_0x4edcae[_0x22f1cc(0x154)],'tool_calls':_0x1791c9(_0x4edcae[_0x22f1cc(0x1f9)]),'messages':_0x4edcae[_0x22f1cc(0x1f9)]?.[_0x22f1cc(0x197)](_0x17431e=>({'role':_0x17431e[_0x22f1cc(0x121)],'content':_0x17431e['content'],..._0x17431e[_0x22f1cc(0x126)]?{'tool_calls':_0x17431e[_0x22f1cc(0x126)][_0x22f1cc(0x13b)]}:{},..._0x17431e['tool_call_id']?{'tool_call_id':_0x17431e[_0x22f1cc(0x1b8)]}:{}}))},'source':'mcp-filesystem'})[_0x22f1cc(0x14d)](()=>{});let _0x456071='';if(_0x4edcae['terminationReason']===_0x22f1cc(0x23e)&&_0x4edcae[_0x22f1cc(0x1b2)]?.[_0x22f1cc(0x208)]?.[_0x22f1cc(0x12f)]){const _0xf64af2=_0x4edcae[_0x22f1cc(0x1b2)][_0x22f1cc(0x208)][_0x22f1cc(0x12f)];if(_0xf64af2[_0x22f1cc(0x13b)]===0x0)return _0x456071=_0x4edcae[_0x22f1cc(0x1b2)][_0x22f1cc(0x1f6)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x22f1cc(0x176),'text':_0x456071}]};const _0x2549ac=[],_0x21ca76=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x14c502 of _0x4edcae['messages']){if(_0x14c502[_0x22f1cc(0x121)]===_0x22f1cc(0x1ea)&&Array[_0x22f1cc(0x217)](_0x14c502['tool_calls']))for(const _0x459f10 of _0x14c502[_0x22f1cc(0x126)]){try{const _0x2681f2=_0x459f10[_0x22f1cc(0x203)]?.[_0x22f1cc(0x1b4)],_0x516810=JSON[_0x22f1cc(0x19a)](_0x459f10[_0x22f1cc(0x203)]?.[_0x22f1cc(0x1a5)]||'{}');if(_0x2681f2===_0x22f1cc(0x21a))_0x21ca76[_0x22f1cc(0x1bd)](_0x22f1cc(0x1f0)+_0x516810[_0x22f1cc(0x166)]+'\x27\x20in\x20`'+(_0x516810[_0x22f1cc(0x1a2)]||'.')+'`');else{if(_0x2681f2===_0x22f1cc(0x215))_0x21ca76[_0x22f1cc(0x1bd)](_0x22f1cc(0x13d)+_0x516810[_0x22f1cc(0x1a2)]+'`');else{if(_0x2681f2===_0x22f1cc(0x17b))_0x21ca76[_0x22f1cc(0x1bd)](_0x22f1cc(0x212)+(_0x516810[_0x22f1cc(0x1f7)]||'.')+'`');else _0x2681f2===_0x22f1cc(0x210)&&_0x21ca76['push'](_0x22f1cc(0x15f)+_0x516810[_0x22f1cc(0x166)]+_0x22f1cc(0x1cf)+(_0x516810['path']||'.')+'`');}}}catch{}}}_0x2549ac['push'](_0x21ca76[_0x22f1cc(0x22f)]('\x0a'));const _0x3d820c=['',_0x22f1cc(0x123)];for(const _0x48dcfb of _0xf64af2){if(_0x48dcfb[_0x22f1cc(0x1ee)]==='*')_0x3d820c['push']('-\x20'+_0x48dcfb[_0x22f1cc(0x1a2)]+':*');else{if(Array[_0x22f1cc(0x217)](_0x48dcfb[_0x22f1cc(0x1ee)])){const _0x3d7ff2=_0x48dcfb['lines']['map'](([_0xe16fdc,_0x26bbd8])=>{if(_0xe16fdc===_0x26bbd8)return''+_0xe16fdc;return _0xe16fdc+'-'+_0x26bbd8;});_0x3d820c[_0x22f1cc(0x1bd)]('-\x20'+_0x48dcfb['path']+':'+_0x3d7ff2[_0x22f1cc(0x22f)](','));}else _0x3d820c[_0x22f1cc(0x1bd)]('-\x20'+_0x48dcfb['path']+':*');}}_0x3d820c[_0x22f1cc(0x1bd)](''),_0x2549ac['push'](_0x3d820c[_0x22f1cc(0x22f)]('\x0a')),_0x2549ac[_0x22f1cc(0x1bd)](_0x22f1cc(0x234));const _0x5cfdbc=[],_0x1db517=[];for(const _0x4fc1f8 of _0xf64af2){let _0x109b35=a0_0x43e623[_0x22f1cc(0x23b)](_0x2038da['data'][_0x22f1cc(0x239)],_0x4fc1f8['path']),_0x509d6a=null,_0x2b2239=null;try{_0x509d6a=await a0_0x306e16[_0x22f1cc(0x1af)](_0x109b35,{'encoding':'utf-8'});}catch(_0x408bb9){const _0x2ffd69=fixPathRepetition(_0x109b35);if(_0x2ffd69)try{_0x509d6a=await a0_0x306e16[_0x22f1cc(0x1af)](_0x2ffd69,{'encoding':'utf-8'}),_0x109b35=_0x2ffd69;}catch{_0x2b2239=_0x408bb9 instanceof Error?_0x408bb9:new Error(String(_0x408bb9));}else _0x2b2239=_0x408bb9 instanceof Error?_0x408bb9:new Error(String(_0x408bb9));}if(_0x509d6a!==null){const _0x3727d5=_0x509d6a['split'](/\r?\n/),_0x564483=[];if(_0x4fc1f8['lines']==='*'||!Array['isArray'](_0x4fc1f8['lines']))for(let _0x40ce06=0x1;_0x40ce06<=_0x3727d5['length'];_0x40ce06++){const _0x3e9b5f=_0x3727d5[_0x40ce06-0x1];_0x564483[_0x22f1cc(0x1bd)](_0x40ce06+'|\x20'+_0x3e9b5f);}else for(const [_0x2708a7,_0x22aae3]of _0x4fc1f8[_0x22f1cc(0x1ee)]){_0x564483[_0x22f1cc(0x13b)]>0x0&&_0x564483[_0x22f1cc(0x1bd)]('');for(let _0x2ec0e8=_0x2708a7;_0x2ec0e8<=_0x22aae3&&_0x2ec0e8<=_0x3727d5[_0x22f1cc(0x13b)];_0x2ec0e8++){const _0x25c88f=_0x3727d5[_0x2ec0e8-0x1];_0x564483[_0x22f1cc(0x1bd)](_0x2ec0e8+'|\x20'+_0x25c88f);}}_0x1db517[_0x22f1cc(0x1bd)]({'path':_0x4fc1f8[_0x22f1cc(0x1a2)],'content':_0x564483[_0x22f1cc(0x22f)]('\x0a')});}else _0x5cfdbc[_0x22f1cc(0x1bd)]('<file\x20path=\x22'+_0x4fc1f8['path']+_0x22f1cc(0x18d)+(_0x2b2239?.[_0x22f1cc(0x164)]||_0x22f1cc(0x18f))+_0x22f1cc(0x1ad));}try{const _0x19781a=await compactFileContexts(_0x1db517,_0x2038da[_0x22f1cc(0x17a)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x5df196 of _0x19781a){_0x5cfdbc[_0x22f1cc(0x1bd)](_0x22f1cc(0x1d5)+_0x5df196[_0x22f1cc(0x1a2)]+'\x22>\x0a'+_0x5df196[_0x22f1cc(0x240)]+_0x22f1cc(0x1ad));}}catch(_0x1f8003){logger[_0x22f1cc(0x152)](_0x22f1cc(0x128),_0x22f1cc(0x23f),{'error':_0x1f8003 instanceof Error?_0x1f8003[_0x22f1cc(0x164)]:String(_0x1f8003),'files_count':_0x1db517[_0x22f1cc(0x13b)]});for(const _0x308ff6 of _0x1db517){_0x5cfdbc[_0x22f1cc(0x1bd)](_0x22f1cc(0x1d5)+_0x308ff6[_0x22f1cc(0x1a2)]+_0x22f1cc(0x161)+_0x308ff6[_0x22f1cc(0x240)]+_0x22f1cc(0x1ad));}}_0x2549ac[_0x22f1cc(0x1bd)](_0x5cfdbc[_0x22f1cc(0x22f)]('\x0a\x0a')),_0x456071=_0x2549ac['join']('\x0a');const _0x5b6f81=_0x4edcae[_0x22f1cc(0x243)]?.[_0x22f1cc(0x14a)](_0x1abf93=>_0x1abf93[_0x22f1cc(0x164)]?.[_0x22f1cc(0x12d)]('File\x20read\x20error:'))||[];if(_0x5b6f81[_0x22f1cc(0x13b)]>0x0){const _0x45ad57=_0x5b6f81['map'](_0x58a22e=>_0x58a22e[_0x22f1cc(0x164)])[_0x22f1cc(0x22f)](';\x20');reportMorphError({'error_message':_0x45ad57,'error_type':_0x22f1cc(0x133),'context':{'tool':_0x22f1cc(0x167),'repo_path':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)],'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'model':_0x22f1cc(0x18c),'termination_reason':_0x22f1cc(0x1b1),'error_count':_0x5b6f81[_0x22f1cc(0x13b)],'is_timeout':![],'timings':_0x4edcae['timings'],'files_attempted':_0xf64af2[_0x22f1cc(0x197)](_0x388df8=>({'path':_0x388df8[_0x22f1cc(0x1a2)],'lines':_0x388df8[_0x22f1cc(0x1ee)]})),'tool_calls':_0x1791c9(_0x4edcae[_0x22f1cc(0x1f9)]),'messages':_0x4edcae['messages']?.['map'](_0x1a94e4=>({'role':_0x1a94e4[_0x22f1cc(0x121)],'content':_0x1a94e4[_0x22f1cc(0x240)],..._0x1a94e4[_0x22f1cc(0x126)]?{'tool_calls':_0x1a94e4[_0x22f1cc(0x126)][_0x22f1cc(0x13b)]}:{},..._0x1a94e4[_0x22f1cc(0x1b8)]?{'tool_call_id':_0x1a94e4[_0x22f1cc(0x1b8)]}:{}})),'request_content':{'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'repo_path':_0x2038da['data'][_0x22f1cc(0x239)],'repoRoot':a0_0x43e623[_0x22f1cc(0x23b)](_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)]),'model':'morph-warp-grep-v2.1'}},'source':_0x22f1cc(0x11e)})[_0x22f1cc(0x14d)](()=>{});}}else{if(_0x4edcae[_0x22f1cc(0x181)]===_0x22f1cc(0x1ec)&&_0x4edcae[_0x22f1cc(0x243)]['length']>0x0){const _0x5a5c4e=_0x4edcae[_0x22f1cc(0x243)][_0x22f1cc(0x197)](_0x15f9fe=>_0x15f9fe[_0x22f1cc(0x164)])['join'](';\x20');_0x456071=_0x22f1cc(0x198)+_0x5a5c4e;const _0x565f7c=_0x5a5c4e[_0x22f1cc(0x242)]()['includes']('timeout')||_0x5a5c4e[_0x22f1cc(0x242)]()['includes']('timed\x20out')||_0x5a5c4e[_0x22f1cc(0x242)]()[_0x22f1cc(0x1f2)](_0x22f1cc(0x1f3)),_0x445750=_0x4edcae[_0x22f1cc(0x1b2)]?.[_0x22f1cc(0x208)]?.['files'],_0x397ba2=_0x4edcae['errors'][0x0];reportMorphError({'error_message':_0x5a5c4e,'error_type':_0x565f7c?'TimeoutError':_0x397ba2?.['constructor']?.[_0x22f1cc(0x1b4)]||_0x22f1cc(0x1d6),'context':{'tool':_0x22f1cc(0x167),'repo_path':_0x2038da['data']['repo_path'],'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'model':_0x22f1cc(0x18c),'termination_reason':_0x4edcae['terminationReason'],'error_count':_0x4edcae['errors'][_0x22f1cc(0x13b)],'is_timeout':_0x565f7c,'timings':_0x4edcae[_0x22f1cc(0x154)],'files_attempted':_0x445750?.[_0x22f1cc(0x197)](_0x1c6177=>({'path':_0x1c6177[_0x22f1cc(0x1a2)],'lines':_0x1c6177['lines']})),'tool_calls':_0x1791c9(_0x4edcae[_0x22f1cc(0x1f9)]),'messages':_0x4edcae['messages']?.[_0x22f1cc(0x197)](_0x24c94e=>({'role':_0x24c94e['role'],'content':_0x24c94e[_0x22f1cc(0x240)],..._0x24c94e['tool_calls']?{'tool_calls':_0x24c94e[_0x22f1cc(0x126)]['length']}:{},..._0x24c94e[_0x22f1cc(0x1b8)]?{'tool_call_id':_0x24c94e[_0x22f1cc(0x1b8)]}:{}})),'request_content':{'query':_0x2038da['data'][_0x22f1cc(0x14f)],'repo_path':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)],'repoRoot':a0_0x43e623[_0x22f1cc(0x23b)](_0x2038da[_0x22f1cc(0x17a)]['repo_path']),'model':_0x22f1cc(0x18c)}},'stack_trace':_0x397ba2?.[_0x22f1cc(0x1ba)]||undefined,'source':_0x22f1cc(0x11e)})[_0x22f1cc(0x14d)](()=>{});}else _0x456071=_0x22f1cc(0x20d);}return{'content':[{'type':_0x22f1cc(0x176),'text':_0x456071}]};}catch(_0x1b0e85){const _0x4b6b38=handleMorphAPIError(_0x1b0e85);if(_0x4b6b38)return logger[_0x22f1cc(0x180)](_0x22f1cc(0x128),'tool_call_error',{'tool':_0x22f1cc(0x167),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x22f1cc(0x200)]()-_0x3fcabd}),_0x4b6b38;const _0x1eeaed=_0x1b0e85 instanceof Error?_0x1b0e85[_0x22f1cc(0x164)]:String(_0x1b0e85);logger[_0x22f1cc(0x180)](_0x22f1cc(0x128),_0x22f1cc(0x1e3),{'tool':_0x22f1cc(0x167),'error':_0x1eeaed,'repo_path':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)],'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'latency_ms':Date[_0x22f1cc(0x200)]()-_0x3fcabd});const _0x50bdc1=_0x1eeaed[_0x22f1cc(0x242)]()[_0x22f1cc(0x1f2)](_0x22f1cc(0x1de))||_0x1eeaed[_0x22f1cc(0x242)]()[_0x22f1cc(0x1f2)](_0x22f1cc(0x20e))||_0x1eeaed[_0x22f1cc(0x242)]()[_0x22f1cc(0x1f2)](_0x22f1cc(0x1f3))||_0x1b0e85 instanceof Error&&_0x1b0e85['name']===_0x22f1cc(0x149);return reportMorphError({'error_message':_0x1eeaed,'error_type':_0x50bdc1?_0x22f1cc(0x149):_0x1b0e85 instanceof Error?_0x1b0e85[_0x22f1cc(0x17c)][_0x22f1cc(0x1b4)]:_0x22f1cc(0x1bf),'context':{'tool':_0x22f1cc(0x167),'repo_path':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)],'query':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'model':_0x22f1cc(0x18c),'is_timeout':_0x50bdc1,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x2038da['data'][_0x22f1cc(0x14f)],'repo_path':_0x2038da[_0x22f1cc(0x17a)][_0x22f1cc(0x239)],'repoRoot':a0_0x43e623['resolve'](_0x2038da['data']['repo_path']),'model':_0x22f1cc(0x18c)}},'stack_trace':_0x1b0e85 instanceof Error?_0x1b0e85[_0x22f1cc(0x1ba)]:undefined,'source':_0x22f1cc(0x11e)})[_0x22f1cc(0x14d)](()=>{}),{'content':[{'type':_0x22f1cc(0x176),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x1eeaed}],'isError':![]};}}case TOOL_NAMES[_0x22f1cc(0x204)]:{const _0x597d53=WarpGrepGitHubArgsSchema['safeParse'](_0x3b0c99);if(!_0x597d53[_0x22f1cc(0x227)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x597d53[_0x22f1cc(0x180)]}],'isError':!![]};const _0x506bb7=_0x597d53[_0x22f1cc(0x17a)]['github_url']||_0x597d53[_0x22f1cc(0x17a)]['owner_repo'];if(!_0x506bb7)return{'content':[{'type':_0x22f1cc(0x176),'text':_0x22f1cc(0x19b)}],'isError':!![]};const _0x5528ce=MORPH_API_KEY;if(!_0x5528ce)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x5e9a30=Date[_0x22f1cc(0x200)]();logger[_0x22f1cc(0x226)](_0x22f1cc(0x128),_0x22f1cc(0x125),{'identifier':_0x506bb7,'query':_0x597d53[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'branch':_0x597d53['data']['branch']});try{const _0x5eee10=new WarpGrepClient({'morphApiKey':_0x5528ce,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x316106=await _0x5eee10[_0x22f1cc(0x220)]({'searchTerm':_0x597d53[_0x22f1cc(0x17a)]['search_string'],'github':_0x506bb7,'branch':_0x597d53[_0x22f1cc(0x17a)]['branch']}),_0x2282de=Date[_0x22f1cc(0x200)]()-_0x5e9a30;logMcpStderr(_0x22f1cc(0x232)+_0x2282de+'ms.\x20Success:\x20'+_0x316106[_0x22f1cc(0x227)]);const _0xf8b14=formatResult(_0x316106);return{'content':[{'type':_0x22f1cc(0x176),'text':_0xf8b14}]};}catch(_0x1d3b06){const _0x54265b=handleMorphAPIError(_0x1d3b06);if(_0x54265b)return _0x54265b;const _0x22619c=Date[_0x22f1cc(0x200)]()-_0x5e9a30,_0x2be908=_0x1d3b06 instanceof Error?_0x1d3b06['message']:String(_0x1d3b06);return logMcpStderr(_0x22f1cc(0x18a)+_0x22619c+_0x22f1cc(0x1c7),_0x2be908),reportMorphError({'error_message':_0x2be908,'error_type':_0x1d3b06 instanceof Error?_0x1d3b06[_0x22f1cc(0x17c)][_0x22f1cc(0x1b4)]:_0x22f1cc(0x1bf),'context':{'tool':_0x22f1cc(0x16b),'github_url':_0x506bb7,'search_string':_0x597d53[_0x22f1cc(0x17a)][_0x22f1cc(0x14f)],'branch':_0x597d53[_0x22f1cc(0x17a)][_0x22f1cc(0x168)]},'stack_trace':_0x1d3b06 instanceof Error?_0x1d3b06['stack']:undefined,'source':_0x22f1cc(0x11e),'tool':_0x22f1cc(0x16b),'latency_ms':_0x22619c})[_0x22f1cc(0x14d)](()=>{}),{'content':[{'type':'text','text':_0x22f1cc(0x241)+_0x2be908}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x1897bb);}}catch(_0x4ade17){const _0x1c9830=_0x4ade17 instanceof Error?_0x4ade17[_0x22f1cc(0x164)]:String(_0x4ade17);return reportMorphError({'error_message':_0x1c9830,'error_type':_0x4ade17 instanceof Error?_0x4ade17['constructor'][_0x22f1cc(0x1b4)]:_0x22f1cc(0x1bf),'context':{'tool':_0x1897bb,'arguments':_0x3b0c99?JSON[_0x22f1cc(0x173)](_0x3b0c99)[_0x22f1cc(0x183)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x4ade17 instanceof Error?_0x4ade17['stack']:undefined,'source':_0x22f1cc(0x11e)})[_0x22f1cc(0x14d)](()=>{}),{'content':[{'type':'text','text':'Error:\x20'+_0x1c9830}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x16c686){const _0x506eb5=a0_0x503392,_0x6f5f08=await getValidRootDirectories(_0x16c686);if(_0x6f5f08[_0x506eb5(0x13b)]>0x0)allowedDirectories=[..._0x6f5f08],logMcpStderr(_0x506eb5(0x1d0)+_0x6f5f08['length']+_0x506eb5(0x1ef));else{logMcpStderr(_0x506eb5(0x22a));if(ENABLE_WORKSPACE_MODE)try{const _0x21c341=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x21c341&&(allowedDirectories=[_0x21c341],logMcpStderr(_0x506eb5(0x19c)+_0x21c341));}catch(_0x8db52d){logMcpStderr(_0x506eb5(0x1fb)+_0x8db52d);}}}server[a0_0x503392(0x211)](RootsListChangedNotificationSchema,async()=>{const _0x3c4e94=a0_0x503392;try{const _0x3ebf66=await server[_0x3c4e94(0x17d)]();_0x3ebf66&&_0x3c4e94(0x15d)in _0x3ebf66&&await updateAllowedDirectoriesFromRoots(_0x3ebf66[_0x3c4e94(0x15d)]);}catch(_0x27e603){logMcpStderr(_0x3c4e94(0x19d),_0x27e603 instanceof Error?_0x27e603['message']:String(_0x27e603));}}),server[a0_0x503392(0x1da)]=async()=>{const _0x1d93f5=a0_0x503392,_0x39e24a=server[_0x1d93f5(0x15a)]();if(_0x39e24a?.[_0x1d93f5(0x15d)])try{const _0x5af383=await server[_0x1d93f5(0x17d)]();_0x5af383&&'roots'in _0x5af383?await updateAllowedDirectoriesFromRoots(_0x5af383[_0x1d93f5(0x15d)]):logMcpStderr(_0x1d93f5(0x1b0));}catch(_0x2ba6e7){logMcpStderr(_0x1d93f5(0x18b),_0x2ba6e7 instanceof Error?_0x2ba6e7['message']:String(_0x2ba6e7));}else{if(allowedDirectories[_0x1d93f5(0x13b)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};function a0_0x4338(){const _0x4782c6=['normalize','default','catch','user','search_string','PathError','RipgrepError','warn','Preview\x20changes\x20without\x20applying\x20them.','timings','Example\x20format:\x0a','access','API\x20error\x20(auth/rate-limit)','2978667jrGtrF','path_validation_resolved','getClientCapabilities','Error\x20accessing\x20directory\x20','application/json','roots','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','-\x20Glob\x20search\x20`','ENABLE_WORKSPACE_MODE','\x22>\x0a','morph-v3-fast','\x0aOptions:','message','go.mod','pattern','codebase_search','branch','--version','array','github_codebase_search','composer.json','Morph\x20Edit\x20Preview','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','glob\x20\x27','https://morphllm.com/api/error-report','unknown','split','stringify','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','WORKSPACE_ROOT','text','-\x20Preserve\x20exact\x20indentation\x0a','provider_created','.vscode','data','list_directory','constructor','listRoots','SymlinkError','unknown\x20error','error','terminationReason','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','substring','SubToolError','instruction','2460927WNMGFS','describe','linesAdded','every','[github_codebase_search]\x20Failed\x20in\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','morph-warp-grep-v2.1','\x22>\x0aError\x20reading\x20file:\x20','string','Unknown\x20error','.\x20Changes:\x20','source','@morphllm/morphmcp\x20','--api-key=','code','sk-','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','map','Error:\x20','.\x20Path:\x20','parse','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Fallback:\x20Using\x20workspace\x20root\x20','Failed\x20to\x20request\x20roots\x20from\x20client:','21116hNZoGZ','linesModified','trim','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','path','context','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.','arguments','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','grep','params','ReadError','1GHJtfq','some','edit_file','\x0a</file>','search_type','readFile','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','completed_with_file_errors','finish','setRequestHandler','name','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','tool_call_id','path_validation_failed','stack','DISABLED_TOOLS','\x20as\x20allowed\x20directory','push','tool_call_received','UnknownError','realpath','connect','Tool\x20','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','BinaryFile','FileNotFound','1898674eVjOUg','ms:','file_read_complete','object','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','safeParse','list_directory\x20','homedir','morph-','`\x20in\x20`','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','7046370kfBfHB','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','slice','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','<file\x20path=\x22','WarpGrepError','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','match','oninitialized','linesRemoved','Created\x20File','.cursor','timeout','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','ENOENT','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','post','tool_call_error','.git','added\x20','status','sep','file','size','assistant','enum','terminated','path_validation_start','lines','\x20valid\x20directories','-\x20Grepped\x20\x27','Cargo.toml','includes','etimedout','completionId','indexOf','payload','command','Applied','messages','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','Warning:\x20Workspace\x20fallback\x20failed:\x20','\x20disabled\x20via\x20DISABLED_TOOLS','isDirectory','8421882gMXKzc','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','now','min','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','function','GITHUB_CODEBASE_SEARCH','WarpGrep\x20sub-tool\x20errors:\x20','has','--api-key','metadata','dirname','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','[could\x20not\x20read\x20file:\x20','MORPH_LARGE_APPLY','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','timed\x20out','toISOString','glob','setNotificationHandler','-\x20Listed\x20directory\x20`','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','log','read','Disabled\x20tools:\x20','isArray','RipgrepNotAvailable','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','grep_search',',\x20modified\x20','code_edit','Max\x20results\x20to\x20return','❌\x20Morph\x20Edit\x20Failed:\x20','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','searchGitHub','node_modules','basename','all','floor','grep\x20\x27','debug','success','\x22.\x20Known\x20tools:\x20','instructions','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','PWD','env','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','boolean','join','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','turns','[github_codebase_search]\x20Done\x20in\x20','Warning:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','\x20\x20morph-mcp','new_string','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','repo_path','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','resolve','read\x20','stat','completed','compaction_failed','content','GitHub\x20search\x20failed:\x20','toLowerCase','errors','pyproject.toml','LocalRipgrepProvider','requiresApiKey','edit','mcp-filesystem','file_path','15rtlTWD','role','number','Relevant\x20context\x20found:','package.json','github_search_start','tool_calls','MORPH_API_URL','MCP','cwd','\x20-\x20','Bearer\x20','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','startsWith','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','files','\x20(new\x20file)','exit','MORPH_WARP_GREP_TIMEOUT','FileReadError','dryRun','description','changes','tsconfig.json','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','tool','length','385248llRSqx','-\x20Read\x20file\x20`','\x20is\x20not\x20a\x20directory','response','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.','optional','tool_call_complete','EDIT_FILE','Repository\x20identifier','false','api-key','0.2.0','morph-mcp','TimeoutError','filter'];a0_0x4338=function(){return _0x4782c6;};return a0_0x4338();}async function runServer(){const _0x52a2c6=a0_0x503392,_0x4ec963=new StdioServerTransport();await server[_0x52a2c6(0x1c1)](_0x4ec963),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories['length']===0x0&&logMcpStderr(_0x52a2c6(0x12c));}runServer()[a0_0x503392(0x14d)](_0x105de9=>{const _0x382b7c=a0_0x503392;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x105de9),process[_0x382b7c(0x131)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x3643c1=a1_0x3562;function a1_0x192a(){var _0x4c6e65=['[os=','342764SVFTji','2230254txxqmo','win32','length','1768VHAAYQ','error','info','darwin','map','184ekXgxV','7DnSAzO','6361470TxuOje','10020328iaqBUK','macOS','Linux','platform','linux','390NSwyhB','335403fKYoNO','2198220cbjzhT','Unknown'];a1_0x192a=function(){return _0x4c6e65;};return a1_0x192a();}(function(_0x13bc15,_0x23cbfd){var _0x27aede=a1_0x3562,_0x24ac7f=_0x13bc15();while(!![]){try{var _0x22352d=parseInt(_0x27aede(0x1f4))/0x1*(-parseInt(_0x27aede(0x1ef))/0x2)+-parseInt(_0x27aede(0x1ec))/0x3+-parseInt(_0x27aede(0x1eb))/0x4+parseInt(_0x27aede(0x1f6))/0x5+parseInt(_0x27aede(0x1e8))/0x6+-parseInt(_0x27aede(0x1f5))/0x7*(parseInt(_0x27aede(0x1e1))/0x8)+-parseInt(_0x27aede(0x1e7))/0x9*(-parseInt(_0x27aede(0x1e6))/0xa);if(_0x22352d===_0x23cbfd)break;else _0x24ac7f['push'](_0x24ac7f['shift']());}catch(_0x396917){_0x24ac7f['push'](_0x24ac7f['shift']());}}}(a1_0x192a,0xcef9b));import a1_0x3035c8 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x3a462a=a1_0x3035c8[a1_0x3643c1(0x1e4)]()){var _0x1e6803=a1_0x3643c1;switch(_0x3a462a){case _0x1e6803(0x1f2):return _0x1e6803(0x1e2);case _0x1e6803(0x1ed):return'Windows';case _0x1e6803(0x1e5):return _0x1e6803(0x1e3);default:return _0x1e6803(0x1e9);}}export function formatMcpLogMessage(_0x2d1d6e,_0x1077e8=a1_0x3035c8[a1_0x3643c1(0x1e4)]()){var _0x467777=a1_0x3643c1;return _0x467777(0x1ea)+getOperatingSystemType(_0x1077e8)+']\x20'+_0x2d1d6e;}function a1_0x3562(_0xaa71bc,_0xbb0b24){_0xaa71bc=_0xaa71bc-0x1e1;var _0x192a8c=a1_0x192a();var _0x3562c9=_0x192a8c[_0xaa71bc];return _0x3562c9;}export function logMcpStderr(_0x54d674,..._0x26fc15){var _0x10699a=a1_0x3643c1;console[_0x10699a(0x1f0)](formatMcpLogMessage(_0x54d674),..._0x26fc15),logger[_0x10699a(0x1f1)]('MCP',_0x54d674,_0x26fc15[_0x10699a(0x1ee)]?{'args':_0x26fc15[_0x10699a(0x1f3)](_0x5ccdd1=>String(_0x5ccdd1))}:undefined);}
1
+ function a1_0x57f7(){var _0x281e9d=['linux','4kILxyh','length','win32','384cggStX','darwin','error','MCP','23259bxUBEu','platform','macOS','map','108722mMkJwM','204911FBLULm','12080349lazsxW','1562260npStyN','1752030AcawnI','124NeoRWi','3694146Nwvrzn'];a1_0x57f7=function(){return _0x281e9d;};return a1_0x57f7();}var a1_0x10de7d=a1_0x2e1b;(function(_0x14f19e,_0x3f4bfd){var _0x452447=a1_0x2e1b,_0x2a8cdf=_0x14f19e();while(!![]){try{var _0x135876=-parseInt(_0x452447(0x1fe))/0x1*(-parseInt(_0x452447(0x1f6))/0x2)+parseInt(_0x452447(0x1f2))/0x3*(-parseInt(_0x452447(0x1fb))/0x4)+parseInt(_0x452447(0x1fa))/0x5+parseInt(_0x452447(0x1fc))/0x6+parseInt(_0x452447(0x1f7))/0x7*(parseInt(_0x452447(0x201))/0x8)+-parseInt(_0x452447(0x1f8))/0x9+-parseInt(_0x452447(0x1f9))/0xa;if(_0x135876===_0x3f4bfd)break;else _0x2a8cdf['push'](_0x2a8cdf['shift']());}catch(_0x369ca7){_0x2a8cdf['push'](_0x2a8cdf['shift']());}}}(a1_0x57f7,0xcf797));import a1_0x2c92fe from'os';import{logger}from'./logger.js';function a1_0x2e1b(_0x43175d,_0x5e0ac3){_0x43175d=_0x43175d-0x1ef;var _0x57f730=a1_0x57f7();var _0x2e1bcb=_0x57f730[_0x43175d];return _0x2e1bcb;}export function getOperatingSystemType(_0x2aa74d=a1_0x2c92fe['platform']()){var _0x2d0958=a1_0x2e1b;switch(_0x2aa74d){case _0x2d0958(0x1ef):return _0x2d0958(0x1f4);case _0x2d0958(0x200):return'Windows';case _0x2d0958(0x1fd):return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0xcbc586,_0x71643f=a1_0x2c92fe[a1_0x10de7d(0x1f3)]()){return'[os='+getOperatingSystemType(_0x71643f)+']\x20'+_0xcbc586;}export function logMcpStderr(_0x54beac,..._0x2c4097){var _0x3af846=a1_0x10de7d;console[_0x3af846(0x1f0)](formatMcpLogMessage(_0x54beac),..._0x2c4097),logger['info'](_0x3af846(0x1f1),_0x54beac,_0x2c4097[_0x3af846(0x1ff)]?{'args':_0x2c4097[_0x3af846(0x1f5)](_0x5c22a7=>String(_0x5c22a7))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0x1513c0=a2_0x1dae;(function(_0x2a8c32,_0x51f7c4){const _0x4f1b70=a2_0x1dae,_0x14a49d=_0x2a8c32();while(!![]){try{const _0x27dfba=-parseInt(_0x4f1b70(0x104))/0x1+parseInt(_0x4f1b70(0x10c))/0x2*(parseInt(_0x4f1b70(0x10f))/0x3)+-parseInt(_0x4f1b70(0x112))/0x4*(parseInt(_0x4f1b70(0x102))/0x5)+-parseInt(_0x4f1b70(0x100))/0x6*(-parseInt(_0x4f1b70(0x101))/0x7)+parseInt(_0x4f1b70(0x116))/0x8*(parseInt(_0x4f1b70(0x107))/0x9)+parseInt(_0x4f1b70(0xff))/0xa+-parseInt(_0x4f1b70(0x105))/0xb;if(_0x27dfba===_0x51f7c4)break;else _0x14a49d['push'](_0x14a49d['shift']());}catch(_0x24ff84){_0x14a49d['push'](_0x14a49d['shift']());}}}(a2_0x5bc8,0xca72e));import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x1513c0(0x103)];constructor(){const _0x2b606d=a2_0x1513c0;this['enabled']=process[_0x2b606d(0x10e)][_0x2b606d(0x113)]==='1'||!!process['env']['MORPH_LOG_FILE'];const _0x2b1a3d=process[_0x2b606d(0x10e)]['MORPH_LOG_FILE'];this[_0x2b606d(0x103)]=_0x2b1a3d?createWriteStream(_0x2b1a3d,{'flags':'a'}):null;}['debug'](_0x5b267f,_0x2d75d2,_0x1d2211){const _0x2b051d=a2_0x1513c0;this['_log'](_0x2b051d(0x115),_0x5b267f,_0x2d75d2,_0x1d2211);}[a2_0x1513c0(0x111)](_0x520070,_0x197181,_0x219128){const _0x3d74cf=a2_0x1513c0;this['_log'](_0x3d74cf(0x111),_0x520070,_0x197181,_0x219128);}['warn'](_0x370617,_0x227d10,_0xf0df9d){this['_log']('warn',_0x370617,_0x227d10,_0xf0df9d);}['error'](_0x26fd5e,_0x38d3ce,_0x3abdbd){const _0x234f2d=a2_0x1513c0;this[_0x234f2d(0x10d)]('error',_0x26fd5e,_0x38d3ce,_0x3abdbd);}[a2_0x1513c0(0x114)](){const _0x3664fb=a2_0x1513c0;this[_0x3664fb(0x108)]=!![];}get['isEnabled'](){const _0x5d20d9=a2_0x1513c0;return this[_0x5d20d9(0x108)];}[a2_0x1513c0(0x10d)](_0x24c4ce,_0x26a74c,_0x32bd9b,_0x41201c){const _0x22679b=a2_0x1513c0;if(_0x24c4ce!==_0x22679b(0x110)&&!this[_0x22679b(0x108)])return;const _0x6fe2e5=new Date()[_0x22679b(0x106)](),_0x3bd9ce='['+_0x6fe2e5+_0x22679b(0x10a)+_0x24c4ce[_0x22679b(0x109)]()+']\x20['+_0x26a74c+']';console[_0x22679b(0x110)](_0x41201c?_0x3bd9ce+'\x20'+_0x32bd9b+'\x20'+JSON[_0x22679b(0x117)](_0x41201c):_0x3bd9ce+'\x20'+_0x32bd9b),this['fileStream']?.[_0x22679b(0x10b)](JSON[_0x22679b(0x117)]({'ts':_0x6fe2e5,'level':_0x24c4ce,'component':_0x26a74c,'msg':_0x32bd9b,..._0x41201c&&{'data':_0x41201c}})+'\x0a');}}function a2_0x1dae(_0x4482a5,_0x139cd0){_0x4482a5=_0x4482a5-0xff;const _0x5bc89a=a2_0x5bc8();let _0x1dae19=_0x5bc89a[_0x4482a5];return _0x1dae19;}function a2_0x5bc8(){const _0x4d6ceb=['write','26966zramDS','_log','env','177tKauhO','error','info','152868jaJPdy','MORPH_DEBUG','enable','debug','592024RGoBjp','stringify','10515660lAXZAP','6ZIyNpk','6035743tCFexT','20gVwaeG','fileStream','432746YuViHF','25635610YWtvvH','toISOString','126hcDUpn','enabled','toUpperCase',']\x20['];a2_0x5bc8=function(){return _0x4d6ceb;};return a2_0x5bc8();}export const logger=new MorphLogger();
1
+ const a2_0x254b5f=a2_0x2dea;(function(_0x1ad303,_0x1c5f0f){const _0x4867c2=a2_0x2dea,_0x782b44=_0x1ad303();while(!![]){try{const _0x38a534=parseInt(_0x4867c2(0x114))/0x1*(-parseInt(_0x4867c2(0x10e))/0x2)+parseInt(_0x4867c2(0x10a))/0x3*(parseInt(_0x4867c2(0x113))/0x4)+-parseInt(_0x4867c2(0x11a))/0x5+parseInt(_0x4867c2(0x106))/0x6+parseInt(_0x4867c2(0x107))/0x7+parseInt(_0x4867c2(0x118))/0x8+-parseInt(_0x4867c2(0x108))/0x9*(parseInt(_0x4867c2(0x110))/0xa);if(_0x38a534===_0x1c5f0f)break;else _0x782b44['push'](_0x782b44['shift']());}catch(_0x2af3cc){_0x782b44['push'](_0x782b44['shift']());}}}(a2_0x252e,0x475ed));import{createWriteStream}from'fs';function a2_0x2dea(_0x5a23b2,_0x412b8c){_0x5a23b2=_0x5a23b2-0x104;const _0x252e18=a2_0x252e();let _0x2deaa7=_0x252e18[_0x5a23b2];return _0x2deaa7;}class MorphLogger{['enabled'];[a2_0x254b5f(0x11b)];constructor(){const _0x5c116f=a2_0x254b5f;this[_0x5c116f(0x112)]=process[_0x5c116f(0x10d)][_0x5c116f(0x10b)]==='1'||!!process['env'][_0x5c116f(0x104)];const _0x33329f=process[_0x5c116f(0x10d)][_0x5c116f(0x104)];this[_0x5c116f(0x11b)]=_0x33329f?createWriteStream(_0x33329f,{'flags':'a'}):null;}[a2_0x254b5f(0x116)](_0x4be7ea,_0x5da903,_0x19803a){const _0x3de359=a2_0x254b5f;this[_0x3de359(0x111)](_0x3de359(0x116),_0x4be7ea,_0x5da903,_0x19803a);}[a2_0x254b5f(0x10f)](_0xc3dc42,_0x322492,_0x359aad){const _0x18062f=a2_0x254b5f;this[_0x18062f(0x111)](_0x18062f(0x10f),_0xc3dc42,_0x322492,_0x359aad);}['warn'](_0x56c5c3,_0x53d0d7,_0x280938){const _0x2c6ac3=a2_0x254b5f;this[_0x2c6ac3(0x111)](_0x2c6ac3(0x10c),_0x56c5c3,_0x53d0d7,_0x280938);}[a2_0x254b5f(0x109)](_0x915e2e,_0x43c226,_0x1cf463){const _0x111d91=a2_0x254b5f;this['_log'](_0x111d91(0x109),_0x915e2e,_0x43c226,_0x1cf463);}[a2_0x254b5f(0x117)](){const _0x39b566=a2_0x254b5f;this[_0x39b566(0x112)]=!![];}get[a2_0x254b5f(0x115)](){const _0x12e081=a2_0x254b5f;return this[_0x12e081(0x112)];}[a2_0x254b5f(0x111)](_0x408354,_0xf4b1ed,_0x262616,_0x45d2c7){const _0x592f2a=a2_0x254b5f;if(_0x408354!==_0x592f2a(0x109)&&!this['enabled'])return;const _0x28cd80=new Date()['toISOString'](),_0x47892c='['+_0x28cd80+_0x592f2a(0x119)+_0x408354['toUpperCase']()+_0x592f2a(0x119)+_0xf4b1ed+']';console['error'](_0x45d2c7?_0x47892c+'\x20'+_0x262616+'\x20'+JSON[_0x592f2a(0x105)](_0x45d2c7):_0x47892c+'\x20'+_0x262616),this['fileStream']?.[_0x592f2a(0x11c)](JSON[_0x592f2a(0x105)]({'ts':_0x28cd80,'level':_0x408354,'component':_0xf4b1ed,'msg':_0x262616,..._0x45d2c7&&{'data':_0x45d2c7}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x252e(){const _0x2581c0=['20PqGbIs','isEnabled','debug','enable','4597320XvOoSo',']\x20[','1586745lIwRaj','fileStream','write','MORPH_LOG_FILE','stringify','1660278dlESWr','2210649HoUvqR','8766DJuqnw','error','37263THjyDX','MORPH_DEBUG','warn','env','25978OCaZws','info','7010pjeFwK','_log','enabled','124pCrnyF'];a2_0x252e=function(){return _0x2581c0;};return a2_0x252e();}
@@ -1 +1 @@
1
- function a3_0x597a(){const _0x24bbb5=['/mnt/','homedir','match','70ESgwvS','1092655eNBJfK','675485wJcWUB','normalize','slice','554554GDuhTM','charAt','3629709zRioqG','test','startsWith','88dXKPEP','275639eqKHTj','16dfAKZS','replace','26562324KTKwAX','103332IHqyrK','2UAhxtq','6XooihJ','toUpperCase','substring'];a3_0x597a=function(){return _0x24bbb5;};return a3_0x597a();}function a3_0x4c46(_0x2cd8a1,_0x3d5d74){_0x2cd8a1=_0x2cd8a1-0x16d;const _0x597a39=a3_0x597a();let _0x4c4622=_0x597a39[_0x2cd8a1];return _0x4c4622;}(function(_0x1b2d52,_0x7d438f){const _0x1c2dab=a3_0x4c46,_0x311aaf=_0x1b2d52();while(!![]){try{const _0x3142c6=-parseInt(_0x1c2dab(0x178))/0x1*(-parseInt(_0x1c2dab(0x170))/0x2)+-parseInt(_0x1c2dab(0x16f))/0x3*(-parseInt(_0x1c2dab(0x181))/0x4)+-parseInt(_0x1c2dab(0x179))/0x5+parseInt(_0x1c2dab(0x171))/0x6*(-parseInt(_0x1c2dab(0x182))/0x7)+parseInt(_0x1c2dab(0x183))/0x8*(parseInt(_0x1c2dab(0x17e))/0x9)+parseInt(_0x1c2dab(0x177))/0xa*(parseInt(_0x1c2dab(0x17c))/0xb)+-parseInt(_0x1c2dab(0x16e))/0xc;if(_0x3142c6===_0x7d438f)break;else _0x311aaf['push'](_0x311aaf['shift']());}catch(_0x4323d8){_0x311aaf['push'](_0x311aaf['shift']());}}}(a3_0x597a,0x97d62));import a3_0x2bdf57 from'path';import a3_0x1f553f from'os';export function convertToWindowsPath(_0x2b0af1){const _0x286253=a3_0x4c46;if(_0x2b0af1[_0x286253(0x180)](_0x286253(0x174))){const _0x6ed610=_0x2b0af1[_0x286253(0x17d)](0x5)[_0x286253(0x172)](),_0x48f9c2=_0x2b0af1['slice'](0x6)[_0x286253(0x16d)](/\//g,'\x5c');return _0x6ed610+':'+_0x48f9c2;}if(_0x2b0af1[_0x286253(0x176)](/^\/[a-zA-Z]\//)){const _0x23da02=_0x2b0af1['charAt'](0x1)[_0x286253(0x172)](),_0x3c8050=_0x2b0af1[_0x286253(0x17b)](0x2)[_0x286253(0x16d)](/\//g,'\x5c');return _0x23da02+':'+_0x3c8050;}if(_0x2b0af1['match'](/^[a-zA-Z]:/))return _0x2b0af1[_0x286253(0x16d)](/\//g,'\x5c');return _0x2b0af1;}export function normalizePath(_0x2bd468){const _0x3286d2=a3_0x4c46;_0x2bd468=_0x2bd468['trim']()[_0x3286d2(0x16d)](/^["']|["']$/g,'');const _0x3bcb14=_0x2bd468['startsWith']('/')&&!_0x2bd468[_0x3286d2(0x176)](/^\/mnt\/[a-z]\//i)&&!_0x2bd468[_0x3286d2(0x176)](/^\/[a-zA-Z]\//);if(_0x3bcb14)return _0x2bd468[_0x3286d2(0x16d)](/\/+/g,'/')['replace'](/\/+$/,'');_0x2bd468=convertToWindowsPath(_0x2bd468);if(_0x2bd468['startsWith']('\x5c\x5c')){let _0x13ddec=_0x2bd468;_0x13ddec=_0x13ddec[_0x3286d2(0x16d)](/^\\{2,}/,'\x5c\x5c');const _0x55cf21=_0x13ddec[_0x3286d2(0x173)](0x2)[_0x3286d2(0x16d)](/\\\\/g,'\x5c');_0x2bd468='\x5c\x5c'+_0x55cf21;}else _0x2bd468=_0x2bd468[_0x3286d2(0x16d)](/\\\\/g,'\x5c');let _0x57f938=a3_0x2bdf57[_0x3286d2(0x17a)](_0x2bd468);_0x2bd468['startsWith']('\x5c\x5c')&&!_0x57f938[_0x3286d2(0x180)]('\x5c\x5c')&&(_0x57f938='\x5c'+_0x57f938);if(_0x57f938[_0x3286d2(0x176)](/^[a-zA-Z]:/)){let _0x36a374=_0x57f938['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x3286d2(0x17f)](_0x36a374)&&(_0x36a374=_0x36a374['charAt'](0x0)[_0x3286d2(0x172)]()+_0x36a374['slice'](0x1)),_0x36a374;}return _0x57f938[_0x3286d2(0x16d)](/\//g,'\x5c');}export function expandHome(_0x4c0cf3){const _0x4d38ee=a3_0x4c46;if(_0x4c0cf3['startsWith']('~/')||_0x4c0cf3==='~')return a3_0x2bdf57['join'](a3_0x1f553f[_0x4d38ee(0x175)](),_0x4c0cf3[_0x4d38ee(0x17b)](0x1));return _0x4c0cf3;}
1
+ (function(_0x23ad95,_0x3db59a){const _0x4f7de8=a3_0x2e75,_0x511c44=_0x23ad95();while(!![]){try{const _0xe994a9=parseInt(_0x4f7de8(0x1ce))/0x1+parseInt(_0x4f7de8(0x1cf))/0x2*(-parseInt(_0x4f7de8(0x1d0))/0x3)+-parseInt(_0x4f7de8(0x1ca))/0x4+-parseInt(_0x4f7de8(0x1d1))/0x5*(parseInt(_0x4f7de8(0x1cb))/0x6)+-parseInt(_0x4f7de8(0x1c7))/0x7+parseInt(_0x4f7de8(0x1c5))/0x8*(parseInt(_0x4f7de8(0x1d3))/0x9)+parseInt(_0x4f7de8(0x1d7))/0xa;if(_0xe994a9===_0x3db59a)break;else _0x511c44['push'](_0x511c44['shift']());}catch(_0x52c4ac){_0x511c44['push'](_0x511c44['shift']());}}}(a3_0xb72a,0x8a573));function a3_0x2e75(_0x3cc3f2,_0x35e7ba){_0x3cc3f2=_0x3cc3f2-0x1c4;const _0xb72a53=a3_0xb72a();let _0x2e75c8=_0xb72a53[_0x3cc3f2];return _0x2e75c8;}import a3_0x285e4e from'path';function a3_0xb72a(){const _0x4b1da9=['match','5349784rKCTnU','/mnt/','5335687ZWnKam','normalize','slice','1812692FkCikJ','834tnseIX','test','toUpperCase','729497sAZBUJ','524318TEvyAK','3uYbFzA','36620zJPosI','replace','9ehTOrf','homedir','substring','charAt','16640320YHHzEu','startsWith'];a3_0xb72a=function(){return _0x4b1da9;};return a3_0xb72a();}import a3_0x5d4b6b from'os';export function convertToWindowsPath(_0x22c2d4){const _0x31bc3f=a3_0x2e75;if(_0x22c2d4[_0x31bc3f(0x1d8)](_0x31bc3f(0x1c6))){const _0x2d64a1=_0x22c2d4[_0x31bc3f(0x1d6)](0x5)['toUpperCase'](),_0xcdb9e5=_0x22c2d4[_0x31bc3f(0x1c9)](0x6)[_0x31bc3f(0x1d2)](/\//g,'\x5c');return _0x2d64a1+':'+_0xcdb9e5;}if(_0x22c2d4[_0x31bc3f(0x1c4)](/^\/[a-zA-Z]\//)){const _0x5a8991=_0x22c2d4[_0x31bc3f(0x1d6)](0x1)[_0x31bc3f(0x1cd)](),_0x38bcf1=_0x22c2d4[_0x31bc3f(0x1c9)](0x2)['replace'](/\//g,'\x5c');return _0x5a8991+':'+_0x38bcf1;}if(_0x22c2d4[_0x31bc3f(0x1c4)](/^[a-zA-Z]:/))return _0x22c2d4[_0x31bc3f(0x1d2)](/\//g,'\x5c');return _0x22c2d4;}export function normalizePath(_0x331492){const _0x54f202=a3_0x2e75;_0x331492=_0x331492['trim']()[_0x54f202(0x1d2)](/^["']|["']$/g,'');const _0x347d9c=_0x331492[_0x54f202(0x1d8)]('/')&&!_0x331492['match'](/^\/mnt\/[a-z]\//i)&&!_0x331492[_0x54f202(0x1c4)](/^\/[a-zA-Z]\//);if(_0x347d9c)return _0x331492[_0x54f202(0x1d2)](/\/+/g,'/')[_0x54f202(0x1d2)](/\/+$/,'');_0x331492=convertToWindowsPath(_0x331492);if(_0x331492['startsWith']('\x5c\x5c')){let _0x570639=_0x331492;_0x570639=_0x570639['replace'](/^\\{2,}/,'\x5c\x5c');const _0x200368=_0x570639[_0x54f202(0x1d5)](0x2)[_0x54f202(0x1d2)](/\\\\/g,'\x5c');_0x331492='\x5c\x5c'+_0x200368;}else _0x331492=_0x331492[_0x54f202(0x1d2)](/\\\\/g,'\x5c');let _0x2e719b=a3_0x285e4e[_0x54f202(0x1c8)](_0x331492);_0x331492[_0x54f202(0x1d8)]('\x5c\x5c')&&!_0x2e719b[_0x54f202(0x1d8)]('\x5c\x5c')&&(_0x2e719b='\x5c'+_0x2e719b);if(_0x2e719b[_0x54f202(0x1c4)](/^[a-zA-Z]:/)){let _0x550d52=_0x2e719b[_0x54f202(0x1d2)](/\//g,'\x5c');return/^[a-z]:/[_0x54f202(0x1cc)](_0x550d52)&&(_0x550d52=_0x550d52[_0x54f202(0x1d6)](0x0)[_0x54f202(0x1cd)]()+_0x550d52[_0x54f202(0x1c9)](0x1)),_0x550d52;}return _0x2e719b[_0x54f202(0x1d2)](/\//g,'\x5c');}export function expandHome(_0x35a838){const _0x27a1c4=a3_0x2e75;if(_0x35a838['startsWith']('~/')||_0x35a838==='~')return a3_0x285e4e['join'](a3_0x5d4b6b[_0x27a1c4(0x1d4)](),_0x35a838['slice'](0x1));return _0x35a838;}
@@ -1 +1 @@
1
- function a4_0x4266(){const _0x361fc3=['Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute','3TWSLkk','some','startsWith','sep','1247121ypmOek','14KqNjZd','30dCppVW','resolve','2996056FqFASX','normalize','845TFqxHZ','Path\x20must\x20be\x20absolute\x20after\x20normalization','1508691NrZjFl','string','1667236zVvNde','659374SQuwaz','includes','8442MrrZGd','9150625dYfEDi','length'];a4_0x4266=function(){return _0x361fc3;};return a4_0x4266();}(function(_0xa0a6e6,_0x1e1757){const _0x2eb3a8=a4_0x4eb3,_0x5fa6a5=_0xa0a6e6();while(!![]){try{const _0x4b4ea0=-parseInt(_0x2eb3a8(0xfd))/0x1*(-parseInt(_0x2eb3a8(0x10c))/0x2)+parseInt(_0x2eb3a8(0x109))/0x3+-parseInt(_0x2eb3a8(0x10b))/0x4+parseInt(_0x2eb3a8(0x107))/0x5*(-parseInt(_0x2eb3a8(0xf8))/0x6)+parseInt(_0x2eb3a8(0x102))/0x7*(-parseInt(_0x2eb3a8(0x105))/0x8)+parseInt(_0x2eb3a8(0x101))/0x9*(-parseInt(_0x2eb3a8(0x103))/0xa)+parseInt(_0x2eb3a8(0xf9))/0xb;if(_0x4b4ea0===_0x1e1757)break;else _0x5fa6a5['push'](_0x5fa6a5['shift']());}catch(_0x1b6b68){_0x5fa6a5['push'](_0x5fa6a5['shift']());}}}(a4_0x4266,0x7b2c8));function a4_0x4eb3(_0x5ec8c2,_0x2b43a9){_0x5ec8c2=_0x5ec8c2-0xf8;const _0x4266dc=a4_0x4266();let _0x4eb37b=_0x4266dc[_0x5ec8c2];return _0x4eb37b;}import a4_0x5eb2ab from'path';export function isPathWithinAllowedDirectories(_0x14b201,_0x22c31e){const _0x4afed1=a4_0x4eb3;if(typeof _0x14b201!==_0x4afed1(0x10a)||!Array['isArray'](_0x22c31e))return![];if(!_0x14b201||_0x22c31e[_0x4afed1(0xfa)]===0x0)return![];if(_0x14b201[_0x4afed1(0x10d)]('\x00'))return![];let _0x80dec3;try{_0x80dec3=a4_0x5eb2ab[_0x4afed1(0x104)](a4_0x5eb2ab[_0x4afed1(0x106)](_0x14b201));}catch{return![];}if(!a4_0x5eb2ab['isAbsolute'](_0x80dec3))throw new Error(_0x4afed1(0x108));return _0x22c31e[_0x4afed1(0xfe)](_0x211a1a=>{const _0x27a345=_0x4afed1;if(typeof _0x211a1a!==_0x27a345(0x10a)||!_0x211a1a)return![];if(_0x211a1a[_0x27a345(0x10d)]('\x00'))return![];let _0x56a8ee;try{_0x56a8ee=a4_0x5eb2ab[_0x27a345(0x104)](a4_0x5eb2ab[_0x27a345(0x106)](_0x211a1a));}catch{return![];}if(!a4_0x5eb2ab[_0x27a345(0xfc)](_0x56a8ee))throw new Error(_0x27a345(0xfb));if(_0x80dec3===_0x56a8ee)return!![];if(_0x56a8ee===a4_0x5eb2ab[_0x27a345(0x100)])return _0x80dec3[_0x27a345(0xff)](a4_0x5eb2ab[_0x27a345(0x100)]);return _0x80dec3[_0x27a345(0xff)](_0x56a8ee+a4_0x5eb2ab[_0x27a345(0x100)]);});}
1
+ function a4_0x1479(){const _0x19fe8b=['451393ddJSEf','2EPTMMK','137417kZhJxn','184uvdmkr','2767320eBhiWn','2280363kCOHtG','isArray','167436MZEBJG','sep','some','4xRJfOd','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','3391368dhHGJK','isAbsolute','includes','string','66scVwnN','length','normalize','startsWith','170pZGKry','2758875lgnhyP','resolve'];a4_0x1479=function(){return _0x19fe8b;};return a4_0x1479();}(function(_0x103211,_0xac937e){const _0xed378b=a4_0xedc9,_0xae9946=_0x103211();while(!![]){try{const _0x2b7c72=-parseInt(_0xed378b(0x192))/0x1*(-parseInt(_0xed378b(0x17c))/0x2)+parseInt(_0xed378b(0x180))/0x3*(parseInt(_0xed378b(0x185))/0x4)+parseInt(_0xed378b(0x190))/0x5+parseInt(_0xed378b(0x17f))/0x6+parseInt(_0xed378b(0x17d))/0x7*(-parseInt(_0xed378b(0x17e))/0x8)+parseInt(_0xed378b(0x182))/0x9*(parseInt(_0xed378b(0x18f))/0xa)+parseInt(_0xed378b(0x18b))/0xb*(-parseInt(_0xed378b(0x187))/0xc);if(_0x2b7c72===_0xac937e)break;else _0xae9946['push'](_0xae9946['shift']());}catch(_0x22eab2){_0xae9946['push'](_0xae9946['shift']());}}}(a4_0x1479,0x6016c));import a4_0x1ea8b4 from'path';function a4_0xedc9(_0x2c4d44,_0x1a2c32){_0x2c4d44=_0x2c4d44-0x17c;const _0x147930=a4_0x1479();let _0xedc9f7=_0x147930[_0x2c4d44];return _0xedc9f7;}export function isPathWithinAllowedDirectories(_0x4d0b93,_0x5acc87){const _0x2fb292=a4_0xedc9;if(typeof _0x4d0b93!==_0x2fb292(0x18a)||!Array[_0x2fb292(0x181)](_0x5acc87))return![];if(!_0x4d0b93||_0x5acc87[_0x2fb292(0x18c)]===0x0)return![];if(_0x4d0b93[_0x2fb292(0x189)]('\x00'))return![];let _0x19b146;try{_0x19b146=a4_0x1ea8b4[_0x2fb292(0x191)](a4_0x1ea8b4['normalize'](_0x4d0b93));}catch{return![];}if(!a4_0x1ea8b4[_0x2fb292(0x188)](_0x19b146))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x5acc87[_0x2fb292(0x184)](_0x3be047=>{const _0x12a6dc=_0x2fb292;if(typeof _0x3be047!==_0x12a6dc(0x18a)||!_0x3be047)return![];if(_0x3be047['includes']('\x00'))return![];let _0x202d3b;try{_0x202d3b=a4_0x1ea8b4[_0x12a6dc(0x191)](a4_0x1ea8b4[_0x12a6dc(0x18d)](_0x3be047));}catch{return![];}if(!a4_0x1ea8b4[_0x12a6dc(0x188)](_0x202d3b))throw new Error(_0x12a6dc(0x186));if(_0x19b146===_0x202d3b)return!![];if(_0x202d3b===a4_0x1ea8b4[_0x12a6dc(0x183)])return _0x19b146[_0x12a6dc(0x18e)](a4_0x1ea8b4[_0x12a6dc(0x183)]);return _0x19b146[_0x12a6dc(0x18e)](_0x202d3b+a4_0x1ea8b4[_0x12a6dc(0x183)]);});}
@@ -1 +1 @@
1
- (function(_0x121cb3,_0x5e714a){const _0x57c85d=a5_0x43c6,_0x3e5959=_0x121cb3();while(!![]){try{const _0x2d1bd5=-parseInt(_0x57c85d(0x207))/0x1+parseInt(_0x57c85d(0x1fe))/0x2*(parseInt(_0x57c85d(0x1fa))/0x3)+parseInt(_0x57c85d(0x206))/0x4*(-parseInt(_0x57c85d(0x1ff))/0x5)+-parseInt(_0x57c85d(0x208))/0x6*(-parseInt(_0x57c85d(0x1f9))/0x7)+parseInt(_0x57c85d(0x209))/0x8+parseInt(_0x57c85d(0x1f3))/0x9*(parseInt(_0x57c85d(0x1fb))/0xa)+-parseInt(_0x57c85d(0x205))/0xb*(parseInt(_0x57c85d(0x1f7))/0xc);if(_0x2d1bd5===_0x5e714a)break;else _0x3e5959['push'](_0x3e5959['shift']());}catch(_0x375d8f){_0x3e5959['push'](_0x3e5959['shift']());}}}(a5_0x1c5f,0xb1e40));function a5_0x43c6(_0x3fc424,_0x504710){_0x3fc424=_0x3fc424-0x1f2;const _0x1c5fe=a5_0x1c5f();let _0x43c6fe=_0x1c5fe[_0x3fc424];return _0x43c6fe;}import{promises as a5_0x5c5257}from'fs';import a5_0x528ebe from'path';import a5_0xca0716 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x4c42dc){const _0x84f0d3=a5_0x43c6;try{const _0x14d6bd=_0x4c42dc[_0x84f0d3(0x201)](_0x84f0d3(0x1f2))?_0x4c42dc[_0x84f0d3(0x203)](0x7):_0x4c42dc,_0x136494=_0x14d6bd[_0x84f0d3(0x201)]('~/')||_0x14d6bd==='~'?a5_0x528ebe[_0x84f0d3(0x1f8)](a5_0xca0716[_0x84f0d3(0x1f5)](),_0x14d6bd[_0x84f0d3(0x203)](0x1)):_0x14d6bd,_0x34c3ce=a5_0x528ebe[_0x84f0d3(0x200)](_0x136494),_0x3a3b88=await a5_0x5c5257['realpath'](_0x34c3ce);return normalizePath(_0x3a3b88);}catch{return null;}}function formatDirectoryError(_0x28ce4e,_0x3a78c8,_0x2827d0){const _0x129003=a5_0x43c6;if(_0x2827d0)return'Skipping\x20'+_0x2827d0+':\x20'+_0x28ce4e;const _0x5cf2d0=_0x3a78c8 instanceof Error?_0x3a78c8['message']:String(_0x3a78c8);return _0x129003(0x1fd)+_0x28ce4e+'\x20due\x20to\x20error:\x20'+_0x5cf2d0;}function a5_0x1c5f(){const _0x4343ec=['Skipping\x20invalid\x20directory:\x20','2cyiAeO','79105lpECHH','resolve','startsWith','non-directory\x20root','slice','stat','33LLcQIE','28GHIHwL','501319ANlJSt','78GrSnPe','11114072JAHqZO','file://','99NesWbL','push','homedir','uri','8911476iRVUXZ','join','167937NTHWkL','3028596gIITrO','779910XYgnCe','isDirectory'];a5_0x1c5f=function(){return _0x4343ec;};return a5_0x1c5f();}export async function getValidRootDirectories(_0x5ce7ae){const _0x27e4b9=a5_0x43c6,_0x2ab7b8=[];for(const _0x5c1cf4 of _0x5ce7ae){const _0x13aabe=await parseRootUri(_0x5c1cf4[_0x27e4b9(0x1f6)]);if(!_0x13aabe){logMcpStderr(formatDirectoryError(_0x5c1cf4[_0x27e4b9(0x1f6)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x27156e=await a5_0x5c5257[_0x27e4b9(0x204)](_0x13aabe);_0x27156e[_0x27e4b9(0x1fc)]()?_0x2ab7b8[_0x27e4b9(0x1f4)](_0x13aabe):logMcpStderr(formatDirectoryError(_0x13aabe,undefined,_0x27e4b9(0x202)));}catch(_0x4d841c){logMcpStderr(formatDirectoryError(_0x13aabe,_0x4d841c));}}return _0x2ab7b8;}
1
+ (function(_0x1b05d4,_0x430b7c){const _0x2b0f7c=a5_0x5bd4,_0x581498=_0x1b05d4();while(!![]){try{const _0x3843c4=parseInt(_0x2b0f7c(0x127))/0x1*(parseInt(_0x2b0f7c(0x114))/0x2)+parseInt(_0x2b0f7c(0x124))/0x3*(-parseInt(_0x2b0f7c(0x110))/0x4)+parseInt(_0x2b0f7c(0x10f))/0x5+-parseInt(_0x2b0f7c(0x11a))/0x6*(parseInt(_0x2b0f7c(0x11f))/0x7)+-parseInt(_0x2b0f7c(0x125))/0x8*(-parseInt(_0x2b0f7c(0x11c))/0x9)+parseInt(_0x2b0f7c(0x112))/0xa*(-parseInt(_0x2b0f7c(0x111))/0xb)+parseInt(_0x2b0f7c(0x118))/0xc*(parseInt(_0x2b0f7c(0x121))/0xd);if(_0x3843c4===_0x430b7c)break;else _0x581498['push'](_0x581498['shift']());}catch(_0x4f65f8){_0x581498['push'](_0x581498['shift']());}}}(a5_0x3ebb,0x5f061));function a5_0x5bd4(_0x8793f5,_0x2138d6){_0x8793f5=_0x8793f5-0x10e;const _0x3ebbb4=a5_0x3ebb();let _0x5bd493=_0x3ebbb4[_0x8793f5];return _0x5bd493;}import{promises as a5_0x4248b1}from'fs';import a5_0x30a32d from'path';function a5_0x3ebb(){const _0x6c0e48=['isDirectory','8040vwwtmS','uri','61110qaiqNL','slice','36dKOsiR','non-directory\x20root','stat','308WueiFZ','resolve','5213QqAcWj','startsWith','push','709959xslBFF','1062864AFGCFE','message','70141xVpgHA','realpath','\x20due\x20to\x20error:\x20','file://','1999000quDCBD','4OpLufK','12881KbGlvJ','4070IhlSIF','homedir','10uCBnbJ','join','invalid\x20path\x20or\x20inaccessible'];a5_0x3ebb=function(){return _0x6c0e48;};return a5_0x3ebb();}import a5_0x2d9f48 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x4cabb2){const _0x583d6f=a5_0x5bd4;try{const _0x3549a4=_0x4cabb2['startsWith'](_0x583d6f(0x10e))?_0x4cabb2[_0x583d6f(0x11b)](0x7):_0x4cabb2,_0x4567f6=_0x3549a4[_0x583d6f(0x122)]('~/')||_0x3549a4==='~'?a5_0x30a32d[_0x583d6f(0x115)](a5_0x2d9f48[_0x583d6f(0x113)](),_0x3549a4['slice'](0x1)):_0x3549a4,_0x474915=a5_0x30a32d[_0x583d6f(0x120)](_0x4567f6),_0x50766b=await a5_0x4248b1[_0x583d6f(0x128)](_0x474915);return normalizePath(_0x50766b);}catch{return null;}}function formatDirectoryError(_0x39a962,_0x6ce71d,_0x644528){const _0x356f54=a5_0x5bd4;if(_0x644528)return'Skipping\x20'+_0x644528+':\x20'+_0x39a962;const _0x2d3b7e=_0x6ce71d instanceof Error?_0x6ce71d[_0x356f54(0x126)]:String(_0x6ce71d);return'Skipping\x20invalid\x20directory:\x20'+_0x39a962+_0x356f54(0x129)+_0x2d3b7e;}export async function getValidRootDirectories(_0x22ba4e){const _0x509566=a5_0x5bd4,_0x5cec9c=[];for(const _0x2ed82b of _0x22ba4e){const _0x17c82e=await parseRootUri(_0x2ed82b[_0x509566(0x119)]);if(!_0x17c82e){logMcpStderr(formatDirectoryError(_0x2ed82b[_0x509566(0x119)],undefined,_0x509566(0x116)));continue;}try{const _0x206ac2=await a5_0x4248b1[_0x509566(0x11e)](_0x17c82e);_0x206ac2[_0x509566(0x117)]()?_0x5cec9c[_0x509566(0x123)](_0x17c82e):logMcpStderr(formatDirectoryError(_0x17c82e,undefined,_0x509566(0x11d)));}catch(_0x5ab012){logMcpStderr(formatDirectoryError(_0x17c82e,_0x5ab012));}}return _0x5cec9c;}
@@ -1 +1 @@
1
- const a6_0x2b4d14=a6_0x5251;function a6_0x5251(_0xc7671a,_0x37ad9a){_0xc7671a=_0xc7671a-0xde;const _0x2ec54b=a6_0x2ec5();let _0x5251cf=_0x2ec54b[_0xc7671a];return _0x5251cf;}(function(_0x1df86f,_0x1d776e){const _0x17251d=a6_0x5251,_0x3eb4a7=_0x1df86f();while(!![]){try{const _0x2b6137=parseInt(_0x17251d(0xe2))/0x1*(-parseInt(_0x17251d(0xe8))/0x2)+parseInt(_0x17251d(0xdf))/0x3*(parseInt(_0x17251d(0xe3))/0x4)+-parseInt(_0x17251d(0xe0))/0x5+-parseInt(_0x17251d(0xe1))/0x6*(parseInt(_0x17251d(0xe7))/0x7)+-parseInt(_0x17251d(0xe4))/0x8+-parseInt(_0x17251d(0xe6))/0x9+parseInt(_0x17251d(0xe5))/0xa;if(_0x2b6137===_0x1d776e)break;else _0x3eb4a7['push'](_0x3eb4a7['shift']());}catch(_0x5c2d2a){_0x3eb4a7['push'](_0x3eb4a7['shift']());}}}(a6_0x2ec5,0x5d100));export const TOOL_NAMES={'EDIT_FILE':a6_0x2b4d14(0xde),'CODEBASE_SEARCH':a6_0x2b4d14(0xe9),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};function a6_0x2ec5(){const _0x2721c8=['edit_file','16971jCLuaH','582505gAdyui','6lehLBA','3386wKVzBr','424AhlZDU','4480160ZuNluc','17324030DCGzvZ','5946471IUVEPC','929663EEFggy','284qjOYnS','codebase_search'];a6_0x2ec5=function(){return _0x2721c8;};return a6_0x2ec5();}export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ function a6_0x1b67(_0x5e5c14,_0x343e4b){_0x5e5c14=_0x5e5c14-0xe3;const _0x5388ca=a6_0x5388();let _0x1b67c8=_0x5388ca[_0x5e5c14];return _0x1b67c8;}const a6_0xc81e84=a6_0x1b67;(function(_0x2be7c4,_0x20c133){const _0x34f170=a6_0x1b67,_0x2af2e6=_0x2be7c4();while(!![]){try{const _0x3ec1a7=parseInt(_0x34f170(0xe3))/0x1+parseInt(_0x34f170(0xeb))/0x2+-parseInt(_0x34f170(0xe8))/0x3+parseInt(_0x34f170(0xe9))/0x4+-parseInt(_0x34f170(0xee))/0x5*(-parseInt(_0x34f170(0xed))/0x6)+-parseInt(_0x34f170(0xe4))/0x7+-parseInt(_0x34f170(0xe6))/0x8;if(_0x3ec1a7===_0x20c133)break;else _0x2af2e6['push'](_0x2af2e6['shift']());}catch(_0x1ed459){_0x2af2e6['push'](_0x2af2e6['shift']());}}}(a6_0x5388,0xc5727));export const TOOL_NAMES={'EDIT_FILE':a6_0xc81e84(0xe5),'CODEBASE_SEARCH':a6_0xc81e84(0xea),'GITHUB_CODEBASE_SEARCH':a6_0xc81e84(0xe7)};export const ALL_TOOL_NAMES=Object[a6_0xc81e84(0xec)](TOOL_NAMES);function a6_0x5388(){const _0x59b1cb=['edit_file','3217072GXDrNn','github_codebase_search','3083091VQgqUi','2801556uuGKaC','codebase_search','923018pcJOtx','values','216YdLjAq','82765uNnoYt','1555810ouNKoe','7525294BxGxRB'];a6_0x5388=function(){return _0x59b1cb;};return a6_0x5388();}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.199",
3
+ "version": "0.8.200",
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.187",
38
+ "@morphllm/morphsdk": "0.2.188",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",