🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@morphllm/morphmcp

Package Overview
Dependencies
Maintainers
2
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morphllm/morphmcp - npm Package Compare versions

Comparing version
0.8.178
to
0.8.179
+1
-1
dist/index.js
#!/usr/bin/env node
const a0_0x16ed94=a0_0x7395;(function(_0x2fc6a1,_0x599e73){const _0x35f16b=a0_0x7395,_0x378041=_0x2fc6a1();while(!![]){try{const _0xe9f43=-parseInt(_0x35f16b(0x192))/0x1+-parseInt(_0x35f16b(0x18b))/0x2*(parseInt(_0x35f16b(0x1e2))/0x3)+-parseInt(_0x35f16b(0x1fe))/0x4*(parseInt(_0x35f16b(0x114))/0x5)+-parseInt(_0x35f16b(0xfa))/0x6+parseInt(_0x35f16b(0x19c))/0x7*(parseInt(_0x35f16b(0x120))/0x8)+parseInt(_0x35f16b(0x156))/0x9*(parseInt(_0x35f16b(0x180))/0xa)+parseInt(_0x35f16b(0x1ad))/0xb;if(_0xe9f43===_0x599e73)break;else _0x378041['push'](_0x378041['shift']());}catch(_0x56bca1){_0x378041['push'](_0x378041['shift']());}}}(a0_0x50c8,0xa0ef5));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x50c8(){const _0x3f3e0a=['\x20\x20morph-mcp','target_file','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','requiresApiKey','message','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','basename','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Morph\x20Edit\x20Preview','Unknown\x20error','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','BinaryFile','morph-warp-grep-v2.1','some','tool_call_complete','constructor','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','describe','response','api_request_start','FileReadError','UnknownError','<file\x20path=\x22','[github_codebase_search]\x20Done\x20in\x20','file_read_complete','description','lines','ReadError','\x20is\x20not\x20a\x20directory','\x22.\x20Known\x20tools:\x20','readFile','github_search_start','finish','0.2.0','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','warn','Fatal\x20error\x20running\x20server:','content','../package.json','424420JurlbK','-\x20Read\x20file\x20`','dirname','SymlinkError','Parent\x20directory\x20does\x20not\x20exist:\x20','tool_call_received','glob','stack','MORPH_API_KEY','Rules:\x0a','Disabled\x20tools:\x20','394eTkicn','LocalRipgrepProvider','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.',',\x20removed\x20','optional','read','compaction_failed','327272tCyHJE','slice','includes','data','isArray','timeout','min','false','-\x20Grepped\x20\x27','completionId','1217090daRRUh','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','**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','cwd','sep','exit','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','list_directory','timed\x20out','Created\x20File','morph-v3-fast','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.','Morph\x20FastApply\x20failed\x20without\x20error\x20message','warp_grep_complete','stringify','9573982VrGtYG','path_validation_resolved','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','MORPH_WARP_GREP_TIMEOUT','trim','user','Unknown\x20tool:\x20','EDIT_FILE','tool_call_id','realpath','path','debug','search_type','-\x20Preserve\x20exact\x20indentation\x0a','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','inputSchema','setRequestHandler','Warning:\x20Workspace\x20fallback\x20failed:\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Relevant\x20context\x20found:','join','api-key','\x0a...\x20(truncated,\x20total:\x20','SubToolError','split','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','[github_codebase_search]\x20Failed\x20in\x20','.\x20Changes:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','PWD','metadata','TimeoutError','Bearer\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','morph-v3-large','push','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','post','instruction','--api-key=','completed_with_file_errors','Tool\x20\x22','resolve','API\x20error\x20(auth/rate-limit)','package.json','file_path','branch','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','code','ENABLE_WORKSPACE_MODE','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','[could\x20not\x20read\x20file:\x20','tool_calls','2355mYOQjn','text','ToolException','ms.\x20Success:\x20','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','turns','files','RipgrepError','codebase_search','Workspace\x20mode\x20enabled:\x20Using\x20','Error:\x20','now','\x20chars)','new_string','unknown\x20error','file','dryRun','connect','filter','safeParse','\x20valid\x20directories','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Error\x20accessing\x20directory\x20','\x0aExamples:','catch','\x20(new\x20file)','startsWith','Parameters:\x0a','104OeTfFs','ms:','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','tsconfig.json','match','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','grep','node_modules','--api-key','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','argv','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','.cursor','unknown','etimedout','arguments','toLowerCase','linesModified','GITHUB_CODEBASE_SEARCH','stat','grep_search','context','searchGitHub','number','Warning:\x20','terminationReason','error','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x0a</file>','default','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','sk-','MORPH_LARGE_APPLY','`\x20in\x20`','read\x20','pattern','env','linesRemoved','instructions','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','\x22>\x0aError\x20reading\x20file:\x20','roots','success','922368GsugcS','string','added\x20','status','edit','\x20-\x20','.vscode','every','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','messages','all','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','isDirectory','name','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','Here\x20is\x20the\x20content\x20of\x20files:\x0a','length','Failed\x20to\x20read\x20file:\x20','github_url','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','pyproject.toml','assistant','DISABLED_TOOLS','225095eBCNxU','File\x20read\x20error:','@morphllm/morphmcp\x20','PathError','owner_repo','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','provider_created','composer.json','Tool\x20','search_string','morph-','mcp-filesystem','48jruWLh','Example\x20format:\x0a','FileNotFound','path_validation_start','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','repo_path','--version','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','code_edit','linesAdded','completed','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','MCP','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','tool','command','Max\x20results\x20to\x20return','role','getClientCapabilities','\x20as\x20allowed\x20directory','payload','path_validation_failed','errors','object','Applied','has','parse','-\x20Glob\x20search\x20`','file_read_failed','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','utf-8','.\x20Path:\x20','.git','listRoots','timings','log','edit_file','\x22>\x0a',',\x20modified\x20','github_codebase_search','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.','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','map','Preview\x20changes\x20without\x20applying\x20them.','Fallback:\x20Using\x20workspace\x20root\x20','GitHub\x20search\x20failed:\x20','application/json','runWarpGrep_call','changes','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','enum','size','WarpGrepError','tool_call_error','117chrZzc','\x0aOptions:','MORPH_API_URL'];a0_0x50c8=function(){return _0x3f3e0a;};return a0_0x50c8();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x38b0cc from'fs/promises';import a0_0x37f788 from'path';import a0_0x5afb28 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_0x30afef from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x193ee6){const _0x59749a=a0_0x7395,_0xec1203=_0x193ee6[_0x59749a(0x1c5)](a0_0x37f788[_0x59749a(0x1a1)])['filter'](Boolean);if(_0xec1203[_0x59749a(0x10c)]<0x2)return null;for(let _0x225f53=Math['floor'](_0xec1203['length']/0x2);_0x225f53>=0x1;_0x225f53--){for(let _0x255ff3=0x0;_0x255ff3<=_0xec1203[_0x59749a(0x10c)]-0x2*_0x225f53;_0x255ff3++){const _0x4e8fe5=_0xec1203[_0x59749a(0x193)](_0x255ff3,_0x255ff3+_0x225f53),_0x92299f=_0xec1203[_0x59749a(0x193)](_0x255ff3+_0x225f53,_0x255ff3+0x2*_0x225f53);if(_0x4e8fe5[_0x59749a(0x101)]((_0x11a781,_0x49f09f)=>_0x11a781===_0x92299f[_0x49f09f])){const _0x4de80a=[..._0xec1203[_0x59749a(0x193)](0x0,_0x255ff3),..._0xec1203[_0x59749a(0x193)](_0x255ff3+_0x225f53)];return a0_0x37f788['sep']+_0x4de80a[_0x59749a(0x1c1)](a0_0x37f788[_0x59749a(0x1a1)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4081ef=a0_0x7395;try{const _0x3a31c8=require(_0x4081ef(0x17f));return _0x3a31c8['version']??'unknown';}catch(_0xa176ea){return logMcpStderr(_0x4081ef(0x1af),_0xa176ea),_0x4081ef(0x20b);}}function printHelp(){const _0x259e42=a0_0x7395;console[_0x259e42(0x143)](_0x259e42(0x116)+getPackageVersion()),console['log']('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x259e42(0x143)](_0x259e42(0x157)),console[_0x259e42(0x143)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x259e42(0x143)](_0x259e42(0x119)),console[_0x259e42(0x143)](_0x259e42(0x12b)),console[_0x259e42(0x143)](_0x259e42(0x1f9)),console[_0x259e42(0x143)](_0x259e42(0x159)),console[_0x259e42(0x143)](_0x259e42(0x10f));}const cliArgs=process[a0_0x16ed94(0x208)][a0_0x16ed94(0x193)](0x2),VERSION_FLAGS=new Set([a0_0x16ed94(0x126),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);function a0_0x7395(_0x27fade,_0xa201a2){_0x27fade=_0x27fade-0xde;const _0x50c8e1=a0_0x50c8();let _0x73953c=_0x50c8e1[_0x27fade];return _0x73953c;}cliArgs[a0_0x16ed94(0x166)](_0x68aa60=>VERSION_FLAGS[a0_0x16ed94(0x139)](_0x68aa60))&&(console[a0_0x16ed94(0x143)]('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x16ed94(0x1a2)](0x0));cliArgs[a0_0x16ed94(0x166)](_0x3f5598=>HELP_FLAGS['has'](_0x3f5598))&&(printHelp(),process[a0_0x16ed94(0x1a2)](0x0));function getCliArg(_0x1ac624){const _0x585664=a0_0x16ed94;for(let _0x15d3ea=0x0;_0x15d3ea<cliArgs[_0x585664(0x10c)];_0x15d3ea++){const _0x52d6be=cliArgs[_0x15d3ea];if(_0x52d6be['startsWith']('--'+_0x1ac624+'='))return _0x52d6be[_0x585664(0x193)](('--'+_0x1ac624+'=')[_0x585664(0x10c)]);if(_0x52d6be==='--'+_0x1ac624&&_0x15d3ea+0x1<cliArgs[_0x585664(0x10c)])return cliArgs[_0x15d3ea+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x16ed94(0x10c)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x16ed94(0x139)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x16ed94(0x1fc)](a0_0x16ed94(0x1d4)))continue;if(arg===a0_0x16ed94(0x206)){i++;continue;}args[a0_0x16ed94(0x1d0)](arg);}const WORKSPACE_ROOT=process[a0_0x16ed94(0xf3)]['WORKSPACE_ROOT']||process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x1ca)]||process[a0_0x16ed94(0x1a0)](),ENABLE_WORKSPACE_MODE=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x1de)]!=='false',MORPH_API_KEY=getCliArg(a0_0x16ed94(0x1c2))??process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x188)],MORPH_API_URL=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x158)],MORPH_LARGE_APPLY=process['env'][a0_0x16ed94(0xef)]!==a0_0x16ed94(0x199),MORPH_WARP_GREP_TIMEOUT=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x1b0)]?parseInt(process['env'][a0_0x16ed94(0x1b0)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x16ed94(0xf3)][a0_0x16ed94(0x113)]?new Set(process[a0_0x16ed94(0xf3)]['DISABLED_TOOLS'][a0_0x16ed94(0x1c5)](',')[a0_0x16ed94(0x14a)](_0x440f82=>_0x440f82[a0_0x16ed94(0x1b1)]())[a0_0x16ed94(0x1f4)](_0x4502cd=>_0x4502cd['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x16ed94(0x153)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x16ed94(0x139)](tool)&&console[a0_0x16ed94(0xe9)](a0_0x16ed94(0xf6)+tool+a0_0x16ed94(0x176)+[...KNOWN_TOOL_NAMES][a0_0x16ed94(0x1c1)](',\x20'));}console[a0_0x16ed94(0xe9)](a0_0x16ed94(0x18a)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x16ed94(0x1fc)](a0_0x16ed94(0xee))&&!MORPH_API_KEY[a0_0x16ed94(0x1fc)](a0_0x16ed94(0x11e))&&logMcpStderr(a0_0x16ed94(0x124));async function reportMorphError(_0x15429b){const _0x137816=a0_0x16ed94;try{await a0_0x30afef[_0x137816(0x1d2)]('https://morphllm.com/api/error-report',{..._0x15429b,'timestamp':new Date()['toISOString'](),'source':_0x15429b['source']||_0x137816(0x11f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x15429b[_0x137816(0xe4)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x137816(0x14e),'Authorization':_0x137816(0x1cd)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x56fd8a,_0x897e95){const _0x3cd348=a0_0x16ed94;if(_0x56fd8a&&typeof _0x56fd8a==='object'&&'status'in _0x56fd8a)return _0x56fd8a['status'];if(_0x56fd8a&&typeof _0x56fd8a===_0x3cd348(0x137)&&'response'in _0x56fd8a)return _0x56fd8a[_0x3cd348(0x16b)]?.[_0x3cd348(0xfd)];const _0x933e72=_0x897e95[_0x3cd348(0x202)](/\b(401|429)\b/);return _0x933e72?parseInt(_0x933e72[0x1],0xa):null;}function handleMorphAPIError(_0x487e0b){const _0x131355=a0_0x16ed94,_0x30ab0c=_0x487e0b instanceof Error?_0x487e0b[_0x131355(0x15d)]:String(_0x487e0b),_0x3c7f38=extractStatusCode(_0x487e0b,_0x30ab0c);switch(_0x3c7f38){case 0x191:return{'content':[{'type':'text','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':_0x131355(0x1a4)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x16ed94(0xea)),logMcpStderr(a0_0x16ed94(0x209)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x16ed94(0x15e)),logMcpStderr(a0_0x16ed94(0x102)));function normalizePath(_0x6896e8){return a0_0x37f788['normalize'](_0x6896e8);}function expandHome(_0x5d8e90){const _0x52435f=a0_0x16ed94;if(_0x5d8e90[_0x52435f(0x1fc)]('~/')||_0x5d8e90==='~')return a0_0x37f788['join'](a0_0x5afb28['homedir'](),_0x5d8e90['slice'](0x1));return _0x5d8e90;}let allowedDirectories=await Promise[a0_0x16ed94(0x105)](args['map'](async _0xa3e7d1=>{const _0x397974=a0_0x16ed94,_0x24150c=expandHome(_0xa3e7d1),_0x2f86a8=a0_0x37f788[_0x397974(0x1d7)](_0x24150c);try{const _0x2f050b=await a0_0x38b0cc['realpath'](_0x2f86a8);return normalizePath(_0x2f050b);}catch(_0x7079ba){return normalizePath(_0x2f86a8);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x16ed94(0x10c)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x16ed94(0x1d0)](workspaceDir),logMcpStderr(a0_0x16ed94(0x1eb)+workspaceDir+a0_0x16ed94(0x133)));}catch(a0_0x56c65c){logMcpStderr(a0_0x16ed94(0x160)+a0_0x56c65c);}async function detectWorkspaceRoot(_0x41da66){const _0x1b8582=a0_0x16ed94;let _0x332bec=a0_0x37f788[_0x1b8582(0x1d7)](_0x41da66);const _0x5d53a6=[_0x1b8582(0x140),_0x1b8582(0x100),_0x1b8582(0x1d9),'Cargo.toml',_0x1b8582(0x111),'go.mod',_0x1b8582(0x20a),_0x1b8582(0x201),_0x1b8582(0x11b)];while(_0x332bec!==a0_0x37f788[_0x1b8582(0x182)](_0x332bec)){for(const _0x7b01b8 of _0x5d53a6){const _0x1b6a04=a0_0x37f788['join'](_0x332bec,_0x7b01b8);try{return await a0_0x38b0cc['access'](_0x1b6a04),normalizePath(_0x332bec);}catch{}}_0x332bec=a0_0x37f788[_0x1b8582(0x182)](_0x332bec);}return normalizePath(_0x41da66);}await Promise[a0_0x16ed94(0x105)](args[a0_0x16ed94(0x14a)](async _0x19c514=>{const _0x2c0c5b=a0_0x16ed94;try{const _0x2ca649=await a0_0x38b0cc[_0x2c0c5b(0xe2)](expandHome(_0x19c514));!_0x2ca649[_0x2c0c5b(0x107)]()&&(logMcpStderr(_0x2c0c5b(0x1ec)+_0x19c514+_0x2c0c5b(0x175)),process[_0x2c0c5b(0x1a2)](0x1));}catch(_0x1d64df){logMcpStderr(_0x2c0c5b(0x1f8)+_0x19c514+':',_0x1d64df),process[_0x2c0c5b(0x1a2)](0x1);}}));async function validatePath(_0x30d4d7){const _0x2830ec=a0_0x16ed94,_0x40ea0b=expandHome(_0x30d4d7),_0x36251b=a0_0x37f788[_0x2830ec(0x1d7)](_0x40ea0b);logger[_0x2830ec(0x1b8)](_0x2830ec(0x12c),_0x2830ec(0x123),{'raw_path':_0x30d4d7,'absolute':_0x36251b});try{const _0x58298f=await a0_0x38b0cc[_0x2830ec(0x1b6)](_0x36251b);return logger['debug'](_0x2830ec(0x12c),_0x2830ec(0x1ae),{'resolved':_0x58298f,'symlink':_0x58298f!==_0x36251b}),_0x58298f;}catch(_0x409c09){if(_0x409c09[_0x2830ec(0x1dd)]==='ENOENT'){const _0xad2201=a0_0x37f788[_0x2830ec(0x182)](_0x36251b);try{const _0x885fe5=await a0_0x38b0cc['realpath'](_0xad2201),_0x21a7b2=a0_0x37f788['join'](_0x885fe5,a0_0x37f788[_0x2830ec(0x15f)](_0x36251b));return logger[_0x2830ec(0x1b8)](_0x2830ec(0x12c),_0x2830ec(0x1ae),{'resolved':_0x21a7b2,'new_file':!![]}),_0x21a7b2;}catch{logger['error'](_0x2830ec(0x12c),_0x2830ec(0x135),{'raw_path':_0x30d4d7,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0xad2201});throw new Error(_0x2830ec(0x184)+_0xad2201);}}logger[_0x2830ec(0xe9)](_0x2830ec(0x12c),'path_validation_failed',{'raw_path':_0x30d4d7,'error':_0x409c09['message']});throw _0x409c09;}}const MorphEditFileArgsSchema=z[a0_0x16ed94(0x137)]({'path':z['string'](),'code_edit':z['string']()[a0_0x16ed94(0x16a)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z['string']()['describe'](a0_0x16ed94(0x18d)),'dryRun':z['boolean']()['default'](![])['describe'](a0_0x16ed94(0x14b))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x16ed94(0x10a),WarpGrepArgsSchema=z[a0_0x16ed94(0x137)]({'search_string':z['string']()[a0_0x16ed94(0x16a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x16ed94(0x16a)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x16ed94(0x152)](['default',a0_0x16ed94(0x205)])['optional']()['describe'](a0_0x16ed94(0x127))}),WarpGrepGitHubArgsSchema=z[a0_0x16ed94(0x137)]({'search_string':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x16a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x18f)]()[a0_0x16ed94(0x16a)](a0_0x16ed94(0x148)),'owner_repo':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x18f)]()['describe']('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x16ed94(0xfb)]()[a0_0x16ed94(0x18f)]()[a0_0x16ed94(0x16a)](a0_0x16ed94(0x1bf))}),CodebaseSearchArgsSchema=z[a0_0x16ed94(0x137)]({'query':z['string']()[a0_0x16ed94(0x16a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x16ed94(0x16a)]('Repository\x20identifier'),'branch':z['string']()['optional']()[a0_0x16ed94(0x16a)](a0_0x16ed94(0x106)),'commitHash':z['string']()[a0_0x16ed94(0x18f)]()[a0_0x16ed94(0x16a)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x16ed94(0xfb)]())[a0_0x16ed94(0xec)]([])['describe'](a0_0x16ed94(0x1bb)),'limit':z[a0_0x16ed94(0xe6)]()['optional']()[a0_0x16ed94(0xec)](0xa)['describe'](a0_0x16ed94(0x130))}),server=new Server({'name':'morph-mcp','version':a0_0x16ed94(0x17a)},{'capabilities':{'tools':{}}});server[a0_0x16ed94(0x1bd)](ListToolsRequestSchema,async()=>{const _0x58531d=a0_0x16ed94,_0x5e5d06=[{'name':TOOL_NAMES[_0x58531d(0x1b4)],'description':_0x58531d(0x19f)+_0x58531d(0x1fd)+_0x58531d(0xed)+_0x58531d(0x15b)+_0x58531d(0x1a3)+_0x58531d(0x1df)+_0x58531d(0x121)+_0x58531d(0x203)+_0x58531d(0x189)+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x58531d(0x1ba)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x58531d(0x1e6),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0x58531d(0x1dc)+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'+_0x58531d(0x1f7)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3839b8=_0x5e5d06[_0x58531d(0x1f4)](_0x42723d=>{const _0x4f92f=_0x58531d;if(DISABLED_TOOLS[_0x4f92f(0x139)](_0x42723d[_0x4f92f(0x108)]))return console[_0x4f92f(0xe9)](_0x4f92f(0x11c)+_0x42723d[_0x4f92f(0x108)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x4f92f(0x15c)in _0x42723d&&_0x42723d[_0x4f92f(0x15c)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x42723d[_0x4f92f(0x108)]+_0x4f92f(0x13d)),![];return!![];});return{'tools':_0x3839b8[_0x58531d(0x14a)](_0x4a4981=>({'name':_0x4a4981[_0x58531d(0x108)],'description':_0x4a4981[_0x58531d(0x172)],'inputSchema':_0x4a4981[_0x58531d(0x1bc)]}))};}),server[a0_0x16ed94(0x1bd)](CallToolRequestSchema,async _0x18caa7=>{const _0x5d3319=a0_0x16ed94,{name:_0x49f5bf,arguments:_0x44f402}=_0x18caa7['params'],_0x5244ad=Date[_0x5d3319(0x1ed)]();logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x185),{'tool':_0x49f5bf,'args':_0x49f5bf==='edit_file'?{'path':_0x44f402?.[_0x5d3319(0x1b7)],'instruction':_0x44f402?.[_0x5d3319(0x1d3)]||_0x44f402?.[_0x5d3319(0xf5)],'dryRun':_0x44f402?.[_0x5d3319(0x1f2)]}:_0x44f402});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x163)}],'isError':!![]};if(!MORPH_API_KEY[_0x5d3319(0x1fc)](_0x5d3319(0xee))&&!MORPH_API_KEY[_0x5d3319(0x1fc)]('morph-'))return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x1a9)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x49f5bf))return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x1d6)+_0x49f5bf+_0x5d3319(0x12d)}],'isError':![]};switch(_0x49f5bf){case TOOL_NAMES[_0x5d3319(0x1b4)]:{let _0x209dd4=_0x44f402;if(_0x209dd4&&typeof _0x209dd4===_0x5d3319(0x137)){if(!(_0x5d3319(0x1b7)in _0x209dd4)){const _0x499ec6=_0x209dd4[_0x5d3319(0x15a)]??_0x209dd4['filePath']??_0x209dd4['target_filepath']??_0x209dd4[_0x5d3319(0x1da)]??_0x209dd4[_0x5d3319(0x1f1)];if(_0x499ec6)_0x209dd4={..._0x209dd4,'path':_0x499ec6};}'instructions'in _0x209dd4&&!(_0x5d3319(0x1d3)in _0x209dd4)&&(_0x209dd4={..._0x209dd4,'instruction':_0x209dd4[_0x5d3319(0xf5)]});if(!('code_edit'in _0x209dd4)){const _0x5d437e=_0x209dd4['code']??_0x209dd4[_0x5d3319(0x1ef)]??_0x209dd4['content']??_0x209dd4[_0x5d3319(0xfe)];if(_0x5d437e)_0x209dd4={..._0x209dd4,'code_edit':_0x5d437e};}}const _0xaf107c=MorphEditFileArgsSchema[_0x5d3319(0x1f5)](_0x209dd4);if(!_0xaf107c[_0x5d3319(0xf9)])throw new Error(_0x5d3319(0x1c6)+_0xaf107c['error']);const _0x427038=await validatePath(_0xaf107c[_0x5d3319(0x195)]['path']);let _0x3e9517=null,_0x4a5b59=!![],_0x2f2a0d=null;try{_0x3e9517=await a0_0x38b0cc[_0x5d3319(0x177)](_0x427038,_0x5d3319(0x13e)),logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x171),{'path':_0x427038,'size_bytes':_0x3e9517[_0x5d3319(0x10c)]});}catch(_0x1a1216){const _0x341425=_0x1a1216[_0x5d3319(0x1dd)];_0x341425==='ENOENT'?(_0x4a5b59=![],_0x3e9517='',logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x171),{'path':_0x427038,'exists':![]})):(_0x2f2a0d=_0x5d3319(0x10d)+(_0x341425||'unknown')+_0x5d3319(0xff)+(_0x1a1216 instanceof Error?_0x1a1216['message']:String(_0x1a1216)),logger[_0x5d3319(0xe9)]('MCP',_0x5d3319(0x13c),{'path':_0x427038,'error':_0x2f2a0d}),logMcpStderr(_0x5d3319(0xe7)+_0x2f2a0d));}let _0x1189f0;try{const _0x3c4d0e=MORPH_API_KEY;if(!_0x3c4d0e)throw new Error(_0x5d3319(0x103));const _0x240acf=a0_0x37f788[_0x5d3319(0x182)](_0x427038),_0x4132ad=a0_0x37f788[_0x5d3319(0x15f)](_0x427038);logger[_0x5d3319(0x1b8)]('MCP',_0x5d3319(0x16c),{'model':_0x5d3319(0x1a8),'path':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1b7)],'instruction_len':_0xaf107c['data']['instruction'][_0x5d3319(0x10c)],'code_edit_len':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x128)][_0x5d3319(0x10c)],'original_code_len':_0x3e9517?.[_0x5d3319(0x10c)]??0x0,'dry_run':_0xaf107c['data'][_0x5d3319(0x1f2)]});const _0xdcbfd5=Date[_0x5d3319(0x1ed)](),_0x219493=await executeEditFile({'target_filepath':_0x4132ad,'code_edit':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x128)],'instruction':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)]},{'morphApiKey':_0x3c4d0e,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x240acf,'autoWrite':!_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1f2)],'generateUdiff':![],'debug':![]}),_0x193162=Date['now']()-_0xdcbfd5;_0x1189f0=_0x219493[_0x5d3319(0x19b)];if(!_0x219493[_0x5d3319(0xf9)])throw new Error(_0x219493[_0x5d3319(0xe9)]||_0x5d3319(0x1aa));const _0x5df242=_0x219493[_0x5d3319(0x150)],_0x51cc80=_0x5d3319(0xfc)+_0x5df242[_0x5d3319(0x129)]+_0x5d3319(0x18e)+_0x5df242[_0x5d3319(0xf4)]+_0x5d3319(0x146)+_0x5df242[_0x5d3319(0xe0)];logger[_0x5d3319(0x1b8)](_0x5d3319(0x12c),_0x5d3319(0x167),{'tool':_0x5d3319(0x144),'success':!![],'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad,'edit_latency_ms':_0x193162,'changes':{'added':_0x5df242['linesAdded'],'removed':_0x5df242[_0x5d3319(0xf4)],'modified':_0x5df242[_0x5d3319(0xe0)]},'completion_id':_0x1189f0});if(_0xaf107c['data']['dryRun'])return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x161)+(_0x4a5b59?'':_0x5d3319(0x1fb))+':\x20'+_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)]+_0x5d3319(0x1c8)+_0x51cc80+_0x5d3319(0x13f)+_0xaf107c[_0x5d3319(0x195)]['path']+'.'}]};return{'content':[{'type':_0x5d3319(0x1e3),'text':'Morph\x20Edit\x20'+(_0x4a5b59?_0x5d3319(0x138):_0x5d3319(0x1a7))+':\x20'+_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)]+_0x5d3319(0x1c8)+_0x51cc80+_0x5d3319(0x13f)+_0xaf107c['data'][_0x5d3319(0x1b7)]+'.'}]};}catch(_0x909e70){const _0x43bfe0=handleMorphAPIError(_0x909e70);if(_0x43bfe0)return logger['error'](_0x5d3319(0x12c),_0x5d3319(0x155),{'tool':'edit_file','error':_0x5d3319(0x1d8),'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad}),_0x43bfe0;const _0x5b87a2=_0x909e70 instanceof Error?_0x909e70['message']:String(_0x909e70);return logger[_0x5d3319(0xe9)](_0x5d3319(0x12c),'tool_call_error',{'tool':_0x5d3319(0x144),'error':_0x5b87a2,'path':_0xaf107c['data']['path'],'validated_path':_0x427038,'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad,'stack':_0x909e70 instanceof Error?_0x909e70[_0x5d3319(0x187)]:undefined}),reportMorphError({'error_message':_0x5b87a2,'error_type':_0x909e70 instanceof Error?_0x909e70[_0x5d3319(0x168)][_0x5d3319(0x108)]:'UnknownError','context':{'tool':_0x5d3319(0x144),'completion_id':_0x1189f0,'file_path':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1b7)],'validated_path':_0x427038,'instruction':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1d3)],'model':MORPH_LARGE_APPLY?_0x5d3319(0x1cf):_0x5d3319(0x1a8),'dry_run':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1f2)],'file_exists':_0x4a5b59,'file_read_error':_0x2f2a0d,'file_readable':_0x3e9517!==null,'request_content':{'path':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1b7)],'code_edit':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x128)],'instruction':_0xaf107c[_0x5d3319(0x195)]['instruction'],'original_code':_0x3e9517!==null?_0x3e9517[_0x5d3319(0x10c)]>0xc350?_0x3e9517['substring'](0x0,0xc350)+_0x5d3319(0x1c3)+_0x3e9517[_0x5d3319(0x10c)]+_0x5d3319(0x1ee):_0x3e9517:_0x5d3319(0x1e0)+(_0x2f2a0d||_0x5d3319(0x1f0))+']','original_code_length':_0x3e9517?.[_0x5d3319(0x10c)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':'morph-v3-fast','dry_run':_0xaf107c[_0x5d3319(0x195)][_0x5d3319(0x1f2)]}},'stack_trace':_0x909e70 instanceof Error?_0x909e70[_0x5d3319(0x187)]:undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x5b87a2}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x11a1f3=WarpGrepArgsSchema[_0x5d3319(0x1f5)](_0x44f402);if(!_0x11a1f3[_0x5d3319(0xf9)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x11a1f3[_0x5d3319(0xe9)]}],'isError':!![]};const _0x2bd82e=_0x509d74=>{const _0x2faa20=_0x5d3319,_0x79c10=[];for(const _0x391ac0 of _0x509d74||[]){if(_0x391ac0[_0x2faa20(0x131)]===_0x2faa20(0x112)&&Array[_0x2faa20(0x196)](_0x391ac0[_0x2faa20(0x1e1)]))for(const _0x57caca of _0x391ac0['tool_calls']){try{const _0x39e13d=_0x57caca[_0x2faa20(0x19e)]?.[_0x2faa20(0x108)],_0x5b826e=JSON[_0x2faa20(0x13a)](_0x57caca['function']?.[_0x2faa20(0xde)]||'{}');if(_0x39e13d===_0x2faa20(0xe3))_0x79c10[_0x2faa20(0x1d0)]('grep\x20\x27'+_0x5b826e['pattern']+'\x27\x20'+(_0x5b826e[_0x2faa20(0x1b7)]||'.'));else{if(_0x39e13d===_0x2faa20(0x190))_0x79c10[_0x2faa20(0x1d0)](_0x2faa20(0xf1)+_0x5b826e[_0x2faa20(0x1b7)]);else{if(_0x39e13d===_0x2faa20(0x1a5))_0x79c10[_0x2faa20(0x1d0)]('list_directory\x20'+(_0x5b826e[_0x2faa20(0x12f)]||'.'));else{if(_0x39e13d===_0x2faa20(0x186))_0x79c10[_0x2faa20(0x1d0)]('glob\x20\x27'+_0x5b826e[_0x2faa20(0xf2)]+'\x27\x20'+(_0x5b826e[_0x2faa20(0x1b7)]||'.'));else _0x39e13d==='finish'&&_0x79c10[_0x2faa20(0x1d0)](_0x2faa20(0x179));}}}}catch{}}}return _0x79c10;},_0x433f07=_0x3835f0=>{const _0x11c92d=_0x5d3319,_0x268008=[];if(!_0x3835f0||!Array[_0x11c92d(0x196)](_0x3835f0))return _0x268008;const _0x2efc4c=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x11c92d(0x122),'tool':_0x11c92d(0x190)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x11c92d(0x117),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x11c92d(0x174),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x11c92d(0x164),'tool':_0x11c92d(0x190)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x11c92d(0x1e9),'tool':_0x11c92d(0x204)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x11c92d(0x204)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x11c92d(0x164),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x11c92d(0x183),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x11c92d(0x164),'tool':_0x11c92d(0x190)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x11c92d(0x190)},{'pattern':/Error reading file:/,'error_type':_0x11c92d(0x174),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x11c92d(0x1e4),'tool':_0x11c92d(0x20b)}];let _0x384e62=0x0;for(const _0x1956f1 of _0x3835f0){_0x1956f1['role']==='assistant'&&Array['isArray'](_0x1956f1[_0x11c92d(0x1e1)])&&_0x384e62++;const _0x16ac97=_0x1956f1['content'];if((_0x1956f1[_0x11c92d(0x131)]===_0x11c92d(0x12e)||_0x1956f1[_0x11c92d(0x131)]===_0x11c92d(0x1b2))&&_0x16ac97&&typeof _0x16ac97===_0x11c92d(0xfb))for(const {pattern:_0x177727,error_type:_0x4b0191,tool:_0x846ad2}of _0x2efc4c){const _0x2baeff=_0x16ac97[_0x11c92d(0x202)](new RegExp(_0x177727['source'],'g'));if(_0x2baeff)for(const _0xb7d7d3 of _0x2baeff){const _0x3e9411=_0x16ac97['indexOf'](_0xb7d7d3),_0x1706f3=_0x16ac97['substring'](_0x3e9411,Math[_0x11c92d(0x198)](_0x3e9411+0xc8,_0x16ac97['length']));_0x268008['push']({'tool':_0x846ad2,'error_type':_0x4b0191,'error_message':_0x1706f3['split']('\x0a')[0x0],'turn':_0x384e62});}}}return _0x268008;};try{const _0x5c8da4=a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3['data'][_0x5d3319(0x125)]),_0x63485e=_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x1b9)],_0x4b18a3=_0x63485e===_0x5d3319(0x205)?{'allowNames':[_0x5d3319(0x205)]}:undefined,_0x2a867e=new LocalRipgrepProvider(_0x5c8da4,undefined,_0x4b18a3);logger['debug']('MCP',_0x5d3319(0x11a),{'type':_0x5d3319(0x18c),'repo_root':_0x5c8da4,'search_type':_0x63485e||'default'}),logger[_0x5d3319(0x1b8)](_0x5d3319(0x12c),'warp_grep_start',{'query':_0x11a1f3[_0x5d3319(0x195)]['search_string'],'repo_root':_0x5c8da4,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x3a37ff=Date[_0x5d3319(0x1ed)](),_0x2bc555=await runWarpGrep({'searchTerm':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'repoRoot':_0x5c8da4,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x2a867e,'search_type':_0x63485e}),_0x3b444e=Date['now']()-_0x3a37ff,_0x532607=_0x2bc555['finish']?.[_0x5d3319(0x1cb)]?.['files']?.[_0x5d3319(0x10c)]??0x0;logger[_0x5d3319(0x1b8)](_0x5d3319(0x12c),_0x5d3319(0x1ab),{'termination':_0x2bc555[_0x5d3319(0xe8)],'turns':_0x2bc555[_0x5d3319(0x142)]?.[_0x5d3319(0x1e7)]??0x0,'files_found':_0x532607,'latency_ms':_0x3b444e});const _0x2b2e4e=_0x433f07(_0x2bc555[_0x5d3319(0x104)]);_0x2b2e4e[_0x5d3319(0x10c)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2b2e4e[_0x5d3319(0x10c)]+'\x20error(s)','error_type':_0x5d3319(0x1c4),'level':_0x5d3319(0x17c),'tool':_0x5d3319(0x1ea),'context':{'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3[_0x5d3319(0x195)]['search_string'],'model':_0x5d3319(0x165),'termination_reason':_0x2bc555['terminationReason'],'sub_tool_errors':_0x2b2e4e,'timings':_0x2bc555[_0x5d3319(0x142)],'tool_calls':_0x2bd82e(_0x2bc555['messages']),'messages':_0x2bc555['messages']?.['map'](_0x55b824=>({'role':_0x55b824['role'],'content':_0x55b824[_0x5d3319(0x17e)],..._0x55b824[_0x5d3319(0x1e1)]?{'tool_calls':_0x55b824[_0x5d3319(0x1e1)]['length']}:{},..._0x55b824[_0x5d3319(0x1b5)]?{'tool_call_id':_0x55b824[_0x5d3319(0x1b5)]}:{}}))},'source':_0x5d3319(0x11f)})['catch'](()=>{});let _0x6d1d9e='';if(_0x2bc555[_0x5d3319(0xe8)]===_0x5d3319(0x12a)&&_0x2bc555[_0x5d3319(0x179)]?.[_0x5d3319(0x1cb)]?.[_0x5d3319(0x1e8)]){const _0x5b636c=_0x2bc555[_0x5d3319(0x179)][_0x5d3319(0x1cb)][_0x5d3319(0x1e8)];if(_0x5b636c['length']===0x0)return _0x6d1d9e=_0x2bc555[_0x5d3319(0x179)][_0x5d3319(0x134)]||_0x5d3319(0x1d1),{'content':[{'type':_0x5d3319(0x1e3),'text':_0x6d1d9e}]};const _0x3cf235=[],_0x4b8a1f=[_0x5d3319(0x149)];for(const _0x14621f of _0x2bc555['messages']){if(_0x14621f[_0x5d3319(0x131)]===_0x5d3319(0x112)&&Array['isArray'](_0x14621f[_0x5d3319(0x1e1)]))for(const _0xd60e17 of _0x14621f['tool_calls']){try{const _0x150eb7=_0xd60e17[_0x5d3319(0x19e)]?.[_0x5d3319(0x108)],_0xa41761=JSON[_0x5d3319(0x13a)](_0xd60e17['function']?.[_0x5d3319(0xde)]||'{}');if(_0x150eb7===_0x5d3319(0xe3))_0x4b8a1f[_0x5d3319(0x1d0)](_0x5d3319(0x19a)+_0xa41761[_0x5d3319(0xf2)]+'\x27\x20in\x20`'+(_0xa41761['path']||'.')+'`');else{if(_0x150eb7===_0x5d3319(0x190))_0x4b8a1f[_0x5d3319(0x1d0)](_0x5d3319(0x181)+_0xa41761[_0x5d3319(0x1b7)]+'`');else{if(_0x150eb7===_0x5d3319(0x1a5))_0x4b8a1f['push']('-\x20Listed\x20directory\x20`'+(_0xa41761[_0x5d3319(0x12f)]||'.')+'`');else _0x150eb7===_0x5d3319(0x186)&&_0x4b8a1f[_0x5d3319(0x1d0)](_0x5d3319(0x13b)+_0xa41761[_0x5d3319(0xf2)]+_0x5d3319(0xf0)+(_0xa41761[_0x5d3319(0x1b7)]||'.')+'`');}}}catch{}}}_0x3cf235[_0x5d3319(0x1d0)](_0x4b8a1f[_0x5d3319(0x1c1)]('\x0a'));const _0x152368=['',_0x5d3319(0x1c0)];for(const _0x561d70 of _0x5b636c){if(_0x561d70[_0x5d3319(0x173)]==='*')_0x152368[_0x5d3319(0x1d0)]('-\x20'+_0x561d70[_0x5d3319(0x1b7)]+':*');else{if(Array['isArray'](_0x561d70['lines'])){const _0x5c3fb8=_0x561d70[_0x5d3319(0x173)][_0x5d3319(0x14a)](([_0x3eb15e,_0x3bd6f8])=>{if(_0x3eb15e===_0x3bd6f8)return''+_0x3eb15e;return _0x3eb15e+'-'+_0x3bd6f8;});_0x152368[_0x5d3319(0x1d0)]('-\x20'+_0x561d70[_0x5d3319(0x1b7)]+':'+_0x5c3fb8[_0x5d3319(0x1c1)](','));}else _0x152368[_0x5d3319(0x1d0)]('-\x20'+_0x561d70[_0x5d3319(0x1b7)]+':*');}}_0x152368[_0x5d3319(0x1d0)](''),_0x3cf235[_0x5d3319(0x1d0)](_0x152368[_0x5d3319(0x1c1)]('\x0a')),_0x3cf235['push'](_0x5d3319(0x10b));const _0x2d1f68=[],_0x4b6233=[];for(const _0x2ee2c1 of _0x5b636c){let _0x24928e=a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],_0x2ee2c1[_0x5d3319(0x1b7)]),_0x1aeee3=null,_0x5483ad=null;try{_0x1aeee3=await a0_0x38b0cc[_0x5d3319(0x177)](_0x24928e,{'encoding':_0x5d3319(0x13e)});}catch(_0x2a64ba){const _0x490a40=fixPathRepetition(_0x24928e);if(_0x490a40)try{_0x1aeee3=await a0_0x38b0cc[_0x5d3319(0x177)](_0x490a40,{'encoding':'utf-8'}),_0x24928e=_0x490a40;}catch{_0x5483ad=_0x2a64ba instanceof Error?_0x2a64ba:new Error(String(_0x2a64ba));}else _0x5483ad=_0x2a64ba instanceof Error?_0x2a64ba:new Error(String(_0x2a64ba));}if(_0x1aeee3!==null){const _0x3a8bc6=_0x1aeee3[_0x5d3319(0x1c5)](/\r?\n/),_0x2149dd=[];if(_0x2ee2c1['lines']==='*'||!Array['isArray'](_0x2ee2c1[_0x5d3319(0x173)]))for(let _0x580a7f=0x1;_0x580a7f<=_0x3a8bc6[_0x5d3319(0x10c)];_0x580a7f++){const _0x7e776e=_0x3a8bc6[_0x580a7f-0x1];_0x2149dd[_0x5d3319(0x1d0)](_0x580a7f+'|\x20'+_0x7e776e);}else for(const [_0x3d72c1,_0x11abdd]of _0x2ee2c1[_0x5d3319(0x173)]){_0x2149dd[_0x5d3319(0x10c)]>0x0&&_0x2149dd[_0x5d3319(0x1d0)]('');for(let _0x11f9d0=_0x3d72c1;_0x11f9d0<=_0x11abdd&&_0x11f9d0<=_0x3a8bc6[_0x5d3319(0x10c)];_0x11f9d0++){const _0x2d1c9b=_0x3a8bc6[_0x11f9d0-0x1];_0x2149dd[_0x5d3319(0x1d0)](_0x11f9d0+'|\x20'+_0x2d1c9b);}}_0x4b6233[_0x5d3319(0x1d0)]({'path':_0x2ee2c1[_0x5d3319(0x1b7)],'content':_0x2149dd[_0x5d3319(0x1c1)]('\x0a')});}else _0x2d1f68[_0x5d3319(0x1d0)](_0x5d3319(0x16f)+_0x2ee2c1[_0x5d3319(0x1b7)]+_0x5d3319(0xf7)+(_0x5483ad?.[_0x5d3319(0x15d)]||_0x5d3319(0x162))+_0x5d3319(0xeb));}try{const _0x206530=await compactFileContexts(_0x4b6233,_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],MORPH_API_KEY,MORPH_API_URL);for(const _0x24519c of _0x206530){_0x2d1f68['push'](_0x5d3319(0x16f)+_0x24519c[_0x5d3319(0x1b7)]+'\x22>\x0a'+_0x24519c['content']+'\x0a</file>');}}catch(_0x4e2ac2){logger[_0x5d3319(0x17c)](_0x5d3319(0x12c),_0x5d3319(0x191),{'error':_0x4e2ac2 instanceof Error?_0x4e2ac2[_0x5d3319(0x15d)]:String(_0x4e2ac2),'files_count':_0x4b6233[_0x5d3319(0x10c)]});for(const _0x1c1608 of _0x4b6233){_0x2d1f68[_0x5d3319(0x1d0)](_0x5d3319(0x16f)+_0x1c1608[_0x5d3319(0x1b7)]+_0x5d3319(0x145)+_0x1c1608[_0x5d3319(0x17e)]+_0x5d3319(0xeb));}}_0x3cf235[_0x5d3319(0x1d0)](_0x2d1f68['join']('\x0a\x0a')),_0x6d1d9e=_0x3cf235[_0x5d3319(0x1c1)]('\x0a');const _0x53ee64=_0x2bc555[_0x5d3319(0x136)]?.[_0x5d3319(0x1f4)](_0x49d236=>_0x49d236['message']?.['startsWith'](_0x5d3319(0x115)))||[];if(_0x53ee64[_0x5d3319(0x10c)]>0x0){const _0x4d9f53=_0x53ee64['map'](_0x4b1416=>_0x4b1416[_0x5d3319(0x15d)])[_0x5d3319(0x1c1)](';\x20');reportMorphError({'error_message':_0x4d9f53,'error_type':_0x5d3319(0x16d),'context':{'tool':_0x5d3319(0x1ea),'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3[_0x5d3319(0x195)]['search_string'],'model':_0x5d3319(0x165),'termination_reason':_0x5d3319(0x1d5),'error_count':_0x53ee64[_0x5d3319(0x10c)],'is_timeout':![],'timings':_0x2bc555[_0x5d3319(0x142)],'files_attempted':_0x5b636c['map'](_0x23e307=>({'path':_0x23e307[_0x5d3319(0x1b7)],'lines':_0x23e307[_0x5d3319(0x173)]})),'tool_calls':_0x2bd82e(_0x2bc555[_0x5d3319(0x104)]),'messages':_0x2bc555[_0x5d3319(0x104)]?.[_0x5d3319(0x14a)](_0x203c4a=>({'role':_0x203c4a[_0x5d3319(0x131)],'content':_0x203c4a['content'],..._0x203c4a[_0x5d3319(0x1e1)]?{'tool_calls':_0x203c4a[_0x5d3319(0x1e1)]['length']}:{},..._0x203c4a['tool_call_id']?{'tool_call_id':_0x203c4a[_0x5d3319(0x1b5)]}:{}})),'request_content':{'query':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'repoRoot':a0_0x37f788['resolve'](_0x11a1f3['data'][_0x5d3319(0x125)]),'model':_0x5d3319(0x165)}},'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{});}}else{if(_0x2bc555[_0x5d3319(0xe8)]==='terminated'&&_0x2bc555[_0x5d3319(0x136)][_0x5d3319(0x10c)]>0x0){const _0x3e0176=_0x2bc555[_0x5d3319(0x136)]['map'](_0x448807=>_0x448807[_0x5d3319(0x15d)])['join'](';\x20');_0x6d1d9e=_0x5d3319(0x1ec)+_0x3e0176;const _0x212a09=_0x3e0176[_0x5d3319(0xdf)]()[_0x5d3319(0x194)]('timeout')||_0x3e0176[_0x5d3319(0xdf)]()[_0x5d3319(0x194)](_0x5d3319(0x1a6))||_0x3e0176[_0x5d3319(0xdf)]()[_0x5d3319(0x194)](_0x5d3319(0x20c)),_0x48293b=_0x2bc555[_0x5d3319(0x179)]?.[_0x5d3319(0x1cb)]?.[_0x5d3319(0x1e8)],_0x1be8cd=_0x2bc555[_0x5d3319(0x136)][0x0];reportMorphError({'error_message':_0x3e0176,'error_type':_0x212a09?_0x5d3319(0x1cc):_0x1be8cd?.[_0x5d3319(0x168)]?.[_0x5d3319(0x108)]||_0x5d3319(0x154),'context':{'tool':_0x5d3319(0x1ea),'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'model':_0x5d3319(0x165),'termination_reason':_0x2bc555[_0x5d3319(0xe8)],'error_count':_0x2bc555[_0x5d3319(0x136)][_0x5d3319(0x10c)],'is_timeout':_0x212a09,'timings':_0x2bc555[_0x5d3319(0x142)],'files_attempted':_0x48293b?.[_0x5d3319(0x14a)](_0x462c38=>({'path':_0x462c38[_0x5d3319(0x1b7)],'lines':_0x462c38[_0x5d3319(0x173)]})),'tool_calls':_0x2bd82e(_0x2bc555[_0x5d3319(0x104)]),'messages':_0x2bc555[_0x5d3319(0x104)]?.['map'](_0x4ca49e=>({'role':_0x4ca49e[_0x5d3319(0x131)],'content':_0x4ca49e[_0x5d3319(0x17e)],..._0x4ca49e[_0x5d3319(0x1e1)]?{'tool_calls':_0x4ca49e[_0x5d3319(0x1e1)][_0x5d3319(0x10c)]}:{},..._0x4ca49e['tool_call_id']?{'tool_call_id':_0x4ca49e['tool_call_id']}:{}})),'request_content':{'query':_0x11a1f3['data'][_0x5d3319(0x11d)],'repo_path':_0x11a1f3[_0x5d3319(0x195)]['repo_path'],'repoRoot':a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)]),'model':_0x5d3319(0x165)}},'stack_trace':_0x1be8cd?.[_0x5d3319(0x187)]||undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{});}else _0x6d1d9e=_0x5d3319(0x207);}return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x6d1d9e}]};}catch(_0x1de53b){const _0x3c71dd=handleMorphAPIError(_0x1de53b);if(_0x3c71dd)return logger['error'](_0x5d3319(0x12c),_0x5d3319(0x155),{'tool':_0x5d3319(0x1ea),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad}),_0x3c71dd;const _0x44cd7a=_0x1de53b instanceof Error?_0x1de53b[_0x5d3319(0x15d)]:String(_0x1de53b);logger['error'](_0x5d3319(0x12c),'tool_call_error',{'tool':_0x5d3319(0x1ea),'error':_0x44cd7a,'repo_path':_0x11a1f3['data']['repo_path'],'query':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x11d)],'latency_ms':Date[_0x5d3319(0x1ed)]()-_0x5244ad});const _0x1b10d5=_0x44cd7a['toLowerCase']()['includes'](_0x5d3319(0x197))||_0x44cd7a[_0x5d3319(0xdf)]()[_0x5d3319(0x194)](_0x5d3319(0x1a6))||_0x44cd7a[_0x5d3319(0xdf)]()[_0x5d3319(0x194)]('etimedout')||_0x1de53b instanceof Error&&_0x1de53b[_0x5d3319(0x108)]===_0x5d3319(0x1cc);return reportMorphError({'error_message':_0x44cd7a,'error_type':_0x1b10d5?_0x5d3319(0x1cc):_0x1de53b instanceof Error?_0x1de53b[_0x5d3319(0x168)][_0x5d3319(0x108)]:_0x5d3319(0x16e),'context':{'tool':_0x5d3319(0x1ea),'repo_path':_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)],'query':_0x11a1f3['data'][_0x5d3319(0x11d)],'model':_0x5d3319(0x165),'is_timeout':_0x1b10d5,'exception_phase':_0x5d3319(0x14f),'request_content':{'query':_0x11a1f3['data']['search_string'],'repo_path':_0x11a1f3[_0x5d3319(0x195)]['repo_path'],'repoRoot':a0_0x37f788[_0x5d3319(0x1d7)](_0x11a1f3[_0x5d3319(0x195)][_0x5d3319(0x125)]),'model':_0x5d3319(0x165)}},'stack_trace':_0x1de53b instanceof Error?_0x1de53b[_0x5d3319(0x187)]:undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{}),{'content':[{'type':_0x5d3319(0x1e3),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x44cd7a}],'isError':![]};}}case TOOL_NAMES[_0x5d3319(0xe1)]:{const _0x33c141=WarpGrepGitHubArgsSchema[_0x5d3319(0x1f5)](_0x44f402);if(!_0x33c141[_0x5d3319(0xf9)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x33c141['error']}],'isError':!![]};const _0x1593d4=_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x10e)]||_0x33c141['data'][_0x5d3319(0x118)];if(!_0x1593d4)return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x110)}],'isError':!![]};const _0x5d08ef=MORPH_API_KEY;if(!_0x5d08ef)throw new Error(_0x5d3319(0x103));const _0x54f954=Date[_0x5d3319(0x1ed)]();logger['debug'](_0x5d3319(0x12c),_0x5d3319(0x178),{'identifier':_0x1593d4,'query':_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x11d)],'branch':_0x33c141['data'][_0x5d3319(0x1db)]});try{const _0x515fdb=new WarpGrepClient({'morphApiKey':_0x5d08ef,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x165fc5=await _0x515fdb[_0x5d3319(0xe5)]({'searchTerm':_0x33c141[_0x5d3319(0x195)]['search_string'],'github':_0x1593d4,'branch':_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x1db)]}),_0x2bb5c1=Date[_0x5d3319(0x1ed)]()-_0x54f954;logMcpStderr(_0x5d3319(0x170)+_0x2bb5c1+_0x5d3319(0x1e5)+_0x165fc5[_0x5d3319(0xf9)]);const _0x2bd24d=formatResult(_0x165fc5);return{'content':[{'type':_0x5d3319(0x1e3),'text':_0x2bd24d}]};}catch(_0x3e4fcc){const _0x96e822=handleMorphAPIError(_0x3e4fcc);if(_0x96e822)return _0x96e822;const _0x4cd364=Date[_0x5d3319(0x1ed)]()-_0x54f954,_0x4fa035=_0x3e4fcc instanceof Error?_0x3e4fcc[_0x5d3319(0x15d)]:String(_0x3e4fcc);return logMcpStderr(_0x5d3319(0x1c7)+_0x4cd364+_0x5d3319(0x1ff),_0x4fa035),reportMorphError({'error_message':_0x4fa035,'error_type':_0x3e4fcc instanceof Error?_0x3e4fcc[_0x5d3319(0x168)][_0x5d3319(0x108)]:_0x5d3319(0x16e),'context':{'tool':_0x5d3319(0x147),'github_url':_0x1593d4,'search_string':_0x33c141[_0x5d3319(0x195)][_0x5d3319(0x11d)],'branch':_0x33c141[_0x5d3319(0x195)]['branch']},'stack_trace':_0x3e4fcc instanceof Error?_0x3e4fcc['stack']:undefined,'source':'mcp-filesystem','tool':_0x5d3319(0x147),'latency_ms':_0x4cd364})['catch'](()=>{}),{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x14d)+_0x4fa035}],'isError':![]};}}default:throw new Error(_0x5d3319(0x1b3)+_0x49f5bf);}}catch(_0x58c33c){const _0x1c7da0=_0x58c33c instanceof Error?_0x58c33c[_0x5d3319(0x15d)]:String(_0x58c33c);return reportMorphError({'error_message':_0x1c7da0,'error_type':_0x58c33c instanceof Error?_0x58c33c[_0x5d3319(0x168)][_0x5d3319(0x108)]:_0x5d3319(0x16e),'context':{'tool':_0x49f5bf,'arguments':_0x44f402?JSON[_0x5d3319(0x1ac)](_0x44f402)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x5d3319(0x17a)},'stack_trace':_0x58c33c instanceof Error?_0x58c33c[_0x5d3319(0x187)]:undefined,'source':_0x5d3319(0x11f)})[_0x5d3319(0x1fa)](()=>{}),{'content':[{'type':_0x5d3319(0x1e3),'text':_0x5d3319(0x1ec)+_0x1c7da0}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x49fc92){const _0x4cbba7=a0_0x16ed94,_0x517068=await getValidRootDirectories(_0x49fc92);if(_0x517068['length']>0x0)allowedDirectories=[..._0x517068],logMcpStderr(_0x4cbba7(0x151)+_0x517068[_0x4cbba7(0x10c)]+_0x4cbba7(0x1f6));else{logMcpStderr(_0x4cbba7(0x169));if(ENABLE_WORKSPACE_MODE)try{const _0x311fe6=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x311fe6&&(allowedDirectories=[_0x311fe6],logMcpStderr(_0x4cbba7(0x14c)+_0x311fe6));}catch(_0x5efd1e){logMcpStderr(_0x4cbba7(0x1be)+_0x5efd1e);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x49d578=a0_0x16ed94;try{const _0x40992e=await server[_0x49d578(0x141)]();_0x40992e&&_0x49d578(0xf8)in _0x40992e&&await updateAllowedDirectoriesFromRoots(_0x40992e[_0x49d578(0xf8)]);}catch(_0x3c91ee){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x3c91ee instanceof Error?_0x3c91ee[_0x49d578(0x15d)]:String(_0x3c91ee));}}),server['oninitialized']=async()=>{const _0x480997=a0_0x16ed94,_0x261325=server[_0x480997(0x132)]();if(_0x261325?.['roots'])try{const _0x2ef554=await server['listRoots']();_0x2ef554&&_0x480997(0xf8)in _0x2ef554?await updateAllowedDirectoriesFromRoots(_0x2ef554['roots']):logMcpStderr(_0x480997(0x200));}catch(_0x3c7d0a){logMcpStderr(_0x480997(0x109),_0x3c7d0a instanceof Error?_0x3c7d0a[_0x480997(0x15d)]:String(_0x3c7d0a));}else{if(allowedDirectories[_0x480997(0x10c)]>0x0)logMcpStderr(_0x480997(0x1c9),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x480997(0x17b));else throw new Error(_0x480997(0x19d));}}};async function runServer(){const _0x3e71e7=a0_0x16ed94,_0x11442f=new StdioServerTransport();await server[_0x3e71e7(0x1f3)](_0x11442f),logMcpStderr(_0x3e71e7(0x1ce)),allowedDirectories[_0x3e71e7(0x10c)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x16ed94(0x1fa)](_0x3b6706=>{const _0xddeef0=a0_0x16ed94;logMcpStderr(_0xddeef0(0x17d),_0x3b6706),process[_0xddeef0(0x1a2)](0x1);});
const a0_0x41e81a=a0_0x5961;(function(_0x40a204,_0x1d7060){const _0x4dfa97=a0_0x5961,_0x32d422=_0x40a204();while(!![]){try{const _0x10339d=-parseInt(_0x4dfa97(0x201))/0x1*(parseInt(_0x4dfa97(0x274))/0x2)+-parseInt(_0x4dfa97(0x239))/0x3+-parseInt(_0x4dfa97(0x1d4))/0x4+parseInt(_0x4dfa97(0x260))/0x5*(parseInt(_0x4dfa97(0x28e))/0x6)+parseInt(_0x4dfa97(0x243))/0x7+parseInt(_0x4dfa97(0x22e))/0x8+parseInt(_0x4dfa97(0x207))/0x9;if(_0x10339d===_0x1d7060)break;else _0x32d422['push'](_0x32d422['shift']());}catch(_0xb9b765){_0x32d422['push'](_0x32d422['shift']());}}}(a0_0x2138,0x8f6a9));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';function a0_0x5961(_0x1c0afc,_0x2b7db5){_0x1c0afc=_0x1c0afc-0x1bd;const _0x213888=a0_0x2138();let _0x5961d7=_0x213888[_0x1c0afc];return _0x5961d7;}import a0_0x5f2eb7 from'fs/promises';import a0_0x5863e0 from'path';import a0_0x486d97 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_0x58f79b from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x5968d7){const _0x4c749a=a0_0x5961,_0x26930c=_0x5968d7['split'](a0_0x5863e0['sep'])['filter'](Boolean);if(_0x26930c[_0x4c749a(0x2e3)]<0x2)return null;for(let _0x3b02cf=Math['floor'](_0x26930c[_0x4c749a(0x2e3)]/0x2);_0x3b02cf>=0x1;_0x3b02cf--){for(let _0x1044ed=0x0;_0x1044ed<=_0x26930c[_0x4c749a(0x2e3)]-0x2*_0x3b02cf;_0x1044ed++){const _0x15078e=_0x26930c['slice'](_0x1044ed,_0x1044ed+_0x3b02cf),_0x1bd5d5=_0x26930c[_0x4c749a(0x2a7)](_0x1044ed+_0x3b02cf,_0x1044ed+0x2*_0x3b02cf);if(_0x15078e[_0x4c749a(0x2cb)]((_0x37f0d7,_0x3b7aa7)=>_0x37f0d7===_0x1bd5d5[_0x3b7aa7])){const _0x56c934=[..._0x26930c['slice'](0x0,_0x1044ed),..._0x26930c[_0x4c749a(0x2a7)](_0x1044ed+_0x3b02cf)];return a0_0x5863e0[_0x4c749a(0x234)]+_0x56c934[_0x4c749a(0x21a)](a0_0x5863e0[_0x4c749a(0x234)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1487d4=a0_0x5961;try{const _0xd8baf2=require(_0x1487d4(0x27d));return _0xd8baf2[_0x1487d4(0x29c)]??'unknown';}catch(_0x368868){return logMcpStderr(_0x1487d4(0x20a),_0x368868),'unknown';}}function printHelp(){const _0x432445=a0_0x5961;console[_0x432445(0x264)](_0x432445(0x23e)+getPackageVersion()),console[_0x432445(0x264)](_0x432445(0x2a5)),console['log'](_0x432445(0x2c4)),console[_0x432445(0x264)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console['log'](_0x432445(0x2b2)),console[_0x432445(0x264)](_0x432445(0x2e7)),console[_0x432445(0x264)](_0x432445(0x269)),console['log'](_0x432445(0x248)),console['log'](_0x432445(0x1ce));}const cliArgs=process[a0_0x41e81a(0x2d5)][a0_0x41e81a(0x2a7)](0x2),VERSION_FLAGS=new Set([a0_0x41e81a(0x2b9),'-v','-V']),HELP_FLAGS=new Set([a0_0x41e81a(0x26d),'-h']);cliArgs[a0_0x41e81a(0x262)](_0x5d517b=>VERSION_FLAGS[a0_0x41e81a(0x1db)](_0x5d517b))&&(console['log'](a0_0x41e81a(0x23e)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x41e81a(0x262)](_0x351f6b=>HELP_FLAGS[a0_0x41e81a(0x1db)](_0x351f6b))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x263ede){const _0x42be35=a0_0x41e81a;for(let _0x3670b6=0x0;_0x3670b6<cliArgs[_0x42be35(0x2e3)];_0x3670b6++){const _0x53154f=cliArgs[_0x3670b6];if(_0x53154f['startsWith']('--'+_0x263ede+'='))return _0x53154f[_0x42be35(0x2a7)](('--'+_0x263ede+'=')['length']);if(_0x53154f==='--'+_0x263ede&&_0x3670b6+0x1<cliArgs['length'])return cliArgs[_0x3670b6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x41e81a(0x1db)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x41e81a(0x211)](a0_0x41e81a(0x2be)))continue;if(arg===a0_0x41e81a(0x263)){i++;continue;}args[a0_0x41e81a(0x291)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x41e81a(0x22c)]||process[a0_0x41e81a(0x233)][a0_0x41e81a(0x25a)]||process[a0_0x41e81a(0x2d8)](),ENABLE_WORKSPACE_MODE=process[a0_0x41e81a(0x233)]['ENABLE_WORKSPACE_MODE']!==a0_0x41e81a(0x276),MORPH_API_KEY=getCliArg(a0_0x41e81a(0x2ea))??process[a0_0x41e81a(0x233)][a0_0x41e81a(0x2bb)],MORPH_API_URL=process[a0_0x41e81a(0x233)][a0_0x41e81a(0x25b)],MORPH_LARGE_APPLY=process['env'][a0_0x41e81a(0x29b)]!==a0_0x41e81a(0x276),MORPH_WARP_GREP_TIMEOUT=process[a0_0x41e81a(0x233)][a0_0x41e81a(0x1c1)]?parseInt(process[a0_0x41e81a(0x233)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x41e81a(0x233)][a0_0x41e81a(0x253)]?new Set(process[a0_0x41e81a(0x233)][a0_0x41e81a(0x253)][a0_0x41e81a(0x21e)](',')[a0_0x41e81a(0x1bf)](_0x110bba=>_0x110bba[a0_0x41e81a(0x22b)]())[a0_0x41e81a(0x241)](_0x1aa895=>_0x1aa895[a0_0x41e81a(0x2e3)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x41e81a(0x2ca)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x41e81a(0x2ef)](a0_0x41e81a(0x294)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x41e81a(0x21a)](',\x20'));}console[a0_0x41e81a(0x2ef)](a0_0x41e81a(0x215)+[...DISABLED_TOOLS][a0_0x41e81a(0x21a)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x41e81a(0x220))&&!MORPH_API_KEY[a0_0x41e81a(0x211)]('morph-')&&logMcpStderr(a0_0x41e81a(0x2a4));async function reportMorphError(_0x196a0b){const _0x8ac1e=a0_0x41e81a;try{await a0_0x58f79b['post'](_0x8ac1e(0x26b),{..._0x196a0b,'timestamp':new Date()[_0x8ac1e(0x225)](),'source':_0x196a0b[_0x8ac1e(0x2d4)]||_0x8ac1e(0x1f1),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x196a0b['context']}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x584a2a,_0x2754fb){const _0x1c45e1=a0_0x41e81a;if(_0x584a2a&&typeof _0x584a2a===_0x1c45e1(0x1c7)&&'status'in _0x584a2a)return _0x584a2a[_0x1c45e1(0x1fa)];if(_0x584a2a&&typeof _0x584a2a===_0x1c45e1(0x1c7)&&_0x1c45e1(0x25f)in _0x584a2a)return _0x584a2a[_0x1c45e1(0x25f)]?.['status'];const _0xead68d=_0x2754fb['match'](/\b(401|429)\b/);return _0xead68d?parseInt(_0xead68d[0x1],0xa):null;}function handleMorphAPIError(_0x380e0f){const _0x5fbb04=a0_0x41e81a,_0x52b7c9=_0x380e0f instanceof Error?_0x380e0f['message']:String(_0x380e0f),_0x4a84be=extractStatusCode(_0x380e0f,_0x52b7c9);switch(_0x4a84be){case 0x191:return{'content':[{'type':_0x5fbb04(0x278),'text':_0x5fbb04(0x232)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x5fbb04(0x1e2)}],'isError':!![]};default:return null;}}function a0_0x2138(){const _0x3a0864=['Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','toLowerCase','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','isDirectory','dirname','github_url','Parent\x20directory\x20does\x20not\x20exist:\x20','enum','ReadError','exit','Tool\x20\x22','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','indexOf','mcp-filesystem','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','composer.json','file_read_failed','Unknown\x20error','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','warp_grep_complete','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','api_request_start','status','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.','repo_path','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','terminationReason','\x22>\x0aError\x20reading\x20file:\x20','WarpGrepError','150047mfQlfW','tool_call_received','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','codebase_search','\x22>\x0a','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','2731932pxTePB','Cargo.toml','ToolException','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','number','search_string','morph-mcp','owner_repo','Failed\x20to\x20read\x20file:\x20','startsWith','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','.\x20Path:\x20','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Disabled\x20tools:\x20','\x20disabled\x20via\x20DISABLED_TOOLS','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','setRequestHandler','lines','join','params','Specific\x20commit\x20hash\x20to\x20search','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','split','Repository\x20identifier','sk-','File\x20read\x20error:','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','grep\x20\x27','basename','toISOString','GITHUB_CODEBASE_SEARCH','`\x20in\x20`','function','\x0a</file>','getClientCapabilities','trim','WORKSPACE_ROOT','list_directory\x20','7806792OyVujk','read','tool','edit_file','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.','env','sep','TimeoutError','Example\x20format:\x0a','WarpGrep\x20sub-tool\x20errors:\x20','-\x20Listed\x20directory\x20`','1032042ETMDjG','resolve','code','target_file','tsconfig.json','@morphllm/morphmcp\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','isArray','filter','timings','3726184cTUmQf','target_filepath','pyproject.toml','tool_calls','constructor','\x20\x20morph-mcp','tool_call_id','\x20error(s)','safeParse','search_type','\x20is\x20not\x20a\x20directory','Tool\x20','file','LocalRipgrepProvider','linesAdded','warp_grep_start','DISABLED_TOOLS','compaction_failed','morph-v3-large','arguments','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','PWD','MORPH_API_URL','finish','substring','pattern','response','19235YXBhec','glob','some','--api-key','log','success','API\x20error\x20(auth/rate-limit)','instruction','morph-','\x0aExamples:','catch','https://morphllm.com/api/error-report','Created\x20File','--help','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','requiresApiKey','optional','-\x20Read\x20file\x20`',',\x20modified\x20','FileNotFound','14EGpZSc','\x20-\x20','false','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','text','normalize','Invalid\x20arguments:\x20','debug','linesModified','../package.json','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','now','data','role','PathError','name','file_path','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','filePath','errors','listRoots',',\x20removed\x20','Parameters:\x0a','stack','warn','588bTnSOG','GitHub\x20search\x20failed:\x20','match','push','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','morph-v3-fast','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','github_codebase_search','.\x20Changes:\x20','dryRun','❌\x20Morph\x20Edit\x20Failed:\x20','assistant','MORPH_LARGE_APPLY','version','\x20chars)','terminated','utf-8','BinaryFile','node_modules','provider_created','CODEBASE_SEARCH','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20as\x20allowed\x20directory','slice','array','parse','MCP','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Fatal\x20error\x20running\x20server:','describe','roots','branch','payload','ENOENT','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','[github_codebase_search]\x20Done\x20in\x20','Applied','instructions','user','Error:\x20','command','--version','\x27\x20in\x20`','MORPH_API_KEY','SymlinkError','homedir','--api-key=','stringify','files','package.json','readFile','Max\x20results\x20to\x20return','\x0aOptions:','completed_with_file_errors','FileReadError','access','tool_call_error','setNotificationHandler','size','every','unknown','linesRemoved','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','metadata','go.mod','runWarpGrep_call','string','path_validation_resolved','source','argv','grep','messages','cwd','new_string','tool_call_complete','file_read_complete','added\x20','glob\x20\x27','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.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','etimedout','Here\x20is\x20the\x20content\x20of\x20files:\x0a','edit','length','inputSchema','content','Failed\x20to\x20request\x20roots\x20from\x20client:','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','EDIT_FILE','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','api-key','Error\x20running\x20fast\x20context\x20search:\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','**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','message','error','default','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.','stat','path','map','path_validation_failed','MORPH_WARP_GREP_TIMEOUT','<file\x20path=\x22','UnknownError','unknown\x20error','all','includes','object','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','list_directory','.git','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Workspace\x20mode\x20enabled:\x20Using\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','ms:','RipgrepNotAvailable','read\x20','827756UbrNbU','grep_search','code_edit','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','timeout','connect','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','has','morph-warp-grep-v2.1','oninitialized','ms.\x20Success:\x20','.vscode','[github_codebase_search]\x20Failed\x20in\x20','timed\x20out','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','github_search_start'];a0_0x2138=function(){return _0x3a0864;};return a0_0x2138();}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x41e81a(0x1c8)),logMcpStderr(a0_0x41e81a(0x1e4)),logMcpStderr(a0_0x41e81a(0x20b)),logMcpStderr(a0_0x41e81a(0x2ce)),logMcpStderr(a0_0x41e81a(0x1f6)),logMcpStderr(a0_0x41e81a(0x1cb)));function normalizePath(_0x512267){const _0x148085=a0_0x41e81a;return a0_0x5863e0[_0x148085(0x279)](_0x512267);}function expandHome(_0x3c621b){const _0x2bd137=a0_0x41e81a;if(_0x3c621b['startsWith']('~/')||_0x3c621b==='~')return a0_0x5863e0[_0x2bd137(0x21a)](a0_0x486d97[_0x2bd137(0x2bd)](),_0x3c621b[_0x2bd137(0x2a7)](0x1));return _0x3c621b;}let allowedDirectories=await Promise[a0_0x41e81a(0x1c5)](args[a0_0x41e81a(0x1bf)](async _0x350e94=>{const _0x47bad9=expandHome(_0x350e94),_0x1a6cb3=a0_0x5863e0['resolve'](_0x47bad9);try{const _0x2a50ac=await a0_0x5f2eb7['realpath'](_0x1a6cb3);return normalizePath(_0x2a50ac);}catch(_0x109a92){return normalizePath(_0x1a6cb3);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x41e81a(0x291)](workspaceDir),logMcpStderr(a0_0x41e81a(0x1cc)+workspaceDir+a0_0x41e81a(0x2a6)));}catch(a0_0xc19f20){logMcpStderr(a0_0x41e81a(0x27e)+a0_0xc19f20);}async function detectWorkspaceRoot(_0x7212cf){const _0x1040ec=a0_0x41e81a;let _0x465dc1=a0_0x5863e0[_0x1040ec(0x23a)](_0x7212cf);const _0x27b2f9=[_0x1040ec(0x1ca),_0x1040ec(0x1df),_0x1040ec(0x2c1),_0x1040ec(0x208),_0x1040ec(0x245),_0x1040ec(0x2d0),'.cursor',_0x1040ec(0x23d),_0x1040ec(0x1f3)];while(_0x465dc1!==a0_0x5863e0[_0x1040ec(0x1e8)](_0x465dc1)){for(const _0x350603 of _0x27b2f9){const _0xd8297c=a0_0x5863e0['join'](_0x465dc1,_0x350603);try{return await a0_0x5f2eb7[_0x1040ec(0x2c7)](_0xd8297c),normalizePath(_0x465dc1);}catch{}}_0x465dc1=a0_0x5863e0[_0x1040ec(0x1e8)](_0x465dc1);}return normalizePath(_0x7212cf);}await Promise[a0_0x41e81a(0x1c5)](args['map'](async _0x2b4c7d=>{const _0x1ebda5=a0_0x41e81a;try{const _0x54fa3c=await a0_0x5f2eb7[_0x1ebda5(0x1bd)](expandHome(_0x2b4c7d));!_0x54fa3c[_0x1ebda5(0x1e7)]()&&(logMcpStderr('Error:\x20'+_0x2b4c7d+_0x1ebda5(0x24d)),process['exit'](0x1));}catch(_0x1024c0){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x2b4c7d+':',_0x1024c0),process[_0x1ebda5(0x1ed)](0x1);}}));async function validatePath(_0x810312){const _0x42b7f1=a0_0x41e81a,_0x45121d=expandHome(_0x810312),_0xefbaa5=a0_0x5863e0[_0x42b7f1(0x23a)](_0x45121d);logger[_0x42b7f1(0x27b)]('MCP','path_validation_start',{'raw_path':_0x810312,'absolute':_0xefbaa5});try{const _0x505070=await a0_0x5f2eb7['realpath'](_0xefbaa5);return logger[_0x42b7f1(0x27b)]('MCP',_0x42b7f1(0x2d3),{'resolved':_0x505070,'symlink':_0x505070!==_0xefbaa5}),_0x505070;}catch(_0xd9f3eb){if(_0xd9f3eb[_0x42b7f1(0x23b)]==='ENOENT'){const _0x4bd1df=a0_0x5863e0['dirname'](_0xefbaa5);try{const _0x371d02=await a0_0x5f2eb7['realpath'](_0x4bd1df),_0x9d74f3=a0_0x5863e0[_0x42b7f1(0x21a)](_0x371d02,a0_0x5863e0[_0x42b7f1(0x224)](_0xefbaa5));return logger[_0x42b7f1(0x27b)]('MCP',_0x42b7f1(0x2d3),{'resolved':_0x9d74f3,'new_file':!![]}),_0x9d74f3;}catch{logger[_0x42b7f1(0x2ef)](_0x42b7f1(0x2aa),_0x42b7f1(0x1c0),{'raw_path':_0x810312,'error':_0x42b7f1(0x1ea)+_0x4bd1df});throw new Error(_0x42b7f1(0x1ea)+_0x4bd1df);}}logger['error']('MCP','path_validation_failed',{'raw_path':_0x810312,'error':_0xd9f3eb[_0x42b7f1(0x2ee)]});throw _0xd9f3eb;}}const MorphEditFileArgsSchema=z[a0_0x41e81a(0x1c7)]({'path':z[a0_0x41e81a(0x2d2)](),'code_edit':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x259)),'instruction':z['string']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x285)),'dryRun':z['boolean']()[a0_0x41e81a(0x2f0)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x41e81a(0x2f1),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x2ad)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x203)),'search_type':z[a0_0x41e81a(0x1eb)]([a0_0x41e81a(0x2f0),'node_modules'])['optional']()['describe'](a0_0x41e81a(0x206))}),WarpGrepGitHubArgsSchema=z[a0_0x41e81a(0x1c7)]({'search_string':z['string']()[a0_0x41e81a(0x2ad)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2de)),'owner_repo':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2e9)),'branch':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x286))}),CodebaseSearchArgsSchema=z[a0_0x41e81a(0x1c7)]({'query':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x21f)),'branch':z[a0_0x41e81a(0x2d2)]()['optional']()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x222)),'commitHash':z[a0_0x41e81a(0x2d2)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x21c)),'targetDirectories':z[a0_0x41e81a(0x2a8)](z[a0_0x41e81a(0x2d2)]())[a0_0x41e81a(0x2f0)]([])[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2ab)),'limit':z[a0_0x41e81a(0x20c)]()[a0_0x41e81a(0x270)]()[a0_0x41e81a(0x2f0)](0xa)[a0_0x41e81a(0x2ad)](a0_0x41e81a(0x2c3))}),server=new Server({'name':a0_0x41e81a(0x20e),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x4dcca2=a0_0x41e81a,_0xa6becd=[{'name':TOOL_NAMES[_0x4dcca2(0x2e8)],'description':_0x4dcca2(0x2ed)+_0x4dcca2(0x28b)+_0x4dcca2(0x1fd)+_0x4dcca2(0x292)+_0x4dcca2(0x257)+_0x4dcca2(0x212)+_0x4dcca2(0x236)+_0x4dcca2(0x1da)+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+'-\x20Preserve\x20exact\x20indentation\x0a'+_0x4dcca2(0x1d7)+_0x4dcca2(0x214),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0x4dcca2(0x2ec)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x4dcca2(0x2df)+_0x4dcca2(0x277)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x17268c=_0xa6becd[_0x4dcca2(0x241)](_0x25362a=>{const _0x3174b8=_0x4dcca2;if(DISABLED_TOOLS[_0x3174b8(0x1db)](_0x25362a[_0x3174b8(0x283)]))return console['error'](_0x3174b8(0x24e)+_0x25362a[_0x3174b8(0x283)]+_0x3174b8(0x216)),![];if(_0x3174b8(0x26f)in _0x25362a&&_0x25362a[_0x3174b8(0x26f)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x25362a[_0x3174b8(0x283)]+_0x3174b8(0x1e6)),![];return!![];});return{'tools':_0x17268c[_0x4dcca2(0x1bf)](_0x5ebdca=>({'name':_0x5ebdca['name'],'description':_0x5ebdca['description'],'inputSchema':_0x5ebdca[_0x4dcca2(0x2e4)]}))};}),server[a0_0x41e81a(0x218)](CallToolRequestSchema,async _0x1b7bc7=>{const _0x5a09d5=a0_0x41e81a,{name:_0x5f498c,arguments:_0x363cd2}=_0x1b7bc7[_0x5a09d5(0x21b)],_0x175270=Date[_0x5a09d5(0x27f)]();logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x202),{'tool':_0x5f498c,'args':_0x5f498c===_0x5a09d5(0x231)?{'path':_0x363cd2?.[_0x5a09d5(0x1be)],'instruction':_0x363cd2?.[_0x5a09d5(0x267)]||_0x363cd2?.[_0x5a09d5(0x2b5)],'dryRun':_0x363cd2?.[_0x5a09d5(0x298)]}:_0x363cd2});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':_0x5a09d5(0x1ef)}],'isError':!![]};if(!MORPH_API_KEY[_0x5a09d5(0x211)]('sk-')&&!MORPH_API_KEY[_0x5a09d5(0x211)](_0x5a09d5(0x268)))return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x1fb)}],'isError':!![]};if(DISABLED_TOOLS[_0x5a09d5(0x1db)](_0x5f498c))return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x1ee)+_0x5f498c+_0x5a09d5(0x1d0)}],'isError':![]};switch(_0x5f498c){case TOOL_NAMES[_0x5a09d5(0x2e8)]:{let _0x37571f=_0x363cd2;if(_0x37571f&&typeof _0x37571f===_0x5a09d5(0x1c7)){if(!('path'in _0x37571f)){const _0x262ec4=_0x37571f[_0x5a09d5(0x23c)]??_0x37571f[_0x5a09d5(0x287)]??_0x37571f[_0x5a09d5(0x244)]??_0x37571f[_0x5a09d5(0x284)]??_0x37571f[_0x5a09d5(0x24f)];if(_0x262ec4)_0x37571f={..._0x37571f,'path':_0x262ec4};}'instructions'in _0x37571f&&!(_0x5a09d5(0x267)in _0x37571f)&&(_0x37571f={..._0x37571f,'instruction':_0x37571f['instructions']});if(!('code_edit'in _0x37571f)){const _0x47dbf9=_0x37571f['code']??_0x37571f[_0x5a09d5(0x2d9)]??_0x37571f['content']??_0x37571f[_0x5a09d5(0x2e2)];if(_0x47dbf9)_0x37571f={..._0x37571f,'code_edit':_0x47dbf9};}}const _0x5a7668=MorphEditFileArgsSchema[_0x5a09d5(0x24b)](_0x37571f);if(!_0x5a7668[_0x5a09d5(0x265)])throw new Error(_0x5a09d5(0x1f8)+_0x5a7668[_0x5a09d5(0x2ef)]);const _0x2bf757=await validatePath(_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)]);let _0x15caf3=null,_0x6d560a=!![],_0x209960=null;try{_0x15caf3=await a0_0x5f2eb7[_0x5a09d5(0x2c2)](_0x2bf757,_0x5a09d5(0x29f)),logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2db),{'path':_0x2bf757,'size_bytes':_0x15caf3['length']});}catch(_0x5af592){const _0x374cc5=_0x5af592[_0x5a09d5(0x23b)];_0x374cc5===_0x5a09d5(0x2b1)?(_0x6d560a=![],_0x15caf3='',logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2db),{'path':_0x2bf757,'exists':![]})):(_0x209960=_0x5a09d5(0x210)+(_0x374cc5||'unknown')+_0x5a09d5(0x275)+(_0x5af592 instanceof Error?_0x5af592[_0x5a09d5(0x2ee)]:String(_0x5af592)),logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),_0x5a09d5(0x1f4),{'path':_0x2bf757,'error':_0x209960}),logMcpStderr('Warning:\x20'+_0x209960));}let _0x1d83ce;try{const _0x3bbea6=MORPH_API_KEY;if(!_0x3bbea6)throw new Error(_0x5a09d5(0x26e));const _0x5dfeb6=a0_0x5863e0[_0x5a09d5(0x1e8)](_0x2bf757),_0x1bad32=a0_0x5863e0[_0x5a09d5(0x224)](_0x2bf757);logger['debug'](_0x5a09d5(0x2aa),_0x5a09d5(0x1f9),{'model':_0x5a09d5(0x293),'path':_0x5a7668['data'][_0x5a09d5(0x1be)],'instruction_len':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x267)][_0x5a09d5(0x2e3)],'code_edit_len':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1d6)][_0x5a09d5(0x2e3)],'original_code_len':_0x15caf3?.[_0x5a09d5(0x2e3)]??0x0,'dry_run':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)]});const _0x562087=Date[_0x5a09d5(0x27f)](),_0x32c61a=await executeEditFile({'target_filepath':_0x1bad32,'code_edit':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1d6)],'instruction':_0x5a7668['data'][_0x5a09d5(0x267)]},{'morphApiKey':_0x3bbea6,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x5dfeb6,'autoWrite':!_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)],'generateUdiff':![],'debug':![]}),_0x5821ce=Date['now']()-_0x562087;_0x1d83ce=_0x32c61a['completionId'];if(!_0x32c61a['success'])throw new Error(_0x32c61a[_0x5a09d5(0x2ef)]||_0x5a09d5(0x23f));const _0x41518b=_0x32c61a['changes'],_0x59b11b=_0x5a09d5(0x2dc)+_0x41518b[_0x5a09d5(0x251)]+_0x5a09d5(0x28a)+_0x41518b[_0x5a09d5(0x2cd)]+_0x5a09d5(0x272)+_0x41518b[_0x5a09d5(0x27c)];logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2da),{'tool':_0x5a09d5(0x231),'success':!![],'latency_ms':Date['now']()-_0x175270,'edit_latency_ms':_0x5821ce,'changes':{'added':_0x41518b[_0x5a09d5(0x251)],'removed':_0x41518b[_0x5a09d5(0x2cd)],'modified':_0x41518b['linesModified']},'completion_id':_0x1d83ce});if(_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)])return{'content':[{'type':_0x5a09d5(0x278),'text':'Morph\x20Edit\x20Preview'+(_0x6d560a?'':'\x20(new\x20file)')+':\x20'+_0x5a7668[_0x5a09d5(0x280)]['instruction']+_0x5a09d5(0x297)+_0x59b11b+'.\x20Path:\x20'+_0x5a7668['data'][_0x5a09d5(0x1be)]+'.'}]};return{'content':[{'type':_0x5a09d5(0x278),'text':'Morph\x20Edit\x20'+(_0x6d560a?_0x5a09d5(0x2b4):_0x5a09d5(0x26c))+':\x20'+_0x5a7668['data'][_0x5a09d5(0x267)]+'.\x20Changes:\x20'+_0x59b11b+_0x5a09d5(0x213)+_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)]+'.'}]};}catch(_0x1650c7){const _0x5db0dd=handleMorphAPIError(_0x1650c7);if(_0x5db0dd)return logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),_0x5a09d5(0x2c8),{'tool':_0x5a09d5(0x231),'error':_0x5a09d5(0x266),'latency_ms':Date['now']()-_0x175270}),_0x5db0dd;const _0x484e12=_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x2ee)]:String(_0x1650c7);return logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),'tool_call_error',{'tool':_0x5a09d5(0x231),'error':_0x484e12,'path':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)],'validated_path':_0x2bf757,'latency_ms':Date['now']()-_0x175270,'stack':_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x28c)]:undefined}),reportMorphError({'error_message':_0x484e12,'error_type':_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x247)][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':'edit_file','completion_id':_0x1d83ce,'file_path':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)],'validated_path':_0x2bf757,'instruction':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x267)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x5a09d5(0x293),'dry_run':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)],'file_exists':_0x6d560a,'file_read_error':_0x209960,'file_readable':_0x15caf3!==null,'request_content':{'path':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x1be)],'code_edit':_0x5a7668[_0x5a09d5(0x280)]['code_edit'],'instruction':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x267)],'original_code':_0x15caf3!==null?_0x15caf3[_0x5a09d5(0x2e3)]>0xc350?_0x15caf3[_0x5a09d5(0x25d)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x15caf3[_0x5a09d5(0x2e3)]+_0x5a09d5(0x29d):_0x15caf3:'[could\x20not\x20read\x20file:\x20'+(_0x209960||_0x5a09d5(0x1c4))+']','original_code_length':_0x15caf3?.[_0x5a09d5(0x2e3)]??0x0,'model':MORPH_LARGE_APPLY?_0x5a09d5(0x255):_0x5a09d5(0x293),'dry_run':_0x5a7668[_0x5a09d5(0x280)][_0x5a09d5(0x298)]}},'stack_trace':_0x1650c7 instanceof Error?_0x1650c7[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x299)+_0x484e12}],'isError':!![]};}}case TOOL_NAMES[_0x5a09d5(0x2a3)]:{const _0xb4eafb=WarpGrepArgsSchema[_0x5a09d5(0x24b)](_0x363cd2);if(!_0xb4eafb[_0x5a09d5(0x265)])return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x27a)+_0xb4eafb[_0x5a09d5(0x2ef)]}],'isError':!![]};const _0x3ca5e0=_0x3a3414=>{const _0x4dc684=_0x5a09d5,_0x4dbeb2=[];for(const _0x101b0e of _0x3a3414||[]){if(_0x101b0e['role']===_0x4dc684(0x29a)&&Array[_0x4dc684(0x240)](_0x101b0e[_0x4dc684(0x246)]))for(const _0x237071 of _0x101b0e['tool_calls']){try{const _0x3e44bc=_0x237071[_0x4dc684(0x228)]?.[_0x4dc684(0x283)],_0x549602=JSON[_0x4dc684(0x2a9)](_0x237071[_0x4dc684(0x228)]?.[_0x4dc684(0x256)]||'{}');if(_0x3e44bc===_0x4dc684(0x1d5))_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x223)+_0x549602[_0x4dc684(0x25e)]+'\x27\x20'+(_0x549602[_0x4dc684(0x1be)]||'.'));else{if(_0x3e44bc===_0x4dc684(0x22f))_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x1d3)+_0x549602['path']);else{if(_0x3e44bc===_0x4dc684(0x1c9))_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x22d)+(_0x549602['command']||'.'));else{if(_0x3e44bc===_0x4dc684(0x261))_0x4dbeb2['push'](_0x4dc684(0x2dd)+_0x549602['pattern']+'\x27\x20'+(_0x549602[_0x4dc684(0x1be)]||'.'));else _0x3e44bc==='finish'&&_0x4dbeb2[_0x4dc684(0x291)](_0x4dc684(0x25c));}}}}catch{}}}return _0x4dbeb2;},_0x2f5026=_0x4a2c4d=>{const _0x225eda=_0x5a09d5,_0xbb72c0=[];if(!_0x4a2c4d||!Array[_0x225eda(0x240)](_0x4a2c4d))return _0xbb72c0;const _0x37d39a=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x225eda(0x273),'tool':_0x225eda(0x22f)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x225eda(0x282),'tool':_0x225eda(0x22f)},{'pattern':/\[READ ERROR\]/,'error_type':_0x225eda(0x1ec),'tool':_0x225eda(0x22f)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x225eda(0x22f)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x225eda(0x1d2),'tool':_0x225eda(0x2d6)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x225eda(0x2a0),'tool':_0x225eda(0x22f)},{'pattern':/\[SYMLINK\]/,'error_type':_0x225eda(0x2bc),'tool':_0x225eda(0x22f)},{'pattern':/not a text file/,'error_type':_0x225eda(0x2a0),'tool':_0x225eda(0x22f)},{'pattern':/symbolic link/,'error_type':_0x225eda(0x2bc),'tool':_0x225eda(0x22f)},{'pattern':/Error reading file:/,'error_type':_0x225eda(0x1ec),'tool':_0x225eda(0x22f)},{'pattern':/status="error"/,'error_type':_0x225eda(0x209),'tool':_0x225eda(0x2cc)}];let _0x62aa8c=0x0;for(const _0x5e11ca of _0x4a2c4d){_0x5e11ca['role']===_0x225eda(0x29a)&&Array[_0x225eda(0x240)](_0x5e11ca[_0x225eda(0x246)])&&_0x62aa8c++;const _0x483e6f=_0x5e11ca[_0x225eda(0x2e5)];if((_0x5e11ca[_0x225eda(0x281)]===_0x225eda(0x230)||_0x5e11ca[_0x225eda(0x281)]===_0x225eda(0x2b6))&&_0x483e6f&&typeof _0x483e6f==='string')for(const {pattern:_0x38f77b,error_type:_0x15ac2a,tool:_0x394bdf}of _0x37d39a){const _0x536073=_0x483e6f[_0x225eda(0x290)](new RegExp(_0x38f77b[_0x225eda(0x2d4)],'g'));if(_0x536073)for(const _0x365ecd of _0x536073){const _0xe0cb5e=_0x483e6f[_0x225eda(0x1f0)](_0x365ecd),_0x21236d=_0x483e6f[_0x225eda(0x25d)](_0xe0cb5e,Math['min'](_0xe0cb5e+0xc8,_0x483e6f[_0x225eda(0x2e3)]));_0xbb72c0[_0x225eda(0x291)]({'tool':_0x394bdf,'error_type':_0x15ac2a,'error_message':_0x21236d['split']('\x0a')[0x0],'turn':_0x62aa8c});}}}return _0xbb72c0;};try{const _0x2df413=a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb['data'][_0x5a09d5(0x1fc)]),_0x2b0b70=_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x24c)],_0x5b4242=_0x2b0b70===_0x5a09d5(0x2a1)?{'allowNames':[_0x5a09d5(0x2a1)]}:undefined,_0x21f263=new LocalRipgrepProvider(_0x2df413,undefined,_0x5b4242);logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x2a2),{'type':_0x5a09d5(0x250),'repo_root':_0x2df413,'search_type':_0x2b0b70||_0x5a09d5(0x2f0)}),logger[_0x5a09d5(0x27b)](_0x5a09d5(0x2aa),_0x5a09d5(0x252),{'query':_0xb4eafb['data'][_0x5a09d5(0x20d)],'repo_root':_0x2df413,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1fdbbf=Date[_0x5a09d5(0x27f)](),_0x254569=await runWarpGrep({'searchTerm':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repoRoot':_0x2df413,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x21f263,'search_type':_0x2b0b70}),_0x434115=Date[_0x5a09d5(0x27f)]()-_0x1fdbbf,_0x3bcbc3=_0x254569[_0x5a09d5(0x25c)]?.['metadata']?.[_0x5a09d5(0x2c0)]?.[_0x5a09d5(0x2e3)]??0x0;logger['debug'](_0x5a09d5(0x2aa),_0x5a09d5(0x1f7),{'termination':_0x254569[_0x5a09d5(0x1fe)],'turns':_0x254569[_0x5a09d5(0x242)]?.['turns']??0x0,'files_found':_0x3bcbc3,'latency_ms':_0x434115});const _0x262a62=_0x2f5026(_0x254569[_0x5a09d5(0x2d7)]);_0x262a62[_0x5a09d5(0x2e3)]>0x0&&reportMorphError({'error_message':_0x5a09d5(0x237)+_0x262a62[_0x5a09d5(0x2e3)]+_0x5a09d5(0x24a),'error_type':'SubToolError','level':_0x5a09d5(0x28d),'tool':_0x5a09d5(0x204),'context':{'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'query':_0xb4eafb['data'][_0x5a09d5(0x20d)],'model':'morph-warp-grep-v2.1','termination_reason':_0x254569[_0x5a09d5(0x1fe)],'sub_tool_errors':_0x262a62,'timings':_0x254569['timings'],'tool_calls':_0x3ca5e0(_0x254569[_0x5a09d5(0x2d7)]),'messages':_0x254569[_0x5a09d5(0x2d7)]?.[_0x5a09d5(0x1bf)](_0x29d2b0=>({'role':_0x29d2b0['role'],'content':_0x29d2b0[_0x5a09d5(0x2e5)],..._0x29d2b0[_0x5a09d5(0x246)]?{'tool_calls':_0x29d2b0['tool_calls']['length']}:{},..._0x29d2b0[_0x5a09d5(0x249)]?{'tool_call_id':_0x29d2b0[_0x5a09d5(0x249)]}:{}}))},'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{});let _0x30c57e='';if(_0x254569[_0x5a09d5(0x1fe)]==='completed'&&_0x254569[_0x5a09d5(0x25c)]?.[_0x5a09d5(0x2cf)]?.['files']){const _0x352a61=_0x254569[_0x5a09d5(0x25c)][_0x5a09d5(0x2cf)]['files'];if(_0x352a61[_0x5a09d5(0x2e3)]===0x0)return _0x30c57e=_0x254569[_0x5a09d5(0x25c)][_0x5a09d5(0x2b0)]||_0x5a09d5(0x258),{'content':[{'type':'text','text':_0x30c57e}]};const _0x161af3=[],_0x414a4a=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x17c906 of _0x254569[_0x5a09d5(0x2d7)]){if(_0x17c906[_0x5a09d5(0x281)]===_0x5a09d5(0x29a)&&Array[_0x5a09d5(0x240)](_0x17c906[_0x5a09d5(0x246)]))for(const _0xdf2c6c of _0x17c906[_0x5a09d5(0x246)]){try{const _0x32466a=_0xdf2c6c['function']?.[_0x5a09d5(0x283)],_0x25eb61=JSON['parse'](_0xdf2c6c[_0x5a09d5(0x228)]?.[_0x5a09d5(0x256)]||'{}');if(_0x32466a===_0x5a09d5(0x1d5))_0x414a4a[_0x5a09d5(0x291)]('-\x20Grepped\x20\x27'+_0x25eb61['pattern']+_0x5a09d5(0x2ba)+(_0x25eb61[_0x5a09d5(0x1be)]||'.')+'`');else{if(_0x32466a===_0x5a09d5(0x22f))_0x414a4a['push'](_0x5a09d5(0x271)+_0x25eb61[_0x5a09d5(0x1be)]+'`');else{if(_0x32466a===_0x5a09d5(0x1c9))_0x414a4a[_0x5a09d5(0x291)](_0x5a09d5(0x238)+(_0x25eb61[_0x5a09d5(0x2b8)]||'.')+'`');else _0x32466a===_0x5a09d5(0x261)&&_0x414a4a['push']('-\x20Glob\x20search\x20`'+_0x25eb61[_0x5a09d5(0x25e)]+_0x5a09d5(0x227)+(_0x25eb61[_0x5a09d5(0x1be)]||'.')+'`');}}}catch{}}}_0x161af3[_0x5a09d5(0x291)](_0x414a4a[_0x5a09d5(0x21a)]('\x0a'));const _0x21d6c9=['','Relevant\x20context\x20found:'];for(const _0xbc11b6 of _0x352a61){if(_0xbc11b6[_0x5a09d5(0x219)]==='*')_0x21d6c9['push']('-\x20'+_0xbc11b6[_0x5a09d5(0x1be)]+':*');else{if(Array[_0x5a09d5(0x240)](_0xbc11b6[_0x5a09d5(0x219)])){const _0xb5d3ba=_0xbc11b6[_0x5a09d5(0x219)][_0x5a09d5(0x1bf)](([_0x29e1a9,_0x3a8063])=>{if(_0x29e1a9===_0x3a8063)return''+_0x29e1a9;return _0x29e1a9+'-'+_0x3a8063;});_0x21d6c9[_0x5a09d5(0x291)]('-\x20'+_0xbc11b6[_0x5a09d5(0x1be)]+':'+_0xb5d3ba['join'](','));}else _0x21d6c9[_0x5a09d5(0x291)]('-\x20'+_0xbc11b6[_0x5a09d5(0x1be)]+':*');}}_0x21d6c9[_0x5a09d5(0x291)](''),_0x161af3['push'](_0x21d6c9[_0x5a09d5(0x21a)]('\x0a')),_0x161af3[_0x5a09d5(0x291)](_0x5a09d5(0x2e1));const _0x5aadb7=[],_0x27a31e=[];for(const _0x2eb5c4 of _0x352a61){let _0x2bd801=a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb['data'][_0x5a09d5(0x1fc)],_0x2eb5c4[_0x5a09d5(0x1be)]),_0x30bb64=null,_0x282ba2=null;try{_0x30bb64=await a0_0x5f2eb7['readFile'](_0x2bd801,{'encoding':_0x5a09d5(0x29f)});}catch(_0x3e7a7e){const _0x2462f4=fixPathRepetition(_0x2bd801);if(_0x2462f4)try{_0x30bb64=await a0_0x5f2eb7['readFile'](_0x2462f4,{'encoding':'utf-8'}),_0x2bd801=_0x2462f4;}catch{_0x282ba2=_0x3e7a7e instanceof Error?_0x3e7a7e:new Error(String(_0x3e7a7e));}else _0x282ba2=_0x3e7a7e instanceof Error?_0x3e7a7e:new Error(String(_0x3e7a7e));}if(_0x30bb64!==null){const _0x52af40=_0x30bb64['split'](/\r?\n/),_0x57a0db=[];if(_0x2eb5c4[_0x5a09d5(0x219)]==='*'||!Array[_0x5a09d5(0x240)](_0x2eb5c4[_0x5a09d5(0x219)]))for(let _0xb8136a=0x1;_0xb8136a<=_0x52af40['length'];_0xb8136a++){const _0x1d4429=_0x52af40[_0xb8136a-0x1];_0x57a0db[_0x5a09d5(0x291)](_0xb8136a+'|\x20'+_0x1d4429);}else for(const [_0x3c849e,_0x5f127b]of _0x2eb5c4['lines']){_0x57a0db['length']>0x0&&_0x57a0db[_0x5a09d5(0x291)]('');for(let _0x165675=_0x3c849e;_0x165675<=_0x5f127b&&_0x165675<=_0x52af40['length'];_0x165675++){const _0x21e060=_0x52af40[_0x165675-0x1];_0x57a0db[_0x5a09d5(0x291)](_0x165675+'|\x20'+_0x21e060);}}_0x27a31e[_0x5a09d5(0x291)]({'path':_0x2eb5c4[_0x5a09d5(0x1be)],'content':_0x57a0db[_0x5a09d5(0x21a)]('\x0a')});}else _0x5aadb7[_0x5a09d5(0x291)]('<file\x20path=\x22'+_0x2eb5c4['path']+_0x5a09d5(0x1ff)+(_0x282ba2?.[_0x5a09d5(0x2ee)]||_0x5a09d5(0x1f5))+'\x0a</file>');}try{const _0x538b63=await compactFileContexts(_0x27a31e,_0xb4eafb[_0x5a09d5(0x280)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x5e1a10 of _0x538b63){_0x5aadb7[_0x5a09d5(0x291)](_0x5a09d5(0x1c2)+_0x5e1a10[_0x5a09d5(0x1be)]+'\x22>\x0a'+_0x5e1a10['content']+'\x0a</file>');}}catch(_0x5253d3){logger[_0x5a09d5(0x28d)]('MCP',_0x5a09d5(0x254),{'error':_0x5253d3 instanceof Error?_0x5253d3[_0x5a09d5(0x2ee)]:String(_0x5253d3),'files_count':_0x27a31e[_0x5a09d5(0x2e3)]});for(const _0x3ab485 of _0x27a31e){_0x5aadb7['push'](_0x5a09d5(0x1c2)+_0x3ab485[_0x5a09d5(0x1be)]+_0x5a09d5(0x205)+_0x3ab485[_0x5a09d5(0x2e5)]+_0x5a09d5(0x229));}}_0x161af3[_0x5a09d5(0x291)](_0x5aadb7[_0x5a09d5(0x21a)]('\x0a\x0a')),_0x30c57e=_0x161af3['join']('\x0a');const _0x47cf7b=_0x254569['errors']?.[_0x5a09d5(0x241)](_0x484add=>_0x484add['message']?.[_0x5a09d5(0x211)](_0x5a09d5(0x221)))||[];if(_0x47cf7b['length']>0x0){const _0x116889=_0x47cf7b[_0x5a09d5(0x1bf)](_0x21004d=>_0x21004d[_0x5a09d5(0x2ee)])[_0x5a09d5(0x21a)](';\x20');reportMorphError({'error_message':_0x116889,'error_type':_0x5a09d5(0x2c6),'context':{'tool':_0x5a09d5(0x204),'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'model':_0x5a09d5(0x1dc),'termination_reason':_0x5a09d5(0x2c5),'error_count':_0x47cf7b[_0x5a09d5(0x2e3)],'is_timeout':![],'timings':_0x254569['timings'],'files_attempted':_0x352a61['map'](_0x41735f=>({'path':_0x41735f[_0x5a09d5(0x1be)],'lines':_0x41735f[_0x5a09d5(0x219)]})),'tool_calls':_0x3ca5e0(_0x254569[_0x5a09d5(0x2d7)]),'messages':_0x254569[_0x5a09d5(0x2d7)]?.[_0x5a09d5(0x1bf)](_0x4ee140=>({'role':_0x4ee140[_0x5a09d5(0x281)],'content':_0x4ee140[_0x5a09d5(0x2e5)],..._0x4ee140[_0x5a09d5(0x246)]?{'tool_calls':_0x4ee140[_0x5a09d5(0x246)]['length']}:{},..._0x4ee140[_0x5a09d5(0x249)]?{'tool_call_id':_0x4ee140[_0x5a09d5(0x249)]}:{}})),'request_content':{'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repo_path':_0xb4eafb['data']['repo_path'],'repoRoot':a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)]),'model':'morph-warp-grep-v2.1'}},'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{});}}else{if(_0x254569[_0x5a09d5(0x1fe)]===_0x5a09d5(0x29e)&&_0x254569[_0x5a09d5(0x288)]['length']>0x0){const _0x437274=_0x254569[_0x5a09d5(0x288)]['map'](_0x4d9ecd=>_0x4d9ecd[_0x5a09d5(0x2ee)])[_0x5a09d5(0x21a)](';\x20');_0x30c57e=_0x5a09d5(0x2b7)+_0x437274;const _0x4bdf0a=_0x437274[_0x5a09d5(0x1e5)]()[_0x5a09d5(0x1c6)](_0x5a09d5(0x1d8))||_0x437274['toLowerCase']()['includes'](_0x5a09d5(0x1e1))||_0x437274['toLowerCase']()[_0x5a09d5(0x1c6)]('etimedout'),_0xa7aa=_0x254569[_0x5a09d5(0x25c)]?.[_0x5a09d5(0x2cf)]?.[_0x5a09d5(0x2c0)],_0x55b5b6=_0x254569[_0x5a09d5(0x288)][0x0];reportMorphError({'error_message':_0x437274,'error_type':_0x4bdf0a?_0x5a09d5(0x235):_0x55b5b6?.['constructor']?.['name']||_0x5a09d5(0x200),'context':{'tool':_0x5a09d5(0x204),'repo_path':_0xb4eafb[_0x5a09d5(0x280)]['repo_path'],'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'model':_0x5a09d5(0x1dc),'termination_reason':_0x254569[_0x5a09d5(0x1fe)],'error_count':_0x254569[_0x5a09d5(0x288)][_0x5a09d5(0x2e3)],'is_timeout':_0x4bdf0a,'timings':_0x254569[_0x5a09d5(0x242)],'files_attempted':_0xa7aa?.[_0x5a09d5(0x1bf)](_0x4c51a3=>({'path':_0x4c51a3[_0x5a09d5(0x1be)],'lines':_0x4c51a3[_0x5a09d5(0x219)]})),'tool_calls':_0x3ca5e0(_0x254569[_0x5a09d5(0x2d7)]),'messages':_0x254569[_0x5a09d5(0x2d7)]?.[_0x5a09d5(0x1bf)](_0x1c96b9=>({'role':_0x1c96b9[_0x5a09d5(0x281)],'content':_0x1c96b9[_0x5a09d5(0x2e5)],..._0x1c96b9[_0x5a09d5(0x246)]?{'tool_calls':_0x1c96b9[_0x5a09d5(0x246)][_0x5a09d5(0x2e3)]}:{},..._0x1c96b9['tool_call_id']?{'tool_call_id':_0x1c96b9[_0x5a09d5(0x249)]}:{}})),'request_content':{'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'repoRoot':a0_0x5863e0['resolve'](_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x55b5b6?.[_0x5a09d5(0x28c)]||undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{});}else _0x30c57e=_0x5a09d5(0x217);}return{'content':[{'type':_0x5a09d5(0x278),'text':_0x30c57e}]};}catch(_0x16f623){const _0x171979=handleMorphAPIError(_0x16f623);if(_0x171979)return logger['error'](_0x5a09d5(0x2aa),_0x5a09d5(0x2c8),{'tool':_0x5a09d5(0x204),'error':_0x5a09d5(0x266),'latency_ms':Date[_0x5a09d5(0x27f)]()-_0x175270}),_0x171979;const _0xd8bc5f=_0x16f623 instanceof Error?_0x16f623[_0x5a09d5(0x2ee)]:String(_0x16f623);logger[_0x5a09d5(0x2ef)](_0x5a09d5(0x2aa),_0x5a09d5(0x2c8),{'tool':_0x5a09d5(0x204),'error':_0xd8bc5f,'repo_path':_0xb4eafb[_0x5a09d5(0x280)]['repo_path'],'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'latency_ms':Date['now']()-_0x175270});const _0x70a54e=_0xd8bc5f['toLowerCase']()[_0x5a09d5(0x1c6)](_0x5a09d5(0x1d8))||_0xd8bc5f[_0x5a09d5(0x1e5)]()[_0x5a09d5(0x1c6)](_0x5a09d5(0x1e1))||_0xd8bc5f[_0x5a09d5(0x1e5)]()['includes'](_0x5a09d5(0x2e0))||_0x16f623 instanceof Error&&_0x16f623['name']===_0x5a09d5(0x235);return reportMorphError({'error_message':_0xd8bc5f,'error_type':_0x70a54e?_0x5a09d5(0x235):_0x16f623 instanceof Error?_0x16f623['constructor'][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':_0x5a09d5(0x204),'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'query':_0xb4eafb[_0x5a09d5(0x280)]['search_string'],'model':'morph-warp-grep-v2.1','is_timeout':_0x70a54e,'exception_phase':_0x5a09d5(0x2d1),'request_content':{'query':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'repo_path':_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)],'repoRoot':a0_0x5863e0[_0x5a09d5(0x23a)](_0xb4eafb[_0x5a09d5(0x280)][_0x5a09d5(0x1fc)]),'model':_0x5a09d5(0x1dc)}},'stack_trace':_0x16f623 instanceof Error?_0x16f623[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x2eb)+_0xd8bc5f}],'isError':![]};}}case TOOL_NAMES[_0x5a09d5(0x226)]:{const _0x5852f0=WarpGrepGitHubArgsSchema[_0x5a09d5(0x24b)](_0x363cd2);if(!_0x5852f0[_0x5a09d5(0x265)])return{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x27a)+_0x5852f0[_0x5a09d5(0x2ef)]}],'isError':!![]};const _0x30aab2=_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x1e9)]||_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x20f)];if(!_0x30aab2)return{'content':[{'type':'text','text':_0x5a09d5(0x21d)}],'isError':!![]};const _0x2c45a3=MORPH_API_KEY;if(!_0x2c45a3)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x29af95=Date[_0x5a09d5(0x27f)]();logger[_0x5a09d5(0x27b)]('MCP',_0x5a09d5(0x1e3),{'identifier':_0x30aab2,'query':_0x5852f0[_0x5a09d5(0x280)]['search_string'],'branch':_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x2af)]});try{const _0x47d8ac=new WarpGrepClient({'morphApiKey':_0x2c45a3,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x504d98=await _0x47d8ac['searchGitHub']({'searchTerm':_0x5852f0[_0x5a09d5(0x280)][_0x5a09d5(0x20d)],'github':_0x30aab2,'branch':_0x5852f0[_0x5a09d5(0x280)]['branch']}),_0x1f4abe=Date[_0x5a09d5(0x27f)]()-_0x29af95;logMcpStderr(_0x5a09d5(0x2b3)+_0x1f4abe+_0x5a09d5(0x1de)+_0x504d98[_0x5a09d5(0x265)]);const _0x488ff4=formatResult(_0x504d98);return{'content':[{'type':_0x5a09d5(0x278),'text':_0x488ff4}]};}catch(_0x27d32b){const _0x552beb=handleMorphAPIError(_0x27d32b);if(_0x552beb)return _0x552beb;const _0x182f51=Date[_0x5a09d5(0x27f)]()-_0x29af95,_0x123b2a=_0x27d32b instanceof Error?_0x27d32b[_0x5a09d5(0x2ee)]:String(_0x27d32b);return logMcpStderr(_0x5a09d5(0x1e0)+_0x182f51+_0x5a09d5(0x1d1),_0x123b2a),reportMorphError({'error_message':_0x123b2a,'error_type':_0x27d32b instanceof Error?_0x27d32b[_0x5a09d5(0x247)][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':'github_codebase_search','github_url':_0x30aab2,'search_string':_0x5852f0[_0x5a09d5(0x280)]['search_string'],'branch':_0x5852f0[_0x5a09d5(0x280)]['branch']},'stack_trace':_0x27d32b instanceof Error?_0x27d32b[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1),'tool':_0x5a09d5(0x296),'latency_ms':_0x182f51})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':'text','text':_0x5a09d5(0x28f)+_0x123b2a}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x5f498c);}}catch(_0x2cebef){const _0x4382fe=_0x2cebef instanceof Error?_0x2cebef[_0x5a09d5(0x2ee)]:String(_0x2cebef);return reportMorphError({'error_message':_0x4382fe,'error_type':_0x2cebef instanceof Error?_0x2cebef[_0x5a09d5(0x247)][_0x5a09d5(0x283)]:_0x5a09d5(0x1c3),'context':{'tool':_0x5f498c,'arguments':_0x363cd2?JSON[_0x5a09d5(0x2bf)](_0x363cd2)[_0x5a09d5(0x25d)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x2cebef instanceof Error?_0x2cebef[_0x5a09d5(0x28c)]:undefined,'source':_0x5a09d5(0x1f1)})[_0x5a09d5(0x26a)](()=>{}),{'content':[{'type':_0x5a09d5(0x278),'text':_0x5a09d5(0x2b7)+_0x4382fe}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3f0cea){const _0x90adeb=a0_0x41e81a,_0x417ddc=await getValidRootDirectories(_0x3f0cea);if(_0x417ddc['length']>0x0)allowedDirectories=[..._0x417ddc],logMcpStderr(_0x90adeb(0x1f2)+_0x417ddc[_0x90adeb(0x2e3)]+'\x20valid\x20directories');else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x3858ba=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x3858ba&&(allowedDirectories=[_0x3858ba],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x3858ba));}catch(_0x59da5d){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x59da5d);}}}server[a0_0x41e81a(0x2c9)](RootsListChangedNotificationSchema,async()=>{const _0x3b33e5=a0_0x41e81a;try{const _0x497614=await server[_0x3b33e5(0x289)]();_0x497614&&_0x3b33e5(0x2ae)in _0x497614&&await updateAllowedDirectoriesFromRoots(_0x497614['roots']);}catch(_0x17fead){logMcpStderr(_0x3b33e5(0x2e6),_0x17fead instanceof Error?_0x17fead[_0x3b33e5(0x2ee)]:String(_0x17fead));}}),server[a0_0x41e81a(0x1dd)]=async()=>{const _0x154f30=a0_0x41e81a,_0x5f06d7=server[_0x154f30(0x22a)]();if(_0x5f06d7?.[_0x154f30(0x2ae)])try{const _0x3b5790=await server[_0x154f30(0x289)]();_0x3b5790&&'roots'in _0x3b5790?await updateAllowedDirectoriesFromRoots(_0x3b5790[_0x154f30(0x2ae)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x2869b2){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x2869b2 instanceof Error?_0x2869b2['message']:String(_0x2869b2));}else{if(allowedDirectories[_0x154f30(0x2e3)]>0x0)logMcpStderr(_0x154f30(0x295),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x154f30(0x1cd));else throw new Error(_0x154f30(0x1cf));}}};async function runServer(){const _0x23ad5a=a0_0x41e81a,_0x61670a=new StdioServerTransport();await server[_0x23ad5a(0x1d9)](_0x61670a),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x41e81a(0x26a)](_0x2863d5=>{const _0x1074cd=a0_0x41e81a;logMcpStderr(_0x1074cd(0x2ac),_0x2863d5),process[_0x1074cd(0x1ed)](0x1);});

@@ -1,1 +0,1 @@

(function(_0x292728,_0x22c8f8){var _0x140f2=a1_0x1a92,_0x562c1d=_0x292728();while(!![]){try{var _0x48c985=parseInt(_0x140f2(0x1ba))/0x1*(-parseInt(_0x140f2(0x1ad))/0x2)+parseInt(_0x140f2(0x1b6))/0x3*(parseInt(_0x140f2(0x1bb))/0x4)+parseInt(_0x140f2(0x1ac))/0x5+-parseInt(_0x140f2(0x1b5))/0x6+-parseInt(_0x140f2(0x1b3))/0x7+parseInt(_0x140f2(0x1bd))/0x8*(parseInt(_0x140f2(0x1b1))/0x9)+parseInt(_0x140f2(0x1b0))/0xa*(parseInt(_0x140f2(0x1b2))/0xb);if(_0x48c985===_0x22c8f8)break;else _0x562c1d['push'](_0x562c1d['shift']());}catch(_0x2f80f0){_0x562c1d['push'](_0x562c1d['shift']());}}}(a1_0x13a0,0x86d56));import a1_0x257fda from'os';import{logger}from'./logger.js';function a1_0x1a92(_0xed4d65,_0x4b6014){_0xed4d65=_0xed4d65-0x1ab;var _0x13a0db=a1_0x13a0();var _0x1a92a4=_0x13a0db[_0xed4d65];return _0x1a92a4;}function a1_0x13a0(){var _0x3f6ef1=['linux','20887nBELcg','2872WXygzl','Linux','1363792vlRzXy','MCP','Unknown','info','3685605btblzd','54hcrATu','Windows','macOS','389590WYdawP','54Jmvuqx','88zqJdmi','6071457lbgvTn','error','3914442YNZFaz','2358noeVbS','darwin','map'];a1_0x13a0=function(){return _0x3f6ef1;};return a1_0x13a0();}export function getOperatingSystemType(_0x3d2a42=a1_0x257fda['platform']()){var _0x27ea38=a1_0x1a92;switch(_0x3d2a42){case _0x27ea38(0x1b7):return _0x27ea38(0x1af);case'win32':return _0x27ea38(0x1ae);case _0x27ea38(0x1b9):return _0x27ea38(0x1bc);default:return _0x27ea38(0x1bf);}}export function formatMcpLogMessage(_0x5cba72,_0x459ecc=a1_0x257fda['platform']()){return'[os='+getOperatingSystemType(_0x459ecc)+']\x20'+_0x5cba72;}export function logMcpStderr(_0x52698a,..._0x2b7c12){var _0x28afe8=a1_0x1a92;console[_0x28afe8(0x1b4)](formatMcpLogMessage(_0x52698a),..._0x2b7c12),logger[_0x28afe8(0x1ab)](_0x28afe8(0x1be),_0x52698a,_0x2b7c12['length']?{'args':_0x2b7c12[_0x28afe8(0x1b8)](_0x59dc0f=>String(_0x59dc0f))}:undefined);}
var a1_0x74b0a6=a1_0x5667;(function(_0x40aa79,_0x578712){var _0x6f572e=a1_0x5667,_0x528263=_0x40aa79();while(!![]){try{var _0x59299c=parseInt(_0x6f572e(0x7d))/0x1*(parseInt(_0x6f572e(0x8d))/0x2)+parseInt(_0x6f572e(0x8a))/0x3*(-parseInt(_0x6f572e(0x7c))/0x4)+parseInt(_0x6f572e(0x84))/0x5+parseInt(_0x6f572e(0x8c))/0x6+-parseInt(_0x6f572e(0x82))/0x7*(parseInt(_0x6f572e(0x85))/0x8)+parseInt(_0x6f572e(0x8e))/0x9*(-parseInt(_0x6f572e(0x8f))/0xa)+parseInt(_0x6f572e(0x81))/0xb;if(_0x59299c===_0x578712)break;else _0x528263['push'](_0x528263['shift']());}catch(_0xa9a174){_0x528263['push'](_0x528263['shift']());}}}(a1_0x2282,0x4146c));import a1_0x451efe from'os';function a1_0x2282(){var _0x2c0055=['[os=','33WNWQTM','macOS','1874556dxZUvT','2XAxzPN','153LnnUbH','202760xHjDAP','Unknown','77712eTZNuy','174343WUHSOi','platform','Linux','error','6170373axtGBi','7TcorkM','length','656560WvdYRW','2826016zBiMAr','win32','MCP','Windows'];a1_0x2282=function(){return _0x2c0055;};return a1_0x2282();}import{logger}from'./logger.js';function a1_0x5667(_0x3a512e,_0x325664){_0x3a512e=_0x3a512e-0x7b;var _0x228267=a1_0x2282();var _0x56671d=_0x228267[_0x3a512e];return _0x56671d;}export function getOperatingSystemType(_0x4a46fc=a1_0x451efe[a1_0x74b0a6(0x7e)]()){var _0x22d476=a1_0x74b0a6;switch(_0x4a46fc){case'darwin':return _0x22d476(0x8b);case _0x22d476(0x86):return _0x22d476(0x88);case'linux':return _0x22d476(0x7f);default:return _0x22d476(0x7b);}}export function formatMcpLogMessage(_0x3c9fbd,_0x59b57c=a1_0x451efe[a1_0x74b0a6(0x7e)]()){var _0x18f793=a1_0x74b0a6;return _0x18f793(0x89)+getOperatingSystemType(_0x59b57c)+']\x20'+_0x3c9fbd;}export function logMcpStderr(_0x5d9771,..._0x3e92cb){var _0xa3d4e7=a1_0x74b0a6;console[_0xa3d4e7(0x80)](formatMcpLogMessage(_0x5d9771),..._0x3e92cb),logger['info'](_0xa3d4e7(0x87),_0x5d9771,_0x3e92cb[_0xa3d4e7(0x83)]?{'args':_0x3e92cb['map'](_0x3da96b=>String(_0x3da96b))}:undefined);}

@@ -1,1 +0,1 @@

const a2_0x49193f=a2_0xf4c8;(function(_0x25fdba,_0x4f2c59){const _0x298c01=a2_0xf4c8,_0x394bd6=_0x25fdba();while(!![]){try{const _0x4535b7=-parseInt(_0x298c01(0x94))/0x1*(parseInt(_0x298c01(0x97))/0x2)+parseInt(_0x298c01(0x99))/0x3+parseInt(_0x298c01(0x9e))/0x4*(parseInt(_0x298c01(0xa4))/0x5)+-parseInt(_0x298c01(0xa7))/0x6*(-parseInt(_0x298c01(0xa8))/0x7)+parseInt(_0x298c01(0xa0))/0x8*(parseInt(_0x298c01(0x9d))/0x9)+parseInt(_0x298c01(0x93))/0xa*(parseInt(_0x298c01(0x96))/0xb)+-parseInt(_0x298c01(0x98))/0xc;if(_0x4535b7===_0x4f2c59)break;else _0x394bd6['push'](_0x394bd6['shift']());}catch(_0x2847cc){_0x394bd6['push'](_0x394bd6['shift']());}}}(a2_0xa7ae,0x52bdd));function a2_0xa7ae(){const _0x5578bd=['902vznzAA','1113814wZfQrL','14336244SvBmtF','906483MoDbKk','toISOString','error','write','27EPJJuO','3868YXEzCj','warn','290760CmyLlh','enable','fileStream','MORPH_LOG_FILE','3415uQHawc','_log','isEnabled','3707196NSPcbL','7ZvPVcY','debug','env','enabled',']\x20[','info','48900ggyGhx','1nYYtCH','toUpperCase'];a2_0xa7ae=function(){return _0x5578bd;};return a2_0xa7ae();}function a2_0xf4c8(_0x4ddec7,_0x1383a4){_0x4ddec7=_0x4ddec7-0x93;const _0xa7aeab=a2_0xa7ae();let _0xf4c89e=_0xa7aeab[_0x4ddec7];return _0xf4c89e;}import{createWriteStream}from'fs';class MorphLogger{[a2_0x49193f(0xab)];[a2_0x49193f(0xa2)];constructor(){const _0x291ff0=a2_0x49193f;this[_0x291ff0(0xab)]=process[_0x291ff0(0xaa)]['MORPH_DEBUG']==='1'||!!process[_0x291ff0(0xaa)][_0x291ff0(0xa3)];const _0x280801=process[_0x291ff0(0xaa)]['MORPH_LOG_FILE'];this[_0x291ff0(0xa2)]=_0x280801?createWriteStream(_0x280801,{'flags':'a'}):null;}[a2_0x49193f(0xa9)](_0x3f7c25,_0x5e5be1,_0x233662){const _0x35f839=a2_0x49193f;this[_0x35f839(0xa5)](_0x35f839(0xa9),_0x3f7c25,_0x5e5be1,_0x233662);}[a2_0x49193f(0xad)](_0x1438f1,_0x3d5658,_0x18e387){const _0x253f1c=a2_0x49193f;this[_0x253f1c(0xa5)]('info',_0x1438f1,_0x3d5658,_0x18e387);}[a2_0x49193f(0x9f)](_0x4ac425,_0x5c7e0a,_0x473a57){const _0xcfeaf3=a2_0x49193f;this[_0xcfeaf3(0xa5)](_0xcfeaf3(0x9f),_0x4ac425,_0x5c7e0a,_0x473a57);}[a2_0x49193f(0x9b)](_0x491a36,_0x3e9180,_0x24e65f){const _0x2f8234=a2_0x49193f;this[_0x2f8234(0xa5)](_0x2f8234(0x9b),_0x491a36,_0x3e9180,_0x24e65f);}[a2_0x49193f(0xa1)](){const _0x468d86=a2_0x49193f;this[_0x468d86(0xab)]=!![];}get[a2_0x49193f(0xa6)](){const _0x2e4143=a2_0x49193f;return this[_0x2e4143(0xab)];}['_log'](_0x3ee542,_0x2e23cb,_0x41df9d,_0x2afca3){const _0x362caf=a2_0x49193f;if(_0x3ee542!=='error'&&!this['enabled'])return;const _0x677905=new Date()[_0x362caf(0x9a)](),_0x132ee9='['+_0x677905+']\x20['+_0x3ee542[_0x362caf(0x95)]()+_0x362caf(0xac)+_0x2e23cb+']';console[_0x362caf(0x9b)](_0x2afca3?_0x132ee9+'\x20'+_0x41df9d+'\x20'+JSON['stringify'](_0x2afca3):_0x132ee9+'\x20'+_0x41df9d),this['fileStream']?.[_0x362caf(0x9c)](JSON['stringify']({'ts':_0x677905,'level':_0x3ee542,'component':_0x2e23cb,'msg':_0x41df9d,..._0x2afca3&&{'data':_0x2afca3}})+'\x0a');}}export const logger=new MorphLogger();
const a2_0x315720=a2_0x263b;(function(_0x12624c,_0x1da5fb){const _0x51b6dd=a2_0x263b,_0x4fa9a0=_0x12624c();while(!![]){try{const _0x52ce8b=-parseInt(_0x51b6dd(0x109))/0x1+parseInt(_0x51b6dd(0x118))/0x2+-parseInt(_0x51b6dd(0x119))/0x3+parseInt(_0x51b6dd(0x10c))/0x4+parseInt(_0x51b6dd(0x10a))/0x5*(parseInt(_0x51b6dd(0x115))/0x6)+parseInt(_0x51b6dd(0x110))/0x7+parseInt(_0x51b6dd(0x11e))/0x8*(-parseInt(_0x51b6dd(0x10d))/0x9);if(_0x52ce8b===_0x1da5fb)break;else _0x4fa9a0['push'](_0x4fa9a0['shift']());}catch(_0xb35daa){_0x4fa9a0['push'](_0x4fa9a0['shift']());}}}(a2_0x22b1,0x48425));import{createWriteStream}from'fs';function a2_0x263b(_0x1994ea,_0x3dc814){_0x1994ea=_0x1994ea-0x105;const _0x22b10f=a2_0x22b1();let _0x263b9a=_0x22b10f[_0x1994ea];return _0x263b9a;}class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x3f7376=a2_0x263b;this[_0x3f7376(0x11d)]=process['env'][_0x3f7376(0x113)]==='1'||!!process[_0x3f7376(0x10f)][_0x3f7376(0x117)];const _0x28cf07=process['env']['MORPH_LOG_FILE'];this[_0x3f7376(0x11c)]=_0x28cf07?createWriteStream(_0x28cf07,{'flags':'a'}):null;}['debug'](_0x2e9375,_0xbaecec,_0x3c9f77){const _0x4281ab=a2_0x263b;this[_0x4281ab(0x107)](_0x4281ab(0x105),_0x2e9375,_0xbaecec,_0x3c9f77);}[a2_0x315720(0x116)](_0xb44b0d,_0x4ba3eb,_0x251df9){const _0x2b865b=a2_0x315720;this[_0x2b865b(0x107)](_0x2b865b(0x116),_0xb44b0d,_0x4ba3eb,_0x251df9);}[a2_0x315720(0x10b)](_0x4b8ac8,_0xda0bc0,_0x3def69){const _0x2e23f7=a2_0x315720;this[_0x2e23f7(0x107)](_0x2e23f7(0x10b),_0x4b8ac8,_0xda0bc0,_0x3def69);}['error'](_0x5cca84,_0x18f041,_0x2c6568){const _0x197b64=a2_0x315720;this[_0x197b64(0x107)]('error',_0x5cca84,_0x18f041,_0x2c6568);}[a2_0x315720(0x108)](){this['enabled']=!![];}get[a2_0x315720(0x106)](){const _0x54f7c6=a2_0x315720;return this[_0x54f7c6(0x11d)];}[a2_0x315720(0x107)](_0x49e418,_0x8dacde,_0x4e0efa,_0x83ec7){const _0x2aa7bc=a2_0x315720;if(_0x49e418!==_0x2aa7bc(0x111)&&!this[_0x2aa7bc(0x11d)])return;const _0x5ebe72=new Date()[_0x2aa7bc(0x11b)](),_0x161d80='['+_0x5ebe72+_0x2aa7bc(0x112)+_0x49e418[_0x2aa7bc(0x10e)]()+_0x2aa7bc(0x112)+_0x8dacde+']';console['error'](_0x83ec7?_0x161d80+'\x20'+_0x4e0efa+'\x20'+JSON['stringify'](_0x83ec7):_0x161d80+'\x20'+_0x4e0efa),this[_0x2aa7bc(0x11c)]?.[_0x2aa7bc(0x11a)](JSON[_0x2aa7bc(0x114)]({'ts':_0x5ebe72,'level':_0x49e418,'component':_0x8dacde,'msg':_0x4e0efa,..._0x83ec7&&{'data':_0x83ec7}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x22b1(){const _0x597acc=['enabled','32cfLxnw','debug','isEnabled','_log','enable','99197VEIQUd','85985oBGGnf','warn','2327180djvHmH','2505159tiNnOn','toUpperCase','env','3246733BVWkrB','error',']\x20[','MORPH_DEBUG','stringify','102eMVetN','info','MORPH_LOG_FILE','823604pbpZOG','723573pAcBxv','write','toISOString','fileStream'];a2_0x22b1=function(){return _0x597acc;};return a2_0x22b1();}

@@ -1,1 +0,1 @@

function a3_0xeac1(_0x756e51,_0xab016d){_0x756e51=_0x756e51-0x1a6;const _0x3444bd=a3_0x3444();let _0xeac17c=_0x3444bd[_0x756e51];return _0xeac17c;}(function(_0xe7bc0f,_0x38e0ea){const _0x1a1028=a3_0xeac1,_0x38b894=_0xe7bc0f();while(!![]){try{const _0x305cb8=parseInt(_0x1a1028(0x1b1))/0x1+-parseInt(_0x1a1028(0x1b8))/0x2*(-parseInt(_0x1a1028(0x1b3))/0x3)+-parseInt(_0x1a1028(0x1b5))/0x4+-parseInt(_0x1a1028(0x1a6))/0x5+parseInt(_0x1a1028(0x1b9))/0x6+-parseInt(_0x1a1028(0x1b7))/0x7*(-parseInt(_0x1a1028(0x1b4))/0x8)+parseInt(_0x1a1028(0x1ab))/0x9*(-parseInt(_0x1a1028(0x1aa))/0xa);if(_0x305cb8===_0x38e0ea)break;else _0x38b894['push'](_0x38b894['shift']());}catch(_0x2dec00){_0x38b894['push'](_0x38b894['shift']());}}}(a3_0x3444,0xa3934));import a3_0x2886d8 from'path';import a3_0x2c389e from'os';export function convertToWindowsPath(_0x57078b){const _0x4b501f=a3_0xeac1;if(_0x57078b[_0x4b501f(0x1b6)](_0x4b501f(0x1b0))){const _0x5ee6af=_0x57078b['charAt'](0x5)[_0x4b501f(0x1af)](),_0x4e411c=_0x57078b[_0x4b501f(0x1a9)](0x6)[_0x4b501f(0x1ad)](/\//g,'\x5c');return _0x5ee6af+':'+_0x4e411c;}if(_0x57078b[_0x4b501f(0x1b2)](/^\/[a-zA-Z]\//)){const _0x26e4fe=_0x57078b[_0x4b501f(0x1a8)](0x1)['toUpperCase'](),_0x4a4990=_0x57078b[_0x4b501f(0x1a9)](0x2)['replace'](/\//g,'\x5c');return _0x26e4fe+':'+_0x4a4990;}if(_0x57078b[_0x4b501f(0x1b2)](/^[a-zA-Z]:/))return _0x57078b[_0x4b501f(0x1ad)](/\//g,'\x5c');return _0x57078b;}export function normalizePath(_0x1eb069){const _0xdc6939=a3_0xeac1;_0x1eb069=_0x1eb069[_0xdc6939(0x1a7)]()[_0xdc6939(0x1ad)](/^["']|["']$/g,'');const _0x535bc=_0x1eb069[_0xdc6939(0x1b6)]('/')&&!_0x1eb069['match'](/^\/mnt\/[a-z]\//i)&&!_0x1eb069['match'](/^\/[a-zA-Z]\//);if(_0x535bc)return _0x1eb069[_0xdc6939(0x1ad)](/\/+/g,'/')[_0xdc6939(0x1ad)](/\/+$/,'');_0x1eb069=convertToWindowsPath(_0x1eb069);if(_0x1eb069[_0xdc6939(0x1b6)]('\x5c\x5c')){let _0x3ae92b=_0x1eb069;_0x3ae92b=_0x3ae92b[_0xdc6939(0x1ad)](/^\\{2,}/,'\x5c\x5c');const _0x548919=_0x3ae92b[_0xdc6939(0x1ac)](0x2)[_0xdc6939(0x1ad)](/\\\\/g,'\x5c');_0x1eb069='\x5c\x5c'+_0x548919;}else _0x1eb069=_0x1eb069[_0xdc6939(0x1ad)](/\\\\/g,'\x5c');let _0x49dbf9=a3_0x2886d8['normalize'](_0x1eb069);_0x1eb069[_0xdc6939(0x1b6)]('\x5c\x5c')&&!_0x49dbf9['startsWith']('\x5c\x5c')&&(_0x49dbf9='\x5c'+_0x49dbf9);if(_0x49dbf9[_0xdc6939(0x1b2)](/^[a-zA-Z]:/)){let _0x9ac206=_0x49dbf9[_0xdc6939(0x1ad)](/\//g,'\x5c');return/^[a-z]:/[_0xdc6939(0x1ba)](_0x9ac206)&&(_0x9ac206=_0x9ac206[_0xdc6939(0x1a8)](0x0)[_0xdc6939(0x1af)]()+_0x9ac206['slice'](0x1)),_0x9ac206;}return _0x49dbf9[_0xdc6939(0x1ad)](/\//g,'\x5c');}export function expandHome(_0x14444f){const _0x54cb3f=a3_0xeac1;if(_0x14444f[_0x54cb3f(0x1b6)]('~/')||_0x14444f==='~')return a3_0x2886d8['join'](a3_0x2c389e[_0x54cb3f(0x1ae)](),_0x14444f[_0x54cb3f(0x1a9)](0x1));return _0x14444f;}function a3_0x3444(){const _0x1f3f37=['homedir','toUpperCase','/mnt/','1089089GXmSxo','match','1014SkrwsK','8MzEBiJ','750232JpxNVg','startsWith','8027488gsRMhc','3146qsqsxO','7509150vBIHyF','test','2214980axMfkJ','trim','charAt','slice','83390JgzUfO','2934pZdrdR','substring','replace'];a3_0x3444=function(){return _0x1f3f37;};return a3_0x3444();}
(function(_0x4ba7cd,_0x1e5670){const _0x36909b=a3_0x2476,_0x559bbe=_0x4ba7cd();while(!![]){try{const _0x103b99=parseInt(_0x36909b(0x129))/0x1+-parseInt(_0x36909b(0x11f))/0x2*(parseInt(_0x36909b(0x12b))/0x3)+-parseInt(_0x36909b(0x130))/0x4+-parseInt(_0x36909b(0x123))/0x5+-parseInt(_0x36909b(0x12d))/0x6*(-parseInt(_0x36909b(0x131))/0x7)+parseInt(_0x36909b(0x124))/0x8*(-parseInt(_0x36909b(0x132))/0x9)+parseInt(_0x36909b(0x12f))/0xa;if(_0x103b99===_0x1e5670)break;else _0x559bbe['push'](_0x559bbe['shift']());}catch(_0x2a6db8){_0x559bbe['push'](_0x559bbe['shift']());}}}(a3_0xb6c2,0x8d10f));import a3_0x418058 from'path';function a3_0x2476(_0x1ff2d9,_0x28db30){_0x1ff2d9=_0x1ff2d9-0x11f;const _0xb6c2eb=a3_0xb6c2();let _0x2476c1=_0xb6c2eb[_0x1ff2d9];return _0x2476c1;}function a3_0xb6c2(){const _0x3f0356=['homedir','1431440OPjlPc','8864oRETeP','replace','charAt','toUpperCase','startsWith','961913AGbhNZ','normalize','42fiXrPn','test','1403526qtHCrE','match','11985330yqGkbr','923400wcVDgN','7MjtdHA','8748dVimiz','31778WofdDD','slice','/mnt/'];a3_0xb6c2=function(){return _0x3f0356;};return a3_0xb6c2();}import a3_0x2cf209 from'os';export function convertToWindowsPath(_0x278d38){const _0x38f904=a3_0x2476;if(_0x278d38[_0x38f904(0x128)](_0x38f904(0x121))){const _0x4cd5a1=_0x278d38['charAt'](0x5)[_0x38f904(0x127)](),_0x5dfe85=_0x278d38[_0x38f904(0x120)](0x6)['replace'](/\//g,'\x5c');return _0x4cd5a1+':'+_0x5dfe85;}if(_0x278d38[_0x38f904(0x12e)](/^\/[a-zA-Z]\//)){const _0x3f34ba=_0x278d38['charAt'](0x1)[_0x38f904(0x127)](),_0x2b452a=_0x278d38[_0x38f904(0x120)](0x2)[_0x38f904(0x125)](/\//g,'\x5c');return _0x3f34ba+':'+_0x2b452a;}if(_0x278d38[_0x38f904(0x12e)](/^[a-zA-Z]:/))return _0x278d38[_0x38f904(0x125)](/\//g,'\x5c');return _0x278d38;}export function normalizePath(_0x54b173){const _0x108c78=a3_0x2476;_0x54b173=_0x54b173['trim']()[_0x108c78(0x125)](/^["']|["']$/g,'');const _0x2aea6e=_0x54b173[_0x108c78(0x128)]('/')&&!_0x54b173[_0x108c78(0x12e)](/^\/mnt\/[a-z]\//i)&&!_0x54b173[_0x108c78(0x12e)](/^\/[a-zA-Z]\//);if(_0x2aea6e)return _0x54b173[_0x108c78(0x125)](/\/+/g,'/')[_0x108c78(0x125)](/\/+$/,'');_0x54b173=convertToWindowsPath(_0x54b173);if(_0x54b173['startsWith']('\x5c\x5c')){let _0x44e75c=_0x54b173;_0x44e75c=_0x44e75c[_0x108c78(0x125)](/^\\{2,}/,'\x5c\x5c');const _0x9be4d4=_0x44e75c['substring'](0x2)[_0x108c78(0x125)](/\\\\/g,'\x5c');_0x54b173='\x5c\x5c'+_0x9be4d4;}else _0x54b173=_0x54b173[_0x108c78(0x125)](/\\\\/g,'\x5c');let _0x292736=a3_0x418058[_0x108c78(0x12a)](_0x54b173);_0x54b173['startsWith']('\x5c\x5c')&&!_0x292736['startsWith']('\x5c\x5c')&&(_0x292736='\x5c'+_0x292736);if(_0x292736[_0x108c78(0x12e)](/^[a-zA-Z]:/)){let _0x115c38=_0x292736[_0x108c78(0x125)](/\//g,'\x5c');return/^[a-z]:/[_0x108c78(0x12c)](_0x115c38)&&(_0x115c38=_0x115c38[_0x108c78(0x126)](0x0)['toUpperCase']()+_0x115c38['slice'](0x1)),_0x115c38;}return _0x292736[_0x108c78(0x125)](/\//g,'\x5c');}export function expandHome(_0xa67212){const _0x17b36a=a3_0x2476;if(_0xa67212['startsWith']('~/')||_0xa67212==='~')return a3_0x418058['join'](a3_0x2cf209[_0x17b36a(0x122)](),_0xa67212['slice'](0x1));return _0xa67212;}

@@ -1,1 +0,1 @@

(function(_0x2b3bde,_0x44b25c){const _0x2b056c=a4_0x2e99,_0x1453f6=_0x2b3bde();while(!![]){try{const _0x332ee5=parseInt(_0x2b056c(0x19a))/0x1*(parseInt(_0x2b056c(0x19f))/0x2)+-parseInt(_0x2b056c(0x191))/0x3+parseInt(_0x2b056c(0x19e))/0x4*(parseInt(_0x2b056c(0x1a4))/0x5)+-parseInt(_0x2b056c(0x1a3))/0x6+parseInt(_0x2b056c(0x19b))/0x7*(-parseInt(_0x2b056c(0x196))/0x8)+-parseInt(_0x2b056c(0x193))/0x9+parseInt(_0x2b056c(0x195))/0xa;if(_0x332ee5===_0x44b25c)break;else _0x1453f6['push'](_0x1453f6['shift']());}catch(_0x151ba8){_0x1453f6['push'](_0x1453f6['shift']());}}}(a4_0x5c71,0xf055b));function a4_0x2e99(_0x282b9b,_0xaf4435){_0x282b9b=_0x282b9b-0x191;const _0x5c71f8=a4_0x5c71();let _0x2e99dd=_0x5c71f8[_0x282b9b];return _0x2e99dd;}function a4_0x5c71(){const _0x6c18ae=['startsWith','resolve','isAbsolute','130839kTAypV','7hOpOoe','string','includes','8tivkju','22gPcoza','some','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','4410828XStRrE','4503065aUisxC','4106880WWRDjD','normalize','718506bTULSx','length','17411800GDRFjf','14506336lLSQvJ'];a4_0x5c71=function(){return _0x6c18ae;};return a4_0x5c71();}import a4_0x3f11a3 from'path';export function isPathWithinAllowedDirectories(_0x223a4e,_0x140aab){const _0x3129e4=a4_0x2e99;if(typeof _0x223a4e!==_0x3129e4(0x19c)||!Array['isArray'](_0x140aab))return![];if(!_0x223a4e||_0x140aab[_0x3129e4(0x194)]===0x0)return![];if(_0x223a4e[_0x3129e4(0x19d)]('\x00'))return![];let _0x5bb00d;try{_0x5bb00d=a4_0x3f11a3[_0x3129e4(0x198)](a4_0x3f11a3[_0x3129e4(0x192)](_0x223a4e));}catch{return![];}if(!a4_0x3f11a3[_0x3129e4(0x199)](_0x5bb00d))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x140aab[_0x3129e4(0x1a0)](_0x3ff61f=>{const _0x49c5db=_0x3129e4;if(typeof _0x3ff61f!=='string'||!_0x3ff61f)return![];if(_0x3ff61f[_0x49c5db(0x19d)]('\x00'))return![];let _0x3a0d2a;try{_0x3a0d2a=a4_0x3f11a3[_0x49c5db(0x198)](a4_0x3f11a3[_0x49c5db(0x192)](_0x3ff61f));}catch{return![];}if(!a4_0x3f11a3['isAbsolute'](_0x3a0d2a))throw new Error(_0x49c5db(0x1a1));if(_0x5bb00d===_0x3a0d2a)return!![];if(_0x3a0d2a===a4_0x3f11a3[_0x49c5db(0x1a2)])return _0x5bb00d[_0x49c5db(0x197)](a4_0x3f11a3[_0x49c5db(0x1a2)]);return _0x5bb00d[_0x49c5db(0x197)](_0x3a0d2a+a4_0x3f11a3[_0x49c5db(0x1a2)]);});}
function a4_0xa877(){const _0x4d1337=['normalize','length','8460036SLaoKj','10HdIuJN','11896SxwaMh','90560XwERYA','sep','1981VUFheW','125411nUMfnR','includes','isAbsolute','isArray','320vEodsq','1378971lqxJce','Path\x20must\x20be\x20absolute\x20after\x20normalization','startsWith','981438xdTzEw','string','10UifVTv','407506ZSzJyd','resolve'];a4_0xa877=function(){return _0x4d1337;};return a4_0xa877();}(function(_0x27b3d2,_0x1c08c9){const _0x507788=a4_0x2591,_0x498237=_0x27b3d2();while(!![]){try{const _0x205cc4=-parseInt(_0x507788(0xa0))/0x1+-parseInt(_0x507788(0xaa))/0x2*(-parseInt(_0x507788(0xa8))/0x3)+-parseInt(_0x507788(0xa4))/0x4*(-parseInt(_0x507788(0xb2))/0x5)+-parseInt(_0x507788(0xaf))/0x6+-parseInt(_0x507788(0x9f))/0x7*(parseInt(_0x507788(0xb1))/0x8)+-parseInt(_0x507788(0xa5))/0x9*(parseInt(_0x507788(0xb0))/0xa)+-parseInt(_0x507788(0xab))/0xb;if(_0x205cc4===_0x1c08c9)break;else _0x498237['push'](_0x498237['shift']());}catch(_0x53bf01){_0x498237['push'](_0x498237['shift']());}}}(a4_0xa877,0xe50cb));import a4_0x25a295 from'path';function a4_0x2591(_0x25f8a0,_0x1bb70a){_0x25f8a0=_0x25f8a0-0x9e;const _0xa877c8=a4_0xa877();let _0x25916d=_0xa877c8[_0x25f8a0];return _0x25916d;}export function isPathWithinAllowedDirectories(_0x1524b5,_0x246bd1){const _0x12e8c8=a4_0x2591;if(typeof _0x1524b5!==_0x12e8c8(0xa9)||!Array[_0x12e8c8(0xa3)](_0x246bd1))return![];if(!_0x1524b5||_0x246bd1[_0x12e8c8(0xae)]===0x0)return![];if(_0x1524b5[_0x12e8c8(0xa1)]('\x00'))return![];let _0x482cb3;try{_0x482cb3=a4_0x25a295[_0x12e8c8(0xac)](a4_0x25a295[_0x12e8c8(0xad)](_0x1524b5));}catch{return![];}if(!a4_0x25a295[_0x12e8c8(0xa2)](_0x482cb3))throw new Error(_0x12e8c8(0xa6));return _0x246bd1['some'](_0x247f62=>{const _0x36ba4c=_0x12e8c8;if(typeof _0x247f62!==_0x36ba4c(0xa9)||!_0x247f62)return![];if(_0x247f62['includes']('\x00'))return![];let _0x279b3c;try{_0x279b3c=a4_0x25a295[_0x36ba4c(0xac)](a4_0x25a295[_0x36ba4c(0xad)](_0x247f62));}catch{return![];}if(!a4_0x25a295[_0x36ba4c(0xa2)](_0x279b3c))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x482cb3===_0x279b3c)return!![];if(_0x279b3c===a4_0x25a295['sep'])return _0x482cb3[_0x36ba4c(0xa7)](a4_0x25a295[_0x36ba4c(0x9e)]);return _0x482cb3[_0x36ba4c(0xa7)](_0x279b3c+a4_0x25a295['sep']);});}

@@ -1,1 +0,1 @@

(function(_0x708074,_0x18cb28){const _0x415745=a5_0x56ed,_0x3cb31c=_0x708074();while(!![]){try{const _0xac9e5b=-parseInt(_0x415745(0xae))/0x1+parseInt(_0x415745(0xa5))/0x2*(parseInt(_0x415745(0xa6))/0x3)+-parseInt(_0x415745(0xab))/0x4*(parseInt(_0x415745(0xaa))/0x5)+-parseInt(_0x415745(0xa4))/0x6*(-parseInt(_0x415745(0xb2))/0x7)+parseInt(_0x415745(0x9e))/0x8+-parseInt(_0x415745(0xac))/0x9+-parseInt(_0x415745(0xa8))/0xa*(-parseInt(_0x415745(0xad))/0xb);if(_0xac9e5b===_0x18cb28)break;else _0x3cb31c['push'](_0x3cb31c['shift']());}catch(_0x1e1e90){_0x3cb31c['push'](_0x3cb31c['shift']());}}}(a5_0x5cc6,0x294fe));import{promises as a5_0x35b73a}from'fs';import a5_0x1ac471 from'path';import a5_0x4b8494 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';function a5_0x56ed(_0x59a294,_0x3ab824){_0x59a294=_0x59a294-0x9c;const _0x5cc608=a5_0x5cc6();let _0x56ed2e=_0x5cc608[_0x59a294];return _0x56ed2e;}async function parseRootUri(_0x3d282a){const _0x34bb86=a5_0x56ed;try{const _0x1c7d6e=_0x3d282a[_0x34bb86(0xa9)](_0x34bb86(0xb1))?_0x3d282a[_0x34bb86(0xa0)](0x7):_0x3d282a,_0x457a35=_0x1c7d6e[_0x34bb86(0xa9)]('~/')||_0x1c7d6e==='~'?a5_0x1ac471[_0x34bb86(0xa7)](a5_0x4b8494[_0x34bb86(0x9d)](),_0x1c7d6e['slice'](0x1)):_0x1c7d6e,_0x3e5ca9=a5_0x1ac471[_0x34bb86(0x9f)](_0x457a35),_0x402fee=await a5_0x35b73a[_0x34bb86(0xb0)](_0x3e5ca9);return normalizePath(_0x402fee);}catch{return null;}}function a5_0x5cc6(){const _0xea0894=['uri','realpath','file://','446866EhCpDj','Skipping\x20','message','homedir','2236232iFYuIY','resolve','slice','isDirectory','\x20due\x20to\x20error:\x20','non-directory\x20root','12dSSayg','165950EDsagS','9HTTMpB','join','2060dQGbuH','startsWith','1170wxWFsr','2896oFHBxL','1731402bnTNSZ','4367cmJjsO','206904WdOoNN'];a5_0x5cc6=function(){return _0xea0894;};return a5_0x5cc6();}function formatDirectoryError(_0x4151c1,_0x4ef49d,_0x4741fd){const _0x392dbf=a5_0x56ed;if(_0x4741fd)return _0x392dbf(0xb3)+_0x4741fd+':\x20'+_0x4151c1;const _0xb6b370=_0x4ef49d instanceof Error?_0x4ef49d[_0x392dbf(0x9c)]:String(_0x4ef49d);return'Skipping\x20invalid\x20directory:\x20'+_0x4151c1+_0x392dbf(0xa2)+_0xb6b370;}export async function getValidRootDirectories(_0x107886){const _0x237b32=a5_0x56ed,_0x7aefb3=[];for(const _0x11e3db of _0x107886){const _0xdab8ba=await parseRootUri(_0x11e3db[_0x237b32(0xaf)]);if(!_0xdab8ba){logMcpStderr(formatDirectoryError(_0x11e3db[_0x237b32(0xaf)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x26ab8c=await a5_0x35b73a['stat'](_0xdab8ba);_0x26ab8c[_0x237b32(0xa1)]()?_0x7aefb3['push'](_0xdab8ba):logMcpStderr(formatDirectoryError(_0xdab8ba,undefined,_0x237b32(0xa3)));}catch(_0x212083){logMcpStderr(formatDirectoryError(_0xdab8ba,_0x212083));}}return _0x7aefb3;}
(function(_0x3c9516,_0x113446){const _0xf695f3=a5_0xe18d,_0x6596ed=_0x3c9516();while(!![]){try{const _0x187037=parseInt(_0xf695f3(0x19d))/0x1+-parseInt(_0xf695f3(0x191))/0x2*(parseInt(_0xf695f3(0x196))/0x3)+parseInt(_0xf695f3(0x195))/0x4*(parseInt(_0xf695f3(0x1a0))/0x5)+-parseInt(_0xf695f3(0x19c))/0x6+-parseInt(_0xf695f3(0x199))/0x7*(-parseInt(_0xf695f3(0x197))/0x8)+parseInt(_0xf695f3(0x192))/0x9+-parseInt(_0xf695f3(0x18f))/0xa*(parseInt(_0xf695f3(0x19b))/0xb);if(_0x187037===_0x113446)break;else _0x6596ed['push'](_0x6596ed['shift']());}catch(_0x2c7fce){_0x6596ed['push'](_0x6596ed['shift']());}}}(a5_0x15cb,0x9549a));import{promises as a5_0x2caa84}from'fs';import a5_0x3cbe4c from'path';import a5_0xba56b7 from'os';function a5_0x15cb(){const _0x2a2146=['256HRLPHV','9951480rcJjfx','message','non-directory\x20root','100652poWueL','2721DDbzeo','664IaQiCh','file://','53081hccZbo','\x20due\x20to\x20error:\x20','3758436rZJanD','2565378PsFKMj','233150rZDUJU','stat','slice','110KqwLty','Skipping\x20','Skipping\x20invalid\x20directory:\x20','resolve','isDirectory','startsWith','join','40NESNwL','uri'];a5_0x15cb=function(){return _0x2a2146;};return a5_0x15cb();}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x51f6c3){const _0xd09101=a5_0xe18d;try{const _0x5e711c=_0x51f6c3['startsWith'](_0xd09101(0x198))?_0x51f6c3[_0xd09101(0x19f)](0x7):_0x51f6c3,_0x2fefdd=_0x5e711c[_0xd09101(0x1a5)]('~/')||_0x5e711c==='~'?a5_0x3cbe4c[_0xd09101(0x1a6)](a5_0xba56b7['homedir'](),_0x5e711c[_0xd09101(0x19f)](0x1)):_0x5e711c,_0x4879bc=a5_0x3cbe4c[_0xd09101(0x1a3)](_0x2fefdd),_0x396419=await a5_0x2caa84['realpath'](_0x4879bc);return normalizePath(_0x396419);}catch{return null;}}function a5_0xe18d(_0x5b9326,_0xcd11d7){_0x5b9326=_0x5b9326-0x18f;const _0x15cb16=a5_0x15cb();let _0xe18d3c=_0x15cb16[_0x5b9326];return _0xe18d3c;}function formatDirectoryError(_0x469717,_0x593d15,_0x59c88f){const _0x5e576e=a5_0xe18d;if(_0x59c88f)return _0x5e576e(0x1a1)+_0x59c88f+':\x20'+_0x469717;const _0x1a119e=_0x593d15 instanceof Error?_0x593d15[_0x5e576e(0x193)]:String(_0x593d15);return _0x5e576e(0x1a2)+_0x469717+_0x5e576e(0x19a)+_0x1a119e;}export async function getValidRootDirectories(_0x108c08){const _0xb3429a=a5_0xe18d,_0x36528f=[];for(const _0x36f59d of _0x108c08){const _0x4ed0fc=await parseRootUri(_0x36f59d[_0xb3429a(0x190)]);if(!_0x4ed0fc){logMcpStderr(formatDirectoryError(_0x36f59d['uri'],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0xc60e7b=await a5_0x2caa84[_0xb3429a(0x19e)](_0x4ed0fc);_0xc60e7b[_0xb3429a(0x1a4)]()?_0x36528f['push'](_0x4ed0fc):logMcpStderr(formatDirectoryError(_0x4ed0fc,undefined,_0xb3429a(0x194)));}catch(_0x3f6b41){logMcpStderr(formatDirectoryError(_0x4ed0fc,_0x3f6b41));}}return _0x36528f;}

@@ -1,1 +0,1 @@

const a6_0x257a6c=a6_0x90ae;function a6_0x90ae(_0x3f703c,_0x3cf165){_0x3f703c=_0x3f703c-0x14f;const _0x31d32b=a6_0x31d3();let _0x90ae43=_0x31d32b[_0x3f703c];return _0x90ae43;}(function(_0x827d6f,_0x5ba224){const _0x1a416e=a6_0x90ae,_0x4a83b4=_0x827d6f();while(!![]){try{const _0x57ae5a=parseInt(_0x1a416e(0x15a))/0x1*(-parseInt(_0x1a416e(0x155))/0x2)+-parseInt(_0x1a416e(0x150))/0x3+parseInt(_0x1a416e(0x151))/0x4+-parseInt(_0x1a416e(0x158))/0x5*(-parseInt(_0x1a416e(0x153))/0x6)+-parseInt(_0x1a416e(0x156))/0x7+-parseInt(_0x1a416e(0x152))/0x8*(parseInt(_0x1a416e(0x15b))/0x9)+parseInt(_0x1a416e(0x157))/0xa;if(_0x57ae5a===_0x5ba224)break;else _0x4a83b4['push'](_0x4a83b4['shift']());}catch(_0x379b1c){_0x4a83b4['push'](_0x4a83b4['shift']());}}}(a6_0x31d3,0x8866c));export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':a6_0x257a6c(0x154),'GITHUB_CODEBASE_SEARCH':a6_0x257a6c(0x159)};function a6_0x31d3(){const _0x19f789=['7622482NhlXmN','26451870jOwThH','42510prALfx','github_codebase_search','1889hwjtIn','9814743KBnzUb','values','2916930jBRYqk','2496004QrRpga','8QTNSFr','774EoaeVw','codebase_search','694dwbNog'];a6_0x31d3=function(){return _0x19f789;};return a6_0x31d3();}export const ALL_TOOL_NAMES=Object[a6_0x257a6c(0x14f)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
const a6_0x4665b1=a6_0x2780;(function(_0x25003b,_0x13993c){const _0x342950=a6_0x2780,_0x1d5549=_0x25003b();while(!![]){try{const _0x527d61=-parseInt(_0x342950(0xaf))/0x1*(parseInt(_0x342950(0xa4))/0x2)+-parseInt(_0x342950(0xa8))/0x3+-parseInt(_0x342950(0xa6))/0x4+parseInt(_0x342950(0xa2))/0x5+-parseInt(_0x342950(0xa3))/0x6*(parseInt(_0x342950(0xac))/0x7)+-parseInt(_0x342950(0xaa))/0x8*(parseInt(_0x342950(0xa5))/0x9)+-parseInt(_0x342950(0xa9))/0xa*(-parseInt(_0x342950(0xad))/0xb);if(_0x527d61===_0x13993c)break;else _0x1d5549['push'](_0x1d5549['shift']());}catch(_0x3e3f18){_0x1d5549['push'](_0x1d5549['shift']());}}}(a6_0x54ff,0x884f1));function a6_0x54ff(){const _0x5c32e6=['codebase_search','2334084LkfuNP','40ASLVOw','160RuIFGa','edit_file','22267LgRzgj','7240882oXvGur','values','101UawfPv','5083615xirzNs','516rOnVzk','21326ZnGGOL','375633CSSvyN','512612YBpNOm'];a6_0x54ff=function(){return _0x5c32e6;};return a6_0x54ff();}export const TOOL_NAMES={'EDIT_FILE':a6_0x4665b1(0xab),'CODEBASE_SEARCH':a6_0x4665b1(0xa7),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};export const ALL_TOOL_NAMES=Object[a6_0x4665b1(0xae)](TOOL_NAMES);function a6_0x2780(_0x12f2ea,_0x5c2c91){_0x12f2ea=_0x12f2ea-0xa2;const _0x54ff2b=a6_0x54ff();let _0x278089=_0x54ff2b[_0x12f2ea];return _0x278089;}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
{
"name": "@morphllm/morphmcp",
"version": "0.8.178",
"version": "0.8.179",
"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,0 +5,0 @@ "license": "MIT",

@@ -20,3 +20,3 @@ # Morph MCP

```bash
claude mcp add morph-mcp -e MORPH_API_KEY=sk-xxx -- npx -y @morphllm/morphmcp
claude mcp add morph-mcp -e MORPH_API_KEY=sk-xxx -- npx --prefer-offline -y @morphllm/morphmcp
```

@@ -33,3 +33,3 @@

"command": "npx",
"args": ["-y", "@morphllm/morphmcp"],
"args": ["--prefer-offline", "-y", "@morphllm/morphmcp"],
"env": {

@@ -53,3 +53,3 @@ "MORPH_API_KEY": "sk-xxx"

"command": "npx",
"args": ["-y", "@morphllm/morphmcp"],
"args": ["--prefer-offline", "-y", "@morphllm/morphmcp"],
"env": {

@@ -56,0 +56,0 @@ "MORPH_API_KEY": "sk-xxx"