@morphllm/morphmcp 0.8.157 → 0.8.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x10d739=a0_0x14cf;(function(_0x25931c,_0x130c8a){const _0x2f1e8f=a0_0x14cf,_0x3fd1f1=_0x25931c();while(!![]){try{const _0x511946=-parseInt(_0x2f1e8f(0x217))/0x1*(parseInt(_0x2f1e8f(0x1dc))/0x2)+parseInt(_0x2f1e8f(0x26e))/0x3*(-parseInt(_0x2f1e8f(0x238))/0x4)+-parseInt(_0x2f1e8f(0x205))/0x5*(-parseInt(_0x2f1e8f(0x1c0))/0x6)+-parseInt(_0x2f1e8f(0x23e))/0x7*(-parseInt(_0x2f1e8f(0x1a9))/0x8)+parseInt(_0x2f1e8f(0x212))/0x9+parseInt(_0x2f1e8f(0x1f6))/0xa*(-parseInt(_0x2f1e8f(0x195))/0xb)+parseInt(_0x2f1e8f(0x19c))/0xc*(-parseInt(_0x2f1e8f(0x20c))/0xd);if(_0x511946===_0x130c8a)break;else _0x3fd1f1['push'](_0x3fd1f1['shift']());}catch(_0x3dfd0c){_0x3fd1f1['push'](_0x3fd1f1['shift']());}}}(a0_0x323f,0x90c86));function a0_0x14cf(_0x251874,_0x4ecd33){_0x251874=_0x251874-0x195;const _0x323ff6=a0_0x323f();let _0x14cf39=_0x323ff6[_0x251874];return _0x14cf39;}import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x49b6f5 from'fs/promises';import a0_0x11fbeb from'path';import a0_0x7bb45d from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';function a0_0x323f(){const _0x4f05ac=['substring','grep_search','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Failed\x20to\x20request\x20roots\x20from\x20client:','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','instruction','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','exit','source','\x22>\x0a','env','@morphllm/morphmcp\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','lines','290480LrEhIN','morph-v3-fast','includes','Morph\x20FastApply\x20failed\x20without\x20error\x20message','morph-warp-grep-v2.1','\x20chars)','[could\x20not\x20read\x20file:\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','SubToolError','push','pyproject.toml','etimedout','--version','[github_codebase_search]\x20Searching\x20','realpath','20BXOFeK','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','completionId','name','has','access','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','325SbemOn','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','log','MORPH_WARP_GREP_TIMEOUT','instructions','all','10640088dVoisU','linesRemoved','../package.json','homedir','floor','11qBAGPU','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','listRoots','-\x20Read\x20file\x20`','warn','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','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','Error\x20running\x20fast\x20context\x20search:\x20','description','Here\x20is\x20the\x20content\x20of\x20files:\x0a','Morph\x20Edit\x20Preview','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','\x20-\x20','Workspace\x20mode\x20enabled:\x20Using\x20','added\x20','split','ReadError','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','inputSchema','list_directory','error','Invalid\x20arguments:\x20','timed\x20out','\x0aOptions:','Disabled\x20tools:\x20','stringify','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','\x20\x20morph-mcp','connect','Warning:\x20','Applied','object',',\x20removed\x20','4nYbfmt','mcp-filesystem','TimeoutError','GitHub\x20search\x20failed:\x20','\x20valid\x20directories','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','91hhcPli','0.2.0','glob','trim','cwd','status','match','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','startsWith','list_directory\x20','oninitialized','owner_repo','context','code','map','stack','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','Morph\x20Edit\x20','arguments','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','SymlinkError','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','array','response','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','filter','completed','boolean','normalize','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','linesModified','isDirectory','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.',',\x20modified\x20','command','payload','toLowerCase','RipgrepNotAvailable','edit_file','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','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','tool_call_id','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','pattern','WarpGrepError','MORPH_API_URL','1392981qcZlBM','timeout','isArray','getClientCapabilities','roots','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','tool_calls','codebase_search','search_type','sep','constructor','-\x20Grepped\x20\x27','describe','content','[github_codebase_search]\x20Done\x20in\x20','application/json','search_string','branch','length','\x27\x20in\x20`','grep\x20\x27','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','slice','\x20error(s)','indexOf','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','requiresApiKey','https://morphllm.com/api/error-report','join','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','\x20is\x20not\x20a\x20directory','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.','\x0aExamples:','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','readFile','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','enum','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.','Fatal\x20error\x20running\x20server:','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.','params','read','github_url','data','ToolException','searchGitHub','ms:','Parent\x20directory\x20does\x20not\x20exist:\x20','[github_codebase_search]\x20Failed\x20in\x20','<file\x20path=\x22','\x20for:\x20\x22','dryRun','metadata','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','.\x20Path:\x20','WORKSPACE_ROOT','44zsgirh','Preview\x20changes\x20without\x20applying\x20them.','FileReadError','Unknown\x20error','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','Failed\x20to\x20read\x20file:\x20','safeParse','140172wGznxS','ENOENT','setNotificationHandler','package.json','BinaryFile','function','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.','Max\x20results\x20to\x20return','For\x20deletions:\x0a','parse','DISABLED_TOOLS','glob\x20\x27','text','59080bpnedo','github_codebase_search','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','utf-8','.\x20Changes:\x20','\x0a</file>','-\x20Listed\x20directory\x20`','--help','Bearer\x20','--api-key','false','stat','--api-key=','timings','catch','Rules:\x0a','dirname','setRequestHandler','basename','number','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','UnknownError','.git','1741272WCfbEK','Error:\x20','FileNotFound','resolve','errors','unknown','default','Repository\x20identifier','terminated','success','messages','node_modules','File\x20read\x20error:','terminationReason','string','sk-','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','repo_path','finish','message','code_edit','grep','Specific\x20commit\x20hash\x20to\x20search','optional','Relevant\x20context\x20found:','\x0a...\x20(truncated,\x20total:\x20','role','Benefits:\x0a','177002fAGthD','path','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','MORPH_API_KEY','files','now','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.','\x22.\x20Known\x20tools:\x20','assistant'];a0_0x323f=function(){return _0x4f05ac;};return a0_0x323f();}import a0_0x1221e4 from'axios';function fixPathRepetition(_0x40608a){const _0x32838d=a0_0x14cf,_0x138b1c=_0x40608a[_0x32838d(0x226)](a0_0x11fbeb[_0x32838d(0x277)])[_0x32838d(0x259)](Boolean);if(_0x138b1c[_0x32838d(0x280)]<0x2)return null;for(let _0x33ae7e=Math[_0x32838d(0x216)](_0x138b1c[_0x32838d(0x280)]/0x2);_0x33ae7e>=0x1;_0x33ae7e--){for(let _0x4b66c3=0x0;_0x4b66c3<=_0x138b1c[_0x32838d(0x280)]-0x2*_0x33ae7e;_0x4b66c3++){const _0x2a03a9=_0x138b1c['slice'](_0x4b66c3,_0x4b66c3+_0x33ae7e),_0x1b4602=_0x138b1c['slice'](_0x4b66c3+_0x33ae7e,_0x4b66c3+0x2*_0x33ae7e);if(_0x2a03a9['every']((_0x30017d,_0xc429e6)=>_0x30017d===_0x1b4602[_0xc429e6])){const _0x36548f=[..._0x138b1c[_0x32838d(0x284)](0x0,_0x4b66c3),..._0x138b1c[_0x32838d(0x284)](_0x4b66c3+_0x33ae7e)];return a0_0x11fbeb[_0x32838d(0x277)]+_0x36548f[_0x32838d(0x28a)](a0_0x11fbeb[_0x32838d(0x277)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4d9cbc=a0_0x14cf;try{const _0x4e3475=require(_0x4d9cbc(0x214));return _0x4e3475['version']??_0x4d9cbc(0x1c5);}catch(_0x1b02c2){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x1b02c2),_0x4d9cbc(0x1c5);}}function printHelp(){const _0x485a68=a0_0x14cf;console[_0x485a68(0x20e)](_0x485a68(0x1f3)+getPackageVersion()),console['log'](_0x485a68(0x283)),console['log'](_0x485a68(0x22e)),console['log'](_0x485a68(0x1d0)),console[_0x485a68(0x20e)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x485a68(0x20e)](_0x485a68(0x20b)),console[_0x485a68(0x20e)](_0x485a68(0x28e)),console[_0x485a68(0x20e)](_0x485a68(0x232)),console[_0x485a68(0x20e)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0x10d739(0x284)](0x2),VERSION_FLAGS=new Set([a0_0x10d739(0x202),'-v','-V']),HELP_FLAGS=new Set([a0_0x10d739(0x1b0),'-h']);cliArgs['some'](_0x2706e3=>VERSION_FLAGS[a0_0x10d739(0x209)](_0x2706e3))&&(console[a0_0x10d739(0x20e)]('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x10d739(0x1ef)](0x0));cliArgs['some'](_0x30ef2f=>HELP_FLAGS[a0_0x10d739(0x209)](_0x30ef2f))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x34a9ed){const _0xa24fd4=a0_0x10d739;for(let _0x177ce6=0x0;_0x177ce6<cliArgs[_0xa24fd4(0x280)];_0x177ce6++){const _0x81d3b=cliArgs[_0x177ce6];if(_0x81d3b[_0xa24fd4(0x246)]('--'+_0x34a9ed+'='))return _0x81d3b[_0xa24fd4(0x284)](('--'+_0x34a9ed+'=')['length']);if(_0x81d3b==='--'+_0x34a9ed&&_0x177ce6+0x1<cliArgs['length'])return cliArgs[_0x177ce6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x10d739(0x280)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x10d739(0x209)](arg)||HELP_FLAGS[a0_0x10d739(0x209)](arg))continue;if(arg[a0_0x10d739(0x246)](a0_0x10d739(0x1b5)))continue;if(arg===a0_0x10d739(0x1b2)){i++;continue;}args[a0_0x10d739(0x1ff)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x10d739(0x2a5)]||process[a0_0x10d739(0x1f2)]['PWD']||process[a0_0x10d739(0x242)](),ENABLE_WORKSPACE_MODE=process[a0_0x10d739(0x1f2)]['ENABLE_WORKSPACE_MODE']!==a0_0x10d739(0x1b3),MORPH_API_KEY=getCliArg('api-key')??process['env'][a0_0x10d739(0x1e1)],MORPH_API_URL=process[a0_0x10d739(0x1f2)][a0_0x10d739(0x26d)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x10d739(0x1f2)][a0_0x10d739(0x20f)]?parseInt(process[a0_0x10d739(0x1f2)][a0_0x10d739(0x20f)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x10d739(0x266),a0_0x10d739(0x275),'github_codebase_search']),DISABLED_TOOLS=process[a0_0x10d739(0x1f2)][a0_0x10d739(0x1a6)]?new Set(process[a0_0x10d739(0x1f2)][a0_0x10d739(0x1a6)][a0_0x10d739(0x226)](',')[a0_0x10d739(0x24c)](_0x3488aa=>_0x3488aa[a0_0x10d739(0x241)]())['filter'](_0xee6ddc=>_0xee6ddc[a0_0x10d739(0x280)]>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x10d739(0x22b)](a0_0x10d739(0x255)+tool+a0_0x10d739(0x1e5)+[...KNOWN_TOOL_NAMES][a0_0x10d739(0x28a)](',\x20'));}console[a0_0x10d739(0x22b)](a0_0x10d739(0x22f)+[...DISABLED_TOOLS][a0_0x10d739(0x28a)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY[a0_0x10d739(0x246)]('morph-')&&logMcpStderr(a0_0x10d739(0x222));async function reportMorphError(_0x4cc09b){const _0x2573ac=a0_0x10d739;try{await a0_0x1221e4['post'](_0x2573ac(0x289),{..._0x4cc09b,'timestamp':new Date()['toISOString'](),'source':_0x4cc09b[_0x2573ac(0x1f0)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4cc09b[_0x2573ac(0x24a)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x2573ac(0x27d),'Authorization':_0x2573ac(0x1b1)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x41a649,_0x13a539){const _0x4189b4=a0_0x10d739;if(_0x41a649&&typeof _0x41a649===_0x4189b4(0x236)&&_0x4189b4(0x243)in _0x41a649)return _0x41a649[_0x4189b4(0x243)];if(_0x41a649&&typeof _0x41a649===_0x4189b4(0x236)&&_0x4189b4(0x257)in _0x41a649)return _0x41a649[_0x4189b4(0x257)]?.[_0x4189b4(0x243)];const _0x279230=_0x13a539[_0x4189b4(0x244)](/\b(401|429)\b/);return _0x279230?parseInt(_0x279230[0x1],0xa):null;}function handleMorphAPIError(_0x569540){const _0x188309=a0_0x10d739,_0x41ea9c=_0x569540 instanceof Error?_0x569540[_0x188309(0x1d3)]:String(_0x569540),_0x3d9dc4=extractStatusCode(_0x569540,_0x41ea9c);switch(_0x3d9dc4){case 0x191:return{'content':[{'type':_0x188309(0x1a8),'text':_0x188309(0x293)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':'Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.'}],'isError':!![]};default:return null;}}args[a0_0x10d739(0x280)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x10d739(0x1ee)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x10d739(0x267)),logMcpStderr(a0_0x10d739(0x273)),logMcpStderr(a0_0x10d739(0x1fd)));function normalizePath(_0x563a61){const _0x4a8f80=a0_0x10d739;return a0_0x11fbeb[_0x4a8f80(0x25c)](_0x563a61);}function expandHome(_0x57a98a){const _0x32b1cf=a0_0x10d739;if(_0x57a98a[_0x32b1cf(0x246)]('~/')||_0x57a98a==='~')return a0_0x11fbeb[_0x32b1cf(0x28a)](a0_0x7bb45d[_0x32b1cf(0x215)](),_0x57a98a[_0x32b1cf(0x284)](0x1));return _0x57a98a;}let allowedDirectories=await Promise[a0_0x10d739(0x211)](args['map'](async _0x34b22d=>{const _0x2be306=a0_0x10d739,_0x3fa3cd=expandHome(_0x34b22d),_0x3c0633=a0_0x11fbeb[_0x2be306(0x1c3)](_0x3fa3cd);try{const _0x4dbac2=await a0_0x49b6f5[_0x2be306(0x204)](_0x3c0633);return normalizePath(_0x4dbac2);}catch(_0x44f299){return normalizePath(_0x3c0633);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x10d739(0x1ff)](workspaceDir),logMcpStderr(a0_0x10d739(0x224)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x51c2d9){logMcpStderr(a0_0x10d739(0x228)+a0_0x51c2d9);}async function detectWorkspaceRoot(_0x5a42ae){const _0x13c060=a0_0x10d739;let _0x2f732e=a0_0x11fbeb[_0x13c060(0x1c3)](_0x5a42ae);const _0x2300ad=[_0x13c060(0x1bf),'.vscode',_0x13c060(0x19f),'Cargo.toml',_0x13c060(0x200),'go.mod','.cursor','tsconfig.json','composer.json'];while(_0x2f732e!==a0_0x11fbeb['dirname'](_0x2f732e)){for(const _0x470050 of _0x2300ad){const _0x3af959=a0_0x11fbeb[_0x13c060(0x28a)](_0x2f732e,_0x470050);try{return await a0_0x49b6f5[_0x13c060(0x20a)](_0x3af959),normalizePath(_0x2f732e);}catch{}}_0x2f732e=a0_0x11fbeb[_0x13c060(0x1b9)](_0x2f732e);}return normalizePath(_0x5a42ae);}await Promise[a0_0x10d739(0x211)](args[a0_0x10d739(0x24c)](async _0x30ee42=>{const _0x3b522a=a0_0x10d739;try{const _0x13752d=await a0_0x49b6f5[_0x3b522a(0x1b4)](expandHome(_0x30ee42));!_0x13752d[_0x3b522a(0x25f)]()&&(logMcpStderr(_0x3b522a(0x1c1)+_0x30ee42+_0x3b522a(0x28c)),process[_0x3b522a(0x1ef)](0x1));}catch(_0x535e48){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x30ee42+':',_0x535e48),process[_0x3b522a(0x1ef)](0x1);}}));async function validatePath(_0x460738){const _0x5a3b05=a0_0x10d739,_0x1de9e7=expandHome(_0x460738),_0x3ce312=a0_0x11fbeb[_0x5a3b05(0x1c3)](_0x1de9e7);try{const _0x118762=await a0_0x49b6f5[_0x5a3b05(0x204)](_0x3ce312);return _0x118762;}catch(_0x3c8d7d){if(_0x3c8d7d[_0x5a3b05(0x24b)]===_0x5a3b05(0x19d)){const _0x2a8b2f=a0_0x11fbeb[_0x5a3b05(0x1b9)](_0x3ce312);try{const _0x1be535=await a0_0x49b6f5[_0x5a3b05(0x204)](_0x2a8b2f);return a0_0x11fbeb[_0x5a3b05(0x28a)](_0x1be535,a0_0x11fbeb[_0x5a3b05(0x1bb)](_0x3ce312));}catch{throw new Error(_0x5a3b05(0x29d)+_0x2a8b2f);}}throw _0x3c8d7d;}}const MorphEditFileArgsSchema=z[a0_0x10d739(0x236)]({'path':z['string'](),'code_edit':z[a0_0x10d739(0x1ce)]()['describe'](a0_0x10d739(0x28b)),'instruction':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x27a)](a0_0x10d739(0x25d)),'dryRun':z[a0_0x10d739(0x25b)]()[a0_0x10d739(0x1c6)](![])['describe'](a0_0x10d739(0x196))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x10d739(0x1e4),WarpGrepArgsSchema=z[a0_0x10d739(0x236)]({'search_string':z['string']()[a0_0x10d739(0x27a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x27a)](a0_0x10d739(0x268)),'search_type':z[a0_0x10d739(0x292)]([a0_0x10d739(0x1c6),a0_0x10d739(0x1cb)])[a0_0x10d739(0x1d7)]()[a0_0x10d739(0x27a)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x10d739(0x236)]({'search_string':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x27a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x1d7)]()[a0_0x10d739(0x27a)](a0_0x10d739(0x1a2)),'owner_repo':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x1d7)]()[a0_0x10d739(0x27a)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z['string']()[a0_0x10d739(0x1d7)]()['describe'](a0_0x10d739(0x245))}),CodebaseSearchArgsSchema=z[a0_0x10d739(0x236)]({'query':z['string']()[a0_0x10d739(0x27a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x27a)](a0_0x10d739(0x1c7)),'branch':z['string']()['optional']()[a0_0x10d739(0x27a)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x10d739(0x1ce)]()[a0_0x10d739(0x1d7)]()['describe'](a0_0x10d739(0x1d6)),'targetDirectories':z[a0_0x10d739(0x256)](z[a0_0x10d739(0x1ce)]())[a0_0x10d739(0x1c6)]([])['describe'](a0_0x10d739(0x1df)),'limit':z[a0_0x10d739(0x1bc)]()[a0_0x10d739(0x1d7)]()['default'](0xa)[a0_0x10d739(0x27a)](a0_0x10d739(0x1a3))}),server=new Server({'name':'morph-mcp','version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x10d739(0x1ba)](ListToolsRequestSchema,async()=>{const _0x308370=a0_0x10d739,_0x222df2=[{'name':_0x308370(0x266),'description':_0x308370(0x28f)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x308370(0x206)+_0x308370(0x1db)+_0x308370(0x20d)+_0x308370(0x24e)+_0x308370(0x1ec)+_0x308370(0x21d)+_0x308370(0x253)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x308370(0x1a4)+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+_0x308370(0x218)+_0x308370(0x1b8)+_0x308370(0x1f4)+_0x308370(0x2a3)+_0x308370(0x1e9)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x308370(0x1bd)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x308370(0x199),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x308370(0x275),'description':_0x308370(0x21c)+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'+_0x308370(0x26a)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x55dcbe=_0x222df2['filter'](_0x236cdf=>{const _0x58d859=_0x308370;if(DISABLED_TOOLS[_0x58d859(0x209)](_0x236cdf['name']))return console[_0x58d859(0x22b)]('Tool\x20'+_0x236cdf[_0x58d859(0x208)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x58d859(0x288)in _0x236cdf&&_0x236cdf[_0x58d859(0x288)]&&!MORPH_API_KEY)return logMcpStderr(_0x58d859(0x234)+_0x236cdf[_0x58d859(0x208)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x55dcbe[_0x308370(0x24c)](_0x162a8b=>({'name':_0x162a8b[_0x308370(0x208)],'description':_0x162a8b[_0x308370(0x21f)],'inputSchema':_0x162a8b[_0x308370(0x229)]}))};}),server[a0_0x10d739(0x1ba)](CallToolRequestSchema,async _0x172d88=>{const _0x2066e3=a0_0x10d739,{name:_0x1a7f10,arguments:_0x36826a}=_0x172d88[_0x2066e3(0x296)];try{if(!MORPH_API_KEY)return{'content':[{'type':_0x2066e3(0x1a8),'text':_0x2066e3(0x231)}],'isError':!![]};if(!MORPH_API_KEY[_0x2066e3(0x246)](_0x2066e3(0x1cf))&&!MORPH_API_KEY['startsWith']('morph-'))return{'content':[{'type':_0x2066e3(0x1a8),'text':_0x2066e3(0x295)}],'isError':!![]};if(DISABLED_TOOLS[_0x2066e3(0x209)](_0x1a7f10))throw new Error('Tool\x20\x22'+_0x1a7f10+'\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable');switch(_0x1a7f10){case'edit_file':{const _0x250468=_0x36826a&&typeof _0x36826a===_0x2066e3(0x236)&&_0x2066e3(0x210)in _0x36826a&&!('instruction'in _0x36826a)?{..._0x36826a,'instruction':_0x36826a[_0x2066e3(0x210)],'instructions':undefined}:_0x36826a,_0x53bf71=MorphEditFileArgsSchema[_0x2066e3(0x19b)](_0x250468);if(!_0x53bf71['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x53bf71[_0x2066e3(0x22b)]);const _0x2eb369=await validatePath(_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1dd)]);let _0x55163f=null,_0x5d33cd=!![],_0x1d4476=null;try{_0x55163f=await a0_0x49b6f5[_0x2066e3(0x290)](_0x2eb369,_0x2066e3(0x1ac));}catch(_0x2e12ff){const _0x2efa77=_0x2e12ff['code'];_0x2efa77===_0x2066e3(0x19d)?(_0x5d33cd=![],_0x55163f=''):(_0x1d4476=_0x2066e3(0x19a)+(_0x2efa77||_0x2066e3(0x1c5))+_0x2066e3(0x223)+(_0x2e12ff instanceof Error?_0x2e12ff[_0x2066e3(0x1d3)]:String(_0x2e12ff)),logMcpStderr('Warning:\x20'+_0x1d4476));}let _0x4b7d9a;try{const _0x14e4e7=MORPH_API_KEY;if(!_0x14e4e7)throw new Error(_0x2066e3(0x260));const _0x59bbab=a0_0x11fbeb[_0x2066e3(0x1b9)](_0x2eb369),_0x34e75c=a0_0x11fbeb[_0x2066e3(0x1bb)](_0x2eb369),_0x25d681=await executeEditFile({'target_filepath':_0x34e75c,'code_edit':_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1d4)],'instruction':_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1ed)]},{'morphApiKey':_0x14e4e7,'morphApiUrl':MORPH_API_URL,'baseDir':_0x59bbab,'autoWrite':!_0x53bf71['data'][_0x2066e3(0x2a1)],'generateUdiff':![],'debug':![]});_0x4b7d9a=_0x25d681[_0x2066e3(0x207)];if(!_0x25d681[_0x2066e3(0x1c9)])throw new Error(_0x25d681[_0x2066e3(0x22b)]||_0x2066e3(0x1f9));const _0x10d3d2=_0x25d681['changes'],_0x37b361=_0x2066e3(0x225)+_0x10d3d2['linesAdded']+_0x2066e3(0x237)+_0x10d3d2[_0x2066e3(0x213)]+_0x2066e3(0x261)+_0x10d3d2[_0x2066e3(0x25e)];if(_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x2a1)])return{'content':[{'type':'text','text':_0x2066e3(0x221)+(_0x5d33cd?'':'\x20(new\x20file)')+':\x20'+_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1ed)]+_0x2066e3(0x1ad)+_0x37b361+_0x2066e3(0x2a4)+_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1dd)]+'.'}]};return{'content':[{'type':_0x2066e3(0x1a8),'text':_0x2066e3(0x24f)+(_0x5d33cd?_0x2066e3(0x235):'Created\x20File')+':\x20'+_0x53bf71[_0x2066e3(0x299)]['instruction']+_0x2066e3(0x1ad)+_0x37b361+'.\x20Path:\x20'+_0x53bf71['data'][_0x2066e3(0x1dd)]+'.'}]};}catch(_0x4ac705){const _0x2f1d87=handleMorphAPIError(_0x4ac705);if(_0x2f1d87)return _0x2f1d87;const _0x4925a8=_0x4ac705 instanceof Error?_0x4ac705[_0x2066e3(0x1d3)]:String(_0x4ac705);return reportMorphError({'error_message':_0x4925a8,'error_type':_0x4ac705 instanceof Error?_0x4ac705['constructor'][_0x2066e3(0x208)]:_0x2066e3(0x1be),'context':{'tool':'edit_file','completion_id':_0x4b7d9a,'file_path':_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1dd)],'validated_path':_0x2eb369,'instruction':_0x53bf71['data'][_0x2066e3(0x1ed)],'model':_0x2066e3(0x1f7),'dry_run':_0x53bf71['data'][_0x2066e3(0x2a1)],'file_exists':_0x5d33cd,'file_read_error':_0x1d4476,'file_readable':_0x55163f!==null,'request_content':{'path':_0x53bf71[_0x2066e3(0x299)][_0x2066e3(0x1dd)],'code_edit':_0x53bf71[_0x2066e3(0x299)]['code_edit'],'instruction':_0x53bf71['data'][_0x2066e3(0x1ed)],'original_code':_0x55163f!==null?_0x55163f['length']>0xc350?_0x55163f['substring'](0x0,0xc350)+_0x2066e3(0x1d9)+_0x55163f[_0x2066e3(0x280)]+_0x2066e3(0x1fb):_0x55163f:_0x2066e3(0x1fc)+(_0x1d4476||'unknown\x20error')+']','original_code_length':_0x55163f?.['length']??0x0,'model':_0x2066e3(0x1f7),'dry_run':_0x53bf71['data']['dryRun']}},'stack_trace':_0x4ac705 instanceof Error?_0x4ac705[_0x2066e3(0x24d)]:undefined,'source':_0x2066e3(0x239)})[_0x2066e3(0x1b7)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x4925a8}],'isError':!![]};}}case _0x2066e3(0x275):{const _0x3018e7=WarpGrepArgsSchema[_0x2066e3(0x19b)](_0x36826a);if(!_0x3018e7[_0x2066e3(0x1c9)])return{'content':[{'type':_0x2066e3(0x1a8),'text':_0x2066e3(0x22c)+_0x3018e7['error']}],'isError':!![]};const _0x4e0457=_0x387a4d=>{const _0x2a4b01=_0x2066e3,_0xcf33ba=[];for(const _0x18c322 of _0x387a4d||[]){if(_0x18c322[_0x2a4b01(0x1da)]===_0x2a4b01(0x1e6)&&Array[_0x2a4b01(0x270)](_0x18c322[_0x2a4b01(0x274)]))for(const _0x23fd1f of _0x18c322[_0x2a4b01(0x274)]){try{const _0x534c10=_0x23fd1f[_0x2a4b01(0x1a1)]?.['name'],_0x34810a=JSON[_0x2a4b01(0x1a5)](_0x23fd1f[_0x2a4b01(0x1a1)]?.['arguments']||'{}');if(_0x534c10===_0x2a4b01(0x1e8))_0xcf33ba['push'](_0x2a4b01(0x282)+_0x34810a[_0x2a4b01(0x26b)]+'\x27\x20'+(_0x34810a[_0x2a4b01(0x1dd)]||'.'));else{if(_0x534c10===_0x2a4b01(0x297))_0xcf33ba[_0x2a4b01(0x1ff)]('read\x20'+_0x34810a[_0x2a4b01(0x1dd)]);else{if(_0x534c10===_0x2a4b01(0x22a))_0xcf33ba[_0x2a4b01(0x1ff)](_0x2a4b01(0x247)+(_0x34810a[_0x2a4b01(0x262)]||'.'));else{if(_0x534c10==='glob')_0xcf33ba[_0x2a4b01(0x1ff)](_0x2a4b01(0x1a7)+_0x34810a[_0x2a4b01(0x26b)]+'\x27\x20'+(_0x34810a[_0x2a4b01(0x1dd)]||'.'));else _0x534c10===_0x2a4b01(0x1d2)&&_0xcf33ba[_0x2a4b01(0x1ff)](_0x2a4b01(0x1d2));}}}}catch{}}}return _0xcf33ba;},_0x43911b=_0xe01f67=>{const _0x2fbdd6=_0x2066e3,_0x152324=[];if(!_0xe01f67||!Array[_0x2fbdd6(0x270)](_0xe01f67))return _0x152324;const _0x597b00=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2fbdd6(0x1c2),'tool':_0x2fbdd6(0x297)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x2fbdd6(0x297)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2fbdd6(0x227),'tool':_0x2fbdd6(0x297)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2fbdd6(0x1a0),'tool':_0x2fbdd6(0x297)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x2fbdd6(0x1d5)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2fbdd6(0x265),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2fbdd6(0x1a0),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x2fbdd6(0x254),'tool':_0x2fbdd6(0x297)},{'pattern':/not a text file/,'error_type':_0x2fbdd6(0x1a0),'tool':_0x2fbdd6(0x297)},{'pattern':/symbolic link/,'error_type':_0x2fbdd6(0x254),'tool':_0x2fbdd6(0x297)},{'pattern':/Error reading file:/,'error_type':_0x2fbdd6(0x227),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x2fbdd6(0x29a),'tool':_0x2fbdd6(0x1c5)}];let _0x1ed04a=0x0;for(const _0x7f45fe of _0xe01f67){_0x7f45fe[_0x2fbdd6(0x1da)]===_0x2fbdd6(0x1e6)&&Array[_0x2fbdd6(0x270)](_0x7f45fe[_0x2fbdd6(0x274)])&&_0x1ed04a++;const _0x462fbc=_0x7f45fe[_0x2fbdd6(0x27b)];if((_0x7f45fe[_0x2fbdd6(0x1da)]==='tool'||_0x7f45fe[_0x2fbdd6(0x1da)]==='user')&&_0x462fbc&&typeof _0x462fbc===_0x2fbdd6(0x1ce))for(const {pattern:_0x29c2e3,error_type:_0x18bf3d,tool:_0x3e20ec}of _0x597b00){const _0x329093=_0x462fbc[_0x2fbdd6(0x244)](new RegExp(_0x29c2e3['source'],'g'));if(_0x329093)for(const _0xc45fd2 of _0x329093){const _0x211efe=_0x462fbc[_0x2fbdd6(0x286)](_0xc45fd2),_0xa7fc0f=_0x462fbc[_0x2fbdd6(0x1e7)](_0x211efe,Math['min'](_0x211efe+0xc8,_0x462fbc['length']));_0x152324[_0x2fbdd6(0x1ff)]({'tool':_0x3e20ec,'error_type':_0x18bf3d,'error_message':_0xa7fc0f[_0x2fbdd6(0x226)]('\x0a')[0x0],'turn':_0x1ed04a});}}}return _0x152324;};try{const _0x191e95=a0_0x11fbeb[_0x2066e3(0x1c3)](_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)]),_0x15fe65=_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x276)],_0xb5c800=_0x15fe65===_0x2066e3(0x1cb)?{'allowNames':['node_modules']}:undefined,_0x1e8bc7=new LocalRipgrepProvider(_0x191e95,undefined,_0xb5c800),_0x56667d=await runWarpGrep({'searchTerm':_0x3018e7['data'][_0x2066e3(0x27e)],'repoRoot':_0x191e95,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1e8bc7,'search_type':_0x15fe65}),_0x2926fd=_0x43911b(_0x56667d[_0x2066e3(0x1ca)]);_0x2926fd[_0x2066e3(0x280)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2926fd['length']+_0x2066e3(0x285),'error_type':_0x2066e3(0x1fe),'level':_0x2066e3(0x21b),'tool':_0x2066e3(0x275),'context':{'repo_path':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)],'query':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x27e)],'model':_0x2066e3(0x1fa),'termination_reason':_0x56667d[_0x2066e3(0x1cd)],'sub_tool_errors':_0x2926fd,'timings':_0x56667d['timings'],'tool_calls':_0x4e0457(_0x56667d[_0x2066e3(0x1ca)]),'messages':_0x56667d['messages']?.[_0x2066e3(0x24c)](_0x359dd2=>({'role':_0x359dd2[_0x2066e3(0x1da)],'content':_0x359dd2['content'],..._0x359dd2['tool_calls']?{'tool_calls':_0x359dd2[_0x2066e3(0x274)][_0x2066e3(0x280)]}:{},..._0x359dd2[_0x2066e3(0x269)]?{'tool_call_id':_0x359dd2[_0x2066e3(0x269)]}:{}}))},'source':_0x2066e3(0x239)})['catch'](()=>{});let _0xffd7c8='';if(_0x56667d['terminationReason']===_0x2066e3(0x25a)&&_0x56667d[_0x2066e3(0x1d2)]?.[_0x2066e3(0x2a2)]?.[_0x2066e3(0x1e2)]){const _0x509d1e=_0x56667d['finish'][_0x2066e3(0x2a2)][_0x2066e3(0x1e2)];if(_0x509d1e[_0x2066e3(0x280)]===0x0)return _0xffd7c8=_0x56667d[_0x2066e3(0x1d2)][_0x2066e3(0x263)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x2066e3(0x1a8),'text':_0xffd7c8}]};const _0x354e59=[],_0x17816c=[_0x2066e3(0x251)];for(const _0x41e1b4 of _0x56667d[_0x2066e3(0x1ca)]){if(_0x41e1b4[_0x2066e3(0x1da)]===_0x2066e3(0x1e6)&&Array['isArray'](_0x41e1b4[_0x2066e3(0x274)]))for(const _0x75edb7 of _0x41e1b4[_0x2066e3(0x274)]){try{const _0x4b0b78=_0x75edb7[_0x2066e3(0x1a1)]?.[_0x2066e3(0x208)],_0x1a3b37=JSON[_0x2066e3(0x1a5)](_0x75edb7['function']?.[_0x2066e3(0x250)]||'{}');if(_0x4b0b78===_0x2066e3(0x1e8))_0x17816c[_0x2066e3(0x1ff)](_0x2066e3(0x279)+_0x1a3b37[_0x2066e3(0x26b)]+_0x2066e3(0x281)+(_0x1a3b37[_0x2066e3(0x1dd)]||'.')+'`');else{if(_0x4b0b78===_0x2066e3(0x297))_0x17816c[_0x2066e3(0x1ff)](_0x2066e3(0x21a)+_0x1a3b37[_0x2066e3(0x1dd)]+'`');else{if(_0x4b0b78===_0x2066e3(0x22a))_0x17816c[_0x2066e3(0x1ff)](_0x2066e3(0x1af)+(_0x1a3b37[_0x2066e3(0x262)]||'.')+'`');else _0x4b0b78===_0x2066e3(0x240)&&_0x17816c[_0x2066e3(0x1ff)]('-\x20Glob\x20search\x20`'+_0x1a3b37[_0x2066e3(0x26b)]+'`\x20in\x20`'+(_0x1a3b37[_0x2066e3(0x1dd)]||'.')+'`');}}}catch{}}}_0x354e59[_0x2066e3(0x1ff)](_0x17816c[_0x2066e3(0x28a)]('\x0a'));const _0x3944b3=['',_0x2066e3(0x1d8)];for(const _0x323da5 of _0x509d1e){if(_0x323da5[_0x2066e3(0x1f5)]==='*')_0x3944b3[_0x2066e3(0x1ff)]('-\x20'+_0x323da5['path']+':*');else{if(Array[_0x2066e3(0x270)](_0x323da5[_0x2066e3(0x1f5)])){const _0x2a1173=_0x323da5[_0x2066e3(0x1f5)][_0x2066e3(0x24c)](([_0x5289cf,_0x5f59cf])=>{if(_0x5289cf===_0x5f59cf)return''+_0x5289cf;return _0x5289cf+'-'+_0x5f59cf;});_0x3944b3[_0x2066e3(0x1ff)]('-\x20'+_0x323da5[_0x2066e3(0x1dd)]+':'+_0x2a1173[_0x2066e3(0x28a)](','));}else _0x3944b3['push']('-\x20'+_0x323da5['path']+':*');}}_0x3944b3[_0x2066e3(0x1ff)](''),_0x354e59['push'](_0x3944b3[_0x2066e3(0x28a)]('\x0a')),_0x354e59[_0x2066e3(0x1ff)](_0x2066e3(0x220));const _0x401eb4=[],_0x1730ac=[];for(const _0x25f0d1 of _0x509d1e){let _0x43a3f8=a0_0x11fbeb[_0x2066e3(0x1c3)](_0x3018e7['data']['repo_path'],_0x25f0d1[_0x2066e3(0x1dd)]),_0x559750=null,_0x2cf284=null;try{_0x559750=await a0_0x49b6f5[_0x2066e3(0x290)](_0x43a3f8,{'encoding':_0x2066e3(0x1ac)});}catch(_0x3c354c){const _0x5ae589=fixPathRepetition(_0x43a3f8);if(_0x5ae589)try{_0x559750=await a0_0x49b6f5[_0x2066e3(0x290)](_0x5ae589,{'encoding':_0x2066e3(0x1ac)}),_0x43a3f8=_0x5ae589;}catch{_0x2cf284=_0x3c354c instanceof Error?_0x3c354c:new Error(String(_0x3c354c));}else _0x2cf284=_0x3c354c instanceof Error?_0x3c354c:new Error(String(_0x3c354c));}if(_0x559750!==null){const _0x2cb78a=_0x559750[_0x2066e3(0x226)](/\r?\n/),_0x5a65f8=[];if(_0x25f0d1[_0x2066e3(0x1f5)]==='*'||!Array[_0x2066e3(0x270)](_0x25f0d1['lines']))for(let _0x19aa35=0x1;_0x19aa35<=_0x2cb78a[_0x2066e3(0x280)];_0x19aa35++){const _0xc978ba=_0x2cb78a[_0x19aa35-0x1];_0x5a65f8['push'](_0x19aa35+'|\x20'+_0xc978ba);}else for(const [_0x59b7a7,_0x2c947b]of _0x25f0d1['lines']){_0x5a65f8[_0x2066e3(0x280)]>0x0&&_0x5a65f8[_0x2066e3(0x1ff)]('');for(let _0x1c2536=_0x59b7a7;_0x1c2536<=_0x2c947b&&_0x1c2536<=_0x2cb78a[_0x2066e3(0x280)];_0x1c2536++){const _0x4d0179=_0x2cb78a[_0x1c2536-0x1];_0x5a65f8[_0x2066e3(0x1ff)](_0x1c2536+'|\x20'+_0x4d0179);}}_0x1730ac['push']({'path':_0x25f0d1[_0x2066e3(0x1dd)],'content':_0x5a65f8[_0x2066e3(0x28a)]('\x0a')});}else _0x401eb4[_0x2066e3(0x1ff)](_0x2066e3(0x29f)+_0x25f0d1[_0x2066e3(0x1dd)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x2cf284?.[_0x2066e3(0x1d3)]||_0x2066e3(0x198))+'\x0a</file>');}try{const _0x106486=await compactFileContexts(_0x1730ac,_0x3018e7['data'][_0x2066e3(0x27e)],MORPH_API_KEY,MORPH_API_URL);for(const _0x59dcd5 of _0x106486){_0x401eb4[_0x2066e3(0x1ff)](_0x2066e3(0x29f)+_0x59dcd5[_0x2066e3(0x1dd)]+_0x2066e3(0x1f1)+_0x59dcd5[_0x2066e3(0x27b)]+_0x2066e3(0x1ae));}}catch(_0x2e1350){console[_0x2066e3(0x22b)]('[codebase_search]\x20compaction\x20failed',_0x2e1350);for(const _0x256718 of _0x1730ac){_0x401eb4['push'](_0x2066e3(0x29f)+_0x256718['path']+_0x2066e3(0x1f1)+_0x256718[_0x2066e3(0x27b)]+_0x2066e3(0x1ae));}}_0x354e59[_0x2066e3(0x1ff)](_0x401eb4[_0x2066e3(0x28a)]('\x0a\x0a')),_0xffd7c8=_0x354e59[_0x2066e3(0x28a)]('\x0a');const _0x3d9d70=_0x56667d[_0x2066e3(0x1c4)]?.[_0x2066e3(0x259)](_0x1b08d8=>_0x1b08d8[_0x2066e3(0x1d3)]?.[_0x2066e3(0x246)](_0x2066e3(0x1cc)))||[];if(_0x3d9d70[_0x2066e3(0x280)]>0x0){const _0x3d0cc3=_0x3d9d70[_0x2066e3(0x24c)](_0x4815fc=>_0x4815fc[_0x2066e3(0x1d3)])['join'](';\x20');reportMorphError({'error_message':_0x3d0cc3,'error_type':_0x2066e3(0x197),'context':{'tool':_0x2066e3(0x275),'repo_path':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)],'query':_0x3018e7['data'][_0x2066e3(0x27e)],'model':_0x2066e3(0x1fa),'termination_reason':'completed_with_file_errors','error_count':_0x3d9d70[_0x2066e3(0x280)],'is_timeout':![],'timings':_0x56667d[_0x2066e3(0x1b6)],'files_attempted':_0x509d1e[_0x2066e3(0x24c)](_0x375548=>({'path':_0x375548[_0x2066e3(0x1dd)],'lines':_0x375548[_0x2066e3(0x1f5)]})),'tool_calls':_0x4e0457(_0x56667d[_0x2066e3(0x1ca)]),'messages':_0x56667d[_0x2066e3(0x1ca)]?.[_0x2066e3(0x24c)](_0x58509f=>({'role':_0x58509f[_0x2066e3(0x1da)],'content':_0x58509f['content'],..._0x58509f[_0x2066e3(0x274)]?{'tool_calls':_0x58509f[_0x2066e3(0x274)][_0x2066e3(0x280)]}:{},..._0x58509f[_0x2066e3(0x269)]?{'tool_call_id':_0x58509f[_0x2066e3(0x269)]}:{}})),'request_content':{'query':_0x3018e7[_0x2066e3(0x299)]['search_string'],'repo_path':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)],'repoRoot':a0_0x11fbeb[_0x2066e3(0x1c3)](_0x3018e7[_0x2066e3(0x299)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'source':_0x2066e3(0x239)})[_0x2066e3(0x1b7)](()=>{});}}else{if(_0x56667d['terminationReason']===_0x2066e3(0x1c8)&&_0x56667d['errors'][_0x2066e3(0x280)]>0x0){const _0x57d5e3=_0x56667d[_0x2066e3(0x1c4)]['map'](_0xf48d87=>_0xf48d87[_0x2066e3(0x1d3)])[_0x2066e3(0x28a)](';\x20');_0xffd7c8=_0x2066e3(0x1c1)+_0x57d5e3;const _0x20b53d=_0x57d5e3[_0x2066e3(0x264)]()['includes']('timeout')||_0x57d5e3[_0x2066e3(0x264)]()['includes'](_0x2066e3(0x22d))||_0x57d5e3[_0x2066e3(0x264)]()[_0x2066e3(0x1f8)](_0x2066e3(0x201)),_0x52560c=_0x56667d[_0x2066e3(0x1d2)]?.[_0x2066e3(0x2a2)]?.['files'],_0x2dc15b=_0x56667d[_0x2066e3(0x1c4)][0x0];reportMorphError({'error_message':_0x57d5e3,'error_type':_0x20b53d?_0x2066e3(0x23a):_0x2dc15b?.[_0x2066e3(0x278)]?.['name']||_0x2066e3(0x26c),'context':{'tool':_0x2066e3(0x275),'repo_path':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)],'query':_0x3018e7['data'][_0x2066e3(0x27e)],'model':_0x2066e3(0x1fa),'termination_reason':_0x56667d['terminationReason'],'error_count':_0x56667d[_0x2066e3(0x1c4)][_0x2066e3(0x280)],'is_timeout':_0x20b53d,'timings':_0x56667d[_0x2066e3(0x1b6)],'files_attempted':_0x52560c?.[_0x2066e3(0x24c)](_0x2fcc87=>({'path':_0x2fcc87[_0x2066e3(0x1dd)],'lines':_0x2fcc87[_0x2066e3(0x1f5)]})),'tool_calls':_0x4e0457(_0x56667d[_0x2066e3(0x1ca)]),'messages':_0x56667d[_0x2066e3(0x1ca)]?.[_0x2066e3(0x24c)](_0x8c8afa=>({'role':_0x8c8afa[_0x2066e3(0x1da)],'content':_0x8c8afa[_0x2066e3(0x27b)],..._0x8c8afa[_0x2066e3(0x274)]?{'tool_calls':_0x8c8afa[_0x2066e3(0x274)][_0x2066e3(0x280)]}:{},..._0x8c8afa[_0x2066e3(0x269)]?{'tool_call_id':_0x8c8afa[_0x2066e3(0x269)]}:{}})),'request_content':{'query':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x27e)],'repo_path':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)],'repoRoot':a0_0x11fbeb[_0x2066e3(0x1c3)](_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)]),'model':_0x2066e3(0x1fa)}},'stack_trace':_0x2dc15b?.[_0x2066e3(0x24d)]||undefined,'source':_0x2066e3(0x239)})[_0x2066e3(0x1b7)](()=>{});}else _0xffd7c8=_0x2066e3(0x252);}return{'content':[{'type':'text','text':_0xffd7c8}]};}catch(_0x268047){const _0x49e50d=handleMorphAPIError(_0x268047);if(_0x49e50d)return _0x49e50d;const _0x3a1637=_0x268047 instanceof Error?_0x268047[_0x2066e3(0x1d3)]:String(_0x268047),_0x962b25=_0x3a1637['toLowerCase']()[_0x2066e3(0x1f8)](_0x2066e3(0x26f))||_0x3a1637[_0x2066e3(0x264)]()[_0x2066e3(0x1f8)](_0x2066e3(0x22d))||_0x3a1637[_0x2066e3(0x264)]()[_0x2066e3(0x1f8)]('etimedout')||_0x268047 instanceof Error&&_0x268047[_0x2066e3(0x208)]===_0x2066e3(0x23a);return reportMorphError({'error_message':_0x3a1637,'error_type':_0x962b25?_0x2066e3(0x23a):_0x268047 instanceof Error?_0x268047[_0x2066e3(0x278)][_0x2066e3(0x208)]:_0x2066e3(0x1be),'context':{'tool':_0x2066e3(0x275),'repo_path':_0x3018e7['data'][_0x2066e3(0x1d1)],'query':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x27e)],'model':_0x2066e3(0x1fa),'is_timeout':_0x962b25,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x3018e7[_0x2066e3(0x299)]['search_string'],'repo_path':_0x3018e7[_0x2066e3(0x299)][_0x2066e3(0x1d1)],'repoRoot':a0_0x11fbeb[_0x2066e3(0x1c3)](_0x3018e7['data']['repo_path']),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x268047 instanceof Error?_0x268047[_0x2066e3(0x24d)]:undefined,'source':_0x2066e3(0x239)})[_0x2066e3(0x1b7)](()=>{}),{'content':[{'type':_0x2066e3(0x1a8),'text':_0x2066e3(0x21e)+_0x3a1637}],'isError':![]};}}case _0x2066e3(0x1aa):{const _0x16916c=WarpGrepGitHubArgsSchema['safeParse'](_0x36826a);if(!_0x16916c[_0x2066e3(0x1c9)])return{'content':[{'type':'text','text':_0x2066e3(0x22c)+_0x16916c[_0x2066e3(0x22b)]}],'isError':!![]};const _0xe49ddf=_0x16916c[_0x2066e3(0x299)][_0x2066e3(0x298)]||_0x16916c['data'][_0x2066e3(0x249)];if(!_0xe49ddf)return{'content':[{'type':'text','text':_0x2066e3(0x287)}],'isError':!![]};const _0x4da59d=MORPH_API_KEY;if(!_0x4da59d)throw new Error(_0x2066e3(0x260));const _0x44d0e3=Date[_0x2066e3(0x1e3)]();logMcpStderr(_0x2066e3(0x203)+_0xe49ddf+_0x2066e3(0x2a0)+_0x16916c['data']['search_string']+'\x22');try{const _0x1b53e2=new WarpGrepClient({'morphApiKey':_0x4da59d,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4ae7e8=await _0x1b53e2[_0x2066e3(0x29b)]({'searchTerm':_0x16916c[_0x2066e3(0x299)][_0x2066e3(0x27e)],'github':_0xe49ddf,'branch':_0x16916c['data']['branch']}),_0x244d3e=Date['now']()-_0x44d0e3;logMcpStderr(_0x2066e3(0x27c)+_0x244d3e+'ms.\x20Success:\x20'+_0x4ae7e8[_0x2066e3(0x1c9)]);const _0x25fb4c=formatResult(_0x4ae7e8);return{'content':[{'type':'text','text':_0x25fb4c}]};}catch(_0x3d005b){const _0x3f6a69=handleMorphAPIError(_0x3d005b);if(_0x3f6a69)return _0x3f6a69;const _0x3df6ca=Date[_0x2066e3(0x1e3)]()-_0x44d0e3,_0x16a6eb=_0x3d005b instanceof Error?_0x3d005b[_0x2066e3(0x1d3)]:String(_0x3d005b);return logMcpStderr(_0x2066e3(0x29e)+_0x3df6ca+_0x2066e3(0x29c),_0x16a6eb),reportMorphError({'error_message':_0x16a6eb,'error_type':_0x3d005b instanceof Error?_0x3d005b[_0x2066e3(0x278)][_0x2066e3(0x208)]:_0x2066e3(0x1be),'context':{'tool':'github_codebase_search','github_url':_0xe49ddf,'search_string':_0x16916c[_0x2066e3(0x299)]['search_string'],'branch':_0x16916c[_0x2066e3(0x299)][_0x2066e3(0x27f)]},'stack_trace':_0x3d005b instanceof Error?_0x3d005b[_0x2066e3(0x24d)]:undefined,'source':_0x2066e3(0x239),'tool':_0x2066e3(0x1aa),'latency_ms':_0x3df6ca})[_0x2066e3(0x1b7)](()=>{}),{'content':[{'type':_0x2066e3(0x1a8),'text':_0x2066e3(0x23b)+_0x16a6eb}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x1a7f10);}}catch(_0x45c974){const _0x4cae71=_0x45c974 instanceof Error?_0x45c974[_0x2066e3(0x1d3)]:String(_0x45c974);return reportMorphError({'error_message':_0x4cae71,'error_type':_0x45c974 instanceof Error?_0x45c974[_0x2066e3(0x278)]['name']:_0x2066e3(0x1be),'context':{'tool':_0x1a7f10,'arguments':_0x36826a?JSON[_0x2066e3(0x230)](_0x36826a)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x2066e3(0x23f)},'stack_trace':_0x45c974 instanceof Error?_0x45c974[_0x2066e3(0x24d)]:undefined,'source':_0x2066e3(0x239)})[_0x2066e3(0x1b7)](()=>{}),{'content':[{'type':_0x2066e3(0x1a8),'text':'Error:\x20'+_0x4cae71}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x32aad6){const _0x4745f3=a0_0x10d739,_0x42379b=await getValidRootDirectories(_0x32aad6);if(_0x42379b[_0x4745f3(0x280)]>0x0)allowedDirectories=[..._0x42379b],logMcpStderr(_0x4745f3(0x258)+_0x42379b[_0x4745f3(0x280)]+_0x4745f3(0x23c));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x156d58=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x156d58&&(allowedDirectories=[_0x156d58],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x156d58));}catch(_0x2a9dec){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2a9dec);}}}server[a0_0x10d739(0x19e)](RootsListChangedNotificationSchema,async()=>{const _0xec168a=a0_0x10d739;try{const _0x30d074=await server[_0xec168a(0x219)]();_0x30d074&&_0xec168a(0x272)in _0x30d074&&await updateAllowedDirectoriesFromRoots(_0x30d074[_0xec168a(0x272)]);}catch(_0x5480bd){logMcpStderr(_0xec168a(0x1eb),_0x5480bd instanceof Error?_0x5480bd[_0xec168a(0x1d3)]:String(_0x5480bd));}}),server[a0_0x10d739(0x248)]=async()=>{const _0x380edc=a0_0x10d739,_0x50cc38=server[_0x380edc(0x271)]();if(_0x50cc38?.[_0x380edc(0x272)])try{const _0xdc152e=await server[_0x380edc(0x219)]();_0xdc152e&&_0x380edc(0x272)in _0xdc152e?await updateAllowedDirectoriesFromRoots(_0xdc152e[_0x380edc(0x272)]):logMcpStderr(_0x380edc(0x1de));}catch(_0x3a2c5f){logMcpStderr(_0x380edc(0x291),_0x3a2c5f instanceof Error?_0x3a2c5f[_0x380edc(0x1d3)]:String(_0x3a2c5f));}else{if(allowedDirectories[_0x380edc(0x280)]>0x0)logMcpStderr(_0x380edc(0x1e0),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x380edc(0x1ab));else throw new Error(_0x380edc(0x28d));}}};async function runServer(){const _0x275d12=a0_0x10d739,_0x604a1b=new StdioServerTransport();await server[_0x275d12(0x233)](_0x604a1b),logMcpStderr(_0x275d12(0x1ea)),allowedDirectories['length']===0x0&&logMcpStderr(_0x275d12(0x23d));}runServer()['catch'](_0x17db16=>{const _0x21acca=a0_0x10d739;logMcpStderr(_0x21acca(0x294),_0x17db16),process[_0x21acca(0x1ef)](0x1);});
2
+ const a0_0x14f8f4=a0_0x5ca9;(function(_0x4d01a8,_0x24c66e){const _0x376039=a0_0x5ca9,_0x2f820a=_0x4d01a8();while(!![]){try{const _0x2fb6b2=parseInt(_0x376039(0x16e))/0x1*(-parseInt(_0x376039(0x217))/0x2)+-parseInt(_0x376039(0x191))/0x3+-parseInt(_0x376039(0x258))/0x4*(parseInt(_0x376039(0x1b0))/0x5)+-parseInt(_0x376039(0x16c))/0x6+parseInt(_0x376039(0x19b))/0x7*(parseInt(_0x376039(0x1b9))/0x8)+parseInt(_0x376039(0x18b))/0x9+-parseInt(_0x376039(0x25f))/0xa*(-parseInt(_0x376039(0x210))/0xb);if(_0x2fb6b2===_0x24c66e)break;else _0x2f820a['push'](_0x2f820a['shift']());}catch(_0x3b94d6){_0x2f820a['push'](_0x2f820a['shift']());}}}(a0_0x4e5c,0xdfcde));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x3a9187 from'fs/promises';import a0_0x53019e from'path';import a0_0x13efd6 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x4d8637 from'axios';function fixPathRepetition(_0x1fc51f){const _0x262b98=a0_0x5ca9,_0x1ba3c3=_0x1fc51f[_0x262b98(0x164)](a0_0x53019e['sep'])[_0x262b98(0x26e)](Boolean);if(_0x1ba3c3[_0x262b98(0x230)]<0x2)return null;for(let _0x407968=Math[_0x262b98(0x154)](_0x1ba3c3['length']/0x2);_0x407968>=0x1;_0x407968--){for(let _0x11cf8f=0x0;_0x11cf8f<=_0x1ba3c3[_0x262b98(0x230)]-0x2*_0x407968;_0x11cf8f++){const _0x592ebf=_0x1ba3c3[_0x262b98(0x209)](_0x11cf8f,_0x11cf8f+_0x407968),_0x4cdd38=_0x1ba3c3[_0x262b98(0x209)](_0x11cf8f+_0x407968,_0x11cf8f+0x2*_0x407968);if(_0x592ebf[_0x262b98(0x1e3)]((_0x445b22,_0x3965cf)=>_0x445b22===_0x4cdd38[_0x3965cf])){const _0x2de5ad=[..._0x1ba3c3[_0x262b98(0x209)](0x0,_0x11cf8f),..._0x1ba3c3['slice'](_0x11cf8f+_0x407968)];return a0_0x53019e['sep']+_0x2de5ad['join'](a0_0x53019e['sep']);}}}return null;}function a0_0x4e5c(){const _0x276c30=['\x0a...\x20(truncated,\x20total:\x20','searchGitHub','Fallback:\x20Using\x20workspace\x20root\x20','branch','text','messages','stringify','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','\x27\x20in\x20`','MORPH_FAST_APPLY','safeParse','morph-v3-fast','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','read','status','PWD','readFile','\x0aOptions:','timings','sk-','Relevant\x20context\x20found:','\x20valid\x20directories','grep_search','role','optional','884264uiokbr','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','response','<file\x20path=\x22','FileReadError','includes','glob\x20\x27','10PZXPzR','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','isArray','github_codebase_search','Cargo.toml','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','toISOString','-\x20Grepped\x20\x27','context','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','morph-mcp','[codebase_search]\x20compaction\x20failed','warn','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','filter','array','isDirectory','content','path','ToolException','floor','source','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','BinaryFile','Warning:\x20','Invalid\x20arguments:\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','--help','code_edit','stack','some','ms:','application/json','Applied','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Error:\x20','split','\x20as\x20allowed\x20directory','MORPH_API_KEY','metadata','list_directory','env','-\x20Read\x20file\x20`','\x0aExamples:','228444onDSpG','success','9463SCHAkt','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','user','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','tool_calls','SymlinkError','version','ENABLE_WORKSPACE_MODE','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','No\x20valid\x20root\x20directories\x20provided\x20by\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.','utf-8','package.json','error','[github_codebase_search]\x20Done\x20in\x20','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.','tool_call_id','timed\x20out','Benefits:\x0a','linesAdded','push','SubToolError','completionId','repo_path','\x20\x20morph-mcp','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','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.','Max\x20results\x20to\x20return','10383948tYzhFc','search_string','read\x20','Unknown\x20tool:\x20','linesRemoved','❌\x20Morph\x20Edit\x20Failed:\x20','2719134DdKrnz','Tool\x20','getClientCapabilities','morph-','has','pattern','connect','\x20disabled\x20via\x20DISABLED_TOOLS','WarpGrep\x20sub-tool\x20errors:\x20','assistant','83363CYPVcZ','match','\x22>\x0aError\x20reading\x20file:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','terminationReason','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','--version','name','files','-\x20Glob\x20search\x20`','tool','@morphllm/morphmcp\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','completed','indexOf','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','join','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','Failed\x20to\x20read\x20file:\x20','exit','Rules:\x0a','10aHqkHv','UnknownError','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','GitHub\x20search\x20failed:\x20','etimedout','command','unknown\x20error','0.2.0','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','1032xOHuAu','Created\x20File','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','list_directory\x20','[github_codebase_search]\x20Failed\x20in\x20','../package.json','grep\x20\x27','search_type','\x20-\x20','substring','setNotificationHandler','MORPH_API_URL','TimeoutError','unknown','normalize','.\x20Path:\x20','\x20(new\x20file)','go.mod','enum','ReadError','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','realpath','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','basename','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Morph\x20Edit\x20Preview','startsWith','\x0a</file>','mcp-filesystem','code','stat','changes','WORKSPACE_ROOT','dryRun','edit_file','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','all','catch','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','every','default','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','argv','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Repository\x20identifier','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','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.','Failed\x20to\x20request\x20roots\x20from\x20client:','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','glob','Specific\x20commit\x20hash\x20to\x20search','morph-warp-grep-v2.1','arguments','grep','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','DISABLED_TOOLS','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','payload','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','.git','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','true','finish','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','\x20error(s)','map','homedir','api-key','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','completed_with_file_errors','resolve','cwd','message','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','constructor','slice',',\x20removed\x20','describe','errors','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','Disabled\x20tools:\x20','requiresApiKey','5010060AxklRz','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','tsconfig.json','instruction','timeout','178INpAGY','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','pyproject.toml','post','inputSchema','data','.\x20Changes:\x20','Error\x20accessing\x20directory\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','terminated','[could\x20not\x20read\x20file:\x20','--api-key=','parse','toLowerCase','node_modules','codebase_search','MORPH_WARP_GREP_TIMEOUT','object','function','morph-v3-large','oninitialized','roots','owner_repo','listRoots','length','\x20is\x20not\x20a\x20directory','.vscode','dirname','ms.\x20Success:\x20','now','Warning:\x20Workspace\x20fallback\x20failed:\x20','log','string','FileNotFound','lines','false','description'];a0_0x4e5c=function(){return _0x276c30;};return a0_0x4e5c();}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x2caec2=a0_0x5ca9;try{const _0x288f44=require(_0x2caec2(0x1be));return _0x288f44[_0x2caec2(0x175)]??_0x2caec2(0x1c6);}catch(_0x2b72c0){return logMcpStderr(_0x2caec2(0x259),_0x2b72c0),_0x2caec2(0x1c6);}}function printHelp(){const _0x444f35=a0_0x5ca9;console[_0x444f35(0x237)](_0x444f35(0x1a6)+getPackageVersion()),console[_0x444f35(0x237)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x444f35(0x237)](_0x444f35(0x250)),console[_0x444f35(0x237)](_0x444f35(0x246)),console['log'](_0x444f35(0x265)),console['log']('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log'](_0x444f35(0x16b)),console[_0x444f35(0x237)](_0x444f35(0x187)),console[_0x444f35(0x237)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x14f8f4(0x1e7)][a0_0x14f8f4(0x209)](0x2),VERSION_FLAGS=new Set([a0_0x14f8f4(0x1a1),'-v','-V']),HELP_FLAGS=new Set([a0_0x14f8f4(0x15b),'-h']);cliArgs[a0_0x14f8f4(0x15e)](_0x5c54bb=>VERSION_FLAGS['has'](_0x5c54bb))&&(console[a0_0x14f8f4(0x237)](a0_0x14f8f4(0x1a6)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x14f8f4(0x15e)](_0x4eabde=>HELP_FLAGS[a0_0x14f8f4(0x195)](_0x4eabde))&&(printHelp(),process[a0_0x14f8f4(0x1ae)](0x0));function getCliArg(_0x3c4450){const _0x490c35=a0_0x14f8f4;for(let _0x531f89=0x0;_0x531f89<cliArgs[_0x490c35(0x230)];_0x531f89++){const _0x20f0e1=cliArgs[_0x531f89];if(_0x20f0e1[_0x490c35(0x1d4)]('--'+_0x3c4450+'='))return _0x20f0e1[_0x490c35(0x209)](('--'+_0x3c4450+'=')[_0x490c35(0x230)]);if(_0x20f0e1==='--'+_0x3c4450&&_0x531f89+0x1<cliArgs[_0x490c35(0x230)])return cliArgs[_0x531f89+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x14f8f4(0x230)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x14f8f4(0x195)](arg))continue;if(arg[a0_0x14f8f4(0x1d4)](a0_0x14f8f4(0x223)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x1da)]||process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x24e)]||process[a0_0x14f8f4(0x205)](),ENABLE_WORKSPACE_MODE=process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x176)]!==a0_0x14f8f4(0x23b),MORPH_API_KEY=getCliArg(a0_0x14f8f4(0x201))??process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x166)],MORPH_API_URL=process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x1c4)],MORPH_FAST_APPLY=process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x248)]===a0_0x14f8f4(0x1fb),MORPH_WARP_GREP_TIMEOUT=process[a0_0x14f8f4(0x169)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x228)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x14f8f4(0x1dc),'codebase_search',a0_0x14f8f4(0x262)]),DISABLED_TOOLS=process['env'][a0_0x14f8f4(0x1f4)]?new Set(process[a0_0x14f8f4(0x169)][a0_0x14f8f4(0x1f4)][a0_0x14f8f4(0x164)](',')[a0_0x14f8f4(0x1ff)](_0xa08c90=>_0xa08c90['trim']())[a0_0x14f8f4(0x26e)](_0x26fc1a=>_0x26fc1a[a0_0x14f8f4(0x230)]>0x0)):new Set();function a0_0x5ca9(_0x310b76,_0x2f0a4b){_0x310b76=_0x310b76-0x14f;const _0x4e5c00=a0_0x4e5c();let _0x5ca9a8=_0x4e5c00[_0x310b76];return _0x5ca9a8;}if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x14f8f4(0x195)](tool)&&console['error']('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x14f8f4(0x1ab)](',\x20'));}console[a0_0x14f8f4(0x17c)](a0_0x14f8f4(0x20e)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x14f8f4(0x1d4)](a0_0x14f8f4(0x252))&&!MORPH_API_KEY[a0_0x14f8f4(0x1d4)](a0_0x14f8f4(0x194))&&logMcpStderr(a0_0x14f8f4(0x212));async function reportMorphError(_0x251a18){const _0x2a1e66=a0_0x14f8f4;try{await a0_0x4d8637[_0x2a1e66(0x21a)]('https://morphllm.com/api/error-report',{..._0x251a18,'timestamp':new Date()[_0x2a1e66(0x266)](),'source':_0x251a18[_0x2a1e66(0x155)]||_0x2a1e66(0x1d6),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x251a18[_0x2a1e66(0x268)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x2a1e66(0x160),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x4dd3ce,_0x2eaec8){const _0x346da8=a0_0x14f8f4;if(_0x4dd3ce&&typeof _0x4dd3ce===_0x346da8(0x229)&&_0x346da8(0x24d)in _0x4dd3ce)return _0x4dd3ce[_0x346da8(0x24d)];if(_0x4dd3ce&&typeof _0x4dd3ce===_0x346da8(0x229)&&_0x346da8(0x25a)in _0x4dd3ce)return _0x4dd3ce[_0x346da8(0x25a)]?.[_0x346da8(0x24d)];const _0x2cb2f9=_0x2eaec8['match'](/\b(401|429)\b/);return _0x2cb2f9?parseInt(_0x2cb2f9[0x1],0xa):null;}function handleMorphAPIError(_0x51774d){const _0x5c94d6=a0_0x14f8f4,_0x45c8e7=_0x51774d instanceof Error?_0x51774d[_0x5c94d6(0x206)]:String(_0x51774d),_0x4cc972=extractStatusCode(_0x51774d,_0x45c8e7);switch(_0x4cc972){case 0x191:return{'content':[{'type':'text','text':_0x5c94d6(0x17e)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x5c94d6(0x241),'text':_0x5c94d6(0x245)}],'isError':!![]};default:return null;}}args[a0_0x14f8f4(0x230)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x14f8f4(0x211)),logMcpStderr(a0_0x14f8f4(0x1f6)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x14f8f4(0x260)),logMcpStderr(a0_0x14f8f4(0x202)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x386e79){const _0x1e2db9=a0_0x14f8f4;return a0_0x53019e[_0x1e2db9(0x1c7)](_0x386e79);}function expandHome(_0x5127b7){const _0x3a616a=a0_0x14f8f4;if(_0x5127b7['startsWith']('~/')||_0x5127b7==='~')return a0_0x53019e[_0x3a616a(0x1ab)](a0_0x13efd6[_0x3a616a(0x200)](),_0x5127b7[_0x3a616a(0x209)](0x1));return _0x5127b7;}let allowedDirectories=await Promise[a0_0x14f8f4(0x1df)](args[a0_0x14f8f4(0x1ff)](async _0x414989=>{const _0x155bd1=a0_0x14f8f4,_0x1323cb=expandHome(_0x414989),_0x334308=a0_0x53019e['resolve'](_0x1323cb);try{const _0x34ea32=await a0_0x3a9187[_0x155bd1(0x1cf)](_0x334308);return normalizePath(_0x34ea32);}catch(_0x39b8d6){return normalizePath(_0x334308);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x14f8f4(0x230)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x14f8f4(0x183)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x14f8f4(0x165)));}catch(a0_0x291712){logMcpStderr(a0_0x14f8f4(0x16f)+a0_0x291712);}async function detectWorkspaceRoot(_0x2d5acf){const _0x4c8c0a=a0_0x14f8f4;let _0x38f027=a0_0x53019e['resolve'](_0x2d5acf);const _0x5cc05f=[_0x4c8c0a(0x1f9),_0x4c8c0a(0x232),_0x4c8c0a(0x17b),_0x4c8c0a(0x263),_0x4c8c0a(0x219),_0x4c8c0a(0x1ca),'.cursor',_0x4c8c0a(0x214),'composer.json'];while(_0x38f027!==a0_0x53019e['dirname'](_0x38f027)){for(const _0x2a482f of _0x5cc05f){const _0x1c13cd=a0_0x53019e[_0x4c8c0a(0x1ab)](_0x38f027,_0x2a482f);try{return await a0_0x3a9187['access'](_0x1c13cd),normalizePath(_0x38f027);}catch{}}_0x38f027=a0_0x53019e['dirname'](_0x38f027);}return normalizePath(_0x2d5acf);}await Promise[a0_0x14f8f4(0x1df)](args['map'](async _0x553188=>{const _0xa03cb=a0_0x14f8f4;try{const _0x6ab034=await a0_0x3a9187[_0xa03cb(0x1d8)](expandHome(_0x553188));!_0x6ab034[_0xa03cb(0x150)]()&&(logMcpStderr(_0xa03cb(0x163)+_0x553188+_0xa03cb(0x231)),process[_0xa03cb(0x1ae)](0x1));}catch(_0x5dcb04){logMcpStderr(_0xa03cb(0x21e)+_0x553188+':',_0x5dcb04),process[_0xa03cb(0x1ae)](0x1);}}));async function validatePath(_0x1c6d10){const _0x31bf4f=a0_0x14f8f4,_0x476726=expandHome(_0x1c6d10),_0x1cc764=a0_0x53019e[_0x31bf4f(0x204)](_0x476726);try{const _0x51ca36=await a0_0x3a9187[_0x31bf4f(0x1cf)](_0x1cc764);return _0x51ca36;}catch(_0x370bf5){if(_0x370bf5[_0x31bf4f(0x1d7)]==='ENOENT'){const _0x3a9699=a0_0x53019e[_0x31bf4f(0x233)](_0x1cc764);try{const _0x4a2504=await a0_0x3a9187[_0x31bf4f(0x1cf)](_0x3a9699);return a0_0x53019e[_0x31bf4f(0x1ab)](_0x4a2504,a0_0x53019e[_0x31bf4f(0x1d1)](_0x1cc764));}catch{throw new Error(_0x31bf4f(0x1cd)+_0x3a9699);}}throw _0x370bf5;}}const MorphEditFileArgsSchema=z[a0_0x14f8f4(0x229)]({'path':z['string'](),'code_edit':z[a0_0x14f8f4(0x238)]()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x1d2)),'instruction':z['string']()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x15a)),'dryRun':z['boolean']()[a0_0x14f8f4(0x1e4)](![])[a0_0x14f8f4(0x20b)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x14f8f4(0x179),WarpGrepArgsSchema=z[a0_0x14f8f4(0x229)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x14f8f4(0x20b)]('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_0x14f8f4(0x1cb)]([a0_0x14f8f4(0x1e4),a0_0x14f8f4(0x226)])['optional']()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x26d))}),WarpGrepGitHubArgsSchema=z[a0_0x14f8f4(0x229)]({'search_string':z['string']()[a0_0x14f8f4(0x20b)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x14f8f4(0x257)]()[a0_0x14f8f4(0x20b)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z[a0_0x14f8f4(0x238)]()[a0_0x14f8f4(0x257)]()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x162)),'branch':z[a0_0x14f8f4(0x238)]()[a0_0x14f8f4(0x257)]()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x1f5))}),CodebaseSearchArgsSchema=z[a0_0x14f8f4(0x229)]({'query':z[a0_0x14f8f4(0x238)]()[a0_0x14f8f4(0x20b)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x14f8f4(0x238)]()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x1e9)),'branch':z[a0_0x14f8f4(0x238)]()['optional']()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x207)),'commitHash':z[a0_0x14f8f4(0x238)]()['optional']()[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x1ef)),'targetDirectories':z[a0_0x14f8f4(0x14f)](z[a0_0x14f8f4(0x238)]())[a0_0x14f8f4(0x1e4)]([])[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x1ea)),'limit':z['number']()['optional']()[a0_0x14f8f4(0x1e4)](0xa)[a0_0x14f8f4(0x20b)](a0_0x14f8f4(0x18a))}),server=new Server({'name':a0_0x14f8f4(0x26a),'version':a0_0x14f8f4(0x1b7)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x43bdb5=a0_0x14f8f4,_0x3c1238=[{'name':_0x43bdb5(0x1dc),'description':_0x43bdb5(0x1b8)+_0x43bdb5(0x172)+_0x43bdb5(0x1ed)+_0x43bdb5(0x20d)+_0x43bdb5(0x181)+_0x43bdb5(0x1ac)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x43bdb5(0x269)+_0x43bdb5(0x1de)+_0x43bdb5(0x177)+_0x43bdb5(0x1e1)+_0x43bdb5(0x1e2)+'For\x20deletions:\x0a'+_0x43bdb5(0x1b2)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x43bdb5(0x1af)+_0x43bdb5(0x1ce)+_0x43bdb5(0x1dd)+_0x43bdb5(0x1fd)+_0x43bdb5(0x1bb)+_0x43bdb5(0x21f)+_0x43bdb5(0x156)+_0x43bdb5(0x244),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x43bdb5(0x227),'description':'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'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x43bdb5(0x171)+_0x43bdb5(0x1a0)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x268001=_0x3c1238['filter'](_0x436312=>{const _0x1f05e3=_0x43bdb5;if(DISABLED_TOOLS['has'](_0x436312[_0x1f05e3(0x1a2)]))return console[_0x1f05e3(0x17c)](_0x1f05e3(0x192)+_0x436312[_0x1f05e3(0x1a2)]+_0x1f05e3(0x198)),![];if('requiresApiKey'in _0x436312&&_0x436312[_0x1f05e3(0x20f)]&&!MORPH_API_KEY)return logMcpStderr(_0x1f05e3(0x158)+_0x436312[_0x1f05e3(0x1a2)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x268001[_0x43bdb5(0x1ff)](_0x2fcc74=>({'name':_0x2fcc74[_0x43bdb5(0x1a2)],'description':_0x2fcc74[_0x43bdb5(0x23c)],'inputSchema':_0x2fcc74[_0x43bdb5(0x21b)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0xf56e0=>{const _0x35d84e=a0_0x14f8f4,{name:_0x4af50c,arguments:_0x5a8813}=_0xf56e0['params'];try{if(!MORPH_API_KEY)return{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x1fa)}],'isError':!![]};if(!MORPH_API_KEY[_0x35d84e(0x1d4)](_0x35d84e(0x252))&&!MORPH_API_KEY[_0x35d84e(0x1d4)]('morph-'))return{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x1eb)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x4af50c))throw new Error('Tool\x20\x22'+_0x4af50c+_0x35d84e(0x24b));switch(_0x4af50c){case _0x35d84e(0x1dc):{const _0x2821a1=_0x5a8813&&typeof _0x5a8813==='object'&&'instructions'in _0x5a8813&&!('instruction'in _0x5a8813)?{..._0x5a8813,'instruction':_0x5a8813['instructions'],'instructions':undefined}:_0x5a8813,_0x10867c=MorphEditFileArgsSchema[_0x35d84e(0x249)](_0x2821a1);if(!_0x10867c[_0x35d84e(0x16d)])throw new Error(_0x35d84e(0x1e6)+_0x10867c[_0x35d84e(0x17c)]);const _0x6bc59b=await validatePath(_0x10867c['data'][_0x35d84e(0x152)]);let _0x88888=null,_0x4f1f4c=!![],_0x24c94c=null;try{_0x88888=await a0_0x3a9187['readFile'](_0x6bc59b,_0x35d84e(0x17a));}catch(_0x58ac9b){const _0x51d3c3=_0x58ac9b[_0x35d84e(0x1d7)];_0x51d3c3==='ENOENT'?(_0x4f1f4c=![],_0x88888=''):(_0x24c94c=_0x35d84e(0x1ad)+(_0x51d3c3||_0x35d84e(0x1c6))+_0x35d84e(0x1c1)+(_0x58ac9b instanceof Error?_0x58ac9b['message']:String(_0x58ac9b)),logMcpStderr('Warning:\x20'+_0x24c94c));}let _0x2d02f9;try{const _0x75513a=MORPH_API_KEY;if(!_0x75513a)throw new Error(_0x35d84e(0x188));const _0x5de15c=a0_0x53019e[_0x35d84e(0x233)](_0x6bc59b),_0x5ad155=a0_0x53019e['basename'](_0x6bc59b),_0x587735=await executeEditFile({'target_filepath':_0x5ad155,'code_edit':_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x15c)],'instruction':_0x10867c[_0x35d84e(0x21c)]['instruction']},{'morphApiKey':_0x75513a,'morphApiUrl':MORPH_API_URL,'fast':MORPH_FAST_APPLY,'baseDir':_0x5de15c,'autoWrite':!_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x1db)],'generateUdiff':![],'debug':![]});_0x2d02f9=_0x587735[_0x35d84e(0x185)];if(!_0x587735['success'])throw new Error(_0x587735[_0x35d84e(0x17c)]||_0x35d84e(0x1e8));const _0x1e2da3=_0x587735[_0x35d84e(0x1d9)],_0x5419d5='added\x20'+_0x1e2da3[_0x35d84e(0x182)]+_0x35d84e(0x20a)+_0x1e2da3[_0x35d84e(0x18f)]+',\x20modified\x20'+_0x1e2da3['linesModified'];if(_0x10867c[_0x35d84e(0x21c)]['dryRun'])return{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x1d3)+(_0x4f1f4c?'':_0x35d84e(0x1c9))+':\x20'+_0x10867c[_0x35d84e(0x21c)]['instruction']+_0x35d84e(0x21d)+_0x5419d5+_0x35d84e(0x1c8)+_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x152)]+'.'}]};return{'content':[{'type':_0x35d84e(0x241),'text':'Morph\x20Edit\x20'+(_0x4f1f4c?_0x35d84e(0x161):_0x35d84e(0x1ba))+':\x20'+_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x215)]+'.\x20Changes:\x20'+_0x5419d5+'.\x20Path:\x20'+_0x10867c['data']['path']+'.'}]};}catch(_0x3a55a1){const _0x10543c=handleMorphAPIError(_0x3a55a1);if(_0x10543c)return _0x10543c;const _0x51a7d4=_0x3a55a1 instanceof Error?_0x3a55a1['message']:String(_0x3a55a1);return reportMorphError({'error_message':_0x51a7d4,'error_type':_0x3a55a1 instanceof Error?_0x3a55a1[_0x35d84e(0x208)][_0x35d84e(0x1a2)]:'UnknownError','context':{'tool':_0x35d84e(0x1dc),'completion_id':_0x2d02f9,'file_path':_0x10867c['data'][_0x35d84e(0x152)],'validated_path':_0x6bc59b,'instruction':_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x215)],'model':MORPH_FAST_APPLY?'morph-v3-fast':'morph-v3-large','dry_run':_0x10867c[_0x35d84e(0x21c)]['dryRun'],'file_exists':_0x4f1f4c,'file_read_error':_0x24c94c,'file_readable':_0x88888!==null,'request_content':{'path':_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x152)],'code_edit':_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x15c)],'instruction':_0x10867c['data'][_0x35d84e(0x215)],'original_code':_0x88888!==null?_0x88888[_0x35d84e(0x230)]>0xc350?_0x88888[_0x35d84e(0x1c2)](0x0,0xc350)+_0x35d84e(0x23d)+_0x88888['length']+'\x20chars)':_0x88888:_0x35d84e(0x222)+(_0x24c94c||_0x35d84e(0x1b6))+']','original_code_length':_0x88888?.[_0x35d84e(0x230)]??0x0,'model':MORPH_FAST_APPLY?_0x35d84e(0x24a):_0x35d84e(0x22b),'dry_run':_0x10867c[_0x35d84e(0x21c)][_0x35d84e(0x1db)]}},'stack_trace':_0x3a55a1 instanceof Error?_0x3a55a1[_0x35d84e(0x15d)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x190)+_0x51a7d4}],'isError':!![]};}}case _0x35d84e(0x227):{const _0x387a00=WarpGrepArgsSchema[_0x35d84e(0x249)](_0x5a8813);if(!_0x387a00[_0x35d84e(0x16d)])return{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x159)+_0x387a00['error']}],'isError':!![]};const _0x22ee9e=_0x235a49=>{const _0x50aa68=_0x35d84e,_0x1dbc8a=[];for(const _0x5b1170 of _0x235a49||[]){if(_0x5b1170['role']===_0x50aa68(0x19a)&&Array[_0x50aa68(0x261)](_0x5b1170[_0x50aa68(0x173)]))for(const _0x2b5b89 of _0x5b1170[_0x50aa68(0x173)]){try{const _0x38d77d=_0x2b5b89[_0x50aa68(0x22a)]?.[_0x50aa68(0x1a2)],_0x2a1e71=JSON[_0x50aa68(0x224)](_0x2b5b89[_0x50aa68(0x22a)]?.[_0x50aa68(0x1f1)]||'{}');if(_0x38d77d===_0x50aa68(0x255))_0x1dbc8a['push'](_0x50aa68(0x1bf)+_0x2a1e71[_0x50aa68(0x196)]+'\x27\x20'+(_0x2a1e71[_0x50aa68(0x152)]||'.'));else{if(_0x38d77d==='read')_0x1dbc8a['push'](_0x50aa68(0x18d)+_0x2a1e71['path']);else{if(_0x38d77d===_0x50aa68(0x168))_0x1dbc8a[_0x50aa68(0x183)](_0x50aa68(0x1bc)+(_0x2a1e71['command']||'.'));else{if(_0x38d77d==='glob')_0x1dbc8a[_0x50aa68(0x183)](_0x50aa68(0x25e)+_0x2a1e71[_0x50aa68(0x196)]+'\x27\x20'+(_0x2a1e71['path']||'.'));else _0x38d77d==='finish'&&_0x1dbc8a[_0x50aa68(0x183)](_0x50aa68(0x1fc));}}}}catch{}}}return _0x1dbc8a;},_0x16bccb=_0x50255c=>{const _0x2b7774=_0x35d84e,_0x555ae6=[];if(!_0x50255c||!Array[_0x2b7774(0x261)](_0x50255c))return _0x555ae6;const _0x19a2ec=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2b7774(0x239),'tool':_0x2b7774(0x24c)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x2b7774(0x24c)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2b7774(0x1cc),'tool':_0x2b7774(0x24c)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2b7774(0x157),'tool':_0x2b7774(0x24c)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x2b7774(0x1f2)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x2b7774(0x1f2)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x2b7774(0x174),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x2b7774(0x157),'tool':_0x2b7774(0x24c)},{'pattern':/symbolic link/,'error_type':_0x2b7774(0x174),'tool':_0x2b7774(0x24c)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x2b7774(0x24c)},{'pattern':/status="error"/,'error_type':_0x2b7774(0x153),'tool':_0x2b7774(0x1c6)}];let _0x1bc810=0x0;for(const _0x34d43f of _0x50255c){_0x34d43f[_0x2b7774(0x256)]===_0x2b7774(0x19a)&&Array[_0x2b7774(0x261)](_0x34d43f[_0x2b7774(0x173)])&&_0x1bc810++;const _0x25bd60=_0x34d43f[_0x2b7774(0x151)];if((_0x34d43f[_0x2b7774(0x256)]===_0x2b7774(0x1a5)||_0x34d43f[_0x2b7774(0x256)]===_0x2b7774(0x170))&&_0x25bd60&&typeof _0x25bd60==='string')for(const {pattern:_0x2cf977,error_type:_0x50aee2,tool:_0x3cfa54}of _0x19a2ec){const _0x19c918=_0x25bd60[_0x2b7774(0x19c)](new RegExp(_0x2cf977[_0x2b7774(0x155)],'g'));if(_0x19c918)for(const _0x438664 of _0x19c918){const _0x2c207c=_0x25bd60[_0x2b7774(0x1a9)](_0x438664),_0x3cb696=_0x25bd60[_0x2b7774(0x1c2)](_0x2c207c,Math['min'](_0x2c207c+0xc8,_0x25bd60[_0x2b7774(0x230)]));_0x555ae6[_0x2b7774(0x183)]({'tool':_0x3cfa54,'error_type':_0x50aee2,'error_message':_0x3cb696['split']('\x0a')[0x0],'turn':_0x1bc810});}}}return _0x555ae6;};try{const _0x46a6e8=a0_0x53019e[_0x35d84e(0x204)](_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)]),_0x2d5f9b=_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x1c0)],_0xdd8a1f=_0x2d5f9b==='node_modules'?{'allowNames':[_0x35d84e(0x226)]}:undefined,_0x372ef2=new LocalRipgrepProvider(_0x46a6e8,undefined,_0xdd8a1f),_0x1656cd=await runWarpGrep({'searchTerm':_0x387a00['data'][_0x35d84e(0x18c)],'repoRoot':_0x46a6e8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x372ef2,'search_type':_0x2d5f9b}),_0x5a838f=_0x16bccb(_0x1656cd[_0x35d84e(0x242)]);_0x5a838f[_0x35d84e(0x230)]>0x0&&reportMorphError({'error_message':_0x35d84e(0x199)+_0x5a838f[_0x35d84e(0x230)]+_0x35d84e(0x1fe),'error_type':_0x35d84e(0x184),'level':_0x35d84e(0x26c),'tool':_0x35d84e(0x227),'context':{'repo_path':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)],'query':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'model':_0x35d84e(0x1f0),'termination_reason':_0x1656cd[_0x35d84e(0x19f)],'sub_tool_errors':_0x5a838f,'timings':_0x1656cd[_0x35d84e(0x251)],'tool_calls':_0x22ee9e(_0x1656cd[_0x35d84e(0x242)]),'messages':_0x1656cd[_0x35d84e(0x242)]?.[_0x35d84e(0x1ff)](_0x4c95dc=>({'role':_0x4c95dc[_0x35d84e(0x256)],'content':_0x4c95dc[_0x35d84e(0x151)],..._0x4c95dc['tool_calls']?{'tool_calls':_0x4c95dc[_0x35d84e(0x173)][_0x35d84e(0x230)]}:{},..._0x4c95dc[_0x35d84e(0x17f)]?{'tool_call_id':_0x4c95dc[_0x35d84e(0x17f)]}:{}}))},'source':'mcp-filesystem'})[_0x35d84e(0x1e0)](()=>{});let _0x38f5ce='';if(_0x1656cd[_0x35d84e(0x19f)]===_0x35d84e(0x1a8)&&_0x1656cd[_0x35d84e(0x1fc)]?.['metadata']?.['files']){const _0x1d1d09=_0x1656cd['finish'][_0x35d84e(0x167)][_0x35d84e(0x1a3)];if(_0x1d1d09['length']===0x0)return _0x38f5ce=_0x1656cd[_0x35d84e(0x1fc)][_0x35d84e(0x1f7)]||_0x35d84e(0x1d0),{'content':[{'type':_0x35d84e(0x241),'text':_0x38f5ce}]};const _0x10574b=[],_0xcb9113=[_0x35d84e(0x264)];for(const _0x116922 of _0x1656cd[_0x35d84e(0x242)]){if(_0x116922[_0x35d84e(0x256)]===_0x35d84e(0x19a)&&Array[_0x35d84e(0x261)](_0x116922['tool_calls']))for(const _0x4836a4 of _0x116922[_0x35d84e(0x173)]){try{const _0x4fc09f=_0x4836a4[_0x35d84e(0x22a)]?.[_0x35d84e(0x1a2)],_0x22f065=JSON[_0x35d84e(0x224)](_0x4836a4['function']?.['arguments']||'{}');if(_0x4fc09f===_0x35d84e(0x255))_0xcb9113[_0x35d84e(0x183)](_0x35d84e(0x267)+_0x22f065[_0x35d84e(0x196)]+_0x35d84e(0x247)+(_0x22f065[_0x35d84e(0x152)]||'.')+'`');else{if(_0x4fc09f==='read')_0xcb9113[_0x35d84e(0x183)](_0x35d84e(0x16a)+_0x22f065[_0x35d84e(0x152)]+'`');else{if(_0x4fc09f===_0x35d84e(0x168))_0xcb9113[_0x35d84e(0x183)]('-\x20Listed\x20directory\x20`'+(_0x22f065[_0x35d84e(0x1b5)]||'.')+'`');else _0x4fc09f===_0x35d84e(0x1ee)&&_0xcb9113[_0x35d84e(0x183)](_0x35d84e(0x1a4)+_0x22f065[_0x35d84e(0x196)]+'`\x20in\x20`'+(_0x22f065['path']||'.')+'`');}}}catch{}}}_0x10574b[_0x35d84e(0x183)](_0xcb9113['join']('\x0a'));const _0x7ee561=['',_0x35d84e(0x253)];for(const _0x28e359 of _0x1d1d09){if(_0x28e359[_0x35d84e(0x23a)]==='*')_0x7ee561[_0x35d84e(0x183)]('-\x20'+_0x28e359['path']+':*');else{if(Array[_0x35d84e(0x261)](_0x28e359[_0x35d84e(0x23a)])){const _0x5c1c4e=_0x28e359[_0x35d84e(0x23a)][_0x35d84e(0x1ff)](([_0x35753e,_0x13a39a])=>{if(_0x35753e===_0x13a39a)return''+_0x35753e;return _0x35753e+'-'+_0x13a39a;});_0x7ee561[_0x35d84e(0x183)]('-\x20'+_0x28e359['path']+':'+_0x5c1c4e['join'](','));}else _0x7ee561[_0x35d84e(0x183)]('-\x20'+_0x28e359[_0x35d84e(0x152)]+':*');}}_0x7ee561['push'](''),_0x10574b[_0x35d84e(0x183)](_0x7ee561[_0x35d84e(0x1ab)]('\x0a')),_0x10574b[_0x35d84e(0x183)](_0x35d84e(0x19e));const _0x3ecb31=[],_0x3ae822=[];for(const _0x1832e1 of _0x1d1d09){let _0x457a7f=a0_0x53019e[_0x35d84e(0x204)](_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)],_0x1832e1[_0x35d84e(0x152)]),_0x59c757=null,_0x5e288e=null;try{_0x59c757=await a0_0x3a9187[_0x35d84e(0x24f)](_0x457a7f,{'encoding':_0x35d84e(0x17a)});}catch(_0xb4925b){const _0x39b8d2=fixPathRepetition(_0x457a7f);if(_0x39b8d2)try{_0x59c757=await a0_0x3a9187[_0x35d84e(0x24f)](_0x39b8d2,{'encoding':_0x35d84e(0x17a)}),_0x457a7f=_0x39b8d2;}catch{_0x5e288e=_0xb4925b instanceof Error?_0xb4925b:new Error(String(_0xb4925b));}else _0x5e288e=_0xb4925b instanceof Error?_0xb4925b:new Error(String(_0xb4925b));}if(_0x59c757!==null){const _0x3a7ec6=_0x59c757[_0x35d84e(0x164)](/\r?\n/),_0x3d10fd=[];if(_0x1832e1[_0x35d84e(0x23a)]==='*'||!Array[_0x35d84e(0x261)](_0x1832e1['lines']))for(let _0x30dc38=0x1;_0x30dc38<=_0x3a7ec6[_0x35d84e(0x230)];_0x30dc38++){const _0x5f0b9d=_0x3a7ec6[_0x30dc38-0x1];_0x3d10fd['push'](_0x30dc38+'|\x20'+_0x5f0b9d);}else for(const [_0x1f73c0,_0x3e6e25]of _0x1832e1[_0x35d84e(0x23a)]){_0x3d10fd['length']>0x0&&_0x3d10fd['push']('');for(let _0x216b33=_0x1f73c0;_0x216b33<=_0x3e6e25&&_0x216b33<=_0x3a7ec6[_0x35d84e(0x230)];_0x216b33++){const _0x5d8c4c=_0x3a7ec6[_0x216b33-0x1];_0x3d10fd[_0x35d84e(0x183)](_0x216b33+'|\x20'+_0x5d8c4c);}}_0x3ae822[_0x35d84e(0x183)]({'path':_0x1832e1['path'],'content':_0x3d10fd[_0x35d84e(0x1ab)]('\x0a')});}else _0x3ecb31['push'](_0x35d84e(0x25b)+_0x1832e1['path']+_0x35d84e(0x19d)+(_0x5e288e?.[_0x35d84e(0x206)]||'Unknown\x20error')+_0x35d84e(0x1d5));}try{const _0x5582b0=await compactFileContexts(_0x3ae822,_0x387a00['data']['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x110695 of _0x5582b0){_0x3ecb31[_0x35d84e(0x183)](_0x35d84e(0x25b)+_0x110695['path']+'\x22>\x0a'+_0x110695[_0x35d84e(0x151)]+_0x35d84e(0x1d5));}}catch(_0x5a1a82){console[_0x35d84e(0x17c)](_0x35d84e(0x26b),_0x5a1a82);for(const _0x3dd604 of _0x3ae822){_0x3ecb31['push'](_0x35d84e(0x25b)+_0x3dd604[_0x35d84e(0x152)]+'\x22>\x0a'+_0x3dd604[_0x35d84e(0x151)]+_0x35d84e(0x1d5));}}_0x10574b['push'](_0x3ecb31[_0x35d84e(0x1ab)]('\x0a\x0a')),_0x38f5ce=_0x10574b[_0x35d84e(0x1ab)]('\x0a');const _0x5c066d=_0x1656cd[_0x35d84e(0x20c)]?.[_0x35d84e(0x26e)](_0x49af9d=>_0x49af9d[_0x35d84e(0x206)]?.[_0x35d84e(0x1d4)]('File\x20read\x20error:'))||[];if(_0x5c066d[_0x35d84e(0x230)]>0x0){const _0x5dcd63=_0x5c066d[_0x35d84e(0x1ff)](_0x53aafa=>_0x53aafa[_0x35d84e(0x206)])[_0x35d84e(0x1ab)](';\x20');reportMorphError({'error_message':_0x5dcd63,'error_type':_0x35d84e(0x25c),'context':{'tool':_0x35d84e(0x227),'repo_path':_0x387a00['data'][_0x35d84e(0x186)],'query':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'model':_0x35d84e(0x1f0),'termination_reason':_0x35d84e(0x203),'error_count':_0x5c066d[_0x35d84e(0x230)],'is_timeout':![],'timings':_0x1656cd[_0x35d84e(0x251)],'files_attempted':_0x1d1d09[_0x35d84e(0x1ff)](_0x5b5be6=>({'path':_0x5b5be6['path'],'lines':_0x5b5be6[_0x35d84e(0x23a)]})),'tool_calls':_0x22ee9e(_0x1656cd[_0x35d84e(0x242)]),'messages':_0x1656cd['messages']?.[_0x35d84e(0x1ff)](_0x9baed=>({'role':_0x9baed['role'],'content':_0x9baed[_0x35d84e(0x151)],..._0x9baed[_0x35d84e(0x173)]?{'tool_calls':_0x9baed[_0x35d84e(0x173)][_0x35d84e(0x230)]}:{},..._0x9baed['tool_call_id']?{'tool_call_id':_0x9baed[_0x35d84e(0x17f)]}:{}})),'request_content':{'query':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'repo_path':_0x387a00[_0x35d84e(0x21c)]['repo_path'],'repoRoot':a0_0x53019e['resolve'](_0x387a00[_0x35d84e(0x21c)]['repo_path']),'model':_0x35d84e(0x1f0)}},'source':_0x35d84e(0x1d6)})['catch'](()=>{});}}else{if(_0x1656cd[_0x35d84e(0x19f)]===_0x35d84e(0x221)&&_0x1656cd[_0x35d84e(0x20c)][_0x35d84e(0x230)]>0x0){const _0x34cf57=_0x1656cd[_0x35d84e(0x20c)][_0x35d84e(0x1ff)](_0x41733d=>_0x41733d[_0x35d84e(0x206)])['join'](';\x20');_0x38f5ce='Error:\x20'+_0x34cf57;const _0x42a7cd=_0x34cf57[_0x35d84e(0x225)]()[_0x35d84e(0x25d)](_0x35d84e(0x216))||_0x34cf57[_0x35d84e(0x225)]()[_0x35d84e(0x25d)]('timed\x20out')||_0x34cf57[_0x35d84e(0x225)]()[_0x35d84e(0x25d)]('etimedout'),_0x2031fe=_0x1656cd['finish']?.[_0x35d84e(0x167)]?.[_0x35d84e(0x1a3)],_0x5f0185=_0x1656cd[_0x35d84e(0x20c)][0x0];reportMorphError({'error_message':_0x34cf57,'error_type':_0x42a7cd?_0x35d84e(0x1c5):_0x5f0185?.[_0x35d84e(0x208)]?.[_0x35d84e(0x1a2)]||'WarpGrepError','context':{'tool':_0x35d84e(0x227),'repo_path':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)],'query':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'model':_0x35d84e(0x1f0),'termination_reason':_0x1656cd[_0x35d84e(0x19f)],'error_count':_0x1656cd[_0x35d84e(0x20c)][_0x35d84e(0x230)],'is_timeout':_0x42a7cd,'timings':_0x1656cd['timings'],'files_attempted':_0x2031fe?.[_0x35d84e(0x1ff)](_0x47e109=>({'path':_0x47e109[_0x35d84e(0x152)],'lines':_0x47e109[_0x35d84e(0x23a)]})),'tool_calls':_0x22ee9e(_0x1656cd[_0x35d84e(0x242)]),'messages':_0x1656cd[_0x35d84e(0x242)]?.[_0x35d84e(0x1ff)](_0x358745=>({'role':_0x358745['role'],'content':_0x358745[_0x35d84e(0x151)],..._0x358745['tool_calls']?{'tool_calls':_0x358745[_0x35d84e(0x173)][_0x35d84e(0x230)]}:{},..._0x358745[_0x35d84e(0x17f)]?{'tool_call_id':_0x358745[_0x35d84e(0x17f)]}:{}})),'request_content':{'query':_0x387a00[_0x35d84e(0x21c)]['search_string'],'repo_path':_0x387a00['data']['repo_path'],'repoRoot':a0_0x53019e[_0x35d84e(0x204)](_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)]),'model':_0x35d84e(0x1f0)}},'stack_trace':_0x5f0185?.['stack']||undefined,'source':'mcp-filesystem'})[_0x35d84e(0x1e0)](()=>{});}else _0x38f5ce=_0x35d84e(0x1aa);}return{'content':[{'type':_0x35d84e(0x241),'text':_0x38f5ce}]};}catch(_0x217f86){const _0x5c85c2=handleMorphAPIError(_0x217f86);if(_0x5c85c2)return _0x5c85c2;const _0x5d2fcd=_0x217f86 instanceof Error?_0x217f86['message']:String(_0x217f86),_0x463129=_0x5d2fcd[_0x35d84e(0x225)]()[_0x35d84e(0x25d)](_0x35d84e(0x216))||_0x5d2fcd[_0x35d84e(0x225)]()[_0x35d84e(0x25d)](_0x35d84e(0x180))||_0x5d2fcd['toLowerCase']()[_0x35d84e(0x25d)](_0x35d84e(0x1b4))||_0x217f86 instanceof Error&&_0x217f86[_0x35d84e(0x1a2)]===_0x35d84e(0x1c5);return reportMorphError({'error_message':_0x5d2fcd,'error_type':_0x463129?'TimeoutError':_0x217f86 instanceof Error?_0x217f86[_0x35d84e(0x208)][_0x35d84e(0x1a2)]:'UnknownError','context':{'tool':_0x35d84e(0x227),'repo_path':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)],'query':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'model':'morph-warp-grep-v2.1','is_timeout':_0x463129,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'repo_path':_0x387a00['data'][_0x35d84e(0x186)],'repoRoot':a0_0x53019e[_0x35d84e(0x204)](_0x387a00[_0x35d84e(0x21c)][_0x35d84e(0x186)]),'model':_0x35d84e(0x1f0)}},'stack_trace':_0x217f86 instanceof Error?_0x217f86[_0x35d84e(0x15d)]:undefined,'source':'mcp-filesystem'})[_0x35d84e(0x1e0)](()=>{}),{'content':[{'type':_0x35d84e(0x241),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x5d2fcd}],'isError':![]};}}case _0x35d84e(0x262):{const _0x1b4453=WarpGrepGitHubArgsSchema[_0x35d84e(0x249)](_0x5a8813);if(!_0x1b4453['success'])return{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x159)+_0x1b4453['error']}],'isError':!![]};const _0x5a023e=_0x1b4453['data']['github_url']||_0x1b4453[_0x35d84e(0x21c)][_0x35d84e(0x22e)];if(!_0x5a023e)return{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x1f3)}],'isError':!![]};const _0x431dea=MORPH_API_KEY;if(!_0x431dea)throw new Error(_0x35d84e(0x188));const _0x307140=Date[_0x35d84e(0x235)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x5a023e+'\x20for:\x20\x22'+_0x1b4453['data'][_0x35d84e(0x18c)]+'\x22');try{const _0x3404d5=new WarpGrepClient({'morphApiKey':_0x431dea,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x521237=await _0x3404d5[_0x35d84e(0x23e)]({'searchTerm':_0x1b4453[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'github':_0x5a023e,'branch':_0x1b4453[_0x35d84e(0x21c)][_0x35d84e(0x240)]}),_0x4280c2=Date['now']()-_0x307140;logMcpStderr(_0x35d84e(0x17d)+_0x4280c2+_0x35d84e(0x234)+_0x521237['success']);const _0x11756e=formatResult(_0x521237);return{'content':[{'type':'text','text':_0x11756e}]};}catch(_0xcc0ac4){const _0x4866ba=handleMorphAPIError(_0xcc0ac4);if(_0x4866ba)return _0x4866ba;const _0xbf0b78=Date[_0x35d84e(0x235)]()-_0x307140,_0x131fdc=_0xcc0ac4 instanceof Error?_0xcc0ac4[_0x35d84e(0x206)]:String(_0xcc0ac4);return logMcpStderr(_0x35d84e(0x1bd)+_0xbf0b78+_0x35d84e(0x15f),_0x131fdc),reportMorphError({'error_message':_0x131fdc,'error_type':_0xcc0ac4 instanceof Error?_0xcc0ac4[_0x35d84e(0x208)][_0x35d84e(0x1a2)]:_0x35d84e(0x1b1),'context':{'tool':'github_codebase_search','github_url':_0x5a023e,'search_string':_0x1b4453[_0x35d84e(0x21c)][_0x35d84e(0x18c)],'branch':_0x1b4453[_0x35d84e(0x21c)][_0x35d84e(0x240)]},'stack_trace':_0xcc0ac4 instanceof Error?_0xcc0ac4[_0x35d84e(0x15d)]:undefined,'source':_0x35d84e(0x1d6),'tool':_0x35d84e(0x262),'latency_ms':_0xbf0b78})[_0x35d84e(0x1e0)](()=>{}),{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x1b3)+_0x131fdc}],'isError':![]};}}default:throw new Error(_0x35d84e(0x18e)+_0x4af50c);}}catch(_0x1df703){const _0xbbd905=_0x1df703 instanceof Error?_0x1df703[_0x35d84e(0x206)]:String(_0x1df703);return reportMorphError({'error_message':_0xbbd905,'error_type':_0x1df703 instanceof Error?_0x1df703[_0x35d84e(0x208)][_0x35d84e(0x1a2)]:_0x35d84e(0x1b1),'context':{'tool':_0x4af50c,'arguments':_0x5a8813?JSON[_0x35d84e(0x243)](_0x5a8813)[_0x35d84e(0x1c2)](0x0,0x1f4):undefined,'mcp_server_version':_0x35d84e(0x1b7)},'stack_trace':_0x1df703 instanceof Error?_0x1df703[_0x35d84e(0x15d)]:undefined,'source':_0x35d84e(0x1d6)})[_0x35d84e(0x1e0)](()=>{}),{'content':[{'type':_0x35d84e(0x241),'text':_0x35d84e(0x163)+_0xbbd905}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x27fbb6){const _0x2e8748=a0_0x14f8f4,_0x46d742=await getValidRootDirectories(_0x27fbb6);if(_0x46d742['length']>0x0)allowedDirectories=[..._0x46d742],logMcpStderr(_0x2e8748(0x220)+_0x46d742[_0x2e8748(0x230)]+_0x2e8748(0x254));else{logMcpStderr(_0x2e8748(0x178));if(ENABLE_WORKSPACE_MODE)try{const _0x20fef0=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x20fef0&&(allowedDirectories=[_0x20fef0],logMcpStderr(_0x2e8748(0x23f)+_0x20fef0));}catch(_0x335d90){logMcpStderr(_0x2e8748(0x236)+_0x335d90);}}}server[a0_0x14f8f4(0x1c3)](RootsListChangedNotificationSchema,async()=>{const _0xaac054=a0_0x14f8f4;try{const _0x4acc38=await server[_0xaac054(0x22f)]();_0x4acc38&&_0xaac054(0x22d)in _0x4acc38&&await updateAllowedDirectoriesFromRoots(_0x4acc38[_0xaac054(0x22d)]);}catch(_0x17953e){logMcpStderr(_0xaac054(0x1ec),_0x17953e instanceof Error?_0x17953e[_0xaac054(0x206)]:String(_0x17953e));}}),server[a0_0x14f8f4(0x22c)]=async()=>{const _0x2e15b2=a0_0x14f8f4,_0xd80c73=server[_0x2e15b2(0x193)]();if(_0xd80c73?.['roots'])try{const _0x3a6bea=await server[_0x2e15b2(0x22f)]();_0x3a6bea&&'roots'in _0x3a6bea?await updateAllowedDirectoriesFromRoots(_0x3a6bea[_0x2e15b2(0x22d)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x353727){logMcpStderr(_0x2e15b2(0x218),_0x353727 instanceof Error?_0x353727[_0x2e15b2(0x206)]:String(_0x353727));}else{if(allowedDirectories[_0x2e15b2(0x230)]>0x0)logMcpStderr(_0x2e15b2(0x1a7),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x2e15b2(0x1f8));else throw new Error(_0x2e15b2(0x189));}}};async function runServer(){const _0x3ac564=a0_0x14f8f4,_0xfc7f14=new StdioServerTransport();await server[_0x3ac564(0x197)](_0xfc7f14),logMcpStderr(_0x3ac564(0x1e5)),allowedDirectories['length']===0x0&&logMcpStderr(_0x3ac564(0x213));}runServer()['catch'](_0x40a847=>{const _0x1bcebd=a0_0x14f8f4;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x40a847),process[_0x1bcebd(0x1ae)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- function a1_0x56fe(){var _0x40577a=['win32','10080kZEafV','Unknown','linux','938934NXrMkT','[os=','6616137aQhQOF','8788LkbONz','Linux','platform','1338jHlNcl','darwin','60OtymZs','4614XuzVla','10SIEHsR','Windows','1069752ieyhys','259860TRWAhx','7032695fmHfmt'];a1_0x56fe=function(){return _0x40577a;};return a1_0x56fe();}function a1_0x2e06(_0x1da249,_0x5a1e89){_0x1da249=_0x1da249-0xa4;var _0x56fece=a1_0x56fe();var _0x2e06f6=_0x56fece[_0x1da249];return _0x2e06f6;}var a1_0x3573c1=a1_0x2e06;(function(_0x193fe9,_0x5b4d50){var _0x31809e=a1_0x2e06,_0x2486d1=_0x193fe9();while(!![]){try{var _0x4cbb3f=parseInt(_0x31809e(0xa8))/0x1*(-parseInt(_0x31809e(0xab))/0x2)+parseInt(_0x31809e(0xa4))/0x3*(parseInt(_0x31809e(0xb4))/0x4)+parseInt(_0x31809e(0xac))/0x5+-parseInt(_0x31809e(0xa7))/0x6*(-parseInt(_0x31809e(0xae))/0x7)+-parseInt(_0x31809e(0xaa))/0x8+parseInt(_0x31809e(0xb1))/0x9*(-parseInt(_0x31809e(0xa6))/0xa)+-parseInt(_0x31809e(0xb3))/0xb;if(_0x4cbb3f===_0x5b4d50)break;else _0x2486d1['push'](_0x2486d1['shift']());}catch(_0x58980b){_0x2486d1['push'](_0x2486d1['shift']());}}}(a1_0x56fe,0xcb727));import a1_0x1e20e6 from'os';export function getOperatingSystemType(_0x36c500=a1_0x1e20e6[a1_0x3573c1(0xb6)]()){var _0x31d2a5=a1_0x3573c1;switch(_0x36c500){case _0x31d2a5(0xa5):return'macOS';case _0x31d2a5(0xad):return _0x31d2a5(0xa9);case _0x31d2a5(0xb0):return _0x31d2a5(0xb5);default:return _0x31d2a5(0xaf);}}export function formatMcpLogMessage(_0x27d6f5,_0x5a9e29=a1_0x1e20e6[a1_0x3573c1(0xb6)]()){var _0x35b208=a1_0x3573c1;return _0x35b208(0xb2)+getOperatingSystemType(_0x5a9e29)+']\x20'+_0x27d6f5;}export function logMcpStderr(_0xe86e11,..._0x3b8475){console['error'](formatMcpLogMessage(_0xe86e11),..._0x3b8475);}
1
+ function a1_0x207c(_0x3c4279,_0x832f06){_0x3c4279=_0x3c4279-0xd0;var _0x12e876=a1_0x12e8();var _0x207ccb=_0x12e876[_0x3c4279];return _0x207ccb;}var a1_0x1c4fce=a1_0x207c;(function(_0x441525,_0x7374eb){var _0x44ee2f=a1_0x207c,_0x747d6e=_0x441525();while(!![]){try{var _0x21b010=parseInt(_0x44ee2f(0xd0))/0x1*(parseInt(_0x44ee2f(0xe0))/0x2)+parseInt(_0x44ee2f(0xd5))/0x3*(parseInt(_0x44ee2f(0xd9))/0x4)+parseInt(_0x44ee2f(0xd4))/0x5*(-parseInt(_0x44ee2f(0xe3))/0x6)+-parseInt(_0x44ee2f(0xd8))/0x7+parseInt(_0x44ee2f(0xdc))/0x8*(-parseInt(_0x44ee2f(0xe2))/0x9)+parseInt(_0x44ee2f(0xd1))/0xa+parseInt(_0x44ee2f(0xda))/0xb*(parseInt(_0x44ee2f(0xe1))/0xc);if(_0x21b010===_0x7374eb)break;else _0x747d6e['push'](_0x747d6e['shift']());}catch(_0x10bf35){_0x747d6e['push'](_0x747d6e['shift']());}}}(a1_0x12e8,0x3474e));import a1_0x22b290 from'os';function a1_0x12e8(){var _0x456523=['7982QCrHpv','13512evDAMs','13851PNinUI','456072BBoQiK','87WZravS','430530mkdKqK','Unknown','Linux','25wkMxBa','177bYXkSM','Windows','error','1980307TrBjuW','28472KBhVAP','1397pwhPok','win32','392jvHxmD','darwin','platform','linux'];a1_0x12e8=function(){return _0x456523;};return a1_0x12e8();}export function getOperatingSystemType(_0x37f129=a1_0x22b290[a1_0x1c4fce(0xde)]()){var _0x3cc408=a1_0x1c4fce;switch(_0x37f129){case _0x3cc408(0xdd):return'macOS';case _0x3cc408(0xdb):return _0x3cc408(0xd6);case _0x3cc408(0xdf):return _0x3cc408(0xd3);default:return _0x3cc408(0xd2);}}export function formatMcpLogMessage(_0x31df0d,_0x47c542=a1_0x22b290[a1_0x1c4fce(0xde)]()){return'[os='+getOperatingSystemType(_0x47c542)+']\x20'+_0x31df0d;}export function logMcpStderr(_0x5381ce,..._0x16b730){var _0x3be72a=a1_0x1c4fce;console[_0x3be72a(0xd7)](formatMcpLogMessage(_0x5381ce),..._0x16b730);}
@@ -1 +1 @@
1
- (function(_0x60f885,_0x5d410c){const _0x5df8b6=a2_0xc41c,_0x48548a=_0x60f885();while(!![]){try{const _0x2fb422=parseInt(_0x5df8b6(0x125))/0x1*(-parseInt(_0x5df8b6(0x121))/0x2)+parseInt(_0x5df8b6(0x116))/0x3+-parseInt(_0x5df8b6(0x11a))/0x4*(-parseInt(_0x5df8b6(0x119))/0x5)+-parseInt(_0x5df8b6(0x129))/0x6+-parseInt(_0x5df8b6(0x124))/0x7*(-parseInt(_0x5df8b6(0x11f))/0x8)+-parseInt(_0x5df8b6(0x11e))/0x9+parseInt(_0x5df8b6(0x11b))/0xa;if(_0x2fb422===_0x5d410c)break;else _0x48548a['push'](_0x48548a['shift']());}catch(_0x478324){_0x48548a['push'](_0x48548a['shift']());}}}(a2_0x22b2,0xc4dc1));function a2_0x22b2(){const _0x15b2b7=['1505355JxRyBJ','normalize','charAt','9210VJfHVP','2564xgdvaf','10193970qELvxI','match','/mnt/','5095422kmEhBD','48ltOxrK','join','10MEsBIb','homedir','toUpperCase','360458ISmywy','16967UORIkp','slice','trim','substring','9321228hSkZug','replace','startsWith'];a2_0x22b2=function(){return _0x15b2b7;};return a2_0x22b2();}import a2_0x16d211 from'path';import a2_0x13b61f from'os';export function convertToWindowsPath(_0x399d44){const _0x1c92b1=a2_0xc41c;if(_0x399d44[_0x1c92b1(0x115)](_0x1c92b1(0x11d))){const _0xfe5b28=_0x399d44[_0x1c92b1(0x118)](0x5)[_0x1c92b1(0x123)](),_0x217925=_0x399d44['slice'](0x6)['replace'](/\//g,'\x5c');return _0xfe5b28+':'+_0x217925;}if(_0x399d44[_0x1c92b1(0x11c)](/^\/[a-zA-Z]\//)){const _0x499f5d=_0x399d44[_0x1c92b1(0x118)](0x1)[_0x1c92b1(0x123)](),_0x2e92bc=_0x399d44[_0x1c92b1(0x126)](0x2)[_0x1c92b1(0x114)](/\//g,'\x5c');return _0x499f5d+':'+_0x2e92bc;}if(_0x399d44[_0x1c92b1(0x11c)](/^[a-zA-Z]:/))return _0x399d44[_0x1c92b1(0x114)](/\//g,'\x5c');return _0x399d44;}function a2_0xc41c(_0x43d12d,_0xd4d1eb){_0x43d12d=_0x43d12d-0x114;const _0x22b286=a2_0x22b2();let _0xc41c44=_0x22b286[_0x43d12d];return _0xc41c44;}export function normalizePath(_0x4958d3){const _0x5cc727=a2_0xc41c;_0x4958d3=_0x4958d3[_0x5cc727(0x127)]()[_0x5cc727(0x114)](/^["']|["']$/g,'');const _0xe757b0=_0x4958d3[_0x5cc727(0x115)]('/')&&!_0x4958d3[_0x5cc727(0x11c)](/^\/mnt\/[a-z]\//i)&&!_0x4958d3[_0x5cc727(0x11c)](/^\/[a-zA-Z]\//);if(_0xe757b0)return _0x4958d3[_0x5cc727(0x114)](/\/+/g,'/')['replace'](/\/+$/,'');_0x4958d3=convertToWindowsPath(_0x4958d3);if(_0x4958d3[_0x5cc727(0x115)]('\x5c\x5c')){let _0x12175e=_0x4958d3;_0x12175e=_0x12175e[_0x5cc727(0x114)](/^\\{2,}/,'\x5c\x5c');const _0x5622ab=_0x12175e[_0x5cc727(0x128)](0x2)[_0x5cc727(0x114)](/\\\\/g,'\x5c');_0x4958d3='\x5c\x5c'+_0x5622ab;}else _0x4958d3=_0x4958d3[_0x5cc727(0x114)](/\\\\/g,'\x5c');let _0xe06dd2=a2_0x16d211[_0x5cc727(0x117)](_0x4958d3);_0x4958d3[_0x5cc727(0x115)]('\x5c\x5c')&&!_0xe06dd2[_0x5cc727(0x115)]('\x5c\x5c')&&(_0xe06dd2='\x5c'+_0xe06dd2);if(_0xe06dd2[_0x5cc727(0x11c)](/^[a-zA-Z]:/)){let _0x5b1137=_0xe06dd2[_0x5cc727(0x114)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x5b1137)&&(_0x5b1137=_0x5b1137[_0x5cc727(0x118)](0x0)[_0x5cc727(0x123)]()+_0x5b1137[_0x5cc727(0x126)](0x1)),_0x5b1137;}return _0xe06dd2[_0x5cc727(0x114)](/\//g,'\x5c');}export function expandHome(_0x68ddb6){const _0x36592a=a2_0xc41c;if(_0x68ddb6[_0x36592a(0x115)]('~/')||_0x68ddb6==='~')return a2_0x16d211[_0x36592a(0x120)](a2_0x13b61f[_0x36592a(0x122)](),_0x68ddb6[_0x36592a(0x126)](0x1));return _0x68ddb6;}
1
+ function a2_0x5cda(){const _0xb1c28b=['3784pbnBFb','slice','235354FpwNJX','test','/mnt/','startsWith','toUpperCase','7oEszEK','6221RMQDEX','983754osHYJh','charAt','match','replace','substring','6VfHzuY','61788RQkXfh','15740yutOcV','normalize','5pBqxiK','trim','627264OaHwql','homedir','1082248ngDFCY'];a2_0x5cda=function(){return _0xb1c28b;};return a2_0x5cda();}(function(_0x1644d4,_0x5ef526){const _0x45b4a4=a2_0x3d7b,_0x33da31=_0x1644d4();while(!![]){try{const _0x5335d6=-parseInt(_0x45b4a4(0x10d))/0x1+parseInt(_0x45b4a4(0x107))/0x2*(-parseInt(_0x45b4a4(0x113))/0x3)+-parseInt(_0x45b4a4(0x102))/0x4+-parseInt(_0x45b4a4(0x100))/0x5*(parseInt(_0x45b4a4(0xfd))/0x6)+-parseInt(_0x45b4a4(0x10c))/0x7*(-parseInt(_0x45b4a4(0x104))/0x8)+-parseInt(_0x45b4a4(0x10e))/0x9+-parseInt(_0x45b4a4(0xfe))/0xa*(-parseInt(_0x45b4a4(0x105))/0xb);if(_0x5335d6===_0x5ef526)break;else _0x33da31['push'](_0x33da31['shift']());}catch(_0x48cc01){_0x33da31['push'](_0x33da31['shift']());}}}(a2_0x5cda,0x26c16));function a2_0x3d7b(_0x14ca38,_0x549910){_0x14ca38=_0x14ca38-0xfd;const _0x5cdaf4=a2_0x5cda();let _0x3d7b85=_0x5cdaf4[_0x14ca38];return _0x3d7b85;}import a2_0x299186 from'path';import a2_0x39a506 from'os';export function convertToWindowsPath(_0x549d1e){const _0x578935=a2_0x3d7b;if(_0x549d1e[_0x578935(0x10a)](_0x578935(0x109))){const _0x5c968b=_0x549d1e[_0x578935(0x10f)](0x5)[_0x578935(0x10b)](),_0x3582f9=_0x549d1e[_0x578935(0x106)](0x6)[_0x578935(0x111)](/\//g,'\x5c');return _0x5c968b+':'+_0x3582f9;}if(_0x549d1e['match'](/^\/[a-zA-Z]\//)){const _0x19f216=_0x549d1e[_0x578935(0x10f)](0x1)[_0x578935(0x10b)](),_0x2ccd2f=_0x549d1e[_0x578935(0x106)](0x2)[_0x578935(0x111)](/\//g,'\x5c');return _0x19f216+':'+_0x2ccd2f;}if(_0x549d1e['match'](/^[a-zA-Z]:/))return _0x549d1e[_0x578935(0x111)](/\//g,'\x5c');return _0x549d1e;}export function normalizePath(_0x4349e8){const _0x5187f1=a2_0x3d7b;_0x4349e8=_0x4349e8[_0x5187f1(0x101)]()[_0x5187f1(0x111)](/^["']|["']$/g,'');const _0x4da153=_0x4349e8[_0x5187f1(0x10a)]('/')&&!_0x4349e8['match'](/^\/mnt\/[a-z]\//i)&&!_0x4349e8[_0x5187f1(0x110)](/^\/[a-zA-Z]\//);if(_0x4da153)return _0x4349e8[_0x5187f1(0x111)](/\/+/g,'/')['replace'](/\/+$/,'');_0x4349e8=convertToWindowsPath(_0x4349e8);if(_0x4349e8[_0x5187f1(0x10a)]('\x5c\x5c')){let _0x47cc61=_0x4349e8;_0x47cc61=_0x47cc61[_0x5187f1(0x111)](/^\\{2,}/,'\x5c\x5c');const _0x2dca6e=_0x47cc61[_0x5187f1(0x112)](0x2)[_0x5187f1(0x111)](/\\\\/g,'\x5c');_0x4349e8='\x5c\x5c'+_0x2dca6e;}else _0x4349e8=_0x4349e8[_0x5187f1(0x111)](/\\\\/g,'\x5c');let _0x4b20d6=a2_0x299186[_0x5187f1(0xff)](_0x4349e8);_0x4349e8[_0x5187f1(0x10a)]('\x5c\x5c')&&!_0x4b20d6['startsWith']('\x5c\x5c')&&(_0x4b20d6='\x5c'+_0x4b20d6);if(_0x4b20d6['match'](/^[a-zA-Z]:/)){let _0xd21944=_0x4b20d6['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x5187f1(0x108)](_0xd21944)&&(_0xd21944=_0xd21944[_0x5187f1(0x10f)](0x0)[_0x5187f1(0x10b)]()+_0xd21944['slice'](0x1)),_0xd21944;}return _0x4b20d6[_0x5187f1(0x111)](/\//g,'\x5c');}export function expandHome(_0x50978d){const _0x3ee053=a2_0x3d7b;if(_0x50978d[_0x3ee053(0x10a)]('~/')||_0x50978d==='~')return a2_0x299186['join'](a2_0x39a506[_0x3ee053(0x103)](),_0x50978d[_0x3ee053(0x106)](0x1));return _0x50978d;}
@@ -1 +1 @@
1
- (function(_0x5e712d,_0x5ac9a0){const _0x1a6457=a3_0x44bc,_0x363727=_0x5e712d();while(!![]){try{const _0x360acf=parseInt(_0x1a6457(0x147))/0x1*(-parseInt(_0x1a6457(0x146))/0x2)+parseInt(_0x1a6457(0x13e))/0x3+parseInt(_0x1a6457(0x14c))/0x4*(parseInt(_0x1a6457(0x14a))/0x5)+parseInt(_0x1a6457(0x153))/0x6*(-parseInt(_0x1a6457(0x145))/0x7)+-parseInt(_0x1a6457(0x14b))/0x8*(parseInt(_0x1a6457(0x151))/0x9)+-parseInt(_0x1a6457(0x141))/0xa+parseInt(_0x1a6457(0x13f))/0xb;if(_0x360acf===_0x5ac9a0)break;else _0x363727['push'](_0x363727['shift']());}catch(_0x1e16ad){_0x363727['push'](_0x363727['shift']());}}}(a3_0x1123,0xe3d8d));import a3_0x57a1fc from'path';function a3_0x1123(){const _0x4eb09c=['231831HmBoDw','11353056ENeFBL','includes','16171020Xaiugr','resolve','startsWith','sep','150843nBMyEs','1442vIVqUP','61uTCcvY','some','Path\x20must\x20be\x20absolute\x20after\x20normalization','700490JneNUS','535288qbttqA','48DvJAJK','normalize','length','isAbsolute','string','9Qmicix','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','36MqLTrz'];a3_0x1123=function(){return _0x4eb09c;};return a3_0x1123();}function a3_0x44bc(_0x4c25ee,_0x5ee88f){_0x4c25ee=_0x4c25ee-0x13e;const _0x112349=a3_0x1123();let _0x44bc1b=_0x112349[_0x4c25ee];return _0x44bc1b;}export function isPathWithinAllowedDirectories(_0x77f4e6,_0x209a6e){const _0x276271=a3_0x44bc;if(typeof _0x77f4e6!==_0x276271(0x150)||!Array['isArray'](_0x209a6e))return![];if(!_0x77f4e6||_0x209a6e[_0x276271(0x14e)]===0x0)return![];if(_0x77f4e6[_0x276271(0x140)]('\x00'))return![];let _0x37e9c6;try{_0x37e9c6=a3_0x57a1fc[_0x276271(0x142)](a3_0x57a1fc[_0x276271(0x14d)](_0x77f4e6));}catch{return![];}if(!a3_0x57a1fc[_0x276271(0x14f)](_0x37e9c6))throw new Error(_0x276271(0x149));return _0x209a6e[_0x276271(0x148)](_0xe98f66=>{const _0x5863fd=_0x276271;if(typeof _0xe98f66!==_0x5863fd(0x150)||!_0xe98f66)return![];if(_0xe98f66[_0x5863fd(0x140)]('\x00'))return![];let _0x2350fc;try{_0x2350fc=a3_0x57a1fc[_0x5863fd(0x142)](a3_0x57a1fc[_0x5863fd(0x14d)](_0xe98f66));}catch{return![];}if(!a3_0x57a1fc[_0x5863fd(0x14f)](_0x2350fc))throw new Error(_0x5863fd(0x152));if(_0x37e9c6===_0x2350fc)return!![];if(_0x2350fc===a3_0x57a1fc[_0x5863fd(0x144)])return _0x37e9c6[_0x5863fd(0x143)](a3_0x57a1fc[_0x5863fd(0x144)]);return _0x37e9c6['startsWith'](_0x2350fc+a3_0x57a1fc[_0x5863fd(0x144)]);});}
1
+ function a3_0x4d87(_0x5aa7b1,_0x195ffe){_0x5aa7b1=_0x5aa7b1-0x181;const _0x3f406e=a3_0x3f40();let _0x4d87f1=_0x3f406e[_0x5aa7b1];return _0x4d87f1;}(function(_0x5b6f6f,_0x93cc6a){const _0x4d43fe=a3_0x4d87,_0x49cd9a=_0x5b6f6f();while(!![]){try{const _0x5a8801=parseInt(_0x4d43fe(0x18c))/0x1*(-parseInt(_0x4d43fe(0x194))/0x2)+-parseInt(_0x4d43fe(0x188))/0x3*(parseInt(_0x4d43fe(0x182))/0x4)+-parseInt(_0x4d43fe(0x191))/0x5+parseInt(_0x4d43fe(0x189))/0x6+parseInt(_0x4d43fe(0x18e))/0x7+-parseInt(_0x4d43fe(0x190))/0x8+parseInt(_0x4d43fe(0x187))/0x9*(parseInt(_0x4d43fe(0x186))/0xa);if(_0x5a8801===_0x93cc6a)break;else _0x49cd9a['push'](_0x49cd9a['shift']());}catch(_0x3cf557){_0x49cd9a['push'](_0x49cd9a['shift']());}}}(a3_0x3f40,0x8800d));import a3_0x449b1e from'path';export function isPathWithinAllowedDirectories(_0x4eca49,_0x274d03){const _0x174c24=a3_0x4d87;if(typeof _0x4eca49!==_0x174c24(0x183)||!Array['isArray'](_0x274d03))return![];if(!_0x4eca49||_0x274d03['length']===0x0)return![];if(_0x4eca49[_0x174c24(0x184)]('\x00'))return![];let _0xef4d9c;try{_0xef4d9c=a3_0x449b1e['resolve'](a3_0x449b1e[_0x174c24(0x18d)](_0x4eca49));}catch{return![];}if(!a3_0x449b1e['isAbsolute'](_0xef4d9c))throw new Error(_0x174c24(0x18a));return _0x274d03[_0x174c24(0x192)](_0x3c00fd=>{const _0x3c24dd=_0x174c24;if(typeof _0x3c00fd!=='string'||!_0x3c00fd)return![];if(_0x3c00fd[_0x3c24dd(0x184)]('\x00'))return![];let _0x34b5ce;try{_0x34b5ce=a3_0x449b1e[_0x3c24dd(0x181)](a3_0x449b1e['normalize'](_0x3c00fd));}catch{return![];}if(!a3_0x449b1e[_0x3c24dd(0x18f)](_0x34b5ce))throw new Error(_0x3c24dd(0x18b));if(_0xef4d9c===_0x34b5ce)return!![];if(_0x34b5ce===a3_0x449b1e[_0x3c24dd(0x193)])return _0xef4d9c['startsWith'](a3_0x449b1e['sep']);return _0xef4d9c[_0x3c24dd(0x185)](_0x34b5ce+a3_0x449b1e['sep']);});}function a3_0x3f40(){const _0x23e38f=['includes','startsWith','8204290BAOqGJ','18Yypcff','57jChNst','3927948iDuefU','Path\x20must\x20be\x20absolute\x20after\x20normalization','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','179317mpLSrB','normalize','1109955ZrpEwA','isAbsolute','2986128eKLLYq','3490960EVowTh','some','sep','6FsAJdE','resolve','60548rGLUQM','string'];a3_0x3f40=function(){return _0x23e38f;};return a3_0x3f40();}
@@ -1 +1 @@
1
- (function(_0x27a42d,_0x1a5417){const _0x42cdb2=a4_0x3005,_0x38cf69=_0x27a42d();while(!![]){try{const _0x40b114=parseInt(_0x42cdb2(0x1ac))/0x1*(-parseInt(_0x42cdb2(0x1af))/0x2)+-parseInt(_0x42cdb2(0x1bf))/0x3+-parseInt(_0x42cdb2(0x1ab))/0x4*(parseInt(_0x42cdb2(0x1c2))/0x5)+parseInt(_0x42cdb2(0x1b2))/0x6+-parseInt(_0x42cdb2(0x1b0))/0x7*(parseInt(_0x42cdb2(0x1bd))/0x8)+parseInt(_0x42cdb2(0x1b6))/0x9+parseInt(_0x42cdb2(0x1b5))/0xa;if(_0x40b114===_0x1a5417)break;else _0x38cf69['push'](_0x38cf69['shift']());}catch(_0x33a8d6){_0x38cf69['push'](_0x38cf69['shift']());}}}(a4_0x204a,0x6e1df));import{promises as a4_0x488c1e}from'fs';import a4_0x3d59fd from'path';function a4_0x3005(_0x143631,_0x373932){_0x143631=_0x143631-0x1aa;const _0x204acc=a4_0x204a();let _0x300529=_0x204acc[_0x143631];return _0x300529;}import a4_0x1be421 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x34f2ce){const _0x45518e=a4_0x3005;try{const _0x5338bb=_0x34f2ce[_0x45518e(0x1aa)](_0x45518e(0x1b4))?_0x34f2ce[_0x45518e(0x1ba)](0x7):_0x34f2ce,_0x291bdb=_0x5338bb[_0x45518e(0x1aa)]('~/')||_0x5338bb==='~'?a4_0x3d59fd[_0x45518e(0x1c1)](a4_0x1be421[_0x45518e(0x1c0)](),_0x5338bb[_0x45518e(0x1ba)](0x1)):_0x5338bb,_0x55193d=a4_0x3d59fd[_0x45518e(0x1ae)](_0x291bdb),_0x7438c6=await a4_0x488c1e[_0x45518e(0x1b9)](_0x55193d);return normalizePath(_0x7438c6);}catch{return null;}}function formatDirectoryError(_0x3a02a0,_0x3ea0cd,_0x485179){const _0x32b80d=a4_0x3005;if(_0x485179)return'Skipping\x20'+_0x485179+':\x20'+_0x3a02a0;const _0x40f294=_0x3ea0cd instanceof Error?_0x3ea0cd[_0x32b80d(0x1b8)]:String(_0x3ea0cd);return _0x32b80d(0x1b1)+_0x3a02a0+_0x32b80d(0x1be)+_0x40f294;}function a4_0x204a(){const _0x1921ab=['resolve','18RblBaC','63WxhAGV','Skipping\x20invalid\x20directory:\x20','2798520IRayGK','uri','file://','10646590iclWTJ','4908429qocOMl','stat','message','realpath','slice','non-directory\x20root','invalid\x20path\x20or\x20inaccessible','272784jbctdZ','\x20due\x20to\x20error:\x20','2588358NZflBX','homedir','join','2249875yRoIyn','startsWith','4hieDLQ','642PXUDOd','push'];a4_0x204a=function(){return _0x1921ab;};return a4_0x204a();}export async function getValidRootDirectories(_0x5cb47f){const _0x2d4326=a4_0x3005,_0x27e28f=[];for(const _0x3ac09e of _0x5cb47f){const _0x49d6a5=await parseRootUri(_0x3ac09e[_0x2d4326(0x1b3)]);if(!_0x49d6a5){logMcpStderr(formatDirectoryError(_0x3ac09e['uri'],undefined,_0x2d4326(0x1bc)));continue;}try{const _0x5a5c6b=await a4_0x488c1e[_0x2d4326(0x1b7)](_0x49d6a5);_0x5a5c6b['isDirectory']()?_0x27e28f[_0x2d4326(0x1ad)](_0x49d6a5):logMcpStderr(formatDirectoryError(_0x49d6a5,undefined,_0x2d4326(0x1bb)));}catch(_0x5ac6b3){logMcpStderr(formatDirectoryError(_0x49d6a5,_0x5ac6b3));}}return _0x27e28f;}
1
+ (function(_0x551f7b,_0xe551cc){const _0x356c7f=a4_0x25e0,_0x23c8a2=_0x551f7b();while(!![]){try{const _0x46ac3f=-parseInt(_0x356c7f(0xa7))/0x1*(-parseInt(_0x356c7f(0x97))/0x2)+parseInt(_0x356c7f(0xa1))/0x3+parseInt(_0x356c7f(0xa6))/0x4*(-parseInt(_0x356c7f(0xa5))/0x5)+parseInt(_0x356c7f(0x9c))/0x6*(-parseInt(_0x356c7f(0x9b))/0x7)+-parseInt(_0x356c7f(0xa4))/0x8+parseInt(_0x356c7f(0x99))/0x9+-parseInt(_0x356c7f(0x9a))/0xa;if(_0x46ac3f===_0xe551cc)break;else _0x23c8a2['push'](_0x23c8a2['shift']());}catch(_0x5a01f8){_0x23c8a2['push'](_0x23c8a2['shift']());}}}(a4_0x58c3,0x39cd7));import{promises as a4_0x450fa4}from'fs';import a4_0x3c10f8 from'path';import a4_0x516240 from'os';import{normalizePath}from'./path-utils.js';function a4_0x25e0(_0x493427,_0x338182){_0x493427=_0x493427-0x96;const _0x58c334=a4_0x58c3();let _0x25e0ed=_0x58c334[_0x493427];return _0x25e0ed;}function a4_0x58c3(){const _0x39416d=['3491910TpQTIl','2356300zodBYp','7fyrLSJ','405948gSIQng','isDirectory','stat','slice','realpath','1411524VCkKlf','homedir','Skipping\x20invalid\x20directory:\x20','2404648puDfRH','30tlvqhY','138668rHeUAd','47533KZaDVo','file://','join','uri','startsWith','Skipping\x20','invalid\x20path\x20or\x20inaccessible','\x20due\x20to\x20error:\x20','non-directory\x20root','8vjvpbY','message'];a4_0x58c3=function(){return _0x39416d;};return a4_0x58c3();}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x42fb5e){const _0x477355=a4_0x25e0;try{const _0x4dd43a=_0x42fb5e[_0x477355(0xab)](_0x477355(0xa8))?_0x42fb5e[_0x477355(0x9f)](0x7):_0x42fb5e,_0x14ded9=_0x4dd43a[_0x477355(0xab)]('~/')||_0x4dd43a==='~'?a4_0x3c10f8[_0x477355(0xa9)](a4_0x516240[_0x477355(0xa2)](),_0x4dd43a[_0x477355(0x9f)](0x1)):_0x4dd43a,_0xa1094f=a4_0x3c10f8['resolve'](_0x14ded9),_0xb6ddf1=await a4_0x450fa4[_0x477355(0xa0)](_0xa1094f);return normalizePath(_0xb6ddf1);}catch{return null;}}function formatDirectoryError(_0x47525d,_0x379c39,_0xb93e66){const _0x169dd5=a4_0x25e0;if(_0xb93e66)return _0x169dd5(0xac)+_0xb93e66+':\x20'+_0x47525d;const _0x1d8f71=_0x379c39 instanceof Error?_0x379c39[_0x169dd5(0x98)]:String(_0x379c39);return _0x169dd5(0xa3)+_0x47525d+_0x169dd5(0xae)+_0x1d8f71;}export async function getValidRootDirectories(_0x48bd9a){const _0x501b3f=a4_0x25e0,_0x344b50=[];for(const _0x1be809 of _0x48bd9a){const _0x2d1777=await parseRootUri(_0x1be809[_0x501b3f(0xaa)]);if(!_0x2d1777){logMcpStderr(formatDirectoryError(_0x1be809[_0x501b3f(0xaa)],undefined,_0x501b3f(0xad)));continue;}try{const _0x520fad=await a4_0x450fa4[_0x501b3f(0x9e)](_0x2d1777);_0x520fad[_0x501b3f(0x9d)]()?_0x344b50['push'](_0x2d1777):logMcpStderr(formatDirectoryError(_0x2d1777,undefined,_0x501b3f(0x96)));}catch(_0x2f4cd5){logMcpStderr(formatDirectoryError(_0x2d1777,_0x2f4cd5));}}return _0x344b50;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.157",
3
+ "version": "0.8.159",
4
4
  "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@google/generative-ai": "^0.21.0",
37
37
  "@modelcontextprotocol/sdk": "^1.12.3",
38
- "@morphllm/morphsdk": "0.2.160",
38
+ "@morphllm/morphsdk": "0.2.161",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",