@morphllm/morphmcp 0.8.144 → 0.8.145
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_0x4261fe=a0_0x1d2d;function a0_0x6a63(){const _0x389217=['Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','has','Tool\x20\x22','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.','Morph\x20Edit\x20Preview','PathError','.vscode','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.','[github_codebase_search]\x20Searching\x20','code','etimedout','ENABLE_WORKSPACE_MODE','--api-key=','stringify','requiresApiKey','branch','\x20for:\x20\x22','--api-key','RipgrepNotAvailable','user','arguments','runWarpGrep_call','read\x20','list_directory','github_url','[could\x20not\x20read\x20file:\x20','sep','inputSchema','morph-v3-fast','0.2.0','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.','boolean','ReadError','code_edit','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Tool\x20','\x0aOptions:','warn','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','enum','morph-warp-grep-v2.1','description','Workspace\x20mode\x20enabled:\x20Using\x20','match','dirname','\x0a</file>','resolve','Cargo.toml','../package.json','data','Preview\x20changes\x20without\x20applying\x20them.','toISOString','timings','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','\x20as\x20allowed\x20directory','env','[github_codebase_search]\x20Failed\x20in\x20','FileNotFound','role','grep','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','\x20(new\x20file)','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.',',\x20removed\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Fatal\x20error\x20running\x20server:','name','trim','context','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','array','false','stat','4bHHkTG','@morphllm/morphmcp\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','Repository\x20identifier','<file\x20path=\x22','8204024evlTko','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','completed','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','realpath','Rules:\x0a','WarpGrep\x20sub-tool\x20errors:\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','isArray','connect','glob\x20\x27','lines','node_modules','Parent\x20directory\x20does\x20not\x20exist:\x20','Relevant\x20context\x20found:','Max\x20results\x20to\x20return','tool_call_id','listRoots','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x22>\x0aError\x20reading\x20file:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Bearer\x20','ToolException','finish','string','post','exit','search_type','owner_repo','changes','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','terminated','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Created\x20File','BinaryFile','searchGitHub','531984oXMTIM','some','stack','tool','dryRun','every','timeout','parse','codebase_search','split','MORPH_WARP_GREP_TIMEOUT','linesModified','SubToolError','\x20is\x20not\x20a\x20directory','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','push','files','mcp-filesystem','roots','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','errors','default','Unknown\x20error','\x0a...\x20(truncated,\x20total:\x20','package.json','Morph\x20Edit\x20','\x20\x20morph-mcp','text','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','optional','version','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','ms:','payload','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','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','join','catch','log','\x27\x20in\x20`','terminationReason','100SnEHjT','content','-\x20Glob\x20search\x20`','DISABLED_TOOLS','UnknownError','github_codebase_search','readFile','\x20disabled\x20via\x20DISABLED_TOOLS','success','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','completed_with_file_errors','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Error\x20accessing\x20directory\x20','metadata','utf-8','size','515226TosXKD','sk-','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','glob','message','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','homedir','api-key','Warning:\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','isDirectory','now','tool_calls','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','PWD','linesAdded','application/json','instruction','getClientCapabilities','`\x20in\x20`','Failed\x20to\x20request\x20roots\x20from\x20client:','setRequestHandler','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','assistant','substring','Warning:\x20Workspace\x20fallback\x20failed:\x20','For\x20deletions:\x0a','timed\x20out','slice','error','oninitialized','edit_file','all','constructor','--help','Error:\x20','function','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','messages','path','search_string','number','-\x20Read\x20file\x20`','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','TimeoutError','toLowerCase','repo_path','describe','pattern','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','-\x20Grepped\x20\x27','1193463mUHcMX','setNotificationHandler','Invalid\x20arguments:\x20','Failed\x20to\x20read\x20file:\x20','Benefits:\x0a','safeParse','WORKSPACE_ROOT','Disabled\x20tools:\x20','.\x20Changes:\x20','grep_search','tsconfig.json','--version','command','ENOENT','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','object','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27',',\x20modified\x20','Specific\x20commit\x20hash\x20to\x20search','includes','startsWith','length','argv','unknown','map','filter','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','composer.json','2456865EnnVLq','morph-mcp','SymlinkError','read','indexOf','7DdByPs','[github_codebase_search]\x20Done\x20in\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','RipgrepError','4234335aXynsp','WarpGrepError','Error\x20running\x20fast\x20context\x20search:\x20','.\x20Path:\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20error(s)','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','min','go.mod','265212kSzdOi'];a0_0x6a63=function(){return _0x389217;};return a0_0x6a63();}(function(_0x3ad9c0,_0xba8f7e){const _0x4f7327=a0_0x1d2d,_0x3112b7=_0x3ad9c0();while(!![]){try{const _0x46e907=-parseInt(_0x4f7327(0x261))/0x1+-parseInt(_0x4f7327(0x29b))/0x2+parseInt(_0x4f7327(0x1d7))/0x3+-parseInt(_0x4f7327(0x237))/0x4*(-parseInt(_0x4f7327(0x1e0))/0x5)+-parseInt(_0x4f7327(0x1ea))/0x6+-parseInt(_0x4f7327(0x1dc))/0x7*(-parseInt(_0x4f7327(0x23c))/0x8)+-parseInt(_0x4f7327(0x1ba))/0x9*(parseInt(_0x4f7327(0x28b))/0xa);if(_0x46e907===_0xba8f7e)break;else _0x3112b7['push'](_0x3112b7['shift']());}catch(_0x183926){_0x3112b7['push'](_0x3112b7['shift']());}}}(a0_0x6a63,0x81c00));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_0x2e9590 from'fs/promises';import a0_0x299f38 from'path';import a0_0x569f82 from'os';import{createRequire}from'module';function a0_0x1d2d(_0x40c8f8,_0x4e568c){_0x40c8f8=_0x40c8f8-0x1b7;const _0x6a63fb=a0_0x6a63();let _0x1d2d34=_0x6a63fb[_0x40c8f8];return _0x1d2d34;}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_0x2a9174 from'axios';function fixPathRepetition(_0x548774){const _0x1ae6ee=a0_0x1d2d,_0x3ac962=_0x548774[_0x1ae6ee(0x26a)](a0_0x299f38[_0x1ae6ee(0x206)])[_0x1ae6ee(0x1d4)](Boolean);if(_0x3ac962[_0x1ae6ee(0x1d0)]<0x2)return null;for(let _0xdafe65=Math['floor'](_0x3ac962[_0x1ae6ee(0x1d0)]/0x2);_0xdafe65>=0x1;_0xdafe65--){for(let _0x355deb=0x0;_0x355deb<=_0x3ac962[_0x1ae6ee(0x1d0)]-0x2*_0xdafe65;_0x355deb++){const _0x561f47=_0x3ac962[_0x1ae6ee(0x2b7)](_0x355deb,_0x355deb+_0xdafe65),_0x1bd74b=_0x3ac962[_0x1ae6ee(0x2b7)](_0x355deb+_0xdafe65,_0x355deb+0x2*_0xdafe65);if(_0x561f47[_0x1ae6ee(0x266)]((_0xfa6db1,_0x10f5cb)=>_0xfa6db1===_0x1bd74b[_0x10f5cb])){const _0x5ac454=[..._0x3ac962[_0x1ae6ee(0x2b7)](0x0,_0x355deb),..._0x3ac962[_0x1ae6ee(0x2b7)](_0x355deb+_0xdafe65)];return a0_0x299f38[_0x1ae6ee(0x206)]+_0x5ac454[_0x1ae6ee(0x286)](a0_0x299f38[_0x1ae6ee(0x206)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x5e3c62=a0_0x1d2d;try{const _0x5c6400=require(_0x5e3c62(0x21c));return _0x5c6400[_0x5e3c62(0x280)]??_0x5e3c62(0x1d2);}catch(_0x571498){return logMcpStderr(_0x5e3c62(0x231),_0x571498),_0x5e3c62(0x1d2);}}function printHelp(){const _0x3a7c1d=a0_0x1d2d;console[_0x3a7c1d(0x288)](_0x3a7c1d(0x238)+getPackageVersion()),console[_0x3a7c1d(0x288)](_0x3a7c1d(0x20e)),console['log'](_0x3a7c1d(0x210)),console['log']('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x3a7c1d(0x288)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x3a7c1d(0x288)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x3a7c1d(0x288)]('\x0aExamples:'),console[_0x3a7c1d(0x288)](_0x3a7c1d(0x27c)),console[_0x3a7c1d(0x288)](_0x3a7c1d(0x1d5));}const cliArgs=process[a0_0x4261fe(0x1d1)][a0_0x4261fe(0x2b7)](0x2),VERSION_FLAGS=new Set([a0_0x4261fe(0x1c5),'-v','-V']),HELP_FLAGS=new Set([a0_0x4261fe(0x2bd),'-h']);cliArgs['some'](_0x22be71=>VERSION_FLAGS[a0_0x4261fe(0x1ed)](_0x22be71))&&(console[a0_0x4261fe(0x288)](a0_0x4261fe(0x238)+getPackageVersion()),process[a0_0x4261fe(0x257)](0x0));cliArgs[a0_0x4261fe(0x262)](_0x300e91=>HELP_FLAGS[a0_0x4261fe(0x1ed)](_0x300e91))&&(printHelp(),process[a0_0x4261fe(0x257)](0x0));function getCliArg(_0x1c56c4){const _0x4033a2=a0_0x4261fe;for(let _0x1c659e=0x0;_0x1c659e<cliArgs[_0x4033a2(0x1d0)];_0x1c659e++){const _0xeb98c7=cliArgs[_0x1c659e];if(_0xeb98c7[_0x4033a2(0x1cf)]('--'+_0x1c56c4+'='))return _0xeb98c7[_0x4033a2(0x2b7)](('--'+_0x1c56c4+'=')[_0x4033a2(0x1d0)]);if(_0xeb98c7==='--'+_0x1c56c4&&_0x1c659e+0x1<cliArgs[_0x4033a2(0x1d0)])return cliArgs[_0x1c659e+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4261fe(0x1ed)](arg)||HELP_FLAGS[a0_0x4261fe(0x1ed)](arg))continue;if(arg[a0_0x4261fe(0x1cf)](a0_0x4261fe(0x1f8)))continue;if(arg===a0_0x4261fe(0x1fd)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x4261fe(0x223)][a0_0x4261fe(0x1c0)]||process[a0_0x4261fe(0x223)][a0_0x4261fe(0x2a9)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x4261fe(0x1f7)]!==a0_0x4261fe(0x235),MORPH_API_KEY=getCliArg(a0_0x4261fe(0x2a2))??process[a0_0x4261fe(0x223)]['MORPH_API_KEY'],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x4261fe(0x223)][a0_0x4261fe(0x26b)]?parseInt(process[a0_0x4261fe(0x223)][a0_0x4261fe(0x26b)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set(['edit_file','codebase_search',a0_0x4261fe(0x290)]),DISABLED_TOOLS=process[a0_0x4261fe(0x223)][a0_0x4261fe(0x28e)]?new Set(process[a0_0x4261fe(0x223)]['DISABLED_TOOLS'][a0_0x4261fe(0x26a)](',')['map'](_0x133413=>_0x133413[a0_0x4261fe(0x22f)]())['filter'](_0x394776=>_0x394776[a0_0x4261fe(0x1d0)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x4261fe(0x29a)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x4261fe(0x1ed)](tool)&&console['error'](a0_0x4261fe(0x240)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console['error'](a0_0x4261fe(0x1c1)+[...DISABLED_TOOLS][a0_0x4261fe(0x286)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x4261fe(0x29c))&&!MORPH_API_KEY[a0_0x4261fe(0x1cf)]('morph-')&&logMcpStderr(a0_0x4261fe(0x1cb));async function reportMorphError(_0x513858){const _0x57b9f7=a0_0x4261fe;try{await a0_0x2a9174[_0x57b9f7(0x256)]('https://morphllm.com/api/error-report',{..._0x513858,'timestamp':new Date()[_0x57b9f7(0x21f)](),'source':_0x513858['source']||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x513858[_0x57b9f7(0x230)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x57b9f7(0x2ab),'Authorization':_0x57b9f7(0x252)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x4261fe(0x2a0)),logMcpStderr(a0_0x4261fe(0x284)),logMcpStderr(a0_0x4261fe(0x2a4)),logMcpStderr(a0_0x4261fe(0x239)),logMcpStderr(a0_0x4261fe(0x296)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x19dff9){return a0_0x299f38['normalize'](_0x19dff9);}function expandHome(_0x3f2241){const _0x2e3bda=a0_0x4261fe;if(_0x3f2241[_0x2e3bda(0x1cf)]('~/')||_0x3f2241==='~')return a0_0x299f38[_0x2e3bda(0x286)](a0_0x569f82[_0x2e3bda(0x2a1)](),_0x3f2241[_0x2e3bda(0x2b7)](0x1));return _0x3f2241;}let allowedDirectories=await Promise['all'](args[a0_0x4261fe(0x1d3)](async _0x521b5f=>{const _0x34822f=expandHome(_0x521b5f),_0x549299=a0_0x299f38['resolve'](_0x34822f);try{const _0x30e9e7=await a0_0x2e9590['realpath'](_0x549299);return normalizePath(_0x30e9e7);}catch(_0x5581ed){return normalizePath(_0x549299);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4261fe(0x1d0)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4261fe(0x270)](workspaceDir),logMcpStderr(a0_0x4261fe(0x216)+workspaceDir+a0_0x4261fe(0x222)));}catch(a0_0x27c122){logMcpStderr(a0_0x4261fe(0x244)+a0_0x27c122);}async function detectWorkspaceRoot(_0x14c272){const _0x31e7ab=a0_0x4261fe;let _0x33e72e=a0_0x299f38[_0x31e7ab(0x21a)](_0x14c272);const _0x5853e9=['.git',_0x31e7ab(0x1f2),_0x31e7ab(0x27a),_0x31e7ab(0x21b),'pyproject.toml',_0x31e7ab(0x1e9),'.cursor',_0x31e7ab(0x1c4),_0x31e7ab(0x1d6)];while(_0x33e72e!==a0_0x299f38['dirname'](_0x33e72e)){for(const _0x3fe1c7 of _0x5853e9){const _0x5a31b6=a0_0x299f38[_0x31e7ab(0x286)](_0x33e72e,_0x3fe1c7);try{return await a0_0x2e9590['access'](_0x5a31b6),normalizePath(_0x33e72e);}catch{}}_0x33e72e=a0_0x299f38['dirname'](_0x33e72e);}return normalizePath(_0x14c272);}await Promise[a0_0x4261fe(0x2bb)](args[a0_0x4261fe(0x1d3)](async _0x249b7c=>{const _0x52df89=a0_0x4261fe;try{const _0x50cff3=await a0_0x2e9590[_0x52df89(0x236)](expandHome(_0x249b7c));!_0x50cff3[_0x52df89(0x2a5)]()&&(logMcpStderr('Error:\x20'+_0x249b7c+_0x52df89(0x26e)),process[_0x52df89(0x257)](0x1));}catch(_0x371c9d){logMcpStderr(_0x52df89(0x297)+_0x249b7c+':',_0x371c9d),process['exit'](0x1);}}));async function validatePath(_0x479244){const _0x1f3381=a0_0x4261fe,_0x499f05=expandHome(_0x479244),_0x317d84=a0_0x299f38[_0x1f3381(0x21a)](_0x499f05);try{const _0x86891a=await a0_0x2e9590['realpath'](_0x317d84);return _0x86891a;}catch(_0x237003){if(_0x237003['code']==='ENOENT'){const _0xfcfee8=a0_0x299f38['dirname'](_0x317d84);try{const _0x19294f=await a0_0x2e9590[_0x1f3381(0x241)](_0xfcfee8);return a0_0x299f38[_0x1f3381(0x286)](_0x19294f,a0_0x299f38['basename'](_0x317d84));}catch{throw new Error(_0x1f3381(0x24a)+_0xfcfee8);}}throw _0x237003;}}const MorphEditFileArgsSchema=z[a0_0x4261fe(0x1c9)]({'path':z['string'](),'code_edit':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x27e)),'instruction':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x22a)),'dryRun':z[a0_0x4261fe(0x20b)]()[a0_0x4261fe(0x277)](![])[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x21e))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x4261fe(0x1f3),WarpGrepArgsSchema=z[a0_0x4261fe(0x1c9)]({'search_string':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x4261fe(0x255)]()['describe'](a0_0x4261fe(0x285)),'search_type':z[a0_0x4261fe(0x213)]([a0_0x4261fe(0x277),a0_0x4261fe(0x249)])[a0_0x4261fe(0x27f)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x2c0))}),WarpGrepGitHubArgsSchema=z[a0_0x4261fe(0x1c9)]({'search_string':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x2ca)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x27f)]()['describe'](a0_0x4261fe(0x20a)),'owner_repo':z[a0_0x4261fe(0x255)]()['optional']()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x25b)),'branch':z['string']()[a0_0x4261fe(0x27f)]()['describe'](a0_0x4261fe(0x1ec))}),CodebaseSearchArgsSchema=z[a0_0x4261fe(0x1c9)]({'query':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x4261fe(0x255)]()['describe'](a0_0x4261fe(0x23a)),'branch':z[a0_0x4261fe(0x255)]()['optional']()[a0_0x4261fe(0x2ca)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x4261fe(0x255)]()[a0_0x4261fe(0x27f)]()[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x1cd)),'targetDirectories':z[a0_0x4261fe(0x234)](z[a0_0x4261fe(0x255)]())[a0_0x4261fe(0x277)]([])[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x2a8)),'limit':z[a0_0x4261fe(0x2c4)]()[a0_0x4261fe(0x27f)]()['default'](0xa)[a0_0x4261fe(0x2ca)](a0_0x4261fe(0x24c))}),server=new Server({'name':a0_0x4261fe(0x1d8),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x3b92ed=a0_0x4261fe,_0x33b3cb=[{'name':_0x3b92ed(0x2ba),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x3b92ed(0x26f)+_0x3b92ed(0x1be)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x3b92ed(0x23d)+_0x3b92ed(0x251)+_0x3b92ed(0x2c6)+_0x3b92ed(0x1ca)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x3b92ed(0x2b5)+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+_0x3b92ed(0x281)+_0x3b92ed(0x242)+_0x3b92ed(0x212)+_0x3b92ed(0x1e4)+_0x3b92ed(0x23e)+_0x3b92ed(0x221)+_0x3b92ed(0x29d)+_0x3b92ed(0x228)+_0x3b92ed(0x2b1),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x3b92ed(0x269),'description':'A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x3b92ed(0x275)+_0x3b92ed(0x22c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3b7cc9=_0x33b3cb[_0x3b92ed(0x1d4)](_0x285fe7=>{const _0x1581ca=_0x3b92ed;if(DISABLED_TOOLS[_0x1581ca(0x1ed)](_0x285fe7['name']))return console[_0x1581ca(0x2b8)](_0x1581ca(0x20f)+_0x285fe7[_0x1581ca(0x22e)]+_0x1581ca(0x292)),![];if(_0x1581ca(0x1fa)in _0x285fe7&&_0x285fe7[_0x1581ca(0x1fa)]&&!MORPH_API_KEY)return logMcpStderr(_0x1581ca(0x2a3)+_0x285fe7[_0x1581ca(0x22e)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x3b7cc9[_0x3b92ed(0x1d3)](_0xa3b31a=>({'name':_0xa3b31a['name'],'description':_0xa3b31a[_0x3b92ed(0x215)],'inputSchema':_0xa3b31a[_0x3b92ed(0x207)]}))};}),server[a0_0x4261fe(0x2b0)](CallToolRequestSchema,async _0x10dbc5=>{const _0x2c6ba3=a0_0x4261fe,{name:_0x54ac54,arguments:_0x25c399}=_0x10dbc5['params'];try{if(DISABLED_TOOLS['has'](_0x54ac54))throw new Error(_0x2c6ba3(0x1ee)+_0x54ac54+_0x2c6ba3(0x1e7));switch(_0x54ac54){case _0x2c6ba3(0x2ba):{const _0x2ce499=MorphEditFileArgsSchema['safeParse'](_0x25c399);if(!_0x2ce499[_0x2c6ba3(0x293)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x2ce499[_0x2c6ba3(0x2b8)]);const _0x3966fa=await validatePath(_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c2)]);let _0x48f852=null,_0x506843=!![],_0x2f797d=null;try{_0x48f852=await a0_0x2e9590[_0x2c6ba3(0x291)](_0x3966fa,_0x2c6ba3(0x299));}catch(_0x2d1c6a){const _0x47eab1=_0x2d1c6a[_0x2c6ba3(0x1f5)];_0x47eab1===_0x2c6ba3(0x1c7)?(_0x506843=![],_0x48f852=''):(_0x2f797d=_0x2c6ba3(0x1bd)+(_0x47eab1||_0x2c6ba3(0x1d2))+'\x20-\x20'+(_0x2d1c6a instanceof Error?_0x2d1c6a[_0x2c6ba3(0x29f)]:String(_0x2d1c6a)),logMcpStderr('Warning:\x20'+_0x2f797d));}let _0xe862de;try{const _0x4b19d5=MORPH_API_KEY;if(!_0x4b19d5)throw new Error(_0x2c6ba3(0x294));const _0x37ca0d=a0_0x299f38[_0x2c6ba3(0x218)](_0x3966fa),_0x11a17d=a0_0x299f38['basename'](_0x3966fa),_0x26bc7f=await executeEditFile({'target_filepath':_0x11a17d,'code_edit':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x20d)],'instructions':_0x2ce499[_0x2c6ba3(0x21d)]['instruction']},{'morphApiKey':_0x4b19d5,'morphApiUrl':MORPH_API_URL,'baseDir':_0x37ca0d,'autoWrite':!_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)],'generateUdiff':![],'debug':![]});_0xe862de=_0x26bc7f['completionId'];if(!_0x26bc7f[_0x2c6ba3(0x293)])throw new Error(_0x26bc7f['error']||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x2cb68e=_0x26bc7f[_0x2c6ba3(0x25a)],_0x5f1ae2='added\x20'+_0x2cb68e[_0x2c6ba3(0x2aa)]+_0x2c6ba3(0x22b)+_0x2cb68e['linesRemoved']+_0x2c6ba3(0x1cc)+_0x2cb68e[_0x2c6ba3(0x26c)];if(_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)])return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1f0)+(_0x506843?'':_0x2c6ba3(0x229))+':\x20'+_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)]+'.\x20Changes:\x20'+_0x5f1ae2+_0x2c6ba3(0x1e3)+_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c2)]+'.'}]};return{'content':[{'type':'text','text':_0x2c6ba3(0x27b)+(_0x506843?'Applied':_0x2c6ba3(0x25e))+':\x20'+_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)]+_0x2c6ba3(0x1c2)+_0x5f1ae2+'.\x20Path:\x20'+_0x2ce499[_0x2c6ba3(0x21d)]['path']+'.'}]};}catch(_0x47c529){const _0x37f76c=_0x47c529 instanceof Error?_0x47c529[_0x2c6ba3(0x29f)]:String(_0x47c529);return reportMorphError({'error_message':_0x37f76c,'error_type':_0x47c529 instanceof Error?_0x47c529[_0x2c6ba3(0x2bc)][_0x2c6ba3(0x22e)]:_0x2c6ba3(0x28f),'context':{'tool':_0x2c6ba3(0x2ba),'completion_id':_0xe862de,'file_path':_0x2ce499['data'][_0x2c6ba3(0x2c2)],'validated_path':_0x3966fa,'instruction':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)],'model':_0x2c6ba3(0x208),'dry_run':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)],'file_exists':_0x506843,'file_read_error':_0x2f797d,'file_readable':_0x48f852!==null,'request_content':{'path':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c2)],'code_edit':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x20d)],'instruction':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2ac)],'original_code':_0x48f852!==null?_0x48f852[_0x2c6ba3(0x1d0)]>0xc350?_0x48f852[_0x2c6ba3(0x2b3)](0x0,0xc350)+_0x2c6ba3(0x279)+_0x48f852[_0x2c6ba3(0x1d0)]+'\x20chars)':_0x48f852:_0x2c6ba3(0x205)+(_0x2f797d||'unknown\x20error')+']','original_code_length':_0x48f852?.[_0x2c6ba3(0x1d0)]??0x0,'model':_0x2c6ba3(0x208),'dry_run':_0x2ce499[_0x2c6ba3(0x21d)][_0x2c6ba3(0x265)]}},'stack_trace':_0x47c529 instanceof Error?_0x47c529[_0x2c6ba3(0x263)]:undefined,'source':'mcp-filesystem'})[_0x2c6ba3(0x287)](()=>{}),{'content':[{'type':_0x2c6ba3(0x27d),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x37f76c}],'isError':!![]};}}case'codebase_search':{const _0x2f866f=WarpGrepArgsSchema[_0x2c6ba3(0x1bf)](_0x25c399);if(!_0x2f866f[_0x2c6ba3(0x293)])return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1bc)+_0x2f866f['error']}],'isError':!![]};const _0x449cd1=_0x676a36=>{const _0x35871d=_0x2c6ba3,_0x89d1c6=[];for(const _0x4b621e of _0x676a36||[]){if(_0x4b621e['role']==='assistant'&&Array[_0x35871d(0x245)](_0x4b621e[_0x35871d(0x2a7)]))for(const _0xc1fc6d of _0x4b621e[_0x35871d(0x2a7)]){try{const _0x2cdff7=_0xc1fc6d[_0x35871d(0x2bf)]?.['name'],_0xfff64f=JSON[_0x35871d(0x268)](_0xc1fc6d[_0x35871d(0x2bf)]?.[_0x35871d(0x200)]||'{}');if(_0x2cdff7==='grep_search')_0x89d1c6[_0x35871d(0x270)]('grep\x20\x27'+_0xfff64f[_0x35871d(0x1b7)]+'\x27\x20'+(_0xfff64f[_0x35871d(0x2c2)]||'.'));else{if(_0x2cdff7===_0x35871d(0x1da))_0x89d1c6[_0x35871d(0x270)](_0x35871d(0x202)+_0xfff64f[_0x35871d(0x2c2)]);else{if(_0x2cdff7===_0x35871d(0x203))_0x89d1c6[_0x35871d(0x270)]('list_directory\x20'+(_0xfff64f[_0x35871d(0x1c6)]||'.'));else{if(_0x2cdff7===_0x35871d(0x29e))_0x89d1c6[_0x35871d(0x270)](_0x35871d(0x247)+_0xfff64f['pattern']+'\x27\x20'+(_0xfff64f[_0x35871d(0x2c2)]||'.'));else _0x2cdff7==='finish'&&_0x89d1c6[_0x35871d(0x270)](_0x35871d(0x254));}}}}catch{}}}return _0x89d1c6;},_0x7e106d=_0x28453f=>{const _0x1ef069=_0x2c6ba3,_0x553553=[];if(!_0x28453f||!Array[_0x1ef069(0x245)](_0x28453f))return _0x553553;const _0x262d7f=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1ef069(0x225),'tool':_0x1ef069(0x1da)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1ef069(0x1f1),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x1ef069(0x20c),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1ef069(0x25f),'tool':_0x1ef069(0x1da)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1ef069(0x1df),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1ef069(0x1fe),'tool':_0x1ef069(0x227)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x1ef069(0x1da)},{'pattern':/\[SYMLINK\]/,'error_type':_0x1ef069(0x1d9),'tool':_0x1ef069(0x1da)},{'pattern':/not a text file/,'error_type':_0x1ef069(0x25f),'tool':_0x1ef069(0x1da)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x1ef069(0x1da)},{'pattern':/Error reading file:/,'error_type':_0x1ef069(0x20c),'tool':_0x1ef069(0x1da)},{'pattern':/status="error"/,'error_type':_0x1ef069(0x253),'tool':_0x1ef069(0x1d2)}];let _0x387524=0x0;for(const _0x3a20c2 of _0x28453f){_0x3a20c2[_0x1ef069(0x226)]===_0x1ef069(0x2b2)&&Array[_0x1ef069(0x245)](_0x3a20c2[_0x1ef069(0x2a7)])&&_0x387524++;const _0x1ebf14=_0x3a20c2[_0x1ef069(0x28c)];if((_0x3a20c2[_0x1ef069(0x226)]===_0x1ef069(0x264)||_0x3a20c2[_0x1ef069(0x226)]===_0x1ef069(0x1ff))&&_0x1ebf14&&typeof _0x1ebf14===_0x1ef069(0x255))for(const {pattern:_0x10e246,error_type:_0x17ce43,tool:_0x512fe2}of _0x262d7f){const _0x5d4e70=_0x1ebf14[_0x1ef069(0x217)](new RegExp(_0x10e246['source'],'g'));if(_0x5d4e70)for(const _0x15edaf of _0x5d4e70){const _0x2b8355=_0x1ebf14[_0x1ef069(0x1db)](_0x15edaf),_0x8de57a=_0x1ebf14[_0x1ef069(0x2b3)](_0x2b8355,Math[_0x1ef069(0x1e8)](_0x2b8355+0xc8,_0x1ebf14['length']));_0x553553[_0x1ef069(0x270)]({'tool':_0x512fe2,'error_type':_0x17ce43,'error_message':_0x8de57a[_0x1ef069(0x26a)]('\x0a')[0x0],'turn':_0x387524});}}}return _0x553553;};try{const _0x47a37b=a0_0x299f38[_0x2c6ba3(0x21a)](_0x2f866f['data'][_0x2c6ba3(0x2c9)]),_0xed4dd3=_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x258)],_0x4d86e8=_0xed4dd3==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x4364a7=new LocalRipgrepProvider(_0x47a37b,undefined,_0x4d86e8),_0x51eac1=await runWarpGrep({'searchTerm':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'repoRoot':_0x47a37b,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4364a7,'search_type':_0xed4dd3}),_0x3e9049=_0x7e106d(_0x51eac1[_0x2c6ba3(0x2c1)]);_0x3e9049['length']>0x0&&reportMorphError({'error_message':_0x2c6ba3(0x243)+_0x3e9049[_0x2c6ba3(0x1d0)]+_0x2c6ba3(0x1e6),'error_type':_0x2c6ba3(0x26d),'level':_0x2c6ba3(0x211),'tool':_0x2c6ba3(0x269),'context':{'repo_path':_0x2f866f['data']['repo_path'],'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'model':'morph-warp-grep-v2.1','termination_reason':_0x51eac1['terminationReason'],'sub_tool_errors':_0x3e9049,'timings':_0x51eac1[_0x2c6ba3(0x220)],'tool_calls':_0x449cd1(_0x51eac1[_0x2c6ba3(0x2c1)]),'messages':_0x51eac1[_0x2c6ba3(0x2c1)]?.[_0x2c6ba3(0x1d3)](_0x3bb0b9=>({'role':_0x3bb0b9['role'],'content':_0x3bb0b9['content'],..._0x3bb0b9[_0x2c6ba3(0x2a7)]?{'tool_calls':_0x3bb0b9[_0x2c6ba3(0x2a7)][_0x2c6ba3(0x1d0)]}:{},..._0x3bb0b9['tool_call_id']?{'tool_call_id':_0x3bb0b9[_0x2c6ba3(0x24d)]}:{}}))},'source':'mcp-filesystem'})[_0x2c6ba3(0x287)](()=>{});let _0x1c4e26='';if(_0x51eac1['terminationReason']===_0x2c6ba3(0x23f)&&_0x51eac1[_0x2c6ba3(0x254)]?.['metadata']?.[_0x2c6ba3(0x271)]){const _0x383aa2=_0x51eac1['finish'][_0x2c6ba3(0x298)]['files'];if(_0x383aa2[_0x2c6ba3(0x1d0)]===0x0)return _0x1c4e26=_0x51eac1[_0x2c6ba3(0x254)][_0x2c6ba3(0x283)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x1c4e26}]};const _0x39998b=[],_0x554174=[_0x2c6ba3(0x1e5)];for(const _0x4c3cff of _0x51eac1[_0x2c6ba3(0x2c1)]){if(_0x4c3cff['role']===_0x2c6ba3(0x2b2)&&Array[_0x2c6ba3(0x245)](_0x4c3cff[_0x2c6ba3(0x2a7)]))for(const _0x5d975a of _0x4c3cff[_0x2c6ba3(0x2a7)]){try{const _0x42f7b7=_0x5d975a[_0x2c6ba3(0x2bf)]?.[_0x2c6ba3(0x22e)],_0x5313e5=JSON[_0x2c6ba3(0x268)](_0x5d975a['function']?.[_0x2c6ba3(0x200)]||'{}');if(_0x42f7b7===_0x2c6ba3(0x1c3))_0x554174['push'](_0x2c6ba3(0x1b9)+_0x5313e5[_0x2c6ba3(0x1b7)]+_0x2c6ba3(0x289)+(_0x5313e5[_0x2c6ba3(0x2c2)]||'.')+'`');else{if(_0x42f7b7===_0x2c6ba3(0x1da))_0x554174['push'](_0x2c6ba3(0x2c5)+_0x5313e5[_0x2c6ba3(0x2c2)]+'`');else{if(_0x42f7b7===_0x2c6ba3(0x203))_0x554174[_0x2c6ba3(0x270)]('-\x20Listed\x20directory\x20`'+(_0x5313e5[_0x2c6ba3(0x1c6)]||'.')+'`');else _0x42f7b7==='glob'&&_0x554174[_0x2c6ba3(0x270)](_0x2c6ba3(0x28d)+_0x5313e5[_0x2c6ba3(0x1b7)]+_0x2c6ba3(0x2ae)+(_0x5313e5['path']||'.')+'`');}}}catch{}}}_0x39998b[_0x2c6ba3(0x270)](_0x554174[_0x2c6ba3(0x286)]('\x0a'));const _0xcc52dc=['',_0x2c6ba3(0x24b)];for(const _0x11bfac of _0x383aa2){if(_0x11bfac[_0x2c6ba3(0x248)]==='*')_0xcc52dc['push']('-\x20'+_0x11bfac[_0x2c6ba3(0x2c2)]+':*');else{if(Array[_0x2c6ba3(0x245)](_0x11bfac[_0x2c6ba3(0x248)])){const _0x88cf1c=_0x11bfac[_0x2c6ba3(0x248)][_0x2c6ba3(0x1d3)](([_0x122f07,_0xdb4195])=>{if(_0x122f07===_0xdb4195)return''+_0x122f07;return _0x122f07+'-'+_0xdb4195;});_0xcc52dc[_0x2c6ba3(0x270)]('-\x20'+_0x11bfac[_0x2c6ba3(0x2c2)]+':'+_0x88cf1c[_0x2c6ba3(0x286)](','));}else _0xcc52dc[_0x2c6ba3(0x270)]('-\x20'+_0x11bfac['path']+':*');}}_0xcc52dc[_0x2c6ba3(0x270)](''),_0x39998b['push'](_0xcc52dc[_0x2c6ba3(0x286)]('\x0a')),_0x39998b['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0xeeb23d=[];for(const _0x231bf6 of _0x383aa2){let _0x1be5e0=a0_0x299f38[_0x2c6ba3(0x21a)](_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)],_0x231bf6[_0x2c6ba3(0x2c2)]),_0x2feda4=null,_0x43d8ff=null;try{_0x2feda4=await a0_0x2e9590[_0x2c6ba3(0x291)](_0x1be5e0,{'encoding':_0x2c6ba3(0x299)});}catch(_0x5061c8){const _0x2d90ba=fixPathRepetition(_0x1be5e0);if(_0x2d90ba)try{_0x2feda4=await a0_0x2e9590[_0x2c6ba3(0x291)](_0x2d90ba,{'encoding':'utf-8'}),_0x1be5e0=_0x2d90ba;}catch{_0x43d8ff=_0x5061c8 instanceof Error?_0x5061c8:new Error(String(_0x5061c8));}else _0x43d8ff=_0x5061c8 instanceof Error?_0x5061c8:new Error(String(_0x5061c8));}if(_0x2feda4!==null){const _0x3c3348=_0x2feda4['split'](/\r?\n/),_0x5eee6d=['<file\x20path=\x22'+_0x231bf6['path']+'\x22>'];if(_0x231bf6[_0x2c6ba3(0x248)]==='*'||!Array['isArray'](_0x231bf6[_0x2c6ba3(0x248)]))for(let _0x128e8e=0x1;_0x128e8e<=_0x3c3348[_0x2c6ba3(0x1d0)];_0x128e8e++){const _0x574f8f=_0x3c3348[_0x128e8e-0x1];_0x5eee6d['push'](_0x128e8e+'|\x20'+_0x574f8f);}else for(const [_0x324bc9,_0x30e8b4]of _0x231bf6[_0x2c6ba3(0x248)]){_0x5eee6d[_0x2c6ba3(0x1d0)]>0x1&&_0x5eee6d['push']('');for(let _0x28cd7f=_0x324bc9;_0x28cd7f<=_0x30e8b4&&_0x28cd7f<=_0x3c3348['length'];_0x28cd7f++){const _0x585fa1=_0x3c3348[_0x28cd7f-0x1];_0x5eee6d[_0x2c6ba3(0x270)](_0x28cd7f+'|\x20'+_0x585fa1);}}_0x5eee6d[_0x2c6ba3(0x270)]('</file>'),_0xeeb23d['push'](_0x5eee6d[_0x2c6ba3(0x286)]('\x0a'));}else _0xeeb23d['push'](_0x2c6ba3(0x23b)+_0x231bf6[_0x2c6ba3(0x2c2)]+_0x2c6ba3(0x250)+(_0x43d8ff?.[_0x2c6ba3(0x29f)]||_0x2c6ba3(0x278))+_0x2c6ba3(0x219));}_0x39998b['push'](_0xeeb23d['join']('\x0a\x0a')),_0x1c4e26=_0x39998b[_0x2c6ba3(0x286)]('\x0a');const _0x4679e9=_0x51eac1[_0x2c6ba3(0x276)]?.[_0x2c6ba3(0x1d4)](_0x296f1f=>_0x296f1f['message']?.[_0x2c6ba3(0x1cf)]('File\x20read\x20error:'))||[];if(_0x4679e9[_0x2c6ba3(0x1d0)]>0x0){const _0x5ac241=_0x4679e9[_0x2c6ba3(0x1d3)](_0x31cbf6=>_0x31cbf6[_0x2c6ba3(0x29f)])[_0x2c6ba3(0x286)](';\x20');reportMorphError({'error_message':_0x5ac241,'error_type':'FileReadError','context':{'tool':_0x2c6ba3(0x269),'repo_path':_0x2f866f[_0x2c6ba3(0x21d)]['repo_path'],'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'model':_0x2c6ba3(0x214),'termination_reason':_0x2c6ba3(0x295),'error_count':_0x4679e9[_0x2c6ba3(0x1d0)],'is_timeout':![],'timings':_0x51eac1[_0x2c6ba3(0x220)],'files_attempted':_0x383aa2[_0x2c6ba3(0x1d3)](_0x2faefd=>({'path':_0x2faefd['path'],'lines':_0x2faefd['lines']})),'tool_calls':_0x449cd1(_0x51eac1[_0x2c6ba3(0x2c1)]),'messages':_0x51eac1[_0x2c6ba3(0x2c1)]?.['map'](_0x585589=>({'role':_0x585589[_0x2c6ba3(0x226)],'content':_0x585589[_0x2c6ba3(0x28c)],..._0x585589[_0x2c6ba3(0x2a7)]?{'tool_calls':_0x585589['tool_calls'][_0x2c6ba3(0x1d0)]}:{},..._0x585589[_0x2c6ba3(0x24d)]?{'tool_call_id':_0x585589[_0x2c6ba3(0x24d)]}:{}})),'request_content':{'query':_0x2f866f[_0x2c6ba3(0x21d)]['search_string'],'repo_path':_0x2f866f['data'][_0x2c6ba3(0x2c9)],'repoRoot':a0_0x299f38[_0x2c6ba3(0x21a)](_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)]),'model':_0x2c6ba3(0x214)}},'source':'mcp-filesystem'})['catch'](()=>{});}}else{if(_0x51eac1[_0x2c6ba3(0x28a)]===_0x2c6ba3(0x25c)&&_0x51eac1['errors'][_0x2c6ba3(0x1d0)]>0x0){const _0x2f82a9=_0x51eac1[_0x2c6ba3(0x276)][_0x2c6ba3(0x1d3)](_0x58c2e6=>_0x58c2e6[_0x2c6ba3(0x29f)])[_0x2c6ba3(0x286)](';\x20');_0x1c4e26='Error:\x20'+_0x2f82a9;const _0x4d91a9=_0x2f82a9[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x267))||_0x2f82a9['toLowerCase']()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x2b6))||_0x2f82a9[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x1f6)),_0xe523ab=_0x51eac1[_0x2c6ba3(0x254)]?.[_0x2c6ba3(0x298)]?.['files'],_0x424239=_0x51eac1[_0x2c6ba3(0x276)][0x0];reportMorphError({'error_message':_0x2f82a9,'error_type':_0x4d91a9?_0x2c6ba3(0x2c7):_0x424239?.[_0x2c6ba3(0x2bc)]?.[_0x2c6ba3(0x22e)]||_0x2c6ba3(0x1e1),'context':{'tool':_0x2c6ba3(0x269),'repo_path':_0x2f866f['data'][_0x2c6ba3(0x2c9)],'query':_0x2f866f[_0x2c6ba3(0x21d)]['search_string'],'model':_0x2c6ba3(0x214),'termination_reason':_0x51eac1[_0x2c6ba3(0x28a)],'error_count':_0x51eac1[_0x2c6ba3(0x276)][_0x2c6ba3(0x1d0)],'is_timeout':_0x4d91a9,'timings':_0x51eac1[_0x2c6ba3(0x220)],'files_attempted':_0xe523ab?.[_0x2c6ba3(0x1d3)](_0x1f8492=>({'path':_0x1f8492[_0x2c6ba3(0x2c2)],'lines':_0x1f8492[_0x2c6ba3(0x248)]})),'tool_calls':_0x449cd1(_0x51eac1[_0x2c6ba3(0x2c1)]),'messages':_0x51eac1[_0x2c6ba3(0x2c1)]?.[_0x2c6ba3(0x1d3)](_0x356a94=>({'role':_0x356a94[_0x2c6ba3(0x226)],'content':_0x356a94['content'],..._0x356a94[_0x2c6ba3(0x2a7)]?{'tool_calls':_0x356a94['tool_calls'][_0x2c6ba3(0x1d0)]}:{},..._0x356a94[_0x2c6ba3(0x24d)]?{'tool_call_id':_0x356a94[_0x2c6ba3(0x24d)]}:{}})),'request_content':{'query':_0x2f866f['data'][_0x2c6ba3(0x2c3)],'repo_path':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)],'repoRoot':a0_0x299f38['resolve'](_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)]),'model':_0x2c6ba3(0x214)}},'stack_trace':_0x424239?.[_0x2c6ba3(0x263)]||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0x1c4e26=_0x2c6ba3(0x232);}return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x1c4e26}]};}catch(_0x396844){const _0x2864d0=_0x396844 instanceof Error?_0x396844['message']:String(_0x396844),_0xa4154e=_0x2864d0[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x267))||_0x2864d0['toLowerCase']()[_0x2c6ba3(0x1ce)](_0x2c6ba3(0x2b6))||_0x2864d0[_0x2c6ba3(0x2c8)]()[_0x2c6ba3(0x1ce)]('etimedout')||_0x396844 instanceof Error&&_0x396844['name']==='TimeoutError';return reportMorphError({'error_message':_0x2864d0,'error_type':_0xa4154e?_0x2c6ba3(0x2c7):_0x396844 instanceof Error?_0x396844[_0x2c6ba3(0x2bc)][_0x2c6ba3(0x22e)]:_0x2c6ba3(0x28f),'context':{'tool':'codebase_search','repo_path':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c9)],'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'model':_0x2c6ba3(0x214),'is_timeout':_0xa4154e,'exception_phase':_0x2c6ba3(0x201),'request_content':{'query':_0x2f866f[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)],'repo_path':_0x2f866f['data'][_0x2c6ba3(0x2c9)],'repoRoot':a0_0x299f38['resolve'](_0x2f866f['data'][_0x2c6ba3(0x2c9)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x396844 instanceof Error?_0x396844[_0x2c6ba3(0x263)]:undefined,'source':'mcp-filesystem'})[_0x2c6ba3(0x287)](()=>{}),{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1e2)+_0x2864d0}],'isError':![]};}}case _0x2c6ba3(0x290):{const _0x5dacb8=WarpGrepGitHubArgsSchema[_0x2c6ba3(0x1bf)](_0x25c399);if(!_0x5dacb8[_0x2c6ba3(0x293)])return{'content':[{'type':'text','text':_0x2c6ba3(0x1bc)+_0x5dacb8['error']}],'isError':!![]};const _0x320151=_0x5dacb8[_0x2c6ba3(0x21d)][_0x2c6ba3(0x204)]||_0x5dacb8[_0x2c6ba3(0x21d)][_0x2c6ba3(0x259)];if(!_0x320151)return{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x1c8)}],'isError':!![]};const _0x3f4ae6=MORPH_API_KEY;if(!_0x3f4ae6)throw new Error(_0x2c6ba3(0x294));const _0x3d90ac=Date[_0x2c6ba3(0x2a6)]();logMcpStderr(_0x2c6ba3(0x1f4)+_0x320151+_0x2c6ba3(0x1fc)+_0x5dacb8[_0x2c6ba3(0x21d)][_0x2c6ba3(0x2c3)]+'\x22');try{const _0x5c6324=new WarpGrepClient({'morphApiKey':_0x3f4ae6,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4e78c6=await _0x5c6324[_0x2c6ba3(0x260)]({'searchTerm':_0x5dacb8[_0x2c6ba3(0x21d)]['search_string'],'github':_0x320151,'branch':_0x5dacb8['data'][_0x2c6ba3(0x1fb)]}),_0x3a8fe2=Date[_0x2c6ba3(0x2a6)]()-_0x3d90ac;logMcpStderr(_0x2c6ba3(0x1dd)+_0x3a8fe2+'ms.\x20Success:\x20'+_0x4e78c6[_0x2c6ba3(0x293)]);const _0x438f10=formatResult(_0x4e78c6);return{'content':[{'type':'text','text':_0x438f10}]};}catch(_0x2d7c6e){const _0x34b347=Date['now']()-_0x3d90ac,_0x3d8165=_0x2d7c6e instanceof Error?_0x2d7c6e[_0x2c6ba3(0x29f)]:String(_0x2d7c6e);return logMcpStderr(_0x2c6ba3(0x224)+_0x34b347+_0x2c6ba3(0x282),_0x3d8165),reportMorphError({'error_message':_0x3d8165,'error_type':_0x2d7c6e instanceof Error?_0x2d7c6e[_0x2c6ba3(0x2bc)][_0x2c6ba3(0x22e)]:'UnknownError','context':{'tool':_0x2c6ba3(0x290),'github_url':_0x320151,'search_string':_0x5dacb8[_0x2c6ba3(0x21d)]['search_string'],'branch':_0x5dacb8['data'][_0x2c6ba3(0x1fb)]},'stack_trace':_0x2d7c6e instanceof Error?_0x2d7c6e['stack']:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x34b347})[_0x2c6ba3(0x287)](()=>{}),{'content':[{'type':'text','text':'GitHub\x20search\x20failed:\x20'+_0x3d8165}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x54ac54);}}catch(_0x2d4971){const _0x1d2735=_0x2d4971 instanceof Error?_0x2d4971[_0x2c6ba3(0x29f)]:String(_0x2d4971);return reportMorphError({'error_message':_0x1d2735,'error_type':_0x2d4971 instanceof Error?_0x2d4971[_0x2c6ba3(0x2bc)]['name']:'UnknownError','context':{'tool':_0x54ac54,'arguments':_0x25c399?JSON[_0x2c6ba3(0x1f9)](_0x25c399)[_0x2c6ba3(0x2b3)](0x0,0x1f4):undefined,'mcp_server_version':_0x2c6ba3(0x209)},'stack_trace':_0x2d4971 instanceof Error?_0x2d4971[_0x2c6ba3(0x263)]:undefined,'source':_0x2c6ba3(0x272)})['catch'](()=>{}),{'content':[{'type':_0x2c6ba3(0x27d),'text':_0x2c6ba3(0x2be)+_0x1d2735}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2fa2d3){const _0x4b4e79=a0_0x4261fe,_0x3120a5=await getValidRootDirectories(_0x2fa2d3);if(_0x3120a5[_0x4b4e79(0x1d0)]>0x0)allowedDirectories=[..._0x3120a5],logMcpStderr(_0x4b4e79(0x25d)+_0x3120a5[_0x4b4e79(0x1d0)]+'\x20valid\x20directories');else{logMcpStderr(_0x4b4e79(0x1b8));if(ENABLE_WORKSPACE_MODE)try{const _0x453190=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x453190&&(allowedDirectories=[_0x453190],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x453190));}catch(_0x4eb3f6){logMcpStderr(_0x4b4e79(0x2b4)+_0x4eb3f6);}}}server[a0_0x4261fe(0x1bb)](RootsListChangedNotificationSchema,async()=>{const _0xa18c0f=a0_0x4261fe;try{const _0x192890=await server[_0xa18c0f(0x24e)]();_0x192890&&_0xa18c0f(0x273)in _0x192890&&await updateAllowedDirectoriesFromRoots(_0x192890['roots']);}catch(_0x2c6168){logMcpStderr(_0xa18c0f(0x2af),_0x2c6168 instanceof Error?_0x2c6168[_0xa18c0f(0x29f)]:String(_0x2c6168));}}),server[a0_0x4261fe(0x2b9)]=async()=>{const _0x32ac6e=a0_0x4261fe,_0x4c6c0f=server[_0x32ac6e(0x2ad)]();if(_0x4c6c0f?.['roots'])try{const _0x438f39=await server['listRoots']();_0x438f39&&_0x32ac6e(0x273)in _0x438f39?await updateAllowedDirectoriesFromRoots(_0x438f39[_0x32ac6e(0x273)]):logMcpStderr(_0x32ac6e(0x1de));}catch(_0x2cece8){logMcpStderr(_0x32ac6e(0x274),_0x2cece8 instanceof Error?_0x2cece8[_0x32ac6e(0x29f)]:String(_0x2cece8));}else{if(allowedDirectories[_0x32ac6e(0x1d0)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x32ac6e(0x1eb));else throw new Error(_0x32ac6e(0x1ef));}}};async function runServer(){const _0x222ea5=a0_0x4261fe,_0x24b1dd=new StdioServerTransport();await server[_0x222ea5(0x246)](_0x24b1dd),logMcpStderr(_0x222ea5(0x233)),allowedDirectories[_0x222ea5(0x1d0)]===0x0&&logMcpStderr(_0x222ea5(0x24f));}runServer()[a0_0x4261fe(0x287)](_0x101f75=>{const _0x53dc92=a0_0x4261fe;logMcpStderr(_0x53dc92(0x22d),_0x101f75),process[_0x53dc92(0x257)](0x1);});
|
|
2
|
+
const a0_0x23a6f4=a0_0x6cf3;(function(_0x3aed29,_0xfd87f1){const _0xda0b95=a0_0x6cf3,_0x3c754e=_0x3aed29();while(!![]){try{const _0xdf2052=-parseInt(_0xda0b95(0x20a))/0x1*(-parseInt(_0xda0b95(0x25b))/0x2)+parseInt(_0xda0b95(0x198))/0x3+parseInt(_0xda0b95(0x1ab))/0x4*(parseInt(_0xda0b95(0x159))/0x5)+-parseInt(_0xda0b95(0x1db))/0x6*(-parseInt(_0xda0b95(0x18c))/0x7)+-parseInt(_0xda0b95(0x18d))/0x8+-parseInt(_0xda0b95(0x1f6))/0x9+-parseInt(_0xda0b95(0x257))/0xa*(-parseInt(_0xda0b95(0x183))/0xb);if(_0xdf2052===_0xfd87f1)break;else _0x3c754e['push'](_0x3c754e['shift']());}catch(_0x3caade){_0x3c754e['push'](_0x3c754e['shift']());}}}(a0_0x2f57,0xc8afb));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x372d7a from'fs/promises';import a0_0x388e0f from'path';import a0_0x477f98 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import a0_0x2d5c68 from'axios';function fixPathRepetition(_0x1aa7f9){const _0x1f577c=a0_0x6cf3,_0x1317e5=_0x1aa7f9['split'](a0_0x388e0f['sep'])[_0x1f577c(0x1d0)](Boolean);if(_0x1317e5['length']<0x2)return null;for(let _0x3e6be1=Math['floor'](_0x1317e5[_0x1f577c(0x187)]/0x2);_0x3e6be1>=0x1;_0x3e6be1--){for(let _0x1dd63d=0x0;_0x1dd63d<=_0x1317e5[_0x1f577c(0x187)]-0x2*_0x3e6be1;_0x1dd63d++){const _0x3c82de=_0x1317e5['slice'](_0x1dd63d,_0x1dd63d+_0x3e6be1),_0x59bd09=_0x1317e5[_0x1f577c(0x173)](_0x1dd63d+_0x3e6be1,_0x1dd63d+0x2*_0x3e6be1);if(_0x3c82de[_0x1f577c(0x1d6)]((_0x4a5ee4,_0x2f80b4)=>_0x4a5ee4===_0x59bd09[_0x2f80b4])){const _0x3c484a=[..._0x1317e5[_0x1f577c(0x173)](0x0,_0x1dd63d),..._0x1317e5['slice'](_0x1dd63d+_0x3e6be1)];return a0_0x388e0f['sep']+_0x3c484a['join'](a0_0x388e0f[_0x1f577c(0x1ae)]);}}}return null;}const require=createRequire(import.meta.url);function a0_0x2f57(){const _0x23fea6=['default','edit_file','setNotificationHandler','user','realpath','unknown\x20error','map','changes','-\x20Glob\x20search\x20`','composer.json','RipgrepError','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','string','[github_codebase_search]\x20Done\x20in\x20','mcp-filesystem','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','indexOf','\x0a</file>','grep\x20\x27','Relevant\x20context\x20found:','etimedout','completionId','[could\x20not\x20read\x20file:\x20','Cargo.toml','cwd','finish','argv','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','pyproject.toml','has','stringify','requiresApiKey','tool_calls','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','linesRemoved','dirname','`\x20in\x20`','Fatal\x20error\x20running\x20server:','820gaEeXi','Unknown\x20error','code_edit','search_string','2335706ZMfUWR','messages','search_type','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','version','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Max\x20results\x20to\x20return',',\x20removed\x20','node_modules','sk-','\x20\x20morph-mcp','getClientCapabilities','errors','instruction','Applied','45DhZJib','github_codebase_search','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','roots','function','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','params','isArray','all','Morph\x20Edit\x20Preview','timed\x20out','success','morph-v3-fast','message','PWD','glob\x20\x27','ToolException','Workspace\x20mode\x20enabled:\x20Using\x20','WarpGrepError','\x22.\x20Known\x20tools:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x0aExamples:','.\x20Path:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Listed\x20directory\x20`','payload','slice','branch','Failed\x20to\x20read\x20file:\x20','FileReadError','catch','completed','\x22>\x0aError\x20reading\x20file:\x20','.\x20Changes:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','glob','source','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','\x20error(s)','stack','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','https://morphllm.com/api/error-report','140657jCMdKw','go.mod','Warning:\x20','ms:','length','GitHub\x20search\x20failed:\x20','list_directory\x20','<file\x20path=\x22','substring','1911049JvKJGj','11684144uQVCmK','[github_codebase_search]\x20Failed\x20in\x20','utf-8','-\x20Read\x20file\x20`','role','\x20-\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','ReadError','package.json','parse','1009749SJqcNb','metadata','repo_path','match','read','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','\x20as\x20allowed\x20directory','.vscode','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','UnknownError','pattern','\x20is\x20not\x20a\x20directory','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','lines','dryRun','TimeoutError','timeout','startsWith','211920UcdRaE','\x27\x20in\x20`','0.2.0','sep','tool_call_id','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','FileNotFound','env','application/json','includes','grep','--help','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','resolve','@morphllm/morphmcp\x20','Repository\x20identifier','name','Disabled\x20tools:\x20','\x20valid\x20directories','Preview\x20changes\x20without\x20applying\x20them.','assistant','Error\x20running\x20fast\x20context\x20search:\x20','code','morph-warp-grep-v2.1','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','--version','arguments','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','some','ENOENT','\x20for:\x20\x22','join','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','connect','split','RipgrepNotAvailable','Error:\x20','filter','ENABLE_WORKSPACE_MODE','now','content','SubToolError','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','every','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','description','added\x20','ms.\x20Success:\x20','6tQlOPi','toLowerCase','min','readFile','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Rules:\x0a','Morph\x20FastApply\x20failed\x20without\x20error\x20message','BinaryFile','enum','boolean','morph-','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','MORPH_API_KEY','-\x20Grepped\x20\x27','\x0aOptions:','files','optional','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','DISABLED_TOOLS','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','setRequestHandler','Morph\x20Edit\x20','unknown','SymlinkError','command','error','❌\x20Morph\x20Edit\x20Failed:\x20','9182412BPXthr','MORPH_WARP_GREP_TIMEOUT','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','path','../package.json','oninitialized','trim','warn','completed_with_file_errors','morph-mcp','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','normalize','toISOString','codebase_search','searchGitHub','data','runWarpGrep_call','exit','1nqcHkd','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','constructor','basename','File\x20read\x20error:','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','linesAdded','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','--api-key=','log','isDirectory','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','Fallback:\x20Using\x20workspace\x20root\x20','linesModified','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','text','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','Warning:\x20Workspace\x20fallback\x20failed:\x20','push','Here\x20is\x20the\x20content\x20of\x20files:\x0a','listRoots','WORKSPACE_ROOT','Tool\x20\x22','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','.git','timings','object','terminationReason','access','safeParse','Unknown\x20tool:\x20','describe','Error\x20accessing\x20directory\x20','tool'];a0_0x2f57=function(){return _0x23fea6;};return a0_0x2f57();}function getPackageVersion(){const _0x3b30ce=a0_0x6cf3;try{const _0x239e90=require(_0x3b30ce(0x1fc));return _0x239e90[_0x3b30ce(0x25f)]??_0x3b30ce(0x1f1);}catch(_0x3b2336){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x3b2336),'unknown';}}function printHelp(){const _0x2a2c73=a0_0x6cf3;console[_0x2a2c73(0x216)](_0x2a2c73(0x1b9)+getPackageVersion()),console[_0x2a2c73(0x216)](_0x2a2c73(0x25e)),console['log'](_0x2a2c73(0x1e9)),console['log'](_0x2a2c73(0x1cb)),console[_0x2a2c73(0x216)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x2a2c73(0x216)](_0x2a2c73(0x23b)),console[_0x2a2c73(0x216)](_0x2a2c73(0x16e)),console['log'](_0x2a2c73(0x266)),console[_0x2a2c73(0x216)](_0x2a2c73(0x252));}const cliArgs=process[a0_0x23a6f4(0x24b)][a0_0x23a6f4(0x173)](0x2),VERSION_FLAGS=new Set([a0_0x23a6f4(0x1c4),'-v','-V']),HELP_FLAGS=new Set([a0_0x23a6f4(0x1b6),'-h']);cliArgs[a0_0x23a6f4(0x1c7)](_0x2b09ba=>VERSION_FLAGS['has'](_0x2b09ba))&&(console[a0_0x23a6f4(0x216)](a0_0x23a6f4(0x1b9)+getPackageVersion()),process[a0_0x23a6f4(0x209)](0x0));cliArgs[a0_0x23a6f4(0x1c7)](_0x670684=>HELP_FLAGS[a0_0x23a6f4(0x24e)](_0x670684))&&(printHelp(),process[a0_0x23a6f4(0x209)](0x0));function getCliArg(_0xb8b05b){const _0xcd5c2b=a0_0x23a6f4;for(let _0x519995=0x0;_0x519995<cliArgs[_0xcd5c2b(0x187)];_0x519995++){const _0x190f03=cliArgs[_0x519995];if(_0x190f03['startsWith']('--'+_0xb8b05b+'='))return _0x190f03[_0xcd5c2b(0x173)](('--'+_0xb8b05b+'=')[_0xcd5c2b(0x187)]);if(_0x190f03==='--'+_0xb8b05b&&_0x519995+0x1<cliArgs[_0xcd5c2b(0x187)])return cliArgs[_0x519995+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x23a6f4(0x187)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x23a6f4(0x24e)](arg)||HELP_FLAGS[a0_0x23a6f4(0x24e)](arg))continue;if(arg[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x215)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process['env'][a0_0x23a6f4(0x222)]||process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x167)]||process[a0_0x23a6f4(0x249)](),ENABLE_WORKSPACE_MODE=process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1d1)]!=='false',MORPH_API_KEY=getCliArg('api-key')??process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1e7)],MORPH_API_URL=process[a0_0x23a6f4(0x1b2)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x23a6f4(0x1f7)]?parseInt(process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1f7)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x23a6f4(0x231),a0_0x23a6f4(0x205),a0_0x23a6f4(0x15a)]),DISABLED_TOOLS=process[a0_0x23a6f4(0x1b2)][a0_0x23a6f4(0x1ed)]?new Set(process[a0_0x23a6f4(0x1b2)]['DISABLED_TOOLS'][a0_0x23a6f4(0x1cd)](',')[a0_0x23a6f4(0x236)](_0x577a1b=>_0x577a1b[a0_0x23a6f4(0x1fe)]())[a0_0x23a6f4(0x1d0)](_0x832cb=>_0x832cb[a0_0x23a6f4(0x187)]>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x23a6f4(0x24e)](tool)&&console['error'](a0_0x23a6f4(0x20c)+tool+a0_0x23a6f4(0x16c)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x23a6f4(0x1f4)](a0_0x23a6f4(0x1bc)+[...DISABLED_TOOLS][a0_0x23a6f4(0x1ca)](',\x20'));}function a0_0x6cf3(_0x392938,_0x3ef6eb){_0x392938=_0x392938-0x157;const _0x2f5768=a0_0x2f57();let _0x6cf34f=_0x2f5768[_0x392938];return _0x6cf34f;}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x265))&&!MORPH_API_KEY[a0_0x23a6f4(0x1aa)](a0_0x23a6f4(0x1e5))&&logMcpStderr(a0_0x23a6f4(0x1a0));async function reportMorphError(_0x21b85c){const _0x2226e2=a0_0x23a6f4;try{await a0_0x2d5c68['post'](_0x2226e2(0x182),{..._0x21b85c,'timestamp':new Date()[_0x2226e2(0x204)](),'source':_0x21b85c[_0x2226e2(0x17d)]||_0x2226e2(0x23f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x21b85c['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x2226e2(0x1b3),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x23a6f4(0x240)),logMcpStderr(a0_0x23a6f4(0x24c)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x23a6f4(0x1d7)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x23a6f4(0x224)));function normalizePath(_0x12114b){const _0x306574=a0_0x23a6f4;return a0_0x388e0f[_0x306574(0x203)](_0x12114b);}function expandHome(_0x515d8d){const _0x409be7=a0_0x23a6f4;if(_0x515d8d[_0x409be7(0x1aa)]('~/')||_0x515d8d==='~')return a0_0x388e0f[_0x409be7(0x1ca)](a0_0x477f98['homedir'](),_0x515d8d[_0x409be7(0x173)](0x1));return _0x515d8d;}let allowedDirectories=await Promise['all'](args[a0_0x23a6f4(0x236)](async _0x1fda58=>{const _0x353f0c=expandHome(_0x1fda58),_0x35b7ba=a0_0x388e0f['resolve'](_0x353f0c);try{const _0x406947=await a0_0x372d7a['realpath'](_0x35b7ba);return normalizePath(_0x406947);}catch(_0x263e33){return normalizePath(_0x35b7ba);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x23a6f4(0x187)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x23a6f4(0x21f)](workspaceDir),logMcpStderr(a0_0x23a6f4(0x16a)+workspaceDir+a0_0x23a6f4(0x19e)));}catch(a0_0x7084ff){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x7084ff);}async function detectWorkspaceRoot(_0x3c2420){const _0xd369d8=a0_0x23a6f4;let _0x4bd508=a0_0x388e0f['resolve'](_0x3c2420);const _0x1870cb=[_0xd369d8(0x226),_0xd369d8(0x19f),_0xd369d8(0x196),_0xd369d8(0x248),_0xd369d8(0x24d),_0xd369d8(0x184),'.cursor','tsconfig.json',_0xd369d8(0x239)];while(_0x4bd508!==a0_0x388e0f[_0xd369d8(0x254)](_0x4bd508)){for(const _0x34bd4e of _0x1870cb){const _0x8c06e2=a0_0x388e0f['join'](_0x4bd508,_0x34bd4e);try{return await a0_0x372d7a[_0xd369d8(0x22a)](_0x8c06e2),normalizePath(_0x4bd508);}catch{}}_0x4bd508=a0_0x388e0f[_0xd369d8(0x254)](_0x4bd508);}return normalizePath(_0x3c2420);}await Promise[a0_0x23a6f4(0x161)](args[a0_0x23a6f4(0x236)](async _0x5705e3=>{const _0x4b3042=a0_0x23a6f4;try{const _0x2e6beb=await a0_0x372d7a['stat'](expandHome(_0x5705e3));!_0x2e6beb[_0x4b3042(0x217)]()&&(logMcpStderr(_0x4b3042(0x1cf)+_0x5705e3+_0x4b3042(0x1a4)),process[_0x4b3042(0x209)](0x1));}catch(_0x5c1aee){logMcpStderr(_0x4b3042(0x22e)+_0x5705e3+':',_0x5c1aee),process[_0x4b3042(0x209)](0x1);}}));async function validatePath(_0x4f52ea){const _0x2b73f7=a0_0x23a6f4,_0x18abda=expandHome(_0x4f52ea),_0x1566fc=a0_0x388e0f[_0x2b73f7(0x1b8)](_0x18abda);try{const _0xc00ac1=await a0_0x372d7a[_0x2b73f7(0x234)](_0x1566fc);return _0xc00ac1;}catch(_0x43dbf8){if(_0x43dbf8[_0x2b73f7(0x1c1)]===_0x2b73f7(0x1c8)){const _0x37b159=a0_0x388e0f[_0x2b73f7(0x254)](_0x1566fc);try{const _0x30491e=await a0_0x372d7a[_0x2b73f7(0x234)](_0x37b159);return a0_0x388e0f['join'](_0x30491e,a0_0x388e0f[_0x2b73f7(0x20e)](_0x1566fc));}catch{throw new Error(_0x2b73f7(0x170)+_0x37b159);}}throw _0x43dbf8;}}const MorphEditFileArgsSchema=z[a0_0x23a6f4(0x228)]({'path':z[a0_0x23a6f4(0x23d)](),'code_edit':z['string']()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x260)),'dryRun':z[a0_0x23a6f4(0x1e4)]()[a0_0x23a6f4(0x230)](![])[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x1be))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x23a6f4(0x210),WarpGrepArgsSchema=z[a0_0x23a6f4(0x228)]({'search_string':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x23a6f4(0x23d)]()['describe'](a0_0x23a6f4(0x17e)),'search_type':z[a0_0x23a6f4(0x1e3)]([a0_0x23a6f4(0x230),a0_0x23a6f4(0x264)])['optional']()['describe'](a0_0x23a6f4(0x21b))}),WarpGrepGitHubArgsSchema=z[a0_0x23a6f4(0x228)]({'search_string':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x22d)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()['describe'](a0_0x23a6f4(0x212)),'branch':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x22d)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x23a6f4(0x22d)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x23a6f4(0x23d)]()['describe'](a0_0x23a6f4(0x1ba)),'branch':z[a0_0x23a6f4(0x23d)]()['optional']()['describe'](a0_0x23a6f4(0x1ee)),'commitHash':z[a0_0x23a6f4(0x23d)]()[a0_0x23a6f4(0x1eb)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x23a6f4(0x23d)]())[a0_0x23a6f4(0x230)]([])[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x202)),'limit':z['number']()[a0_0x23a6f4(0x1eb)]()[a0_0x23a6f4(0x230)](0xa)[a0_0x23a6f4(0x22d)](a0_0x23a6f4(0x262))}),server=new Server({'name':a0_0x23a6f4(0x201),'version':a0_0x23a6f4(0x1ad)},{'capabilities':{'tools':{}}});server[a0_0x23a6f4(0x1ef)](ListToolsRequestSchema,async()=>{const _0x292d00=a0_0x23a6f4,_0x26a311=[{'name':_0x292d00(0x231),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x292d00(0x1ec)+_0x292d00(0x193)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+_0x292d00(0x1c6)+_0x292d00(0x23c)+_0x292d00(0x17b)+_0x292d00(0x15b)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x292d00(0x15e)+_0x292d00(0x214)+'For\x20deletions:\x0a'+_0x292d00(0x1f8)+_0x292d00(0x1d5)+_0x292d00(0x1e0)+_0x292d00(0x21d)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x292d00(0x19d)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x292d00(0x225)+_0x292d00(0x1c3)+'IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x292d00(0x205),'description':_0x292d00(0x1a1)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x292d00(0x1fa)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x34fe8f=_0x26a311[_0x292d00(0x1d0)](_0x19d560=>{const _0x47bf7c=_0x292d00;if(DISABLED_TOOLS[_0x47bf7c(0x24e)](_0x19d560[_0x47bf7c(0x1bb)]))return console['error']('Tool\x20'+_0x19d560['name']+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x47bf7c(0x250)in _0x19d560&&_0x19d560[_0x47bf7c(0x250)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x19d560[_0x47bf7c(0x1bb)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x34fe8f['map'](_0x551b22=>({'name':_0x551b22[_0x292d00(0x1bb)],'description':_0x551b22[_0x292d00(0x1d8)],'inputSchema':_0x551b22['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0xe153fb=>{const _0x3e4c67=a0_0x23a6f4,{name:_0x4dc166,arguments:_0x125058}=_0xe153fb[_0x3e4c67(0x15f)];try{if(DISABLED_TOOLS[_0x3e4c67(0x24e)](_0x4dc166))throw new Error(_0x3e4c67(0x223)+_0x4dc166+_0x3e4c67(0x218));switch(_0x4dc166){case _0x3e4c67(0x231):{const _0x579491=MorphEditFileArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x579491[_0x3e4c67(0x164)])throw new Error(_0x3e4c67(0x261)+_0x579491['error']);const _0x46e233=await validatePath(_0x579491[_0x3e4c67(0x207)]['path']);let _0x2764a8=null,_0x27deb6=!![],_0xbd2a63=null;try{_0x2764a8=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x46e233,_0x3e4c67(0x18f));}catch(_0x32fcac){const _0x35e6b6=_0x32fcac[_0x3e4c67(0x1c1)];_0x35e6b6===_0x3e4c67(0x1c8)?(_0x27deb6=![],_0x2764a8=''):(_0xbd2a63=_0x3e4c67(0x175)+(_0x35e6b6||_0x3e4c67(0x1f1))+_0x3e4c67(0x192)+(_0x32fcac instanceof Error?_0x32fcac[_0x3e4c67(0x166)]:String(_0x32fcac)),logMcpStderr(_0x3e4c67(0x185)+_0xbd2a63));}let _0x5cc0b3;try{const _0x1572d5=MORPH_API_KEY;if(!_0x1572d5)throw new Error(_0x3e4c67(0x213));const _0xcc0734=a0_0x388e0f[_0x3e4c67(0x254)](_0x46e233),_0x1c1770=a0_0x388e0f[_0x3e4c67(0x20e)](_0x46e233),_0x10b9fa=await executeEditFile({'target_filepath':_0x1c1770,'code_edit':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x259)],'instructions':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)]},{'morphApiKey':_0x1572d5,'morphApiUrl':MORPH_API_URL,'baseDir':_0xcc0734,'autoWrite':!_0x579491[_0x3e4c67(0x207)]['dryRun'],'generateUdiff':![],'debug':![]});_0x5cc0b3=_0x10b9fa[_0x3e4c67(0x246)];if(!_0x10b9fa[_0x3e4c67(0x164)])throw new Error(_0x10b9fa['error']||_0x3e4c67(0x1e1));const _0x293050=_0x10b9fa[_0x3e4c67(0x237)],_0x8e61b5=_0x3e4c67(0x1d9)+_0x293050[_0x3e4c67(0x211)]+_0x3e4c67(0x263)+_0x293050[_0x3e4c67(0x253)]+',\x20modified\x20'+_0x293050[_0x3e4c67(0x21a)];if(_0x579491[_0x3e4c67(0x207)]['dryRun'])return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x162)+(_0x27deb6?'':'\x20(new\x20file)')+':\x20'+_0x579491['data'][_0x3e4c67(0x157)]+_0x3e4c67(0x17a)+_0x8e61b5+'.\x20Path:\x20'+_0x579491['data'][_0x3e4c67(0x1fb)]+'.'}]};return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1f0)+(_0x27deb6?_0x3e4c67(0x158):'Created\x20File')+':\x20'+_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)]+_0x3e4c67(0x17a)+_0x8e61b5+_0x3e4c67(0x16f)+_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1fb)]+'.'}]};}catch(_0x42f1f9){const _0x5d2c40=_0x42f1f9 instanceof Error?_0x42f1f9[_0x3e4c67(0x166)]:String(_0x42f1f9);return reportMorphError({'error_message':_0x5d2c40,'error_type':_0x42f1f9 instanceof Error?_0x42f1f9['constructor']['name']:'UnknownError','context':{'tool':_0x3e4c67(0x231),'completion_id':_0x5cc0b3,'file_path':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1fb)],'validated_path':_0x46e233,'instruction':_0x579491['data'][_0x3e4c67(0x157)],'model':_0x3e4c67(0x165),'dry_run':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1a7)],'file_exists':_0x27deb6,'file_read_error':_0xbd2a63,'file_readable':_0x2764a8!==null,'request_content':{'path':_0x579491['data']['path'],'code_edit':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x259)],'instruction':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x157)],'original_code':_0x2764a8!==null?_0x2764a8['length']>0xc350?_0x2764a8[_0x3e4c67(0x18b)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x2764a8[_0x3e4c67(0x187)]+'\x20chars)':_0x2764a8:_0x3e4c67(0x247)+(_0xbd2a63||_0x3e4c67(0x235))+']','original_code_length':_0x2764a8?.[_0x3e4c67(0x187)]??0x0,'model':_0x3e4c67(0x165),'dry_run':_0x579491[_0x3e4c67(0x207)][_0x3e4c67(0x1a7)]}},'stack_trace':_0x42f1f9 instanceof Error?_0x42f1f9['stack']:undefined,'source':_0x3e4c67(0x23f)})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1f5)+_0x5d2c40}],'isError':!![]};}}case _0x3e4c67(0x205):{const _0x32f81a=WarpGrepArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x32f81a['success'])return{'content':[{'type':_0x3e4c67(0x21c),'text':'Invalid\x20arguments:\x20'+_0x32f81a[_0x3e4c67(0x1f4)]}],'isError':!![]};const _0x4710a2=_0x30396d=>{const _0x5cf2f6=_0x3e4c67,_0x4581de=[];for(const _0x333390 of _0x30396d||[]){if(_0x333390[_0x5cf2f6(0x191)]===_0x5cf2f6(0x1bf)&&Array['isArray'](_0x333390[_0x5cf2f6(0x251)]))for(const _0x59da43 of _0x333390[_0x5cf2f6(0x251)]){try{const _0x429988=_0x59da43[_0x5cf2f6(0x15d)]?.[_0x5cf2f6(0x1bb)],_0x10cb85=JSON[_0x5cf2f6(0x197)](_0x59da43['function']?.[_0x5cf2f6(0x1c5)]||'{}');if(_0x429988==='grep_search')_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x243)+_0x10cb85['pattern']+'\x27\x20'+(_0x10cb85[_0x5cf2f6(0x1fb)]||'.'));else{if(_0x429988===_0x5cf2f6(0x19c))_0x4581de[_0x5cf2f6(0x21f)]('read\x20'+_0x10cb85['path']);else{if(_0x429988==='list_directory')_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x189)+(_0x10cb85[_0x5cf2f6(0x1f3)]||'.'));else{if(_0x429988===_0x5cf2f6(0x17c))_0x4581de['push'](_0x5cf2f6(0x168)+_0x10cb85[_0x5cf2f6(0x1a3)]+'\x27\x20'+(_0x10cb85['path']||'.'));else _0x429988==='finish'&&_0x4581de[_0x5cf2f6(0x21f)](_0x5cf2f6(0x24a));}}}}catch{}}}return _0x4581de;},_0x450d45=_0x3abe52=>{const _0x14e55f=_0x3e4c67,_0x2f5015=[];if(!_0x3abe52||!Array[_0x14e55f(0x160)](_0x3abe52))return _0x2f5015;const _0x1407ff=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x14e55f(0x1b1),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x14e55f(0x195),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x14e55f(0x1e2),'tool':_0x14e55f(0x19c)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x14e55f(0x23a),'tool':_0x14e55f(0x1b5)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x14e55f(0x1ce),'tool':_0x14e55f(0x1b5)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x14e55f(0x1e2),'tool':_0x14e55f(0x19c)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x14e55f(0x19c)},{'pattern':/not a text file/,'error_type':_0x14e55f(0x1e2),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x14e55f(0x1f2),'tool':_0x14e55f(0x19c)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x14e55f(0x19c)},{'pattern':/status="error"/,'error_type':_0x14e55f(0x169),'tool':_0x14e55f(0x1f1)}];let _0x4a0557=0x0;for(const _0x4fde3f of _0x3abe52){_0x4fde3f[_0x14e55f(0x191)]===_0x14e55f(0x1bf)&&Array[_0x14e55f(0x160)](_0x4fde3f[_0x14e55f(0x251)])&&_0x4a0557++;const _0x3b9992=_0x4fde3f[_0x14e55f(0x1d3)];if((_0x4fde3f['role']===_0x14e55f(0x22f)||_0x4fde3f['role']===_0x14e55f(0x233))&&_0x3b9992&&typeof _0x3b9992===_0x14e55f(0x23d))for(const {pattern:_0x2f8b6f,error_type:_0x2b1594,tool:_0x11f69e}of _0x1407ff){const _0x42c768=_0x3b9992[_0x14e55f(0x19b)](new RegExp(_0x2f8b6f[_0x14e55f(0x17d)],'g'));if(_0x42c768)for(const _0x367f7c of _0x42c768){const _0x5c9a06=_0x3b9992[_0x14e55f(0x241)](_0x367f7c),_0x28da35=_0x3b9992[_0x14e55f(0x18b)](_0x5c9a06,Math[_0x14e55f(0x1dd)](_0x5c9a06+0xc8,_0x3b9992[_0x14e55f(0x187)]));_0x2f5015[_0x14e55f(0x21f)]({'tool':_0x11f69e,'error_type':_0x2b1594,'error_message':_0x28da35['split']('\x0a')[0x0],'turn':_0x4a0557});}}}return _0x2f5015;};try{const _0x5d6553=a0_0x388e0f['resolve'](_0x32f81a['data'][_0x3e4c67(0x19a)]),_0xf5e966=_0x32f81a['data'][_0x3e4c67(0x25d)],_0x17d9b8=_0xf5e966===_0x3e4c67(0x264)?{'allowNames':[_0x3e4c67(0x264)]}:undefined,_0x33f375=new LocalRipgrepProvider(_0x5d6553,undefined,_0x17d9b8),_0x524c58=await runWarpGrep({'searchTerm':_0x32f81a[_0x3e4c67(0x207)]['search_string'],'repoRoot':_0x5d6553,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x33f375,'search_type':_0xf5e966}),_0x24e387=_0x450d45(_0x524c58['messages']);_0x24e387[_0x3e4c67(0x187)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x24e387[_0x3e4c67(0x187)]+_0x3e4c67(0x17f),'error_type':_0x3e4c67(0x1d4),'level':_0x3e4c67(0x1ff),'tool':_0x3e4c67(0x205),'context':{'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x524c58[_0x3e4c67(0x229)],'sub_tool_errors':_0x24e387,'timings':_0x524c58[_0x3e4c67(0x227)],'tool_calls':_0x4710a2(_0x524c58[_0x3e4c67(0x25c)]),'messages':_0x524c58[_0x3e4c67(0x25c)]?.[_0x3e4c67(0x236)](_0x506d83=>({'role':_0x506d83[_0x3e4c67(0x191)],'content':_0x506d83[_0x3e4c67(0x1d3)],..._0x506d83[_0x3e4c67(0x251)]?{'tool_calls':_0x506d83[_0x3e4c67(0x251)][_0x3e4c67(0x187)]}:{},..._0x506d83['tool_call_id']?{'tool_call_id':_0x506d83[_0x3e4c67(0x1af)]}:{}}))},'source':_0x3e4c67(0x23f)})['catch'](()=>{});let _0x50fda5='';if(_0x524c58[_0x3e4c67(0x229)]===_0x3e4c67(0x178)&&_0x524c58[_0x3e4c67(0x24a)]?.['metadata']?.[_0x3e4c67(0x1ea)]){const _0x591545=_0x524c58[_0x3e4c67(0x24a)][_0x3e4c67(0x199)][_0x3e4c67(0x1ea)];if(_0x591545[_0x3e4c67(0x187)]===0x0)return _0x50fda5=_0x524c58['finish'][_0x3e4c67(0x172)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':'text','text':_0x50fda5}]};const _0xd395a2=[],_0x11c5a2=[_0x3e4c67(0x1b7)];for(const _0x1b489e of _0x524c58[_0x3e4c67(0x25c)]){if(_0x1b489e[_0x3e4c67(0x191)]===_0x3e4c67(0x1bf)&&Array[_0x3e4c67(0x160)](_0x1b489e[_0x3e4c67(0x251)]))for(const _0xd7c578 of _0x1b489e[_0x3e4c67(0x251)]){try{const _0xb4845b=_0xd7c578['function']?.['name'],_0x436d21=JSON['parse'](_0xd7c578[_0x3e4c67(0x15d)]?.['arguments']||'{}');if(_0xb4845b==='grep_search')_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x1e8)+_0x436d21[_0x3e4c67(0x1a3)]+_0x3e4c67(0x1ac)+(_0x436d21[_0x3e4c67(0x1fb)]||'.')+'`');else{if(_0xb4845b===_0x3e4c67(0x19c))_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x190)+_0x436d21[_0x3e4c67(0x1fb)]+'`');else{if(_0xb4845b==='list_directory')_0x11c5a2['push'](_0x3e4c67(0x171)+(_0x436d21[_0x3e4c67(0x1f3)]||'.')+'`');else _0xb4845b===_0x3e4c67(0x17c)&&_0x11c5a2[_0x3e4c67(0x21f)](_0x3e4c67(0x238)+_0x436d21['pattern']+_0x3e4c67(0x255)+(_0x436d21['path']||'.')+'`');}}}catch{}}}_0xd395a2[_0x3e4c67(0x21f)](_0x11c5a2[_0x3e4c67(0x1ca)]('\x0a'));const _0x1e9937=['',_0x3e4c67(0x244)];for(const _0x196c38 of _0x591545){if(_0x196c38[_0x3e4c67(0x1a6)]==='*')_0x1e9937[_0x3e4c67(0x21f)]('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':*');else{if(Array['isArray'](_0x196c38[_0x3e4c67(0x1a6)])){const _0x2c7d51=_0x196c38[_0x3e4c67(0x1a6)][_0x3e4c67(0x236)](([_0x4ef144,_0x23d34d])=>{if(_0x4ef144===_0x23d34d)return''+_0x4ef144;return _0x4ef144+'-'+_0x23d34d;});_0x1e9937['push']('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':'+_0x2c7d51[_0x3e4c67(0x1ca)](','));}else _0x1e9937[_0x3e4c67(0x21f)]('-\x20'+_0x196c38[_0x3e4c67(0x1fb)]+':*');}}_0x1e9937['push'](''),_0xd395a2[_0x3e4c67(0x21f)](_0x1e9937['join']('\x0a')),_0xd395a2[_0x3e4c67(0x21f)](_0x3e4c67(0x220));const _0x57f3ad=[];for(const _0x363f63 of _0x591545){let _0x1c345b=a0_0x388e0f['resolve'](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],_0x363f63[_0x3e4c67(0x1fb)]),_0x1d5d09=null,_0x49ef77=null;try{_0x1d5d09=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x1c345b,{'encoding':_0x3e4c67(0x18f)});}catch(_0x1ad704){const _0x1ba6f6=fixPathRepetition(_0x1c345b);if(_0x1ba6f6)try{_0x1d5d09=await a0_0x372d7a[_0x3e4c67(0x1de)](_0x1ba6f6,{'encoding':_0x3e4c67(0x18f)}),_0x1c345b=_0x1ba6f6;}catch{_0x49ef77=_0x1ad704 instanceof Error?_0x1ad704:new Error(String(_0x1ad704));}else _0x49ef77=_0x1ad704 instanceof Error?_0x1ad704:new Error(String(_0x1ad704));}if(_0x1d5d09!==null){const _0x30623f=_0x1d5d09[_0x3e4c67(0x1cd)](/\r?\n/),_0x30f839=[_0x3e4c67(0x18a)+_0x363f63[_0x3e4c67(0x1fb)]+'\x22>'];if(_0x363f63[_0x3e4c67(0x1a6)]==='*'||!Array[_0x3e4c67(0x160)](_0x363f63[_0x3e4c67(0x1a6)]))for(let _0x45b319=0x1;_0x45b319<=_0x30623f['length'];_0x45b319++){const _0x1237d1=_0x30623f[_0x45b319-0x1];_0x30f839[_0x3e4c67(0x21f)](_0x45b319+'|\x20'+_0x1237d1);}else for(const [_0x843ca1,_0x4ff3ec]of _0x363f63[_0x3e4c67(0x1a6)]){_0x30f839[_0x3e4c67(0x187)]>0x1&&_0x30f839[_0x3e4c67(0x21f)]('');for(let _0x586858=_0x843ca1;_0x586858<=_0x4ff3ec&&_0x586858<=_0x30623f['length'];_0x586858++){const _0x15eeac=_0x30623f[_0x586858-0x1];_0x30f839['push'](_0x586858+'|\x20'+_0x15eeac);}}_0x30f839['push']('</file>'),_0x57f3ad[_0x3e4c67(0x21f)](_0x30f839['join']('\x0a'));}else _0x57f3ad['push'](_0x3e4c67(0x18a)+_0x363f63[_0x3e4c67(0x1fb)]+_0x3e4c67(0x179)+(_0x49ef77?.['message']||_0x3e4c67(0x258))+_0x3e4c67(0x242));}_0xd395a2[_0x3e4c67(0x21f)](_0x57f3ad[_0x3e4c67(0x1ca)]('\x0a\x0a')),_0x50fda5=_0xd395a2[_0x3e4c67(0x1ca)]('\x0a');const _0xc4470a=_0x524c58[_0x3e4c67(0x268)]?.[_0x3e4c67(0x1d0)](_0x4d95dc=>_0x4d95dc[_0x3e4c67(0x166)]?.[_0x3e4c67(0x1aa)](_0x3e4c67(0x20f)))||[];if(_0xc4470a['length']>0x0){const _0x3dacd8=_0xc4470a[_0x3e4c67(0x236)](_0x4df51d=>_0x4df51d['message'])['join'](';\x20');reportMorphError({'error_message':_0x3dacd8,'error_type':_0x3e4c67(0x176),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x3e4c67(0x200),'error_count':_0xc4470a['length'],'is_timeout':![],'timings':_0x524c58[_0x3e4c67(0x227)],'files_attempted':_0x591545['map'](_0x3a7eac=>({'path':_0x3a7eac[_0x3e4c67(0x1fb)],'lines':_0x3a7eac[_0x3e4c67(0x1a6)]})),'tool_calls':_0x4710a2(_0x524c58[_0x3e4c67(0x25c)]),'messages':_0x524c58['messages']?.[_0x3e4c67(0x236)](_0x5dab11=>({'role':_0x5dab11[_0x3e4c67(0x191)],'content':_0x5dab11['content'],..._0x5dab11[_0x3e4c67(0x251)]?{'tool_calls':_0x5dab11['tool_calls'][_0x3e4c67(0x187)]}:{},..._0x5dab11['tool_call_id']?{'tool_call_id':_0x5dab11[_0x3e4c67(0x1af)]}:{}})),'request_content':{'query':_0x32f81a[_0x3e4c67(0x207)]['search_string'],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)]['repo_path']),'model':_0x3e4c67(0x1c2)}},'source':_0x3e4c67(0x23f)})['catch'](()=>{});}}else{if(_0x524c58[_0x3e4c67(0x229)]==='terminated'&&_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x187)]>0x0){const _0x512ccd=_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x236)](_0x1134ea=>_0x1134ea[_0x3e4c67(0x166)])['join'](';\x20');_0x50fda5='Error:\x20'+_0x512ccd;const _0xc7701c=_0x512ccd['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x1a9))||_0x512ccd['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x163))||_0x512ccd[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x245)),_0x3a3edb=_0x524c58[_0x3e4c67(0x24a)]?.['metadata']?.[_0x3e4c67(0x1ea)],_0xcf0738=_0x524c58[_0x3e4c67(0x268)][0x0];reportMorphError({'error_message':_0x512ccd,'error_type':_0xc7701c?_0x3e4c67(0x1a8):_0xcf0738?.[_0x3e4c67(0x20d)]?.[_0x3e4c67(0x1bb)]||_0x3e4c67(0x16b),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a['data'][_0x3e4c67(0x19a)],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'termination_reason':_0x524c58['terminationReason'],'error_count':_0x524c58[_0x3e4c67(0x268)][_0x3e4c67(0x187)],'is_timeout':_0xc7701c,'timings':_0x524c58[_0x3e4c67(0x227)],'files_attempted':_0x3a3edb?.[_0x3e4c67(0x236)](_0x1cd144=>({'path':_0x1cd144[_0x3e4c67(0x1fb)],'lines':_0x1cd144['lines']})),'tool_calls':_0x4710a2(_0x524c58['messages']),'messages':_0x524c58['messages']?.['map'](_0x5b29d2=>({'role':_0x5b29d2[_0x3e4c67(0x191)],'content':_0x5b29d2['content'],..._0x5b29d2[_0x3e4c67(0x251)]?{'tool_calls':_0x5b29d2[_0x3e4c67(0x251)]['length']}:{},..._0x5b29d2['tool_call_id']?{'tool_call_id':_0x5b29d2[_0x3e4c67(0x1af)]}:{}})),'request_content':{'query':_0x32f81a['data']['search_string'],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)]),'model':_0x3e4c67(0x1c2)}},'stack_trace':_0xcf0738?.[_0x3e4c67(0x180)]||undefined,'source':_0x3e4c67(0x23f)})['catch'](()=>{});}else _0x50fda5=_0x3e4c67(0x1f9);}return{'content':[{'type':'text','text':_0x50fda5}]};}catch(_0x284ee1){const _0x17658a=_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x166)]:String(_0x284ee1),_0x381601=_0x17658a['toLowerCase']()[_0x3e4c67(0x1b4)](_0x3e4c67(0x1a9))||_0x17658a[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x163))||_0x17658a[_0x3e4c67(0x1dc)]()[_0x3e4c67(0x1b4)](_0x3e4c67(0x245))||_0x284ee1 instanceof Error&&_0x284ee1['name']===_0x3e4c67(0x1a8);return reportMorphError({'error_message':_0x17658a,'error_type':_0x381601?_0x3e4c67(0x1a8):_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':_0x3e4c67(0x205),'repo_path':_0x32f81a[_0x3e4c67(0x207)]['repo_path'],'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'model':_0x3e4c67(0x1c2),'is_timeout':_0x381601,'exception_phase':_0x3e4c67(0x208),'request_content':{'query':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'repo_path':_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)],'repoRoot':a0_0x388e0f[_0x3e4c67(0x1b8)](_0x32f81a[_0x3e4c67(0x207)][_0x3e4c67(0x19a)]),'model':_0x3e4c67(0x1c2)}},'stack_trace':_0x284ee1 instanceof Error?_0x284ee1[_0x3e4c67(0x180)]:undefined,'source':_0x3e4c67(0x23f)})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1c0)+_0x17658a}],'isError':![]};}}case _0x3e4c67(0x15a):{const _0x58cd5f=WarpGrepGitHubArgsSchema[_0x3e4c67(0x22b)](_0x125058);if(!_0x58cd5f[_0x3e4c67(0x164)])return{'content':[{'type':_0x3e4c67(0x21c),'text':'Invalid\x20arguments:\x20'+_0x58cd5f[_0x3e4c67(0x1f4)]}],'isError':!![]};const _0x12374b=_0x58cd5f[_0x3e4c67(0x207)]['github_url']||_0x58cd5f[_0x3e4c67(0x207)]['owner_repo'];if(!_0x12374b)return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1b0)}],'isError':!![]};const _0x42bda8=MORPH_API_KEY;if(!_0x42bda8)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x272149=Date[_0x3e4c67(0x1d2)]();logMcpStderr('[github_codebase_search]\x20Searching\x20'+_0x12374b+_0x3e4c67(0x1c9)+_0x58cd5f[_0x3e4c67(0x207)]['search_string']+'\x22');try{const _0xbe4cb9=new WarpGrepClient({'morphApiKey':_0x42bda8,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x31ea58=await _0xbe4cb9[_0x3e4c67(0x206)]({'searchTerm':_0x58cd5f['data'][_0x3e4c67(0x25a)],'github':_0x12374b,'branch':_0x58cd5f[_0x3e4c67(0x207)][_0x3e4c67(0x174)]}),_0x397be0=Date[_0x3e4c67(0x1d2)]()-_0x272149;logMcpStderr(_0x3e4c67(0x23e)+_0x397be0+_0x3e4c67(0x1da)+_0x31ea58['success']);const _0x5acd50=formatResult(_0x31ea58);return{'content':[{'type':_0x3e4c67(0x21c),'text':_0x5acd50}]};}catch(_0x171d63){const _0x5ef0da=Date[_0x3e4c67(0x1d2)]()-_0x272149,_0x46bd95=_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x166)]:String(_0x171d63);return logMcpStderr(_0x3e4c67(0x18e)+_0x5ef0da+_0x3e4c67(0x186),_0x46bd95),reportMorphError({'error_message':_0x46bd95,'error_type':_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':'github_codebase_search','github_url':_0x12374b,'search_string':_0x58cd5f[_0x3e4c67(0x207)][_0x3e4c67(0x25a)],'branch':_0x58cd5f[_0x3e4c67(0x207)]['branch']},'stack_trace':_0x171d63 instanceof Error?_0x171d63[_0x3e4c67(0x180)]:undefined,'source':_0x3e4c67(0x23f),'tool':_0x3e4c67(0x15a),'latency_ms':_0x5ef0da})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x188)+_0x46bd95}],'isError':![]};}}default:throw new Error(_0x3e4c67(0x22c)+_0x4dc166);}}catch(_0x5abe02){const _0x142684=_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x166)]:String(_0x5abe02);return reportMorphError({'error_message':_0x142684,'error_type':_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x20d)][_0x3e4c67(0x1bb)]:_0x3e4c67(0x1a2),'context':{'tool':_0x4dc166,'arguments':_0x125058?JSON[_0x3e4c67(0x24f)](_0x125058)[_0x3e4c67(0x18b)](0x0,0x1f4):undefined,'mcp_server_version':_0x3e4c67(0x1ad)},'stack_trace':_0x5abe02 instanceof Error?_0x5abe02[_0x3e4c67(0x180)]:undefined,'source':'mcp-filesystem'})[_0x3e4c67(0x177)](()=>{}),{'content':[{'type':_0x3e4c67(0x21c),'text':_0x3e4c67(0x1cf)+_0x142684}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2571de){const _0x56867a=a0_0x23a6f4,_0x5df25c=await getValidRootDirectories(_0x2571de);if(_0x5df25c[_0x56867a(0x187)]>0x0)allowedDirectories=[..._0x5df25c],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x5df25c[_0x56867a(0x187)]+_0x56867a(0x1bd));else{logMcpStderr(_0x56867a(0x1e6));if(ENABLE_WORKSPACE_MODE)try{const _0x268a5a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x268a5a&&(allowedDirectories=[_0x268a5a],logMcpStderr(_0x56867a(0x219)+_0x268a5a));}catch(_0xeac7a3){logMcpStderr(_0x56867a(0x21e)+_0xeac7a3);}}}server[a0_0x23a6f4(0x232)](RootsListChangedNotificationSchema,async()=>{const _0x39add3=a0_0x23a6f4;try{const _0x23518b=await server[_0x39add3(0x221)]();_0x23518b&&_0x39add3(0x15c)in _0x23518b&&await updateAllowedDirectoriesFromRoots(_0x23518b[_0x39add3(0x15c)]);}catch(_0x398086){logMcpStderr(_0x39add3(0x194),_0x398086 instanceof Error?_0x398086[_0x39add3(0x166)]:String(_0x398086));}}),server[a0_0x23a6f4(0x1fd)]=async()=>{const _0xf602e5=a0_0x23a6f4,_0x56b837=server[_0xf602e5(0x267)]();if(_0x56b837?.[_0xf602e5(0x15c)])try{const _0x4540d6=await server[_0xf602e5(0x221)]();_0x4540d6&&_0xf602e5(0x15c)in _0x4540d6?await updateAllowedDirectoriesFromRoots(_0x4540d6[_0xf602e5(0x15c)]):logMcpStderr(_0xf602e5(0x181));}catch(_0x32d77f){logMcpStderr(_0xf602e5(0x1a5),_0x32d77f instanceof Error?_0x32d77f['message']:String(_0x32d77f));}else{if(allowedDirectories[_0xf602e5(0x187)]>0x0)logMcpStderr(_0xf602e5(0x1df),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0xf602e5(0x20b));else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};async function runServer(){const _0x340fd3=a0_0x23a6f4,_0x39d48f=new StdioServerTransport();await server[_0x340fd3(0x1cc)](_0x39d48f),logMcpStderr(_0x340fd3(0x16d)),allowedDirectories['length']===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x23a6f4(0x177)](_0x319a74=>{const _0x3c635d=a0_0x23a6f4;logMcpStderr(_0x3c635d(0x256),_0x319a74),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a1_0x144c(_0x233157,_0x2f157d){_0x233157=_0x233157-0x1b5;var _0x4c1caa=a1_0x4c1c();var _0x144ce3=_0x4c1caa[_0x233157];return _0x144ce3;}(function(_0x9f4f08,_0x17db69){var _0x2ee89a=a1_0x144c,_0x5b4cde=_0x9f4f08();while(!![]){try{var _0x3d976d=parseInt(_0x2ee89a(0x1c0))/0x1+-parseInt(_0x2ee89a(0x1bc))/0x2+-parseInt(_0x2ee89a(0x1c3))/0x3+parseInt(_0x2ee89a(0x1bf))/0x4+parseInt(_0x2ee89a(0x1c5))/0x5*(-parseInt(_0x2ee89a(0x1b5))/0x6)+-parseInt(_0x2ee89a(0x1b9))/0x7+parseInt(_0x2ee89a(0x1c1))/0x8*(parseInt(_0x2ee89a(0x1c2))/0x9);if(_0x3d976d===_0x17db69)break;else _0x5b4cde['push'](_0x5b4cde['shift']());}catch(_0x4eaa89){_0x5b4cde['push'](_0x5b4cde['shift']());}}}(a1_0x4c1c,0xab01c));import a1_0x372b4d from'os';export function getOperatingSystemType(_0x34b2ff=a1_0x372b4d['platform']()){var _0x18bc08=a1_0x144c;switch(_0x34b2ff){case'darwin':return _0x18bc08(0x1b8);case _0x18bc08(0x1bb):return _0x18bc08(0x1b7);case _0x18bc08(0x1be):return _0x18bc08(0x1c4);default:return _0x18bc08(0x1ba);}}export function formatMcpLogMessage(_0x2db969,_0x527d2b=a1_0x372b4d['platform']()){var _0x33bb3d=a1_0x144c;return _0x33bb3d(0x1bd)+getOperatingSystemType(_0x527d2b)+']\x20'+_0x2db969;}export function logMcpStderr(_0x496d6e,..._0x48afbc){var _0x2b7ca4=a1_0x144c;console[_0x2b7ca4(0x1b6)](formatMcpLogMessage(_0x496d6e),..._0x48afbc);}function a1_0x4c1c(){var _0x1b0a81=['linux','2435336SZeSsV','393406VdzqAN','8bkDzpp','26220303gMORoq','3934107XZuJhE','Linux','1525sokFbB','4122hpbVrx','error','Windows','macOS','3356402wwuUlE','Unknown','win32','2429546YHFrav','[os='];a1_0x4c1c=function(){return _0x1b0a81;};return a1_0x4c1c();}
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1e7fe6,_0x4a2c6a){const _0x2a2c9f=a2_0x16cc,_0x215bd1=_0x1e7fe6();while(!![]){try{const _0xd606d4=-parseInt(_0x2a2c9f(0x1ab))/0x1*(parseInt(_0x2a2c9f(0x1a4))/0x2)+parseInt(_0x2a2c9f(0x1a9))/0x3*(parseInt(_0x2a2c9f(0x1a0))/0x4)+parseInt(_0x2a2c9f(0x1af))/0x5+parseInt(_0x2a2c9f(0x1a8))/0x6*(parseInt(_0x2a2c9f(0x1ae))/0x7)+parseInt(_0x2a2c9f(0x19e))/0x8+-parseInt(_0x2a2c9f(0x19d))/0x9+parseInt(_0x2a2c9f(0x1a3))/0xa;if(_0xd606d4===_0x4a2c6a)break;else _0x215bd1['push'](_0x215bd1['shift']());}catch(_0x69c594){_0x215bd1['push'](_0x215bd1['shift']());}}}(a2_0x114b,0xbeeea));function a2_0x16cc(_0x32e09d,_0x456eaf){_0x32e09d=_0x32e09d-0x19d;const _0x114b4b=a2_0x114b();let _0x16ccc1=_0x114b4b[_0x32e09d];return _0x16ccc1;}import a2_0x213326 from'path';function a2_0x114b(){const _0x53b53f=['5434855lcPhvP','9333558jNeAYZ','6256104kTjWUt','charAt','1652556puiKAo','replace','homedir','1745370CmrDCH','1792174IOLEne','trim','join','startsWith','1551282fbWLrG','3COldDC','slice','1KJNGwK','toUpperCase','match','7JeMlKE'];a2_0x114b=function(){return _0x53b53f;};return a2_0x114b();}import a2_0x5af5e4 from'os';export function convertToWindowsPath(_0x50ce00){const _0x3ee15a=a2_0x16cc;if(_0x50ce00['startsWith']('/mnt/')){const _0x3780d3=_0x50ce00[_0x3ee15a(0x19f)](0x5)[_0x3ee15a(0x1ac)](),_0x3f871c=_0x50ce00[_0x3ee15a(0x1aa)](0x6)['replace'](/\//g,'\x5c');return _0x3780d3+':'+_0x3f871c;}if(_0x50ce00[_0x3ee15a(0x1ad)](/^\/[a-zA-Z]\//)){const _0x18d589=_0x50ce00[_0x3ee15a(0x19f)](0x1)[_0x3ee15a(0x1ac)](),_0x2bc061=_0x50ce00['slice'](0x2)[_0x3ee15a(0x1a1)](/\//g,'\x5c');return _0x18d589+':'+_0x2bc061;}if(_0x50ce00[_0x3ee15a(0x1ad)](/^[a-zA-Z]:/))return _0x50ce00[_0x3ee15a(0x1a1)](/\//g,'\x5c');return _0x50ce00;}export function normalizePath(_0x44fe75){const _0x489f56=a2_0x16cc;_0x44fe75=_0x44fe75[_0x489f56(0x1a5)]()[_0x489f56(0x1a1)](/^["']|["']$/g,'');const _0x112858=_0x44fe75['startsWith']('/')&&!_0x44fe75[_0x489f56(0x1ad)](/^\/mnt\/[a-z]\//i)&&!_0x44fe75[_0x489f56(0x1ad)](/^\/[a-zA-Z]\//);if(_0x112858)return _0x44fe75[_0x489f56(0x1a1)](/\/+/g,'/')[_0x489f56(0x1a1)](/\/+$/,'');_0x44fe75=convertToWindowsPath(_0x44fe75);if(_0x44fe75[_0x489f56(0x1a7)]('\x5c\x5c')){let _0x4b7be0=_0x44fe75;_0x4b7be0=_0x4b7be0[_0x489f56(0x1a1)](/^\\{2,}/,'\x5c\x5c');const _0x22fa1e=_0x4b7be0['substring'](0x2)[_0x489f56(0x1a1)](/\\\\/g,'\x5c');_0x44fe75='\x5c\x5c'+_0x22fa1e;}else _0x44fe75=_0x44fe75[_0x489f56(0x1a1)](/\\\\/g,'\x5c');let _0x35ced0=a2_0x213326['normalize'](_0x44fe75);_0x44fe75[_0x489f56(0x1a7)]('\x5c\x5c')&&!_0x35ced0[_0x489f56(0x1a7)]('\x5c\x5c')&&(_0x35ced0='\x5c'+_0x35ced0);if(_0x35ced0['match'](/^[a-zA-Z]:/)){let _0x3f5610=_0x35ced0[_0x489f56(0x1a1)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x3f5610)&&(_0x3f5610=_0x3f5610[_0x489f56(0x19f)](0x0)[_0x489f56(0x1ac)]()+_0x3f5610[_0x489f56(0x1aa)](0x1)),_0x3f5610;}return _0x35ced0['replace'](/\//g,'\x5c');}export function expandHome(_0x25e372){const _0xb51537=a2_0x16cc;if(_0x25e372[_0xb51537(0x1a7)]('~/')||_0x25e372==='~')return a2_0x213326[_0xb51537(0x1a6)](a2_0x5af5e4[_0xb51537(0x1a2)](),_0x25e372[_0xb51537(0x1aa)](0x1));return _0x25e372;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xa3537d,_0x55a440){const _0x1378b4=a3_0x5a3b,_0x1e7ee3=_0xa3537d();while(!![]){try{const _0x379829=parseInt(_0x1378b4(0x127))/0x1+parseInt(_0x1378b4(0x124))/0x2+-parseInt(_0x1378b4(0x119))/0x3+-parseInt(_0x1378b4(0x11e))/0x4+parseInt(_0x1378b4(0x126))/0x5+-parseInt(_0x1378b4(0x120))/0x6+-parseInt(_0x1378b4(0x117))/0x7*(-parseInt(_0x1378b4(0x11c))/0x8);if(_0x379829===_0x55a440)break;else _0x1e7ee3['push'](_0x1e7ee3['shift']());}catch(_0x22f1b1){_0x1e7ee3['push'](_0x1e7ee3['shift']());}}}(a3_0x4f87,0xefb86));function a3_0x5a3b(_0x1cb8c9,_0x2b9262){_0x1cb8c9=_0x1cb8c9-0x116;const _0x4f875a=a3_0x4f87();let _0x5a3b74=_0x4f875a[_0x1cb8c9];return _0x5a3b74;}function a3_0x4f87(){const _0x115f88=['6322324CLWmUR','startsWith','10763400HCGthN','normalize','includes','some','2842850RKFQaP','isAbsolute','5050765MmQpKQ','405257DyEYvJ','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','28343PaixwO','string','3106137FBIiFd','length','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','5048inbZxJ','isArray'];a3_0x4f87=function(){return _0x115f88;};return a3_0x4f87();}import a3_0x1dff72 from'path';export function isPathWithinAllowedDirectories(_0x590e02,_0x43bf9a){const _0x5cf7f2=a3_0x5a3b;if(typeof _0x590e02!==_0x5cf7f2(0x118)||!Array[_0x5cf7f2(0x11d)](_0x43bf9a))return![];if(!_0x590e02||_0x43bf9a[_0x5cf7f2(0x11a)]===0x0)return![];if(_0x590e02[_0x5cf7f2(0x122)]('\x00'))return![];let _0x639be8;try{_0x639be8=a3_0x1dff72[_0x5cf7f2(0x128)](a3_0x1dff72['normalize'](_0x590e02));}catch{return![];}if(!a3_0x1dff72['isAbsolute'](_0x639be8))throw new Error(_0x5cf7f2(0x116));return _0x43bf9a[_0x5cf7f2(0x123)](_0x1a5a4d=>{const _0xc31f39=_0x5cf7f2;if(typeof _0x1a5a4d!==_0xc31f39(0x118)||!_0x1a5a4d)return![];if(_0x1a5a4d[_0xc31f39(0x122)]('\x00'))return![];let _0x9ab975;try{_0x9ab975=a3_0x1dff72[_0xc31f39(0x128)](a3_0x1dff72[_0xc31f39(0x121)](_0x1a5a4d));}catch{return![];}if(!a3_0x1dff72[_0xc31f39(0x125)](_0x9ab975))throw new Error(_0xc31f39(0x11b));if(_0x639be8===_0x9ab975)return!![];if(_0x9ab975===a3_0x1dff72['sep'])return _0x639be8[_0xc31f39(0x11f)](a3_0x1dff72['sep']);return _0x639be8[_0xc31f39(0x11f)](_0x9ab975+a3_0x1dff72['sep']);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x293950,_0x9503bb){const _0x178fc4=a4_0x477f,_0x57c898=_0x293950();while(!![]){try{const _0xee9dfb=-parseInt(_0x178fc4(0x18f))/0x1+parseInt(_0x178fc4(0x18c))/0x2*(parseInt(_0x178fc4(0x195))/0x3)+-parseInt(_0x178fc4(0x189))/0x4+-parseInt(_0x178fc4(0x18b))/0x5*(-parseInt(_0x178fc4(0x199))/0x6)+-parseInt(_0x178fc4(0x19b))/0x7+parseInt(_0x178fc4(0x198))/0x8+parseInt(_0x178fc4(0x18d))/0x9;if(_0xee9dfb===_0x9503bb)break;else _0x57c898['push'](_0x57c898['shift']());}catch(_0x3a69d3){_0x57c898['push'](_0x57c898['shift']());}}}(a4_0x1241,0x98e06));import{promises as a4_0x1740ca}from'fs';import a4_0x110c77 from'path';import a4_0x34da83 from'os';function a4_0x477f(_0x525a42,_0xbb98){_0x525a42=_0x525a42-0x187;const _0x124173=a4_0x1241();let _0x477f24=_0x124173[_0x525a42];return _0x477f24;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x16bd04){const _0x433351=a4_0x477f;try{const _0x28c398=_0x16bd04[_0x433351(0x18e)]('file://')?_0x16bd04[_0x433351(0x187)](0x7):_0x16bd04,_0x21fcff=_0x28c398['startsWith']('~/')||_0x28c398==='~'?a4_0x110c77['join'](a4_0x34da83[_0x433351(0x188)](),_0x28c398[_0x433351(0x187)](0x1)):_0x28c398,_0x1f7fa7=a4_0x110c77['resolve'](_0x21fcff),_0x3833d8=await a4_0x1740ca[_0x433351(0x193)](_0x1f7fa7);return normalizePath(_0x3833d8);}catch{return null;}}function a4_0x1241(){const _0x116650=['3lvFdhh','invalid\x20path\x20or\x20inaccessible','Skipping\x20invalid\x20directory:\x20','2369888EhasbP','4475886vChqvP','\x20due\x20to\x20error:\x20','5109741SIftQR','slice','homedir','1073044DfllgH','uri','5YRBMQQ','1201694yFUlSG','8988714mgZipK','startsWith','1017404AKclhp','push','isDirectory','non-directory\x20root','realpath','stat'];a4_0x1241=function(){return _0x116650;};return a4_0x1241();}function formatDirectoryError(_0xfab1a1,_0xb70d96,_0x597fa0){const _0x1096c9=a4_0x477f;if(_0x597fa0)return'Skipping\x20'+_0x597fa0+':\x20'+_0xfab1a1;const _0x277697=_0xb70d96 instanceof Error?_0xb70d96['message']:String(_0xb70d96);return _0x1096c9(0x197)+_0xfab1a1+_0x1096c9(0x19a)+_0x277697;}export async function getValidRootDirectories(_0x152b85){const _0x58176f=a4_0x477f,_0x1caa63=[];for(const _0xf415f2 of _0x152b85){const _0x259df0=await parseRootUri(_0xf415f2['uri']);if(!_0x259df0){logMcpStderr(formatDirectoryError(_0xf415f2[_0x58176f(0x18a)],undefined,_0x58176f(0x196)));continue;}try{const _0xf7626=await a4_0x1740ca[_0x58176f(0x194)](_0x259df0);_0xf7626[_0x58176f(0x191)]()?_0x1caa63[_0x58176f(0x190)](_0x259df0):logMcpStderr(formatDirectoryError(_0x259df0,undefined,_0x58176f(0x192)));}catch(_0x56339f){logMcpStderr(formatDirectoryError(_0x259df0,_0x56339f));}}return _0x1caa63;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.145",
|
|
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.150",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|