@morphllm/morphmcp 0.8.145 → 0.8.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/log-utils.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x23a6f4=a0_0x6cf3;(function(_0x3aed29,_0xfd87f1){const _0xda0b95=a0_0x6cf3,_0x3c754e=_0x3aed29();while(!![]){try{const _0xdf2052=-parseInt(_0xda0b95(0x20a))/0x1*(-parseInt(_0xda0b95(0x25b))/0x2)+parseInt(_0xda0b95(0x198))/0x3+parseInt(_0xda0b95(0x1ab))/0x4*(parseInt(_0xda0b95(0x159))/0x5)+-parseInt(_0xda0b95(0x1db))/0x6*(-parseInt(_0xda0b95(0x18c))/0x7)+-parseInt(_0xda0b95(0x18d))/0x8+-parseInt(_0xda0b95(0x1f6))/0x9+-parseInt(_0xda0b95(0x257))/0xa*(-parseInt(_0xda0b95(0x183))/0xb);if(_0xdf2052===_0xfd87f1)break;else _0x3c754e['push'](_0x3c754e['shift']());}catch(_0x3caade){_0x3c754e['push'](_0x3c754e['shift']());}}}(a0_0x2f57,0xc8afb));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_0x372d7a from'fs/promises';import a0_0x388e0f from'path';import a0_0x477f98 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import a0_0x2d5c68 from'axios';function fixPathRepetition(_0x1aa7f9){const _0x1f577c=a0_0x6cf3,_0x1317e5=_0x1aa7f9['split'](a0_0x388e0f['sep'])[_0x1f577c(0x1d0)](Boolean);if(_0x1317e5['length']<0x2)return null;for(let _0x3e6be1=Math['floor'](_0x1317e5[_0x1f577c(0x187)]/0x2);_0x3e6be1>=0x1;_0x3e6be1--){for(let _0x1dd63d=0x0;_0x1dd63d<=_0x1317e5[_0x1f577c(0x187)]-0x2*_0x3e6be1;_0x1dd63d++){const _0x3c82de=_0x1317e5['slice'](_0x1dd63d,_0x1dd63d+_0x3e6be1),_0x59bd09=_0x1317e5[_0x1f577c(0x173)](_0x1dd63d+_0x3e6be1,_0x1dd63d+0x2*_0x3e6be1);if(_0x3c82de[_0x1f577c(0x1d6)]((_0x4a5ee4,_0x2f80b4)=>_0x4a5ee4===_0x59bd09[_0x2f80b4])){const _0x3c484a=[..._0x1317e5[_0x1f577c(0x173)](0x0,_0x1dd63d),..._0x1317e5['slice'](_0x1dd63d+_0x3e6be1)];return a0_0x388e0f['sep']+_0x3c484a['join'](a0_0x388e0f[_0x1f577c(0x1ae)]);}}}return null;}const require=createRequire(import.meta.url);function a0_0x2f57(){const _0x23fea6=['default','edit_file','setNotificationHandler','user','realpath','unknown\x20error','map','changes','-\x20Glob\x20search\x20`','composer.json','RipgrepError','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','string','[github_codebase_search]\x20Done\x20in\x20','mcp-filesystem','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','indexOf','\x0a</file>','grep\x20\x27','Relevant\x20context\x20found:','etimedout','completionId','[could\x20not\x20read\x20file:\x20','Cargo.toml','cwd','finish','argv','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','pyproject.toml','has','stringify','requiresApiKey','tool_calls','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','linesRemoved','dirname','`\x20in\x20`','Fatal\x20error\x20running\x20server:','820gaEeXi','Unknown\x20error','code_edit','search_string','2335706ZMfUWR','messages','search_type','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','version','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Max\x20results\x20to\x20return',',\x20removed\x20','node_modules','sk-','\x20\x20morph-mcp','getClientCapabilities','errors','instruction','Applied','45DhZJib','github_codebase_search','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','roots','function','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','params','isArray','all','Morph\x20Edit\x20Preview','timed\x20out','success','morph-v3-fast','message','PWD','glob\x20\x27','ToolException','Workspace\x20mode\x20enabled:\x20Using\x20','WarpGrepError','\x22.\x20Known\x20tools:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x0aExamples:','.\x20Path:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Listed\x20directory\x20`','payload','slice','branch','Failed\x20to\x20read\x20file:\x20','FileReadError','catch','completed','\x22>\x0aError\x20reading\x20file:\x20','.\x20Changes:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','glob','source','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','\x20error(s)','stack','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','https://morphllm.com/api/error-report','140657jCMdKw','go.mod','Warning:\x20','ms:','length','GitHub\x20search\x20failed:\x20','list_directory\x20','<file\x20path=\x22','substring','1911049JvKJGj','11684144uQVCmK','[github_codebase_search]\x20Failed\x20in\x20','utf-8','-\x20Read\x20file\x20`','role','\x20-\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','ReadError','package.json','parse','1009749SJqcNb','metadata','repo_path','match','read','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','\x20as\x20allowed\x20directory','.vscode','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','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','UnknownError','pattern','\x20is\x20not\x20a\x20directory','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','lines','dryRun','TimeoutError','timeout','startsWith','211920UcdRaE','\x27\x20in\x20`','0.2.0','sep','tool_call_id','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','FileNotFound','env','application/json','includes','grep','--help','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','resolve','@morphllm/morphmcp\x20','Repository\x20identifier','name','Disabled\x20tools:\x20','\x20valid\x20directories','Preview\x20changes\x20without\x20applying\x20them.','assistant','Error\x20running\x20fast\x20context\x20search:\x20','code','morph-warp-grep-v2.1','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','--version','arguments','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','some','ENOENT','\x20for:\x20\x22','join','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','connect','split','RipgrepNotAvailable','Error:\x20','filter','ENABLE_WORKSPACE_MODE','now','content','SubToolError','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','every','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','description','added\x20','ms.\x20Success:\x20','6tQlOPi','toLowerCase','min','readFile','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Rules:\x0a','Morph\x20FastApply\x20failed\x20without\x20error\x20message','BinaryFile','enum','boolean','morph-','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','MORPH_API_KEY','-\x20Grepped\x20\x27','\x0aOptions:','files','optional','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','DISABLED_TOOLS','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','setRequestHandler','Morph\x20Edit\x20','unknown','SymlinkError','command','error','❌\x20Morph\x20Edit\x20Failed:\x20','9182412BPXthr','MORPH_WARP_GREP_TIMEOUT','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','path','../package.json','oninitialized','trim','warn','completed_with_file_errors','morph-mcp','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','normalize','toISOString','codebase_search','searchGitHub','data','runWarpGrep_call','exit','1nqcHkd','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','constructor','basename','File\x20read\x20error:','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.','linesAdded','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','--api-key=','log','isDirectory','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','Fallback:\x20Using\x20workspace\x20root\x20','linesModified','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','text','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','Warning:\x20Workspace\x20fallback\x20failed:\x20','push','Here\x20is\x20the\x20content\x20of\x20files:\x0a','listRoots','WORKSPACE_ROOT','Tool\x20\x22','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','.git','timings','object','terminationReason','access','safeParse','Unknown\x20tool:\x20','describe','Error\x20accessing\x20directory\x20','tool'];a0_0x2f57=function(){return _0x23fea6;};return a0_0x2f57();}function getPackageVersion(){const _0x3b30ce=a0_0x6cf3;try{const _0x239e90=require(_0x3b30ce(0x1fc));return _0x239e90[_0x3b30ce(0x25f)]??_0x3b30ce(0x1f1);}catch(_0x3b2336){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x3b2336),'unknown';}}function printHelp(){const _0x2a2c73=a0_0x6cf3;console[_0x2a2c73(0x216)](_0x2a2c73(0x1b9)+getPackageVersion()),console[_0x2a2c73(0x216)](_0x2a2c73(0x25e)),console['log'](_0x2a2c73(0x1e9)),console['log'](_0x2a2c73(0x1cb)),console[_0x2a2c73(0x216)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x2a2c73(0x216)](_0x2a2c73(0x23b)),console[_0x2a2c73(0x216)](_0x2a2c73(0x16e)),console['log'](_0x2a2c73(0x266)),console[_0x2a2c73(0x216)](_0x2a2c73(0x252));}const cliArgs=process[a0_0x23a6f4(0x24b)][a0_0x23a6f4(0x173)](0x2),VERSION_FLAGS=new Set([a0_0x23a6f4(0x1c4),'-v','-V']),HELP_FLAGS=new Set([a0_0x23a6f4(0x1b6),'-h']);cliArgs[a0_0x23a6f4(0x1c7)](_0x2b09ba=>VERSION_FLAGS['has'](_0x2b09ba))&&(console[a0_0x23a6f4(0x216)](a0_0x23a6f4(0x1b9)+getPackageVersion()),process[a0_0x23a6f4(0x209)](0x0));cliArgs[a0_0x23a6f4(0x1c7)](_0x670684=>HELP_FLAGS[a0_0x23a6f4(0x24e)](_0x670684))&&(printHelp(),process[a0_0x23a6f4(0x209)](0x0));function getCliArg(_0xb8b05b){const _0xcd5c2b=a0_0x23a6f4;for(let _0x519995=0x0;_0x519995<cliArgs[_0xcd5c2b(0x187)];_0x519995++){const _0x190f03=cliArgs[_0x519995];if(_0x190f03['startsWith']('--'+_0xb8b05b+'='))return _0x190f03[_0xcd5c2b(0x173)](('--'+_0xb8b05b+'=')[_0xcd5c2b(0x187)]);if(_0x190f03==='--'+_0xb8b05b&&_0x519995+0x1<cliArgs[_0xcd5c2b(0x187)])return cliArgs[_0x519995+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x23a6f4(0x187)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x23a6f4(0x24e)](arg)||HELP_FLAGS[a0_0x23a6f4(0x24e)](arg))continue;if(arg[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x215)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process['env'][a0_0x23a6f4(0x222)]||process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x167)]||process[a0_0x23a6f4(0x249)](),ENABLE_WORKSPACE_MODE=process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1d1)]!=='false',MORPH_API_KEY=getCliArg('api-key')??process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1e7)],MORPH_API_URL=process[a0_0x23a6f4(0x1b2)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x23a6f4(0x1f7)]?parseInt(process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1f7)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x23a6f4(0x231),a0_0x23a6f4(0x205),a0_0x23a6f4(0x15a)]),DISABLED_TOOLS=process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1ed)]?new Set(process[a0_0x23a6f4(0x1b2)]['DISABLED_TOOLS'][a0_0x23a6f4(0x1cd)](',')[a0_0x23a6f4(0x236)](_0x577a1b=>_0x577a1b[a0_0x23a6f4(0x1fe)]())[a0_0x23a6f4(0x1d0)](_0x832cb=>_0x832cb[a0_0x23a6f4(0x187)]>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x23a6f4(0x24e)](tool)&&console['error'](a0_0x23a6f4(0x20c)+tool+a0_0x23a6f4(0x16c)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x23a6f4(0x1f4)](a0_0x23a6f4(0x1bc)+[...DISABLED_TOOLS][a0_0x23a6f4(0x1ca)](',\x20'));}function a0_0x6cf3(_0x392938,_0x3ef6eb){_0x392938=_0x392938-0x157;const _0x2f5768=a0_0x2f57();let _0x6cf34f=_0x2f5768[_0x392938];return _0x6cf34f;}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x265))&&!MORPH_API_KEY[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x1e5))&&logMcpStderr(a0_0x23a6f4(0x1a0));async function reportMorphError(_0x21b85c){const _0x2226e2=a0_0x23a6f4;try{await a0_0x2d5c68['post'](_0x2226e2(0x182),{..._0x21b85c,'timestamp':new Date()[_0x2226e2(0x204)](),'source':_0x21b85c[_0x2226e2(0x17d)]||_0x2226e2(0x23f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x21b85c['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x2226e2(0x1b3),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x23a6f4(0x240)),logMcpStderr(a0_0x23a6f4(0x24c)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x23a6f4(0x1d7)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x23a6f4(0x224)));function normalizePath(_0x12114b){const _0x306574=a0_0x23a6f4;return a0_0x388e0f[_0x306574(0x203)](_0x12114b);}function expandHome(_0x515d8d){const _0x409be7=a0_0x23a6f4;if(_0x515d8d[_0x409be7(0x1aa)]('~/')||_0x515d8d==='~')return a0_0x388e0f[_0x409be7(0x1ca)](a0_0x477f98['homedir'](),_0x515d8d[_0x409be7(0x173)](0x1));return _0x515d8d;}let allowedDirectories=await Promise['all'](args[a0_0x23a6f4(0x236)](async _0x1fda58=>{const _0x353f0c=expandHome(_0x1fda58),_0x35b7ba=a0_0x388e0f['resolve'](_0x353f0c);try{const _0x406947=await a0_0x372d7a['realpath'](_0x35b7ba);return normalizePath(_0x406947);}catch(_0x263e33){return normalizePath(_0x35b7ba);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x23a6f4(0x187)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x23a6f4(0x21f)](workspaceDir),logMcpStderr(a0_0x23a6f4(0x16a)+workspaceDir+a0_0x23a6f4(0x19e)));}catch(a0_0x7084ff){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x7084ff);}async function detectWorkspaceRoot(_0x3c2420){const _0xd369d8=a0_0x23a6f4;let _0x4bd508=a0_0x388e0f['resolve'](_0x3c2420);const _0x1870cb=[_0xd369d8(0x226),_0xd369d8(0x19f),_0xd369d8(0x196),_0xd369d8(0x248),_0xd369d8(0x24d),_0xd369d8(0x184),'.cursor','tsconfig.json',_0xd369d8(0x239)];while(_0x4bd508!==a0_0x388e0f[_0xd369d8(0x254)](_0x4bd508)){for(const _0x34bd4e of _0x1870cb){const _0x8c06e2=a0_0x388e0f['join'](_0x4bd508,_0x34bd4e);try{return await a0_0x372d7a[_0xd369d8(0x22a)](_0x8c06e2),normalizePath(_0x4bd508);}catch{}}_0x4bd508=a0_0x388e0f[_0xd369d8(0x254)](_0x4bd508);}return normalizePath(_0x3c2420);}await Promise[a0_0x23a6f4(0x161)](args[a0_0x23a6f4(0x236)](async _0x5705e3=>{const _0x4b3042=a0_0x23a6f4;try{const _0x2e6beb=await a0_0x372d7a['stat'](expandHome(_0x5705e3));!_0x2e6beb[_0x4b3042(0x217)]()&&(logMcpStderr(_0x4b3042(0x1cf)+_0x5705e3+_0x4b3042(0x1a4)),process[_0x4b3042(0x209)](0x1));}catch(_0x5c1aee){logMcpStderr(_0x4b3042(0x22e)+_0x5705e3+':',_0x5c1aee),process[_0x4b3042(0x209)](0x1);}}));async function validatePath(_0x4f52ea){const _0x2b73f7=a0_0x23a6f4,_0x18abda=expandHome(_0x4f52ea),_0x1566fc=a0_0x388e0f[_0x2b73f7(0x1b8)](_0x18abda);try{const _0xc00ac1=await a0_0x372d7a[_0x2b73f7(0x234)](_0x1566fc);return _0xc00ac1;}catch(_0x43dbf8){if(_0x43dbf8[_0x2b73f7(0x1c1)]===_0x2b73f7(0x1c8)){const _0x37b159=a0_0x388e0f[_0x2b73f7(0x254)](_0x1566fc);try{const _0x30491e=await a0_0x372d7a[_0x2b73f7(0x234)](_0x37b159);return a0_0x388e0f['join'](_0x30491e,a0_0x388e0f[_0x2b73f7(0x20e)](_0x1566fc));}catch{throw new Error(_0x2b73f7(0x170)+_0x37b159);}}throw _0x43dbf8;}}const MorphEditFileArgsSchema=z[a0_0x23a6f4(0x228)]({'path':z[a0_0x23a6f4(0x23d)](),'code_edit':z['string']()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x260)),'dryRun':z[a0_0x23a6f4(0x1e4)]()[a0_0x23a6f4(0x230)](![])[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x1be))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x23a6f4(0x210),WarpGrepArgsSchema=z[a0_0x23a6f4(0x228)]({'search_string':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x23a6f4(0x23d)]()['describe'](a0_0x23a6f4(0x17e)),'search_type':z[a0_0x23a6f4(0x1e3)]([a0_0x23a6f4(0x230),a0_0x23a6f4(0x264)])['optional']()['describe'](a0_0x23a6f4(0x21b))}),WarpGrepGitHubArgsSchema=z[a0_0x23a6f4(0x228)]({'search_string':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x22d)]('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_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()['describe'](a0_0x23a6f4(0x212)),'branch':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x22d)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x23a6f4(0x23d)]()['describe'](a0_0x23a6f4(0x1ba)),'branch':z[a0_0x23a6f4(0x23d)]()['optional']()['describe'](a0_0x23a6f4(0x1ee)),'commitHash':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x23a6f4(0x23d)]())[a0_0x23a6f4(0x230)]([])[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x202)),'limit':z['number']()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x230)](0xa)[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x262))}),server=new Server({'name':a0_0x23a6f4(0x201),'version':a0_0x23a6f4(0x1ad)},{'capabilities':{'tools':{}}});server[a0_0x23a6f4(0x1ef)](ListToolsRequestSchema,async()=>{const _0x292d00=a0_0x23a6f4,_0x26a311=[{'name':_0x292d00(0x231),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x292d00(0x1ec)+_0x292d00(0x193)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+_0x292d00(0x1c6)+_0x292d00(0x23c)+_0x292d00(0x17b)+_0x292d00(0x15b)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x292d00(0x15e)+_0x292d00(0x214)+'For\x20deletions:\x0a'+_0x292d00(0x1f8)+_0x292d00(0x1d5)+_0x292d00(0x1e0)+_0x292d00(0x21d)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x292d00(0x19d)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x292d00(0x225)+_0x292d00(0x1c3)+'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','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x292d00(0x205),'description':_0x292d00(0x1a1)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x292d00(0x1fa)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x34fe8f=_0x26a311[_0x292d00(0x1d0)](_0x19d560=>{const _0x47bf7c=_0x292d00;if(DISABLED_TOOLS[_0x47bf7c(0x24e)](_0x19d560[_0x47bf7c(0x1bb)]))return console['error']('Tool\x20'+_0x19d560['name']+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x47bf7c(0x250)in _0x19d560&&_0x19d560[_0x47bf7c(0x250)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x19d560[_0x47bf7c(0x1bb)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x34fe8f['map'](_0x551b22=>({'name':_0x551b22[_0x292d00(0x1bb)],'description':_0x551b22[_0x292d00(0x1d8)],'inputSchema':_0x551b22['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0xe153fb=>{const _0x3e4c67=a0_0x23a6f4,{name:_0x4dc166,arguments:_0x125058}=_0xe153fb[_0x3e4c67(0x15f)];try{if(DISABLED_TOOLS[_0x3e4c67(0x24e)](_0x4dc166))throw new Error(_0x3e4c67(0x223)+_0x4dc166+_0x3e4c67(0x218));switch(_0x4dc166){case _0x3e4c67(0x231):{const _0x579491=MorphEditFileArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x579491[_0x3e4c67(0x164)])throw new Error(_0x3e4c67(0x261)+_0x579491['error']);const _0x46e233=await validatePath(_0x579491[_0x3e4c67(0x207)]['path']);let _0x2764a8=null,_0x27deb6=!![],_0xbd2a63=null;try{_0x2764a8=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x46e233,_0x3e4c67(0x18f));}catch(_0x32fcac){const _0x35e6b6=_0x32fcac[_0x3e4c67(0x1c1)];_0x35e6b6===_0x3e4c67(0x1c8)?(_0x27deb6=![],_0x2764a8=''):(_0xbd2a63=_0x3e4c67(0x175)+(_0x35e6b6||_0x3e4c67(0x1f1))+_0x3e4c67(0x192)+(_0x32fcac instanceof Error?_0x32fcac[_0x3e4c67(0x166)]:String(_0x32fcac)),logMcpStderr(_0x3e4c67(0x185)+_0xbd2a63));}let _0x5cc0b3;try{const _0x1572d5=MORPH_API_KEY;if(!_0x1572d5)throw new Error(_0x3e4c67(0x213));const _0xcc0734=a0_0x388e0f[_0x3e4c67(0x254)](_0x46e233),_0x1c1770=a0_0x388e0f[_0x3e4c67(0x20e)](_0x46e233),_0x10b9fa=await executeEditFile({'target_filepath':_0x1c1770,'code_edit':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x259)],'instructions':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)]},{'morphApiKey':_0x1572d5,'morphApiUrl':MORPH_API_URL,'baseDir':_0xcc0734,'autoWrite':!_0x579491[_0x3e4c67(0x207)]['dryRun'],'generateUdiff':![],'debug':![]});_0x5cc0b3=_0x10b9fa[_0x3e4c67(0x246)];if(!_0x10b9fa[_0x3e4c67(0x164)])throw new Error(_0x10b9fa['error']||_0x3e4c67(0x1e1));const _0x293050=_0x10b9fa[_0x3e4c67(0x237)],_0x8e61b5=_0x3e4c67(0x1d9)+_0x293050[_0x3e4c67(0x211)]+_0x3e4c67(0x263)+_0x293050[_0x3e4c67(0x253)]+',\x20modified\x20'+_0x293050[_0x3e4c67(0x21a)];if(_0x579491[_0x3e4c67(0x207)]['dryRun'])return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x162)+(_0x27deb6?'':'\x20(new\x20file)')+':\x20'+_0x579491['data'][_0x3e4c67(0x157)]+_0x3e4c67(0x17a)+_0x8e61b5+'.\x20Path:\x20'+_0x579491['data'][_0x3e4c67(0x1fb)]+'.'}]};return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1f0)+(_0x27deb6?_0x3e4c67(0x158):'Created\x20File')+':\x20'+_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)]+_0x3e4c67(0x17a)+_0x8e61b5+_0x3e4c67(0x16f)+_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1fb)]+'.'}]};}catch(_0x42f1f9){const _0x5d2c40=_0x42f1f9 instanceof Error?_0x42f1f9[_0x3e4c67(0x166)]:String(_0x42f1f9);return reportMorphError({'error_message':_0x5d2c40,'error_type':_0x42f1f9 instanceof Error?_0x42f1f9['constructor']['name']:'UnknownError','context':{'tool':_0x3e4c67(0x231),'completion_id':_0x5cc0b3,'file_path':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1fb)],'validated_path':_0x46e233,'instruction':_0x579491['data'][_0x3e4c67(0x157)],'model':_0x3e4c67(0x165),'dry_run':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1a7)],'file_exists':_0x27deb6,'file_read_error':_0xbd2a63,'file_readable':_0x2764a8!==null,'request_content':{'path':_0x579491['data']['path'],'code_edit':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x259)],'instruction':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)],'original_code':_0x2764a8!==null?_0x2764a8['length']>0xc350?_0x2764a8[_0x3e4c67(0x18b)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x2764a8[_0x3e4c67(0x187)]+'\x20chars)':_0x2764a8:_0x3e4c67(0x247)+(_0xbd2a63||_0x3e4c67(0x235))+']','original_code_length':_0x2764a8?.[_0x3e4c67(0x187)]??0x0,'model':_0x3e4c67(0x165),'dry_run':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1a7)]}},'stack_trace':_0x42f1f9 instanceof Error?_0x42f1f9['stack']:undefined,'source':_0x3e4c67(0x23f)})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1f5)+_0x5d2c40}],'isError':!![]};}}case _0x3e4c67(0x205):{const _0x32f81a=WarpGrepArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x32f81a['success'])return{'content':[{'type':_0x3e4c67(0x21c),'text':'Invalid\x20arguments:\x20'+_0x32f81a[_0x3e4c67(0x1f4)]}],'isError':!![]};const _0x4710a2=_0x30396d=>{const _0x5cf2f6=_0x3e4c67,_0x4581de=[];for(const _0x333390 of _0x30396d||[]){if(_0x333390[_0x5cf2f6(0x191)]===_0x5cf2f6(0x1bf)&&Array['isArray'](_0x333390[_0x5cf2f6(0x251)]))for(const _0x59da43 of _0x333390[_0x5cf2f6(0x251)]){try{const _0x429988=_0x59da43[_0x5cf2f6(0x15d)]?.[_0x5cf2f6(0x1bb)],_0x10cb85=JSON[_0x5cf2f6(0x197)](_0x59da43['function']?.[_0x5cf2f6(0x1c5)]||'{}');if(_0x429988==='grep_search')_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x243)+_0x10cb85['pattern']+'\x27\x20'+(_0x10cb85[_0x5cf2f6(0x1fb)]||'.'));else{if(_0x429988===_0x5cf2f6(0x19c))_0x4581de[_0x5cf2f6(0x21f)]('read\x20'+_0x10cb85['path']);else{if(_0x429988==='list_directory')_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x189)+(_0x10cb85[_0x5cf2f6(0x1f3)]||'.'));else{if(_0x429988===_0x5cf2f6(0x17c))_0x4581de['push'](_0x5cf2f6(0x168)+_0x10cb85[_0x5cf2f6(0x1a3)]+'\x27\x20'+(_0x10cb85['path']||'.'));else _0x429988==='finish'&&_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x24a));}}}}catch{}}}return _0x4581de;},_0x450d45=_0x3abe52=>{const _0x14e55f=_0x3e4c67,_0x2f5015=[];if(!_0x3abe52||!Array[_0x14e55f(0x160)](_0x3abe52))return _0x2f5015;const _0x1407ff=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x14e55f(0x1b1),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x14e55f(0x195),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x14e55f(0x1e2),'tool':_0x14e55f(0x19c)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x14e55f(0x23a),'tool':_0x14e55f(0x1b5)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x14e55f(0x1ce),'tool':_0x14e55f(0x1b5)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x14e55f(0x1e2),'tool':_0x14e55f(0x19c)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x14e55f(0x19c)},{'pattern':/not a text file/,'error_type':_0x14e55f(0x1e2),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x14e55f(0x1f2),'tool':_0x14e55f(0x19c)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x14e55f(0x19c)},{'pattern':/status="error"/,'error_type':_0x14e55f(0x169),'tool':_0x14e55f(0x1f1)}];let _0x4a0557=0x0;for(const _0x4fde3f of _0x3abe52){_0x4fde3f[_0x14e55f(0x191)]===_0x14e55f(0x1bf)&&Array[_0x14e55f(0x160)](_0x4fde3f[_0x14e55f(0x251)])&&_0x4a0557++;const _0x3b9992=_0x4fde3f[_0x14e55f(0x1d3)];if((_0x4fde3f['role']===_0x14e55f(0x22f)||_0x4fde3f['role']===_0x14e55f(0x233))&&_0x3b9992&&typeof _0x3b9992===_0x14e55f(0x23d))for(const {pattern:_0x2f8b6f,error_type:_0x2b1594,tool:_0x11f69e}of _0x1407ff){const _0x42c768=_0x3b9992[_0x14e55f(0x19b)](new RegExp(_0x2f8b6f[_0x14e55f(0x17d)],'g'));if(_0x42c768)for(const _0x367f7c of _0x42c768){const _0x5c9a06=_0x3b9992[_0x14e55f(0x241)](_0x367f7c),_0x28da35=_0x3b9992[_0x14e55f(0x18b)](_0x5c9a06,Math[_0x14e55f(0x1dd)](_0x5c9a06+0xc8,_0x3b9992[_0x14e55f(0x187)]));_0x2f5015[_0x14e55f(0x21f)]({'tool':_0x11f69e,'error_type':_0x2b1594,'error_message':_0x28da35['split']('\x0a')[0x0],'turn':_0x4a0557});}}}return _0x2f5015;};try{const _0x5d6553=a0_0x388e0f['resolve'](_0x32f81a['data'][_0x3e4c67(0x19a)]),_0xf5e966=_0x32f81a['data'][_0x3e4c67(0x25d)],_0x17d9b8=_0xf5e966===_0x3e4c67(0x264)?{'allowNames':[_0x3e4c67(0x264)]}:undefined,_0x33f375=new LocalRipgrepProvider(_0x5d6553,undefined,_0x17d9b8),_0x524c58=await runWarpGrep({'searchTerm':_0x32f81a[_0x3e4c67(0x207)]['search_string'],'repoRoot':_0x5d6553,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x33f375,'search_type':_0xf5e966}),_0x24e387=_0x450d45(_0x524c58['messages']);_0x24e387[_0x3e4c67(0x187)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x24e387[_0x3e4c67(0x187)]+_0x3e4c67(0x17f),'error_type':_0x3e4c67(0x1d4),'level':_0x3e4c67(0x1ff),'tool':_0x3e4c67(0x205),'context':{'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x524c58[_0x3e4c67(0x229)],'sub_tool_errors':_0x24e387,'timings':_0x524c58[_0x3e4c67(0x227)],'tool_calls':_0x4710a2(_0x524c58[_0x3e4c67(0x25c)]),'messages':_0x524c58[_0x3e4c67(0x25c)]?.[_0x3e4c67(0x236)](_0x506d83=>({'role':_0x506d83[_0x3e4c67(0x191)],'content':_0x506d83[_0x3e4c67(0x1d3)],..._0x506d83[_0x3e4c67(0x251)]?{'tool_calls':_0x506d83[_0x3e4c67(0x251)][_0x3e4c67(0x187)]}:{},..._0x506d83['tool_call_id']?{'tool_call_id':_0x506d83[_0x3e4c67(0x1af)]}:{}}))},'source':_0x3e4c67(0x23f)})['catch'](()=>{});let _0x50fda5='';if(_0x524c58[_0x3e4c67(0x229)]===_0x3e4c67(0x178)&&_0x524c58[_0x3e4c67(0x24a)]?.['metadata']?.[_0x3e4c67(0x1ea)]){const _0x591545=_0x524c58[_0x3e4c67(0x24a)][_0x3e4c67(0x199)][_0x3e4c67(0x1ea)];if(_0x591545[_0x3e4c67(0x187)]===0x0)return _0x50fda5=_0x524c58['finish'][_0x3e4c67(0x172)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':'text','text':_0x50fda5}]};const _0xd395a2=[],_0x11c5a2=[_0x3e4c67(0x1b7)];for(const _0x1b489e of _0x524c58[_0x3e4c67(0x25c)]){if(_0x1b489e[_0x3e4c67(0x191)]===_0x3e4c67(0x1bf)&&Array[_0x3e4c67(0x160)](_0x1b489e[_0x3e4c67(0x251)]))for(const _0xd7c578 of _0x1b489e[_0x3e4c67(0x251)]){try{const _0xb4845b=_0xd7c578['function']?.['name'],_0x436d21=JSON['parse'](_0xd7c578[_0x3e4c67(0x15d)]?.['arguments']||'{}');if(_0xb4845b==='grep_search')_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x1e8)+_0x436d21[_0x3e4c67(0x1a3)]+_0x3e4c67(0x1ac)+(_0x436d21[_0x3e4c67(0x1fb)]||'.')+'`');else{if(_0xb4845b===_0x3e4c67(0x19c))_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x190)+_0x436d21[_0x3e4c67(0x1fb)]+'`');else{if(_0xb4845b==='list_directory')_0x11c5a2['push'](_0x3e4c67(0x171)+(_0x436d21[_0x3e4c67(0x1f3)]||'.')+'`');else _0xb4845b===_0x3e4c67(0x17c)&&_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x238)+_0x436d21['pattern']+_0x3e4c67(0x255)+(_0x436d21['path']||'.')+'`');}}}catch{}}}_0xd395a2[_0x3e4c67(0x21f)](_0x11c5a2[_0x3e4c67(0x1ca)]('\x0a'));const _0x1e9937=['',_0x3e4c67(0x244)];for(const _0x196c38 of _0x591545){if(_0x196c38[_0x3e4c67(0x1a6)]==='*')_0x1e9937[_0x3e4c67(0x21f)]('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':*');else{if(Array['isArray'](_0x196c38[_0x3e4c67(0x1a6)])){const _0x2c7d51=_0x196c38[_0x3e4c67(0x1a6)][_0x3e4c67(0x236)](([_0x4ef144,_0x23d34d])=>{if(_0x4ef144===_0x23d34d)return''+_0x4ef144;return _0x4ef144+'-'+_0x23d34d;});_0x1e9937['push']('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':'+_0x2c7d51[_0x3e4c67(0x1ca)](','));}else _0x1e9937[_0x3e4c67(0x21f)]('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':*');}}_0x1e9937['push'](''),_0xd395a2[_0x3e4c67(0x21f)](_0x1e9937['join']('\x0a')),_0xd395a2[_0x3e4c67(0x21f)](_0x3e4c67(0x220));const _0x57f3ad=[];for(const _0x363f63 of _0x591545){let _0x1c345b=a0_0x388e0f['resolve'](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],_0x363f63[_0x3e4c67(0x1fb)]),_0x1d5d09=null,_0x49ef77=null;try{_0x1d5d09=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x1c345b,{'encoding':_0x3e4c67(0x18f)});}catch(_0x1ad704){const _0x1ba6f6=fixPathRepetition(_0x1c345b);if(_0x1ba6f6)try{_0x1d5d09=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x1ba6f6,{'encoding':_0x3e4c67(0x18f)}),_0x1c345b=_0x1ba6f6;}catch{_0x49ef77=_0x1ad704 instanceof Error?_0x1ad704:new Error(String(_0x1ad704));}else _0x49ef77=_0x1ad704 instanceof Error?_0x1ad704:new Error(String(_0x1ad704));}if(_0x1d5d09!==null){const _0x30623f=_0x1d5d09[_0x3e4c67(0x1cd)](/\r?\n/),_0x30f839=[_0x3e4c67(0x18a)+_0x363f63[_0x3e4c67(0x1fb)]+'\x22>'];if(_0x363f63[_0x3e4c67(0x1a6)]==='*'||!Array[_0x3e4c67(0x160)](_0x363f63[_0x3e4c67(0x1a6)]))for(let _0x45b319=0x1;_0x45b319<=_0x30623f['length'];_0x45b319++){const _0x1237d1=_0x30623f[_0x45b319-0x1];_0x30f839[_0x3e4c67(0x21f)](_0x45b319+'|\x20'+_0x1237d1);}else for(const [_0x843ca1,_0x4ff3ec]of _0x363f63[_0x3e4c67(0x1a6)]){_0x30f839[_0x3e4c67(0x187)]>0x1&&_0x30f839[_0x3e4c67(0x21f)]('');for(let _0x586858=_0x843ca1;_0x586858<=_0x4ff3ec&&_0x586858<=_0x30623f['length'];_0x586858++){const _0x15eeac=_0x30623f[_0x586858-0x1];_0x30f839['push'](_0x586858+'|\x20'+_0x15eeac);}}_0x30f839['push']('</file>'),_0x57f3ad[_0x3e4c67(0x21f)](_0x30f839['join']('\x0a'));}else _0x57f3ad['push'](_0x3e4c67(0x18a)+_0x363f63[_0x3e4c67(0x1fb)]+_0x3e4c67(0x179)+(_0x49ef77?.['message']||_0x3e4c67(0x258))+_0x3e4c67(0x242));}_0xd395a2[_0x3e4c67(0x21f)](_0x57f3ad[_0x3e4c67(0x1ca)]('\x0a\x0a')),_0x50fda5=_0xd395a2[_0x3e4c67(0x1ca)]('\x0a');const _0xc4470a=_0x524c58[_0x3e4c67(0x268)]?.[_0x3e4c67(0x1d0)](_0x4d95dc=>_0x4d95dc[_0x3e4c67(0x166)]?.[_0x3e4c67(0x1aa)](_0x3e4c67(0x20f)))||[];if(_0xc4470a['length']>0x0){const _0x3dacd8=_0xc4470a[_0x3e4c67(0x236)](_0x4df51d=>_0x4df51d['message'])['join'](';\x20');reportMorphError({'error_message':_0x3dacd8,'error_type':_0x3e4c67(0x176),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x3e4c67(0x200),'error_count':_0xc4470a['length'],'is_timeout':![],'timings':_0x524c58[_0x3e4c67(0x227)],'files_attempted':_0x591545['map'](_0x3a7eac=>({'path':_0x3a7eac[_0x3e4c67(0x1fb)],'lines':_0x3a7eac[_0x3e4c67(0x1a6)]})),'tool_calls':_0x4710a2(_0x524c58[_0x3e4c67(0x25c)]),'messages':_0x524c58['messages']?.[_0x3e4c67(0x236)](_0x5dab11=>({'role':_0x5dab11[_0x3e4c67(0x191)],'content':_0x5dab11['content'],..._0x5dab11[_0x3e4c67(0x251)]?{'tool_calls':_0x5dab11['tool_calls'][_0x3e4c67(0x187)]}:{},..._0x5dab11['tool_call_id']?{'tool_call_id':_0x5dab11[_0x3e4c67(0x1af)]}:{}})),'request_content':{'query':_0x32f81a[_0x3e4c67(0x207)]['search_string'],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)]['repo_path']),'model':_0x3e4c67(0x1c2)}},'source':_0x3e4c67(0x23f)})['catch'](()=>{});}}else{if(_0x524c58[_0x3e4c67(0x229)]==='terminated'&&_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x187)]>0x0){const _0x512ccd=_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x236)](_0x1134ea=>_0x1134ea[_0x3e4c67(0x166)])['join'](';\x20');_0x50fda5='Error:\x20'+_0x512ccd;const _0xc7701c=_0x512ccd['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x1a9))||_0x512ccd['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x163))||_0x512ccd[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x245)),_0x3a3edb=_0x524c58[_0x3e4c67(0x24a)]?.['metadata']?.[_0x3e4c67(0x1ea)],_0xcf0738=_0x524c58[_0x3e4c67(0x268)][0x0];reportMorphError({'error_message':_0x512ccd,'error_type':_0xc7701c?_0x3e4c67(0x1a8):_0xcf0738?.[_0x3e4c67(0x20d)]?.[_0x3e4c67(0x1bb)]||_0x3e4c67(0x16b),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a['data'][_0x3e4c67(0x19a)],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x524c58['terminationReason'],'error_count':_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x187)],'is_timeout':_0xc7701c,'timings':_0x524c58[_0x3e4c67(0x227)],'files_attempted':_0x3a3edb?.[_0x3e4c67(0x236)](_0x1cd144=>({'path':_0x1cd144[_0x3e4c67(0x1fb)],'lines':_0x1cd144['lines']})),'tool_calls':_0x4710a2(_0x524c58['messages']),'messages':_0x524c58['messages']?.['map'](_0x5b29d2=>({'role':_0x5b29d2[_0x3e4c67(0x191)],'content':_0x5b29d2['content'],..._0x5b29d2[_0x3e4c67(0x251)]?{'tool_calls':_0x5b29d2[_0x3e4c67(0x251)]['length']}:{},..._0x5b29d2['tool_call_id']?{'tool_call_id':_0x5b29d2[_0x3e4c67(0x1af)]}:{}})),'request_content':{'query':_0x32f81a['data']['search_string'],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)]),'model':_0x3e4c67(0x1c2)}},'stack_trace':_0xcf0738?.[_0x3e4c67(0x180)]||undefined,'source':_0x3e4c67(0x23f)})['catch'](()=>{});}else _0x50fda5=_0x3e4c67(0x1f9);}return{'content':[{'type':'text','text':_0x50fda5}]};}catch(_0x284ee1){const _0x17658a=_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x166)]:String(_0x284ee1),_0x381601=_0x17658a['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x1a9))||_0x17658a[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x163))||_0x17658a[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x245))||_0x284ee1 instanceof Error&&_0x284ee1['name']===_0x3e4c67(0x1a8);return reportMorphError({'error_message':_0x17658a,'error_type':_0x381601?_0x3e4c67(0x1a8):_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'is_timeout':_0x381601,'exception_phase':_0x3e4c67(0x208),'request_content':{'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)]),'model':_0x3e4c67(0x1c2)}},'stack_trace':_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x180)]:undefined,'source':_0x3e4c67(0x23f)})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1c0)+_0x17658a}],'isError':![]};}}case _0x3e4c67(0x15a):{const _0x58cd5f=WarpGrepGitHubArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x58cd5f[_0x3e4c67(0x164)])return{'content':[{'type':_0x3e4c67(0x21c),'text':'Invalid\x20arguments:\x20'+_0x58cd5f[_0x3e4c67(0x1f4)]}],'isError':!![]};const _0x12374b=_0x58cd5f[_0x3e4c67(0x207)]['github_url']||_0x58cd5f[_0x3e4c67(0x207)]['owner_repo'];if(!_0x12374b)return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1b0)}],'isError':!![]};const _0x42bda8=MORPH_API_KEY;if(!_0x42bda8)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x272149=Date[_0x3e4c67(0x1d2)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x12374b+_0x3e4c67(0x1c9)+_0x58cd5f[_0x3e4c67(0x207)]['search_string']+'\x22');try{const _0xbe4cb9=new WarpGrepClient({'morphApiKey':_0x42bda8,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x31ea58=await _0xbe4cb9[_0x3e4c67(0x206)]({'searchTerm':_0x58cd5f['data'][_0x3e4c67(0x25a)],'github':_0x12374b,'branch':_0x58cd5f[_0x3e4c67(0x207)][_0x3e4c67(0x174)]}),_0x397be0=Date[_0x3e4c67(0x1d2)]()-_0x272149;logMcpStderr(_0x3e4c67(0x23e)+_0x397be0+_0x3e4c67(0x1da)+_0x31ea58['success']);const _0x5acd50=formatResult(_0x31ea58);return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x5acd50}]};}catch(_0x171d63){const _0x5ef0da=Date[_0x3e4c67(0x1d2)]()-_0x272149,_0x46bd95=_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x166)]:String(_0x171d63);return logMcpStderr(_0x3e4c67(0x18e)+_0x5ef0da+_0x3e4c67(0x186),_0x46bd95),reportMorphError({'error_message':_0x46bd95,'error_type':_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':'github_codebase_search','github_url':_0x12374b,'search_string':_0x58cd5f[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'branch':_0x58cd5f[_0x3e4c67(0x207)]['branch']},'stack_trace':_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x180)]:undefined,'source':_0x3e4c67(0x23f),'tool':_0x3e4c67(0x15a),'latency_ms':_0x5ef0da})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x188)+_0x46bd95}],'isError':![]};}}default:throw new Error(_0x3e4c67(0x22c)+_0x4dc166);}}catch(_0x5abe02){const _0x142684=_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x166)]:String(_0x5abe02);return reportMorphError({'error_message':_0x142684,'error_type':_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':_0x4dc166,'arguments':_0x125058?JSON[_0x3e4c67(0x24f)](_0x125058)[_0x3e4c67(0x18b)](0x0,0x1f4):undefined,'mcp_server_version':_0x3e4c67(0x1ad)},'stack_trace':_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x180)]:undefined,'source':'mcp-filesystem'})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1cf)+_0x142684}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2571de){const _0x56867a=a0_0x23a6f4,_0x5df25c=await getValidRootDirectories(_0x2571de);if(_0x5df25c[_0x56867a(0x187)]>0x0)allowedDirectories=[..._0x5df25c],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x5df25c[_0x56867a(0x187)]+_0x56867a(0x1bd));else{logMcpStderr(_0x56867a(0x1e6));if(ENABLE_WORKSPACE_MODE)try{const _0x268a5a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x268a5a&&(allowedDirectories=[_0x268a5a],logMcpStderr(_0x56867a(0x219)+_0x268a5a));}catch(_0xeac7a3){logMcpStderr(_0x56867a(0x21e)+_0xeac7a3);}}}server[a0_0x23a6f4(0x232)](RootsListChangedNotificationSchema,async()=>{const _0x39add3=a0_0x23a6f4;try{const _0x23518b=await server[_0x39add3(0x221)]();_0x23518b&&_0x39add3(0x15c)in _0x23518b&&await updateAllowedDirectoriesFromRoots(_0x23518b[_0x39add3(0x15c)]);}catch(_0x398086){logMcpStderr(_0x39add3(0x194),_0x398086 instanceof Error?_0x398086[_0x39add3(0x166)]:String(_0x398086));}}),server[a0_0x23a6f4(0x1fd)]=async()=>{const _0xf602e5=a0_0x23a6f4,_0x56b837=server[_0xf602e5(0x267)]();if(_0x56b837?.[_0xf602e5(0x15c)])try{const _0x4540d6=await server[_0xf602e5(0x221)]();_0x4540d6&&_0xf602e5(0x15c)in _0x4540d6?await updateAllowedDirectoriesFromRoots(_0x4540d6[_0xf602e5(0x15c)]):logMcpStderr(_0xf602e5(0x181));}catch(_0x32d77f){logMcpStderr(_0xf602e5(0x1a5),_0x32d77f instanceof Error?_0x32d77f['message']:String(_0x32d77f));}else{if(allowedDirectories[_0xf602e5(0x187)]>0x0)logMcpStderr(_0xf602e5(0x1df),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0xf602e5(0x20b));else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};async function runServer(){const _0x340fd3=a0_0x23a6f4,_0x39d48f=new StdioServerTransport();await server[_0x340fd3(0x1cc)](_0x39d48f),logMcpStderr(_0x340fd3(0x16d)),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x23a6f4(0x177)](_0x319a74=>{const _0x3c635d=a0_0x23a6f4;logMcpStderr(_0x3c635d(0x256),_0x319a74),process['exit'](0x1);});
|
|
2
|
+
const a0_0x5da130=a0_0x1187;(function(_0x467fdd,_0x1acf54){const _0x2e05cf=a0_0x1187,_0x4c4f01=_0x467fdd();while(!![]){try{const _0x5ba5af=parseInt(_0x2e05cf(0x14a))/0x1+-parseInt(_0x2e05cf(0xb0))/0x2*(parseInt(_0x2e05cf(0x109))/0x3)+parseInt(_0x2e05cf(0x13a))/0x4+parseInt(_0x2e05cf(0x164))/0x5*(-parseInt(_0x2e05cf(0x14b))/0x6)+parseInt(_0x2e05cf(0xee))/0x7*(parseInt(_0x2e05cf(0x121))/0x8)+-parseInt(_0x2e05cf(0x9c))/0x9+-parseInt(_0x2e05cf(0xec))/0xa*(-parseInt(_0x2e05cf(0xe2))/0xb);if(_0x5ba5af===_0x1acf54)break;else _0x4c4f01['push'](_0x4c4f01['shift']());}catch(_0x293fb2){_0x4c4f01['push'](_0x4c4f01['shift']());}}}(a0_0x58da,0x28ece));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_0x4829da from'fs/promises';import a0_0x1af6fb from'path';import a0_0x372e5a from'os';import{createRequire}from'module';import{z}from'zod';function a0_0x58da(){const _0x122344=['arguments','startsWith','grep_search','morph-v3-fast','WarpGrepError','TimeoutError','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','dirname','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','Unknown\x20error','stack','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','error','payload','all','messages','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','4686AVXJTx','\x0a</file>','branch','Benefits:\x0a','map','Morph\x20Edit\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','access','includes','dryRun','110ovYzMe','@morphllm/morphmcp\x20','1059954JrvDnB','join','github_url','size','assistant','default','name','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.','mcp-filesystem','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','match','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Repository\x20identifier','ENABLE_WORKSPACE_MODE','content','PathError','setRequestHandler','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','edit_file','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','user','composer.json','tool_calls','added\x20','exit','utf-8','3pvdrsd','read\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','application/json','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','false','parse','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','PWD','message','string','glob\x20\x27','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','catch','\x27\x20in\x20`','argv','BinaryFile','\x0a...\x20(truncated,\x20total:\x20','Bearer\x20','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','list_directory','metadata','16nLEWdf','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','slice','success','go.mod','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','[could\x20not\x20read\x20file:\x20',',\x20modified\x20','version','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','MORPH_API_URL','RipgrepNotAvailable','tool','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','searchGitHub','stringify','normalize','MORPH_API_KEY','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','changes','completed','Fallback:\x20Using\x20workspace\x20root\x20','246256srcOMN','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','WORKSPACE_ROOT','ToolException','oninitialized','ms:','For\x20deletions:\x0a','pattern','MORPH_WARP_GREP_TIMEOUT','homedir','filter','requiresApiKey','--help','tsconfig.json','\x20error(s)','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','168780efoJxM','29724GxYmyo','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','<file\x20path=\x22','code','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','linesRemoved','text','Workspace\x20mode\x20enabled:\x20Using\x20','timed\x20out','getClientCapabilities','setNotificationHandler','list_directory\x20','sep','morph-','Here\x20is\x20the\x20content\x20of\x20files:\x0a','❌\x20Morph\x20Edit\x20Failed:\x20','indexOf','.git','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','lines','pyproject.toml','resolve','path','../package.json','owner_repo','55UtkXht','\x20-\x20','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','grep\x20\x27','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','SymlinkError','`\x20in\x20`','basename','floor','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','description','instruction','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.','inputSchema','unknown','ENOENT','Tool\x20','search_type','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','codebase_search','object','grep','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','realpath','\x22.\x20Known\x20tools:\x20','env','runWarpGrep_call','UnknownError','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','read','unknown\x20error','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x20chars)','code_edit',',\x20removed\x20','length','GitHub\x20search\x20failed:\x20','-\x20Listed\x20directory\x20`','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','linesModified','Error:\x20','terminated','sk-','\x22>\x0aError\x20reading\x20file:\x20','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','isDirectory','Cargo.toml','data','has','repo_path','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','Fatal\x20error\x20running\x20server:','optional','roots','role','0.2.0','safeParse','ReadError','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','files','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Failed\x20to\x20request\x20roots\x20from\x20client:','toLowerCase','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','[github_codebase_search]\x20Failed\x20in\x20','readFile','File\x20read\x20error:','etimedout','tool_call_id','search_string','Warning:\x20','.\x20Changes:\x20','cwd','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.','Rules:\x0a','Unknown\x20tool:\x20','-\x20Grepped\x20\x27','morph-warp-grep-v2.1','1388727jlKceP','glob','push','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','FileReadError','node_modules','toISOString','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','constructor','post','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','isArray','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','errors','describe','finish','Failed\x20to\x20read\x20file:\x20','source','322894ZXvKiI','function','substring','Applied','split','\x20(new\x20file)','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','now','some','Error\x20running\x20fast\x20context\x20search:\x20','Error\x20accessing\x20directory\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','--api-key','log','DISABLED_TOOLS','api-key','command','Created\x20File','.vscode','array','stat','boolean','\x0aOptions:','timings','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','.cursor','listRoots','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','github_codebase_search','warn','terminationReason'];a0_0x58da=function(){return _0x122344;};return a0_0x58da();}import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import a0_0x4e5a08 from'axios';function fixPathRepetition(_0x194e57){const _0x14308c=a0_0x1187,_0x274f48=_0x194e57[_0x14308c(0xb4)](a0_0x1af6fb[_0x14308c(0x157)])[_0x14308c(0x144)](Boolean);if(_0x274f48['length']<0x2)return null;for(let _0x448435=Math[_0x14308c(0x16c)](_0x274f48[_0x14308c(0x6f)]/0x2);_0x448435>=0x1;_0x448435--){for(let _0x7e7734=0x0;_0x7e7734<=_0x274f48[_0x14308c(0x6f)]-0x2*_0x448435;_0x7e7734++){const _0x463fcb=_0x274f48['slice'](_0x7e7734,_0x7e7734+_0x448435),_0xe7b1ed=_0x274f48[_0x14308c(0x123)](_0x7e7734+_0x448435,_0x7e7734+0x2*_0x448435);if(_0x463fcb['every']((_0xa79fa9,_0x317dbb)=>_0xa79fa9===_0xe7b1ed[_0x317dbb])){const _0x310fe2=[..._0x274f48[_0x14308c(0x123)](0x0,_0x7e7734),..._0x274f48['slice'](_0x7e7734+_0x448435)];return a0_0x1af6fb[_0x14308c(0x157)]+_0x310fe2['join'](a0_0x1af6fb['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x511e77=a0_0x1187;try{const _0x371576=require(_0x511e77(0x162));return _0x371576[_0x511e77(0x129)]??_0x511e77(0x172);}catch(_0x493690){return logMcpStderr(_0x511e77(0x176),_0x493690),_0x511e77(0x172);}}function printHelp(){const _0x1b4fd1=a0_0x1187;console[_0x1b4fd1(0xbf)](_0x1b4fd1(0xed)+getPackageVersion()),console[_0x1b4fd1(0xbf)](_0x1b4fd1(0xb6)),console[_0x1b4fd1(0xbf)](_0x1b4fd1(0xc8)),console['log'](_0x1b4fd1(0x88)),console[_0x1b4fd1(0xbf)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x1b4fd1(0xbf)](_0x1b4fd1(0xb8)),console['log']('\x0aExamples:'),console['log']('\x20\x20morph-mcp'),console['log'](_0x1b4fd1(0x11e));}const cliArgs=process[a0_0x5da130(0x11a)]['slice'](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x5da130(0x146),'-h']);cliArgs[a0_0x5da130(0xba)](_0x296e32=>VERSION_FLAGS[a0_0x5da130(0x7c)](_0x296e32))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x5da130(0x107)](0x0));cliArgs[a0_0x5da130(0xba)](_0x8504f7=>HELP_FLAGS[a0_0x5da130(0x7c)](_0x8504f7))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x26e6b0){const _0x15c257=a0_0x5da130;for(let _0x4164f0=0x0;_0x4164f0<cliArgs['length'];_0x4164f0++){const _0x2641f4=cliArgs[_0x4164f0];if(_0x2641f4['startsWith']('--'+_0x26e6b0+'='))return _0x2641f4[_0x15c257(0x123)](('--'+_0x26e6b0+'=')[_0x15c257(0x6f)]);if(_0x2641f4==='--'+_0x26e6b0&&_0x4164f0+0x1<cliArgs[_0x15c257(0x6f)])return cliArgs[_0x4164f0+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5da130(0x6f)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x5da130(0x7c)](arg)||HELP_FLAGS[a0_0x5da130(0x7c)](arg))continue;if(arg[a0_0x5da130(0xd2)]('--api-key='))continue;if(arg===a0_0x5da130(0xbe)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x5da130(0x17f)][a0_0x5da130(0x13c)]||process[a0_0x5da130(0x17f)][a0_0x5da130(0x113)]||process[a0_0x5da130(0x96)](),ENABLE_WORKSPACE_MODE=process[a0_0x5da130(0x17f)][a0_0x5da130(0xfc)]!==a0_0x5da130(0x10f),MORPH_API_KEY=getCliArg(a0_0x5da130(0xc1))??process[a0_0x5da130(0x17f)][a0_0x5da130(0x134)],MORPH_API_URL=process[a0_0x5da130(0x17f)][a0_0x5da130(0x12b)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x5da130(0x17f)][a0_0x5da130(0x142)]?parseInt(process[a0_0x5da130(0x17f)][a0_0x5da130(0x142)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set(['edit_file',a0_0x5da130(0x178),a0_0x5da130(0xce)]),DISABLED_TOOLS=process['env'][a0_0x5da130(0xc0)]?new Set(process[a0_0x5da130(0x17f)][a0_0x5da130(0xc0)]['split'](',')[a0_0x5da130(0xe6)](_0x3a2539=>_0x3a2539['trim']())['filter'](_0x269c9a=>_0x269c9a[a0_0x5da130(0x6f)]>0x0)):new Set();function a0_0x1187(_0x583ccb,_0x3f7d18){_0x583ccb=_0x583ccb-0x6a;const _0x58da3f=a0_0x58da();let _0x1187c5=_0x58da3f[_0x583ccb];return _0x1187c5;}if(DISABLED_TOOLS[a0_0x5da130(0xf1)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x5da130(0x7c)](tool)&&console['error'](a0_0x5da130(0x122)+tool+a0_0x5da130(0x17e)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x5da130(0xdd)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x5da130(0xef)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x5da130(0xd2)](a0_0x5da130(0x76))&&!MORPH_API_KEY[a0_0x5da130(0xd2)](a0_0x5da130(0x158))&&logMcpStderr(a0_0x5da130(0x78));async function reportMorphError(_0x25e36a){const _0x425f61=a0_0x5da130;try{await a0_0x4e5a08[_0x425f61(0xa7)]('https://morphllm.com/api/error-report',{..._0x25e36a,'timestamp':new Date()[_0x425f61(0xa3)](),'source':_0x25e36a[_0x425f61(0xaf)]||_0x425f61(0xf6),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x25e36a['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x425f61(0x10c),'Authorization':_0x425f61(0x11d)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5da130(0xaa)),logMcpStderr(a0_0x5da130(0xfa)),logMcpStderr(a0_0x5da130(0x14c)),logMcpStderr(a0_0x5da130(0x112)),logMcpStderr(a0_0x5da130(0x10e)),logMcpStderr(a0_0x5da130(0xdc)));function normalizePath(_0x5543df){const _0x48090a=a0_0x5da130;return a0_0x1af6fb[_0x48090a(0x133)](_0x5543df);}function expandHome(_0x19c30c){const _0x4b7119=a0_0x5da130;if(_0x19c30c[_0x4b7119(0xd2)]('~/')||_0x19c30c==='~')return a0_0x1af6fb['join'](a0_0x372e5a[_0x4b7119(0x143)](),_0x19c30c[_0x4b7119(0x123)](0x1));return _0x19c30c;}let allowedDirectories=await Promise['all'](args[a0_0x5da130(0xe6)](async _0x40f100=>{const _0x3946e3=expandHome(_0x40f100),_0x11e8cc=a0_0x1af6fb['resolve'](_0x3946e3);try{const _0x41d1d9=await a0_0x4829da['realpath'](_0x11e8cc);return normalizePath(_0x41d1d9);}catch(_0x1cf979){return normalizePath(_0x11e8cc);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x5da130(0x6f)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x5da130(0x152)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x31083f){logMcpStderr(a0_0x5da130(0xa8)+a0_0x31083f);}async function detectWorkspaceRoot(_0x3253f8){const _0xda6f08=a0_0x5da130;let _0x597ab7=a0_0x1af6fb[_0xda6f08(0x160)](_0x3253f8);const _0x5ac947=[_0xda6f08(0x15c),_0xda6f08(0xc4),'package.json',_0xda6f08(0x7a),_0xda6f08(0x15f),_0xda6f08(0x125),_0xda6f08(0xcb),_0xda6f08(0x147),_0xda6f08(0x104)];while(_0x597ab7!==a0_0x1af6fb[_0xda6f08(0xd8)](_0x597ab7)){for(const _0x123c97 of _0x5ac947){const _0x8bc55c=a0_0x1af6fb[_0xda6f08(0xef)](_0x597ab7,_0x123c97);try{return await a0_0x4829da[_0xda6f08(0xe9)](_0x8bc55c),normalizePath(_0x597ab7);}catch{}}_0x597ab7=a0_0x1af6fb[_0xda6f08(0xd8)](_0x597ab7);}return normalizePath(_0x3253f8);}await Promise[a0_0x5da130(0xdf)](args[a0_0x5da130(0xe6)](async _0x2155d2=>{const _0xf68408=a0_0x5da130;try{const _0x105fca=await a0_0x4829da[_0xf68408(0xc6)](expandHome(_0x2155d2));!_0x105fca[_0xf68408(0x79)]()&&(logMcpStderr(_0xf68408(0x74)+_0x2155d2+'\x20is\x20not\x20a\x20directory'),process[_0xf68408(0x107)](0x1));}catch(_0x35f641){logMcpStderr(_0xf68408(0xbc)+_0x2155d2+':',_0x35f641),process[_0xf68408(0x107)](0x1);}}));async function validatePath(_0x3e3c0e){const _0xb4678b=a0_0x5da130,_0x5444b9=expandHome(_0x3e3c0e),_0x28ff9f=a0_0x1af6fb[_0xb4678b(0x160)](_0x5444b9);try{const _0x8f546c=await a0_0x4829da[_0xb4678b(0x17d)](_0x28ff9f);return _0x8f546c;}catch(_0x4b71f7){if(_0x4b71f7[_0xb4678b(0x14e)]===_0xb4678b(0x173)){const _0x337346=a0_0x1af6fb[_0xb4678b(0xd8)](_0x28ff9f);try{const _0x21cac6=await a0_0x4829da['realpath'](_0x337346);return a0_0x1af6fb['join'](_0x21cac6,a0_0x1af6fb[_0xb4678b(0x16b)](_0x28ff9f));}catch{throw new Error(_0xb4678b(0xa4)+_0x337346);}}throw _0x4b71f7;}}const MorphEditFileArgsSchema=z[a0_0x5da130(0x179)]({'path':z['string'](),'code_edit':z['string']()[a0_0x5da130(0xac)](a0_0x5da130(0x177)),'instruction':z[a0_0x5da130(0x115)]()[a0_0x5da130(0xac)](a0_0x5da130(0xd7)),'dryRun':z[a0_0x5da130(0xc7)]()[a0_0x5da130(0xf3)](![])[a0_0x5da130(0xac)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5da130(0x97),WarpGrepArgsSchema=z[a0_0x5da130(0x179)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x5da130(0x115)]()[a0_0x5da130(0xac)](a0_0x5da130(0xd9)),'search_type':z['enum']([a0_0x5da130(0xf3),a0_0x5da130(0xa2)])[a0_0x5da130(0x80)]()[a0_0x5da130(0xac)](a0_0x5da130(0x130))}),WarpGrepGitHubArgsSchema=z[a0_0x5da130(0x179)]({'search_string':z[a0_0x5da130(0x115)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x5da130(0x115)]()[a0_0x5da130(0x80)]()[a0_0x5da130(0xac)](a0_0x5da130(0x170)),'owner_repo':z[a0_0x5da130(0x115)]()[a0_0x5da130(0x80)]()['describe'](a0_0x5da130(0x10d)),'branch':z[a0_0x5da130(0x115)]()[a0_0x5da130(0x80)]()[a0_0x5da130(0xac)](a0_0x5da130(0xb7))}),CodebaseSearchArgsSchema=z['object']({'query':z[a0_0x5da130(0x115)]()[a0_0x5da130(0xac)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x5da130(0x115)]()['describe'](a0_0x5da130(0xfb)),'branch':z['string']()[a0_0x5da130(0x80)]()[a0_0x5da130(0xac)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z['string']()[a0_0x5da130(0x80)]()[a0_0x5da130(0xac)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x5da130(0xc5)](z[a0_0x5da130(0x115)]())['default']([])['describe'](a0_0x5da130(0xf9)),'limit':z['number']()[a0_0x5da130(0x80)]()[a0_0x5da130(0xf3)](0xa)[a0_0x5da130(0xac)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x5da130(0xff)](ListToolsRequestSchema,async()=>{const _0x434e82=a0_0x5da130,_0x406dd5=[{'name':_0x434e82(0x101),'description':_0x434e82(0x87)+_0x434e82(0x136)+_0x434e82(0xe1)+_0x434e82(0xa0)+_0x434e82(0xe5)+_0x434e82(0x149)+_0x434e82(0xa5)+_0x434e82(0x17c)+_0x434e82(0xca)+_0x434e82(0x166)+_0x434e82(0x86)+_0x434e82(0x100)+_0x434e82(0x140)+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+_0x434e82(0x17b)+_0x434e82(0x98)+_0x434e82(0x15d)+_0x434e82(0xcd)+_0x434e82(0x117)+_0x434e82(0x14f)+_0x434e82(0x102)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x434e82(0x7e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','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'+_0x434e82(0x6b)+_0x434e82(0x126)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0xe2e812=_0x406dd5[_0x434e82(0x144)](_0x5f08fd=>{const _0x3a3102=_0x434e82;if(DISABLED_TOOLS[_0x3a3102(0x7c)](_0x5f08fd[_0x3a3102(0xf4)]))return console[_0x3a3102(0xdd)](_0x3a3102(0x174)+_0x5f08fd[_0x3a3102(0xf4)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x3a3102(0x145)in _0x5f08fd&&_0x5f08fd[_0x3a3102(0x145)]&&!MORPH_API_KEY)return logMcpStderr(_0x3a3102(0x94)+_0x5f08fd[_0x3a3102(0xf4)]+_0x3a3102(0xbd)),![];return!![];});return{'tools':_0xe2e812[_0x434e82(0xe6)](_0x16ad75=>({'name':_0x16ad75['name'],'description':_0x16ad75[_0x434e82(0x16e)],'inputSchema':_0x16ad75[_0x434e82(0x171)]}))};}),server[a0_0x5da130(0xff)](CallToolRequestSchema,async _0x1aa27a=>{const _0x3e66de=a0_0x5da130,{name:_0x1c3444,arguments:_0x15d808}=_0x1aa27a['params'];try{if(DISABLED_TOOLS['has'](_0x1c3444))throw new Error('Tool\x20\x22'+_0x1c3444+_0x3e66de(0x9f));switch(_0x1c3444){case _0x3e66de(0x101):{const _0x29adaf=MorphEditFileArgsSchema[_0x3e66de(0x84)](_0x15d808);if(!_0x29adaf[_0x3e66de(0x124)])throw new Error(_0x3e66de(0x12a)+_0x29adaf[_0x3e66de(0xdd)]);const _0x110efc=await validatePath(_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x161)]);let _0x3e08c7=null,_0x42c6d3=!![],_0x555906=null;try{_0x3e08c7=await a0_0x4829da[_0x3e66de(0x8f)](_0x110efc,_0x3e66de(0x108));}catch(_0x56f921){const _0x5010bd=_0x56f921[_0x3e66de(0x14e)];_0x5010bd===_0x3e66de(0x173)?(_0x42c6d3=![],_0x3e08c7=''):(_0x555906=_0x3e66de(0xae)+(_0x5010bd||'unknown')+_0x3e66de(0x165)+(_0x56f921 instanceof Error?_0x56f921[_0x3e66de(0x114)]:String(_0x56f921)),logMcpStderr(_0x3e66de(0x94)+_0x555906));}let _0x1f3af4;try{const _0x3d4d59=MORPH_API_KEY;if(!_0x3d4d59)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x79b762=a0_0x1af6fb[_0x3e66de(0xd8)](_0x110efc),_0x1a182e=a0_0x1af6fb[_0x3e66de(0x16b)](_0x110efc),_0xe8df9c=await executeEditFile({'target_filepath':_0x1a182e,'code_edit':_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x6d)],'instructions':_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x16f)]},{'morphApiKey':_0x3d4d59,'morphApiUrl':MORPH_API_URL,'baseDir':_0x79b762,'autoWrite':!_0x29adaf[_0x3e66de(0x7b)]['dryRun'],'generateUdiff':![],'debug':![]});_0x1f3af4=_0xe8df9c['completionId'];if(!_0xe8df9c[_0x3e66de(0x124)])throw new Error(_0xe8df9c[_0x3e66de(0xdd)]||_0x3e66de(0x10b));const _0x5616c0=_0xe8df9c[_0x3e66de(0x137)],_0x2f9b78=_0x3e66de(0x106)+_0x5616c0['linesAdded']+_0x3e66de(0x6e)+_0x5616c0[_0x3e66de(0x150)]+_0x3e66de(0x128)+_0x5616c0[_0x3e66de(0x73)];if(_0x29adaf[_0x3e66de(0x7b)]['dryRun'])return{'content':[{'type':_0x3e66de(0x151),'text':'Morph\x20Edit\x20Preview'+(_0x42c6d3?'':_0x3e66de(0xb5))+':\x20'+_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x16f)]+_0x3e66de(0x95)+_0x2f9b78+'.\x20Path:\x20'+_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x161)]+'.'}]};return{'content':[{'type':_0x3e66de(0x151),'text':_0x3e66de(0xe7)+(_0x42c6d3?_0x3e66de(0xb3):_0x3e66de(0xc3))+':\x20'+_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x16f)]+_0x3e66de(0x95)+_0x2f9b78+'.\x20Path:\x20'+_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x161)]+'.'}]};}catch(_0x5daba0){const _0x4cbc16=_0x5daba0 instanceof Error?_0x5daba0[_0x3e66de(0x114)]:String(_0x5daba0);return reportMorphError({'error_message':_0x4cbc16,'error_type':_0x5daba0 instanceof Error?_0x5daba0[_0x3e66de(0xa6)][_0x3e66de(0xf4)]:_0x3e66de(0x181),'context':{'tool':_0x3e66de(0x101),'completion_id':_0x1f3af4,'file_path':_0x29adaf['data'][_0x3e66de(0x161)],'validated_path':_0x110efc,'instruction':_0x29adaf['data']['instruction'],'model':_0x3e66de(0xd4),'dry_run':_0x29adaf[_0x3e66de(0x7b)]['dryRun'],'file_exists':_0x42c6d3,'file_read_error':_0x555906,'file_readable':_0x3e08c7!==null,'request_content':{'path':_0x29adaf[_0x3e66de(0x7b)]['path'],'code_edit':_0x29adaf[_0x3e66de(0x7b)][_0x3e66de(0x6d)],'instruction':_0x29adaf[_0x3e66de(0x7b)]['instruction'],'original_code':_0x3e08c7!==null?_0x3e08c7[_0x3e66de(0x6f)]>0xc350?_0x3e08c7[_0x3e66de(0xb2)](0x0,0xc350)+_0x3e66de(0x11c)+_0x3e08c7['length']+_0x3e66de(0x6c):_0x3e08c7:_0x3e66de(0x127)+(_0x555906||_0x3e66de(0x6a))+']','original_code_length':_0x3e08c7?.[_0x3e66de(0x6f)]??0x0,'model':_0x3e66de(0xd4),'dry_run':_0x29adaf['data'][_0x3e66de(0xeb)]}},'stack_trace':_0x5daba0 instanceof Error?_0x5daba0[_0x3e66de(0xdb)]:undefined,'source':_0x3e66de(0xf6)})[_0x3e66de(0x118)](()=>{}),{'content':[{'type':_0x3e66de(0x151),'text':_0x3e66de(0x15a)+_0x4cbc16}],'isError':!![]};}}case _0x3e66de(0x178):{const _0x327c37=WarpGrepArgsSchema[_0x3e66de(0x84)](_0x15d808);if(!_0x327c37[_0x3e66de(0x124)])return{'content':[{'type':_0x3e66de(0x151),'text':'Invalid\x20arguments:\x20'+_0x327c37['error']}],'isError':!![]};const _0x3ae1ea=_0xfae116=>{const _0x572347=_0x3e66de,_0x1ab89d=[];for(const _0x5c3493 of _0xfae116||[]){if(_0x5c3493[_0x572347(0x82)]===_0x572347(0xf2)&&Array[_0x572347(0xa9)](_0x5c3493[_0x572347(0x105)]))for(const _0x2b6d45 of _0x5c3493[_0x572347(0x105)]){try{const _0x5393a1=_0x2b6d45[_0x572347(0xb1)]?.[_0x572347(0xf4)],_0x47bf7f=JSON[_0x572347(0x110)](_0x2b6d45[_0x572347(0xb1)]?.[_0x572347(0xd1)]||'{}');if(_0x5393a1===_0x572347(0xd3))_0x1ab89d[_0x572347(0x9e)](_0x572347(0x167)+_0x47bf7f['pattern']+'\x27\x20'+(_0x47bf7f[_0x572347(0x161)]||'.'));else{if(_0x5393a1==='read')_0x1ab89d[_0x572347(0x9e)](_0x572347(0x10a)+_0x47bf7f[_0x572347(0x161)]);else{if(_0x5393a1===_0x572347(0x11f))_0x1ab89d[_0x572347(0x9e)](_0x572347(0x156)+(_0x47bf7f[_0x572347(0xc2)]||'.'));else{if(_0x5393a1===_0x572347(0x9d))_0x1ab89d[_0x572347(0x9e)](_0x572347(0x116)+_0x47bf7f[_0x572347(0x141)]+'\x27\x20'+(_0x47bf7f[_0x572347(0x161)]||'.'));else _0x5393a1===_0x572347(0xad)&&_0x1ab89d['push'](_0x572347(0xad));}}}}catch{}}}return _0x1ab89d;},_0x1f3485=_0x275ec4=>{const _0xfcc15d=_0x3e66de,_0x138a37=[];if(!_0x275ec4||!Array[_0xfcc15d(0xa9)](_0x275ec4))return _0x138a37;const _0x3c54a4=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0xfcc15d(0x183)},{'pattern':/\[PATH ERROR\]/,'error_type':_0xfcc15d(0xfe),'tool':_0xfcc15d(0x183)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0xfcc15d(0x11b),'tool':_0xfcc15d(0x183)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0xfcc15d(0x17a)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0xfcc15d(0x12c),'tool':_0xfcc15d(0x17a)},{'pattern':/\[BINARY FILE\]/,'error_type':_0xfcc15d(0x11b),'tool':_0xfcc15d(0x183)},{'pattern':/\[SYMLINK\]/,'error_type':_0xfcc15d(0x169),'tool':_0xfcc15d(0x183)},{'pattern':/not a text file/,'error_type':_0xfcc15d(0x11b),'tool':_0xfcc15d(0x183)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0xfcc15d(0x183)},{'pattern':/Error reading file:/,'error_type':_0xfcc15d(0x85),'tool':'read'},{'pattern':/status="error"/,'error_type':_0xfcc15d(0x13d),'tool':'unknown'}];let _0xf478e5=0x0;for(const _0x45ab6a of _0x275ec4){_0x45ab6a[_0xfcc15d(0x82)]===_0xfcc15d(0xf2)&&Array[_0xfcc15d(0xa9)](_0x45ab6a[_0xfcc15d(0x105)])&&_0xf478e5++;const _0x5477de=_0x45ab6a[_0xfcc15d(0xfd)];if((_0x45ab6a[_0xfcc15d(0x82)]===_0xfcc15d(0x12d)||_0x45ab6a[_0xfcc15d(0x82)]===_0xfcc15d(0x103))&&_0x5477de&&typeof _0x5477de===_0xfcc15d(0x115))for(const {pattern:_0x537a62,error_type:_0x57ce86,tool:_0x55787e}of _0x3c54a4){const _0x1ec266=_0x5477de[_0xfcc15d(0xf8)](new RegExp(_0x537a62[_0xfcc15d(0xaf)],'g'));if(_0x1ec266)for(const _0x3aedc1 of _0x1ec266){const _0xf6f460=_0x5477de[_0xfcc15d(0x15b)](_0x3aedc1),_0x96ed1a=_0x5477de[_0xfcc15d(0xb2)](_0xf6f460,Math['min'](_0xf6f460+0xc8,_0x5477de['length']));_0x138a37['push']({'tool':_0x55787e,'error_type':_0x57ce86,'error_message':_0x96ed1a[_0xfcc15d(0xb4)]('\x0a')[0x0],'turn':_0xf478e5});}}}return _0x138a37;};try{const _0x28c46c=a0_0x1af6fb[_0x3e66de(0x160)](_0x327c37[_0x3e66de(0x7b)]['repo_path']),_0x27ba35=_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x175)],_0x2bc854=_0x27ba35===_0x3e66de(0xa2)?{'allowNames':[_0x3e66de(0xa2)]}:undefined,_0x1e2e5a=new LocalRipgrepProvider(_0x28c46c,undefined,_0x2bc854),_0x9e212c=await runWarpGrep({'searchTerm':_0x327c37['data'][_0x3e66de(0x93)],'repoRoot':_0x28c46c,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1e2e5a,'search_type':_0x27ba35}),_0x2ce767=_0x1f3485(_0x9e212c[_0x3e66de(0xe0)]);_0x2ce767[_0x3e66de(0x6f)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2ce767[_0x3e66de(0x6f)]+_0x3e66de(0x148),'error_type':'SubToolError','level':_0x3e66de(0xcf),'tool':'codebase_search','context':{'repo_path':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x7d)],'query':_0x327c37[_0x3e66de(0x7b)]['search_string'],'model':_0x3e66de(0x9b),'termination_reason':_0x9e212c[_0x3e66de(0xd0)],'sub_tool_errors':_0x2ce767,'timings':_0x9e212c[_0x3e66de(0xc9)],'tool_calls':_0x3ae1ea(_0x9e212c[_0x3e66de(0xe0)]),'messages':_0x9e212c['messages']?.[_0x3e66de(0xe6)](_0x3c1d0f=>({'role':_0x3c1d0f[_0x3e66de(0x82)],'content':_0x3c1d0f[_0x3e66de(0xfd)],..._0x3c1d0f[_0x3e66de(0x105)]?{'tool_calls':_0x3c1d0f[_0x3e66de(0x105)]['length']}:{},..._0x3c1d0f[_0x3e66de(0x92)]?{'tool_call_id':_0x3c1d0f['tool_call_id']}:{}}))},'source':_0x3e66de(0xf6)})[_0x3e66de(0x118)](()=>{});let _0x49357e='';if(_0x9e212c[_0x3e66de(0xd0)]===_0x3e66de(0x138)&&_0x9e212c[_0x3e66de(0xad)]?.[_0x3e66de(0x120)]?.[_0x3e66de(0x89)]){const _0x34b3f6=_0x9e212c[_0x3e66de(0xad)][_0x3e66de(0x120)][_0x3e66de(0x89)];if(_0x34b3f6[_0x3e66de(0x6f)]===0x0)return _0x49357e=_0x9e212c[_0x3e66de(0xad)][_0x3e66de(0xde)]||_0x3e66de(0x8a),{'content':[{'type':_0x3e66de(0x151),'text':_0x49357e}]};const _0x1eb094=[],_0x145970=[_0x3e66de(0x12f)];for(const _0x2e0681 of _0x9e212c[_0x3e66de(0xe0)]){if(_0x2e0681[_0x3e66de(0x82)]===_0x3e66de(0xf2)&&Array[_0x3e66de(0xa9)](_0x2e0681['tool_calls']))for(const _0x3da555 of _0x2e0681[_0x3e66de(0x105)]){try{const _0x1b8dd3=_0x3da555[_0x3e66de(0xb1)]?.[_0x3e66de(0xf4)],_0x142167=JSON[_0x3e66de(0x110)](_0x3da555[_0x3e66de(0xb1)]?.['arguments']||'{}');if(_0x1b8dd3===_0x3e66de(0xd3))_0x145970[_0x3e66de(0x9e)](_0x3e66de(0x9a)+_0x142167[_0x3e66de(0x141)]+_0x3e66de(0x119)+(_0x142167['path']||'.')+'`');else{if(_0x1b8dd3===_0x3e66de(0x183))_0x145970[_0x3e66de(0x9e)]('-\x20Read\x20file\x20`'+_0x142167[_0x3e66de(0x161)]+'`');else{if(_0x1b8dd3==='list_directory')_0x145970[_0x3e66de(0x9e)](_0x3e66de(0x71)+(_0x142167[_0x3e66de(0xc2)]||'.')+'`');else _0x1b8dd3===_0x3e66de(0x9d)&&_0x145970[_0x3e66de(0x9e)]('-\x20Glob\x20search\x20`'+_0x142167[_0x3e66de(0x141)]+_0x3e66de(0x16a)+(_0x142167[_0x3e66de(0x161)]||'.')+'`');}}}catch{}}}_0x1eb094[_0x3e66de(0x9e)](_0x145970[_0x3e66de(0xef)]('\x0a'));const _0x3c1c93=['','Relevant\x20context\x20found:'];for(const _0x1ac13e of _0x34b3f6){if(_0x1ac13e[_0x3e66de(0x15e)]==='*')_0x3c1c93['push']('-\x20'+_0x1ac13e['path']+':*');else{if(Array[_0x3e66de(0xa9)](_0x1ac13e[_0x3e66de(0x15e)])){const _0x51363e=_0x1ac13e[_0x3e66de(0x15e)]['map'](([_0x5243e5,_0xe8d3bc])=>{if(_0x5243e5===_0xe8d3bc)return''+_0x5243e5;return _0x5243e5+'-'+_0xe8d3bc;});_0x3c1c93[_0x3e66de(0x9e)]('-\x20'+_0x1ac13e[_0x3e66de(0x161)]+':'+_0x51363e[_0x3e66de(0xef)](','));}else _0x3c1c93[_0x3e66de(0x9e)]('-\x20'+_0x1ac13e[_0x3e66de(0x161)]+':*');}}_0x3c1c93[_0x3e66de(0x9e)](''),_0x1eb094[_0x3e66de(0x9e)](_0x3c1c93['join']('\x0a')),_0x1eb094['push'](_0x3e66de(0x159));const _0xac40a2=[];for(const _0x34d8ce of _0x34b3f6){let _0x23cd8b=a0_0x1af6fb[_0x3e66de(0x160)](_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x7d)],_0x34d8ce[_0x3e66de(0x161)]),_0x51590e=null,_0x5d6eaa=null;try{_0x51590e=await a0_0x4829da[_0x3e66de(0x8f)](_0x23cd8b,{'encoding':'utf-8'});}catch(_0x2bc70d){const _0x5a23fa=fixPathRepetition(_0x23cd8b);if(_0x5a23fa)try{_0x51590e=await a0_0x4829da[_0x3e66de(0x8f)](_0x5a23fa,{'encoding':'utf-8'}),_0x23cd8b=_0x5a23fa;}catch{_0x5d6eaa=_0x2bc70d instanceof Error?_0x2bc70d:new Error(String(_0x2bc70d));}else _0x5d6eaa=_0x2bc70d instanceof Error?_0x2bc70d:new Error(String(_0x2bc70d));}if(_0x51590e!==null){const _0x24b4ff=_0x51590e[_0x3e66de(0xb4)](/\r?\n/),_0x10f9c5=[_0x3e66de(0x14d)+_0x34d8ce[_0x3e66de(0x161)]+'\x22>'];if(_0x34d8ce[_0x3e66de(0x15e)]==='*'||!Array[_0x3e66de(0xa9)](_0x34d8ce[_0x3e66de(0x15e)]))for(let _0x549c0b=0x1;_0x549c0b<=_0x24b4ff[_0x3e66de(0x6f)];_0x549c0b++){const _0x14a9f4=_0x24b4ff[_0x549c0b-0x1];_0x10f9c5[_0x3e66de(0x9e)](_0x549c0b+'|\x20'+_0x14a9f4);}else for(const [_0x148284,_0x1ea395]of _0x34d8ce[_0x3e66de(0x15e)]){_0x10f9c5[_0x3e66de(0x6f)]>0x1&&_0x10f9c5['push']('');for(let _0xb24b58=_0x148284;_0xb24b58<=_0x1ea395&&_0xb24b58<=_0x24b4ff[_0x3e66de(0x6f)];_0xb24b58++){const _0x2a5615=_0x24b4ff[_0xb24b58-0x1];_0x10f9c5[_0x3e66de(0x9e)](_0xb24b58+'|\x20'+_0x2a5615);}}_0x10f9c5['push']('</file>'),_0xac40a2[_0x3e66de(0x9e)](_0x10f9c5[_0x3e66de(0xef)]('\x0a'));}else _0xac40a2[_0x3e66de(0x9e)](_0x3e66de(0x14d)+_0x34d8ce[_0x3e66de(0x161)]+_0x3e66de(0x77)+(_0x5d6eaa?.[_0x3e66de(0x114)]||_0x3e66de(0xda))+_0x3e66de(0xe3));}_0x1eb094[_0x3e66de(0x9e)](_0xac40a2['join']('\x0a\x0a')),_0x49357e=_0x1eb094[_0x3e66de(0xef)]('\x0a');const _0x58ff90=_0x9e212c[_0x3e66de(0xab)]?.[_0x3e66de(0x144)](_0x599987=>_0x599987['message']?.[_0x3e66de(0xd2)](_0x3e66de(0x90)))||[];if(_0x58ff90[_0x3e66de(0x6f)]>0x0){const _0x36a3ab=_0x58ff90[_0x3e66de(0xe6)](_0x43688d=>_0x43688d[_0x3e66de(0x114)])['join'](';\x20');reportMorphError({'error_message':_0x36a3ab,'error_type':_0x3e66de(0xa1),'context':{'tool':_0x3e66de(0x178),'repo_path':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x7d)],'query':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x93)],'model':'morph-warp-grep-v2.1','termination_reason':'completed_with_file_errors','error_count':_0x58ff90[_0x3e66de(0x6f)],'is_timeout':![],'timings':_0x9e212c[_0x3e66de(0xc9)],'files_attempted':_0x34b3f6[_0x3e66de(0xe6)](_0x11a6cf=>({'path':_0x11a6cf[_0x3e66de(0x161)],'lines':_0x11a6cf[_0x3e66de(0x15e)]})),'tool_calls':_0x3ae1ea(_0x9e212c[_0x3e66de(0xe0)]),'messages':_0x9e212c[_0x3e66de(0xe0)]?.['map'](_0x3f17e2=>({'role':_0x3f17e2['role'],'content':_0x3f17e2['content'],..._0x3f17e2['tool_calls']?{'tool_calls':_0x3f17e2[_0x3e66de(0x105)][_0x3e66de(0x6f)]}:{},..._0x3f17e2[_0x3e66de(0x92)]?{'tool_call_id':_0x3f17e2[_0x3e66de(0x92)]}:{}})),'request_content':{'query':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x93)],'repo_path':_0x327c37[_0x3e66de(0x7b)]['repo_path'],'repoRoot':a0_0x1af6fb[_0x3e66de(0x160)](_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x7d)]),'model':_0x3e66de(0x9b)}},'source':_0x3e66de(0xf6)})[_0x3e66de(0x118)](()=>{});}}else{if(_0x9e212c[_0x3e66de(0xd0)]===_0x3e66de(0x75)&&_0x9e212c[_0x3e66de(0xab)][_0x3e66de(0x6f)]>0x0){const _0x513821=_0x9e212c[_0x3e66de(0xab)]['map'](_0x18a204=>_0x18a204['message'])[_0x3e66de(0xef)](';\x20');_0x49357e=_0x3e66de(0x74)+_0x513821;const _0x290e3a=_0x513821['toLowerCase']()[_0x3e66de(0xea)]('timeout')||_0x513821['toLowerCase']()['includes'](_0x3e66de(0x153))||_0x513821[_0x3e66de(0x8c)]()[_0x3e66de(0xea)]('etimedout'),_0x10edf8=_0x9e212c[_0x3e66de(0xad)]?.[_0x3e66de(0x120)]?.['files'],_0x115813=_0x9e212c['errors'][0x0];reportMorphError({'error_message':_0x513821,'error_type':_0x290e3a?_0x3e66de(0xd6):_0x115813?.[_0x3e66de(0xa6)]?.[_0x3e66de(0xf4)]||_0x3e66de(0xd5),'context':{'tool':_0x3e66de(0x178),'repo_path':_0x327c37['data']['repo_path'],'query':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x93)],'model':_0x3e66de(0x9b),'termination_reason':_0x9e212c[_0x3e66de(0xd0)],'error_count':_0x9e212c[_0x3e66de(0xab)]['length'],'is_timeout':_0x290e3a,'timings':_0x9e212c[_0x3e66de(0xc9)],'files_attempted':_0x10edf8?.[_0x3e66de(0xe6)](_0xac2af0=>({'path':_0xac2af0['path'],'lines':_0xac2af0[_0x3e66de(0x15e)]})),'tool_calls':_0x3ae1ea(_0x9e212c[_0x3e66de(0xe0)]),'messages':_0x9e212c['messages']?.[_0x3e66de(0xe6)](_0x4f71ab=>({'role':_0x4f71ab[_0x3e66de(0x82)],'content':_0x4f71ab[_0x3e66de(0xfd)],..._0x4f71ab['tool_calls']?{'tool_calls':_0x4f71ab[_0x3e66de(0x105)][_0x3e66de(0x6f)]}:{},..._0x4f71ab[_0x3e66de(0x92)]?{'tool_call_id':_0x4f71ab[_0x3e66de(0x92)]}:{}})),'request_content':{'query':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x93)],'repo_path':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x7d)],'repoRoot':a0_0x1af6fb[_0x3e66de(0x160)](_0x327c37[_0x3e66de(0x7b)]['repo_path']),'model':_0x3e66de(0x9b)}},'stack_trace':_0x115813?.[_0x3e66de(0xdb)]||undefined,'source':_0x3e66de(0xf6)})['catch'](()=>{});}else _0x49357e=_0x3e66de(0x182);}return{'content':[{'type':_0x3e66de(0x151),'text':_0x49357e}]};}catch(_0x743e60){const _0x6bb1fe=_0x743e60 instanceof Error?_0x743e60[_0x3e66de(0x114)]:String(_0x743e60),_0x3d2a10=_0x6bb1fe[_0x3e66de(0x8c)]()['includes']('timeout')||_0x6bb1fe[_0x3e66de(0x8c)]()['includes']('timed\x20out')||_0x6bb1fe[_0x3e66de(0x8c)]()[_0x3e66de(0xea)](_0x3e66de(0x91))||_0x743e60 instanceof Error&&_0x743e60['name']===_0x3e66de(0xd6);return reportMorphError({'error_message':_0x6bb1fe,'error_type':_0x3d2a10?'TimeoutError':_0x743e60 instanceof Error?_0x743e60[_0x3e66de(0xa6)]['name']:_0x3e66de(0x181),'context':{'tool':'codebase_search','repo_path':_0x327c37['data'][_0x3e66de(0x7d)],'query':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x93)],'model':'morph-warp-grep-v2.1','is_timeout':_0x3d2a10,'exception_phase':_0x3e66de(0x180),'request_content':{'query':_0x327c37[_0x3e66de(0x7b)][_0x3e66de(0x93)],'repo_path':_0x327c37[_0x3e66de(0x7b)]['repo_path'],'repoRoot':a0_0x1af6fb['resolve'](_0x327c37[_0x3e66de(0x7b)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x743e60 instanceof Error?_0x743e60[_0x3e66de(0xdb)]:undefined,'source':_0x3e66de(0xf6)})[_0x3e66de(0x118)](()=>{}),{'content':[{'type':_0x3e66de(0x151),'text':_0x3e66de(0xbb)+_0x6bb1fe}],'isError':![]};}}case _0x3e66de(0xce):{const _0x1a28d2=WarpGrepGitHubArgsSchema[_0x3e66de(0x84)](_0x15d808);if(!_0x1a28d2['success'])return{'content':[{'type':_0x3e66de(0x151),'text':'Invalid\x20arguments:\x20'+_0x1a28d2[_0x3e66de(0xdd)]}],'isError':!![]};const _0x4844c2=_0x1a28d2['data'][_0x3e66de(0xf0)]||_0x1a28d2[_0x3e66de(0x7b)][_0x3e66de(0x163)];if(!_0x4844c2)return{'content':[{'type':'text','text':_0x3e66de(0x111)}],'isError':!![]};const _0x589ce8=MORPH_API_KEY;if(!_0x589ce8)throw new Error(_0x3e66de(0x135));const _0x5388cc=Date[_0x3e66de(0xb9)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x4844c2+'\x20for:\x20\x22'+_0x1a28d2['data'][_0x3e66de(0x93)]+'\x22');try{const _0xde9610=new WarpGrepClient({'morphApiKey':_0x589ce8,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x529294=await _0xde9610[_0x3e66de(0x131)]({'searchTerm':_0x1a28d2[_0x3e66de(0x7b)][_0x3e66de(0x93)],'github':_0x4844c2,'branch':_0x1a28d2[_0x3e66de(0x7b)][_0x3e66de(0xe4)]}),_0x30710d=Date[_0x3e66de(0xb9)]()-_0x5388cc;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x30710d+'ms.\x20Success:\x20'+_0x529294['success']);const _0x112a25=formatResult(_0x529294);return{'content':[{'type':_0x3e66de(0x151),'text':_0x112a25}]};}catch(_0xfce83d){const _0x5d0b4a=Date[_0x3e66de(0xb9)]()-_0x5388cc,_0x2ab991=_0xfce83d instanceof Error?_0xfce83d[_0x3e66de(0x114)]:String(_0xfce83d);return logMcpStderr(_0x3e66de(0x8e)+_0x5d0b4a+_0x3e66de(0x13f),_0x2ab991),reportMorphError({'error_message':_0x2ab991,'error_type':_0xfce83d instanceof Error?_0xfce83d[_0x3e66de(0xa6)][_0x3e66de(0xf4)]:_0x3e66de(0x181),'context':{'tool':_0x3e66de(0xce),'github_url':_0x4844c2,'search_string':_0x1a28d2[_0x3e66de(0x7b)][_0x3e66de(0x93)],'branch':_0x1a28d2[_0x3e66de(0x7b)][_0x3e66de(0xe4)]},'stack_trace':_0xfce83d instanceof Error?_0xfce83d[_0x3e66de(0xdb)]:undefined,'source':_0x3e66de(0xf6),'tool':_0x3e66de(0xce),'latency_ms':_0x5d0b4a})[_0x3e66de(0x118)](()=>{}),{'content':[{'type':_0x3e66de(0x151),'text':_0x3e66de(0x70)+_0x2ab991}],'isError':![]};}}default:throw new Error(_0x3e66de(0x99)+_0x1c3444);}}catch(_0x2c2241){const _0x4fa682=_0x2c2241 instanceof Error?_0x2c2241[_0x3e66de(0x114)]:String(_0x2c2241);return reportMorphError({'error_message':_0x4fa682,'error_type':_0x2c2241 instanceof Error?_0x2c2241[_0x3e66de(0xa6)][_0x3e66de(0xf4)]:_0x3e66de(0x181),'context':{'tool':_0x1c3444,'arguments':_0x15d808?JSON[_0x3e66de(0x132)](_0x15d808)[_0x3e66de(0xb2)](0x0,0x1f4):undefined,'mcp_server_version':_0x3e66de(0x83)},'stack_trace':_0x2c2241 instanceof Error?_0x2c2241[_0x3e66de(0xdb)]:undefined,'source':'mcp-filesystem'})[_0x3e66de(0x118)](()=>{}),{'content':[{'type':_0x3e66de(0x151),'text':_0x3e66de(0x74)+_0x4fa682}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x10d183){const _0x959b68=a0_0x5da130,_0x144c28=await getValidRootDirectories(_0x10d183);if(_0x144c28[_0x959b68(0x6f)]>0x0)allowedDirectories=[..._0x144c28],logMcpStderr(_0x959b68(0x13b)+_0x144c28[_0x959b68(0x6f)]+'\x20valid\x20directories');else{logMcpStderr(_0x959b68(0xe8));if(ENABLE_WORKSPACE_MODE)try{const _0x521ad3=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x521ad3&&(allowedDirectories=[_0x521ad3],logMcpStderr(_0x959b68(0x139)+_0x521ad3));}catch(_0x20c879){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x20c879);}}}server[a0_0x5da130(0x155)](RootsListChangedNotificationSchema,async()=>{const _0x52f272=a0_0x5da130;try{const _0x4d85dd=await server[_0x52f272(0xcc)]();_0x4d85dd&&_0x52f272(0x81)in _0x4d85dd&&await updateAllowedDirectoriesFromRoots(_0x4d85dd['roots']);}catch(_0x185dc7){logMcpStderr(_0x52f272(0x8b),_0x185dc7 instanceof Error?_0x185dc7['message']:String(_0x185dc7));}}),server[a0_0x5da130(0x13e)]=async()=>{const _0x33a1a5=a0_0x5da130,_0x2e874e=server[_0x33a1a5(0x154)]();if(_0x2e874e?.['roots'])try{const _0x1e044d=await server[_0x33a1a5(0xcc)]();_0x1e044d&&_0x33a1a5(0x81)in _0x1e044d?await updateAllowedDirectoriesFromRoots(_0x1e044d[_0x33a1a5(0x81)]):logMcpStderr(_0x33a1a5(0x16d));}catch(_0x5a78b1){logMcpStderr(_0x33a1a5(0x12e),_0x5a78b1 instanceof Error?_0x5a78b1[_0x33a1a5(0x114)]:String(_0x5a78b1));}else{if(allowedDirectories[_0x33a1a5(0x6f)]>0x0)logMcpStderr(_0x33a1a5(0x8d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x33a1a5(0xf7));else throw new Error(_0x33a1a5(0xf5));}}};async function runServer(){const _0x31fe9a=a0_0x5da130,_0x37e071=new StdioServerTransport();await server['connect'](_0x37e071),logMcpStderr(_0x31fe9a(0x168)),allowedDirectories['length']===0x0&&logMcpStderr(_0x31fe9a(0x72));}runServer()[a0_0x5da130(0x118)](_0xdb9b8f=>{const _0x557f86=a0_0x5da130;logMcpStderr(_0x557f86(0x7f),_0xdb9b8f),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a1_0x560a(){var _0x219d5c=['1052664XHkdar','win32','618910vurlbb','platform','[os=','6qqzlMV','Unknown','7qMRixg','3144642crYwde','44qnfVRN','darwin','linux','Linux','100482iOqjIQ','Windows','9981840IicOwf','11112813iPADiY','10bVZCYx','1792087yrcTiJ','macOS'];a1_0x560a=function(){return _0x219d5c;};return a1_0x560a();}var a1_0x46a288=a1_0x293a;(function(_0x5beb07,_0x51cec5){var _0x2d4e7b=a1_0x293a,_0x20f122=_0x5beb07();while(!![]){try{var _0x545a69=-parseInt(_0x2d4e7b(0x95))/0x1+-parseInt(_0x2d4e7b(0x86))/0x2*(-parseInt(_0x2d4e7b(0x8e))/0x3)+parseInt(_0x2d4e7b(0x8a))/0x4*(parseInt(_0x2d4e7b(0x97))/0x5)+-parseInt(_0x2d4e7b(0x89))/0x6*(-parseInt(_0x2d4e7b(0x88))/0x7)+-parseInt(_0x2d4e7b(0x90))/0x8+-parseInt(_0x2d4e7b(0x91))/0x9*(-parseInt(_0x2d4e7b(0x92))/0xa)+-parseInt(_0x2d4e7b(0x93))/0xb;if(_0x545a69===_0x51cec5)break;else _0x20f122['push'](_0x20f122['shift']());}catch(_0x5010d0){_0x20f122['push'](_0x20f122['shift']());}}}(a1_0x560a,0xb8f85));import a1_0x48173a from'os';function a1_0x293a(_0x5a3184,_0x84067d){_0x5a3184=_0x5a3184-0x85;var _0x560a4c=a1_0x560a();var _0x293a44=_0x560a4c[_0x5a3184];return _0x293a44;}export function getOperatingSystemType(_0xb26571=a1_0x48173a[a1_0x46a288(0x98)]()){var _0x435a14=a1_0x46a288;switch(_0xb26571){case _0x435a14(0x8b):return _0x435a14(0x94);case _0x435a14(0x96):return _0x435a14(0x8f);case _0x435a14(0x8c):return _0x435a14(0x8d);default:return _0x435a14(0x87);}}export function formatMcpLogMessage(_0x127d03,_0x500970=a1_0x48173a['platform']()){var _0x4ebfa6=a1_0x46a288;return _0x4ebfa6(0x85)+getOperatingSystemType(_0x500970)+']\x20'+_0x127d03;}export function logMcpStderr(_0x50219b,..._0x1d2362){console['error'](formatMcpLogMessage(_0x50219b),..._0x1d2362);}
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a2_0x3f5a(_0xdf2bdf,_0x18d2a2){_0xdf2bdf=_0xdf2bdf-0xfc;const _0x530512=a2_0x5305();let _0x3f5a06=_0x530512[_0xdf2bdf];return _0x3f5a06;}(function(_0x7302bd,_0x1da948){const _0x307f95=a2_0x3f5a,_0x600f17=_0x7302bd();while(!![]){try{const _0x3d9143=parseInt(_0x307f95(0xfd))/0x1*(parseInt(_0x307f95(0x109))/0x2)+-parseInt(_0x307f95(0x10c))/0x3+-parseInt(_0x307f95(0x101))/0x4+-parseInt(_0x307f95(0x107))/0x5+parseInt(_0x307f95(0x102))/0x6+-parseInt(_0x307f95(0x106))/0x7*(-parseInt(_0x307f95(0x105))/0x8)+parseInt(_0x307f95(0x100))/0x9*(parseInt(_0x307f95(0x104))/0xa);if(_0x3d9143===_0x1da948)break;else _0x600f17['push'](_0x600f17['shift']());}catch(_0x1fbb22){_0x600f17['push'](_0x600f17['shift']());}}}(a2_0x5305,0x705f5));function a2_0x5305(){const _0x2dd19a=['startsWith','charAt','1455147xwQkvO','replace','match','normalize','join','40481aoQdkV','/mnt/','homedir','333pnVzuA','3320584biNTpe','5474418ZpfZzq','slice','48080dHBwxb','80ruDaGL','494669JAToGg','2333940jWalFz','toUpperCase','22tqQGAF'];a2_0x5305=function(){return _0x2dd19a;};return a2_0x5305();}import a2_0x4e0023 from'path';import a2_0x64b2e6 from'os';export function convertToWindowsPath(_0x552661){const _0x22bd55=a2_0x3f5a;if(_0x552661[_0x22bd55(0x10a)](_0x22bd55(0xfe))){const _0x3f655b=_0x552661[_0x22bd55(0x10b)](0x5)[_0x22bd55(0x108)](),_0x12edde=_0x552661[_0x22bd55(0x103)](0x6)[_0x22bd55(0x10d)](/\//g,'\x5c');return _0x3f655b+':'+_0x12edde;}if(_0x552661[_0x22bd55(0x10e)](/^\/[a-zA-Z]\//)){const _0x28dd7c=_0x552661['charAt'](0x1)[_0x22bd55(0x108)](),_0xbd7930=_0x552661[_0x22bd55(0x103)](0x2)[_0x22bd55(0x10d)](/\//g,'\x5c');return _0x28dd7c+':'+_0xbd7930;}if(_0x552661['match'](/^[a-zA-Z]:/))return _0x552661['replace'](/\//g,'\x5c');return _0x552661;}export function normalizePath(_0x5af023){const _0x1846f4=a2_0x3f5a;_0x5af023=_0x5af023['trim']()[_0x1846f4(0x10d)](/^["']|["']$/g,'');const _0x282695=_0x5af023[_0x1846f4(0x10a)]('/')&&!_0x5af023['match'](/^\/mnt\/[a-z]\//i)&&!_0x5af023[_0x1846f4(0x10e)](/^\/[a-zA-Z]\//);if(_0x282695)return _0x5af023[_0x1846f4(0x10d)](/\/+/g,'/')[_0x1846f4(0x10d)](/\/+$/,'');_0x5af023=convertToWindowsPath(_0x5af023);if(_0x5af023['startsWith']('\x5c\x5c')){let _0x64532a=_0x5af023;_0x64532a=_0x64532a[_0x1846f4(0x10d)](/^\\{2,}/,'\x5c\x5c');const _0x4da449=_0x64532a['substring'](0x2)[_0x1846f4(0x10d)](/\\\\/g,'\x5c');_0x5af023='\x5c\x5c'+_0x4da449;}else _0x5af023=_0x5af023[_0x1846f4(0x10d)](/\\\\/g,'\x5c');let _0x1a80bc=a2_0x4e0023[_0x1846f4(0x10f)](_0x5af023);_0x5af023[_0x1846f4(0x10a)]('\x5c\x5c')&&!_0x1a80bc['startsWith']('\x5c\x5c')&&(_0x1a80bc='\x5c'+_0x1a80bc);if(_0x1a80bc[_0x1846f4(0x10e)](/^[a-zA-Z]:/)){let _0x166a09=_0x1a80bc['replace'](/\//g,'\x5c');return/^[a-z]:/['test'](_0x166a09)&&(_0x166a09=_0x166a09[_0x1846f4(0x10b)](0x0)[_0x1846f4(0x108)]()+_0x166a09[_0x1846f4(0x103)](0x1)),_0x166a09;}return _0x1a80bc[_0x1846f4(0x10d)](/\//g,'\x5c');}export function expandHome(_0xe48fb7){const _0x79946d=a2_0x3f5a;if(_0xe48fb7['startsWith']('~/')||_0xe48fb7==='~')return a2_0x4e0023[_0x79946d(0xfc)](a2_0x64b2e6[_0x79946d(0xff)](),_0xe48fb7[_0x79946d(0x103)](0x1));return _0xe48fb7;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x33e186,_0x32672e){const _0xb535a6=a3_0x1fc3,_0x3ddf0e=_0x33e186();while(!![]){try{const _0x40a264=parseInt(_0xb535a6(0x1b4))/0x1*(-parseInt(_0xb535a6(0x1ba))/0x2)+-parseInt(_0xb535a6(0x1ab))/0x3*(-parseInt(_0xb535a6(0x1bb))/0x4)+-parseInt(_0xb535a6(0x1bd))/0x5*(parseInt(_0xb535a6(0x1af))/0x6)+-parseInt(_0xb535a6(0x1ae))/0x7+-parseInt(_0xb535a6(0x1aa))/0x8+parseInt(_0xb535a6(0x1b1))/0x9*(parseInt(_0xb535a6(0x1ad))/0xa)+parseInt(_0xb535a6(0x1ac))/0xb*(parseInt(_0xb535a6(0x1a8))/0xc);if(_0x40a264===_0x32672e)break;else _0x3ddf0e['push'](_0x3ddf0e['shift']());}catch(_0x26f184){_0x3ddf0e['push'](_0x3ddf0e['shift']());}}}(a3_0x411b,0xb8967));function a3_0x1fc3(_0x1a8ed6,_0x570c5a){_0x1a8ed6=_0x1a8ed6-0x1a7;const _0x411b95=a3_0x411b();let _0x1fc34e=_0x411b95[_0x1a8ed6];return _0x1fc34e;}function a3_0x411b(){const _0x109709=['resolve','startsWith','2668266xWdFWc','50268GdUnmg','includes','4417510nSsNLx','normalize','4334952pTHnET','length','1689784ETSFDG','159tLinwY','99uVYbLX','7409230WoFGrr','10312813vDkvnQ','6iSCmgT','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','9neVEVz','some','string','1vqgoBn','sep','Path\x20must\x20be\x20absolute\x20after\x20normalization','isAbsolute'];a3_0x411b=function(){return _0x109709;};return a3_0x411b();}import a3_0x191b2c from'path';export function isPathWithinAllowedDirectories(_0x25dd63,_0x1a35f7){const _0x377790=a3_0x1fc3;if(typeof _0x25dd63!==_0x377790(0x1b3)||!Array['isArray'](_0x1a35f7))return![];if(!_0x25dd63||_0x1a35f7[_0x377790(0x1a9)]===0x0)return![];if(_0x25dd63[_0x377790(0x1bc)]('\x00'))return![];let _0xc30db0;try{_0xc30db0=a3_0x191b2c[_0x377790(0x1b8)](a3_0x191b2c['normalize'](_0x25dd63));}catch{return![];}if(!a3_0x191b2c['isAbsolute'](_0xc30db0))throw new Error(_0x377790(0x1b6));return _0x1a35f7[_0x377790(0x1b2)](_0x38f356=>{const _0x296963=_0x377790;if(typeof _0x38f356!=='string'||!_0x38f356)return![];if(_0x38f356['includes']('\x00'))return![];let _0x3833ba;try{_0x3833ba=a3_0x191b2c[_0x296963(0x1b8)](a3_0x191b2c[_0x296963(0x1a7)](_0x38f356));}catch{return![];}if(!a3_0x191b2c[_0x296963(0x1b7)](_0x3833ba))throw new Error(_0x296963(0x1b0));if(_0xc30db0===_0x3833ba)return!![];if(_0x3833ba===a3_0x191b2c[_0x296963(0x1b5)])return _0xc30db0[_0x296963(0x1b9)](a3_0x191b2c[_0x296963(0x1b5)]);return _0xc30db0[_0x296963(0x1b9)](_0x3833ba+a3_0x191b2c[_0x296963(0x1b5)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5ba11c,_0x363f12){const _0x5a7167=a4_0x2009,_0x487a44=_0x5ba11c();while(!![]){try{const _0x3da202=-parseInt(_0x5a7167(0x149))/0x1*(parseInt(_0x5a7167(0x148))/0x2)+-parseInt(_0x5a7167(0x14f))/0x3+-parseInt(_0x5a7167(0x14c))/0x4*(-parseInt(_0x5a7167(0x14d))/0x5)+parseInt(_0x5a7167(0x145))/0x6*(parseInt(_0x5a7167(0x13e))/0x7)+-parseInt(_0x5a7167(0x151))/0x8+parseInt(_0x5a7167(0x152))/0x9*(parseInt(_0x5a7167(0x143))/0xa)+parseInt(_0x5a7167(0x147))/0xb*(-parseInt(_0x5a7167(0x14e))/0xc);if(_0x3da202===_0x363f12)break;else _0x487a44['push'](_0x487a44['shift']());}catch(_0x51b783){_0x487a44['push'](_0x487a44['shift']());}}}(a4_0xc705,0x67c82));import{promises as a4_0x509b83}from'fs';function a4_0x2009(_0xcd62b7,_0x10074c){_0xcd62b7=_0xcd62b7-0x13b;const _0xc70529=a4_0xc705();let _0x20097a=_0xc70529[_0xcd62b7];return _0x20097a;}import a4_0x27d435 from'path';import a4_0x3ae393 from'os';function a4_0xc705(){const _0x13d8fc=['stat','realpath','uri','Skipping\x20','10hBWZHo','resolve','18ndOLdo','message','22NOarGc','38bafTUf','26291SATKea','slice','file://','265300oSTofd','40iFaDNg','673200JWMRfh','329031oQQCjK','join','5269656oVhuOF','6203889PQgjgi','isDirectory','non-directory\x20root','Skipping\x20invalid\x20directory:\x20','1365658Mktbgl'];a4_0xc705=function(){return _0x13d8fc;};return a4_0xc705();}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x323c00){const _0x632d7f=a4_0x2009;try{const _0x28f8ea=_0x323c00['startsWith'](_0x632d7f(0x14b))?_0x323c00[_0x632d7f(0x14a)](0x7):_0x323c00,_0x227e33=_0x28f8ea['startsWith']('~/')||_0x28f8ea==='~'?a4_0x27d435[_0x632d7f(0x150)](a4_0x3ae393['homedir'](),_0x28f8ea[_0x632d7f(0x14a)](0x1)):_0x28f8ea,_0x3a0883=a4_0x27d435[_0x632d7f(0x144)](_0x227e33),_0x40853d=await a4_0x509b83[_0x632d7f(0x140)](_0x3a0883);return normalizePath(_0x40853d);}catch{return null;}}function formatDirectoryError(_0x538882,_0x213129,_0x1b1c57){const _0x3abe3f=a4_0x2009;if(_0x1b1c57)return _0x3abe3f(0x142)+_0x1b1c57+':\x20'+_0x538882;const _0x47b1f0=_0x213129 instanceof Error?_0x213129[_0x3abe3f(0x146)]:String(_0x213129);return _0x3abe3f(0x13d)+_0x538882+'\x20due\x20to\x20error:\x20'+_0x47b1f0;}export async function getValidRootDirectories(_0x22113f){const _0x5296d=a4_0x2009,_0xb72ca4=[];for(const _0x2ede4e of _0x22113f){const _0x3a525c=await parseRootUri(_0x2ede4e[_0x5296d(0x141)]);if(!_0x3a525c){logMcpStderr(formatDirectoryError(_0x2ede4e[_0x5296d(0x141)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x8ee15=await a4_0x509b83[_0x5296d(0x13f)](_0x3a525c);_0x8ee15[_0x5296d(0x13b)]()?_0xb72ca4['push'](_0x3a525c):logMcpStderr(formatDirectoryError(_0x3a525c,undefined,_0x5296d(0x13c)));}catch(_0x8396f3){logMcpStderr(formatDirectoryError(_0x3a525c,_0x8396f3));}}return _0xb72ca4;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.147",
|
|
4
4
|
"description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Morph (https://morphllm.com)",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google/generative-ai": "^0.21.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
38
|
-
"@morphllm/morphsdk": "0.2.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.152",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|