@morphllm/morphmcp 0.8.142 → 0.8.143
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_0x99da29=a0_0x2e7f;(function(_0x517ae8,_0x23443b){const _0x5999b0=a0_0x2e7f,_0x1d358e=_0x517ae8();while(!![]){try{const _0xbfd490=-parseInt(_0x5999b0(0x1ab))/0x1*(-parseInt(_0x5999b0(0x12b))/0x2)+-parseInt(_0x5999b0(0x1c6))/0x3+parseInt(_0x5999b0(0x1cb))/0x4+parseInt(_0x5999b0(0x15d))/0x5*(parseInt(_0x5999b0(0x18d))/0x6)+-parseInt(_0x5999b0(0x17f))/0x7*(parseInt(_0x5999b0(0x114))/0x8)+parseInt(_0x5999b0(0x164))/0x9+parseInt(_0x5999b0(0x1bd))/0xa*(-parseInt(_0x5999b0(0x186))/0xb);if(_0xbfd490===_0x23443b)break;else _0x1d358e['push'](_0x1d358e['shift']());}catch(_0x428301){_0x1d358e['push'](_0x1d358e['shift']());}}}(a0_0x28eb,0x36a09));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_0x57fe67 from'fs/promises';import a0_0x2aa0dc from'path';import a0_0x2b6dcd 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';function a0_0x28eb(){const _0x1f898d=['No\x20relevant\x20code\x20found\x20for\x20the\x20query.','ToolException','optional','normalize','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','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','search_type','Failed\x20to\x20request\x20roots\x20from\x20client:','.\x20Path:\x20','completed','messages','\x27\x20in\x20`','unknown','timeout','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','❌\x20Morph\x20Edit\x20Failed:\x20','description','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Unknown\x20error','Created\x20File','slice','node_modules','exit','boolean','package.json','setRequestHandler','WORKSPACE_ROOT','floor','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','resolve','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','files','branch','all','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.','Repository\x20identifier','completed_with_file_errors','now','.git','basename','text','github_codebase_search','log','homedir','list_directory\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','Morph\x20Edit\x20','payload','Fatal\x20error\x20running\x20server:','TimeoutError','--version','join','listRoots','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Fallback:\x20Using\x20workspace\x20root\x20','params','\x20chars)','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','\x20valid\x20directories','\x20-\x20','1307896zEQlpT','cwd','FileReadError','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','PathError','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','startsWith','push','split','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22',',\x20modified\x20','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','\x0aOptions:','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','api-key','\x0a</file>','dryRun','edit_file','morph-','RipgrepNotAvailable','morph-warp-grep-v2.1','18UWtauK','\x0a...\x20(truncated,\x20total:\x20','false','PWD','code_edit','github_url','enum','map','inputSchema','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','connect','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Specific\x20commit\x20hash\x20to\x20search','error','pattern','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','readFile','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','array','search_string','read','Disabled\x20tools:\x20','0.2.0','Unknown\x20tool:\x20','-\x20Read\x20file\x20`','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','message','indexOf','getClientCapabilities','MORPH_WARP_GREP_TIMEOUT','Error:\x20','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','-\x20Glob\x20search\x20`','min','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','includes','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','repo_path','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','DISABLED_TOOLS','--help','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','\x20disabled\x20via\x20DISABLED_TOOLS','content','ENOENT','@morphllm/morphmcp\x20','env','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.','instruction','filter','661035MUMsmV','list_directory','post','toISOString','ms.\x20Success:\x20','codebase_search','Warning:\x20','3791196Blxsuh','object','MORPH_API_KEY','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','source','path','ENABLE_WORKSPACE_MODE','trim','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','go.mod','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','safeParse','version','utf-8','dirname','[github_codebase_search]\x20Searching\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','command','stack','isArray','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','oninitialized','name','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',',\x20removed\x20','linesRemoved','Tool\x20\x22','7apUqPa','\x20(new\x20file)','default','[github_codebase_search]\x20Failed\x20in\x20','grep_search','\x20error(s)','\x20for:\x20\x22','6443965ClTFZJ','has','code','ms:','read\x20','UnknownError','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','6NtDZYa','.cursor','grep','Rules:\x0a','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','\x0aExamples:','changes','Benefits:\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','warn','terminationReason','success','stringify','data','linesAdded','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Parent\x20directory\x20does\x20not\x20exist:\x20','match','realpath','constructor','searchGitHub','describe','access','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','string','\x22.\x20Known\x20tools:\x20','isDirectory','parse','File\x20read\x20error:','23741Igokch','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.','sep','-\x20Listed\x20directory\x20`','finish','tool_call_id','mcp-filesystem','BinaryFile','catch','role','timings','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','</file>','function','SymlinkError','added\x20','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','composer.json','10ormUzC','setNotificationHandler','toLowerCase','errors','Relevant\x20context\x20found:','Invalid\x20arguments:\x20','`\x20in\x20`','.\x20Changes:\x20','--api-key=','545139VMVfId','arguments','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','Tool\x20','size','1550592xrLjQF','Workspace\x20mode\x20enabled:\x20Using\x20','assistant','Morph\x20Edit\x20Preview','--api-key','<file\x20path=\x22','tool_calls','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','Failed\x20to\x20read\x20file:\x20','substring','sk-','number','tsconfig.json','unknown\x20error','pyproject.toml','RipgrepError','requiresApiKey','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Error\x20accessing\x20directory\x20','metadata','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','[github_codebase_search]\x20Done\x20in\x20','length','owner_repo','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','lines','\x22>\x0aError\x20reading\x20file:\x20','linesModified','.vscode','roots','morph-mcp'];a0_0x28eb=function(){return _0x1f898d;};return a0_0x28eb();}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import a0_0x15f0d8 from'axios';function fixPathRepetition(_0x33aa4d){const _0x2f3a82=a0_0x2e7f,_0x3fc5a0=_0x33aa4d['split'](a0_0x2aa0dc[_0x2f3a82(0x1ad)])[_0x2f3a82(0x15c)](Boolean);if(_0x3fc5a0['length']<0x2)return null;for(let _0x3608d9=Math[_0x2f3a82(0x206)](_0x3fc5a0[_0x2f3a82(0x1e2)]/0x2);_0x3608d9>=0x1;_0x3608d9--){for(let _0x2e5ee8=0x0;_0x2e5ee8<=_0x3fc5a0[_0x2f3a82(0x1e2)]-0x2*_0x3608d9;_0x2e5ee8++){const _0x3a50c1=_0x3fc5a0['slice'](_0x2e5ee8,_0x2e5ee8+_0x3608d9),_0x4d15d9=_0x3fc5a0[_0x2f3a82(0x1ff)](_0x2e5ee8+_0x3608d9,_0x2e5ee8+0x2*_0x3608d9);if(_0x3a50c1['every']((_0x4ff923,_0x4941fa)=>_0x4ff923===_0x4d15d9[_0x4941fa])){const _0x453685=[..._0x3fc5a0[_0x2f3a82(0x1ff)](0x0,_0x2e5ee8),..._0x3fc5a0['slice'](_0x2e5ee8+_0x3608d9)];return a0_0x2aa0dc[_0x2f3a82(0x1ad)]+_0x453685[_0x2f3a82(0x10b)](a0_0x2aa0dc[_0x2f3a82(0x1ad)]);}}}return null;}function a0_0x2e7f(_0xb05a37,_0x39d2af){_0xb05a37=_0xb05a37-0x100;const _0x28eb58=a0_0x28eb();let _0x2e7f74=_0x28eb58[_0xb05a37];return _0x2e7f74;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x270c24=a0_0x2e7f;try{const _0x2dbc31=require('../package.json');return _0x2dbc31[_0x270c24(0x170)]??_0x270c24(0x1f7);}catch(_0x2c834f){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x2c834f),_0x270c24(0x1f7);}}function printHelp(){const _0xa2e945=a0_0x2e7f;console[_0xa2e945(0x102)](_0xa2e945(0x158)+getPackageVersion()),console[_0xa2e945(0x102)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0xa2e945(0x102)](_0xa2e945(0x122)),console[_0xa2e945(0x102)](_0xa2e945(0x1d2)),console[_0xa2e945(0x102)](_0xa2e945(0x11f)),console[_0xa2e945(0x102)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log'](_0xa2e945(0x192)),console[_0xa2e945(0x102)]('\x20\x20morph-mcp'),console[_0xa2e945(0x102)](_0xa2e945(0x154));}const cliArgs=process['argv'][a0_0x99da29(0x1ff)](0x2),VERSION_FLAGS=new Set([a0_0x99da29(0x10a),'-v','-V']),HELP_FLAGS=new Set([a0_0x99da29(0x153),'-h']);cliArgs['some'](_0x79c892=>VERSION_FLAGS[a0_0x99da29(0x187)](_0x79c892))&&(console['log'](a0_0x99da29(0x158)+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x25debb=>HELP_FLAGS[a0_0x99da29(0x187)](_0x25debb))&&(printHelp(),process[a0_0x99da29(0x201)](0x0));function getCliArg(_0x18df4e){const _0x3eb7a0=a0_0x99da29;for(let _0x14bf25=0x0;_0x14bf25<cliArgs[_0x3eb7a0(0x1e2)];_0x14bf25++){const _0x23b975=cliArgs[_0x14bf25];if(_0x23b975[_0x3eb7a0(0x11a)]('--'+_0x18df4e+'='))return _0x23b975[_0x3eb7a0(0x1ff)](('--'+_0x18df4e+'=')[_0x3eb7a0(0x1e2)]);if(_0x23b975==='--'+_0x18df4e&&_0x14bf25+0x1<cliArgs[_0x3eb7a0(0x1e2)])return cliArgs[_0x14bf25+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x99da29(0x187)](arg))continue;if(arg[a0_0x99da29(0x11a)](a0_0x99da29(0x1c5)))continue;if(arg===a0_0x99da29(0x1cf)){i++;continue;}args[a0_0x99da29(0x11b)](arg);}const WORKSPACE_ROOT=process[a0_0x99da29(0x159)][a0_0x99da29(0x205)]||process[a0_0x99da29(0x159)][a0_0x99da29(0x12e)]||process[a0_0x99da29(0x115)](),ENABLE_WORKSPACE_MODE=process[a0_0x99da29(0x159)][a0_0x99da29(0x16a)]!==a0_0x99da29(0x12d),MORPH_API_KEY=getCliArg(a0_0x99da29(0x124))??process[a0_0x99da29(0x159)][a0_0x99da29(0x166)],MORPH_API_URL=process[a0_0x99da29(0x159)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x99da29(0x159)][a0_0x99da29(0x148)]?parseInt(process[a0_0x99da29(0x159)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x99da29(0x127),a0_0x99da29(0x162),a0_0x99da29(0x101)]),DISABLED_TOOLS=process[a0_0x99da29(0x159)][a0_0x99da29(0x152)]?new Set(process[a0_0x99da29(0x159)]['DISABLED_TOOLS']['split'](',')['map'](_0x25304d=>_0x25304d[a0_0x99da29(0x16b)]())[a0_0x99da29(0x15c)](_0x430a1a=>_0x430a1a[a0_0x99da29(0x1e2)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x99da29(0x1ca)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x99da29(0x187)](tool)&&console[a0_0x99da29(0x138)](a0_0x99da29(0x11d)+tool+a0_0x99da29(0x1a7)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console['error'](a0_0x99da29(0x140)+[...DISABLED_TOOLS][a0_0x99da29(0x10b)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x99da29(0x11a)](a0_0x99da29(0x1d5))&&!MORPH_API_KEY['startsWith'](a0_0x99da29(0x128))&&logMcpStderr(a0_0x99da29(0x1a5));async function reportMorphError(_0x58ebc5){const _0x3fc101=a0_0x99da29;try{await a0_0x15f0d8[_0x3fc101(0x15f)]('https://morphllm.com/api/error-report',{..._0x58ebc5,'timestamp':new Date()[_0x3fc101(0x160)](),'source':_0x58ebc5[_0x3fc101(0x168)]||_0x3fc101(0x1b1),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x58ebc5['context']}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x99da29(0x1e2)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x99da29(0x1e0)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x99da29(0x1f9)),logMcpStderr(a0_0x99da29(0x16c)),logMcpStderr(a0_0x99da29(0x174)));function normalizePath(_0x3e71ca){const _0x6287dd=a0_0x99da29;return a0_0x2aa0dc[_0x6287dd(0x1ee)](_0x3e71ca);}function expandHome(_0x277e1e){const _0x39b451=a0_0x99da29;if(_0x277e1e[_0x39b451(0x11a)]('~/')||_0x277e1e==='~')return a0_0x2aa0dc[_0x39b451(0x10b)](a0_0x2b6dcd[_0x39b451(0x103)](),_0x277e1e[_0x39b451(0x1ff)](0x1));return _0x277e1e;}let allowedDirectories=await Promise[a0_0x99da29(0x20c)](args[a0_0x99da29(0x132)](async _0x3a608a=>{const _0x46ac56=a0_0x99da29,_0x110d79=expandHome(_0x3a608a),_0x3d8897=a0_0x2aa0dc['resolve'](_0x110d79);try{const _0x1b7eba=await a0_0x57fe67[_0x46ac56(0x1a0)](_0x3d8897);return normalizePath(_0x1b7eba);}catch(_0x1e0dfc){return normalizePath(_0x3d8897);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x99da29(0x1e2)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x99da29(0x11b)](workspaceDir),logMcpStderr(a0_0x99da29(0x1cc)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x6b76d9){logMcpStderr(a0_0x99da29(0x117)+a0_0x6b76d9);}async function detectWorkspaceRoot(_0x4a034f){const _0xf22114=a0_0x99da29;let _0x433869=a0_0x2aa0dc[_0xf22114(0x208)](_0x4a034f);const _0x5cf17d=[_0xf22114(0x211),_0xf22114(0x1e8),_0xf22114(0x203),'Cargo.toml',_0xf22114(0x1d9),_0xf22114(0x16d),_0xf22114(0x18e),_0xf22114(0x1d7),_0xf22114(0x1bc)];while(_0x433869!==a0_0x2aa0dc[_0xf22114(0x172)](_0x433869)){for(const _0x25f907 of _0x5cf17d){const _0xc03cdb=a0_0x2aa0dc[_0xf22114(0x10b)](_0x433869,_0x25f907);try{return await a0_0x57fe67[_0xf22114(0x1a4)](_0xc03cdb),normalizePath(_0x433869);}catch{}}_0x433869=a0_0x2aa0dc[_0xf22114(0x172)](_0x433869);}return normalizePath(_0x4a034f);}await Promise[a0_0x99da29(0x20c)](args[a0_0x99da29(0x132)](async _0x422ad9=>{const _0x41dfe1=a0_0x99da29;try{const _0x55f422=await a0_0x57fe67['stat'](expandHome(_0x422ad9));!_0x55f422[_0x41dfe1(0x1a8)]()&&(logMcpStderr('Error:\x20'+_0x422ad9+'\x20is\x20not\x20a\x20directory'),process['exit'](0x1));}catch(_0x2e4c56){logMcpStderr(_0x41dfe1(0x1de)+_0x422ad9+':',_0x2e4c56),process[_0x41dfe1(0x201)](0x1);}}));async function validatePath(_0x238345){const _0x3359fb=a0_0x99da29,_0x23d64a=expandHome(_0x238345),_0x123376=a0_0x2aa0dc[_0x3359fb(0x208)](_0x23d64a);try{const _0x98f110=await a0_0x57fe67['realpath'](_0x123376);return _0x98f110;}catch(_0x3eec2f){if(_0x3eec2f[_0x3359fb(0x188)]===_0x3359fb(0x157)){const _0x31de9b=a0_0x2aa0dc[_0x3359fb(0x172)](_0x123376);try{const _0x4ed94c=await a0_0x57fe67[_0x3359fb(0x1a0)](_0x31de9b);return a0_0x2aa0dc[_0x3359fb(0x10b)](_0x4ed94c,a0_0x2aa0dc[_0x3359fb(0x212)](_0x123376));}catch{throw new Error(_0x3359fb(0x19e)+_0x31de9b);}}throw _0x3eec2f;}}const MorphEditFileArgsSchema=z[a0_0x99da29(0x165)]({'path':z[a0_0x99da29(0x1a6)](),'code_edit':z[a0_0x99da29(0x1a6)]()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1a3)](a0_0x99da29(0x151)),'dryRun':z[a0_0x99da29(0x202)]()['default'](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x99da29(0x1ac),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x99da29(0x1a3)](a0_0x99da29(0x1c8)),'search_type':z[a0_0x99da29(0x131)]([a0_0x99da29(0x181),a0_0x99da29(0x200)])[a0_0x99da29(0x1ed)]()[a0_0x99da29(0x1a3)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x99da29(0x165)]({'search_string':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1ed)]()['describe'](a0_0x99da29(0x15a)),'owner_repo':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1ed)]()[a0_0x99da29(0x1a3)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1ed)]()[a0_0x99da29(0x1a3)](a0_0x99da29(0x178))}),CodebaseSearchArgsSchema=z[a0_0x99da29(0x165)]({'query':z[a0_0x99da29(0x1a6)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x99da29(0x1a3)](a0_0x99da29(0x20e)),'branch':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1ed)]()[a0_0x99da29(0x1a3)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x99da29(0x1a6)]()[a0_0x99da29(0x1ed)]()[a0_0x99da29(0x1a3)](a0_0x99da29(0x137)),'targetDirectories':z[a0_0x99da29(0x13d)](z[a0_0x99da29(0x1a6)]())[a0_0x99da29(0x181)]([])[a0_0x99da29(0x1a3)](a0_0x99da29(0x119)),'limit':z[a0_0x99da29(0x1d6)]()['optional']()[a0_0x99da29(0x181)](0xa)[a0_0x99da29(0x1a3)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x99da29(0x1ea),'version':a0_0x99da29(0x141)},{'capabilities':{'tools':{}}});server[a0_0x99da29(0x204)](ListToolsRequestSchema,async()=>{const _0x3722ca=a0_0x99da29,_0x2448be=[{'name':_0x3722ca(0x127),'description':_0x3722ca(0x136)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x3722ca(0x1dc)+_0x3722ca(0x120)+_0x3722ca(0x194)+_0x3722ca(0x14a)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x3722ca(0x14d)+_0x3722ca(0x196)+_0x3722ca(0x144)+_0x3722ca(0x1e4)+_0x3722ca(0x1fc)+'For\x20deletions:\x0a'+_0x3722ca(0x121)+_0x3722ca(0x167)+_0x3722ca(0x190)+_0x3722ca(0x1f0)+_0x3722ca(0x13c)+_0x3722ca(0x1dd)+_0x3722ca(0x191)+_0x3722ca(0x14f)+_0x3722ca(0x134)+_0x3722ca(0x1ef),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x3722ca(0x162),'description':_0x3722ca(0x111)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3722ca(0x16e)+'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':!![]}],_0x4d6c20=_0x2448be[_0x3722ca(0x15c)](_0x3eaec5=>{const _0x1a8ffc=_0x3722ca;if(DISABLED_TOOLS[_0x1a8ffc(0x187)](_0x3eaec5[_0x1a8ffc(0x17a)]))return console[_0x1a8ffc(0x138)](_0x1a8ffc(0x1c9)+_0x3eaec5[_0x1a8ffc(0x17a)]+_0x1a8ffc(0x155)),![];if(_0x1a8ffc(0x1db)in _0x3eaec5&&_0x3eaec5[_0x1a8ffc(0x1db)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x3eaec5['name']+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x4d6c20['map'](_0x461160=>({'name':_0x461160['name'],'description':_0x461160[_0x3722ca(0x1fb)],'inputSchema':_0x461160[_0x3722ca(0x133)]}))};}),server[a0_0x99da29(0x204)](CallToolRequestSchema,async _0x4acffd=>{const _0x134e34=a0_0x99da29,{name:_0x1b834b,arguments:_0x52f233}=_0x4acffd[_0x134e34(0x10f)];try{if(DISABLED_TOOLS[_0x134e34(0x187)](_0x1b834b))throw new Error(_0x134e34(0x17e)+_0x1b834b+_0x134e34(0x13a));switch(_0x1b834b){case _0x134e34(0x127):{const _0x33724d=MorphEditFileArgsSchema[_0x134e34(0x16f)](_0x52f233);if(!_0x33724d['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x33724d[_0x134e34(0x138)]);const _0x150011=await validatePath(_0x33724d[_0x134e34(0x19b)][_0x134e34(0x169)]);let _0x4547b9=null,_0x203203=!![],_0x17e043=null;try{_0x4547b9=await a0_0x57fe67[_0x134e34(0x13b)](_0x150011,'utf-8');}catch(_0x3ef951){const _0x5d961d=_0x3ef951['code'];_0x5d961d==='ENOENT'?(_0x203203=![],_0x4547b9=''):(_0x17e043=_0x134e34(0x1d3)+(_0x5d961d||_0x134e34(0x1f7))+_0x134e34(0x113)+(_0x3ef951 instanceof Error?_0x3ef951[_0x134e34(0x145)]:String(_0x3ef951)),logMcpStderr(_0x134e34(0x163)+_0x17e043));}let _0x198a49;try{const _0x11ac6b=MORPH_API_KEY;if(!_0x11ac6b)throw new Error(_0x134e34(0x19d));const _0xa1fdf7=a0_0x2aa0dc[_0x134e34(0x172)](_0x150011),_0x3698e1=a0_0x2aa0dc[_0x134e34(0x212)](_0x150011),_0x242c51=await executeEditFile({'target_filepath':_0x3698e1,'code_edit':_0x33724d[_0x134e34(0x19b)][_0x134e34(0x12f)],'instructions':_0x33724d[_0x134e34(0x19b)][_0x134e34(0x15b)]},{'morphApiKey':_0x11ac6b,'morphApiUrl':MORPH_API_URL,'baseDir':_0xa1fdf7,'autoWrite':!_0x33724d['data'][_0x134e34(0x126)],'generateUdiff':![],'debug':![]});_0x198a49=_0x242c51['completionId'];if(!_0x242c51[_0x134e34(0x199)])throw new Error(_0x242c51[_0x134e34(0x138)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x161588=_0x242c51[_0x134e34(0x193)],_0x1cbe26=_0x134e34(0x1ba)+_0x161588[_0x134e34(0x19c)]+_0x134e34(0x17c)+_0x161588[_0x134e34(0x17d)]+_0x134e34(0x11e)+_0x161588[_0x134e34(0x1e7)];if(_0x33724d['data']['dryRun'])return{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x1ce)+(_0x203203?'':_0x134e34(0x180))+':\x20'+_0x33724d[_0x134e34(0x19b)]['instruction']+_0x134e34(0x1c4)+_0x1cbe26+'.\x20Path:\x20'+_0x33724d['data'][_0x134e34(0x169)]+'.'}]};return{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x106)+(_0x203203?'Applied':_0x134e34(0x1fe))+':\x20'+_0x33724d[_0x134e34(0x19b)][_0x134e34(0x15b)]+_0x134e34(0x1c4)+_0x1cbe26+_0x134e34(0x1f3)+_0x33724d['data']['path']+'.'}]};}catch(_0x2576fa){const _0x3d1ef6=_0x2576fa instanceof Error?_0x2576fa[_0x134e34(0x145)]:String(_0x2576fa);return reportMorphError({'error_message':_0x3d1ef6,'error_type':_0x2576fa instanceof Error?_0x2576fa[_0x134e34(0x1a1)]['name']:_0x134e34(0x18b),'context':{'tool':'edit_file','completion_id':_0x198a49,'file_path':_0x33724d['data'][_0x134e34(0x169)],'validated_path':_0x150011,'instruction':_0x33724d[_0x134e34(0x19b)][_0x134e34(0x15b)],'model':'morph-v3-fast','dry_run':_0x33724d['data']['dryRun'],'file_exists':_0x203203,'file_read_error':_0x17e043,'file_readable':_0x4547b9!==null,'request_content':{'path':_0x33724d[_0x134e34(0x19b)]['path'],'code_edit':_0x33724d[_0x134e34(0x19b)][_0x134e34(0x12f)],'instruction':_0x33724d[_0x134e34(0x19b)][_0x134e34(0x15b)],'original_code':_0x4547b9!==null?_0x4547b9['length']>0xc350?_0x4547b9[_0x134e34(0x1d4)](0x0,0xc350)+_0x134e34(0x12c)+_0x4547b9[_0x134e34(0x1e2)]+_0x134e34(0x110):_0x4547b9:'[could\x20not\x20read\x20file:\x20'+(_0x17e043||_0x134e34(0x1d8))+']','original_code_length':_0x4547b9?.[_0x134e34(0x1e2)]??0x0,'model':'morph-v3-fast','dry_run':_0x33724d['data'][_0x134e34(0x126)]}},'stack_trace':_0x2576fa instanceof Error?_0x2576fa[_0x134e34(0x176)]:undefined,'source':_0x134e34(0x1b1)})[_0x134e34(0x1b3)](()=>{}),{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x1fa)+_0x3d1ef6}],'isError':!![]};}}case _0x134e34(0x162):{const _0x25a968=WarpGrepArgsSchema['safeParse'](_0x52f233);if(!_0x25a968[_0x134e34(0x199)])return{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x1c2)+_0x25a968[_0x134e34(0x138)]}],'isError':!![]};const _0x4e25fb=_0x75df28=>{const _0x3ecb35=_0x134e34,_0x28724c=[];for(const _0x172b84 of _0x75df28||[]){if(_0x172b84[_0x3ecb35(0x1b4)]===_0x3ecb35(0x1cd)&&Array[_0x3ecb35(0x177)](_0x172b84[_0x3ecb35(0x1d1)]))for(const _0x24c8f7 of _0x172b84[_0x3ecb35(0x1d1)]){try{const _0x3ba406=_0x24c8f7[_0x3ecb35(0x1b8)]?.[_0x3ecb35(0x17a)],_0x352142=JSON[_0x3ecb35(0x1a9)](_0x24c8f7['function']?.['arguments']||'{}');if(_0x3ba406===_0x3ecb35(0x183))_0x28724c[_0x3ecb35(0x11b)]('grep\x20\x27'+_0x352142[_0x3ecb35(0x139)]+'\x27\x20'+(_0x352142['path']||'.'));else{if(_0x3ba406===_0x3ecb35(0x13f))_0x28724c[_0x3ecb35(0x11b)](_0x3ecb35(0x18a)+_0x352142['path']);else{if(_0x3ba406===_0x3ecb35(0x15e))_0x28724c[_0x3ecb35(0x11b)](_0x3ecb35(0x104)+(_0x352142['command']||'.'));else{if(_0x3ba406==='glob')_0x28724c[_0x3ecb35(0x11b)]('glob\x20\x27'+_0x352142[_0x3ecb35(0x139)]+'\x27\x20'+(_0x352142[_0x3ecb35(0x169)]||'.'));else _0x3ba406===_0x3ecb35(0x1af)&&_0x28724c['push'](_0x3ecb35(0x1af));}}}}catch{}}}return _0x28724c;},_0x7c491b=_0x43cb37=>{const _0x278b7f=_0x134e34,_0x94faf9=[];if(!_0x43cb37||!Array[_0x278b7f(0x177)](_0x43cb37))return _0x94faf9;const _0x2f94df=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x278b7f(0x13f)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x278b7f(0x118),'tool':_0x278b7f(0x13f)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x278b7f(0x13f)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x278b7f(0x1b2),'tool':_0x278b7f(0x13f)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x278b7f(0x1da),'tool':_0x278b7f(0x18f)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x278b7f(0x129),'tool':_0x278b7f(0x18f)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x278b7f(0x1b2),'tool':_0x278b7f(0x13f)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x278b7f(0x13f)},{'pattern':/not a text file/,'error_type':_0x278b7f(0x1b2),'tool':_0x278b7f(0x13f)},{'pattern':/symbolic link/,'error_type':_0x278b7f(0x1b9),'tool':_0x278b7f(0x13f)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x278b7f(0x13f)},{'pattern':/status="error"/,'error_type':_0x278b7f(0x1ec),'tool':_0x278b7f(0x1f7)}];let _0xe8dcbe=0x0;for(const _0x4f22e3 of _0x43cb37){_0x4f22e3[_0x278b7f(0x1b4)]===_0x278b7f(0x1cd)&&Array[_0x278b7f(0x177)](_0x4f22e3[_0x278b7f(0x1d1)])&&_0xe8dcbe++;const _0x1c74ec=_0x4f22e3['content'];if((_0x4f22e3[_0x278b7f(0x1b4)]==='tool'||_0x4f22e3[_0x278b7f(0x1b4)]==='user')&&_0x1c74ec&&typeof _0x1c74ec===_0x278b7f(0x1a6))for(const {pattern:_0x572d5f,error_type:_0x17cfdf,tool:_0x108ed6}of _0x2f94df){const _0x2009f6=_0x1c74ec[_0x278b7f(0x19f)](new RegExp(_0x572d5f[_0x278b7f(0x168)],'g'));if(_0x2009f6)for(const _0x39182 of _0x2009f6){const _0x26de49=_0x1c74ec[_0x278b7f(0x146)](_0x39182),_0x26225f=_0x1c74ec['substring'](_0x26de49,Math[_0x278b7f(0x14c)](_0x26de49+0xc8,_0x1c74ec[_0x278b7f(0x1e2)]));_0x94faf9[_0x278b7f(0x11b)]({'tool':_0x108ed6,'error_type':_0x17cfdf,'error_message':_0x26225f[_0x278b7f(0x11c)]('\x0a')[0x0],'turn':_0xe8dcbe});}}}return _0x94faf9;};try{const _0x412ff6=a0_0x2aa0dc['resolve'](_0x25a968[_0x134e34(0x19b)]['repo_path']),_0x50267b=_0x25a968[_0x134e34(0x19b)][_0x134e34(0x1f1)],_0x27451f=_0x50267b===_0x134e34(0x200)?{'allowNames':[_0x134e34(0x200)]}:undefined,_0x48df60=new LocalRipgrepProvider(_0x412ff6,undefined,_0x27451f),_0x2d1dec=await runWarpGrep({'searchTerm':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x13e)],'repoRoot':_0x412ff6,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x48df60,'search_type':_0x50267b}),_0x2fd61d=_0x7c491b(_0x2d1dec[_0x134e34(0x1f5)]);_0x2fd61d[_0x134e34(0x1e2)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2fd61d['length']+_0x134e34(0x184),'error_type':'SubToolError','level':_0x134e34(0x197),'tool':_0x134e34(0x162),'context':{'repo_path':_0x25a968[_0x134e34(0x19b)]['repo_path'],'query':_0x25a968['data'][_0x134e34(0x13e)],'model':_0x134e34(0x12a),'termination_reason':_0x2d1dec[_0x134e34(0x198)],'sub_tool_errors':_0x2fd61d,'timings':_0x2d1dec['timings'],'tool_calls':_0x4e25fb(_0x2d1dec[_0x134e34(0x1f5)]),'messages':_0x2d1dec[_0x134e34(0x1f5)]?.[_0x134e34(0x132)](_0x2faddc=>({'role':_0x2faddc['role'],'content':_0x2faddc[_0x134e34(0x156)],..._0x2faddc[_0x134e34(0x1d1)]?{'tool_calls':_0x2faddc['tool_calls']['length']}:{},..._0x2faddc[_0x134e34(0x1b0)]?{'tool_call_id':_0x2faddc['tool_call_id']}:{}}))},'source':'mcp-filesystem'})[_0x134e34(0x1b3)](()=>{});let _0x3b1eed='';if(_0x2d1dec[_0x134e34(0x198)]===_0x134e34(0x1f4)&&_0x2d1dec[_0x134e34(0x1af)]?.[_0x134e34(0x1df)]?.[_0x134e34(0x20a)]){const _0x3ad6b1=_0x2d1dec[_0x134e34(0x1af)][_0x134e34(0x1df)]['files'];if(_0x3ad6b1[_0x134e34(0x1e2)]===0x0)return _0x3b1eed=_0x2d1dec['finish'][_0x134e34(0x107)]||_0x134e34(0x1eb),{'content':[{'type':_0x134e34(0x100),'text':_0x3b1eed}]};const _0x1640ab=[],_0x3dec4d=[_0x134e34(0x10d)];for(const _0x5d1ed2 of _0x2d1dec[_0x134e34(0x1f5)]){if(_0x5d1ed2[_0x134e34(0x1b4)]===_0x134e34(0x1cd)&&Array[_0x134e34(0x177)](_0x5d1ed2[_0x134e34(0x1d1)]))for(const _0x4af30c of _0x5d1ed2[_0x134e34(0x1d1)]){try{const _0x9f715=_0x4af30c[_0x134e34(0x1b8)]?.[_0x134e34(0x17a)],_0x307626=JSON[_0x134e34(0x1a9)](_0x4af30c[_0x134e34(0x1b8)]?.[_0x134e34(0x1c7)]||'{}');if(_0x9f715===_0x134e34(0x183))_0x3dec4d['push']('-\x20Grepped\x20\x27'+_0x307626[_0x134e34(0x139)]+_0x134e34(0x1f6)+(_0x307626['path']||'.')+'`');else{if(_0x9f715==='read')_0x3dec4d[_0x134e34(0x11b)](_0x134e34(0x143)+_0x307626['path']+'`');else{if(_0x9f715===_0x134e34(0x15e))_0x3dec4d[_0x134e34(0x11b)](_0x134e34(0x1ae)+(_0x307626[_0x134e34(0x175)]||'.')+'`');else _0x9f715==='glob'&&_0x3dec4d['push'](_0x134e34(0x14b)+_0x307626[_0x134e34(0x139)]+_0x134e34(0x1c3)+(_0x307626[_0x134e34(0x169)]||'.')+'`');}}}catch{}}}_0x1640ab[_0x134e34(0x11b)](_0x3dec4d[_0x134e34(0x10b)]('\x0a'));const _0x413a5b=['',_0x134e34(0x1c1)];for(const _0x3ec6e2 of _0x3ad6b1){if(_0x3ec6e2[_0x134e34(0x1e5)]==='*')_0x413a5b[_0x134e34(0x11b)]('-\x20'+_0x3ec6e2[_0x134e34(0x169)]+':*');else{if(Array[_0x134e34(0x177)](_0x3ec6e2[_0x134e34(0x1e5)])){const _0x5105ac=_0x3ec6e2['lines']['map'](([_0x4b76d3,_0x4410a6])=>{if(_0x4b76d3===_0x4410a6)return''+_0x4b76d3;return _0x4b76d3+'-'+_0x4410a6;});_0x413a5b[_0x134e34(0x11b)]('-\x20'+_0x3ec6e2[_0x134e34(0x169)]+':'+_0x5105ac[_0x134e34(0x10b)](','));}else _0x413a5b[_0x134e34(0x11b)]('-\x20'+_0x3ec6e2[_0x134e34(0x169)]+':*');}}_0x413a5b[_0x134e34(0x11b)](''),_0x1640ab['push'](_0x413a5b[_0x134e34(0x10b)]('\x0a')),_0x1640ab['push'](_0x134e34(0x105));const _0xcd6b84=[];for(const _0xf08df3 of _0x3ad6b1){let _0x4f646d=a0_0x2aa0dc[_0x134e34(0x208)](_0x25a968['data'][_0x134e34(0x150)],_0xf08df3[_0x134e34(0x169)]),_0x10d22b=null,_0x253ef3=null;try{_0x10d22b=await a0_0x57fe67[_0x134e34(0x13b)](_0x4f646d,{'encoding':_0x134e34(0x171)});}catch(_0x450a66){const _0x4c4c9e=fixPathRepetition(_0x4f646d);if(_0x4c4c9e)try{_0x10d22b=await a0_0x57fe67[_0x134e34(0x13b)](_0x4c4c9e,{'encoding':_0x134e34(0x171)}),_0x4f646d=_0x4c4c9e;}catch{_0x253ef3=_0x450a66 instanceof Error?_0x450a66:new Error(String(_0x450a66));}else _0x253ef3=_0x450a66 instanceof Error?_0x450a66:new Error(String(_0x450a66));}if(_0x10d22b!==null){const _0x257eb4=_0x10d22b[_0x134e34(0x11c)](/\r?\n/),_0x50dca6=[_0x134e34(0x1d0)+_0xf08df3[_0x134e34(0x169)]+'\x22>'];if(_0xf08df3[_0x134e34(0x1e5)]==='*'||!Array[_0x134e34(0x177)](_0xf08df3[_0x134e34(0x1e5)]))for(let _0x201db7=0x1;_0x201db7<=_0x257eb4[_0x134e34(0x1e2)];_0x201db7++){const _0x1b34e0=_0x257eb4[_0x201db7-0x1];_0x50dca6[_0x134e34(0x11b)](_0x201db7+'|\x20'+_0x1b34e0);}else for(const [_0x198805,_0x34ed67]of _0xf08df3['lines']){_0x50dca6[_0x134e34(0x1e2)]>0x1&&_0x50dca6[_0x134e34(0x11b)]('');for(let _0x29d539=_0x198805;_0x29d539<=_0x34ed67&&_0x29d539<=_0x257eb4['length'];_0x29d539++){const _0x27133e=_0x257eb4[_0x29d539-0x1];_0x50dca6[_0x134e34(0x11b)](_0x29d539+'|\x20'+_0x27133e);}}_0x50dca6['push'](_0x134e34(0x1b7)),_0xcd6b84[_0x134e34(0x11b)](_0x50dca6[_0x134e34(0x10b)]('\x0a'));}else _0xcd6b84[_0x134e34(0x11b)](_0x134e34(0x1d0)+_0xf08df3[_0x134e34(0x169)]+_0x134e34(0x1e6)+(_0x253ef3?.[_0x134e34(0x145)]||_0x134e34(0x1fd))+_0x134e34(0x125));}_0x1640ab[_0x134e34(0x11b)](_0xcd6b84['join']('\x0a\x0a')),_0x3b1eed=_0x1640ab['join']('\x0a');const _0x596ace=_0x2d1dec[_0x134e34(0x1c0)]?.[_0x134e34(0x15c)](_0x5a70fb=>_0x5a70fb['message']?.[_0x134e34(0x11a)](_0x134e34(0x1aa)))||[];if(_0x596ace[_0x134e34(0x1e2)]>0x0){const _0x303e3e=_0x596ace[_0x134e34(0x132)](_0x313be1=>_0x313be1[_0x134e34(0x145)])['join'](';\x20');reportMorphError({'error_message':_0x303e3e,'error_type':_0x134e34(0x116),'context':{'tool':_0x134e34(0x162),'repo_path':_0x25a968[_0x134e34(0x19b)]['repo_path'],'query':_0x25a968[_0x134e34(0x19b)]['search_string'],'model':_0x134e34(0x12a),'termination_reason':_0x134e34(0x20f),'error_count':_0x596ace[_0x134e34(0x1e2)],'is_timeout':![],'timings':_0x2d1dec['timings'],'files_attempted':_0x3ad6b1['map'](_0x2e7525=>({'path':_0x2e7525[_0x134e34(0x169)],'lines':_0x2e7525[_0x134e34(0x1e5)]})),'tool_calls':_0x4e25fb(_0x2d1dec[_0x134e34(0x1f5)]),'messages':_0x2d1dec[_0x134e34(0x1f5)]?.['map'](_0xd7030c=>({'role':_0xd7030c[_0x134e34(0x1b4)],'content':_0xd7030c[_0x134e34(0x156)],..._0xd7030c[_0x134e34(0x1d1)]?{'tool_calls':_0xd7030c['tool_calls'][_0x134e34(0x1e2)]}:{},..._0xd7030c[_0x134e34(0x1b0)]?{'tool_call_id':_0xd7030c['tool_call_id']}:{}})),'request_content':{'query':_0x25a968[_0x134e34(0x19b)]['search_string'],'repo_path':_0x25a968['data']['repo_path'],'repoRoot':a0_0x2aa0dc['resolve'](_0x25a968[_0x134e34(0x19b)][_0x134e34(0x150)]),'model':_0x134e34(0x12a)}},'source':'mcp-filesystem'})[_0x134e34(0x1b3)](()=>{});}}else{if(_0x2d1dec[_0x134e34(0x198)]==='terminated'&&_0x2d1dec[_0x134e34(0x1c0)][_0x134e34(0x1e2)]>0x0){const _0x4f1aff=_0x2d1dec['errors']['map'](_0x442802=>_0x442802[_0x134e34(0x145)])[_0x134e34(0x10b)](';\x20');_0x3b1eed=_0x134e34(0x149)+_0x4f1aff;const _0x32ce0f=_0x4f1aff[_0x134e34(0x1bf)]()['includes'](_0x134e34(0x1f8))||_0x4f1aff[_0x134e34(0x1bf)]()[_0x134e34(0x14e)]('timed\x20out')||_0x4f1aff[_0x134e34(0x1bf)]()['includes']('etimedout'),_0xb9acc=_0x2d1dec[_0x134e34(0x1af)]?.['metadata']?.[_0x134e34(0x20a)],_0x303552=_0x2d1dec[_0x134e34(0x1c0)][0x0];reportMorphError({'error_message':_0x4f1aff,'error_type':_0x32ce0f?'TimeoutError':_0x303552?.['constructor']?.['name']||'WarpGrepError','context':{'tool':_0x134e34(0x162),'repo_path':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x150)],'query':_0x25a968['data']['search_string'],'model':_0x134e34(0x12a),'termination_reason':_0x2d1dec[_0x134e34(0x198)],'error_count':_0x2d1dec[_0x134e34(0x1c0)][_0x134e34(0x1e2)],'is_timeout':_0x32ce0f,'timings':_0x2d1dec[_0x134e34(0x1b5)],'files_attempted':_0xb9acc?.[_0x134e34(0x132)](_0x58ecb3=>({'path':_0x58ecb3[_0x134e34(0x169)],'lines':_0x58ecb3[_0x134e34(0x1e5)]})),'tool_calls':_0x4e25fb(_0x2d1dec[_0x134e34(0x1f5)]),'messages':_0x2d1dec[_0x134e34(0x1f5)]?.[_0x134e34(0x132)](_0x24f452=>({'role':_0x24f452[_0x134e34(0x1b4)],'content':_0x24f452[_0x134e34(0x156)],..._0x24f452[_0x134e34(0x1d1)]?{'tool_calls':_0x24f452['tool_calls'][_0x134e34(0x1e2)]}:{},..._0x24f452[_0x134e34(0x1b0)]?{'tool_call_id':_0x24f452['tool_call_id']}:{}})),'request_content':{'query':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x13e)],'repo_path':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x150)],'repoRoot':a0_0x2aa0dc['resolve'](_0x25a968['data'][_0x134e34(0x150)]),'model':_0x134e34(0x12a)}},'stack_trace':_0x303552?.[_0x134e34(0x176)]||undefined,'source':_0x134e34(0x1b1)})[_0x134e34(0x1b3)](()=>{});}else _0x3b1eed='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x134e34(0x100),'text':_0x3b1eed}]};}catch(_0x5eaeda){const _0x490798=_0x5eaeda instanceof Error?_0x5eaeda[_0x134e34(0x145)]:String(_0x5eaeda),_0x4c3040=_0x490798[_0x134e34(0x1bf)]()[_0x134e34(0x14e)]('timeout')||_0x490798[_0x134e34(0x1bf)]()[_0x134e34(0x14e)]('timed\x20out')||_0x490798['toLowerCase']()[_0x134e34(0x14e)]('etimedout')||_0x5eaeda instanceof Error&&_0x5eaeda[_0x134e34(0x17a)]===_0x134e34(0x109);return reportMorphError({'error_message':_0x490798,'error_type':_0x4c3040?_0x134e34(0x109):_0x5eaeda instanceof Error?_0x5eaeda[_0x134e34(0x1a1)][_0x134e34(0x17a)]:'UnknownError','context':{'tool':_0x134e34(0x162),'repo_path':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x150)],'query':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x13e)],'model':_0x134e34(0x12a),'is_timeout':_0x4c3040,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x25a968['data'][_0x134e34(0x13e)],'repo_path':_0x25a968[_0x134e34(0x19b)][_0x134e34(0x150)],'repoRoot':a0_0x2aa0dc[_0x134e34(0x208)](_0x25a968[_0x134e34(0x19b)][_0x134e34(0x150)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x5eaeda instanceof Error?_0x5eaeda[_0x134e34(0x176)]:undefined,'source':_0x134e34(0x1b1)})[_0x134e34(0x1b3)](()=>{}),{'content':[{'type':_0x134e34(0x100),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x490798}],'isError':![]};}}case _0x134e34(0x101):{const _0x477805=WarpGrepGitHubArgsSchema['safeParse'](_0x52f233);if(!_0x477805[_0x134e34(0x199)])return{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x1c2)+_0x477805[_0x134e34(0x138)]}],'isError':!![]};const _0x2ddb70=_0x477805['data'][_0x134e34(0x130)]||_0x477805[_0x134e34(0x19b)][_0x134e34(0x1e3)];if(!_0x2ddb70)return{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x195)}],'isError':!![]};const _0x2aaae2=MORPH_API_KEY;if(!_0x2aaae2)throw new Error(_0x134e34(0x19d));const _0x4c0cb7=Date['now']();logMcpStderr(_0x134e34(0x173)+_0x2ddb70+_0x134e34(0x185)+_0x477805['data'][_0x134e34(0x13e)]+'\x22');try{const _0x66cb09=new WarpGrepClient({'morphApiKey':_0x2aaae2,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x1f1949=await _0x66cb09[_0x134e34(0x1a2)]({'searchTerm':_0x477805[_0x134e34(0x19b)][_0x134e34(0x13e)],'github':_0x2ddb70,'branch':_0x477805[_0x134e34(0x19b)][_0x134e34(0x20b)]}),_0x4c3a21=Date[_0x134e34(0x210)]()-_0x4c0cb7;logMcpStderr(_0x134e34(0x1e1)+_0x4c3a21+_0x134e34(0x161)+_0x1f1949[_0x134e34(0x199)]);const _0x322a9c=formatResult(_0x1f1949);return{'content':[{'type':_0x134e34(0x100),'text':_0x322a9c}]};}catch(_0x2d3848){const _0x4d9d05=Date[_0x134e34(0x210)]()-_0x4c0cb7,_0x3233fd=_0x2d3848 instanceof Error?_0x2d3848['message']:String(_0x2d3848);return logMcpStderr(_0x134e34(0x182)+_0x4d9d05+_0x134e34(0x189),_0x3233fd),reportMorphError({'error_message':_0x3233fd,'error_type':_0x2d3848 instanceof Error?_0x2d3848[_0x134e34(0x1a1)][_0x134e34(0x17a)]:'UnknownError','context':{'tool':_0x134e34(0x101),'github_url':_0x2ddb70,'search_string':_0x477805[_0x134e34(0x19b)][_0x134e34(0x13e)],'branch':_0x477805['data'][_0x134e34(0x20b)]},'stack_trace':_0x2d3848 instanceof Error?_0x2d3848[_0x134e34(0x176)]:undefined,'source':_0x134e34(0x1b1),'tool':'github_codebase_search','latency_ms':_0x4d9d05})[_0x134e34(0x1b3)](()=>{}),{'content':[{'type':_0x134e34(0x100),'text':'GitHub\x20search\x20failed:\x20'+_0x3233fd}],'isError':![]};}}default:throw new Error(_0x134e34(0x142)+_0x1b834b);}}catch(_0x207e10){const _0x7b14ec=_0x207e10 instanceof Error?_0x207e10[_0x134e34(0x145)]:String(_0x207e10);return reportMorphError({'error_message':_0x7b14ec,'error_type':_0x207e10 instanceof Error?_0x207e10[_0x134e34(0x1a1)][_0x134e34(0x17a)]:_0x134e34(0x18b),'context':{'tool':_0x1b834b,'arguments':_0x52f233?JSON[_0x134e34(0x19a)](_0x52f233)[_0x134e34(0x1d4)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x207e10 instanceof Error?_0x207e10[_0x134e34(0x176)]:undefined,'source':_0x134e34(0x1b1)})['catch'](()=>{}),{'content':[{'type':_0x134e34(0x100),'text':_0x134e34(0x149)+_0x7b14ec}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2725f8){const _0x38a2f3=a0_0x99da29,_0x54ffcd=await getValidRootDirectories(_0x2725f8);if(_0x54ffcd[_0x38a2f3(0x1e2)]>0x0)allowedDirectories=[..._0x54ffcd],logMcpStderr(_0x38a2f3(0x18c)+_0x54ffcd[_0x38a2f3(0x1e2)]+_0x38a2f3(0x112));else{logMcpStderr(_0x38a2f3(0x207));if(ENABLE_WORKSPACE_MODE)try{const _0x125f9a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x125f9a&&(allowedDirectories=[_0x125f9a],logMcpStderr(_0x38a2f3(0x10e)+_0x125f9a));}catch(_0x13ed21){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x13ed21);}}}server[a0_0x99da29(0x1be)](RootsListChangedNotificationSchema,async()=>{const _0x4439b9=a0_0x99da29;try{const _0x1b30d4=await server[_0x4439b9(0x10c)]();_0x1b30d4&&_0x4439b9(0x1e9)in _0x1b30d4&&await updateAllowedDirectoriesFromRoots(_0x1b30d4['roots']);}catch(_0xa1b2f9){logMcpStderr(_0x4439b9(0x1f2),_0xa1b2f9 instanceof Error?_0xa1b2f9[_0x4439b9(0x145)]:String(_0xa1b2f9));}}),server[a0_0x99da29(0x179)]=async()=>{const _0x475a9c=a0_0x99da29,_0x62e3db=server[_0x475a9c(0x147)]();if(_0x62e3db?.[_0x475a9c(0x1e9)])try{const _0x1678c0=await server[_0x475a9c(0x10c)]();_0x1678c0&&_0x475a9c(0x1e9)in _0x1678c0?await updateAllowedDirectoriesFromRoots(_0x1678c0[_0x475a9c(0x1e9)]):logMcpStderr(_0x475a9c(0x1b6));}catch(_0x1b8615){logMcpStderr(_0x475a9c(0x17b),_0x1b8615 instanceof Error?_0x1b8615[_0x475a9c(0x145)]:String(_0x1b8615));}else{if(allowedDirectories[_0x475a9c(0x1e2)]>0x0)logMcpStderr(_0x475a9c(0x209),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x475a9c(0x20d));}}};async function runServer(){const _0x546454=a0_0x99da29,_0x3a267e=new StdioServerTransport();await server[_0x546454(0x135)](_0x3a267e),logMcpStderr(_0x546454(0x123)),allowedDirectories[_0x546454(0x1e2)]===0x0&&logMcpStderr(_0x546454(0x1bb));}runServer()[a0_0x99da29(0x1b3)](_0x1e0b50=>{const _0x19b1a3=a0_0x99da29;logMcpStderr(_0x19b1a3(0x108),_0x1e0b50),process['exit'](0x1);});
|
|
2
|
+
const a0_0x5f59de=a0_0x888c;(function(_0x443375,_0x45777a){const _0x54e325=a0_0x888c,_0x2ff9ae=_0x443375();while(!![]){try{const _0x187edb=parseInt(_0x54e325(0x276))/0x1+parseInt(_0x54e325(0x1db))/0x2*(-parseInt(_0x54e325(0x24d))/0x3)+-parseInt(_0x54e325(0x224))/0x4*(parseInt(_0x54e325(0x2c8))/0x5)+parseInt(_0x54e325(0x25c))/0x6+-parseInt(_0x54e325(0x1f9))/0x7+-parseInt(_0x54e325(0x239))/0x8*(parseInt(_0x54e325(0x260))/0x9)+parseInt(_0x54e325(0x2b2))/0xa;if(_0x187edb===_0x45777a)break;else _0x2ff9ae['push'](_0x2ff9ae['shift']());}catch(_0x30e928){_0x2ff9ae['push'](_0x2ff9ae['shift']());}}}(a0_0x33a9,0xd12c0));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_0xf525bc from'fs/promises';import a0_0xfcf33 from'path';import a0_0x4bb44b 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_0xb3c996 from'axios';function fixPathRepetition(_0x58769f){const _0x3c47c0=a0_0x888c,_0x5bdbae=_0x58769f[_0x3c47c0(0x273)](a0_0xfcf33[_0x3c47c0(0x297)])[_0x3c47c0(0x1b8)](Boolean);if(_0x5bdbae[_0x3c47c0(0x242)]<0x2)return null;for(let _0x416380=Math[_0x3c47c0(0x1f4)](_0x5bdbae['length']/0x2);_0x416380>=0x1;_0x416380--){for(let _0x3d4d35=0x0;_0x3d4d35<=_0x5bdbae[_0x3c47c0(0x242)]-0x2*_0x416380;_0x3d4d35++){const _0x109e8c=_0x5bdbae[_0x3c47c0(0x2c5)](_0x3d4d35,_0x3d4d35+_0x416380),_0x43a9b3=_0x5bdbae[_0x3c47c0(0x2c5)](_0x3d4d35+_0x416380,_0x3d4d35+0x2*_0x416380);if(_0x109e8c[_0x3c47c0(0x23e)]((_0x1b3833,_0x5c745b)=>_0x1b3833===_0x43a9b3[_0x5c745b])){const _0x2055d3=[..._0x5bdbae[_0x3c47c0(0x2c5)](0x0,_0x3d4d35),..._0x5bdbae[_0x3c47c0(0x2c5)](_0x3d4d35+_0x416380)];return a0_0xfcf33[_0x3c47c0(0x297)]+_0x2055d3[_0x3c47c0(0x1d3)](a0_0xfcf33[_0x3c47c0(0x297)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4303f1=a0_0x888c;try{const _0x4a6b19=require('../package.json');return _0x4a6b19[_0x4303f1(0x22b)]??_0x4303f1(0x26e);}catch(_0x37a3b4){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x37a3b4),_0x4303f1(0x26e);}}function printHelp(){const _0x5be90c=a0_0x888c;console[_0x5be90c(0x201)](_0x5be90c(0x2a4)+getPackageVersion()),console['log']('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x5be90c(0x201)](_0x5be90c(0x1ce)),console[_0x5be90c(0x201)](_0x5be90c(0x277)),console[_0x5be90c(0x201)](_0x5be90c(0x27f)),console['log'](_0x5be90c(0x248)),console[_0x5be90c(0x201)](_0x5be90c(0x282)),console['log']('\x20\x20morph-mcp'),console[_0x5be90c(0x201)](_0x5be90c(0x219));}const cliArgs=process['argv'][a0_0x5f59de(0x2c5)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x5f59de(0x213),'-h']);cliArgs[a0_0x5f59de(0x1c7)](_0x831a4f=>VERSION_FLAGS['has'](_0x831a4f))&&(console['log'](a0_0x5f59de(0x2a4)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x5f59de(0x1c7)](_0x5c74fb=>HELP_FLAGS[a0_0x5f59de(0x2a7)](_0x5c74fb))&&(printHelp(),process[a0_0x5f59de(0x25a)](0x0));function getCliArg(_0x3c48e5){const _0x26bddd=a0_0x5f59de;for(let _0x1381dd=0x0;_0x1381dd<cliArgs[_0x26bddd(0x242)];_0x1381dd++){const _0xe63ec4=cliArgs[_0x1381dd];if(_0xe63ec4[_0x26bddd(0x29a)]('--'+_0x3c48e5+'='))return _0xe63ec4[_0x26bddd(0x2c5)](('--'+_0x3c48e5+'=')['length']);if(_0xe63ec4==='--'+_0x3c48e5&&_0x1381dd+0x1<cliArgs[_0x26bddd(0x242)])return cliArgs[_0x1381dd+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5f59de(0x242)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x5f59de(0x2a7)](arg)||HELP_FLAGS[a0_0x5f59de(0x2a7)](arg))continue;if(arg[a0_0x5f59de(0x29a)]('--api-key='))continue;if(arg===a0_0x5f59de(0x296)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x28e)]||process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x1f6)]||process[a0_0x5f59de(0x267)](),ENABLE_WORKSPACE_MODE=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x235)]!==a0_0x5f59de(0x1d9),MORPH_API_KEY=getCliArg(a0_0x5f59de(0x211))??process['env'][a0_0x5f59de(0x1ba)],MORPH_API_URL=process['env'][a0_0x5f59de(0x24b)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x262)]?parseInt(process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x262)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x5f59de(0x299),a0_0x5f59de(0x250),a0_0x5f59de(0x1d6)]),DISABLED_TOOLS=process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x1d1)]?new Set(process[a0_0x5f59de(0x28a)][a0_0x5f59de(0x1d1)][a0_0x5f59de(0x273)](',')['map'](_0x2281e9=>_0x2281e9[a0_0x5f59de(0x1ff)]())[a0_0x5f59de(0x1b8)](_0x5ef55b=>_0x5ef55b[a0_0x5f59de(0x242)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x5f59de(0x24e)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x5f59de(0x264)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x5f59de(0x1df)+[...KNOWN_TOOL_NAMES][a0_0x5f59de(0x1d3)](',\x20'));}console['error'](a0_0x5f59de(0x216)+[...DISABLED_TOOLS][a0_0x5f59de(0x1d3)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x5f59de(0x2b3))&&!MORPH_API_KEY[a0_0x5f59de(0x29a)](a0_0x5f59de(0x1d8))&&logMcpStderr(a0_0x5f59de(0x2b4));async function reportMorphError(_0x554e6d){const _0xfc5a34=a0_0x5f59de;try{await a0_0xb3c996[_0xfc5a34(0x28f)](_0xfc5a34(0x1e2),{..._0x554e6d,'timestamp':new Date()[_0xfc5a34(0x1e0)](),'source':_0x554e6d[_0xfc5a34(0x291)]||_0xfc5a34(0x24f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x554e6d[_0xfc5a34(0x20f)]}},{'timeout':0x1388,'headers':{'Content-Type':_0xfc5a34(0x278),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5f59de(0x1d0)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x5f59de(0x236)),logMcpStderr(a0_0x5f59de(0x298)),logMcpStderr(a0_0x5f59de(0x253)),logMcpStderr(a0_0x5f59de(0x271)));function normalizePath(_0x4ddcbb){const _0x367c79=a0_0x5f59de;return a0_0xfcf33[_0x367c79(0x233)](_0x4ddcbb);}function expandHome(_0x2b8bc2){const _0x9d6643=a0_0x5f59de;if(_0x2b8bc2[_0x9d6643(0x29a)]('~/')||_0x2b8bc2==='~')return a0_0xfcf33[_0x9d6643(0x1d3)](a0_0x4bb44b[_0x9d6643(0x1b3)](),_0x2b8bc2[_0x9d6643(0x2c5)](0x1));return _0x2b8bc2;}let allowedDirectories=await Promise[a0_0x5f59de(0x2af)](args['map'](async _0x587fbc=>{const _0x8144b3=a0_0x5f59de,_0x1d1986=expandHome(_0x587fbc),_0x13120d=a0_0xfcf33[_0x8144b3(0x1cd)](_0x1d1986);try{const _0x5e6ab5=await a0_0xf525bc[_0x8144b3(0x2a2)](_0x13120d);return normalizePath(_0x5e6ab5);}catch(_0x27bff6){return normalizePath(_0x13120d);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x5f59de(0x202)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x3fe7c6){logMcpStderr(a0_0x5f59de(0x1b5)+a0_0x3fe7c6);}function a0_0x33a9(){const _0x35afd3=['--help','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.','BinaryFile','Disabled\x20tools:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x27\x20in\x20`','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','oninitialized','Failed\x20to\x20request\x20roots\x20from\x20client:','Tool\x20','added\x20','Error\x20accessing\x20directory\x20','role','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','function','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','48TiDMUb','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Rules:\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','changes','access','map','version','-\x20Glob\x20search\x20`','array','-\x20Grepped\x20\x27','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','path','constructor','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','normalize','-\x20Listed\x20directory\x20`','ENABLE_WORKSPACE_MODE','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','grep_search','glob','6152936sJbcvg','Specific\x20commit\x20hash\x20to\x20search','[github_codebase_search]\x20Failed\x20in\x20','repo_path','name','every','requiresApiKey','files','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','length','Unknown\x20tool:\x20','package.json','Invalid\x20arguments:\x20','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','dirname','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','success','catch','MORPH_API_URL','ms:','15UmLxag','size','mcp-filesystem','codebase_search','assistant','RipgrepNotAvailable','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','roots','command','includes','linesRemoved','</file>','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','exit','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','6551838LAhUfD',',\x20modified\x20','text','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','9fFeZzx','pattern','MORPH_WARP_GREP_TIMEOUT','tsconfig.json','error','<file\x20path=\x22','search_type','cwd','WarpGrepError','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','min','TimeoutError','search_string','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','unknown','safeParse','FileNotFound','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','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','split','user','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','1085760iKUsoh','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','application/json','utf-8','timeout','Max\x20results\x20to\x20return','lines','completed_with_file_errors','parse','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','stringify','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x0aExamples:','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','setRequestHandler','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','[github_codebase_search]\x20Done\x20in\x20','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','object','morph-v3-fast','env','node_modules','[could\x20not\x20read\x20file:\x20','readFile','WORKSPACE_ROOT','post','metadata','source','basename','ENOENT','morph-warp-grep-v2.1','Morph\x20Edit\x20Preview','--api-key','sep','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','edit_file','startsWith','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Relevant\x20context\x20found:','boolean','isDirectory','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','data','tool','realpath','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','@morphllm/morphmcp\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x0a...\x20(truncated,\x20total:\x20','has','timed\x20out','instruction','content','Applied','Fallback:\x20Using\x20workspace\x20root\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','FileReadError','all','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','0.2.0','15974200crOwvH','sk-','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','code','linesModified','dryRun','unknown\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.','list_directory\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','listRoots','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','code_edit','GitHub\x20search\x20failed:\x20','default','UnknownError','pyproject.toml','etimedout','errors','slice','Unknown\x20error','Fatal\x20error\x20running\x20server:','16145rXdfCS','read','\x22>\x0aError\x20reading\x20file:\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','homedir','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','filter','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','MORPH_API_KEY','optional','grep\x20\x27','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','glob\x20\x27','Parent\x20directory\x20does\x20not\x20exist:\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','.\x20Path:\x20','ms.\x20Success:\x20','\x20chars)','go.mod','read\x20','SubToolError','some','\x20(new\x20file)','runWarpGrep_call','tool_calls','toLowerCase','Morph\x20Edit\x20','resolve','\x0aOptions:','-\x20Read\x20file\x20`','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','DISABLED_TOOLS','isArray','join','payload','Warning:\x20Workspace\x20fallback\x20failed:\x20','github_codebase_search','`\x20in\x20`','morph-','false','grep','673078ueZqwS','match','ToolException','Warning:\x20','\x22.\x20Known\x20tools:\x20','toISOString','terminationReason','https://morphllm.com/api/error-report','WarpGrep\x20sub-tool\x20errors:\x20','messages','branch','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','ReadError','Error:\x20','github_url','searchGitHub','.\x20Changes:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','[github_codebase_search]\x20Searching\x20','string','arguments','message','morph-mcp','tool_call_id','enum','floor','list_directory','PWD','finish','owner_repo','2994775jZpcam','now','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','stat','description','stack','trim','describe','log','push','Repository\x20identifier','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Created\x20File','.git','substring','connect','params','File\x20read\x20error:','Tool\x20\x22','completionId','timings','\x20valid\x20directories','context','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','api-key','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'];a0_0x33a9=function(){return _0x35afd3;};return a0_0x33a9();}async function detectWorkspaceRoot(_0x422fef){const _0x27692b=a0_0x5f59de;let _0x385bf7=a0_0xfcf33[_0x27692b(0x1cd)](_0x422fef);const _0x2ad0e9=[_0x27692b(0x206),'.vscode',_0x27692b(0x244),'Cargo.toml',_0x27692b(0x2c2),_0x27692b(0x1c4),'.cursor',_0x27692b(0x263),'composer.json'];while(_0x385bf7!==a0_0xfcf33['dirname'](_0x385bf7)){for(const _0x549e57 of _0x2ad0e9){const _0x363e91=a0_0xfcf33[_0x27692b(0x1d3)](_0x385bf7,_0x549e57);try{return await a0_0xf525bc[_0x27692b(0x229)](_0x363e91),normalizePath(_0x385bf7);}catch{}}_0x385bf7=a0_0xfcf33['dirname'](_0x385bf7);}return normalizePath(_0x422fef);}await Promise['all'](args[a0_0x5f59de(0x22a)](async _0xccdc33=>{const _0x2377c7=a0_0x5f59de;try{const _0x1f3840=await a0_0xf525bc[_0x2377c7(0x1fc)](expandHome(_0xccdc33));!_0x1f3840[_0x2377c7(0x29e)]()&&(logMcpStderr(_0x2377c7(0x1e8)+_0xccdc33+'\x20is\x20not\x20a\x20directory'),process[_0x2377c7(0x25a)](0x1));}catch(_0x3699d2){logMcpStderr(_0x2377c7(0x21f)+_0xccdc33+':',_0x3699d2),process['exit'](0x1);}}));async function validatePath(_0x522c7b){const _0x1db53e=a0_0x5f59de,_0x34d5a2=expandHome(_0x522c7b),_0x2bb8a2=a0_0xfcf33[_0x1db53e(0x1cd)](_0x34d5a2);try{const _0x5faa69=await a0_0xf525bc[_0x1db53e(0x2a2)](_0x2bb8a2);return _0x5faa69;}catch(_0x568ded){if(_0x568ded[_0x1db53e(0x2b5)]===_0x1db53e(0x293)){const _0x2eb23a=a0_0xfcf33[_0x1db53e(0x247)](_0x2bb8a2);try{const _0x345e6a=await a0_0xf525bc['realpath'](_0x2eb23a);return a0_0xfcf33['join'](_0x345e6a,a0_0xfcf33[_0x1db53e(0x292)](_0x2bb8a2));}catch{throw new Error(_0x1db53e(0x1bf)+_0x2eb23a);}}throw _0x568ded;}}const MorphEditFileArgsSchema=z[a0_0x5f59de(0x288)]({'path':z[a0_0x5f59de(0x1ee)](),'code_edit':z['string']()[a0_0x5f59de(0x200)](a0_0x5f59de(0x2bd)),'instruction':z[a0_0x5f59de(0x1ee)]()['describe']('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0x5f59de(0x29d)]()['default'](![])[a0_0x5f59de(0x200)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5f59de(0x2b9),WarpGrepArgsSchema=z[a0_0x5f59de(0x288)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x5f59de(0x1ee)]()['describe'](a0_0x5f59de(0x275)),'search_type':z[a0_0x5f59de(0x1f3)]([a0_0x5f59de(0x2c0),a0_0x5f59de(0x28b)])[a0_0x5f59de(0x1bb)]()[a0_0x5f59de(0x200)](a0_0x5f59de(0x225))}),WarpGrepGitHubArgsSchema=z[a0_0x5f59de(0x288)]({'search_string':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x200)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x5f59de(0x1bb)]()[a0_0x5f59de(0x200)](a0_0x5f59de(0x214)),'owner_repo':z[a0_0x5f59de(0x1ee)]()['optional']()[a0_0x5f59de(0x200)](a0_0x5f59de(0x2a5)),'branch':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x1bb)]()['describe'](a0_0x5f59de(0x204))}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x5f59de(0x200)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x200)](a0_0x5f59de(0x203)),'branch':z[a0_0x5f59de(0x1ee)]()[a0_0x5f59de(0x1bb)]()['describe'](a0_0x5f59de(0x29f)),'commitHash':z[a0_0x5f59de(0x1ee)]()['optional']()[a0_0x5f59de(0x200)](a0_0x5f59de(0x23a)),'targetDirectories':z[a0_0x5f59de(0x22d)](z['string']())['default']([])[a0_0x5f59de(0x200)](a0_0x5f59de(0x287)),'limit':z['number']()['optional']()['default'](0xa)[a0_0x5f59de(0x200)](a0_0x5f59de(0x27b))}),server=new Server({'name':a0_0x5f59de(0x1f1),'version':a0_0x5f59de(0x2b1)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x5ca4d1=a0_0x5f59de,_0x99479b=[{'name':_0x5ca4d1(0x299),'description':_0x5ca4d1(0x232)+_0x5ca4d1(0x21a)+_0x5ca4d1(0x2bb)+_0x5ca4d1(0x26d)+'Benefits:\x0a'+_0x5ca4d1(0x25b)+_0x5ca4d1(0x227)+_0x5ca4d1(0x1fb)+_0x5ca4d1(0x1b6)+_0x5ca4d1(0x29b)+_0x5ca4d1(0x1b9)+_0x5ca4d1(0x241)+'For\x20deletions:\x0a'+_0x5ca4d1(0x223)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x5ca4d1(0x226)+_0x5ca4d1(0x259)+_0x5ca4d1(0x1b7)+_0x5ca4d1(0x269)+_0x5ca4d1(0x221)+_0x5ca4d1(0x2b0)+_0x5ca4d1(0x1b4)+_0x5ca4d1(0x272),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x5ca4d1(0x250),'description':_0x5ca4d1(0x25f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x5ca4d1(0x283)+_0x5ca4d1(0x212)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x17aa86=_0x99479b[_0x5ca4d1(0x1b8)](_0x348b79=>{const _0x1afaa9=_0x5ca4d1;if(DISABLED_TOOLS[_0x1afaa9(0x2a7)](_0x348b79['name']))return console['error'](_0x1afaa9(0x21d)+_0x348b79[_0x1afaa9(0x23d)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x1afaa9(0x23f)in _0x348b79&&_0x348b79['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x1afaa9(0x1de)+_0x348b79['name']+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x17aa86[_0x5ca4d1(0x22a)](_0x3b3bcd=>({'name':_0x3b3bcd[_0x5ca4d1(0x23d)],'description':_0x3b3bcd[_0x5ca4d1(0x1fd)],'inputSchema':_0x3b3bcd['inputSchema']}))};}),server[a0_0x5f59de(0x284)](CallToolRequestSchema,async _0x1bee5e=>{const _0x1f2901=a0_0x5f59de,{name:_0x59c8cf,arguments:_0x97636a}=_0x1bee5e[_0x1f2901(0x209)];try{if(DISABLED_TOOLS[_0x1f2901(0x2a7)](_0x59c8cf))throw new Error(_0x1f2901(0x20b)+_0x59c8cf+_0x1f2901(0x2a3));switch(_0x59c8cf){case _0x1f2901(0x299):{const _0xc89203=MorphEditFileArgsSchema[_0x1f2901(0x26f)](_0x97636a);if(!_0xc89203[_0x1f2901(0x249)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0xc89203[_0x1f2901(0x264)]);const _0x513055=await validatePath(_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x230)]);let _0x5fd354=null,_0x6357c6=!![],_0x4dd398=null;try{_0x5fd354=await a0_0xf525bc[_0x1f2901(0x28d)](_0x513055,_0x1f2901(0x279));}catch(_0x575550){const _0x163b20=_0x575550['code'];_0x163b20===_0x1f2901(0x293)?(_0x6357c6=![],_0x5fd354=''):(_0x4dd398='Failed\x20to\x20read\x20file:\x20'+(_0x163b20||'unknown')+'\x20-\x20'+(_0x575550 instanceof Error?_0x575550[_0x1f2901(0x1f0)]:String(_0x575550)),logMcpStderr(_0x1f2901(0x1de)+_0x4dd398));}let _0x428977;try{const _0x442434=MORPH_API_KEY;if(!_0x442434)throw new Error(_0x1f2901(0x1bd));const _0x3a5fef=a0_0xfcf33[_0x1f2901(0x247)](_0x513055),_0x160222=a0_0xfcf33[_0x1f2901(0x292)](_0x513055),_0x2fe272=await executeEditFile({'target_filepath':_0x160222,'code_edit':_0xc89203[_0x1f2901(0x2a0)]['code_edit'],'instructions':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2a9)]},{'morphApiKey':_0x442434,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3a5fef,'autoWrite':!_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2b7)],'generateUdiff':![],'debug':![]});_0x428977=_0x2fe272[_0x1f2901(0x20c)];if(!_0x2fe272['success'])throw new Error(_0x2fe272['error']||_0x1f2901(0x1c0));const _0x28c1ce=_0x2fe272[_0x1f2901(0x228)],_0x2e3761=_0x1f2901(0x21e)+_0x28c1ce['linesAdded']+',\x20removed\x20'+_0x28c1ce[_0x1f2901(0x257)]+_0x1f2901(0x25d)+_0x28c1ce[_0x1f2901(0x2b6)];if(_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2b7)])return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x295)+(_0x6357c6?'':_0x1f2901(0x1c8))+':\x20'+_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2a9)]+_0x1f2901(0x1eb)+_0x2e3761+_0x1f2901(0x1c1)+_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x230)]+'.'}]};return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x1cc)+(_0x6357c6?_0x1f2901(0x2ab):_0x1f2901(0x205))+':\x20'+_0xc89203['data'][_0x1f2901(0x2a9)]+_0x1f2901(0x1eb)+_0x2e3761+'.\x20Path:\x20'+_0xc89203[_0x1f2901(0x2a0)]['path']+'.'}]};}catch(_0x1e75fa){const _0x10ab4b=_0x1e75fa instanceof Error?_0x1e75fa[_0x1f2901(0x1f0)]:String(_0x1e75fa);return reportMorphError({'error_message':_0x10ab4b,'error_type':_0x1e75fa instanceof Error?_0x1e75fa['constructor'][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':'edit_file','completion_id':_0x428977,'file_path':_0xc89203[_0x1f2901(0x2a0)]['path'],'validated_path':_0x513055,'instruction':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2a9)],'model':_0x1f2901(0x289),'dry_run':_0xc89203[_0x1f2901(0x2a0)]['dryRun'],'file_exists':_0x6357c6,'file_read_error':_0x4dd398,'file_readable':_0x5fd354!==null,'request_content':{'path':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x230)],'code_edit':_0xc89203['data'][_0x1f2901(0x2be)],'instruction':_0xc89203['data'][_0x1f2901(0x2a9)],'original_code':_0x5fd354!==null?_0x5fd354[_0x1f2901(0x242)]>0xc350?_0x5fd354[_0x1f2901(0x207)](0x0,0xc350)+_0x1f2901(0x2a6)+_0x5fd354['length']+_0x1f2901(0x1c3):_0x5fd354:_0x1f2901(0x28c)+(_0x4dd398||_0x1f2901(0x2b8))+']','original_code_length':_0x5fd354?.['length']??0x0,'model':_0x1f2901(0x289),'dry_run':_0xc89203[_0x1f2901(0x2a0)][_0x1f2901(0x2b7)]}},'stack_trace':_0x1e75fa instanceof Error?_0x1e75fa['stack']:undefined,'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x10ab4b}],'isError':!![]};}}case'codebase_search':{const _0x153c86=WarpGrepArgsSchema[_0x1f2901(0x26f)](_0x97636a);if(!_0x153c86[_0x1f2901(0x249)])return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x245)+_0x153c86[_0x1f2901(0x264)]}],'isError':!![]};const _0x3af8a7=_0x20af8d=>{const _0x300468=_0x1f2901,_0x50b6fa=[];for(const _0x542c24 of _0x20af8d||[]){if(_0x542c24[_0x300468(0x220)]==='assistant'&&Array[_0x300468(0x1d2)](_0x542c24[_0x300468(0x1ca)]))for(const _0x2d0b61 of _0x542c24[_0x300468(0x1ca)]){try{const _0x15288a=_0x2d0b61['function']?.[_0x300468(0x23d)],_0x3e469f=JSON[_0x300468(0x27e)](_0x2d0b61['function']?.[_0x300468(0x1ef)]||'{}');if(_0x15288a==='grep_search')_0x50b6fa['push'](_0x300468(0x1bc)+_0x3e469f[_0x300468(0x261)]+'\x27\x20'+(_0x3e469f[_0x300468(0x230)]||'.'));else{if(_0x15288a===_0x300468(0x2c9))_0x50b6fa[_0x300468(0x202)](_0x300468(0x1c5)+_0x3e469f[_0x300468(0x230)]);else{if(_0x15288a===_0x300468(0x1f5))_0x50b6fa[_0x300468(0x202)](_0x300468(0x2ba)+(_0x3e469f[_0x300468(0x255)]||'.'));else{if(_0x15288a===_0x300468(0x238))_0x50b6fa['push'](_0x300468(0x1be)+_0x3e469f[_0x300468(0x261)]+'\x27\x20'+(_0x3e469f[_0x300468(0x230)]||'.'));else _0x15288a===_0x300468(0x1f7)&&_0x50b6fa[_0x300468(0x202)]('finish');}}}}catch{}}}return _0x50b6fa;},_0x19b0ba=_0xe50d64=>{const _0x170a10=_0x1f2901,_0x41abd6=[];if(!_0xe50d64||!Array['isArray'](_0xe50d64))return _0x41abd6;const _0x20148c=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x170a10(0x270),'tool':_0x170a10(0x2c9)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x170a10(0x2c9)},{'pattern':/\[READ ERROR\]/,'error_type':_0x170a10(0x1e7),'tool':_0x170a10(0x2c9)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x170a10(0x2c9)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x170a10(0x1da)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x170a10(0x252),'tool':_0x170a10(0x1da)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x170a10(0x215),'tool':_0x170a10(0x2c9)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x170a10(0x2c9)},{'pattern':/not a text file/,'error_type':_0x170a10(0x215),'tool':_0x170a10(0x2c9)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x170a10(0x2c9)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x170a10(0x2c9)},{'pattern':/status="error"/,'error_type':_0x170a10(0x1dd),'tool':_0x170a10(0x26e)}];let _0x23f0ec=0x0;for(const _0x58bba8 of _0xe50d64){_0x58bba8[_0x170a10(0x220)]===_0x170a10(0x251)&&Array[_0x170a10(0x1d2)](_0x58bba8[_0x170a10(0x1ca)])&&_0x23f0ec++;const _0x26f807=_0x58bba8[_0x170a10(0x2aa)];if((_0x58bba8[_0x170a10(0x220)]===_0x170a10(0x2a1)||_0x58bba8[_0x170a10(0x220)]===_0x170a10(0x274))&&_0x26f807&&typeof _0x26f807===_0x170a10(0x1ee))for(const {pattern:_0x26fc49,error_type:_0x393c0d,tool:_0x392eeb}of _0x20148c){const _0x5b8735=_0x26f807[_0x170a10(0x1dc)](new RegExp(_0x26fc49['source'],'g'));if(_0x5b8735)for(const _0x3b28d7 of _0x5b8735){const _0xa14b47=_0x26f807['indexOf'](_0x3b28d7),_0x6f998f=_0x26f807[_0x170a10(0x207)](_0xa14b47,Math[_0x170a10(0x26a)](_0xa14b47+0xc8,_0x26f807['length']));_0x41abd6['push']({'tool':_0x392eeb,'error_type':_0x393c0d,'error_message':_0x6f998f[_0x170a10(0x273)]('\x0a')[0x0],'turn':_0x23f0ec});}}}return _0x41abd6;};try{const _0x258399=a0_0xfcf33['resolve'](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)]),_0x50850e=_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x266)],_0x456725=_0x50850e===_0x1f2901(0x28b)?{'allowNames':[_0x1f2901(0x28b)]}:undefined,_0x5f02e9=new LocalRipgrepProvider(_0x258399,undefined,_0x456725),_0x33400e=await runWarpGrep({'searchTerm':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'repoRoot':_0x258399,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x5f02e9,'search_type':_0x50850e}),_0x4b2b8e=_0x19b0ba(_0x33400e[_0x1f2901(0x1e4)]);_0x4b2b8e[_0x1f2901(0x242)]>0x0&&reportMorphError({'error_message':_0x1f2901(0x1e3)+_0x4b2b8e[_0x1f2901(0x242)]+'\x20error(s)','error_type':_0x1f2901(0x1c6),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)]['search_string'],'model':_0x1f2901(0x294),'termination_reason':_0x33400e[_0x1f2901(0x1e1)],'sub_tool_errors':_0x4b2b8e,'timings':_0x33400e[_0x1f2901(0x20d)],'tool_calls':_0x3af8a7(_0x33400e[_0x1f2901(0x1e4)]),'messages':_0x33400e['messages']?.[_0x1f2901(0x22a)](_0x562f56=>({'role':_0x562f56[_0x1f2901(0x220)],'content':_0x562f56['content'],..._0x562f56[_0x1f2901(0x1ca)]?{'tool_calls':_0x562f56[_0x1f2901(0x1ca)][_0x1f2901(0x242)]}:{},..._0x562f56[_0x1f2901(0x1f2)]?{'tool_call_id':_0x562f56[_0x1f2901(0x1f2)]}:{}}))},'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{});let _0x5a7765='';if(_0x33400e[_0x1f2901(0x1e1)]==='completed'&&_0x33400e[_0x1f2901(0x1f7)]?.['metadata']?.[_0x1f2901(0x240)]){const _0x8bd088=_0x33400e[_0x1f2901(0x1f7)][_0x1f2901(0x290)]['files'];if(_0x8bd088['length']===0x0)return _0x5a7765=_0x33400e[_0x1f2901(0x1f7)][_0x1f2901(0x1d4)]||_0x1f2901(0x246),{'content':[{'type':_0x1f2901(0x25e),'text':_0x5a7765}]};const _0x3ce8f7=[],_0x316c0b=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x1890ec of _0x33400e[_0x1f2901(0x1e4)]){if(_0x1890ec[_0x1f2901(0x220)]===_0x1f2901(0x251)&&Array[_0x1f2901(0x1d2)](_0x1890ec[_0x1f2901(0x1ca)]))for(const _0x3a2d3b of _0x1890ec['tool_calls']){try{const _0x530f10=_0x3a2d3b['function']?.[_0x1f2901(0x23d)],_0x265cba=JSON[_0x1f2901(0x27e)](_0x3a2d3b[_0x1f2901(0x222)]?.[_0x1f2901(0x1ef)]||'{}');if(_0x530f10===_0x1f2901(0x237))_0x316c0b['push'](_0x1f2901(0x22e)+_0x265cba[_0x1f2901(0x261)]+_0x1f2901(0x218)+(_0x265cba[_0x1f2901(0x230)]||'.')+'`');else{if(_0x530f10===_0x1f2901(0x2c9))_0x316c0b['push'](_0x1f2901(0x1cf)+_0x265cba[_0x1f2901(0x230)]+'`');else{if(_0x530f10===_0x1f2901(0x1f5))_0x316c0b[_0x1f2901(0x202)](_0x1f2901(0x234)+(_0x265cba[_0x1f2901(0x255)]||'.')+'`');else _0x530f10===_0x1f2901(0x238)&&_0x316c0b[_0x1f2901(0x202)](_0x1f2901(0x22c)+_0x265cba[_0x1f2901(0x261)]+_0x1f2901(0x1d7)+(_0x265cba[_0x1f2901(0x230)]||'.')+'`');}}}catch{}}}_0x3ce8f7[_0x1f2901(0x202)](_0x316c0b['join']('\x0a'));const _0x1dc409=['',_0x1f2901(0x29c)];for(const _0x102dc8 of _0x8bd088){if(_0x102dc8[_0x1f2901(0x27c)]==='*')_0x1dc409['push']('-\x20'+_0x102dc8[_0x1f2901(0x230)]+':*');else{if(Array['isArray'](_0x102dc8['lines'])){const _0xeb223f=_0x102dc8[_0x1f2901(0x27c)][_0x1f2901(0x22a)](([_0x2b38e5,_0x1d4c1f])=>{if(_0x2b38e5===_0x1d4c1f)return''+_0x2b38e5;return _0x2b38e5+'-'+_0x1d4c1f;});_0x1dc409[_0x1f2901(0x202)]('-\x20'+_0x102dc8[_0x1f2901(0x230)]+':'+_0xeb223f['join'](','));}else _0x1dc409[_0x1f2901(0x202)]('-\x20'+_0x102dc8[_0x1f2901(0x230)]+':*');}}_0x1dc409[_0x1f2901(0x202)](''),_0x3ce8f7['push'](_0x1dc409[_0x1f2901(0x1d3)]('\x0a')),_0x3ce8f7[_0x1f2901(0x202)](_0x1f2901(0x1ec));const _0x514992=[];for(const _0x4b9d4b of _0x8bd088){let _0x107eee=a0_0xfcf33['resolve'](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],_0x4b9d4b[_0x1f2901(0x230)]),_0x1356f6=null,_0x3e0fbc=null;try{_0x1356f6=await a0_0xf525bc['readFile'](_0x107eee,{'encoding':_0x1f2901(0x279)});}catch(_0x5652e3){const _0x490e5d=fixPathRepetition(_0x107eee);if(_0x490e5d)try{_0x1356f6=await a0_0xf525bc[_0x1f2901(0x28d)](_0x490e5d,{'encoding':_0x1f2901(0x279)}),_0x107eee=_0x490e5d;}catch{_0x3e0fbc=_0x5652e3 instanceof Error?_0x5652e3:new Error(String(_0x5652e3));}else _0x3e0fbc=_0x5652e3 instanceof Error?_0x5652e3:new Error(String(_0x5652e3));}if(_0x1356f6!==null){const _0x43f6b1=_0x1356f6[_0x1f2901(0x273)](/\r?\n/),_0x1ea301=['<file\x20path=\x22'+_0x4b9d4b['path']+'\x22>'];if(_0x4b9d4b['lines']==='*'||!Array[_0x1f2901(0x1d2)](_0x4b9d4b[_0x1f2901(0x27c)]))for(let _0x47e5c8=0x1;_0x47e5c8<=_0x43f6b1[_0x1f2901(0x242)];_0x47e5c8++){const _0x2ce11d=_0x43f6b1[_0x47e5c8-0x1];_0x1ea301[_0x1f2901(0x202)](_0x47e5c8+'|\x20'+_0x2ce11d);}else for(const [_0x28e708,_0x1cbe76]of _0x4b9d4b['lines']){_0x1ea301[_0x1f2901(0x242)]>0x1&&_0x1ea301['push']('');for(let _0x246091=_0x28e708;_0x246091<=_0x1cbe76&&_0x246091<=_0x43f6b1[_0x1f2901(0x242)];_0x246091++){const _0x7a2f28=_0x43f6b1[_0x246091-0x1];_0x1ea301['push'](_0x246091+'|\x20'+_0x7a2f28);}}_0x1ea301[_0x1f2901(0x202)](_0x1f2901(0x258)),_0x514992[_0x1f2901(0x202)](_0x1ea301[_0x1f2901(0x1d3)]('\x0a'));}else _0x514992['push'](_0x1f2901(0x265)+_0x4b9d4b[_0x1f2901(0x230)]+_0x1f2901(0x2ca)+(_0x3e0fbc?.[_0x1f2901(0x1f0)]||_0x1f2901(0x2c6))+'\x0a</file>');}_0x3ce8f7['push'](_0x514992[_0x1f2901(0x1d3)]('\x0a\x0a')),_0x5a7765=_0x3ce8f7['join']('\x0a');const _0x577b4a=_0x33400e['errors']?.[_0x1f2901(0x1b8)](_0x4b2342=>_0x4b2342[_0x1f2901(0x1f0)]?.[_0x1f2901(0x29a)](_0x1f2901(0x20a)))||[];if(_0x577b4a[_0x1f2901(0x242)]>0x0){const _0x2619de=_0x577b4a[_0x1f2901(0x22a)](_0xd5f8fa=>_0xd5f8fa[_0x1f2901(0x1f0)])['join'](';\x20');reportMorphError({'error_message':_0x2619de,'error_type':_0x1f2901(0x2ae),'context':{'tool':'codebase_search','repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'model':_0x1f2901(0x294),'termination_reason':_0x1f2901(0x27d),'error_count':_0x577b4a[_0x1f2901(0x242)],'is_timeout':![],'timings':_0x33400e[_0x1f2901(0x20d)],'files_attempted':_0x8bd088[_0x1f2901(0x22a)](_0x4ce2e2=>({'path':_0x4ce2e2[_0x1f2901(0x230)],'lines':_0x4ce2e2['lines']})),'tool_calls':_0x3af8a7(_0x33400e[_0x1f2901(0x1e4)]),'messages':_0x33400e[_0x1f2901(0x1e4)]?.[_0x1f2901(0x22a)](_0x19812a=>({'role':_0x19812a[_0x1f2901(0x220)],'content':_0x19812a[_0x1f2901(0x2aa)],..._0x19812a[_0x1f2901(0x1ca)]?{'tool_calls':_0x19812a[_0x1f2901(0x1ca)][_0x1f2901(0x242)]}:{},..._0x19812a[_0x1f2901(0x1f2)]?{'tool_call_id':_0x19812a[_0x1f2901(0x1f2)]}:{}})),'request_content':{'query':_0x153c86['data'][_0x1f2901(0x26c)],'repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'repoRoot':a0_0xfcf33[_0x1f2901(0x1cd)](_0x153c86[_0x1f2901(0x2a0)]['repo_path']),'model':_0x1f2901(0x294)}},'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{});}}else{if(_0x33400e[_0x1f2901(0x1e1)]==='terminated'&&_0x33400e['errors'][_0x1f2901(0x242)]>0x0){const _0x4b1692=_0x33400e[_0x1f2901(0x2c4)][_0x1f2901(0x22a)](_0x6d07d7=>_0x6d07d7['message'])[_0x1f2901(0x1d3)](';\x20');_0x5a7765='Error:\x20'+_0x4b1692;const _0x1ab5a8=_0x4b1692['toLowerCase']()[_0x1f2901(0x256)](_0x1f2901(0x27a))||_0x4b1692[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)](_0x1f2901(0x2a8))||_0x4b1692[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)](_0x1f2901(0x2c3)),_0x22b148=_0x33400e[_0x1f2901(0x1f7)]?.[_0x1f2901(0x290)]?.[_0x1f2901(0x240)],_0x408640=_0x33400e['errors'][0x0];reportMorphError({'error_message':_0x4b1692,'error_type':_0x1ab5a8?_0x1f2901(0x26b):_0x408640?.[_0x1f2901(0x231)]?.[_0x1f2901(0x23d)]||_0x1f2901(0x268),'context':{'tool':_0x1f2901(0x250),'repo_path':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'model':_0x1f2901(0x294),'termination_reason':_0x33400e[_0x1f2901(0x1e1)],'error_count':_0x33400e[_0x1f2901(0x2c4)][_0x1f2901(0x242)],'is_timeout':_0x1ab5a8,'timings':_0x33400e['timings'],'files_attempted':_0x22b148?.[_0x1f2901(0x22a)](_0xe17e8c=>({'path':_0xe17e8c[_0x1f2901(0x230)],'lines':_0xe17e8c[_0x1f2901(0x27c)]})),'tool_calls':_0x3af8a7(_0x33400e[_0x1f2901(0x1e4)]),'messages':_0x33400e['messages']?.[_0x1f2901(0x22a)](_0x240453=>({'role':_0x240453['role'],'content':_0x240453['content'],..._0x240453[_0x1f2901(0x1ca)]?{'tool_calls':_0x240453[_0x1f2901(0x1ca)][_0x1f2901(0x242)]}:{},..._0x240453['tool_call_id']?{'tool_call_id':_0x240453[_0x1f2901(0x1f2)]}:{}})),'request_content':{'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'repo_path':_0x153c86[_0x1f2901(0x2a0)]['repo_path'],'repoRoot':a0_0xfcf33['resolve'](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)]),'model':_0x1f2901(0x294)}},'stack_trace':_0x408640?.[_0x1f2901(0x1fe)]||undefined,'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{});}else _0x5a7765=_0x1f2901(0x22f);}return{'content':[{'type':_0x1f2901(0x25e),'text':_0x5a7765}]};}catch(_0x1be035){const _0x5148ce=_0x1be035 instanceof Error?_0x1be035[_0x1f2901(0x1f0)]:String(_0x1be035),_0xe0fa7=_0x5148ce[_0x1f2901(0x1cb)]()['includes'](_0x1f2901(0x27a))||_0x5148ce[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)]('timed\x20out')||_0x5148ce[_0x1f2901(0x1cb)]()[_0x1f2901(0x256)]('etimedout')||_0x1be035 instanceof Error&&_0x1be035[_0x1f2901(0x23d)]==='TimeoutError';return reportMorphError({'error_message':_0x5148ce,'error_type':_0xe0fa7?'TimeoutError':_0x1be035 instanceof Error?_0x1be035[_0x1f2901(0x231)][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':'codebase_search','repo_path':_0x153c86['data'][_0x1f2901(0x23c)],'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'model':_0x1f2901(0x294),'is_timeout':_0xe0fa7,'exception_phase':_0x1f2901(0x1c9),'request_content':{'query':_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'repo_path':_0x153c86['data']['repo_path'],'repoRoot':a0_0xfcf33[_0x1f2901(0x1cd)](_0x153c86[_0x1f2901(0x2a0)][_0x1f2901(0x23c)]),'model':_0x1f2901(0x294)}},'stack_trace':_0x1be035 instanceof Error?_0x1be035[_0x1f2901(0x1fe)]:undefined,'source':_0x1f2901(0x24f)})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x5148ce}],'isError':![]};}}case _0x1f2901(0x1d6):{const _0x4dfeb2=WarpGrepGitHubArgsSchema[_0x1f2901(0x26f)](_0x97636a);if(!_0x4dfeb2[_0x1f2901(0x249)])return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x245)+_0x4dfeb2['error']}],'isError':!![]};const _0x512878=_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1e9)]||_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1f8)];if(!_0x512878)return{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x281)}],'isError':!![]};const _0x3287eb=MORPH_API_KEY;if(!_0x3287eb)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x1b6530=Date['now']();logMcpStderr(_0x1f2901(0x1ed)+_0x512878+'\x20for:\x20\x22'+_0x4dfeb2[_0x1f2901(0x2a0)]['search_string']+'\x22');try{const _0x4fc41a=new WarpGrepClient({'morphApiKey':_0x3287eb,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x44d559=await _0x4fc41a[_0x1f2901(0x1ea)]({'searchTerm':_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x26c)],'github':_0x512878,'branch':_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1e5)]}),_0x1947f1=Date[_0x1f2901(0x1fa)]()-_0x1b6530;logMcpStderr(_0x1f2901(0x286)+_0x1947f1+_0x1f2901(0x1c2)+_0x44d559[_0x1f2901(0x249)]);const _0x3f6f42=formatResult(_0x44d559);return{'content':[{'type':_0x1f2901(0x25e),'text':_0x3f6f42}]};}catch(_0x2486ff){const _0x318507=Date[_0x1f2901(0x1fa)]()-_0x1b6530,_0x118a64=_0x2486ff instanceof Error?_0x2486ff[_0x1f2901(0x1f0)]:String(_0x2486ff);return logMcpStderr(_0x1f2901(0x23b)+_0x318507+_0x1f2901(0x24c),_0x118a64),reportMorphError({'error_message':_0x118a64,'error_type':_0x2486ff instanceof Error?_0x2486ff[_0x1f2901(0x231)][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':_0x1f2901(0x1d6),'github_url':_0x512878,'search_string':_0x4dfeb2['data'][_0x1f2901(0x26c)],'branch':_0x4dfeb2[_0x1f2901(0x2a0)][_0x1f2901(0x1e5)]},'stack_trace':_0x2486ff instanceof Error?_0x2486ff[_0x1f2901(0x1fe)]:undefined,'source':'mcp-filesystem','tool':_0x1f2901(0x1d6),'latency_ms':_0x318507})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x2bf)+_0x118a64}],'isError':![]};}}default:throw new Error(_0x1f2901(0x243)+_0x59c8cf);}}catch(_0x1a505e){const _0x1de5c7=_0x1a505e instanceof Error?_0x1a505e['message']:String(_0x1a505e);return reportMorphError({'error_message':_0x1de5c7,'error_type':_0x1a505e instanceof Error?_0x1a505e[_0x1f2901(0x231)][_0x1f2901(0x23d)]:_0x1f2901(0x2c1),'context':{'tool':_0x59c8cf,'arguments':_0x97636a?JSON[_0x1f2901(0x280)](_0x97636a)[_0x1f2901(0x207)](0x0,0x1f4):undefined,'mcp_server_version':_0x1f2901(0x2b1)},'stack_trace':_0x1a505e instanceof Error?_0x1a505e[_0x1f2901(0x1fe)]:undefined,'source':'mcp-filesystem'})[_0x1f2901(0x24a)](()=>{}),{'content':[{'type':_0x1f2901(0x25e),'text':_0x1f2901(0x1e8)+_0x1de5c7}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5ddfa4){const _0x491f7c=a0_0x5f59de,_0x17bf1e=await getValidRootDirectories(_0x5ddfa4);if(_0x17bf1e['length']>0x0)allowedDirectories=[..._0x17bf1e],logMcpStderr(_0x491f7c(0x210)+_0x17bf1e[_0x491f7c(0x242)]+_0x491f7c(0x20e));else{logMcpStderr(_0x491f7c(0x2cb));if(ENABLE_WORKSPACE_MODE)try{const _0x4e056d=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4e056d&&(allowedDirectories=[_0x4e056d],logMcpStderr(_0x491f7c(0x2ac)+_0x4e056d));}catch(_0x455aa1){logMcpStderr(_0x491f7c(0x1d5)+_0x455aa1);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x4b10d8=a0_0x5f59de;try{const _0x12281d=await server[_0x4b10d8(0x2bc)]();_0x12281d&&_0x4b10d8(0x254)in _0x12281d&&await updateAllowedDirectoriesFromRoots(_0x12281d['roots']);}catch(_0x4ed3f5){logMcpStderr(_0x4b10d8(0x21c),_0x4ed3f5 instanceof Error?_0x4ed3f5['message']:String(_0x4ed3f5));}}),server[a0_0x5f59de(0x21b)]=async()=>{const _0x21a11b=a0_0x5f59de,_0x54a30c=server['getClientCapabilities']();if(_0x54a30c?.['roots'])try{const _0x431a09=await server[_0x21a11b(0x2bc)]();_0x431a09&&_0x21a11b(0x254)in _0x431a09?await updateAllowedDirectoriesFromRoots(_0x431a09[_0x21a11b(0x254)]):logMcpStderr(_0x21a11b(0x285));}catch(_0x43a74d){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x43a74d instanceof Error?_0x43a74d[_0x21a11b(0x1f0)]:String(_0x43a74d));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x21a11b(0x2ad),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};async function runServer(){const _0x155682=a0_0x5f59de,_0x5eaa39=new StdioServerTransport();await server[_0x155682(0x208)](_0x5eaa39),logMcpStderr(_0x155682(0x217)),allowedDirectories[_0x155682(0x242)]===0x0&&logMcpStderr(_0x155682(0x1e6));}function a0_0x888c(_0x2211f0,_0x9443c1){_0x2211f0=_0x2211f0-0x1b3;const _0x33a961=a0_0x33a9();let _0x888c82=_0x33a961[_0x2211f0];return _0x888c82;}runServer()[a0_0x5f59de(0x24a)](_0x291447=>{const _0xe90716=a0_0x5f59de;logMcpStderr(_0xe90716(0x2c7),_0x291447),process[_0xe90716(0x25a)](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var a1_0x2d9731=a1_0x8e4a;(function(_0x32b949,_0x42a102){var _0x3f48b3=a1_0x8e4a,_0x3d40cd=_0x32b949();while(!![]){try{var _0x409063=parseInt(_0x3f48b3(0x128))/0x1*(-parseInt(_0x3f48b3(0x120))/0x2)+-parseInt(_0x3f48b3(0x129))/0x3+parseInt(_0x3f48b3(0x127))/0x4*(parseInt(_0x3f48b3(0x123))/0x5)+parseInt(_0x3f48b3(0x124))/0x6+parseInt(_0x3f48b3(0x11f))/0x7+parseInt(_0x3f48b3(0x125))/0x8+-parseInt(_0x3f48b3(0x122))/0x9;if(_0x409063===_0x42a102)break;else _0x3d40cd['push'](_0x3d40cd['shift']());}catch(_0x5b845f){_0x3d40cd['push'](_0x3d40cd['shift']());}}}(a1_0x1f52,0x3a420));import a1_0x57072c from'os';function a1_0x1f52(){var _0x496b38=['564584QaIZUV','[os=','28Aoaerr','8101nJzgXf','74811zwLPct','platform','win32','error','linux','darwin','Windows','1489614aDodHD','2cArehp','macOS','6980643DfnvQW','272035quQKML','2298390sfLccW'];a1_0x1f52=function(){return _0x496b38;};return a1_0x1f52();}export function getOperatingSystemType(_0x8e5965=a1_0x57072c[a1_0x2d9731(0x12a)]()){var _0x508383=a1_0x2d9731;switch(_0x8e5965){case _0x508383(0x11d):return _0x508383(0x121);case _0x508383(0x12b):return _0x508383(0x11e);case _0x508383(0x11c):return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0x49c5fb,_0x366a17=a1_0x57072c['platform']()){var _0x5dccc4=a1_0x2d9731;return _0x5dccc4(0x126)+getOperatingSystemType(_0x366a17)+']\x20'+_0x49c5fb;}function a1_0x8e4a(_0xaccaa5,_0x248465){_0xaccaa5=_0xaccaa5-0x11b;var _0x1f528d=a1_0x1f52();var _0x8e4af3=_0x1f528d[_0xaccaa5];return _0x8e4af3;}export function logMcpStderr(_0x1a365e,..._0x1eca94){var _0x254910=a1_0x2d9731;console[_0x254910(0x11b)](formatMcpLogMessage(_0x1a365e),..._0x1eca94);}
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a2_0x2659(){const _0x283a3f=['join','1264606riBzqA','charAt','8194194jYZwUy','normalize','/mnt/','356497JrNBZa','4528230zqneNC','266568UjerAc','startsWith','5176cKNpPG','match','trim','105SnRHjb','602740OMpaJP','2619hoAlsI','replace','slice','homedir','3MRyyqY','253gstkmd'];a2_0x2659=function(){return _0x283a3f;};return a2_0x2659();}(function(_0x3a40e5,_0x36db5f){const _0x34c6fc=a2_0xcf9c,_0x5e29eb=_0x3a40e5();while(!![]){try{const _0x2e13bc=-parseInt(_0x34c6fc(0xa5))/0x1+parseInt(_0x34c6fc(0xa0))/0x2*(parseInt(_0x34c6fc(0x9d))/0x3)+-parseInt(_0x34c6fc(0xa7))/0x4*(-parseInt(_0x34c6fc(0xac))/0x5)+-parseInt(_0x34c6fc(0xa2))/0x6+-parseInt(_0x34c6fc(0xa6))/0x7+-parseInt(_0x34c6fc(0xa9))/0x8*(parseInt(_0x34c6fc(0xae))/0x9)+parseInt(_0x34c6fc(0xad))/0xa*(parseInt(_0x34c6fc(0x9e))/0xb);if(_0x2e13bc===_0x36db5f)break;else _0x5e29eb['push'](_0x5e29eb['shift']());}catch(_0x432d4e){_0x5e29eb['push'](_0x5e29eb['shift']());}}}(a2_0x2659,0xd2234));import a2_0xd925cc from'path';import a2_0x3ed0c0 from'os';export function convertToWindowsPath(_0x48046d){const _0x262126=a2_0xcf9c;if(_0x48046d[_0x262126(0xa8)](_0x262126(0xa4))){const _0x561846=_0x48046d[_0x262126(0xa1)](0x5)['toUpperCase'](),_0x33208f=_0x48046d[_0x262126(0x9b)](0x6)['replace'](/\//g,'\x5c');return _0x561846+':'+_0x33208f;}if(_0x48046d[_0x262126(0xaa)](/^\/[a-zA-Z]\//)){const _0x2f810b=_0x48046d[_0x262126(0xa1)](0x1)['toUpperCase'](),_0x374b12=_0x48046d[_0x262126(0x9b)](0x2)[_0x262126(0xaf)](/\//g,'\x5c');return _0x2f810b+':'+_0x374b12;}if(_0x48046d[_0x262126(0xaa)](/^[a-zA-Z]:/))return _0x48046d[_0x262126(0xaf)](/\//g,'\x5c');return _0x48046d;}function a2_0xcf9c(_0x132105,_0x1d8306){_0x132105=_0x132105-0x9b;const _0x2659ec=a2_0x2659();let _0xcf9ce=_0x2659ec[_0x132105];return _0xcf9ce;}export function normalizePath(_0x329b00){const _0x5523e9=a2_0xcf9c;_0x329b00=_0x329b00[_0x5523e9(0xab)]()[_0x5523e9(0xaf)](/^["']|["']$/g,'');const _0x2aa9bd=_0x329b00['startsWith']('/')&&!_0x329b00['match'](/^\/mnt\/[a-z]\//i)&&!_0x329b00[_0x5523e9(0xaa)](/^\/[a-zA-Z]\//);if(_0x2aa9bd)return _0x329b00[_0x5523e9(0xaf)](/\/+/g,'/')['replace'](/\/+$/,'');_0x329b00=convertToWindowsPath(_0x329b00);if(_0x329b00[_0x5523e9(0xa8)]('\x5c\x5c')){let _0x23c5a7=_0x329b00;_0x23c5a7=_0x23c5a7[_0x5523e9(0xaf)](/^\\{2,}/,'\x5c\x5c');const _0x30fc3d=_0x23c5a7['substring'](0x2)[_0x5523e9(0xaf)](/\\\\/g,'\x5c');_0x329b00='\x5c\x5c'+_0x30fc3d;}else _0x329b00=_0x329b00[_0x5523e9(0xaf)](/\\\\/g,'\x5c');let _0x3b8aba=a2_0xd925cc[_0x5523e9(0xa3)](_0x329b00);_0x329b00[_0x5523e9(0xa8)]('\x5c\x5c')&&!_0x3b8aba[_0x5523e9(0xa8)]('\x5c\x5c')&&(_0x3b8aba='\x5c'+_0x3b8aba);if(_0x3b8aba[_0x5523e9(0xaa)](/^[a-zA-Z]:/)){let _0x579b3e=_0x3b8aba[_0x5523e9(0xaf)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x579b3e)&&(_0x579b3e=_0x579b3e[_0x5523e9(0xa1)](0x0)['toUpperCase']()+_0x579b3e[_0x5523e9(0x9b)](0x1)),_0x579b3e;}return _0x3b8aba[_0x5523e9(0xaf)](/\//g,'\x5c');}export function expandHome(_0x2bb352){const _0x215321=a2_0xcf9c;if(_0x2bb352[_0x215321(0xa8)]('~/')||_0x2bb352==='~')return a2_0xd925cc[_0x215321(0x9f)](a2_0x3ed0c0[_0x215321(0x9c)](),_0x2bb352[_0x215321(0x9b)](0x1));return _0x2bb352;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2122c2,_0x5a3e70){const _0x5e9e25=a3_0x1aa6,_0x2d438a=_0x2122c2();while(!![]){try{const _0x4d6eb1=parseInt(_0x5e9e25(0x97))/0x1*(parseInt(_0x5e9e25(0x9c))/0x2)+parseInt(_0x5e9e25(0x8f))/0x3*(-parseInt(_0x5e9e25(0x9b))/0x4)+parseInt(_0x5e9e25(0x95))/0x5+parseInt(_0x5e9e25(0x93))/0x6+-parseInt(_0x5e9e25(0x90))/0x7+-parseInt(_0x5e9e25(0x8b))/0x8+-parseInt(_0x5e9e25(0x92))/0x9*(parseInt(_0x5e9e25(0x99))/0xa);if(_0x4d6eb1===_0x5a3e70)break;else _0x2d438a['push'](_0x2d438a['shift']());}catch(_0x183685){_0x2d438a['push'](_0x2d438a['shift']());}}}(a3_0x2326,0x62764));import a3_0x1ccfb3 from'path';function a3_0x1aa6(_0x2c4a1b,_0x386ca4){_0x2c4a1b=_0x2c4a1b-0x89;const _0x23260d=a3_0x2326();let _0x1aa606=_0x23260d[_0x2c4a1b];return _0x1aa606;}export function isPathWithinAllowedDirectories(_0x4f8085,_0xdc1ac9){const _0x1a25ed=a3_0x1aa6;if(typeof _0x4f8085!=='string'||!Array['isArray'](_0xdc1ac9))return![];if(!_0x4f8085||_0xdc1ac9['length']===0x0)return![];if(_0x4f8085['includes']('\x00'))return![];let _0x9e7f8;try{_0x9e7f8=a3_0x1ccfb3['resolve'](a3_0x1ccfb3['normalize'](_0x4f8085));}catch{return![];}if(!a3_0x1ccfb3[_0x1a25ed(0x8c)](_0x9e7f8))throw new Error(_0x1a25ed(0x91));return _0xdc1ac9[_0x1a25ed(0x8e)](_0x241e62=>{const _0x26a3c6=_0x1a25ed;if(typeof _0x241e62!==_0x26a3c6(0x8a)||!_0x241e62)return![];if(_0x241e62[_0x26a3c6(0x89)]('\x00'))return![];let _0x2f8997;try{_0x2f8997=a3_0x1ccfb3[_0x26a3c6(0x9a)](a3_0x1ccfb3[_0x26a3c6(0x98)](_0x241e62));}catch{return![];}if(!a3_0x1ccfb3[_0x26a3c6(0x8c)](_0x2f8997))throw new Error(_0x26a3c6(0x94));if(_0x9e7f8===_0x2f8997)return!![];if(_0x2f8997===a3_0x1ccfb3[_0x26a3c6(0x96)])return _0x9e7f8[_0x26a3c6(0x8d)](a3_0x1ccfb3['sep']);return _0x9e7f8[_0x26a3c6(0x8d)](_0x2f8997+a3_0x1ccfb3[_0x26a3c6(0x96)]);});}function a3_0x2326(){const _0x3b3704=['4hQOGxu','1576522trKkOG','includes','string','3018280JQPtKY','isAbsolute','startsWith','some','1933644ioDjBp','2593885rWEfVh','Path\x20must\x20be\x20absolute\x20after\x20normalization','78984YnTQeI','3228330kEEbJM','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','3180580WQOgMz','sep','1HdIOdP','normalize','190FhbgEw','resolve'];a3_0x2326=function(){return _0x3b3704;};return a3_0x2326();}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x283ce2,_0x3391ef){const _0x54e668=a4_0x5e5f,_0x5d3e8a=_0x283ce2();while(!![]){try{const _0x2a3299=parseInt(_0x54e668(0x106))/0x1*(-parseInt(_0x54e668(0xf4))/0x2)+parseInt(_0x54e668(0xfb))/0x3*(-parseInt(_0x54e668(0xf8))/0x4)+parseInt(_0x54e668(0xf0))/0x5*(parseInt(_0x54e668(0xf1))/0x6)+-parseInt(_0x54e668(0xf6))/0x7*(-parseInt(_0x54e668(0x100))/0x8)+parseInt(_0x54e668(0xff))/0x9+parseInt(_0x54e668(0x107))/0xa*(-parseInt(_0x54e668(0xfa))/0xb)+parseInt(_0x54e668(0x104))/0xc;if(_0x2a3299===_0x3391ef)break;else _0x5d3e8a['push'](_0x5d3e8a['shift']());}catch(_0x33aea8){_0x5d3e8a['push'](_0x5d3e8a['shift']());}}}(a4_0x5a84,0x47775));import{promises as a4_0x44068c}from'fs';import a4_0x5c779f from'path';import a4_0x2141b2 from'os';function a4_0x5a84(){const _0x9a772b=['invalid\x20path\x20or\x20inaccessible','34354YgcJfY','1510780YQaBph','7680NZzUtz','954TtHLxq','isDirectory','non-directory\x20root','34FtEwCc','join','2375261nHEYlQ','\x20due\x20to\x20error:\x20','870772NBFqzV','slice','22zxCJAM','6ddVNfR','message','uri','file://','2599524yxmrul','8ABeZFN','startsWith','realpath','stat','8902824FnZwpu'];a4_0x5a84=function(){return _0x9a772b;};return a4_0x5a84();}function a4_0x5e5f(_0x5aabfa,_0x43c563){_0x5aabfa=_0x5aabfa-0xf0;const _0x5a8404=a4_0x5a84();let _0x5e5fd6=_0x5a8404[_0x5aabfa];return _0x5e5fd6;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x3924af){const _0x334428=a4_0x5e5f;try{const _0x3c936f=_0x3924af[_0x334428(0x101)](_0x334428(0xfe))?_0x3924af[_0x334428(0xf9)](0x7):_0x3924af,_0x3a0dd1=_0x3c936f[_0x334428(0x101)]('~/')||_0x3c936f==='~'?a4_0x5c779f[_0x334428(0xf5)](a4_0x2141b2['homedir'](),_0x3c936f[_0x334428(0xf9)](0x1)):_0x3c936f,_0x264bb2=a4_0x5c779f['resolve'](_0x3a0dd1),_0x1d45db=await a4_0x44068c[_0x334428(0x102)](_0x264bb2);return normalizePath(_0x1d45db);}catch{return null;}}function formatDirectoryError(_0x36dc34,_0x4f4375,_0x414d40){const _0x3c38fe=a4_0x5e5f;if(_0x414d40)return'Skipping\x20'+_0x414d40+':\x20'+_0x36dc34;const _0x34c783=_0x4f4375 instanceof Error?_0x4f4375[_0x3c38fe(0xfc)]:String(_0x4f4375);return'Skipping\x20invalid\x20directory:\x20'+_0x36dc34+_0x3c38fe(0xf7)+_0x34c783;}export async function getValidRootDirectories(_0x5afe93){const _0x15ef28=a4_0x5e5f,_0x512519=[];for(const _0x54b4b4 of _0x5afe93){const _0x298a77=await parseRootUri(_0x54b4b4['uri']);if(!_0x298a77){logMcpStderr(formatDirectoryError(_0x54b4b4[_0x15ef28(0xfd)],undefined,_0x15ef28(0x105)));continue;}try{const _0x4576d8=await a4_0x44068c[_0x15ef28(0x103)](_0x298a77);_0x4576d8[_0x15ef28(0xf2)]()?_0x512519['push'](_0x298a77):logMcpStderr(formatDirectoryError(_0x298a77,undefined,_0x15ef28(0xf3)));}catch(_0x3ec46e){logMcpStderr(formatDirectoryError(_0x298a77,_0x3ec46e));}}return _0x512519;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.143",
|
|
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.148",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|