@morphllm/morphmcp 0.8.126 → 0.8.128

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 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
- | `warpgrep_github_search` | Search any public GitHub repo by URL or `owner/repo` shorthand |
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
+ function a0_0x4e40(){const _0xa75543=['data','roots','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','.\x20Changes:\x20','Tool\x20\x22','Preview\x20changes\x20without\x20applying\x20them.','Morph\x20Edit\x20','split','join','[github_codebase_search]\x20Failed\x20in\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','indexOf','\x20disabled\x20via\x20DISABLED_TOOLS','sk-','timed\x20out','TimeoutError','go.mod','stack','File\x20read\x20error:','slice','❌\x20Morph\x20Edit\x20Failed:\x20','setNotificationHandler','every','constructor','codebase_search','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','owner_repo','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.','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','some','user','Morph\x20Edit\x20Preview','filter','PWD','0.2.0','requiresApiKey','-\x20Read\x20file\x20`','files','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','44EDqUVT','MORPH_WARP_GREP_TIMEOUT','ENOENT','dirname','connect','includes','homedir','assistant','access','Error:\x20','object','context','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','code','morph-mcp','Warning:\x20','name','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','--api-key','dryRun','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','composer.json','added\x20','log','RipgrepError','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','default','resolve','Fallback:\x20Using\x20workspace\x20root\x20','success','\x20valid\x20directories','cwd','message','FileReadError','165036XjDYnX','description','list_directory\x20','match','BinaryFile','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','sep','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Workspace\x20mode\x20enabled:\x20Using\x20','timings','terminated','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','instruction','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','searchGitHub','content','api-key','messages','search_type','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','utf-8','129887MjzhrI','safeParse','2840984bupleq','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','catch','linesAdded','Relevant\x20context\x20found:','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]',',\x20modified\x20','[github_codebase_search]\x20Done\x20in\x20','Disabled\x20tools:\x20','ReadError','Specific\x20commit\x20hash\x20to\x20search','read','[could\x20not\x20read\x20file:\x20','morph-warp-grep-v1-1111v0','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','.\x20Path:\x20','exit','\x20(new\x20file)','71667nvPPaQ','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x0aExamples:','path','lines','node_modules','github_url','Failed\x20to\x20read\x20file:\x20','</file>','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.','<file\x20path=\x22','has','https://morphllm.com/api/error-report','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x0a...\x20(truncated,\x20total:\x20','\x20is\x20not\x20a\x20directory','mcp-filesystem','source','FileNotFound','github_codebase_search','metadata','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','normalize','Created\x20File','isArray','length','.vscode','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','code_edit','read\x20','\x27\x20in\x20`','Cargo.toml','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','role','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','floor','array','--api-key=','terminationReason','WarpGrepError','post','text','SubToolError','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','readFile','completed','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.','branch','params','Morph\x20FastApply\x20failed\x20without\x20error\x20message','toLowerCase','inputSchema','finish','[github_codebase_search]\x20Searching\x20','isDirectory','edit_file','describe','ToolException','payload','boolean','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','\x0aOptions:','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Bearer\x20','SymlinkError','stat','search_string','--help','startsWith','.cursor','all','Tool\x20','7kDoNPH','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','realpath','Max\x20results\x20to\x20return','2otDzBy','Here\x20is\x20the\x20content\x20of\x20files:\x0a','1980460lpKsCw','\x0a</file>','runWarpGrep_call','\x22.\x20Known\x20tools:\x20','size','getClientCapabilities','Invalid\x20arguments:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','2213034tTVftj','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','\x20\x20morph-mcp','enum','version','@morphllm/morphmcp\x20','WORKSPACE_ROOT','RipgrepNotAvailable','false','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','ms:','setRequestHandler','morph-v3-fast','listRoots','491425cCGiUF','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','warn','Rules:\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','toISOString','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','optional','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','trim','UnknownError','push','min','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','DISABLED_TOOLS','WarpGrep\x20sub-tool\x20errors:\x20','-\x20Grepped\x20\x27','map','tsconfig.json','basename','morph-','.git','env','1070GYUSAl','repo_path','string','error','now','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','errors','linesRemoved','unknown','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','-\x20Listed\x20directory\x20`','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','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Applied'];a0_0x4e40=function(){return _0xa75543;};return a0_0x4e40();}const a0_0x44994e=a0_0x2846;(function(_0x1197f7,_0x291f66){const _0x9dacef=a0_0x2846,_0x515403=_0x1197f7();while(!![]){try{const _0x4f53f1=-parseInt(_0x9dacef(0x29f))/0x1*(parseInt(_0x9dacef(0x1f9))/0x2)+-parseInt(_0x9dacef(0x288))/0x3*(parseInt(_0x9dacef(0x265))/0x4)+parseInt(_0x9dacef(0x1fb))/0x5+-parseInt(_0x9dacef(0x203))/0x6+-parseInt(_0x9dacef(0x1f5))/0x7*(-parseInt(_0x9dacef(0x2a1))/0x8)+parseInt(_0x9dacef(0x2b3))/0x9*(parseInt(_0x9dacef(0x22c))/0xa)+-parseInt(_0x9dacef(0x213))/0xb;if(_0x4f53f1===_0x291f66)break;else _0x515403['push'](_0x515403['shift']());}catch(_0x398045){_0x515403['push'](_0x515403['shift']());}}}(a0_0x4e40,0x6f043));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_0x3e9020 from'fs/promises';import a0_0x27dcdd from'path';import a0_0x5c48dc 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_0xab6413 from'axios';function fixPathRepetition(_0x2b6b20){const _0x49d8c3=a0_0x2846,_0x24b61f=_0x2b6b20[_0x49d8c3(0x244)](a0_0x27dcdd[_0x49d8c3(0x28e)])[_0x49d8c3(0x25e)](Boolean);if(_0x24b61f[_0x49d8c3(0x1c5)]<0x2)return null;for(let _0x21cb8b=Math[_0x49d8c3(0x1cf)](_0x24b61f['length']/0x2);_0x21cb8b>=0x1;_0x21cb8b--){for(let _0x3881a8=0x0;_0x3881a8<=_0x24b61f[_0x49d8c3(0x1c5)]-0x2*_0x21cb8b;_0x3881a8++){const _0x260902=_0x24b61f[_0x49d8c3(0x251)](_0x3881a8,_0x3881a8+_0x21cb8b),_0x4bbeec=_0x24b61f[_0x49d8c3(0x251)](_0x3881a8+_0x21cb8b,_0x3881a8+0x2*_0x21cb8b);if(_0x260902[_0x49d8c3(0x254)]((_0x2c695b,_0x2f84af)=>_0x2c695b===_0x4bbeec[_0x2f84af])){const _0x231715=[..._0x24b61f[_0x49d8c3(0x251)](0x0,_0x3881a8),..._0x24b61f[_0x49d8c3(0x251)](_0x3881a8+_0x21cb8b)];return a0_0x27dcdd[_0x49d8c3(0x28e)]+_0x231715[_0x49d8c3(0x245)](a0_0x27dcdd[_0x49d8c3(0x28e)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x5e7a16=a0_0x2846;try{const _0x360e76=require('../package.json');return _0x360e76[_0x5e7a16(0x207)]??'unknown';}catch(_0x29febb){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x29febb),'unknown';}}function printHelp(){const _0x4d5a85=a0_0x2846;console['log'](_0x4d5a85(0x208)+getPackageVersion()),console[_0x4d5a85(0x27d)](_0x4d5a85(0x2a6)),console['log'](_0x4d5a85(0x1e9)),console[_0x4d5a85(0x27d)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x4d5a85(0x27d)](_0x4d5a85(0x257)),console[_0x4d5a85(0x27d)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log'](_0x4d5a85(0x2b5)),console[_0x4d5a85(0x27d)](_0x4d5a85(0x205)),console['log'](_0x4d5a85(0x2c0));}const cliArgs=process['argv'][a0_0x44994e(0x251)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x44994e(0x1f0),'-h']);cliArgs[a0_0x44994e(0x25b)](_0x2ed6ad=>VERSION_FLAGS[a0_0x44994e(0x2be)](_0x2ed6ad))&&(console[a0_0x44994e(0x27d)](a0_0x44994e(0x208)+getPackageVersion()),process[a0_0x44994e(0x2b1)](0x0));cliArgs['some'](_0x5ec49e=>HELP_FLAGS[a0_0x44994e(0x2be)](_0x5ec49e))&&(printHelp(),process[a0_0x44994e(0x2b1)](0x0));function getCliArg(_0x5bbf33){const _0x4bffcc=a0_0x44994e;for(let _0x4e8370=0x0;_0x4e8370<cliArgs['length'];_0x4e8370++){const _0x5e4b02=cliArgs[_0x4e8370];if(_0x5e4b02['startsWith']('--'+_0x5bbf33+'='))return _0x5e4b02['slice'](('--'+_0x5bbf33+'=')[_0x4bffcc(0x1c5)]);if(_0x5e4b02==='--'+_0x5bbf33&&_0x4e8370+0x1<cliArgs[_0x4bffcc(0x1c5)])return cliArgs[_0x4e8370+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x44994e(0x1c5)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x44994e(0x2be)](arg)||HELP_FLAGS[a0_0x44994e(0x2be)](arg))continue;if(arg[a0_0x44994e(0x1f1)](a0_0x44994e(0x1d1)))continue;if(arg===a0_0x44994e(0x278)){i++;continue;}args[a0_0x44994e(0x220)](arg);}const WORKSPACE_ROOT=process[a0_0x44994e(0x22b)][a0_0x44994e(0x209)]||process[a0_0x44994e(0x22b)][a0_0x44994e(0x25f)]||process[a0_0x44994e(0x285)](),ENABLE_WORKSPACE_MODE=process[a0_0x44994e(0x22b)]['ENABLE_WORKSPACE_MODE']!==a0_0x44994e(0x20b),MORPH_API_KEY=getCliArg(a0_0x44994e(0x29a))??process[a0_0x44994e(0x22b)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x44994e(0x22b)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x44994e(0x22b)][a0_0x44994e(0x266)]?parseInt(process[a0_0x44994e(0x22b)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x44994e(0x1e3),'codebase_search',a0_0x44994e(0x2c7)]),DISABLED_TOOLS=process['env'][a0_0x44994e(0x223)]?new Set(process[a0_0x44994e(0x22b)][a0_0x44994e(0x223)][a0_0x44994e(0x244)](',')[a0_0x44994e(0x226)](_0x731d39=>_0x731d39['trim']())[a0_0x44994e(0x25e)](_0x22e99e=>_0x22e99e[a0_0x44994e(0x1c5)]>0x0)):new Set();if(DISABLED_TOOLS[a0_0x44994e(0x1ff)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x44994e(0x2be)](tool)&&console[a0_0x44994e(0x22f)](a0_0x44994e(0x1e8)+tool+a0_0x44994e(0x1fe)+[...KNOWN_TOOL_NAMES][a0_0x44994e(0x245)](',\x20'));}console['error'](a0_0x44994e(0x2a9)+[...DISABLED_TOOLS][a0_0x44994e(0x245)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x44994e(0x24b))&&!MORPH_API_KEY['startsWith'](a0_0x44994e(0x229))&&logMcpStderr(a0_0x44994e(0x264));async function reportMorphError(_0x22ac5c){const _0x1e132b=a0_0x44994e;try{await a0_0xab6413[_0x1e132b(0x1d4)](_0x1e132b(0x2bf),{..._0x22ac5c,'timestamp':new Date()[_0x1e132b(0x219)](),'source':_0x22ac5c[_0x1e132b(0x2c5)]||_0x1e132b(0x2c4),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x22ac5c[_0x1e132b(0x270)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x1e132b(0x1ec)+MORPH_API_KEY}});}catch{}}args[a0_0x44994e(0x1c5)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x44994e(0x296)),logMcpStderr(a0_0x44994e(0x21c)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x44994e(0x1c1)),logMcpStderr(a0_0x44994e(0x20c)),logMcpStderr(a0_0x44994e(0x277)));function normalizePath(_0x28bfb3){const _0x4a51a9=a0_0x44994e;return a0_0x27dcdd[_0x4a51a9(0x1c2)](_0x28bfb3);}function expandHome(_0x37d236){const _0x2f595d=a0_0x44994e;if(_0x37d236[_0x2f595d(0x1f1)]('~/')||_0x37d236==='~')return a0_0x27dcdd[_0x2f595d(0x245)](a0_0x5c48dc[_0x2f595d(0x26b)](),_0x37d236[_0x2f595d(0x251)](0x1));return _0x37d236;}let allowedDirectories=await Promise[a0_0x44994e(0x1f3)](args[a0_0x44994e(0x226)](async _0x561151=>{const _0x23c6e4=a0_0x44994e,_0x4d60be=expandHome(_0x561151),_0x1c7831=a0_0x27dcdd[_0x23c6e4(0x281)](_0x4d60be);try{const _0x4b08ac=await a0_0x3e9020[_0x23c6e4(0x1f7)](_0x1c7831);return normalizePath(_0x4b08ac);}catch(_0x3bbf18){return normalizePath(_0x1c7831);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x44994e(0x1c5)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x44994e(0x220)](workspaceDir),logMcpStderr(a0_0x44994e(0x290)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x321cf0){logMcpStderr(a0_0x44994e(0x204)+a0_0x321cf0);}async function detectWorkspaceRoot(_0x105b16){const _0x4cb048=a0_0x44994e;let _0x2e2d29=a0_0x27dcdd[_0x4cb048(0x281)](_0x105b16);const _0x2fbb3a=[_0x4cb048(0x22a),_0x4cb048(0x1c6),'package.json',_0x4cb048(0x1cb),'pyproject.toml',_0x4cb048(0x24e),_0x4cb048(0x1f2),_0x4cb048(0x227),_0x4cb048(0x27b)];while(_0x2e2d29!==a0_0x27dcdd['dirname'](_0x2e2d29)){for(const _0x28cf84 of _0x2fbb3a){const _0x4c6d02=a0_0x27dcdd['join'](_0x2e2d29,_0x28cf84);try{return await a0_0x3e9020[_0x4cb048(0x26d)](_0x4c6d02),normalizePath(_0x2e2d29);}catch{}}_0x2e2d29=a0_0x27dcdd[_0x4cb048(0x268)](_0x2e2d29);}return normalizePath(_0x105b16);}await Promise[a0_0x44994e(0x1f3)](args[a0_0x44994e(0x226)](async _0x3baa37=>{const _0xc2f93=a0_0x44994e;try{const _0x2898e5=await a0_0x3e9020[_0xc2f93(0x1ee)](expandHome(_0x3baa37));!_0x2898e5[_0xc2f93(0x1e2)]()&&(logMcpStderr(_0xc2f93(0x26e)+_0x3baa37+_0xc2f93(0x2c3)),process[_0xc2f93(0x2b1)](0x1));}catch(_0x31f156){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x3baa37+':',_0x31f156),process[_0xc2f93(0x2b1)](0x1);}}));async function validatePath(_0x33b11b){const _0x572ea9=a0_0x44994e,_0x2716c4=expandHome(_0x33b11b),_0x5cfaa1=a0_0x27dcdd[_0x572ea9(0x281)](_0x2716c4);try{const _0x34f5a9=await a0_0x3e9020[_0x572ea9(0x1f7)](_0x5cfaa1);return _0x34f5a9;}catch(_0x58be04){if(_0x58be04[_0x572ea9(0x273)]===_0x572ea9(0x267)){const _0x31c837=a0_0x27dcdd[_0x572ea9(0x268)](_0x5cfaa1);try{const _0x24d100=await a0_0x3e9020[_0x572ea9(0x1f7)](_0x31c837);return a0_0x27dcdd[_0x572ea9(0x245)](_0x24d100,a0_0x27dcdd[_0x572ea9(0x228)](_0x5cfaa1));}catch{throw new Error(_0x572ea9(0x202)+_0x31c837);}}throw _0x58be04;}}const MorphEditFileArgsSchema=z[a0_0x44994e(0x26f)]({'path':z[a0_0x44994e(0x22e)](),'code_edit':z[a0_0x44994e(0x22e)]()[a0_0x44994e(0x1e4)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z['string']()[a0_0x44994e(0x1e4)](a0_0x44994e(0x271)),'dryRun':z[a0_0x44994e(0x1e7)]()[a0_0x44994e(0x280)](![])[a0_0x44994e(0x1e4)](a0_0x44994e(0x242))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x44994e(0x1da),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x44994e(0x22e)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x44994e(0x22e)]()['describe'](a0_0x44994e(0x29d)),'search_type':z[a0_0x44994e(0x206)](['default',a0_0x44994e(0x2b8)])[a0_0x44994e(0x21b)]()[a0_0x44994e(0x1e4)](a0_0x44994e(0x297))}),WarpGrepGitHubArgsSchema=z[a0_0x44994e(0x26f)]({'search_string':z[a0_0x44994e(0x22e)]()[a0_0x44994e(0x1e4)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()[a0_0x44994e(0x1e4)](a0_0x44994e(0x259)),'owner_repo':z[a0_0x44994e(0x22e)]()['optional']()[a0_0x44994e(0x1e4)](a0_0x44994e(0x214)),'branch':z[a0_0x44994e(0x22e)]()[a0_0x44994e(0x21b)]()[a0_0x44994e(0x1e4)](a0_0x44994e(0x294))}),CodebaseSearchArgsSchema=z[a0_0x44994e(0x26f)]({'query':z[a0_0x44994e(0x22e)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x44994e(0x22e)]()['describe']('Repository\x20identifier'),'branch':z['string']()[a0_0x44994e(0x21b)]()[a0_0x44994e(0x1e4)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x44994e(0x22e)]()[a0_0x44994e(0x21b)]()[a0_0x44994e(0x1e4)](a0_0x44994e(0x2ab)),'targetDirectories':z[a0_0x44994e(0x1d0)](z['string']())[a0_0x44994e(0x280)]([])[a0_0x44994e(0x1e4)](a0_0x44994e(0x248)),'limit':z['number']()[a0_0x44994e(0x21b)]()[a0_0x44994e(0x280)](0xa)[a0_0x44994e(0x1e4)](a0_0x44994e(0x1f8))}),server=new Server({'name':a0_0x44994e(0x274),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x44994e(0x210)](ListToolsRequestSchema,async()=>{const _0x53a2ba=a0_0x44994e,_0x4b928d=[{'name':_0x53a2ba(0x1e3),'description':_0x53a2ba(0x23f)+_0x53a2ba(0x27a)+_0x53a2ba(0x236)+_0x53a2ba(0x1d7)+'Benefits:\x0a'+_0x53a2ba(0x20e)+_0x53a2ba(0x215)+_0x53a2ba(0x28f)+_0x53a2ba(0x25a)+_0x53a2ba(0x20d)+_0x53a2ba(0x21a)+_0x53a2ba(0x272)+'For\x20deletions:\x0a'+_0x53a2ba(0x27f)+_0x53a2ba(0x21d)+_0x53a2ba(0x217)+_0x53a2ba(0x1ce)+_0x53a2ba(0x1eb)+_0x53a2ba(0x1cc)+_0x53a2ba(0x1c7)+_0x53a2ba(0x235)+_0x53a2ba(0x23e)+_0x53a2ba(0x222),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x53a2ba(0x256),'description':_0x53a2ba(0x238)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x53a2ba(0x2b4)+'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':!![]}],_0x49756e=_0x4b928d[_0x53a2ba(0x25e)](_0x334afe=>{const _0x4cebdb=_0x53a2ba;if(DISABLED_TOOLS[_0x4cebdb(0x2be)](_0x334afe[_0x4cebdb(0x276)]))return console[_0x4cebdb(0x22f)](_0x4cebdb(0x1f4)+_0x334afe[_0x4cebdb(0x276)]+_0x4cebdb(0x24a)),![];if(_0x4cebdb(0x261)in _0x334afe&&_0x334afe[_0x4cebdb(0x261)]&&!MORPH_API_KEY)return logMcpStderr(_0x4cebdb(0x275)+_0x334afe['name']+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x49756e[_0x53a2ba(0x226)](_0x4f9559=>({'name':_0x4f9559[_0x53a2ba(0x276)],'description':_0x4f9559[_0x53a2ba(0x289)],'inputSchema':_0x4f9559[_0x53a2ba(0x1df)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x25025c=>{const _0x4a704f=a0_0x44994e,{name:_0x38dbbb,arguments:_0x43813e}=_0x25025c[_0x4a704f(0x1dc)];try{if(DISABLED_TOOLS[_0x4a704f(0x2be)](_0x38dbbb))throw new Error(_0x4a704f(0x241)+_0x38dbbb+_0x4a704f(0x293));switch(_0x38dbbb){case _0x4a704f(0x1e3):{const _0xade907=MorphEditFileArgsSchema[_0x4a704f(0x2a0)](_0x43813e);if(!_0xade907[_0x4a704f(0x283)])throw new Error(_0x4a704f(0x2c1)+_0xade907['error']);const _0x2fc471=await validatePath(_0xade907['data'][_0x4a704f(0x2b6)]);let _0x293b96=null,_0x42c824=!![],_0x475f50=null;try{_0x293b96=await a0_0x3e9020[_0x4a704f(0x1d8)](_0x2fc471,_0x4a704f(0x29e));}catch(_0x4f7051){const _0x272f6c=_0x4f7051[_0x4a704f(0x273)];_0x272f6c===_0x4a704f(0x267)?(_0x42c824=![],_0x293b96=''):(_0x475f50=_0x4a704f(0x2ba)+(_0x272f6c||'unknown')+'\x20-\x20'+(_0x4f7051 instanceof Error?_0x4f7051[_0x4a704f(0x286)]:String(_0x4f7051)),logMcpStderr(_0x4a704f(0x275)+_0x475f50));}let _0x1d8215;try{const _0x509fcc=MORPH_API_KEY;if(!_0x509fcc)throw new Error(_0x4a704f(0x28d));const _0x2bb5b9=a0_0x27dcdd[_0x4a704f(0x268)](_0x2fc471),_0x12d7d0=a0_0x27dcdd[_0x4a704f(0x228)](_0x2fc471),_0x1d83bb=await executeEditFile({'target_filepath':_0x12d7d0,'code_edit':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x1c8)],'instructions':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x295)]},{'morphApiKey':_0x509fcc,'morphApiUrl':MORPH_API_URL,'baseDir':_0x2bb5b9,'autoWrite':!_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x279)],'generateUdiff':![],'debug':![]});_0x1d8215=_0x1d83bb['completionId'];if(!_0x1d83bb[_0x4a704f(0x283)])throw new Error(_0x1d83bb[_0x4a704f(0x22f)]||_0x4a704f(0x1dd));const _0x256120=_0x1d83bb['changes'],_0x1b8665=_0x4a704f(0x27c)+_0x256120[_0x4a704f(0x2a4)]+',\x20removed\x20'+_0x256120[_0x4a704f(0x233)]+_0x4a704f(0x2a7)+_0x256120['linesModified'];if(_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x279)])return{'content':[{'type':_0x4a704f(0x1d5),'text':_0x4a704f(0x25d)+(_0x42c824?'':_0x4a704f(0x2b2))+':\x20'+_0xade907[_0x4a704f(0x23c)]['instruction']+_0x4a704f(0x240)+_0x1b8665+_0x4a704f(0x2b0)+_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x2b6)]+'.'}]};return{'content':[{'type':_0x4a704f(0x1d5),'text':_0x4a704f(0x243)+(_0x42c824?_0x4a704f(0x23b):_0x4a704f(0x1c3))+':\x20'+_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x295)]+'.\x20Changes:\x20'+_0x1b8665+_0x4a704f(0x2b0)+_0xade907['data'][_0x4a704f(0x2b6)]+'.'}]};}catch(_0x4f9e8e){const _0x440f33=_0x4f9e8e instanceof Error?_0x4f9e8e[_0x4a704f(0x286)]:String(_0x4f9e8e);return reportMorphError({'error_message':_0x440f33,'error_type':_0x4f9e8e instanceof Error?_0x4f9e8e[_0x4a704f(0x255)]['name']:'UnknownError','context':{'tool':_0x4a704f(0x1e3),'completion_id':_0x1d8215,'file_path':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x2b6)],'validated_path':_0x2fc471,'instruction':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x295)],'model':_0x4a704f(0x211),'dry_run':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x279)],'file_exists':_0x42c824,'file_read_error':_0x475f50,'file_readable':_0x293b96!==null,'request_content':{'path':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x2b6)],'code_edit':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x1c8)],'instruction':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x295)],'original_code':_0x293b96!==null?_0x293b96[_0x4a704f(0x1c5)]>0xc350?_0x293b96['substring'](0x0,0xc350)+_0x4a704f(0x2c2)+_0x293b96[_0x4a704f(0x1c5)]+'\x20chars)':_0x293b96:_0x4a704f(0x2ad)+(_0x475f50||'unknown\x20error')+']','original_code_length':_0x293b96?.['length']??0x0,'model':'morph-v3-fast','dry_run':_0xade907[_0x4a704f(0x23c)][_0x4a704f(0x279)]}},'stack_trace':_0x4f9e8e instanceof Error?_0x4f9e8e[_0x4a704f(0x24f)]:undefined,'source':'mcp-filesystem'})[_0x4a704f(0x2a3)](()=>{}),{'content':[{'type':_0x4a704f(0x1d5),'text':_0x4a704f(0x252)+_0x440f33}],'isError':!![]};}}case _0x4a704f(0x256):{const _0x122646=WarpGrepArgsSchema['safeParse'](_0x43813e);if(!_0x122646[_0x4a704f(0x283)])return{'content':[{'type':'text','text':_0x4a704f(0x201)+_0x122646[_0x4a704f(0x22f)]}],'isError':!![]};const _0x408e22=_0x3b4198=>{const _0x2faeb5=_0x4a704f,_0x542582=[];for(const _0x11eaa8 of _0x3b4198||[]){const _0x533a6f=_0x11eaa8[_0x2faeb5(0x1cd)],_0x46ae3e=_0x11eaa8[_0x2faeb5(0x299)];if(_0x533a6f===_0x2faeb5(0x26c)&&_0x46ae3e){const _0x23388f=_0x46ae3e[_0x2faeb5(0x244)]('\x0a')[_0x2faeb5(0x25e)](_0x36f6c0=>_0x36f6c0[_0x2faeb5(0x21e)]());for(const _0x743767 of _0x23388f){const _0x18fe25=_0x743767['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x18fe25){_0x542582[_0x2faeb5(0x220)]('grep\x20\x27'+_0x18fe25[0x1]+'\x27\x20'+_0x18fe25[0x2]);continue;}const _0x4ba6bb=_0x743767['match'](/^read\s+(.+)$/);if(_0x4ba6bb){_0x542582[_0x2faeb5(0x220)](_0x2faeb5(0x1c9)+_0x4ba6bb[0x1]);continue;}const _0xa5c4b5=_0x743767[_0x2faeb5(0x28b)](/^list_directory\s+(.+)$/);if(_0xa5c4b5){_0x542582[_0x2faeb5(0x220)](_0x2faeb5(0x28a)+_0xa5c4b5[0x1]);continue;}}}}return _0x542582;},_0x92f336=_0x5918dd=>{const _0x285390=_0x4a704f,_0x283e75=[];if(!_0x5918dd||!Array[_0x285390(0x1c4)](_0x5918dd))return _0x283e75;const _0x537d7f=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x285390(0x2c6),'tool':_0x285390(0x2ac)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x285390(0x2ac)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x285390(0x2ac)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x285390(0x28c),'tool':_0x285390(0x2ac)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x285390(0x27e),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x285390(0x20a),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x285390(0x28c),'tool':_0x285390(0x2ac)},{'pattern':/\[SYMLINK\]/,'error_type':_0x285390(0x1ed),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x285390(0x28c),'tool':'read'},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x285390(0x2ac)},{'pattern':/Error reading file:/,'error_type':_0x285390(0x2aa),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x285390(0x1e5),'tool':_0x285390(0x234)}];let _0x249a27=0x0;for(const _0x598ab of _0x5918dd){if(_0x598ab['role']===_0x285390(0x25c)){_0x249a27++;const _0x52def7=_0x598ab[_0x285390(0x299)];if(!_0x52def7||typeof _0x52def7!==_0x285390(0x22e))continue;for(const {pattern:_0x53ab9e,error_type:_0x2d79ef,tool:_0x434838}of _0x537d7f){const _0x4dc3fa=_0x52def7[_0x285390(0x28b)](new RegExp(_0x53ab9e['source'],'g'));if(_0x4dc3fa)for(const _0x3efacf of _0x4dc3fa){const _0x2ca6c6=_0x52def7[_0x285390(0x249)](_0x3efacf),_0x4d004f=_0x52def7['substring'](_0x2ca6c6,Math[_0x285390(0x221)](_0x2ca6c6+0xc8,_0x52def7[_0x285390(0x1c5)]));_0x283e75[_0x285390(0x220)]({'tool':_0x434838,'error_type':_0x2d79ef,'error_message':_0x4d004f[_0x285390(0x244)]('\x0a')[0x0],'turn':_0x249a27});}}}}return _0x283e75;};try{const _0x5a156f=a0_0x27dcdd[_0x4a704f(0x281)](_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x22d)]),_0x13a130=_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x29c)],_0x5aa980=_0x13a130===_0x4a704f(0x2b8)?{'allowNames':[_0x4a704f(0x2b8)]}:undefined,_0x12205f=new LocalRipgrepProvider(_0x5a156f,undefined,_0x5aa980),_0x1db7b1=await runWarpGrep({'searchTerm':_0x122646[_0x4a704f(0x23c)]['search_string'],'repoRoot':_0x5a156f,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x12205f,'search_type':_0x13a130}),_0x567997=_0x92f336(_0x1db7b1['messages']);_0x567997[_0x4a704f(0x1c5)]>0x0&&reportMorphError({'error_message':_0x4a704f(0x224)+_0x567997[_0x4a704f(0x1c5)]+'\x20error(s)','error_type':_0x4a704f(0x1d6),'level':_0x4a704f(0x216),'tool':_0x4a704f(0x256),'context':{'repo_path':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x22d)],'query':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'model':_0x4a704f(0x2ae),'termination_reason':_0x1db7b1['terminationReason'],'sub_tool_errors':_0x567997,'timings':_0x1db7b1['timings'],'tool_calls':_0x408e22(_0x1db7b1[_0x4a704f(0x29b)]),'messages':_0x1db7b1['messages']?.[_0x4a704f(0x226)](_0x45c9ba=>({'role':_0x45c9ba[_0x4a704f(0x1cd)],'content':_0x45c9ba[_0x4a704f(0x299)]}))},'source':_0x4a704f(0x2c4)})['catch'](()=>{});let _0x3031ee='';if(_0x1db7b1[_0x4a704f(0x1d2)]===_0x4a704f(0x1d9)&&_0x1db7b1['finish']?.['metadata']?.['files']){const _0x198b99=_0x1db7b1[_0x4a704f(0x1e0)]['metadata']['files'];if(_0x198b99[_0x4a704f(0x1c5)]===0x0)return _0x3031ee=_0x1db7b1[_0x4a704f(0x1e0)][_0x4a704f(0x1e6)]||_0x4a704f(0x23a),{'content':[{'type':_0x4a704f(0x1d5),'text':_0x3031ee}]};const _0x18e323=[],_0x25d9d3=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x1c33ef of _0x1db7b1[_0x4a704f(0x29b)]){const _0x69cc17=_0x1c33ef[_0x4a704f(0x1cd)],_0x3eb5a5=_0x1c33ef[_0x4a704f(0x299)];if(_0x69cc17===_0x4a704f(0x26c)&&_0x3eb5a5){const _0x30ca7c=_0x3eb5a5[_0x4a704f(0x244)]('\x0a')[_0x4a704f(0x25e)](_0x36a188=>_0x36a188[_0x4a704f(0x21e)]());for(const _0x81cbfa of _0x30ca7c){const _0x43cdc4=_0x81cbfa[_0x4a704f(0x28b)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x43cdc4){_0x25d9d3[_0x4a704f(0x220)](_0x4a704f(0x225)+_0x43cdc4[0x1]+_0x4a704f(0x1ca)+_0x43cdc4[0x2]+'`');continue;}const _0x3c6c9d=_0x81cbfa['match'](/^read\s+(.+)$/);if(_0x3c6c9d){_0x25d9d3[_0x4a704f(0x220)](_0x4a704f(0x262)+_0x3c6c9d[0x1]+'`');continue;}const _0x170df8=_0x81cbfa[_0x4a704f(0x28b)](/^list_directory\s+(.+)$/);if(_0x170df8){_0x25d9d3[_0x4a704f(0x220)](_0x4a704f(0x237)+_0x170df8[0x1]+'`');continue;}}}}_0x18e323[_0x4a704f(0x220)](_0x25d9d3['join']('\x0a'));const _0x3015db=['',_0x4a704f(0x2a5)];for(const _0x556c35 of _0x198b99){if(_0x556c35[_0x4a704f(0x2b7)]==='*')_0x3015db['push']('-\x20'+_0x556c35[_0x4a704f(0x2b6)]+':*');else{if(Array[_0x4a704f(0x1c4)](_0x556c35['lines'])){const _0x46b449=_0x556c35['lines']['map'](([_0x1175f7,_0x41f1c6])=>{if(_0x1175f7===_0x41f1c6)return''+_0x1175f7;return _0x1175f7+'-'+_0x41f1c6;});_0x3015db['push']('-\x20'+_0x556c35[_0x4a704f(0x2b6)]+':'+_0x46b449[_0x4a704f(0x245)](','));}else _0x3015db['push']('-\x20'+_0x556c35['path']+':*');}}_0x3015db[_0x4a704f(0x220)](''),_0x18e323[_0x4a704f(0x220)](_0x3015db[_0x4a704f(0x245)]('\x0a')),_0x18e323[_0x4a704f(0x220)](_0x4a704f(0x1fa));const _0x50b8a8=[];for(const _0x484aa8 of _0x198b99){let _0x42aa3b=a0_0x27dcdd[_0x4a704f(0x281)](_0x122646[_0x4a704f(0x23c)]['repo_path'],_0x484aa8[_0x4a704f(0x2b6)]),_0xb96d21=null,_0x4741a0=null;try{_0xb96d21=await a0_0x3e9020['readFile'](_0x42aa3b,{'encoding':_0x4a704f(0x29e)});}catch(_0x25f17b){const _0x3f5705=fixPathRepetition(_0x42aa3b);if(_0x3f5705)try{_0xb96d21=await a0_0x3e9020[_0x4a704f(0x1d8)](_0x3f5705,{'encoding':_0x4a704f(0x29e)}),_0x42aa3b=_0x3f5705;}catch{_0x4741a0=_0x25f17b instanceof Error?_0x25f17b:new Error(String(_0x25f17b));}else _0x4741a0=_0x25f17b instanceof Error?_0x25f17b:new Error(String(_0x25f17b));}if(_0xb96d21!==null){const _0x2507ed=_0xb96d21[_0x4a704f(0x244)](/\r?\n/),_0x1e11eb=[_0x4a704f(0x2bd)+_0x484aa8['path']+'\x22>'];if(_0x484aa8[_0x4a704f(0x2b7)]==='*'||!Array[_0x4a704f(0x1c4)](_0x484aa8[_0x4a704f(0x2b7)]))for(let _0x35b7dc=0x1;_0x35b7dc<=_0x2507ed[_0x4a704f(0x1c5)];_0x35b7dc++){const _0xc8f90d=_0x2507ed[_0x35b7dc-0x1];_0x1e11eb[_0x4a704f(0x220)](_0x35b7dc+'|\x20'+_0xc8f90d);}else for(const [_0x1ca85a,_0x4fd237]of _0x484aa8[_0x4a704f(0x2b7)]){_0x1e11eb[_0x4a704f(0x1c5)]>0x1&&_0x1e11eb[_0x4a704f(0x220)]('');for(let _0x19337c=_0x1ca85a;_0x19337c<=_0x4fd237&&_0x19337c<=_0x2507ed[_0x4a704f(0x1c5)];_0x19337c++){const _0x2f2b53=_0x2507ed[_0x19337c-0x1];_0x1e11eb[_0x4a704f(0x220)](_0x19337c+'|\x20'+_0x2f2b53);}}_0x1e11eb[_0x4a704f(0x220)](_0x4a704f(0x2bb)),_0x50b8a8[_0x4a704f(0x220)](_0x1e11eb[_0x4a704f(0x245)]('\x0a'));}else _0x50b8a8[_0x4a704f(0x220)](_0x4a704f(0x2bd)+_0x484aa8['path']+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x4741a0?.['message']||'Unknown\x20error')+_0x4a704f(0x1fc));}_0x18e323[_0x4a704f(0x220)](_0x50b8a8['join']('\x0a\x0a')),_0x3031ee=_0x18e323[_0x4a704f(0x245)]('\x0a');const _0xddd531=_0x1db7b1[_0x4a704f(0x232)]?.['filter'](_0x49c09c=>_0x49c09c[_0x4a704f(0x286)]?.[_0x4a704f(0x1f1)](_0x4a704f(0x250)))||[];if(_0xddd531[_0x4a704f(0x1c5)]>0x0){const _0x39d789=_0xddd531[_0x4a704f(0x226)](_0x157d24=>_0x157d24[_0x4a704f(0x286)])[_0x4a704f(0x245)](';\x20');reportMorphError({'error_message':_0x39d789,'error_type':_0x4a704f(0x287),'context':{'tool':_0x4a704f(0x256),'repo_path':_0x122646['data'][_0x4a704f(0x22d)],'query':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'model':'morph-warp-grep-v1-1111v0','termination_reason':'completed_with_file_errors','error_count':_0xddd531[_0x4a704f(0x1c5)],'is_timeout':![],'timings':_0x1db7b1[_0x4a704f(0x291)],'files_attempted':_0x198b99['map'](_0x4e65bb=>({'path':_0x4e65bb[_0x4a704f(0x2b6)],'lines':_0x4e65bb[_0x4a704f(0x2b7)]})),'tool_calls':_0x408e22(_0x1db7b1[_0x4a704f(0x29b)]),'messages':_0x1db7b1[_0x4a704f(0x29b)]?.[_0x4a704f(0x226)](_0x3a02e3=>({'role':_0x3a02e3['role'],'content':_0x3a02e3[_0x4a704f(0x299)]})),'request_content':{'query':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'repo_path':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x22d)],'repoRoot':a0_0x27dcdd[_0x4a704f(0x281)](_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x22d)]),'model':_0x4a704f(0x2ae)}},'source':_0x4a704f(0x2c4)})[_0x4a704f(0x2a3)](()=>{});}}else{if(_0x1db7b1[_0x4a704f(0x1d2)]===_0x4a704f(0x292)&&_0x1db7b1[_0x4a704f(0x232)][_0x4a704f(0x1c5)]>0x0){const _0x5c2939=_0x1db7b1[_0x4a704f(0x232)][_0x4a704f(0x226)](_0x1c39b1=>_0x1c39b1['message'])['join'](';\x20');_0x3031ee=_0x4a704f(0x26e)+_0x5c2939;const _0x3ab7c9=_0x5c2939[_0x4a704f(0x1de)]()['includes']('timeout')||_0x5c2939[_0x4a704f(0x1de)]()[_0x4a704f(0x26a)](_0x4a704f(0x24c))||_0x5c2939[_0x4a704f(0x1de)]()[_0x4a704f(0x26a)]('etimedout'),_0x1627c9=_0x1db7b1['finish']?.[_0x4a704f(0x1c0)]?.[_0x4a704f(0x263)],_0xb77a36=_0x1db7b1[_0x4a704f(0x232)][0x0];reportMorphError({'error_message':_0x5c2939,'error_type':_0x3ab7c9?_0x4a704f(0x24d):_0xb77a36?.[_0x4a704f(0x255)]?.[_0x4a704f(0x276)]||_0x4a704f(0x1d3),'context':{'tool':'codebase_search','repo_path':_0x122646['data'][_0x4a704f(0x22d)],'query':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'model':_0x4a704f(0x2ae),'termination_reason':_0x1db7b1[_0x4a704f(0x1d2)],'error_count':_0x1db7b1[_0x4a704f(0x232)][_0x4a704f(0x1c5)],'is_timeout':_0x3ab7c9,'timings':_0x1db7b1[_0x4a704f(0x291)],'files_attempted':_0x1627c9?.['map'](_0x294c06=>({'path':_0x294c06[_0x4a704f(0x2b6)],'lines':_0x294c06['lines']})),'tool_calls':_0x408e22(_0x1db7b1[_0x4a704f(0x29b)]),'messages':_0x1db7b1[_0x4a704f(0x29b)]?.[_0x4a704f(0x226)](_0x1f2e8d=>({'role':_0x1f2e8d['role'],'content':_0x1f2e8d[_0x4a704f(0x299)]})),'request_content':{'query':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'repo_path':_0x122646['data'][_0x4a704f(0x22d)],'repoRoot':a0_0x27dcdd[_0x4a704f(0x281)](_0x122646[_0x4a704f(0x23c)]['repo_path']),'model':_0x4a704f(0x2ae)}},'stack_trace':_0xb77a36?.[_0x4a704f(0x24f)]||undefined,'source':_0x4a704f(0x2c4)})[_0x4a704f(0x2a3)](()=>{});}else _0x3031ee=_0x4a704f(0x1f6);}return{'content':[{'type':_0x4a704f(0x1d5),'text':_0x3031ee}]};}catch(_0x354c3c){const _0xb1070d=_0x354c3c instanceof Error?_0x354c3c[_0x4a704f(0x286)]:String(_0x354c3c),_0x1b08d0=_0xb1070d[_0x4a704f(0x1de)]()[_0x4a704f(0x26a)]('timeout')||_0xb1070d[_0x4a704f(0x1de)]()[_0x4a704f(0x26a)](_0x4a704f(0x24c))||_0xb1070d['toLowerCase']()['includes']('etimedout')||_0x354c3c instanceof Error&&_0x354c3c['name']===_0x4a704f(0x24d);return reportMorphError({'error_message':_0xb1070d,'error_type':_0x1b08d0?'TimeoutError':_0x354c3c instanceof Error?_0x354c3c['constructor'][_0x4a704f(0x276)]:_0x4a704f(0x21f),'context':{'tool':_0x4a704f(0x256),'repo_path':_0x122646[_0x4a704f(0x23c)]['repo_path'],'query':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'model':_0x4a704f(0x2ae),'is_timeout':_0x1b08d0,'exception_phase':_0x4a704f(0x1fd),'request_content':{'query':_0x122646[_0x4a704f(0x23c)]['search_string'],'repo_path':_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x22d)],'repoRoot':a0_0x27dcdd[_0x4a704f(0x281)](_0x122646[_0x4a704f(0x23c)][_0x4a704f(0x22d)]),'model':_0x4a704f(0x2ae)}},'stack_trace':_0x354c3c instanceof Error?_0x354c3c['stack']:undefined,'source':_0x4a704f(0x2c4)})[_0x4a704f(0x2a3)](()=>{}),{'content':[{'type':'text','text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0xb1070d}],'isError':![]};}}case'github_codebase_search':{const _0x3f3c06=WarpGrepGitHubArgsSchema['safeParse'](_0x43813e);if(!_0x3f3c06['success'])return{'content':[{'type':'text','text':_0x4a704f(0x201)+_0x3f3c06[_0x4a704f(0x22f)]}],'isError':!![]};const _0x20eb7d=_0x3f3c06[_0x4a704f(0x23c)][_0x4a704f(0x2b9)]||_0x3f3c06[_0x4a704f(0x23c)][_0x4a704f(0x258)];if(!_0x20eb7d)return{'content':[{'type':'text','text':_0x4a704f(0x218)}],'isError':!![]};const _0x3da30f=MORPH_API_KEY;if(!_0x3da30f)throw new Error(_0x4a704f(0x28d));const _0x40a3a3=Date['now']();logMcpStderr(_0x4a704f(0x1e1)+_0x20eb7d+'\x20for:\x20\x22'+_0x3f3c06[_0x4a704f(0x23c)][_0x4a704f(0x1ef)]+'\x22');try{const _0x54742a=new WarpGrepClient({'morphApiKey':_0x3da30f,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x39688c=await _0x54742a[_0x4a704f(0x298)]({'searchTerm':_0x3f3c06[_0x4a704f(0x23c)]['search_string'],'github':_0x20eb7d,'branch':_0x3f3c06[_0x4a704f(0x23c)][_0x4a704f(0x1db)]}),_0x2a9eb0=Date[_0x4a704f(0x230)]()-_0x40a3a3;logMcpStderr(_0x4a704f(0x2a8)+_0x2a9eb0+'ms.\x20Success:\x20'+_0x39688c[_0x4a704f(0x283)]);const _0x4130bb=formatResult(_0x39688c);return{'content':[{'type':_0x4a704f(0x1d5),'text':_0x4130bb}]};}catch(_0x2f8012){const _0x5c90b5=Date[_0x4a704f(0x230)]()-_0x40a3a3,_0x25b1be=_0x2f8012 instanceof Error?_0x2f8012[_0x4a704f(0x286)]:String(_0x2f8012);return logMcpStderr(_0x4a704f(0x246)+_0x5c90b5+_0x4a704f(0x20f),_0x25b1be),reportMorphError({'error_message':_0x25b1be,'error_type':_0x2f8012 instanceof Error?_0x2f8012[_0x4a704f(0x255)][_0x4a704f(0x276)]:_0x4a704f(0x21f),'context':{'tool':_0x4a704f(0x2c7),'github_url':_0x20eb7d,'search_string':_0x3f3c06[_0x4a704f(0x23c)][_0x4a704f(0x1ef)],'branch':_0x3f3c06[_0x4a704f(0x23c)][_0x4a704f(0x1db)]},'stack_trace':_0x2f8012 instanceof Error?_0x2f8012[_0x4a704f(0x24f)]:undefined,'source':_0x4a704f(0x2c4),'tool':_0x4a704f(0x2c7),'latency_ms':_0x5c90b5})[_0x4a704f(0x2a3)](()=>{}),{'content':[{'type':_0x4a704f(0x1d5),'text':'GitHub\x20search\x20failed:\x20'+_0x25b1be}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x38dbbb);}}catch(_0xf0a21e){const _0x3db1d4=_0xf0a21e instanceof Error?_0xf0a21e[_0x4a704f(0x286)]:String(_0xf0a21e);return reportMorphError({'error_message':_0x3db1d4,'error_type':_0xf0a21e instanceof Error?_0xf0a21e[_0x4a704f(0x255)][_0x4a704f(0x276)]:_0x4a704f(0x21f),'context':{'tool':_0x38dbbb,'arguments':_0x43813e?JSON['stringify'](_0x43813e)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x4a704f(0x260)},'stack_trace':_0xf0a21e instanceof Error?_0xf0a21e[_0x4a704f(0x24f)]:undefined,'source':'mcp-filesystem'})[_0x4a704f(0x2a3)](()=>{}),{'content':[{'type':_0x4a704f(0x1d5),'text':'Error:\x20'+_0x3db1d4}],'isError':!![]};}});function a0_0x2846(_0x9b3e78,_0x6cee06){_0x9b3e78=_0x9b3e78-0x1c0;const _0x4e409f=a0_0x4e40();let _0x28467a=_0x4e409f[_0x9b3e78];return _0x28467a;}async function updateAllowedDirectoriesFromRoots(_0x4c2ffb){const _0x4a88f2=a0_0x44994e,_0x390386=await getValidRootDirectories(_0x4c2ffb);if(_0x390386['length']>0x0)allowedDirectories=[..._0x390386],logMcpStderr(_0x4a88f2(0x2a2)+_0x390386[_0x4a88f2(0x1c5)]+_0x4a88f2(0x284));else{logMcpStderr(_0x4a88f2(0x1ea));if(ENABLE_WORKSPACE_MODE)try{const _0x3c76cd=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x3c76cd&&(allowedDirectories=[_0x3c76cd],logMcpStderr(_0x4a88f2(0x282)+_0x3c76cd));}catch(_0x59664a){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x59664a);}}}server[a0_0x44994e(0x253)](RootsListChangedNotificationSchema,async()=>{const _0x5d77ef=a0_0x44994e;try{const _0x2e3098=await server[_0x5d77ef(0x212)]();_0x2e3098&&_0x5d77ef(0x23d)in _0x2e3098&&await updateAllowedDirectoriesFromRoots(_0x2e3098[_0x5d77ef(0x23d)]);}catch(_0x43c7f4){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x43c7f4 instanceof Error?_0x43c7f4['message']:String(_0x43c7f4));}}),server['oninitialized']=async()=>{const _0x59e97a=a0_0x44994e,_0x206553=server[_0x59e97a(0x200)]();if(_0x206553?.[_0x59e97a(0x23d)])try{const _0x1e5ba8=await server[_0x59e97a(0x212)]();_0x1e5ba8&&'roots'in _0x1e5ba8?await updateAllowedDirectoriesFromRoots(_0x1e5ba8[_0x59e97a(0x23d)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x54cc75){logMcpStderr(_0x59e97a(0x2af),_0x54cc75 instanceof Error?_0x54cc75[_0x59e97a(0x286)]:String(_0x54cc75));}else{if(allowedDirectories[_0x59e97a(0x1c5)]>0x0)logMcpStderr(_0x59e97a(0x239),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x59e97a(0x247));else throw new Error(_0x59e97a(0x2bc));}}};async function runServer(){const _0x1f403d=a0_0x44994e,_0x1ec749=new StdioServerTransport();await server[_0x1f403d(0x269)](_0x1ec749),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x1f403d(0x1c5)]===0x0&&logMcpStderr(_0x1f403d(0x231));}runServer()[a0_0x44994e(0x2a3)](_0x2e4d4a=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x2e4d4a),process['exit'](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x104603=a1_0x279f;function a1_0x4403(){var _0x470b02=['[os=','Unknown','Linux','1590indZXE','538350KTeywF','platform','error','561nJnHCz','darwin','Windows','linux','22HunLgx','608612imjzxp','751070ZfUHoC','1829002hiMBjY','win32','6759HYRiFP','macOS','5747nsDHow','3nmiuFN','2664zXfRSb'];a1_0x4403=function(){return _0x470b02;};return a1_0x4403();}(function(_0x46e3ad,_0x2b363f){var _0x2664b2=a1_0x279f,_0x17422f=_0x46e3ad();while(!![]){try{var _0x3c7999=-parseInt(_0x2664b2(0x113))/0x1*(-parseInt(_0x2664b2(0x10c))/0x2)+-parseInt(_0x2664b2(0x114))/0x3*(-parseInt(_0x2664b2(0x10d))/0x4)+-parseInt(_0x2664b2(0x10e))/0x5+parseInt(_0x2664b2(0x105))/0x6+-parseInt(_0x2664b2(0x10f))/0x7+parseInt(_0x2664b2(0x100))/0x8*(parseInt(_0x2664b2(0x111))/0x9)+-parseInt(_0x2664b2(0x104))/0xa*(parseInt(_0x2664b2(0x108))/0xb);if(_0x3c7999===_0x2b363f)break;else _0x17422f['push'](_0x17422f['shift']());}catch(_0x5aba9c){_0x17422f['push'](_0x17422f['shift']());}}}(a1_0x4403,0x21191));import a1_0x596b64 from'os';function a1_0x279f(_0x8a92b1,_0x501b7f){_0x8a92b1=_0x8a92b1-0x100;var _0x4403cf=a1_0x4403();var _0x279f86=_0x4403cf[_0x8a92b1];return _0x279f86;}export function getOperatingSystemType(_0x2037d7=a1_0x596b64[a1_0x104603(0x106)]()){var _0x22224a=a1_0x104603;switch(_0x2037d7){case _0x22224a(0x109):return _0x22224a(0x112);case _0x22224a(0x110):return _0x22224a(0x10a);case _0x22224a(0x10b):return _0x22224a(0x103);default:return _0x22224a(0x102);}}export function formatMcpLogMessage(_0x3e1ae6,_0x38db3d=a1_0x596b64[a1_0x104603(0x106)]()){var _0x48d192=a1_0x104603;return _0x48d192(0x101)+getOperatingSystemType(_0x38db3d)+']\x20'+_0x3e1ae6;}export function logMcpStderr(_0xa5be83,..._0x135f4e){var _0x4f939a=a1_0x104603;console[_0x4f939a(0x107)](formatMcpLogMessage(_0xa5be83),..._0x135f4e);}
1
+ var a1_0x4d1c10=a1_0x3e3f;function a1_0x3e3f(_0x53ac87,_0x5c9094){_0x53ac87=_0x53ac87-0xac;var _0x589f1b=a1_0x589f();var _0x3e3f2b=_0x589f1b[_0x53ac87];return _0x3e3f2b;}(function(_0x5b4feb,_0x565054){var _0x3725a8=a1_0x3e3f,_0x429f21=_0x5b4feb();while(!![]){try{var _0x384560=-parseInt(_0x3725a8(0xaf))/0x1+-parseInt(_0x3725a8(0xac))/0x2+parseInt(_0x3725a8(0xbc))/0x3+-parseInt(_0x3725a8(0xbd))/0x4*(parseInt(_0x3725a8(0xb1))/0x5)+-parseInt(_0x3725a8(0xbb))/0x6+parseInt(_0x3725a8(0xba))/0x7*(parseInt(_0x3725a8(0xad))/0x8)+-parseInt(_0x3725a8(0xb3))/0x9*(-parseInt(_0x3725a8(0xb9))/0xa);if(_0x384560===_0x565054)break;else _0x429f21['push'](_0x429f21['shift']());}catch(_0x25b75b){_0x429f21['push'](_0x429f21['shift']());}}}(a1_0x589f,0x9c48a));import a1_0x192922 from'os';function a1_0x589f(){var _0x1143b2=['8VEHBqP','macOS','638492ezhFVe','win32','2377505SPaRrs','Linux','3119355Mlnmxi','darwin','[os=','Windows','error','platform','110JlcgYi','2313857dxcRjZ','6573276bhhryT','99522uZaVDu','8RXLpae','Unknown','1702184vepOSi'];a1_0x589f=function(){return _0x1143b2;};return a1_0x589f();}export function getOperatingSystemType(_0x3d4ede=a1_0x192922[a1_0x4d1c10(0xb8)]()){var _0x377937=a1_0x4d1c10;switch(_0x3d4ede){case _0x377937(0xb4):return _0x377937(0xae);case _0x377937(0xb0):return _0x377937(0xb6);case'linux':return _0x377937(0xb2);default:return _0x377937(0xbe);}}export function formatMcpLogMessage(_0x47636c,_0x2674a5=a1_0x192922['platform']()){var _0x5d71bd=a1_0x4d1c10;return _0x5d71bd(0xb5)+getOperatingSystemType(_0x2674a5)+']\x20'+_0x47636c;}export function logMcpStderr(_0x21413a,..._0x4cb94a){var _0x4bce61=a1_0x4d1c10;console[_0x4bce61(0xb7)](formatMcpLogMessage(_0x21413a),..._0x4cb94a);}
@@ -1 +1 @@
1
- (function(_0x5af38c,_0x61bde1){const _0x162b9f=a2_0x3df0,_0x5f310f=_0x5af38c();while(!![]){try{const _0x1a7a67=-parseInt(_0x162b9f(0x1db))/0x1*(-parseInt(_0x162b9f(0x1e8))/0x2)+-parseInt(_0x162b9f(0x1e9))/0x3+-parseInt(_0x162b9f(0x1e1))/0x4+parseInt(_0x162b9f(0x1e5))/0x5*(-parseInt(_0x162b9f(0x1e3))/0x6)+parseInt(_0x162b9f(0x1d6))/0x7+-parseInt(_0x162b9f(0x1df))/0x8*(parseInt(_0x162b9f(0x1d7))/0x9)+parseInt(_0x162b9f(0x1e4))/0xa*(parseInt(_0x162b9f(0x1d8))/0xb);if(_0x1a7a67===_0x61bde1)break;else _0x5f310f['push'](_0x5f310f['shift']());}catch(_0x3f4666){_0x5f310f['push'](_0x5f310f['shift']());}}}(a2_0x4b2e,0xb9b00));import a2_0x5eee41 from'path';import a2_0x16bdc2 from'os';function a2_0x4b2e(){const _0x3f30d8=['charAt','test','8tBaNde','2346984TRjVqz','/mnt/','startsWith','trim','substring','6612354zeXyqs','1792521jsASJy','88396uKrlHJ','slice','toUpperCase','181409pYpHjb','join','match','homedir','48MeitAn','normalize','5427356Qggald','replace','21594gylKZq','3550QvhzSx','595qmfnuB'];a2_0x4b2e=function(){return _0x3f30d8;};return a2_0x4b2e();}export function convertToWindowsPath(_0xbdfbfb){const _0x35326c=a2_0x3df0;if(_0xbdfbfb[_0x35326c(0x1eb)](_0x35326c(0x1ea))){const _0x4cad41=_0xbdfbfb[_0x35326c(0x1e6)](0x5)[_0x35326c(0x1da)](),_0x154dfd=_0xbdfbfb['slice'](0x6)['replace'](/\//g,'\x5c');return _0x4cad41+':'+_0x154dfd;}if(_0xbdfbfb['match'](/^\/[a-zA-Z]\//)){const _0x4d132d=_0xbdfbfb[_0x35326c(0x1e6)](0x1)[_0x35326c(0x1da)](),_0xc695a1=_0xbdfbfb[_0x35326c(0x1d9)](0x2)[_0x35326c(0x1e2)](/\//g,'\x5c');return _0x4d132d+':'+_0xc695a1;}if(_0xbdfbfb[_0x35326c(0x1dd)](/^[a-zA-Z]:/))return _0xbdfbfb[_0x35326c(0x1e2)](/\//g,'\x5c');return _0xbdfbfb;}export function normalizePath(_0x15acc6){const _0x536a5a=a2_0x3df0;_0x15acc6=_0x15acc6[_0x536a5a(0x1d4)]()['replace'](/^["']|["']$/g,'');const _0x52cb79=_0x15acc6[_0x536a5a(0x1eb)]('/')&&!_0x15acc6['match'](/^\/mnt\/[a-z]\//i)&&!_0x15acc6[_0x536a5a(0x1dd)](/^\/[a-zA-Z]\//);if(_0x52cb79)return _0x15acc6[_0x536a5a(0x1e2)](/\/+/g,'/')['replace'](/\/+$/,'');_0x15acc6=convertToWindowsPath(_0x15acc6);if(_0x15acc6[_0x536a5a(0x1eb)]('\x5c\x5c')){let _0x2defe0=_0x15acc6;_0x2defe0=_0x2defe0[_0x536a5a(0x1e2)](/^\\{2,}/,'\x5c\x5c');const _0x301819=_0x2defe0[_0x536a5a(0x1d5)](0x2)['replace'](/\\\\/g,'\x5c');_0x15acc6='\x5c\x5c'+_0x301819;}else _0x15acc6=_0x15acc6[_0x536a5a(0x1e2)](/\\\\/g,'\x5c');let _0x2704e1=a2_0x5eee41[_0x536a5a(0x1e0)](_0x15acc6);_0x15acc6[_0x536a5a(0x1eb)]('\x5c\x5c')&&!_0x2704e1['startsWith']('\x5c\x5c')&&(_0x2704e1='\x5c'+_0x2704e1);if(_0x2704e1[_0x536a5a(0x1dd)](/^[a-zA-Z]:/)){let _0xcde234=_0x2704e1[_0x536a5a(0x1e2)](/\//g,'\x5c');return/^[a-z]:/[_0x536a5a(0x1e7)](_0xcde234)&&(_0xcde234=_0xcde234[_0x536a5a(0x1e6)](0x0)[_0x536a5a(0x1da)]()+_0xcde234[_0x536a5a(0x1d9)](0x1)),_0xcde234;}return _0x2704e1[_0x536a5a(0x1e2)](/\//g,'\x5c');}function a2_0x3df0(_0x2838f3,_0x34a3af){_0x2838f3=_0x2838f3-0x1d4;const _0x4b2e16=a2_0x4b2e();let _0x3df099=_0x4b2e16[_0x2838f3];return _0x3df099;}export function expandHome(_0x31d5ff){const _0x117727=a2_0x3df0;if(_0x31d5ff['startsWith']('~/')||_0x31d5ff==='~')return a2_0x5eee41[_0x117727(0x1dc)](a2_0x16bdc2[_0x117727(0x1de)](),_0x31d5ff[_0x117727(0x1d9)](0x1));return _0x31d5ff;}
1
+ (function(_0x57b7ee,_0x30b347){const _0x55ca5=a2_0x191a,_0x53e66d=_0x57b7ee();while(!![]){try{const _0x2ecb5b=-parseInt(_0x55ca5(0x10a))/0x1+parseInt(_0x55ca5(0x106))/0x2+parseInt(_0x55ca5(0x10e))/0x3+-parseInt(_0x55ca5(0xff))/0x4*(parseInt(_0x55ca5(0x100))/0x5)+-parseInt(_0x55ca5(0x102))/0x6*(parseInt(_0x55ca5(0x104))/0x7)+-parseInt(_0x55ca5(0x108))/0x8*(-parseInt(_0x55ca5(0x10d))/0x9)+parseInt(_0x55ca5(0x10f))/0xa*(parseInt(_0x55ca5(0x105))/0xb);if(_0x2ecb5b===_0x30b347)break;else _0x53e66d['push'](_0x53e66d['shift']());}catch(_0x59761a){_0x53e66d['push'](_0x53e66d['shift']());}}}(a2_0x4bf1,0xcb50b));import a2_0x2db10d from'path';function a2_0x191a(_0x160bb8,_0x5ddcc9){_0x160bb8=_0x160bb8-0xfb;const _0x4bf157=a2_0x4bf1();let _0x191a52=_0x4bf157[_0x160bb8];return _0x191a52;}import a2_0x4b7cf3 from'os';export function convertToWindowsPath(_0x11296b){const _0x19c4d3=a2_0x191a;if(_0x11296b['startsWith']('/mnt/')){const _0x24260f=_0x11296b['charAt'](0x5)[_0x19c4d3(0x10c)](),_0x1fb2af=_0x11296b[_0x19c4d3(0x10b)](0x6)[_0x19c4d3(0x103)](/\//g,'\x5c');return _0x24260f+':'+_0x1fb2af;}if(_0x11296b['match'](/^\/[a-zA-Z]\//)){const _0x19c543=_0x11296b[_0x19c4d3(0xfd)](0x1)['toUpperCase'](),_0x5d35e4=_0x11296b['slice'](0x2)[_0x19c4d3(0x103)](/\//g,'\x5c');return _0x19c543+':'+_0x5d35e4;}if(_0x11296b[_0x19c4d3(0x101)](/^[a-zA-Z]:/))return _0x11296b['replace'](/\//g,'\x5c');return _0x11296b;}export function normalizePath(_0x199c1d){const _0x594062=a2_0x191a;_0x199c1d=_0x199c1d[_0x594062(0xfe)]()[_0x594062(0x103)](/^["']|["']$/g,'');const _0x18ba45=_0x199c1d[_0x594062(0xfc)]('/')&&!_0x199c1d[_0x594062(0x101)](/^\/mnt\/[a-z]\//i)&&!_0x199c1d[_0x594062(0x101)](/^\/[a-zA-Z]\//);if(_0x18ba45)return _0x199c1d['replace'](/\/+/g,'/')[_0x594062(0x103)](/\/+$/,'');_0x199c1d=convertToWindowsPath(_0x199c1d);if(_0x199c1d['startsWith']('\x5c\x5c')){let _0x39f0c4=_0x199c1d;_0x39f0c4=_0x39f0c4[_0x594062(0x103)](/^\\{2,}/,'\x5c\x5c');const _0x475160=_0x39f0c4['substring'](0x2)[_0x594062(0x103)](/\\\\/g,'\x5c');_0x199c1d='\x5c\x5c'+_0x475160;}else _0x199c1d=_0x199c1d['replace'](/\\\\/g,'\x5c');let _0x1b5ee6=a2_0x2db10d[_0x594062(0xfb)](_0x199c1d);_0x199c1d[_0x594062(0xfc)]('\x5c\x5c')&&!_0x1b5ee6[_0x594062(0xfc)]('\x5c\x5c')&&(_0x1b5ee6='\x5c'+_0x1b5ee6);if(_0x1b5ee6[_0x594062(0x101)](/^[a-zA-Z]:/)){let _0x402f16=_0x1b5ee6[_0x594062(0x103)](/\//g,'\x5c');return/^[a-z]:/[_0x594062(0x107)](_0x402f16)&&(_0x402f16=_0x402f16[_0x594062(0xfd)](0x0)['toUpperCase']()+_0x402f16[_0x594062(0x10b)](0x1)),_0x402f16;}return _0x1b5ee6['replace'](/\//g,'\x5c');}export function expandHome(_0x146f28){const _0x4f5a9c=a2_0x191a;if(_0x146f28[_0x4f5a9c(0xfc)]('~/')||_0x146f28==='~')return a2_0x2db10d[_0x4f5a9c(0x109)](a2_0x4b7cf3[_0x4f5a9c(0x110)](),_0x146f28[_0x4f5a9c(0x10b)](0x1));return _0x146f28;}function a2_0x4bf1(){const _0xf70176=['test','5256hRbLXA','join','1361663jdcmpm','slice','toUpperCase','4086zwCTjb','3737949TOrUpX','718210mWzpVT','homedir','normalize','startsWith','charAt','trim','2945696kyaKbO','5ciVoUs','match','5591538sjEhMm','replace','7HvveMJ','231SutORX','1620574YoLFbY'];a2_0x4bf1=function(){return _0xf70176;};return a2_0x4bf1();}
@@ -1 +1 @@
1
- function a3_0x46cd(){const _0x1d0f71=['18oibgmb','resolve','some','1888654ReWIIY','16508640YUTWtE','1phBzVb','95kfaGtk','5512320JXOGjB','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','Path\x20must\x20be\x20absolute\x20after\x20normalization','length','string','246258AhhavL','includes','sep','isArray','normalize','6637715IiIiDZ','351860DCGMki','1913844VWvSRd','isAbsolute'];a3_0x46cd=function(){return _0x1d0f71;};return a3_0x46cd();}(function(_0x4e0e27,_0x3273c3){const _0x37e60d=a3_0x1542,_0x169380=_0x4e0e27();while(!![]){try{const _0x25ac96=-parseInt(_0x37e60d(0x1f2))/0x1*(parseInt(_0x37e60d(0x205))/0x2)+parseInt(_0x37e60d(0x200))/0x3+-parseInt(_0x37e60d(0x1ff))/0x4+-parseInt(_0x37e60d(0x1f3))/0x5*(parseInt(_0x37e60d(0x1f9))/0x6)+-parseInt(_0x37e60d(0x1fe))/0x7+-parseInt(_0x37e60d(0x1f4))/0x8+-parseInt(_0x37e60d(0x202))/0x9*(-parseInt(_0x37e60d(0x206))/0xa);if(_0x25ac96===_0x3273c3)break;else _0x169380['push'](_0x169380['shift']());}catch(_0xb15593){_0x169380['push'](_0x169380['shift']());}}}(a3_0x46cd,0x77b2a));function a3_0x1542(_0x42c4f3,_0x2d593c){_0x42c4f3=_0x42c4f3-0x1f2;const _0x46cdc6=a3_0x46cd();let _0x154289=_0x46cdc6[_0x42c4f3];return _0x154289;}import a3_0x2f869d from'path';export function isPathWithinAllowedDirectories(_0x24825c,_0x33d6e4){const _0x6ba904=a3_0x1542;if(typeof _0x24825c!=='string'||!Array[_0x6ba904(0x1fc)](_0x33d6e4))return![];if(!_0x24825c||_0x33d6e4[_0x6ba904(0x1f7)]===0x0)return![];if(_0x24825c[_0x6ba904(0x1fa)]('\x00'))return![];let _0x52ad15;try{_0x52ad15=a3_0x2f869d['resolve'](a3_0x2f869d[_0x6ba904(0x1fd)](_0x24825c));}catch{return![];}if(!a3_0x2f869d[_0x6ba904(0x201)](_0x52ad15))throw new Error(_0x6ba904(0x1f6));return _0x33d6e4[_0x6ba904(0x204)](_0x14b328=>{const _0x1d3483=_0x6ba904;if(typeof _0x14b328!==_0x1d3483(0x1f8)||!_0x14b328)return![];if(_0x14b328[_0x1d3483(0x1fa)]('\x00'))return![];let _0x1d4490;try{_0x1d4490=a3_0x2f869d[_0x1d3483(0x203)](a3_0x2f869d['normalize'](_0x14b328));}catch{return![];}if(!a3_0x2f869d['isAbsolute'](_0x1d4490))throw new Error(_0x1d3483(0x1f5));if(_0x52ad15===_0x1d4490)return!![];if(_0x1d4490===a3_0x2f869d[_0x1d3483(0x1fb)])return _0x52ad15['startsWith'](a3_0x2f869d[_0x1d3483(0x1fb)]);return _0x52ad15['startsWith'](_0x1d4490+a3_0x2f869d['sep']);});}
1
+ (function(_0x401953,_0xeb81cf){const _0x5b71c3=a3_0x5047,_0x28c650=_0x401953();while(!![]){try{const _0x35a410=parseInt(_0x5b71c3(0x12b))/0x1*(-parseInt(_0x5b71c3(0x12a))/0x2)+-parseInt(_0x5b71c3(0x12c))/0x3*(-parseInt(_0x5b71c3(0x120))/0x4)+-parseInt(_0x5b71c3(0x134))/0x5*(parseInt(_0x5b71c3(0x127))/0x6)+parseInt(_0x5b71c3(0x131))/0x7+parseInt(_0x5b71c3(0x122))/0x8*(parseInt(_0x5b71c3(0x11e))/0x9)+-parseInt(_0x5b71c3(0x12f))/0xa*(parseInt(_0x5b71c3(0x12e))/0xb)+parseInt(_0x5b71c3(0x132))/0xc*(parseInt(_0x5b71c3(0x121))/0xd);if(_0x35a410===_0xeb81cf)break;else _0x28c650['push'](_0x28c650['shift']());}catch(_0x1166c9){_0x28c650['push'](_0x28c650['shift']());}}}(a3_0x1380,0x77e0e));function a3_0x5047(_0x48f85a,_0x3685d1){_0x48f85a=_0x48f85a-0x11e;const _0x138031=a3_0x1380();let _0x504735=_0x138031[_0x48f85a];return _0x504735;}function a3_0x1380(){const _0x4cd70a=['486876VBfVZY','2140554FPcxyt','44088dXAzLY','resolve','isArray','isAbsolute','startsWith','4965906uFOCAn','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','Path\x20must\x20be\x20absolute\x20after\x20normalization','2086STaGre','83apimuj','21KxXusB','string','132NZSfnT','561380LJJWjD','normalize','2627436BrzDbo','48EfPDJH','includes','5gaTBgx','315fwlqKX','sep'];a3_0x1380=function(){return _0x4cd70a;};return a3_0x1380();}import a3_0x229bcf from'path';export function isPathWithinAllowedDirectories(_0x264c81,_0x3c1f8d){const _0x2d8bbe=a3_0x5047;if(typeof _0x264c81!==_0x2d8bbe(0x12d)||!Array[_0x2d8bbe(0x124)](_0x3c1f8d))return![];if(!_0x264c81||_0x3c1f8d['length']===0x0)return![];if(_0x264c81[_0x2d8bbe(0x133)]('\x00'))return![];let _0x580672;try{_0x580672=a3_0x229bcf[_0x2d8bbe(0x123)](a3_0x229bcf['normalize'](_0x264c81));}catch{return![];}if(!a3_0x229bcf[_0x2d8bbe(0x125)](_0x580672))throw new Error(_0x2d8bbe(0x129));return _0x3c1f8d['some'](_0x5c582d=>{const _0x3fa213=_0x2d8bbe;if(typeof _0x5c582d!=='string'||!_0x5c582d)return![];if(_0x5c582d[_0x3fa213(0x133)]('\x00'))return![];let _0x3cc9a4;try{_0x3cc9a4=a3_0x229bcf[_0x3fa213(0x123)](a3_0x229bcf[_0x3fa213(0x130)](_0x5c582d));}catch{return![];}if(!a3_0x229bcf[_0x3fa213(0x125)](_0x3cc9a4))throw new Error(_0x3fa213(0x128));if(_0x580672===_0x3cc9a4)return!![];if(_0x3cc9a4===a3_0x229bcf['sep'])return _0x580672['startsWith'](a3_0x229bcf[_0x3fa213(0x11f)]);return _0x580672[_0x3fa213(0x126)](_0x3cc9a4+a3_0x229bcf[_0x3fa213(0x11f)]);});}
@@ -1 +1 @@
1
- function a4_0x3254(){const _0x1cd1f5=['2442426OsMKik','uri','stat','7402bxzbqZ','623625lNeviM','invalid\x20path\x20or\x20inaccessible','1413052OwQVPN','realpath','Skipping\x20invalid\x20directory:\x20','join','4663392gQqcTz','3948900bCkjZc','push','Skipping\x20','isDirectory','555709BQJMOA','startsWith','slice','\x20due\x20to\x20error:\x20'];a4_0x3254=function(){return _0x1cd1f5;};return a4_0x3254();}(function(_0x595970,_0x429f38){const _0xfd6926=a4_0x5693,_0x40a2f6=_0x595970();while(!![]){try{const _0x3e91bb=-parseInt(_0xfd6926(0x7f))/0x1+parseInt(_0xfd6926(0x7e))/0x2+parseInt(_0xfd6926(0x7b))/0x3+parseInt(_0xfd6926(0x81))/0x4+parseInt(_0xfd6926(0x86))/0x5+-parseInt(_0xfd6926(0x85))/0x6+-parseInt(_0xfd6926(0x77))/0x7;if(_0x3e91bb===_0x429f38)break;else _0x40a2f6['push'](_0x40a2f6['shift']());}catch(_0x76a7fa){_0x40a2f6['push'](_0x40a2f6['shift']());}}}(a4_0x3254,0x75582));import{promises as a4_0x5d94a3}from'fs';function a4_0x5693(_0x96b93e,_0x3e6513){_0x96b93e=_0x96b93e-0x75;const _0x3254d0=a4_0x3254();let _0x569311=_0x3254d0[_0x96b93e];return _0x569311;}import a4_0x5334b0 from'path';import a4_0x4f20a5 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x4b3bd1){const _0x191657=a4_0x5693;try{const _0x22241c=_0x4b3bd1[_0x191657(0x78)]('file://')?_0x4b3bd1[_0x191657(0x79)](0x7):_0x4b3bd1,_0xd1d458=_0x22241c['startsWith']('~/')||_0x22241c==='~'?a4_0x5334b0[_0x191657(0x84)](a4_0x4f20a5['homedir'](),_0x22241c['slice'](0x1)):_0x22241c,_0x2f21c7=a4_0x5334b0['resolve'](_0xd1d458),_0x3d1ee1=await a4_0x5d94a3[_0x191657(0x82)](_0x2f21c7);return normalizePath(_0x3d1ee1);}catch{return null;}}function formatDirectoryError(_0x22bb74,_0x24b89b,_0x3185fd){const _0x4445fc=a4_0x5693;if(_0x3185fd)return _0x4445fc(0x75)+_0x3185fd+':\x20'+_0x22bb74;const _0x565bf9=_0x24b89b instanceof Error?_0x24b89b['message']:String(_0x24b89b);return _0x4445fc(0x83)+_0x22bb74+_0x4445fc(0x7a)+_0x565bf9;}export async function getValidRootDirectories(_0x259171){const _0x2037e6=a4_0x5693,_0x2b12c4=[];for(const _0x1b5821 of _0x259171){const _0x251fe5=await parseRootUri(_0x1b5821[_0x2037e6(0x7c)]);if(!_0x251fe5){logMcpStderr(formatDirectoryError(_0x1b5821[_0x2037e6(0x7c)],undefined,_0x2037e6(0x80)));continue;}try{const _0x208d2b=await a4_0x5d94a3[_0x2037e6(0x7d)](_0x251fe5);_0x208d2b[_0x2037e6(0x76)]()?_0x2b12c4[_0x2037e6(0x87)](_0x251fe5):logMcpStderr(formatDirectoryError(_0x251fe5,undefined,'non-directory\x20root'));}catch(_0x1e6e38){logMcpStderr(formatDirectoryError(_0x251fe5,_0x1e6e38));}}return _0x2b12c4;}
1
+ function a4_0xe0eb(_0x3e159e,_0x52a822){_0x3e159e=_0x3e159e-0xd9;const _0x5c79bd=a4_0x5c79();let _0xe0eb33=_0x5c79bd[_0x3e159e];return _0xe0eb33;}(function(_0x3a7e2,_0x16a4ba){const _0x38e9f6=a4_0xe0eb,_0x154086=_0x3a7e2();while(!![]){try{const _0x147e5c=parseInt(_0x38e9f6(0xe5))/0x1+parseInt(_0x38e9f6(0xea))/0x2+-parseInt(_0x38e9f6(0xe2))/0x3+-parseInt(_0x38e9f6(0xe1))/0x4*(parseInt(_0x38e9f6(0xef))/0x5)+parseInt(_0x38e9f6(0xec))/0x6+parseInt(_0x38e9f6(0xdb))/0x7+-parseInt(_0x38e9f6(0xe9))/0x8;if(_0x147e5c===_0x16a4ba)break;else _0x154086['push'](_0x154086['shift']());}catch(_0x4d747b){_0x154086['push'](_0x154086['shift']());}}}(a4_0x5c79,0x29f0f));import{promises as a4_0x41a8e3}from'fs';import a4_0x37c54a from'path';import a4_0x21082c from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x19cfb8){const _0x183ec7=a4_0xe0eb;try{const _0x22a4d6=_0x19cfb8[_0x183ec7(0xde)](_0x183ec7(0xe7))?_0x19cfb8['slice'](0x7):_0x19cfb8,_0xcb769f=_0x22a4d6['startsWith']('~/')||_0x22a4d6==='~'?a4_0x37c54a[_0x183ec7(0xdc)](a4_0x21082c[_0x183ec7(0xf0)](),_0x22a4d6[_0x183ec7(0xe0)](0x1)):_0x22a4d6,_0x423079=a4_0x37c54a[_0x183ec7(0xed)](_0xcb769f),_0x4c32c8=await a4_0x41a8e3[_0x183ec7(0xe3)](_0x423079);return normalizePath(_0x4c32c8);}catch{return null;}}function formatDirectoryError(_0x19b5f2,_0x1bbaff,_0x42d3ce){const _0x595062=a4_0xe0eb;if(_0x42d3ce)return _0x595062(0xeb)+_0x42d3ce+':\x20'+_0x19b5f2;const _0x7993f2=_0x1bbaff instanceof Error?_0x1bbaff[_0x595062(0xe4)]:String(_0x1bbaff);return'Skipping\x20invalid\x20directory:\x20'+_0x19b5f2+_0x595062(0xda)+_0x7993f2;}function a4_0x5c79(){const _0x15c703=['homedir','push','\x20due\x20to\x20error:\x20','2179422UlIzWh','join','non-directory\x20root','startsWith','invalid\x20path\x20or\x20inaccessible','slice','7116MspBQA','317274vXqgCp','realpath','message','51872ZTcyaY','isDirectory','file://','stat','1286416ueNyEr','82106BsrMUJ','Skipping\x20','620766hrIkQA','resolve','uri','195yJswvy'];a4_0x5c79=function(){return _0x15c703;};return a4_0x5c79();}export async function getValidRootDirectories(_0x65344f){const _0x369498=a4_0xe0eb,_0x358dc7=[];for(const _0xfc91f8 of _0x65344f){const _0x304e6d=await parseRootUri(_0xfc91f8[_0x369498(0xee)]);if(!_0x304e6d){logMcpStderr(formatDirectoryError(_0xfc91f8[_0x369498(0xee)],undefined,_0x369498(0xdf)));continue;}try{const _0x57d0b7=await a4_0x41a8e3[_0x369498(0xe8)](_0x304e6d);_0x57d0b7[_0x369498(0xe6)]()?_0x358dc7[_0x369498(0xd9)](_0x304e6d):logMcpStderr(formatDirectoryError(_0x304e6d,undefined,_0x369498(0xdd)));}catch(_0x544f2c){logMcpStderr(formatDirectoryError(_0x304e6d,_0x544f2c));}}return _0x358dc7;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.126",
3
+ "version": "0.8.128",
4
4
  "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@google/generative-ai": "^0.21.0",
37
37
  "@modelcontextprotocol/sdk": "^1.12.3",
38
- "@morphllm/morphsdk": "0.2.135",
38
+ "@morphllm/morphsdk": "0.2.136",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",