@morphllm/morphmcp 0.8.126 → 0.8.127
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/README.md +1 -1
- 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 +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Supercharge your coding agent. One MCP with two specialized tools for faster edi
|
|
|
8
8
|
|------|-------------|
|
|
9
9
|
| `edit_file` | Apply code changes at 10,500+ tokens/sec with 98% accuracy |
|
|
10
10
|
| `codebase_search` | Natural-language code exploration sub-agent backed by WarpGrep under the hood |
|
|
11
|
-
| `
|
|
11
|
+
| `github_codebase_search` | Search any public GitHub repo by URL or `owner/repo` shorthand |
|
|
12
12
|
|
|
13
13
|
All three tools are always exposed. Clients can manage tool visibility on their side.
|
|
14
14
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x58523c=a0_0x23f3;(function(_0x477c81,_0x24d203){const _0x1366ea=a0_0x23f3,_0x11fd8c=_0x477c81();while(!![]){try{const _0x38cfa8=parseInt(_0x1366ea(0x19c))/0x1+-parseInt(_0x1366ea(0x20b))/0x2*(parseInt(_0x1366ea(0x16d))/0x3)+-parseInt(_0x1366ea(0x1b0))/0x4+-parseInt(_0x1366ea(0x146))/0x5*(parseInt(_0x1366ea(0x141))/0x6)+-parseInt(_0x1366ea(0x1d3))/0x7+-parseInt(_0x1366ea(0x18c))/0x8*(-parseInt(_0x1366ea(0x136))/0x9)+parseInt(_0x1366ea(0x14e))/0xa;if(_0x38cfa8===_0x24d203)break;else _0x11fd8c['push'](_0x11fd8c['shift']());}catch(_0x42c5e1){_0x11fd8c['push'](_0x11fd8c['shift']());}}}(a0_0xc82c,0x8ccd3));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_0x46c3dc from'fs/promises';import a0_0x29e727 from'path';import a0_0x2b220c from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';function a0_0xc82c(){const _0x43f0ce=['messages','\x22>\x0aError\x20reading\x20file:\x20',',\x20modified\x20','path','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','SubToolError','log','--api-key=','FileNotFound','error','message','has','296344gubiDP','access','Max\x20results\x20to\x20return','list_directory\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','codebase_search','terminated','min','\x20-\x20','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','completed_with_file_errors','Error:\x20','split','catch','\x20error(s)','floor','Unknown\x20error','Unknown\x20tool:\x20','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','readFile','2208028XjGLlU','repo_path','describe','name','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','code_edit','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.','getClientCapabilities','linesRemoved','\x20for:\x20\x22','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','size','DISABLED_TOOLS','content','map','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Invalid\x20arguments:\x20','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','Warning:\x20Workspace\x20fallback\x20failed:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','❌\x20Morph\x20Edit\x20Failed:\x20','user','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','data','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Created\x20File','cwd','Benefits:\x0a','ENABLE_WORKSPACE_MODE','morph-','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Warning:\x20','timings','File\x20read\x20error:','listRoots','2260251AILzjH','@morphllm/morphmcp\x20','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','RipgrepNotAvailable','safeParse','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','fromCharCode','dirname','number','string','Morph\x20Edit\x20','unknown','setRequestHandler','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','[warpgrep_github_search]\x20Done\x20in\x20','0.2.0','push','requiresApiKey','now','\x0a</file>','code','ReadError','Workspace\x20mode\x20enabled:\x20Using\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','GitHub\x20search\x20failed:\x20','TimeoutError','object','application/json','search_type','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','FileReadError','ENOENT','UnknownError','enum','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','setNotificationHandler','metadata','linesAdded','<file\x20path=\x22','WarpGrep\x20sub-tool\x20errors:\x20','\x20as\x20allowed\x20directory','--api-key','branch','trim','stat','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','errors','.cursor','substring','every','some','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.','\x22.\x20Known\x20tools:\x20','realpath','length','34690EBlpsM','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Morph\x20Edit\x20Preview','ToolException','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','pyproject.toml','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_url','env','toLowerCase','instruction','owner_repo','\x27\x20in\x20`','Error\x20running\x20fast\x20context\x20search:\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','MORPH_WARP_GREP_TIMEOUT','ms.\x20Success:\x20','stack','slice','isDirectory','Failed\x20to\x20request\x20roots\x20from\x20client:','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','.\x20Changes:\x20','-\x20Read\x20file\x20`','ms:','edit_file','PWD','utf-8','changes','exit','go.mod','warpgrep_codebase_search','timed\x20out','role','BinaryFile','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','text','grep','Tool\x20','provider','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','basename','SymlinkError','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','success','completionId','read','599058cPMamY','\x0aExamples:','roots','\x0aOptions:','MORPH_API_URL','\x20valid\x20directories','grep\x20\x27','searchRequest','repoRoot','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','inputSchema','6389646dotXKG','connect','runWarpGrep_call','\x20chars)','etimedout','5xxnoSD','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','match','search_string','\x20\x20morph-mcp','morphApiKey','.vscode','toISOString','17829030lyvYrJ','mcp-filesystem','includes','default','finish','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','all','homedir','Cargo.toml','lines','MORPH_API_KEY','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','../package.json','sep','RipgrepError','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','morph-warp-grep-v1-1111v0',',\x20removed\x20','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','warn','filter','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','dryRun','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Specific\x20commit\x20hash\x20to\x20search','composer.json','indexOf','description','51OxMNBI','node_modules','Morph\x20FastApply\x20failed\x20without\x20error\x20message','constructor','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','assistant','startsWith','.\x20Path:\x20','version','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','sk-','files','added\x20','argv','isArray','false','Relevant\x20context\x20found:','PathError','Fallback:\x20Using\x20workspace\x20root\x20','Fatal\x20error\x20running\x20server:','WarpGrepError','[warpgrep_github_search]\x20Searching\x20','Applied','resolve','github','Repository\x20identifier','source','optional','warpgrep_github_search','timeout','join','88yplGIq','terminationReason','Error\x20accessing\x20directory\x20','Bearer\x20'];a0_0xc82c=function(){return _0x43f0ce;};return a0_0xc82c();}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_0x551631 from'axios';function fixPathRepetition(_0x10bd93){const _0x47438f=a0_0x23f3,_0xc50276=_0x10bd93['split'](a0_0x29e727[_0x47438f(0x15c)])[_0x47438f(0x164)](Boolean);if(_0xc50276[_0x47438f(0x20a)]<0x2)return null;for(let _0x27636c=Math[_0x47438f(0x1ab)](_0xc50276[_0x47438f(0x20a)]/0x2);_0x27636c>=0x1;_0x27636c--){for(let _0x22906f=0x0;_0x22906f<=_0xc50276[_0x47438f(0x20a)]-0x2*_0x27636c;_0x22906f++){const _0x6429c5=_0xc50276[_0x47438f(0x116)](_0x22906f,_0x22906f+_0x27636c),_0x5a630a=_0xc50276[_0x47438f(0x116)](_0x22906f+_0x27636c,_0x22906f+0x2*_0x27636c);if(_0x6429c5[_0x47438f(0x205)]((_0x1d1588,_0x6f832e)=>_0x1d1588===_0x5a630a[_0x6f832e])){const _0x446a14=[..._0xc50276[_0x47438f(0x116)](0x0,_0x22906f),..._0xc50276[_0x47438f(0x116)](_0x22906f+_0x27636c)];return a0_0x29e727[_0x47438f(0x15c)]+_0x446a14[_0x47438f(0x18b)](a0_0x29e727[_0x47438f(0x15c)]);}}}return null;}function runWarpGrepWithSearchRequest(_0x17f874){const _0x3ff441=a0_0x23f3,_0x412b31={'repoRoot':_0x17f874[_0x3ff441(0x13e)],'morphApiKey':_0x17f874[_0x3ff441(0x14b)],'morphApiUrl':_0x17f874['morphApiUrl'],'timeout':_0x17f874['timeout'],'provider':_0x17f874[_0x3ff441(0x12d)],'search_type':_0x17f874[_0x3ff441(0x1f0)]};return _0x412b31[String[_0x3ff441(0x1da)](0x73,0x65,0x61,0x72,0x63,0x68,0x54,0x65,0x72,0x6d)]=_0x17f874['searchRequest'],runWarpGrep(_0x412b31);}function searchGitHubWithSearchRequest(_0x36dac7,_0x3a8505){const _0x901844=a0_0x23f3,_0x23591c={'github':_0x3a8505[_0x901844(0x185)],'branch':_0x3a8505[_0x901844(0x1fe)]};return _0x23591c[String[_0x901844(0x1da)](0x73,0x65,0x61,0x72,0x63,0x68,0x54,0x65,0x72,0x6d)]=_0x3a8505[_0x901844(0x13d)],_0x23591c[String['fromCharCode'](0x71,0x75,0x65,0x72,0x79)]=_0x3a8505['searchRequest'],_0x36dac7['searchGitHub'](_0x23591c);}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xe2b30b=a0_0x23f3;try{const _0x2d0091=require(_0xe2b30b(0x15b));return _0x2d0091[_0xe2b30b(0x175)]??_0xe2b30b(0x1df);}catch(_0x47c6cb){return logMcpStderr(_0xe2b30b(0x1e1),_0x47c6cb),_0xe2b30b(0x1df);}}function a0_0x23f3(_0xdbadd1,_0x578b0e){_0xdbadd1=_0xdbadd1-0x107;const _0xc82c18=a0_0xc82c();let _0x23f3b2=_0xc82c18[_0xdbadd1];return _0x23f3b2;}function printHelp(){const _0x58e176=a0_0x23f3;console[_0x58e176(0x196)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x58e176(0x196)](_0x58e176(0x15a)),console[_0x58e176(0x196)](_0x58e176(0x139)),console['log'](_0x58e176(0x127)),console[_0x58e176(0x196)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x58e176(0x196)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x58e176(0x196)](_0x58e176(0x137)),console['log'](_0x58e176(0x14a)),console[_0x58e176(0x196)](_0x58e176(0x1bf));}const cliArgs=process[a0_0x58523c(0x17a)]['slice'](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x58523c(0x206)](_0x97cac5=>VERSION_FLAGS[a0_0x58523c(0x19b)](_0x97cac5))&&(console['log'](a0_0x58523c(0x1d4)+getPackageVersion()),process[a0_0x58523c(0x121)](0x0));cliArgs[a0_0x58523c(0x206)](_0x115be1=>HELP_FLAGS[a0_0x58523c(0x19b)](_0x115be1))&&(printHelp(),process[a0_0x58523c(0x121)](0x0));function getCliArg(_0x4b8911){const _0x5eb853=a0_0x58523c;for(let _0x55de91=0x0;_0x55de91<cliArgs[_0x5eb853(0x20a)];_0x55de91++){const _0x3e7249=cliArgs[_0x55de91];if(_0x3e7249[_0x5eb853(0x173)]('--'+_0x4b8911+'='))return _0x3e7249[_0x5eb853(0x116)](('--'+_0x4b8911+'=')[_0x5eb853(0x20a)]);if(_0x3e7249==='--'+_0x4b8911&&_0x55de91+0x1<cliArgs['length'])return cliArgs[_0x55de91+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x58523c(0x20a)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x58523c(0x19b)](arg))continue;if(arg['startsWith'](a0_0x58523c(0x197)))continue;if(arg===a0_0x58523c(0x1fd)){i++;continue;}args[a0_0x58523c(0x1e4)](arg);}const WORKSPACE_ROOT=process[a0_0x58523c(0x10c)]['WORKSPACE_ROOT']||process[a0_0x58523c(0x10c)][a0_0x58523c(0x11e)]||process[a0_0x58523c(0x1ca)](),ENABLE_WORKSPACE_MODE=process[a0_0x58523c(0x10c)][a0_0x58523c(0x1cc)]!==a0_0x58523c(0x17c),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x58523c(0x10c)][a0_0x58523c(0x158)],MORPH_API_URL=process[a0_0x58523c(0x10c)][a0_0x58523c(0x13a)],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x58523c(0x113)]?parseInt(process[a0_0x58523c(0x10c)][a0_0x58523c(0x113)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x58523c(0x11d),a0_0x58523c(0x123),a0_0x58523c(0x189),a0_0x58523c(0x1a1)]),DISABLED_TOOLS=process[a0_0x58523c(0x10c)]['DISABLED_TOOLS']?new Set(process[a0_0x58523c(0x10c)][a0_0x58523c(0x1bc)][a0_0x58523c(0x1a8)](',')['map'](_0x1b6591=>_0x1b6591[a0_0x58523c(0x1ff)]())[a0_0x58523c(0x164)](_0xe981a0=>_0xe981a0[a0_0x58523c(0x20a)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x58523c(0x1bb)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x58523c(0x19b)](tool)&&console[a0_0x58523c(0x199)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x58523c(0x208)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x58523c(0x199)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x58523c(0x18b)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x58523c(0x177))&&!MORPH_API_KEY[a0_0x58523c(0x173)](a0_0x58523c(0x1cd))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x25918a){const _0x4c7e52=a0_0x58523c;try{await a0_0x551631['post']('https://morphllm.com/api/error-report',{..._0x25918a,'timestamp':new Date()[_0x4c7e52(0x14d)](),'source':_0x25918a[_0x4c7e52(0x187)]||_0x4c7e52(0x14f),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x25918a['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x4c7e52(0x1ef),'Authorization':_0x4c7e52(0x18f)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x58523c(0x1eb)),logMcpStderr(a0_0x58523c(0x128)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x58523c(0x1c6)),logMcpStderr(a0_0x58523c(0x1ae)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x436a87){return a0_0x29e727['normalize'](_0x436a87);}function expandHome(_0x40f73d){const _0x101802=a0_0x58523c;if(_0x40f73d[_0x101802(0x173)]('~/')||_0x40f73d==='~')return a0_0x29e727[_0x101802(0x18b)](a0_0x2b220c[_0x101802(0x155)](),_0x40f73d[_0x101802(0x116)](0x1));return _0x40f73d;}let allowedDirectories=await Promise[a0_0x58523c(0x154)](args[a0_0x58523c(0x1be)](async _0x45e75f=>{const _0x5633b2=a0_0x58523c,_0x3785a1=expandHome(_0x45e75f),_0x19c839=a0_0x29e727[_0x5633b2(0x184)](_0x3785a1);try{const _0x3dda43=await a0_0x46c3dc[_0x5633b2(0x209)](_0x19c839);return normalizePath(_0x3dda43);}catch(_0x487be6){return normalizePath(_0x19c839);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x58523c(0x1e4)](workspaceDir),logMcpStderr(a0_0x58523c(0x1ea)+workspaceDir+a0_0x58523c(0x1fc)));}catch(a0_0x3862aa){logMcpStderr(a0_0x58523c(0x1a0)+a0_0x3862aa);}async function detectWorkspaceRoot(_0x5db8ec){const _0x4cfda7=a0_0x58523c;let _0x4a8074=a0_0x29e727['resolve'](_0x5db8ec);const _0x110cad=['.git',_0x4cfda7(0x14c),'package.json',_0x4cfda7(0x156),_0x4cfda7(0x109),_0x4cfda7(0x122),_0x4cfda7(0x203),'tsconfig.json',_0x4cfda7(0x16a)];while(_0x4a8074!==a0_0x29e727['dirname'](_0x4a8074)){for(const _0xa62ef7 of _0x110cad){const _0x8f7c26=a0_0x29e727['join'](_0x4a8074,_0xa62ef7);try{return await a0_0x46c3dc[_0x4cfda7(0x19d)](_0x8f7c26),normalizePath(_0x4a8074);}catch{}}_0x4a8074=a0_0x29e727['dirname'](_0x4a8074);}return normalizePath(_0x5db8ec);}await Promise[a0_0x58523c(0x154)](args[a0_0x58523c(0x1be)](async _0x4fb741=>{const _0xc99277=a0_0x58523c;try{const _0x3ada2e=await a0_0x46c3dc[_0xc99277(0x200)](expandHome(_0x4fb741));!_0x3ada2e[_0xc99277(0x117)]()&&(logMcpStderr(_0xc99277(0x1a7)+_0x4fb741+'\x20is\x20not\x20a\x20directory'),process['exit'](0x1));}catch(_0x46e72d){logMcpStderr(_0xc99277(0x18e)+_0x4fb741+':',_0x46e72d),process[_0xc99277(0x121)](0x1);}}));async function validatePath(_0x5a915c){const _0x31ba3e=a0_0x58523c,_0x8b50f6=expandHome(_0x5a915c),_0x19fd41=a0_0x29e727['resolve'](_0x8b50f6);try{const _0x448f78=await a0_0x46c3dc[_0x31ba3e(0x209)](_0x19fd41);return _0x448f78;}catch(_0x53a858){if(_0x53a858[_0x31ba3e(0x1e8)]===_0x31ba3e(0x1f3)){const _0x4f3ece=a0_0x29e727[_0x31ba3e(0x1db)](_0x19fd41);try{const _0x103527=await a0_0x46c3dc[_0x31ba3e(0x209)](_0x4f3ece);return a0_0x29e727['join'](_0x103527,a0_0x29e727[_0x31ba3e(0x130)](_0x19fd41));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x4f3ece);}}throw _0x53a858;}}const MorphEditFileArgsSchema=z[a0_0x58523c(0x1ee)]({'path':z[a0_0x58523c(0x1dd)](),'code_edit':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x1b2)](a0_0x58523c(0x1d5)),'instruction':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x1b2)](a0_0x58523c(0x201)),'dryRun':z['boolean']()[a0_0x58523c(0x151)](![])[a0_0x58523c(0x1b2)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x58523c(0x10a),WarpGrepArgsSchema=z[a0_0x58523c(0x1ee)]({'search_string':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x1b2)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x58523c(0x1b2)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x58523c(0x1f5)](['default',a0_0x58523c(0x16e)])[a0_0x58523c(0x188)]()[a0_0x58523c(0x1b2)](a0_0x58523c(0x168))}),WarpGrepGitHubArgsSchema=z[a0_0x58523c(0x1ee)]({'search_string':z[a0_0x58523c(0x1dd)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x188)]()[a0_0x58523c(0x1b2)](a0_0x58523c(0x207)),'owner_repo':z['string']()[a0_0x58523c(0x188)]()['describe']('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x58523c(0x1dd)]()['optional']()[a0_0x58523c(0x1b2)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x58523c(0x1ee)]({'query':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x1b2)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x1b2)](a0_0x58523c(0x186)),'branch':z[a0_0x58523c(0x1dd)]()[a0_0x58523c(0x188)]()[a0_0x58523c(0x1b2)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x58523c(0x1dd)]()['optional']()[a0_0x58523c(0x1b2)](a0_0x58523c(0x169)),'targetDirectories':z['array'](z[a0_0x58523c(0x1dd)]())[a0_0x58523c(0x151)]([])[a0_0x58523c(0x1b2)](a0_0x58523c(0x1d8)),'limit':z[a0_0x58523c(0x1dc)]()['optional']()[a0_0x58523c(0x151)](0xa)[a0_0x58523c(0x1b2)](a0_0x58523c(0x19e))}),server=new Server({'name':'morph-mcp','version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x58523c(0x1e0)](ListToolsRequestSchema,async()=>{const _0x1d9baf=a0_0x58523c,_0x428a61=[{'name':_0x1d9baf(0x11d),'description':_0x1d9baf(0x1a5)+_0x1d9baf(0x153)+_0x1d9baf(0x1ba)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0x1d9baf(0x1cb)+_0x1d9baf(0x1b4)+_0x1d9baf(0x1f6)+_0x1d9baf(0x194)+_0x1d9baf(0x171)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x1d9baf(0x1d9)+_0x1d9baf(0x129)+'For\x20deletions:\x0a'+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+_0x1d9baf(0x132)+'Rules:\x0a'+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x1d9baf(0x1ce)+_0x1d9baf(0x20c)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x1d9baf(0x112)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x1d9baf(0x1c1),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x1d9baf(0x1a1),'description':_0x1d9baf(0x13f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20'+'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':!![]}],_0x843cc2=_0x428a61[_0x1d9baf(0x164)](_0x3d3ba0=>{const _0x10dd89=_0x1d9baf;if(DISABLED_TOOLS[_0x10dd89(0x19b)](_0x3d3ba0[_0x10dd89(0x1b3)]))return console[_0x10dd89(0x199)](_0x10dd89(0x12c)+_0x3d3ba0[_0x10dd89(0x1b3)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x10dd89(0x1e5)in _0x3d3ba0&&_0x3d3ba0[_0x10dd89(0x1e5)]&&!MORPH_API_KEY)return logMcpStderr(_0x10dd89(0x1cf)+_0x3d3ba0[_0x10dd89(0x1b3)]+_0x10dd89(0x119)),![];return!![];});return{'tools':_0x843cc2[_0x1d9baf(0x1be)](_0x4e71d7=>({'name':_0x4e71d7['name'],'description':_0x4e71d7[_0x1d9baf(0x16c)],'inputSchema':_0x4e71d7[_0x1d9baf(0x140)]}))};}),server[a0_0x58523c(0x1e0)](CallToolRequestSchema,async _0x2b1465=>{const _0x597cfd=a0_0x58523c,{name:_0x3d3550,arguments:_0x2e1ffa}=_0x2b1465['params'];try{if(DISABLED_TOOLS[_0x597cfd(0x19b)](_0x3d3550))throw new Error('Tool\x20\x22'+_0x3d3550+'\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable');switch(_0x3d3550){case _0x597cfd(0x11d):{const _0x35693d=MorphEditFileArgsSchema[_0x597cfd(0x1d7)](_0x2e1ffa);if(!_0x35693d[_0x597cfd(0x133)])throw new Error(_0x597cfd(0x15e)+_0x35693d[_0x597cfd(0x199)]);const _0x68ca2f=await validatePath(_0x35693d[_0x597cfd(0x1c7)]['path']);let _0x5c81a4=null,_0x5ac38e=!![],_0x35fd01=null;try{_0x5c81a4=await a0_0x46c3dc[_0x597cfd(0x1af)](_0x68ca2f,_0x597cfd(0x11f));}catch(_0xaaf0db){const _0x28745c=_0xaaf0db['code'];_0x28745c==='ENOENT'?(_0x5ac38e=![],_0x5c81a4=''):(_0x35fd01='Failed\x20to\x20read\x20file:\x20'+(_0x28745c||_0x597cfd(0x1df))+_0x597cfd(0x1a4)+(_0xaaf0db instanceof Error?_0xaaf0db['message']:String(_0xaaf0db)),logMcpStderr(_0x597cfd(0x1cf)+_0x35fd01));}let _0x42615f;try{const _0x3c9090=MORPH_API_KEY;if(!_0x3c9090)throw new Error(_0x597cfd(0x166));const _0x459135=a0_0x29e727[_0x597cfd(0x1db)](_0x68ca2f),_0x3473b0=a0_0x29e727[_0x597cfd(0x130)](_0x68ca2f),_0x4c6d29=await executeEditFile({'target_filepath':_0x3473b0,'code_edit':_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x1b5)],'instructions':_0x35693d[_0x597cfd(0x1c7)]['instruction']},{'morphApiKey':_0x3c9090,'morphApiUrl':MORPH_API_URL,'baseDir':_0x459135,'autoWrite':!_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x167)],'generateUdiff':![],'debug':![]});_0x42615f=_0x4c6d29[_0x597cfd(0x134)];if(!_0x4c6d29[_0x597cfd(0x133)])throw new Error(_0x4c6d29[_0x597cfd(0x199)]||_0x597cfd(0x16f));const _0x5a4c2a=_0x4c6d29[_0x597cfd(0x120)],_0x12d8c7=_0x597cfd(0x179)+_0x5a4c2a[_0x597cfd(0x1f9)]+_0x597cfd(0x161)+_0x5a4c2a[_0x597cfd(0x1b8)]+_0x597cfd(0x192)+_0x5a4c2a['linesModified'];if(_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x167)])return{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x20d)+(_0x5ac38e?'':'\x20(new\x20file)')+':\x20'+_0x35693d[_0x597cfd(0x1c7)]['instruction']+_0x597cfd(0x11a)+_0x12d8c7+'.\x20Path:\x20'+_0x35693d['data']['path']+'.'}]};return{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x1de)+(_0x5ac38e?_0x597cfd(0x183):_0x597cfd(0x1c9))+':\x20'+_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x10e)]+_0x597cfd(0x11a)+_0x12d8c7+_0x597cfd(0x174)+_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x193)]+'.'}]};}catch(_0x26f558){const _0x5edbb8=_0x26f558 instanceof Error?_0x26f558[_0x597cfd(0x19a)]:String(_0x26f558);return reportMorphError({'error_message':_0x5edbb8,'error_type':_0x26f558 instanceof Error?_0x26f558[_0x597cfd(0x170)][_0x597cfd(0x1b3)]:_0x597cfd(0x1f4),'context':{'tool':_0x597cfd(0x11d),'completion_id':_0x42615f,'file_path':_0x35693d['data']['path'],'validated_path':_0x68ca2f,'instruction':_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x10e)],'model':'morph-v3-fast','dry_run':_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x167)],'file_exists':_0x5ac38e,'file_read_error':_0x35fd01,'file_readable':_0x5c81a4!==null,'request_content':{'path':_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x193)],'code_edit':_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x1b5)],'instruction':_0x35693d['data'][_0x597cfd(0x10e)],'original_code':_0x5c81a4!==null?_0x5c81a4[_0x597cfd(0x20a)]>0xc350?_0x5c81a4[_0x597cfd(0x204)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x5c81a4[_0x597cfd(0x20a)]+_0x597cfd(0x144):_0x5c81a4:'[could\x20not\x20read\x20file:\x20'+(_0x35fd01||'unknown\x20error')+']','original_code_length':_0x5c81a4?.[_0x597cfd(0x20a)]??0x0,'model':'morph-v3-fast','dry_run':_0x35693d[_0x597cfd(0x1c7)][_0x597cfd(0x167)]}},'stack_trace':_0x26f558 instanceof Error?_0x26f558[_0x597cfd(0x115)]:undefined,'source':_0x597cfd(0x14f)})[_0x597cfd(0x1a9)](()=>{}),{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x1c4)+_0x5edbb8}],'isError':!![]};}}case _0x597cfd(0x1a1):{const _0xf863e4=WarpGrepArgsSchema['safeParse'](_0x2e1ffa);if(!_0xf863e4[_0x597cfd(0x133)])return{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x1c0)+_0xf863e4[_0x597cfd(0x199)]}],'isError':!![]};const _0xf43a48=_0x5dcf87=>{const _0x555e63=_0x597cfd,_0x4a76d0=[];for(const _0x2a6de6 of _0x5dcf87||[]){const _0x1507a7=_0x2a6de6[_0x555e63(0x125)],_0x2714b0=_0x2a6de6[_0x555e63(0x1bd)];if(_0x1507a7==='assistant'&&_0x2714b0){const _0x4c4976=_0x2714b0[_0x555e63(0x1a8)]('\x0a')[_0x555e63(0x164)](_0x47910a=>_0x47910a[_0x555e63(0x1ff)]());for(const _0x2225ef of _0x4c4976){const _0x1c9931=_0x2225ef['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1c9931){_0x4a76d0['push'](_0x555e63(0x13c)+_0x1c9931[0x1]+'\x27\x20'+_0x1c9931[0x2]);continue;}const _0x1aea24=_0x2225ef['match'](/^read\s+(.+)$/);if(_0x1aea24){_0x4a76d0['push']('read\x20'+_0x1aea24[0x1]);continue;}const _0x3f2909=_0x2225ef['match'](/^list_directory\s+(.+)$/);if(_0x3f2909){_0x4a76d0[_0x555e63(0x1e4)](_0x555e63(0x19f)+_0x3f2909[0x1]);continue;}}}}return _0x4a76d0;},_0x34a474=_0x13d882=>{const _0x3ed430=_0x597cfd,_0x568d16=[];if(!_0x13d882||!Array[_0x3ed430(0x17b)](_0x13d882))return _0x568d16;const _0x578fdd=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x3ed430(0x198),'tool':_0x3ed430(0x135)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x3ed430(0x17e),'tool':_0x3ed430(0x135)},{'pattern':/\[READ ERROR\]/,'error_type':_0x3ed430(0x1e9),'tool':_0x3ed430(0x135)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x3ed430(0x126),'tool':_0x3ed430(0x135)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x3ed430(0x15d),'tool':_0x3ed430(0x12b)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x3ed430(0x1d6),'tool':_0x3ed430(0x12b)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x3ed430(0x126),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x3ed430(0x131),'tool':_0x3ed430(0x135)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x3ed430(0x135)},{'pattern':/symbolic link/,'error_type':_0x3ed430(0x131),'tool':_0x3ed430(0x135)},{'pattern':/Error reading file:/,'error_type':_0x3ed430(0x1e9),'tool':_0x3ed430(0x135)},{'pattern':/status="error"/,'error_type':_0x3ed430(0x107),'tool':_0x3ed430(0x1df)}];let _0x570067=0x0;for(const _0x17b440 of _0x13d882){if(_0x17b440[_0x3ed430(0x125)]===_0x3ed430(0x1c5)){_0x570067++;const _0x454f60=_0x17b440[_0x3ed430(0x1bd)];if(!_0x454f60||typeof _0x454f60!==_0x3ed430(0x1dd))continue;for(const {pattern:_0x4ca1cb,error_type:_0x750087,tool:_0x3195e5}of _0x578fdd){const _0x255e06=_0x454f60[_0x3ed430(0x148)](new RegExp(_0x4ca1cb[_0x3ed430(0x187)],'g'));if(_0x255e06)for(const _0x2a4cc3 of _0x255e06){const _0x5a1df8=_0x454f60[_0x3ed430(0x16b)](_0x2a4cc3),_0x1f5de7=_0x454f60[_0x3ed430(0x204)](_0x5a1df8,Math[_0x3ed430(0x1a3)](_0x5a1df8+0xc8,_0x454f60[_0x3ed430(0x20a)]));_0x568d16[_0x3ed430(0x1e4)]({'tool':_0x3195e5,'error_type':_0x750087,'error_message':_0x1f5de7['split']('\x0a')[0x0],'turn':_0x570067});}}}}return _0x568d16;};try{const _0x485eb8=a0_0x29e727['resolve'](_0xf863e4['data'][_0x597cfd(0x1b1)]),_0x54354c=_0xf863e4['data'][_0x597cfd(0x1f0)],_0x18bb78=_0x54354c==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x206be3=new LocalRipgrepProvider(_0x485eb8,undefined,_0x18bb78),_0x5b2702=await runWarpGrepWithSearchRequest({'searchRequest':_0xf863e4[_0x597cfd(0x1c7)]['search_string'],'repoRoot':_0x485eb8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x206be3,'search_type':_0x54354c}),_0x17efd5=_0x34a474(_0x5b2702[_0x597cfd(0x190)]);_0x17efd5[_0x597cfd(0x20a)]>0x0&&reportMorphError({'error_message':_0x597cfd(0x1fb)+_0x17efd5[_0x597cfd(0x20a)]+_0x597cfd(0x1aa),'error_type':_0x597cfd(0x195),'level':_0x597cfd(0x163),'tool':'codebase_search','context':{'repo_path':_0xf863e4[_0x597cfd(0x1c7)]['repo_path'],'query':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x149)],'model':_0x597cfd(0x160),'termination_reason':_0x5b2702[_0x597cfd(0x18d)],'sub_tool_errors':_0x17efd5,'timings':_0x5b2702[_0x597cfd(0x1d0)],'tool_calls':_0xf43a48(_0x5b2702[_0x597cfd(0x190)]),'messages':_0x5b2702[_0x597cfd(0x190)]?.[_0x597cfd(0x1be)](_0x3d5a1b=>({'role':_0x3d5a1b[_0x597cfd(0x125)],'content':_0x3d5a1b['content']}))},'source':_0x597cfd(0x14f)})['catch'](()=>{});let _0xa6d474='';if(_0x5b2702['terminationReason']==='completed'&&_0x5b2702[_0x597cfd(0x152)]?.[_0x597cfd(0x1f8)]?.[_0x597cfd(0x178)]){const _0x462c82=_0x5b2702[_0x597cfd(0x152)][_0x597cfd(0x1f8)][_0x597cfd(0x178)];if(_0x462c82['length']===0x0)return _0xa6d474=_0x5b2702[_0x597cfd(0x152)]['payload']||_0x597cfd(0x162),{'content':[{'type':'text','text':_0xa6d474}]};const _0x5f0e82=[],_0x4fffce=[_0x597cfd(0x108)];for(const _0x1ff06d of _0x5b2702[_0x597cfd(0x190)]){const _0x3b71d6=_0x1ff06d[_0x597cfd(0x125)],_0x1f3c00=_0x1ff06d[_0x597cfd(0x1bd)];if(_0x3b71d6===_0x597cfd(0x172)&&_0x1f3c00){const _0x548636=_0x1f3c00[_0x597cfd(0x1a8)]('\x0a')[_0x597cfd(0x164)](_0x274ac2=>_0x274ac2[_0x597cfd(0x1ff)]());for(const _0x58aa14 of _0x548636){const _0x1d4d06=_0x58aa14[_0x597cfd(0x148)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1d4d06){_0x4fffce[_0x597cfd(0x1e4)]('-\x20Grepped\x20\x27'+_0x1d4d06[0x1]+_0x597cfd(0x110)+_0x1d4d06[0x2]+'`');continue;}const _0x52329d=_0x58aa14[_0x597cfd(0x148)](/^read\s+(.+)$/);if(_0x52329d){_0x4fffce[_0x597cfd(0x1e4)](_0x597cfd(0x11b)+_0x52329d[0x1]+'`');continue;}const _0x4d8cfa=_0x58aa14[_0x597cfd(0x148)](/^list_directory\s+(.+)$/);if(_0x4d8cfa){_0x4fffce[_0x597cfd(0x1e4)]('-\x20Listed\x20directory\x20`'+_0x4d8cfa[0x1]+'`');continue;}}}}_0x5f0e82[_0x597cfd(0x1e4)](_0x4fffce[_0x597cfd(0x18b)]('\x0a'));const _0xdbf880=['',_0x597cfd(0x17d)];for(const _0x413dda of _0x462c82){if(_0x413dda[_0x597cfd(0x157)]==='*')_0xdbf880['push']('-\x20'+_0x413dda[_0x597cfd(0x193)]+':*');else{if(Array[_0x597cfd(0x17b)](_0x413dda[_0x597cfd(0x157)])){const _0x54db=_0x413dda[_0x597cfd(0x157)][_0x597cfd(0x1be)](([_0x223741,_0x3a2907])=>{if(_0x223741===_0x3a2907)return''+_0x223741;return _0x223741+'-'+_0x3a2907;});_0xdbf880[_0x597cfd(0x1e4)]('-\x20'+_0x413dda[_0x597cfd(0x193)]+':'+_0x54db[_0x597cfd(0x18b)](','));}else _0xdbf880[_0x597cfd(0x1e4)]('-\x20'+_0x413dda[_0x597cfd(0x193)]+':*');}}_0xdbf880['push'](''),_0x5f0e82['push'](_0xdbf880['join']('\x0a')),_0x5f0e82[_0x597cfd(0x1e4)](_0x597cfd(0x1c3));const _0x301674=[];for(const _0x1d3d66 of _0x462c82){let _0x383437=a0_0x29e727[_0x597cfd(0x184)](_0xf863e4[_0x597cfd(0x1c7)]['repo_path'],_0x1d3d66[_0x597cfd(0x193)]),_0x603121=null,_0x2e2a7b=null;try{_0x603121=await a0_0x46c3dc[_0x597cfd(0x1af)](_0x383437,{'encoding':_0x597cfd(0x11f)});}catch(_0x202ee8){const _0x47fd37=fixPathRepetition(_0x383437);if(_0x47fd37)try{_0x603121=await a0_0x46c3dc[_0x597cfd(0x1af)](_0x47fd37,{'encoding':_0x597cfd(0x11f)}),_0x383437=_0x47fd37;}catch{_0x2e2a7b=_0x202ee8 instanceof Error?_0x202ee8:new Error(String(_0x202ee8));}else _0x2e2a7b=_0x202ee8 instanceof Error?_0x202ee8:new Error(String(_0x202ee8));}if(_0x603121!==null){const _0x485d84=_0x603121[_0x597cfd(0x1a8)](/\r?\n/),_0x5207bc=[_0x597cfd(0x1fa)+_0x1d3d66['path']+'\x22>'];if(_0x1d3d66[_0x597cfd(0x157)]==='*'||!Array[_0x597cfd(0x17b)](_0x1d3d66[_0x597cfd(0x157)]))for(let _0x618f06=0x1;_0x618f06<=_0x485d84[_0x597cfd(0x20a)];_0x618f06++){const _0x20b704=_0x485d84[_0x618f06-0x1];_0x5207bc[_0x597cfd(0x1e4)](_0x618f06+'|\x20'+_0x20b704);}else for(const [_0x52dcd6,_0x5a45dd]of _0x1d3d66[_0x597cfd(0x157)]){_0x5207bc[_0x597cfd(0x20a)]>0x1&&_0x5207bc[_0x597cfd(0x1e4)]('');for(let _0x5a4eef=_0x52dcd6;_0x5a4eef<=_0x5a45dd&&_0x5a4eef<=_0x485d84['length'];_0x5a4eef++){const _0x5ab4ff=_0x485d84[_0x5a4eef-0x1];_0x5207bc[_0x597cfd(0x1e4)](_0x5a4eef+'|\x20'+_0x5ab4ff);}}_0x5207bc[_0x597cfd(0x1e4)]('</file>'),_0x301674[_0x597cfd(0x1e4)](_0x5207bc[_0x597cfd(0x18b)]('\x0a'));}else _0x301674[_0x597cfd(0x1e4)](_0x597cfd(0x1fa)+_0x1d3d66[_0x597cfd(0x193)]+_0x597cfd(0x191)+(_0x2e2a7b?.[_0x597cfd(0x19a)]||_0x597cfd(0x1ac))+_0x597cfd(0x1e7));}_0x5f0e82['push'](_0x301674[_0x597cfd(0x18b)]('\x0a\x0a')),_0xa6d474=_0x5f0e82[_0x597cfd(0x18b)]('\x0a');const _0x47be65=_0x5b2702[_0x597cfd(0x202)]?.['filter'](_0x17c011=>_0x17c011[_0x597cfd(0x19a)]?.[_0x597cfd(0x173)](_0x597cfd(0x1d1)))||[];if(_0x47be65[_0x597cfd(0x20a)]>0x0){const _0x2d8eaa=_0x47be65[_0x597cfd(0x1be)](_0x31b6da=>_0x31b6da[_0x597cfd(0x19a)])[_0x597cfd(0x18b)](';\x20');reportMorphError({'error_message':_0x2d8eaa,'error_type':_0x597cfd(0x1f2),'context':{'tool':_0x597cfd(0x1a1),'repo_path':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)],'query':_0xf863e4['data'][_0x597cfd(0x149)],'model':_0x597cfd(0x160),'termination_reason':_0x597cfd(0x1a6),'error_count':_0x47be65[_0x597cfd(0x20a)],'is_timeout':![],'timings':_0x5b2702['timings'],'files_attempted':_0x462c82[_0x597cfd(0x1be)](_0x555782=>({'path':_0x555782['path'],'lines':_0x555782[_0x597cfd(0x157)]})),'tool_calls':_0xf43a48(_0x5b2702[_0x597cfd(0x190)]),'messages':_0x5b2702[_0x597cfd(0x190)]?.['map'](_0x27e936=>({'role':_0x27e936[_0x597cfd(0x125)],'content':_0x27e936[_0x597cfd(0x1bd)]})),'request_content':{'query':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x149)],'repo_path':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)],'repoRoot':a0_0x29e727[_0x597cfd(0x184)](_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)]),'model':_0x597cfd(0x160)}},'source':'mcp-filesystem'})[_0x597cfd(0x1a9)](()=>{});}}else{if(_0x5b2702[_0x597cfd(0x18d)]===_0x597cfd(0x1a2)&&_0x5b2702['errors'][_0x597cfd(0x20a)]>0x0){const _0x5615ef=_0x5b2702[_0x597cfd(0x202)][_0x597cfd(0x1be)](_0x1ba121=>_0x1ba121[_0x597cfd(0x19a)])[_0x597cfd(0x18b)](';\x20');_0xa6d474=_0x597cfd(0x1a7)+_0x5615ef;const _0x2c5d83=_0x5615ef[_0x597cfd(0x10d)]()[_0x597cfd(0x150)](_0x597cfd(0x18a))||_0x5615ef['toLowerCase']()['includes']('timed\x20out')||_0x5615ef[_0x597cfd(0x10d)]()[_0x597cfd(0x150)]('etimedout'),_0x4bf828=_0x5b2702[_0x597cfd(0x152)]?.[_0x597cfd(0x1f8)]?.[_0x597cfd(0x178)],_0x5e36b1=_0x5b2702[_0x597cfd(0x202)][0x0];reportMorphError({'error_message':_0x5615ef,'error_type':_0x2c5d83?_0x597cfd(0x1ed):_0x5e36b1?.[_0x597cfd(0x170)]?.['name']||_0x597cfd(0x181),'context':{'tool':_0x597cfd(0x1a1),'repo_path':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)],'query':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x149)],'model':_0x597cfd(0x160),'termination_reason':_0x5b2702['terminationReason'],'error_count':_0x5b2702[_0x597cfd(0x202)][_0x597cfd(0x20a)],'is_timeout':_0x2c5d83,'timings':_0x5b2702[_0x597cfd(0x1d0)],'files_attempted':_0x4bf828?.['map'](_0x1c5cb1=>({'path':_0x1c5cb1[_0x597cfd(0x193)],'lines':_0x1c5cb1[_0x597cfd(0x157)]})),'tool_calls':_0xf43a48(_0x5b2702[_0x597cfd(0x190)]),'messages':_0x5b2702[_0x597cfd(0x190)]?.[_0x597cfd(0x1be)](_0x272b62=>({'role':_0x272b62[_0x597cfd(0x125)],'content':_0x272b62[_0x597cfd(0x1bd)]})),'request_content':{'query':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x149)],'repo_path':_0xf863e4['data'][_0x597cfd(0x1b1)],'repoRoot':a0_0x29e727[_0x597cfd(0x184)](_0xf863e4['data']['repo_path']),'model':_0x597cfd(0x160)}},'stack_trace':_0x5e36b1?.[_0x597cfd(0x115)]||undefined,'source':_0x597cfd(0x14f)})['catch'](()=>{});}else _0xa6d474=_0x597cfd(0x1c8);}return{'content':[{'type':_0x597cfd(0x12a),'text':_0xa6d474}]};}catch(_0x4e4bfa){const _0x403af3=_0x4e4bfa instanceof Error?_0x4e4bfa[_0x597cfd(0x19a)]:String(_0x4e4bfa),_0x3710a1=_0x403af3[_0x597cfd(0x10d)]()['includes']('timeout')||_0x403af3['toLowerCase']()[_0x597cfd(0x150)](_0x597cfd(0x124))||_0x403af3[_0x597cfd(0x10d)]()['includes'](_0x597cfd(0x145))||_0x4e4bfa instanceof Error&&_0x4e4bfa['name']===_0x597cfd(0x1ed);return reportMorphError({'error_message':_0x403af3,'error_type':_0x3710a1?_0x597cfd(0x1ed):_0x4e4bfa instanceof Error?_0x4e4bfa['constructor'][_0x597cfd(0x1b3)]:_0x597cfd(0x1f4),'context':{'tool':_0x597cfd(0x1a1),'repo_path':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)],'query':_0xf863e4[_0x597cfd(0x1c7)]['search_string'],'model':_0x597cfd(0x160),'is_timeout':_0x3710a1,'exception_phase':_0x597cfd(0x143),'request_content':{'query':_0xf863e4[_0x597cfd(0x1c7)]['search_string'],'repo_path':_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)],'repoRoot':a0_0x29e727[_0x597cfd(0x184)](_0xf863e4[_0x597cfd(0x1c7)][_0x597cfd(0x1b1)]),'model':_0x597cfd(0x160)}},'stack_trace':_0x4e4bfa instanceof Error?_0x4e4bfa[_0x597cfd(0x115)]:undefined,'source':_0x597cfd(0x14f)})[_0x597cfd(0x1a9)](()=>{}),{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x111)+_0x403af3}],'isError':![]};}}case _0x597cfd(0x189):{const _0x1400cb=WarpGrepGitHubArgsSchema[_0x597cfd(0x1d7)](_0x2e1ffa);if(!_0x1400cb[_0x597cfd(0x133)])return{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x1c0)+_0x1400cb[_0x597cfd(0x199)]}],'isError':!![]};const _0x33eabb=_0x1400cb[_0x597cfd(0x1c7)][_0x597cfd(0x10b)]||_0x1400cb[_0x597cfd(0x1c7)][_0x597cfd(0x10f)];if(!_0x33eabb)return{'content':[{'type':'text','text':_0x597cfd(0x165)}],'isError':!![]};const _0x5cd45b=MORPH_API_KEY;if(!_0x5cd45b)throw new Error(_0x597cfd(0x166));const _0x6dd1cb=Date[_0x597cfd(0x1e6)]();logMcpStderr(_0x597cfd(0x182)+_0x33eabb+_0x597cfd(0x1b9)+_0x1400cb[_0x597cfd(0x1c7)][_0x597cfd(0x149)]+'\x22');try{const _0x4a1d97=new WarpGrepClient({'morphApiKey':_0x5cd45b,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x443ab3=await searchGitHubWithSearchRequest(_0x4a1d97,{'searchRequest':_0x1400cb[_0x597cfd(0x1c7)]['search_string'],'github':_0x33eabb,'branch':_0x1400cb[_0x597cfd(0x1c7)][_0x597cfd(0x1fe)]}),_0x559128=Date[_0x597cfd(0x1e6)]()-_0x6dd1cb;logMcpStderr(_0x597cfd(0x1e2)+_0x559128+_0x597cfd(0x114)+_0x443ab3['success']);const _0x12a37f=formatResult(_0x443ab3);return{'content':[{'type':'text','text':_0x12a37f}]};}catch(_0x2a455a){const _0x4f2fa3=Date[_0x597cfd(0x1e6)]()-_0x6dd1cb,_0xf23f42=_0x2a455a instanceof Error?_0x2a455a[_0x597cfd(0x19a)]:String(_0x2a455a);return logMcpStderr('[warpgrep_github_search]\x20Failed\x20in\x20'+_0x4f2fa3+_0x597cfd(0x11c),_0xf23f42),reportMorphError({'error_message':_0xf23f42,'error_type':_0x2a455a instanceof Error?_0x2a455a[_0x597cfd(0x170)][_0x597cfd(0x1b3)]:_0x597cfd(0x1f4),'context':{'tool':_0x597cfd(0x189),'github_url':_0x33eabb,'search_string':_0x1400cb[_0x597cfd(0x1c7)][_0x597cfd(0x149)],'branch':_0x1400cb[_0x597cfd(0x1c7)][_0x597cfd(0x1fe)]},'stack_trace':_0x2a455a instanceof Error?_0x2a455a['stack']:undefined,'source':_0x597cfd(0x14f),'tool':'warpgrep_github_search','latency_ms':_0x4f2fa3})['catch'](()=>{}),{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x1ec)+_0xf23f42}],'isError':![]};}}default:throw new Error(_0x597cfd(0x1ad)+_0x3d3550);}}catch(_0x316b7c){const _0x26f298=_0x316b7c instanceof Error?_0x316b7c[_0x597cfd(0x19a)]:String(_0x316b7c);return reportMorphError({'error_message':_0x26f298,'error_type':_0x316b7c instanceof Error?_0x316b7c['constructor'][_0x597cfd(0x1b3)]:_0x597cfd(0x1f4),'context':{'tool':_0x3d3550,'arguments':_0x2e1ffa?JSON['stringify'](_0x2e1ffa)[_0x597cfd(0x204)](0x0,0x1f4):undefined,'mcp_server_version':_0x597cfd(0x1e3)},'stack_trace':_0x316b7c instanceof Error?_0x316b7c[_0x597cfd(0x115)]:undefined,'source':_0x597cfd(0x14f)})[_0x597cfd(0x1a9)](()=>{}),{'content':[{'type':_0x597cfd(0x12a),'text':_0x597cfd(0x1a7)+_0x26f298}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x33232f){const _0x174784=a0_0x58523c,_0x474072=await getValidRootDirectories(_0x33232f);if(_0x474072[_0x174784(0x20a)]>0x0)allowedDirectories=[..._0x474072],logMcpStderr(_0x174784(0x12f)+_0x474072[_0x174784(0x20a)]+_0x174784(0x13b));else{logMcpStderr(_0x174784(0x12e));if(ENABLE_WORKSPACE_MODE)try{const _0x378704=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x378704&&(allowedDirectories=[_0x378704],logMcpStderr(_0x174784(0x17f)+_0x378704));}catch(_0x5804af){logMcpStderr(_0x174784(0x1c2)+_0x5804af);}}}server[a0_0x58523c(0x1f7)](RootsListChangedNotificationSchema,async()=>{const _0x26e045=a0_0x58523c;try{const _0x529a40=await server[_0x26e045(0x1d2)]();_0x529a40&&_0x26e045(0x138)in _0x529a40&&await updateAllowedDirectoriesFromRoots(_0x529a40['roots']);}catch(_0x2cb6b5){logMcpStderr(_0x26e045(0x118),_0x2cb6b5 instanceof Error?_0x2cb6b5['message']:String(_0x2cb6b5));}}),server['oninitialized']=async()=>{const _0xb39acd=a0_0x58523c,_0x31d0ca=server[_0xb39acd(0x1b7)]();if(_0x31d0ca?.[_0xb39acd(0x138)])try{const _0x32001a=await server[_0xb39acd(0x1d2)]();_0x32001a&&_0xb39acd(0x138)in _0x32001a?await updateAllowedDirectoriesFromRoots(_0x32001a[_0xb39acd(0x138)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x42fd7f){logMcpStderr(_0xb39acd(0x1f1),_0x42fd7f instanceof Error?_0x42fd7f['message']:String(_0x42fd7f));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0xb39acd(0x15f),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0xb39acd(0x147));else throw new Error(_0xb39acd(0x1b6));}}};async function runServer(){const _0x4a89c1=a0_0x58523c,_0x1de46b=new StdioServerTransport();await server[_0x4a89c1(0x142)](_0x1de46b),logMcpStderr(_0x4a89c1(0x176)),allowedDirectories[_0x4a89c1(0x20a)]===0x0&&logMcpStderr(_0x4a89c1(0x159));}runServer()[a0_0x58523c(0x1a9)](_0x1b1847=>{const _0x5ce887=a0_0x58523c;logMcpStderr(_0x5ce887(0x180),_0x1b1847),process[_0x5ce887(0x121)](0x1);});
|
|
2
|
+
const a0_0x444bf9=a0_0x2d77;(function(_0x34532a,_0x1d153b){const _0x1a4345=a0_0x2d77,_0x8c8afd=_0x34532a();while(!![]){try{const _0x3c6cce=-parseInt(_0x1a4345(0x1c4))/0x1+-parseInt(_0x1a4345(0x1f1))/0x2*(parseInt(_0x1a4345(0x1bf))/0x3)+parseInt(_0x1a4345(0x1f8))/0x4*(-parseInt(_0x1a4345(0x1cf))/0x5)+-parseInt(_0x1a4345(0x1e9))/0x6*(parseInt(_0x1a4345(0x229))/0x7)+parseInt(_0x1a4345(0x1fa))/0x8*(-parseInt(_0x1a4345(0x269))/0x9)+-parseInt(_0x1a4345(0x251))/0xa*(-parseInt(_0x1a4345(0x1db))/0xb)+parseInt(_0x1a4345(0x245))/0xc;if(_0x3c6cce===_0x1d153b)break;else _0x8c8afd['push'](_0x8c8afd['shift']());}catch(_0x49815e){_0x8c8afd['push'](_0x8c8afd['shift']());}}}(a0_0x20ce,0xafa40));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_0x1c8efe from'fs/promises';import a0_0x35ce7e from'path';import a0_0x5cb303 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_0x24b08d from'axios';function fixPathRepetition(_0x7b1a2a){const _0x2b3bf4=a0_0x2d77,_0x572107=_0x7b1a2a[_0x2b3bf4(0x19b)](a0_0x35ce7e['sep'])['filter'](Boolean);if(_0x572107['length']<0x2)return null;for(let _0xdd98=Math['floor'](_0x572107['length']/0x2);_0xdd98>=0x1;_0xdd98--){for(let _0x13e245=0x0;_0x13e245<=_0x572107[_0x2b3bf4(0x193)]-0x2*_0xdd98;_0x13e245++){const _0x29e8de=_0x572107[_0x2b3bf4(0x294)](_0x13e245,_0x13e245+_0xdd98),_0x44a2bf=_0x572107[_0x2b3bf4(0x294)](_0x13e245+_0xdd98,_0x13e245+0x2*_0xdd98);if(_0x29e8de[_0x2b3bf4(0x21a)]((_0xbfda40,_0x5792fa)=>_0xbfda40===_0x44a2bf[_0x5792fa])){const _0x20331b=[..._0x572107[_0x2b3bf4(0x294)](0x0,_0x13e245),..._0x572107[_0x2b3bf4(0x294)](_0x13e245+_0xdd98)];return a0_0x35ce7e[_0x2b3bf4(0x246)]+_0x20331b[_0x2b3bf4(0x1c1)](a0_0x35ce7e[_0x2b3bf4(0x246)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x59a613=a0_0x2d77;try{const _0x16eb84=require(_0x59a613(0x278));return _0x16eb84[_0x59a613(0x221)]??_0x59a613(0x212);}catch(_0x2aaf69){return logMcpStderr(_0x59a613(0x27e),_0x2aaf69),_0x59a613(0x212);}}function printHelp(){const _0x146f24=a0_0x2d77;console[_0x146f24(0x214)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x146f24(0x214)](_0x146f24(0x198)),console[_0x146f24(0x214)](_0x146f24(0x1ee)),console[_0x146f24(0x214)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x146f24(0x214)](_0x146f24(0x199)),console[_0x146f24(0x214)](_0x146f24(0x258)),console[_0x146f24(0x214)](_0x146f24(0x25b)),console[_0x146f24(0x214)](_0x146f24(0x1ff)),console[_0x146f24(0x214)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x444bf9(0x19c)][a0_0x444bf9(0x294)](0x2),VERSION_FLAGS=new Set([a0_0x444bf9(0x1ca),'-v','-V']),HELP_FLAGS=new Set([a0_0x444bf9(0x19f),'-h']);cliArgs[a0_0x444bf9(0x228)](_0x4cf66d=>VERSION_FLAGS[a0_0x444bf9(0x291)](_0x4cf66d))&&(console[a0_0x444bf9(0x214)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x444bf9(0x228)](_0x49c262=>HELP_FLAGS[a0_0x444bf9(0x291)](_0x49c262))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x295aba){const _0x274eaa=a0_0x444bf9;for(let _0x29949b=0x0;_0x29949b<cliArgs[_0x274eaa(0x193)];_0x29949b++){const _0x4692a8=cliArgs[_0x29949b];if(_0x4692a8[_0x274eaa(0x226)]('--'+_0x295aba+'='))return _0x4692a8[_0x274eaa(0x294)](('--'+_0x295aba+'=')[_0x274eaa(0x193)]);if(_0x4692a8==='--'+_0x295aba&&_0x29949b+0x1<cliArgs[_0x274eaa(0x193)])return cliArgs[_0x29949b+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x444bf9(0x193)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x444bf9(0x291)](arg))continue;if(arg[a0_0x444bf9(0x226)](a0_0x444bf9(0x1a1)))continue;if(arg===a0_0x444bf9(0x26b)){i++;continue;}args[a0_0x444bf9(0x1af)](arg);}const WORKSPACE_ROOT=process[a0_0x444bf9(0x20d)]['WORKSPACE_ROOT']||process[a0_0x444bf9(0x20d)][a0_0x444bf9(0x28c)]||process[a0_0x444bf9(0x282)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x444bf9(0x222)]!==a0_0x444bf9(0x20c),MORPH_API_KEY=getCliArg('api-key')??process['env'][a0_0x444bf9(0x20b)],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x444bf9(0x20d)][a0_0x444bf9(0x22e)]?parseInt(process[a0_0x444bf9(0x20d)][a0_0x444bf9(0x22e)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x444bf9(0x281),a0_0x444bf9(0x220),'github_codebase_search']),DISABLED_TOOLS=process['env'][a0_0x444bf9(0x1f0)]?new Set(process[a0_0x444bf9(0x20d)][a0_0x444bf9(0x1f0)]['split'](',')[a0_0x444bf9(0x1e1)](_0x291cf1=>_0x291cf1[a0_0x444bf9(0x1f6)]())[a0_0x444bf9(0x1b2)](_0x4609b0=>_0x4609b0[a0_0x444bf9(0x193)]>0x0)):new Set();if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x444bf9(0x291)](tool)&&console[a0_0x444bf9(0x1a3)](a0_0x444bf9(0x1d9)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x444bf9(0x1c1)](',\x20'));}console[a0_0x444bf9(0x1a3)](a0_0x444bf9(0x225)+[...DISABLED_TOOLS][a0_0x444bf9(0x1c1)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x444bf9(0x226)](a0_0x444bf9(0x1f4))&&!MORPH_API_KEY[a0_0x444bf9(0x226)](a0_0x444bf9(0x24d))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x52e6fa){const _0x4d7edb=a0_0x444bf9;try{await a0_0x24b08d[_0x4d7edb(0x1aa)](_0x4d7edb(0x19a),{..._0x52e6fa,'timestamp':new Date()[_0x4d7edb(0x1fb)](),'source':_0x52e6fa['source']||_0x4d7edb(0x25a),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x52e6fa[_0x4d7edb(0x191)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x4d7edb(0x1be)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x444bf9(0x1ab)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x444bf9(0x231)),logMcpStderr(a0_0x444bf9(0x26d)),logMcpStderr(a0_0x444bf9(0x27a)),logMcpStderr(a0_0x444bf9(0x1a5)));function normalizePath(_0x9f3b0e){return a0_0x35ce7e['normalize'](_0x9f3b0e);}function expandHome(_0x4f9946){const _0x9e27a8=a0_0x444bf9;if(_0x4f9946['startsWith']('~/')||_0x4f9946==='~')return a0_0x35ce7e['join'](a0_0x5cb303[_0x9e27a8(0x262)](),_0x4f9946['slice'](0x1));return _0x4f9946;}let allowedDirectories=await Promise['all'](args[a0_0x444bf9(0x1e1)](async _0x586c69=>{const _0x49a7c9=a0_0x444bf9,_0x45f034=expandHome(_0x586c69),_0x26a932=a0_0x35ce7e[_0x49a7c9(0x1d1)](_0x45f034);try{const _0x5a9f93=await a0_0x1c8efe['realpath'](_0x26a932);return normalizePath(_0x5a9f93);}catch(_0x3958cc){return normalizePath(_0x26a932);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x444bf9(0x193)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x444bf9(0x1af)](workspaceDir),logMcpStderr(a0_0x444bf9(0x1f5)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x44b8b7){logMcpStderr(a0_0x444bf9(0x1b1)+a0_0x44b8b7);}async function detectWorkspaceRoot(_0x378d41){const _0xbf78ce=a0_0x444bf9;let _0x2ac732=a0_0x35ce7e['resolve'](_0x378d41);const _0xb6ab50=['.git',_0xbf78ce(0x18a),_0xbf78ce(0x240),_0xbf78ce(0x1cc),_0xbf78ce(0x1c8),_0xbf78ce(0x270),_0xbf78ce(0x21c),_0xbf78ce(0x1d7),_0xbf78ce(0x21f)];while(_0x2ac732!==a0_0x35ce7e[_0xbf78ce(0x26f)](_0x2ac732)){for(const _0x72980b of _0xb6ab50){const _0x48abff=a0_0x35ce7e['join'](_0x2ac732,_0x72980b);try{return await a0_0x1c8efe[_0xbf78ce(0x26e)](_0x48abff),normalizePath(_0x2ac732);}catch{}}_0x2ac732=a0_0x35ce7e[_0xbf78ce(0x26f)](_0x2ac732);}return normalizePath(_0x378d41);}await Promise[a0_0x444bf9(0x1d6)](args['map'](async _0x23358e=>{const _0x5bcc7f=a0_0x444bf9;try{const _0x23fcab=await a0_0x1c8efe[_0x5bcc7f(0x1a0)](expandHome(_0x23358e));!_0x23fcab[_0x5bcc7f(0x24e)]()&&(logMcpStderr(_0x5bcc7f(0x25f)+_0x23358e+_0x5bcc7f(0x1e3)),process[_0x5bcc7f(0x28f)](0x1));}catch(_0x5c9b0d){logMcpStderr(_0x5bcc7f(0x261)+_0x23358e+':',_0x5c9b0d),process[_0x5bcc7f(0x28f)](0x1);}}));async function validatePath(_0x105db2){const _0x4d50e6=a0_0x444bf9,_0x5994ba=expandHome(_0x105db2),_0x12ca5a=a0_0x35ce7e[_0x4d50e6(0x1d1)](_0x5994ba);try{const _0x4d71d6=await a0_0x1c8efe[_0x4d50e6(0x1bd)](_0x12ca5a);return _0x4d71d6;}catch(_0x5143d6){if(_0x5143d6[_0x4d50e6(0x256)]===_0x4d50e6(0x1c0)){const _0x5c25ff=a0_0x35ce7e[_0x4d50e6(0x26f)](_0x12ca5a);try{const _0x3e4459=await a0_0x1c8efe[_0x4d50e6(0x1bd)](_0x5c25ff);return a0_0x35ce7e['join'](_0x3e4459,a0_0x35ce7e[_0x4d50e6(0x227)](_0x12ca5a));}catch{throw new Error(_0x4d50e6(0x213)+_0x5c25ff);}}throw _0x5143d6;}}function a0_0x20ce(){const _0x566486=['instruction','lines','default','Failed\x20to\x20read\x20file:\x20','every','PathError','.cursor','FileReadError','requiresApiKey','composer.json','codebase_search','version','ENABLE_WORKSPACE_MODE','stringify','object','Disabled\x20tools:\x20','startsWith','basename','some','28MBGlSh','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','etimedout','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','text','MORPH_WARP_GREP_TIMEOUT','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','substring','user','setRequestHandler','code_edit','added\x20','runWarpGrep_call','indexOf','BinaryFile','timings','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.','repo_path','metadata','inputSchema','package.json','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.',',\x20modified\x20','searchGitHub','branch','39152700RjJpyI','sep','.\x20Changes:\x20','morph-warp-grep-v1-1111v0','errors','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','linesAdded','\x20disabled\x20via\x20DISABLED_TOOLS','morph-','isDirectory','unknown\x20error','data','20xwdPgz','Warning:\x20','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Here\x20is\x20the\x20content\x20of\x20files:\x0a','connect','code','match','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','WarpGrepError','mcp-filesystem','\x0aExamples:','\x22>\x0aError\x20reading\x20file:\x20','\x20for:\x20\x22','\x20valid\x20directories','Error:\x20','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','Error\x20accessing\x20directory\x20','homedir','path','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','TimeoutError','Preview\x20changes\x20without\x20applying\x20them.','utf-8','UnknownError','6714360MyEsiM','getClientCapabilities','--api-key','Fallback:\x20Using\x20workspace\x20root\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','access','dirname','go.mod','isArray','toLowerCase','optional','dryRun','Fatal\x20error\x20running\x20server:','Unknown\x20tool:\x20','array','../package.json','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','owner_repo','roots','github_codebase_search','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','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','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','edit_file','cwd','morph-v3-fast','GitHub\x20search\x20failed:\x20','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','Specific\x20commit\x20hash\x20to\x20search','WarpGrep\x20sub-tool\x20errors:\x20','success','files','enum','PWD','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','exit','[could\x20not\x20read\x20file:\x20','has','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Created\x20File','slice','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','readFile','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','.vscode','<file\x20path=\x22','node_modules','read','content','params','assistant','context','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','length','payload','messages','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','https://morphllm.com/api/error-report','split','argv','oninitialized','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','--help','stat','--api-key=','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','error','For\x20deletions:\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','stack','ms:','Repository\x20identifier','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.','post','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','completed_with_file_errors','timeout','Morph\x20FastApply\x20failed\x20without\x20error\x20message','push','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','filter','0.2.0','\x27\x20in\x20`','constructor','-\x20Grepped\x20\x27',',\x20removed\x20','timed\x20out','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','RipgrepError','catch','Invalid\x20arguments:\x20','realpath','Bearer\x20','651201XCFuDf','ENOENT','join','github_url','read\x20','800835GssrtI','Applied','[github_codebase_search]\x20Searching\x20','.\x20Path:\x20','pyproject.toml','Tool\x20','--version','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Cargo.toml','Benefits:\x0a','[github_codebase_search]\x20Failed\x20in\x20','5PsdOqU','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','resolve','SymlinkError','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','linesModified','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','all','tsconfig.json','warn','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','describe','5112283iqrxaN','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','message','now','Tool\x20\x22','\x0a...\x20(truncated,\x20total:\x20','map','string','\x20is\x20not\x20a\x20directory','Morph\x20Edit\x20Preview','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','ReadError','ToolException','listRoots','2041338aocoCs','Morph\x20Edit\x20','Error\x20running\x20fast\x20context\x20search:\x20','SubToolError','safeParse','\x0aOptions:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','DISABLED_TOOLS','2anFKPV','\x20(new\x20file)','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','sk-','Workspace\x20mode\x20enabled:\x20Using\x20','trim','includes','1391892zTQlbF','name','8DXfqJD','toISOString','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Rules:\x0a','description','\x20\x20morph-mcp','\x20error(s)','number','changes','boolean','search_string','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','terminationReason','min','RipgrepNotAvailable','grep','MORPH_API_KEY','false','env','role','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','Relevant\x20context\x20found:','unknown','Parent\x20directory\x20does\x20not\x20exist:\x20','log','finish'];a0_0x20ce=function(){return _0x566486;};return a0_0x20ce();}const MorphEditFileArgsSchema=z[a0_0x444bf9(0x224)]({'path':z[a0_0x444bf9(0x1e2)](),'code_edit':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x28e)),'instruction':z['string']()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x1d0)),'dryRun':z[a0_0x444bf9(0x203)]()[a0_0x444bf9(0x218)](![])['describe'](a0_0x444bf9(0x266))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x444bf9(0x1a9),WarpGrepArgsSchema=z[a0_0x444bf9(0x224)]({'search_string':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x1da)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x1da)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x444bf9(0x28b)](['default',a0_0x444bf9(0x18c)])[a0_0x444bf9(0x273)]()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x241))}),WarpGrepGitHubArgsSchema=z[a0_0x444bf9(0x224)]({'search_string':z['string']()[a0_0x444bf9(0x1da)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x273)]()[a0_0x444bf9(0x1da)]('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_0x444bf9(0x1e2)]()[a0_0x444bf9(0x273)]()['describe'](a0_0x444bf9(0x279)),'branch':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x273)]()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x205))}),CodebaseSearchArgsSchema=z[a0_0x444bf9(0x224)]({'query':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x1da)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x1a8)),'branch':z[a0_0x444bf9(0x1e2)]()[a0_0x444bf9(0x273)]()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x264)),'commitHash':z['string']()[a0_0x444bf9(0x273)]()[a0_0x444bf9(0x1da)](a0_0x444bf9(0x287)),'targetDirectories':z[a0_0x444bf9(0x277)](z[a0_0x444bf9(0x1e2)]())[a0_0x444bf9(0x218)]([])['describe'](a0_0x444bf9(0x1cb)),'limit':z[a0_0x444bf9(0x201)]()['optional']()['default'](0xa)[a0_0x444bf9(0x1da)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x444bf9(0x1b3)},{'capabilities':{'tools':{}}});server[a0_0x444bf9(0x235)](ListToolsRequestSchema,async()=>{const _0x579827=a0_0x444bf9,_0x44f8a5=[{'name':_0x579827(0x281),'description':_0x579827(0x285)+_0x579827(0x1dc)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x579827(0x19e)+_0x579827(0x1cd)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x579827(0x206)+_0x579827(0x22f)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+_0x579827(0x28d)+_0x579827(0x1a2)+_0x579827(0x20f)+_0x579827(0x1a4)+_0x579827(0x1ef)+_0x579827(0x1d5)+_0x579827(0x1fd)+_0x579827(0x192)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x579827(0x253)+_0x579827(0x1d3)+_0x579827(0x197)+_0x579827(0x196)+_0x579827(0x260),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x579827(0x220),'description':_0x579827(0x27f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x579827(0x280)+_0x579827(0x1f3)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x352c58=_0x44f8a5[_0x579827(0x1b2)](_0x33e6d1=>{const _0x458292=_0x579827;if(DISABLED_TOOLS['has'](_0x33e6d1[_0x458292(0x1f9)]))return console[_0x458292(0x1a3)](_0x458292(0x1c9)+_0x33e6d1[_0x458292(0x1f9)]+_0x458292(0x24c)),![];if(_0x458292(0x21e)in _0x33e6d1&&_0x33e6d1[_0x458292(0x21e)]&&!MORPH_API_KEY)return logMcpStderr(_0x458292(0x252)+_0x33e6d1[_0x458292(0x1f9)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x352c58[_0x579827(0x1e1)](_0x530a87=>({'name':_0x530a87['name'],'description':_0x530a87[_0x579827(0x1fe)],'inputSchema':_0x530a87[_0x579827(0x23f)]}))};}),server[a0_0x444bf9(0x235)](CallToolRequestSchema,async _0x1dcc5f=>{const _0x4e4103=a0_0x444bf9,{name:_0x120311,arguments:_0x32625e}=_0x1dcc5f[_0x4e4103(0x18f)];try{if(DISABLED_TOOLS[_0x4e4103(0x291)](_0x120311))throw new Error(_0x4e4103(0x1df)+_0x120311+_0x4e4103(0x286));switch(_0x120311){case _0x4e4103(0x281):{const _0x4468e4=MorphEditFileArgsSchema[_0x4e4103(0x1ed)](_0x32625e);if(!_0x4468e4[_0x4e4103(0x289)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x4468e4['error']);const _0x5c69ca=await validatePath(_0x4468e4[_0x4e4103(0x250)]['path']);let _0x2c8b45=null,_0x436aea=!![],_0x21003f=null;try{_0x2c8b45=await a0_0x1c8efe[_0x4e4103(0x296)](_0x5c69ca,_0x4e4103(0x267));}catch(_0x5cec27){const _0x44399f=_0x5cec27['code'];_0x44399f===_0x4e4103(0x1c0)?(_0x436aea=![],_0x2c8b45=''):(_0x21003f=_0x4e4103(0x219)+(_0x44399f||'unknown')+'\x20-\x20'+(_0x5cec27 instanceof Error?_0x5cec27[_0x4e4103(0x1dd)]:String(_0x5cec27)),logMcpStderr(_0x4e4103(0x252)+_0x21003f));}let _0x89e79f;try{const _0x4ab829=MORPH_API_KEY;if(!_0x4ab829)throw new Error(_0x4e4103(0x1e5));const _0x7e7bc6=a0_0x35ce7e['dirname'](_0x5c69ca),_0x3210b3=a0_0x35ce7e[_0x4e4103(0x227)](_0x5c69ca),_0xd3034d=await executeEditFile({'target_filepath':_0x3210b3,'code_edit':_0x4468e4['data'][_0x4e4103(0x236)],'instructions':_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x216)]},{'morphApiKey':_0x4ab829,'morphApiUrl':MORPH_API_URL,'baseDir':_0x7e7bc6,'autoWrite':!_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x274)],'generateUdiff':![],'debug':![]});_0x89e79f=_0xd3034d['completionId'];if(!_0xd3034d['success'])throw new Error(_0xd3034d[_0x4e4103(0x1a3)]||_0x4e4103(0x1ae));const _0x1bc200=_0xd3034d[_0x4e4103(0x202)],_0x467f74=_0x4e4103(0x237)+_0x1bc200[_0x4e4103(0x24b)]+_0x4e4103(0x1b7)+_0x1bc200['linesRemoved']+_0x4e4103(0x242)+_0x1bc200[_0x4e4103(0x1d4)];if(_0x4468e4[_0x4e4103(0x250)]['dryRun'])return{'content':[{'type':_0x4e4103(0x22d),'text':_0x4e4103(0x1e4)+(_0x436aea?'':_0x4e4103(0x1f2))+':\x20'+_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x216)]+_0x4e4103(0x247)+_0x467f74+_0x4e4103(0x1c7)+_0x4468e4['data'][_0x4e4103(0x263)]+'.'}]};return{'content':[{'type':'text','text':_0x4e4103(0x1ea)+(_0x436aea?_0x4e4103(0x1c5):_0x4e4103(0x293))+':\x20'+_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x216)]+'.\x20Changes:\x20'+_0x467f74+_0x4e4103(0x1c7)+_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x263)]+'.'}]};}catch(_0x702240){const _0x377f35=_0x702240 instanceof Error?_0x702240['message']:String(_0x702240);return reportMorphError({'error_message':_0x377f35,'error_type':_0x702240 instanceof Error?_0x702240[_0x4e4103(0x1b5)][_0x4e4103(0x1f9)]:'UnknownError','context':{'tool':_0x4e4103(0x281),'completion_id':_0x89e79f,'file_path':_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x263)],'validated_path':_0x5c69ca,'instruction':_0x4468e4[_0x4e4103(0x250)]['instruction'],'model':_0x4e4103(0x283),'dry_run':_0x4468e4['data'][_0x4e4103(0x274)],'file_exists':_0x436aea,'file_read_error':_0x21003f,'file_readable':_0x2c8b45!==null,'request_content':{'path':_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x263)],'code_edit':_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x236)],'instruction':_0x4468e4['data'][_0x4e4103(0x216)],'original_code':_0x2c8b45!==null?_0x2c8b45[_0x4e4103(0x193)]>0xc350?_0x2c8b45['substring'](0x0,0xc350)+_0x4e4103(0x1e0)+_0x2c8b45[_0x4e4103(0x193)]+'\x20chars)':_0x2c8b45:_0x4e4103(0x290)+(_0x21003f||_0x4e4103(0x24f))+']','original_code_length':_0x2c8b45?.[_0x4e4103(0x193)]??0x0,'model':_0x4e4103(0x283),'dry_run':_0x4468e4[_0x4e4103(0x250)][_0x4e4103(0x274)]}},'stack_trace':_0x702240 instanceof Error?_0x702240[_0x4e4103(0x1a6)]:undefined,'source':_0x4e4103(0x25a)})[_0x4e4103(0x1bb)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x377f35}],'isError':!![]};}}case'codebase_search':{const _0x18046d=WarpGrepArgsSchema[_0x4e4103(0x1ed)](_0x32625e);if(!_0x18046d[_0x4e4103(0x289)])return{'content':[{'type':_0x4e4103(0x22d),'text':_0x4e4103(0x1bc)+_0x18046d[_0x4e4103(0x1a3)]}],'isError':!![]};const _0x34f735=_0x1f6f5c=>{const _0x57238e=_0x4e4103,_0x345c2f=[];for(const _0x3f46f6 of _0x1f6f5c||[]){const _0x8767d3=_0x3f46f6[_0x57238e(0x20e)],_0x1722f0=_0x3f46f6[_0x57238e(0x18e)];if(_0x8767d3===_0x57238e(0x190)&&_0x1722f0){const _0x4fe280=_0x1722f0[_0x57238e(0x19b)]('\x0a')[_0x57238e(0x1b2)](_0x5a1d41=>_0x5a1d41[_0x57238e(0x1f6)]());for(const _0x4bd33c of _0x4fe280){const _0x2edb19=_0x4bd33c[_0x57238e(0x257)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x2edb19){_0x345c2f[_0x57238e(0x1af)]('grep\x20\x27'+_0x2edb19[0x1]+'\x27\x20'+_0x2edb19[0x2]);continue;}const _0xbab3ba=_0x4bd33c['match'](/^read\s+(.+)$/);if(_0xbab3ba){_0x345c2f[_0x57238e(0x1af)](_0x57238e(0x1c3)+_0xbab3ba[0x1]);continue;}const _0x49638e=_0x4bd33c[_0x57238e(0x257)](/^list_directory\s+(.+)$/);if(_0x49638e){_0x345c2f[_0x57238e(0x1af)]('list_directory\x20'+_0x49638e[0x1]);continue;}}}}return _0x345c2f;},_0xb67d00=_0x421c30=>{const _0x34b0a2=_0x4e4103,_0x1775d0=[];if(!_0x421c30||!Array[_0x34b0a2(0x271)](_0x421c30))return _0x1775d0;const _0x1d2349=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x34b0a2(0x21b),'tool':_0x34b0a2(0x18d)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x34b0a2(0x23a),'tool':_0x34b0a2(0x18d)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x34b0a2(0x1ba),'tool':_0x34b0a2(0x20a)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x34b0a2(0x209),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x34b0a2(0x23a),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x34b0a2(0x1d2),'tool':_0x34b0a2(0x18d)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x34b0a2(0x18d)},{'pattern':/symbolic link/,'error_type':_0x34b0a2(0x1d2),'tool':_0x34b0a2(0x18d)},{'pattern':/Error reading file:/,'error_type':_0x34b0a2(0x1e6),'tool':_0x34b0a2(0x18d)},{'pattern':/status="error"/,'error_type':_0x34b0a2(0x1e7),'tool':_0x34b0a2(0x212)}];let _0x457c20=0x0;for(const _0x190a59 of _0x421c30){if(_0x190a59[_0x34b0a2(0x20e)]===_0x34b0a2(0x234)){_0x457c20++;const _0x4a6a2a=_0x190a59[_0x34b0a2(0x18e)];if(!_0x4a6a2a||typeof _0x4a6a2a!==_0x34b0a2(0x1e2))continue;for(const {pattern:_0x36b571,error_type:_0x19fb1f,tool:_0x5701be}of _0x1d2349){const _0x24f721=_0x4a6a2a[_0x34b0a2(0x257)](new RegExp(_0x36b571['source'],'g'));if(_0x24f721)for(const _0x41edf0 of _0x24f721){const _0x16e1f2=_0x4a6a2a[_0x34b0a2(0x239)](_0x41edf0),_0x20ca55=_0x4a6a2a[_0x34b0a2(0x233)](_0x16e1f2,Math[_0x34b0a2(0x208)](_0x16e1f2+0xc8,_0x4a6a2a[_0x34b0a2(0x193)]));_0x1775d0[_0x34b0a2(0x1af)]({'tool':_0x5701be,'error_type':_0x19fb1f,'error_message':_0x20ca55[_0x34b0a2(0x19b)]('\x0a')[0x0],'turn':_0x457c20});}}}}return _0x1775d0;};try{const _0x3a7797=a0_0x35ce7e[_0x4e4103(0x1d1)](_0x18046d[_0x4e4103(0x250)]['repo_path']),_0x1c0924=_0x18046d[_0x4e4103(0x250)]['search_type'],_0xfb3ba1=_0x1c0924===_0x4e4103(0x18c)?{'allowNames':[_0x4e4103(0x18c)]}:undefined,_0xd88ce9=new LocalRipgrepProvider(_0x3a7797,undefined,_0xfb3ba1),_0x92600d=await runWarpGrep({'searchTerm':_0x18046d['data'][_0x4e4103(0x204)],'repoRoot':_0x3a7797,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xd88ce9,'search_type':_0x1c0924}),_0x9969d8=_0xb67d00(_0x92600d[_0x4e4103(0x195)]);_0x9969d8[_0x4e4103(0x193)]>0x0&&reportMorphError({'error_message':_0x4e4103(0x288)+_0x9969d8[_0x4e4103(0x193)]+_0x4e4103(0x200),'error_type':_0x4e4103(0x1ec),'level':_0x4e4103(0x1d8),'tool':'codebase_search','context':{'repo_path':_0x18046d['data'][_0x4e4103(0x23d)],'query':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x204)],'model':_0x4e4103(0x248),'termination_reason':_0x92600d[_0x4e4103(0x207)],'sub_tool_errors':_0x9969d8,'timings':_0x92600d[_0x4e4103(0x23b)],'tool_calls':_0x34f735(_0x92600d['messages']),'messages':_0x92600d[_0x4e4103(0x195)]?.['map'](_0x3ee5c1=>({'role':_0x3ee5c1['role'],'content':_0x3ee5c1[_0x4e4103(0x18e)]}))},'source':_0x4e4103(0x25a)})[_0x4e4103(0x1bb)](()=>{});let _0x323d11='';if(_0x92600d[_0x4e4103(0x207)]==='completed'&&_0x92600d[_0x4e4103(0x215)]?.[_0x4e4103(0x23e)]?.['files']){const _0xef3ca7=_0x92600d[_0x4e4103(0x215)]['metadata']['files'];if(_0xef3ca7[_0x4e4103(0x193)]===0x0)return _0x323d11=_0x92600d[_0x4e4103(0x215)][_0x4e4103(0x194)]||_0x4e4103(0x22a),{'content':[{'type':_0x4e4103(0x22d),'text':_0x323d11}]};const _0x6877a=[],_0x8dedb9=[_0x4e4103(0x24a)];for(const _0x42da19 of _0x92600d[_0x4e4103(0x195)]){const _0x18ca75=_0x42da19[_0x4e4103(0x20e)],_0x52f0a7=_0x42da19[_0x4e4103(0x18e)];if(_0x18ca75===_0x4e4103(0x190)&&_0x52f0a7){const _0x1b6ade=_0x52f0a7[_0x4e4103(0x19b)]('\x0a')['filter'](_0x34212f=>_0x34212f['trim']());for(const _0x3ea2d5 of _0x1b6ade){const _0x4b8c8b=_0x3ea2d5[_0x4e4103(0x257)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x4b8c8b){_0x8dedb9[_0x4e4103(0x1af)](_0x4e4103(0x1b6)+_0x4b8c8b[0x1]+_0x4e4103(0x1b4)+_0x4b8c8b[0x2]+'`');continue;}const _0x56ac10=_0x3ea2d5[_0x4e4103(0x257)](/^read\s+(.+)$/);if(_0x56ac10){_0x8dedb9[_0x4e4103(0x1af)]('-\x20Read\x20file\x20`'+_0x56ac10[0x1]+'`');continue;}const _0x330d73=_0x3ea2d5[_0x4e4103(0x257)](/^list_directory\s+(.+)$/);if(_0x330d73){_0x8dedb9[_0x4e4103(0x1af)]('-\x20Listed\x20directory\x20`'+_0x330d73[0x1]+'`');continue;}}}}_0x6877a[_0x4e4103(0x1af)](_0x8dedb9[_0x4e4103(0x1c1)]('\x0a'));const _0x48a926=['',_0x4e4103(0x211)];for(const _0x3ba80b of _0xef3ca7){if(_0x3ba80b['lines']==='*')_0x48a926[_0x4e4103(0x1af)]('-\x20'+_0x3ba80b[_0x4e4103(0x263)]+':*');else{if(Array[_0x4e4103(0x271)](_0x3ba80b[_0x4e4103(0x217)])){const _0x16c6a3=_0x3ba80b['lines'][_0x4e4103(0x1e1)](([_0x36d7df,_0x54774b])=>{if(_0x36d7df===_0x54774b)return''+_0x36d7df;return _0x36d7df+'-'+_0x54774b;});_0x48a926[_0x4e4103(0x1af)]('-\x20'+_0x3ba80b['path']+':'+_0x16c6a3[_0x4e4103(0x1c1)](','));}else _0x48a926['push']('-\x20'+_0x3ba80b[_0x4e4103(0x263)]+':*');}}_0x48a926[_0x4e4103(0x1af)](''),_0x6877a[_0x4e4103(0x1af)](_0x48a926['join']('\x0a')),_0x6877a['push'](_0x4e4103(0x254));const _0x370886=[];for(const _0x338554 of _0xef3ca7){let _0x23b7e1=a0_0x35ce7e['resolve'](_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)],_0x338554[_0x4e4103(0x263)]),_0x437a9b=null,_0x22347b=null;try{_0x437a9b=await a0_0x1c8efe[_0x4e4103(0x296)](_0x23b7e1,{'encoding':'utf-8'});}catch(_0x39fcc4){const _0x27b0f9=fixPathRepetition(_0x23b7e1);if(_0x27b0f9)try{_0x437a9b=await a0_0x1c8efe[_0x4e4103(0x296)](_0x27b0f9,{'encoding':'utf-8'}),_0x23b7e1=_0x27b0f9;}catch{_0x22347b=_0x39fcc4 instanceof Error?_0x39fcc4:new Error(String(_0x39fcc4));}else _0x22347b=_0x39fcc4 instanceof Error?_0x39fcc4:new Error(String(_0x39fcc4));}if(_0x437a9b!==null){const _0x5079e1=_0x437a9b['split'](/\r?\n/),_0x3dce49=[_0x4e4103(0x18b)+_0x338554['path']+'\x22>'];if(_0x338554['lines']==='*'||!Array[_0x4e4103(0x271)](_0x338554['lines']))for(let _0x418ec6=0x1;_0x418ec6<=_0x5079e1[_0x4e4103(0x193)];_0x418ec6++){const _0x1360de=_0x5079e1[_0x418ec6-0x1];_0x3dce49[_0x4e4103(0x1af)](_0x418ec6+'|\x20'+_0x1360de);}else for(const [_0x3408cd,_0x57a2bb]of _0x338554[_0x4e4103(0x217)]){_0x3dce49['length']>0x1&&_0x3dce49[_0x4e4103(0x1af)]('');for(let _0x5d39d0=_0x3408cd;_0x5d39d0<=_0x57a2bb&&_0x5d39d0<=_0x5079e1[_0x4e4103(0x193)];_0x5d39d0++){const _0x2f2cfa=_0x5079e1[_0x5d39d0-0x1];_0x3dce49[_0x4e4103(0x1af)](_0x5d39d0+'|\x20'+_0x2f2cfa);}}_0x3dce49[_0x4e4103(0x1af)]('</file>'),_0x370886['push'](_0x3dce49[_0x4e4103(0x1c1)]('\x0a'));}else _0x370886[_0x4e4103(0x1af)](_0x4e4103(0x18b)+_0x338554['path']+_0x4e4103(0x25c)+(_0x22347b?.[_0x4e4103(0x1dd)]||'Unknown\x20error')+'\x0a</file>');}_0x6877a['push'](_0x370886['join']('\x0a\x0a')),_0x323d11=_0x6877a[_0x4e4103(0x1c1)]('\x0a');const _0x1e2c8a=_0x92600d[_0x4e4103(0x249)]?.[_0x4e4103(0x1b2)](_0x1dd1c2=>_0x1dd1c2[_0x4e4103(0x1dd)]?.[_0x4e4103(0x226)]('File\x20read\x20error:'))||[];if(_0x1e2c8a['length']>0x0){const _0x14da29=_0x1e2c8a[_0x4e4103(0x1e1)](_0x42e69a=>_0x42e69a[_0x4e4103(0x1dd)])['join'](';\x20');reportMorphError({'error_message':_0x14da29,'error_type':_0x4e4103(0x21d),'context':{'tool':_0x4e4103(0x220),'repo_path':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)],'query':_0x18046d[_0x4e4103(0x250)]['search_string'],'model':_0x4e4103(0x248),'termination_reason':_0x4e4103(0x1ac),'error_count':_0x1e2c8a[_0x4e4103(0x193)],'is_timeout':![],'timings':_0x92600d[_0x4e4103(0x23b)],'files_attempted':_0xef3ca7[_0x4e4103(0x1e1)](_0x35357d=>({'path':_0x35357d[_0x4e4103(0x263)],'lines':_0x35357d[_0x4e4103(0x217)]})),'tool_calls':_0x34f735(_0x92600d[_0x4e4103(0x195)]),'messages':_0x92600d[_0x4e4103(0x195)]?.[_0x4e4103(0x1e1)](_0x32dbc=>({'role':_0x32dbc[_0x4e4103(0x20e)],'content':_0x32dbc[_0x4e4103(0x18e)]})),'request_content':{'query':_0x18046d['data']['search_string'],'repo_path':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)],'repoRoot':a0_0x35ce7e[_0x4e4103(0x1d1)](_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)]),'model':_0x4e4103(0x248)}},'source':_0x4e4103(0x25a)})[_0x4e4103(0x1bb)](()=>{});}}else{if(_0x92600d[_0x4e4103(0x207)]==='terminated'&&_0x92600d[_0x4e4103(0x249)][_0x4e4103(0x193)]>0x0){const _0x5356dd=_0x92600d[_0x4e4103(0x249)][_0x4e4103(0x1e1)](_0x4ec44e=>_0x4ec44e[_0x4e4103(0x1dd)])[_0x4e4103(0x1c1)](';\x20');_0x323d11=_0x4e4103(0x25f)+_0x5356dd;const _0x2afd61=_0x5356dd[_0x4e4103(0x272)]()['includes']('timeout')||_0x5356dd['toLowerCase']()[_0x4e4103(0x1f7)]('timed\x20out')||_0x5356dd['toLowerCase']()[_0x4e4103(0x1f7)](_0x4e4103(0x22b)),_0x34f17a=_0x92600d[_0x4e4103(0x215)]?.[_0x4e4103(0x23e)]?.[_0x4e4103(0x28a)],_0x1b90bb=_0x92600d['errors'][0x0];reportMorphError({'error_message':_0x5356dd,'error_type':_0x2afd61?_0x4e4103(0x265):_0x1b90bb?.[_0x4e4103(0x1b5)]?.[_0x4e4103(0x1f9)]||_0x4e4103(0x259),'context':{'tool':_0x4e4103(0x220),'repo_path':_0x18046d['data'][_0x4e4103(0x23d)],'query':_0x18046d[_0x4e4103(0x250)]['search_string'],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x92600d[_0x4e4103(0x207)],'error_count':_0x92600d['errors'][_0x4e4103(0x193)],'is_timeout':_0x2afd61,'timings':_0x92600d[_0x4e4103(0x23b)],'files_attempted':_0x34f17a?.[_0x4e4103(0x1e1)](_0x2c4253=>({'path':_0x2c4253[_0x4e4103(0x263)],'lines':_0x2c4253[_0x4e4103(0x217)]})),'tool_calls':_0x34f735(_0x92600d[_0x4e4103(0x195)]),'messages':_0x92600d['messages']?.['map'](_0x37f5ac=>({'role':_0x37f5ac[_0x4e4103(0x20e)],'content':_0x37f5ac[_0x4e4103(0x18e)]})),'request_content':{'query':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x204)],'repo_path':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)],'repoRoot':a0_0x35ce7e[_0x4e4103(0x1d1)](_0x18046d[_0x4e4103(0x250)]['repo_path']),'model':_0x4e4103(0x248)}},'stack_trace':_0x1b90bb?.[_0x4e4103(0x1a6)]||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0x323d11='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x323d11}]};}catch(_0x560f5c){const _0x1b316b=_0x560f5c instanceof Error?_0x560f5c[_0x4e4103(0x1dd)]:String(_0x560f5c),_0x4b54a1=_0x1b316b[_0x4e4103(0x272)]()[_0x4e4103(0x1f7)](_0x4e4103(0x1ad))||_0x1b316b[_0x4e4103(0x272)]()[_0x4e4103(0x1f7)](_0x4e4103(0x1b8))||_0x1b316b[_0x4e4103(0x272)]()[_0x4e4103(0x1f7)](_0x4e4103(0x22b))||_0x560f5c instanceof Error&&_0x560f5c[_0x4e4103(0x1f9)]===_0x4e4103(0x265);return reportMorphError({'error_message':_0x1b316b,'error_type':_0x4b54a1?_0x4e4103(0x265):_0x560f5c instanceof Error?_0x560f5c[_0x4e4103(0x1b5)][_0x4e4103(0x1f9)]:_0x4e4103(0x268),'context':{'tool':_0x4e4103(0x220),'repo_path':_0x18046d[_0x4e4103(0x250)]['repo_path'],'query':_0x18046d[_0x4e4103(0x250)]['search_string'],'model':_0x4e4103(0x248),'is_timeout':_0x4b54a1,'exception_phase':_0x4e4103(0x238),'request_content':{'query':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x204)],'repo_path':_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)],'repoRoot':a0_0x35ce7e['resolve'](_0x18046d[_0x4e4103(0x250)][_0x4e4103(0x23d)]),'model':_0x4e4103(0x248)}},'stack_trace':_0x560f5c instanceof Error?_0x560f5c[_0x4e4103(0x1a6)]:undefined,'source':_0x4e4103(0x25a)})[_0x4e4103(0x1bb)](()=>{}),{'content':[{'type':'text','text':_0x4e4103(0x1eb)+_0x1b316b}],'isError':![]};}}case'github_codebase_search':{const _0x488ca2=WarpGrepGitHubArgsSchema[_0x4e4103(0x1ed)](_0x32625e);if(!_0x488ca2['success'])return{'content':[{'type':_0x4e4103(0x22d),'text':'Invalid\x20arguments:\x20'+_0x488ca2[_0x4e4103(0x1a3)]}],'isError':!![]};const _0x2a6e87=_0x488ca2[_0x4e4103(0x250)][_0x4e4103(0x1c2)]||_0x488ca2[_0x4e4103(0x250)][_0x4e4103(0x27b)];if(!_0x2a6e87)return{'content':[{'type':_0x4e4103(0x22d),'text':_0x4e4103(0x295)}],'isError':!![]};const _0xf21d43=MORPH_API_KEY;if(!_0xf21d43)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x2c22d7=Date[_0x4e4103(0x1de)]();logMcpStderr(_0x4e4103(0x1c6)+_0x2a6e87+_0x4e4103(0x25d)+_0x488ca2[_0x4e4103(0x250)][_0x4e4103(0x204)]+'\x22');try{const _0x14a830=new WarpGrepClient({'morphApiKey':_0xf21d43,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x91ae98=await _0x14a830[_0x4e4103(0x243)]({'searchTerm':_0x488ca2[_0x4e4103(0x250)]['search_string'],'github':_0x2a6e87,'branch':_0x488ca2['data'][_0x4e4103(0x244)]}),_0x1203ba=Date[_0x4e4103(0x1de)]()-_0x2c22d7;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x1203ba+'ms.\x20Success:\x20'+_0x91ae98[_0x4e4103(0x289)]);const _0x97d967=formatResult(_0x91ae98);return{'content':[{'type':'text','text':_0x97d967}]};}catch(_0x215074){const _0x49072c=Date[_0x4e4103(0x1de)]()-_0x2c22d7,_0x43868e=_0x215074 instanceof Error?_0x215074[_0x4e4103(0x1dd)]:String(_0x215074);return logMcpStderr(_0x4e4103(0x1ce)+_0x49072c+_0x4e4103(0x1a7),_0x43868e),reportMorphError({'error_message':_0x43868e,'error_type':_0x215074 instanceof Error?_0x215074['constructor'][_0x4e4103(0x1f9)]:_0x4e4103(0x268),'context':{'tool':_0x4e4103(0x27d),'github_url':_0x2a6e87,'search_string':_0x488ca2[_0x4e4103(0x250)][_0x4e4103(0x204)],'branch':_0x488ca2[_0x4e4103(0x250)][_0x4e4103(0x244)]},'stack_trace':_0x215074 instanceof Error?_0x215074[_0x4e4103(0x1a6)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x49072c})['catch'](()=>{}),{'content':[{'type':_0x4e4103(0x22d),'text':_0x4e4103(0x284)+_0x43868e}],'isError':![]};}}default:throw new Error(_0x4e4103(0x276)+_0x120311);}}catch(_0x5677f7){const _0x2bd155=_0x5677f7 instanceof Error?_0x5677f7[_0x4e4103(0x1dd)]:String(_0x5677f7);return reportMorphError({'error_message':_0x2bd155,'error_type':_0x5677f7 instanceof Error?_0x5677f7[_0x4e4103(0x1b5)][_0x4e4103(0x1f9)]:_0x4e4103(0x268),'context':{'tool':_0x120311,'arguments':_0x32625e?JSON[_0x4e4103(0x223)](_0x32625e)[_0x4e4103(0x233)](0x0,0x1f4):undefined,'mcp_server_version':_0x4e4103(0x1b3)},'stack_trace':_0x5677f7 instanceof Error?_0x5677f7['stack']:undefined,'source':'mcp-filesystem'})[_0x4e4103(0x1bb)](()=>{}),{'content':[{'type':_0x4e4103(0x22d),'text':_0x4e4103(0x25f)+_0x2bd155}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x44ede4){const _0x5134dd=a0_0x444bf9,_0x2aba02=await getValidRootDirectories(_0x44ede4);if(_0x2aba02[_0x5134dd(0x193)]>0x0)allowedDirectories=[..._0x2aba02],logMcpStderr(_0x5134dd(0x230)+_0x2aba02['length']+_0x5134dd(0x25e));else{logMcpStderr(_0x5134dd(0x189));if(ENABLE_WORKSPACE_MODE)try{const _0x177a91=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x177a91&&(allowedDirectories=[_0x177a91],logMcpStderr(_0x5134dd(0x26c)+_0x177a91));}catch(_0x15bb65){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x15bb65);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x76134e=a0_0x444bf9;try{const _0x455f74=await server[_0x76134e(0x1e8)]();_0x455f74&&'roots'in _0x455f74&&await updateAllowedDirectoriesFromRoots(_0x455f74[_0x76134e(0x27c)]);}catch(_0x290852){logMcpStderr(_0x76134e(0x210),_0x290852 instanceof Error?_0x290852[_0x76134e(0x1dd)]:String(_0x290852));}}),server[a0_0x444bf9(0x19d)]=async()=>{const _0x1d4dc4=a0_0x444bf9,_0x4e882b=server[_0x1d4dc4(0x26a)]();if(_0x4e882b?.[_0x1d4dc4(0x27c)])try{const _0x5f41f7=await server[_0x1d4dc4(0x1e8)]();_0x5f41f7&&_0x1d4dc4(0x27c)in _0x5f41f7?await updateAllowedDirectoriesFromRoots(_0x5f41f7[_0x1d4dc4(0x27c)]):logMcpStderr(_0x1d4dc4(0x232));}catch(_0xd6e46c){logMcpStderr(_0x1d4dc4(0x292),_0xd6e46c instanceof Error?_0xd6e46c[_0x1d4dc4(0x1dd)]:String(_0xd6e46c));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x1d4dc4(0x1b0),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1d4dc4(0x1fc));else throw new Error(_0x1d4dc4(0x23c));}}};async function runServer(){const _0xf8ffd7=a0_0x444bf9,_0x503084=new StdioServerTransport();await server[_0xf8ffd7(0x255)](_0x503084),logMcpStderr(_0xf8ffd7(0x22c)),allowedDirectories[_0xf8ffd7(0x193)]===0x0&&logMcpStderr(_0xf8ffd7(0x1b9));}function a0_0x2d77(_0x2ca8b2,_0x321791){_0x2ca8b2=_0x2ca8b2-0x189;const _0x20ce27=a0_0x20ce();let _0x2d77dc=_0x20ce27[_0x2ca8b2];return _0x2d77dc;}runServer()[a0_0x444bf9(0x1bb)](_0x4c0ce1=>{const _0x1bd90c=a0_0x444bf9;logMcpStderr(_0x1bd90c(0x275),_0x4c0ce1),process['exit'](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x44ee8e,_0x3eb2f9){var _0x1c1bb8=a1_0x5a89,_0x513c39=_0x44ee8e();while(!![]){try{var _0x6ccd79=parseInt(_0x1c1bb8(0x1e1))/0x1*(-parseInt(_0x1c1bb8(0x1e2))/0x2)+parseInt(_0x1c1bb8(0x1dc))/0x3+parseInt(_0x1c1bb8(0x1df))/0x4*(-parseInt(_0x1c1bb8(0x1db))/0x5)+-parseInt(_0x1c1bb8(0x1d8))/0x6+parseInt(_0x1c1bb8(0x1e3))/0x7*(-parseInt(_0x1c1bb8(0x1e4))/0x8)+parseInt(_0x1c1bb8(0x1da))/0x9+parseInt(_0x1c1bb8(0x1dd))/0xa;if(_0x6ccd79===_0x3eb2f9)break;else _0x513c39['push'](_0x513c39['shift']());}catch(_0x1b8ffc){_0x513c39['push'](_0x513c39['shift']());}}}(a1_0x4e40,0xc888a));function a1_0x5a89(_0x45ad2d,_0x3560b8){_0x45ad2d=_0x45ad2d-0x1d6;var _0x4e404d=a1_0x4e40();var _0x5a890f=_0x4e404d[_0x45ad2d];return _0x5a890f;}import a1_0x5ce416 from'os';export function getOperatingSystemType(_0x5d47f9=a1_0x5ce416['platform']()){var _0x476543=a1_0x5a89;switch(_0x5d47f9){case _0x476543(0x1e0):return _0x476543(0x1e7);case _0x476543(0x1d7):return _0x476543(0x1e6);case'linux':return _0x476543(0x1de);default:return _0x476543(0x1d6);}}export function formatMcpLogMessage(_0x2d25c0,_0x129d31=a1_0x5ce416['platform']()){var _0x4a00d2=a1_0x5a89;return _0x4a00d2(0x1d9)+getOperatingSystemType(_0x129d31)+']\x20'+_0x2d25c0;}function a1_0x4e40(){var _0x42c0a8=['macOS','Unknown','win32','1661544qudNTH','[os=','13642830pAVwfu','616270pYlmRW','2133411JsgTxG','18965920DPQKcW','Linux','28xeHTWM','darwin','1qyiwsM','2086306dzKfsi','7835506KNkRPz','8sUKsEB','error','Windows'];a1_0x4e40=function(){return _0x42c0a8;};return a1_0x4e40();}export function logMcpStderr(_0x996922,..._0x4ee2db){var _0x22c201=a1_0x5a89;console[_0x22c201(0x1e5)](formatMcpLogMessage(_0x996922),..._0x4ee2db);}
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x25d4d1,_0x49c5aa){const _0x439107=a2_0x2578,_0x352173=_0x25d4d1();while(!![]){try{const _0x341d6d=parseInt(_0x439107(0x146))/0x1+parseInt(_0x439107(0x148))/0x2+parseInt(_0x439107(0x13c))/0x3*(parseInt(_0x439107(0x13d))/0x4)+-parseInt(_0x439107(0x13e))/0x5+parseInt(_0x439107(0x145))/0x6*(parseInt(_0x439107(0x138))/0x7)+-parseInt(_0x439107(0x149))/0x8+parseInt(_0x439107(0x13f))/0x9*(-parseInt(_0x439107(0x135))/0xa);if(_0x341d6d===_0x49c5aa)break;else _0x352173['push'](_0x352173['shift']());}catch(_0x35f90d){_0x352173['push'](_0x352173['shift']());}}}(a2_0x4056,0xc32e0));import a2_0x2d6df2 from'path';import a2_0x5bcfe7 from'os';function a2_0x4056(){const _0x274e67=['slice','57gzVmzr','164396LAFOtX','3915985KmceBt','11403FbMEiz','replace','homedir','test','trim','startsWith','1644KLkCMK','1051111xrFxxT','charAt','2931108XBBlNf','6800912hWzwXD','/mnt/','toUpperCase','19150rfBRqi','join','substring','39893LXDkWN','normalize','match'];a2_0x4056=function(){return _0x274e67;};return a2_0x4056();}export function convertToWindowsPath(_0x5387cc){const _0x1cf95b=a2_0x2578;if(_0x5387cc[_0x1cf95b(0x144)](_0x1cf95b(0x14a))){const _0x1e3345=_0x5387cc[_0x1cf95b(0x147)](0x5)[_0x1cf95b(0x14b)](),_0x440568=_0x5387cc['slice'](0x6)[_0x1cf95b(0x140)](/\//g,'\x5c');return _0x1e3345+':'+_0x440568;}if(_0x5387cc[_0x1cf95b(0x13a)](/^\/[a-zA-Z]\//)){const _0x46fd1b=_0x5387cc[_0x1cf95b(0x147)](0x1)[_0x1cf95b(0x14b)](),_0x666a15=_0x5387cc['slice'](0x2)[_0x1cf95b(0x140)](/\//g,'\x5c');return _0x46fd1b+':'+_0x666a15;}if(_0x5387cc[_0x1cf95b(0x13a)](/^[a-zA-Z]:/))return _0x5387cc[_0x1cf95b(0x140)](/\//g,'\x5c');return _0x5387cc;}function a2_0x2578(_0x3132a8,_0x454e4e){_0x3132a8=_0x3132a8-0x135;const _0x40562e=a2_0x4056();let _0x257867=_0x40562e[_0x3132a8];return _0x257867;}export function normalizePath(_0xa1bb91){const _0x2e2f1f=a2_0x2578;_0xa1bb91=_0xa1bb91[_0x2e2f1f(0x143)]()[_0x2e2f1f(0x140)](/^["']|["']$/g,'');const _0x2c5ef8=_0xa1bb91['startsWith']('/')&&!_0xa1bb91[_0x2e2f1f(0x13a)](/^\/mnt\/[a-z]\//i)&&!_0xa1bb91[_0x2e2f1f(0x13a)](/^\/[a-zA-Z]\//);if(_0x2c5ef8)return _0xa1bb91['replace'](/\/+/g,'/')[_0x2e2f1f(0x140)](/\/+$/,'');_0xa1bb91=convertToWindowsPath(_0xa1bb91);if(_0xa1bb91[_0x2e2f1f(0x144)]('\x5c\x5c')){let _0x328155=_0xa1bb91;_0x328155=_0x328155['replace'](/^\\{2,}/,'\x5c\x5c');const _0x126289=_0x328155[_0x2e2f1f(0x137)](0x2)[_0x2e2f1f(0x140)](/\\\\/g,'\x5c');_0xa1bb91='\x5c\x5c'+_0x126289;}else _0xa1bb91=_0xa1bb91[_0x2e2f1f(0x140)](/\\\\/g,'\x5c');let _0x474228=a2_0x2d6df2[_0x2e2f1f(0x139)](_0xa1bb91);_0xa1bb91[_0x2e2f1f(0x144)]('\x5c\x5c')&&!_0x474228[_0x2e2f1f(0x144)]('\x5c\x5c')&&(_0x474228='\x5c'+_0x474228);if(_0x474228[_0x2e2f1f(0x13a)](/^[a-zA-Z]:/)){let _0x590ece=_0x474228[_0x2e2f1f(0x140)](/\//g,'\x5c');return/^[a-z]:/[_0x2e2f1f(0x142)](_0x590ece)&&(_0x590ece=_0x590ece[_0x2e2f1f(0x147)](0x0)[_0x2e2f1f(0x14b)]()+_0x590ece[_0x2e2f1f(0x13b)](0x1)),_0x590ece;}return _0x474228[_0x2e2f1f(0x140)](/\//g,'\x5c');}export function expandHome(_0x2c0320){const _0x4abde0=a2_0x2578;if(_0x2c0320['startsWith']('~/')||_0x2c0320==='~')return a2_0x2d6df2[_0x4abde0(0x136)](a2_0x5bcfe7[_0x4abde0(0x141)](),_0x2c0320[_0x4abde0(0x13b)](0x1));return _0x2c0320;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x20e7dc,_0x4c811d){const _0x1539cf=a3_0x16a9,_0x2aa597=_0x20e7dc();while(!![]){try{const _0x276d23=parseInt(_0x1539cf(0xdc))/0x1+-parseInt(_0x1539cf(0xd2))/0x2+-parseInt(_0x1539cf(0xd9))/0x3*(parseInt(_0x1539cf(0xd7))/0x4)+-parseInt(_0x1539cf(0xe3))/0x5+parseInt(_0x1539cf(0xd6))/0x6+-parseInt(_0x1539cf(0xd5))/0x7*(-parseInt(_0x1539cf(0xde))/0x8)+parseInt(_0x1539cf(0xd4))/0x9;if(_0x276d23===_0x4c811d)break;else _0x2aa597['push'](_0x2aa597['shift']());}catch(_0x1f3169){_0x2aa597['push'](_0x2aa597['shift']());}}}(a3_0x20f1,0xbc679));function a3_0x16a9(_0x4cc367,_0x2f6423){_0x4cc367=_0x4cc367-0xd1;const _0x20f1c8=a3_0x20f1();let _0x16a930=_0x20f1c8[_0x4cc367];return _0x16a930;}import a3_0x3868be from'path';function a3_0x20f1(){const _0x46ea53=['startsWith','505720AkcqkW','length','5848281diXMTV','14854DwkCmm','5525190ItXQYh','52OwOXwy','isAbsolute','326634gtQdmk','resolve','includes','227253szulbZ','isArray','3856PRlQQx','normalize','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','Path\x20must\x20be\x20absolute\x20after\x20normalization','1903760BDvUVR'];a3_0x20f1=function(){return _0x46ea53;};return a3_0x20f1();}export function isPathWithinAllowedDirectories(_0x17e0e5,_0x4210a3){const _0x361b65=a3_0x16a9;if(typeof _0x17e0e5!=='string'||!Array[_0x361b65(0xdd)](_0x4210a3))return![];if(!_0x17e0e5||_0x4210a3[_0x361b65(0xd3)]===0x0)return![];if(_0x17e0e5['includes']('\x00'))return![];let _0x31807c;try{_0x31807c=a3_0x3868be['resolve'](a3_0x3868be['normalize'](_0x17e0e5));}catch{return![];}if(!a3_0x3868be[_0x361b65(0xd8)](_0x31807c))throw new Error(_0x361b65(0xe2));return _0x4210a3['some'](_0x3288aa=>{const _0x288b04=_0x361b65;if(typeof _0x3288aa!=='string'||!_0x3288aa)return![];if(_0x3288aa[_0x288b04(0xdb)]('\x00'))return![];let _0x30aee1;try{_0x30aee1=a3_0x3868be[_0x288b04(0xda)](a3_0x3868be[_0x288b04(0xdf)](_0x3288aa));}catch{return![];}if(!a3_0x3868be[_0x288b04(0xd8)](_0x30aee1))throw new Error(_0x288b04(0xe0));if(_0x31807c===_0x30aee1)return!![];if(_0x30aee1===a3_0x3868be[_0x288b04(0xe1)])return _0x31807c[_0x288b04(0xd1)](a3_0x3868be[_0x288b04(0xe1)]);return _0x31807c[_0x288b04(0xd1)](_0x30aee1+a3_0x3868be[_0x288b04(0xe1)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x539c3e,_0x21a377){const _0x3fdedd=a4_0x5258,_0x534262=_0x539c3e();while(!![]){try{const _0x5e9a13=parseInt(_0x3fdedd(0x179))/0x1+-parseInt(_0x3fdedd(0x18c))/0x2*(parseInt(_0x3fdedd(0x17c))/0x3)+parseInt(_0x3fdedd(0x17f))/0x4+parseInt(_0x3fdedd(0x17b))/0x5+parseInt(_0x3fdedd(0x183))/0x6+parseInt(_0x3fdedd(0x18f))/0x7*(parseInt(_0x3fdedd(0x17e))/0x8)+parseInt(_0x3fdedd(0x17a))/0x9*(-parseInt(_0x3fdedd(0x189))/0xa);if(_0x5e9a13===_0x21a377)break;else _0x534262['push'](_0x534262['shift']());}catch(_0x59999d){_0x534262['push'](_0x534262['shift']());}}}(a4_0x4473,0xdb2c4));import{promises as a4_0x38abce}from'fs';import a4_0x220507 from'path';import a4_0x4dc892 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x463af9){const _0x58e729=a4_0x5258;try{const _0x36671d=_0x463af9[_0x58e729(0x18e)](_0x58e729(0x18a))?_0x463af9[_0x58e729(0x181)](0x7):_0x463af9,_0x41870d=_0x36671d[_0x58e729(0x18e)]('~/')||_0x36671d==='~'?a4_0x220507[_0x58e729(0x18d)](a4_0x4dc892['homedir'](),_0x36671d['slice'](0x1)):_0x36671d,_0x379438=a4_0x220507[_0x58e729(0x180)](_0x41870d),_0x2927b2=await a4_0x38abce[_0x58e729(0x182)](_0x379438);return normalizePath(_0x2927b2);}catch{return null;}}function formatDirectoryError(_0x79af80,_0x572439,_0x58aa64){const _0x1362ff=a4_0x5258;if(_0x58aa64)return _0x1362ff(0x186)+_0x58aa64+':\x20'+_0x79af80;const _0xce4e9f=_0x572439 instanceof Error?_0x572439[_0x1362ff(0x17d)]:String(_0x572439);return'Skipping\x20invalid\x20directory:\x20'+_0x79af80+'\x20due\x20to\x20error:\x20'+_0xce4e9f;}function a4_0x5258(_0x2eae31,_0x1feb13){_0x2eae31=_0x2eae31-0x178;const _0x4473f2=a4_0x4473();let _0x525817=_0x4473f2[_0x2eae31];return _0x525817;}function a4_0x4473(){const _0x354df7=['1012384osxzVp','1034400gvkuNY','resolve','slice','realpath','4142124PkhIEk','invalid\x20path\x20or\x20inaccessible','stat','Skipping\x20','isDirectory','non-directory\x20root','17949090JNlLbw','file://','uri','71194Fyedff','join','startsWith','7tNxGKY','push','980904WNtscg','9OsVLRz','8876695pVQgCg','96gnxwZB','message'];a4_0x4473=function(){return _0x354df7;};return a4_0x4473();}export async function getValidRootDirectories(_0x49eeb0){const _0xaf71f3=a4_0x5258,_0x2618b7=[];for(const _0x549b17 of _0x49eeb0){const _0x7b9abb=await parseRootUri(_0x549b17['uri']);if(!_0x7b9abb){logMcpStderr(formatDirectoryError(_0x549b17[_0xaf71f3(0x18b)],undefined,_0xaf71f3(0x184)));continue;}try{const _0x369421=await a4_0x38abce[_0xaf71f3(0x185)](_0x7b9abb);_0x369421[_0xaf71f3(0x187)]()?_0x2618b7[_0xaf71f3(0x178)](_0x7b9abb):logMcpStderr(formatDirectoryError(_0x7b9abb,undefined,_0xaf71f3(0x188)));}catch(_0x1c20b0){logMcpStderr(formatDirectoryError(_0x7b9abb,_0x1c20b0));}}return _0x2618b7;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.127",
|
|
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)",
|