@morphllm/morphmcp 0.8.55 → 0.8.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- function a0_0xf9c0(){const _0x50e76b=['Morph\x20Edit\x20','Enabled\x20tools:\x20','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','query','[could\x20not\x20read\x20file:\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','slice','roots','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','stat','Error\x20accessing\x20directory\x20','listRoots','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','Unknown\x20tool:\x20','describe','string','...','apply\x20these\x20changes','catch','setRequestHandler','connect','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','timeout','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','sk-','optional','constructor','post','Rules:\x0a','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','read\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','\x20valid\x20directories','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','access','timings','Successfully\x20','ENABLE_WORKSPACE_MODE','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','errors','exit','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','Warning:\x20','🔍\x20Morph\x20Edit\x20Preview','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','getClientCapabilities','tsconfig.json','code_edit','0.2.0','substring','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','assistant','File\x20read\x20error:','package.json','object','startsWith','created','stack','518IOSCAz','\x27\x20in\x20`','.cursor','env','ENOENT','terminationReason','UnknownError','Fatal\x20error\x20running\x20server:','false','mcp-filesystem','role','328648ZVByNS','grep\x20\x27','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','success','utf-8','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','6142895RZgknJ','\x20as\x20allowed\x20directory','messages','map','commitHash','resolve','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','Preview\x20changes\x20without\x20applying\x20them.','message','Workspace\x20mode\x20enabled:\x20Using\x20','\x0a</file>','-\x20Read\x20file\x20`','Fallback:\x20Using\x20workspace\x20root\x20','results','\x22>\x0aError\x20reading\x20file:\x20','setNotificationHandler','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','files','\x20results\x20in\x20','length','metadata','isArray','TimeoutError','name','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','MORPH_API_KEY','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','go.mod','\x20chars)','trim','timed\x20out','MORPH_API_URL','\x20\x20\x20','PWD','.vscode','stringify','diff\x0a','.git','basename','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','udiff','completed_with_file_errors','Failed\x20to\x20read\x20file:\x20','24YHxKyQ','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','6702XGSnnR','composer.json','startLine','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','morph-v3-fast','application/json','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','No\x20results\x20found\x20for\x20query:\x20\x22','applied\x20edits\x20to','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','2670800jXAHQs','499temnFn','argv','requiresApiKey','Created\x20File','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','realpath','Morph\x20FastApply\x20failed\x20without\x20error\x20message','dryRun','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','data','searchTimeMs','morph-','Warning:\x20Workspace\x20fallback\x20failed:\x20','pyproject.toml','Bearer\x20','895jvSMSw','content','text','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','join','warpgrep_codebase_search','stats','search_string','push','error','isDirectory','all','params','repoId','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','terminated','\x20-\x20','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','instruction','split','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','etimedout','Benefits:\x0a','Use\x20dryRun=false\x20to\x20','list_directory\x20','Error\x20running\x20fast\x20context\x20search:\x20','match','Specific\x20commit\x20hash\x20to\x20search','number','lines','toLowerCase','Unknown\x20error','</file>','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','cwd','endLine','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Found\x20','dirname','48327jAXFYT','ENABLED_TOOLS','limit','\x0a...\x20(truncated,\x20total:\x20','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','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','edit_file','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','2457054ZDkURy','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Max\x20results\x20to\x20return','path','create\x20this\x20file','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Invalid\x20arguments:\x20','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','source','sep','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','%\x20match)\x0a','Error:\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','readFile','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Cargo.toml','codebase_search','MORPH_WARP_GREP_TIMEOUT','-\x20Grepped\x20\x27','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','filter','safeParse','Repository\x20identifier','target_directories','includes','finish','repo_path','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','morph-warp-grep-v1-1111v0','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','7RmgTub','<file\x20path=\x22','repeat'];a0_0xf9c0=function(){return _0x50e76b;};return a0_0xf9c0();}const a0_0x43f615=a0_0x3b44;(function(_0x3aa12a,_0x34debb){const _0x51babd=a0_0x3b44,_0x389e1c=_0x3aa12a();while(!![]){try{const _0x516f44=-parseInt(_0x51babd(0x18b))/0x1*(parseInt(_0x51babd(0x142))/0x2)+parseInt(_0x51babd(0x1c3))/0x3*(parseInt(_0x51babd(0x17e))/0x4)+parseInt(_0x51babd(0x19a))/0x5*(parseInt(_0x51babd(0x180))/0x6)+-parseInt(_0x51babd(0x103))/0x7*(parseInt(_0x51babd(0x14d))/0x8)+-parseInt(_0x51babd(0x1cb))/0x9+-parseInt(_0x51babd(0x18a))/0xa+parseInt(_0x51babd(0x153))/0xb;if(_0x516f44===_0x34debb)break;else _0x389e1c['push'](_0x389e1c['shift']());}catch(_0x13f3d0){_0x389e1c['push'](_0x389e1c['shift']());}}}(a0_0xf9c0,0x234fa));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x3b44(_0x534602,_0x5f1513){_0x534602=_0x534602-0xf8;const _0xf9c04=a0_0xf9c0();let _0x3b44d9=_0xf9c04[_0x534602];return _0x3b44d9;}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x5622e8 from'fs/promises';import a0_0x1e61d5 from'path';import a0_0x1e1fd0 from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x453166 from'axios';function fixPathRepetition(_0x48b8d0){const _0x2e3539=a0_0x3b44,_0x24829c=_0x48b8d0[_0x2e3539(0x1af)](a0_0x1e61d5[_0x2e3539(0x1d5)])[_0x2e3539(0x1e2)](Boolean);if(_0x24829c[_0x2e3539(0x166)]<0x2)return null;for(let _0x5a4d5d=Math['floor'](_0x24829c[_0x2e3539(0x166)]/0x2);_0x5a4d5d>=0x1;_0x5a4d5d--){for(let _0x5544ce=0x0;_0x5544ce<=_0x24829c['length']-0x2*_0x5a4d5d;_0x5544ce++){const _0x26dc89=_0x24829c['slice'](_0x5544ce,_0x5544ce+_0x5a4d5d),_0x21096f=_0x24829c[_0x2e3539(0x10d)](_0x5544ce+_0x5a4d5d,_0x5544ce+0x2*_0x5a4d5d);if(_0x26dc89['every']((_0x35d4fb,_0x5e575d)=>_0x35d4fb===_0x21096f[_0x5e575d])){const _0x304192=[..._0x24829c[_0x2e3539(0x10d)](0x0,_0x5544ce),..._0x24829c[_0x2e3539(0x10d)](_0x5544ce+_0x5a4d5d)];return a0_0x1e61d5[_0x2e3539(0x1d5)]+_0x304192['join'](a0_0x1e61d5[_0x2e3539(0x1d5)]);}}}return null;}const args=process[a0_0x43f615(0x18c)][a0_0x43f615(0x10d)](0x2),ALL_TOOLS=['edit_file',a0_0x43f615(0x19f),'codebase_search'],DEFAULT_TOOLS=[a0_0x43f615(0x1c9),a0_0x43f615(0x19f)],ENABLED_TOOLS=process[a0_0x43f615(0x145)]['ENABLED_TOOLS']?process[a0_0x43f615(0x145)][a0_0x43f615(0x1c4)]==='all'?ALL_TOOLS:process[a0_0x43f615(0x145)][a0_0x43f615(0x1c4)][a0_0x43f615(0x1af)](',')[a0_0x43f615(0x156)](_0xc9ea57=>_0xc9ea57[a0_0x43f615(0x170)]()):DEFAULT_TOOLS;console['error'](a0_0x43f615(0x107)+ENABLED_TOOLS[a0_0x43f615(0x19e)](',\x20'));const WORKSPACE_ROOT=process[a0_0x43f615(0x145)]['WORKSPACE_ROOT']||process['env'][a0_0x43f615(0x174)]||process[a0_0x43f615(0x1be)](),ENABLE_WORKSPACE_MODE=process[a0_0x43f615(0x145)][a0_0x43f615(0x12d)]!==a0_0x43f615(0x14a),MORPH_API_KEY=process['env'][a0_0x43f615(0x16c)],MORPH_API_URL=process[a0_0x43f615(0x145)][a0_0x43f615(0x172)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x43f615(0x145)][a0_0x43f615(0x1df)]?parseInt(process[a0_0x43f615(0x145)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x43f615(0x13f)](a0_0x43f615(0x120))&&!MORPH_API_KEY[a0_0x43f615(0x13f)](a0_0x43f615(0x196))&&console[a0_0x43f615(0x1a3)](a0_0x43f615(0x11f));async function reportMorphError(_0xc44e60){const _0x35faf5=a0_0x43f615;try{await a0_0x453166[_0x35faf5(0x123)]('https://morphllm.com/api/error-report',{..._0xc44e60,'timestamp':new Date()['toISOString'](),'source':_0xc44e60[_0x35faf5(0x1d4)]||_0x35faf5(0x14b)},{'timeout':0x1388,'headers':{'Content-Type':_0x35faf5(0x185),'Authorization':_0x35faf5(0x199)+MORPH_API_KEY}});}catch{}}args[a0_0x43f615(0x166)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x43f615(0x1a3)](a0_0x43f615(0x152)),console['error'](a0_0x43f615(0x1ac)),console[a0_0x43f615(0x1a3)](a0_0x43f615(0x1c0)),console[a0_0x43f615(0x1a3)]('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),console[a0_0x43f615(0x1a3)](a0_0x43f615(0x1c7)),console['error'](a0_0x43f615(0x1d9)));function normalizePath(_0x5725a0){return a0_0x1e61d5['normalize'](_0x5725a0);}function expandHome(_0x2ddc9a){const _0x215bb9=a0_0x43f615;if(_0x2ddc9a[_0x215bb9(0x13f)]('~/')||_0x2ddc9a==='~')return a0_0x1e61d5['join'](a0_0x1e1fd0['homedir'](),_0x2ddc9a[_0x215bb9(0x10d)](0x1));return _0x2ddc9a;}let allowedDirectories=await Promise['all'](args[a0_0x43f615(0x156)](async _0xcdc83c=>{const _0x14e3b3=a0_0x43f615,_0x1f9b5d=expandHome(_0xcdc83c),_0x17f0e8=a0_0x1e61d5[_0x14e3b3(0x158)](_0x1f9b5d);try{const _0x4f45cf=await a0_0x5622e8[_0x14e3b3(0x190)](_0x17f0e8);return normalizePath(_0x4f45cf);}catch(_0x1a013a){return normalizePath(_0x17f0e8);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x43f615(0x166)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console[a0_0x43f615(0x1a3)](a0_0x43f615(0x15c)+workspaceDir+a0_0x43f615(0x154)));}catch(a0_0x149045){console[a0_0x43f615(0x1a3)](a0_0x43f615(0x1d0)+a0_0x149045);}async function detectWorkspaceRoot(_0x245371){const _0x336155=a0_0x43f615;let _0x1f497c=a0_0x1e61d5[_0x336155(0x158)](_0x245371);const _0x5ab230=[_0x336155(0x178),_0x336155(0x175),_0x336155(0x13d),_0x336155(0x1dd),_0x336155(0x198),_0x336155(0x16e),_0x336155(0x144),_0x336155(0x136),_0x336155(0x181)];while(_0x1f497c!==a0_0x1e61d5[_0x336155(0x1c2)](_0x1f497c)){for(const _0xaf36c9 of _0x5ab230){const _0x1674a5=a0_0x1e61d5[_0x336155(0x19e)](_0x1f497c,_0xaf36c9);try{return await a0_0x5622e8[_0x336155(0x12a)](_0x1674a5),normalizePath(_0x1f497c);}catch{}}_0x1f497c=a0_0x1e61d5[_0x336155(0x1c2)](_0x1f497c);}return normalizePath(_0x245371);}await Promise[a0_0x43f615(0x1a5)](args[a0_0x43f615(0x156)](async _0x50ff15=>{const _0x4b4b18=a0_0x43f615;try{const _0x48d8f8=await a0_0x5622e8[_0x4b4b18(0x110)](expandHome(_0x50ff15));!_0x48d8f8[_0x4b4b18(0x1a4)]()&&(console[_0x4b4b18(0x1a3)](_0x4b4b18(0x1d8)+_0x50ff15+'\x20is\x20not\x20a\x20directory'),process[_0x4b4b18(0x130)](0x1));}catch(_0x5d8d94){console[_0x4b4b18(0x1a3)](_0x4b4b18(0x111)+_0x50ff15+':',_0x5d8d94),process[_0x4b4b18(0x130)](0x1);}}));async function validatePath(_0xb197c2){const _0x2a0eca=a0_0x43f615,_0x21fac7=expandHome(_0xb197c2),_0x52a16c=a0_0x1e61d5['resolve'](_0x21fac7);try{const _0x243ae4=await a0_0x5622e8[_0x2a0eca(0x190)](_0x52a16c);return _0x243ae4;}catch(_0x4e21d7){if(_0x4e21d7['code']===_0x2a0eca(0x146)){const _0x2bda83=a0_0x1e61d5[_0x2a0eca(0x1c2)](_0x52a16c);try{const _0x3ac0e4=await a0_0x5622e8[_0x2a0eca(0x190)](_0x2bda83);return a0_0x1e61d5['join'](_0x3ac0e4,a0_0x1e61d5[_0x2a0eca(0x179)](_0x52a16c));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x2bda83);}}throw _0x4e21d7;}}const MorphEditFileArgsSchema=z['object']({'path':z['string'](),'code_edit':z[a0_0x43f615(0x116)]()[a0_0x43f615(0x115)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x43f615(0x116)]()[a0_0x43f615(0x115)](a0_0x43f615(0x16d)),'dryRun':z['boolean']()['default'](![])[a0_0x43f615(0x115)](a0_0x43f615(0x15a))}),WarpGrepArgsSchema=z[a0_0x43f615(0x13e)]({'search_string':z['string']()[a0_0x43f615(0x115)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'repo_path':z[a0_0x43f615(0x116)]()[a0_0x43f615(0x115)](a0_0x43f615(0x1c8))}),CodebaseSearchArgsSchema=z[a0_0x43f615(0x13e)]({'query':z['string']()[a0_0x43f615(0x115)]('Natural\x20language\x20query\x20to\x20search\x20for\x20code'),'repoId':z[a0_0x43f615(0x116)]()[a0_0x43f615(0x115)](a0_0x43f615(0xf9)),'branch':z['string']()[a0_0x43f615(0x121)]()[a0_0x43f615(0x115)](a0_0x43f615(0x1cc)),'commitHash':z['string']()[a0_0x43f615(0x121)]()[a0_0x43f615(0x115)](a0_0x43f615(0x1b7)),'target_directories':z['array'](z[a0_0x43f615(0x116)]())['default']([])[a0_0x43f615(0x115)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x43f615(0x1b8)]()[a0_0x43f615(0x121)]()['default'](0xa)[a0_0x43f615(0x115)](a0_0x43f615(0x1cd))}),server=new Server({'name':'morph-mcp','version':a0_0x43f615(0x138)},{'capabilities':{'tools':{}}});server[a0_0x43f615(0x11a)](ListToolsRequestSchema,async()=>{const _0x341143=a0_0x43f615,_0x2f8884=[{'name':_0x341143(0x1c9),'description':_0x341143(0xfe)+_0x341143(0x13a)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x341143(0x109)+'Benefits:\x0a'+_0x341143(0x183)+_0x341143(0x11c)+_0x341143(0x1b0)+_0x341143(0x12e)+_0x341143(0x1ca)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x341143(0x11d)+'For\x20deletions:\x0a'+_0x341143(0x1ad)+_0x341143(0x18f)+_0x341143(0x124)+_0x341143(0x101)+_0x341143(0x127)+_0x341143(0x1e1)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x341143(0x100)+_0x341143(0x1d2)+_0x341143(0x10c),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x341143(0x19f),'description':'A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20'+_0x341143(0x17a)+_0x341143(0x1d6)+_0x341143(0x14f)+_0x341143(0x113)+_0x341143(0x17f)+_0x341143(0x134)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x341143(0x1de),'description':_0x341143(0x163)+_0x341143(0x159)+_0x341143(0x131)+_0x341143(0x1b2)+_0x341143(0x186)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x341143(0x1ab)+_0x341143(0x108)+_0x341143(0x19d)+_0x341143(0x193)+_0x341143(0x10f),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x158122=_0x2f8884[_0x341143(0x1e2)](_0x3d8e6b=>{const _0x190bc8=_0x341143;if(!ENABLED_TOOLS['includes'](_0x3d8e6b[_0x190bc8(0x16a)]))return![];if(_0x190bc8(0x18d)in _0x3d8e6b&&_0x3d8e6b[_0x190bc8(0x18d)]&&!MORPH_API_KEY)return console[_0x190bc8(0x1a3)]('Warning:\x20'+_0x3d8e6b['name']+_0x190bc8(0x125)),![];return!![];});return{'tools':_0x158122['map'](_0x2d00db=>({'name':_0x2d00db[_0x341143(0x16a)],'description':_0x2d00db['description'],'inputSchema':_0x2d00db['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x4ba64a=>{const _0x14fdc4=a0_0x43f615;try{const {name:_0x25e83a,arguments:_0x274de6}=_0x4ba64a[_0x14fdc4(0x1a6)];switch(_0x25e83a){case _0x14fdc4(0x1c9):{const _0x538764=MorphEditFileArgsSchema[_0x14fdc4(0xf8)](_0x274de6);if(!_0x538764['success'])throw new Error(_0x14fdc4(0x16b)+_0x538764[_0x14fdc4(0x1a3)]);const _0xab05e2=await validatePath(_0x538764['data'][_0x14fdc4(0x1ce)]);let _0x37b568=null,_0x369c86=!![],_0x1bed5c=null;try{_0x37b568=await a0_0x5622e8['readFile'](_0xab05e2,_0x14fdc4(0x151));}catch(_0x3d8c11){const _0xbe9314=_0x3d8c11['code'];_0xbe9314===_0x14fdc4(0x146)?(_0x369c86=![],_0x37b568=''):(_0x1bed5c=_0x14fdc4(0x17d)+(_0xbe9314||'unknown')+_0x14fdc4(0x1aa)+(_0x3d8c11 instanceof Error?_0x3d8c11[_0x14fdc4(0x15b)]:String(_0x3d8c11)),console[_0x14fdc4(0x1a3)](_0x14fdc4(0x132)+_0x1bed5c));}try{const _0x150666=MORPH_API_KEY;if(!_0x150666)throw new Error(_0x14fdc4(0x189));const _0xb8beeb=a0_0x1e61d5[_0x14fdc4(0x1c2)](_0xab05e2),_0x3c04f0=a0_0x1e61d5[_0x14fdc4(0x179)](_0xab05e2),_0x3f8944=await executeEditFile({'target_filepath':_0x3c04f0,'code_edit':_0x538764['data'][_0x14fdc4(0x137)],'instructions':_0x538764['data']['instruction']},{'morphApiKey':_0x150666,'morphApiUrl':MORPH_API_URL,'baseDir':_0xb8beeb,'autoWrite':!_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x192)],'generateUdiff':!![],'debug':![]});if(!_0x3f8944[_0x14fdc4(0x150)])throw new Error(_0x3f8944[_0x14fdc4(0x1a3)]||_0x14fdc4(0x191));const _0x30b07f=_0x3f8944[_0x14fdc4(0x17b)]||'';let _0x55808a=0x3;while(_0x30b07f[_0x14fdc4(0xfb)]('`'[_0x14fdc4(0x105)](_0x55808a))){_0x55808a++;}const _0x1f09bc='`'[_0x14fdc4(0x105)](_0x55808a)+_0x14fdc4(0x177)+_0x30b07f+'`'[_0x14fdc4(0x105)](_0x55808a)+'\x0a\x0a';if(_0x538764['data'][_0x14fdc4(0x192)])return{'content':[{'type':_0x14fdc4(0x19c),'text':_0x14fdc4(0x133)+(_0x369c86?'':'\x20(new\x20file)')+':\x20'+_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x1ae)]+'\x0a\x0a'+_0x1f09bc+_0x14fdc4(0x1b3)+(_0x369c86?_0x14fdc4(0x118):_0x14fdc4(0x1cf))+'.'}]};return{'content':[{'type':'text','text':_0x14fdc4(0x106)+(_0x369c86?'Applied':_0x14fdc4(0x18e))+':\x20'+_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x1ae)]+'\x0a\x0a'+_0x1f09bc+_0x14fdc4(0x12c)+(_0x369c86?_0x14fdc4(0x188):_0x14fdc4(0x140))+'\x20'+_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x1ce)]}]};}catch(_0x350a24){const _0x263a05=_0x350a24 instanceof Error?_0x350a24['message']:String(_0x350a24);return reportMorphError({'error_message':_0x263a05,'error_type':_0x350a24 instanceof Error?_0x350a24[_0x14fdc4(0x122)]['name']:_0x14fdc4(0x148),'context':{'tool':_0x14fdc4(0x1c9),'file_path':_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x1ce)],'validated_path':_0xab05e2,'instruction':_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x1ae)],'model':_0x14fdc4(0x184),'dry_run':_0x538764['data']['dryRun'],'file_exists':_0x369c86,'file_read_error':_0x1bed5c,'file_readable':_0x37b568!==null,'request_content':{'path':_0x538764['data'][_0x14fdc4(0x1ce)],'code_edit':_0x538764['data'][_0x14fdc4(0x137)],'instruction':_0x538764[_0x14fdc4(0x194)]['instruction'],'original_code':_0x37b568!==null?_0x37b568['length']>0xc350?_0x37b568[_0x14fdc4(0x139)](0x0,0xc350)+_0x14fdc4(0x1c6)+_0x37b568[_0x14fdc4(0x166)]+_0x14fdc4(0x16f):_0x37b568:_0x14fdc4(0x10b)+(_0x1bed5c||'unknown\x20error')+']','original_code_length':_0x37b568?.[_0x14fdc4(0x166)]??0x0,'model':_0x14fdc4(0x184),'dry_run':_0x538764[_0x14fdc4(0x194)][_0x14fdc4(0x192)]}},'stack_trace':_0x350a24 instanceof Error?_0x350a24['stack']:undefined,'source':_0x14fdc4(0x14b)})[_0x14fdc4(0x119)](()=>{}),{'content':[{'type':_0x14fdc4(0x19c),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x263a05}],'isError':!![]};}}case _0x14fdc4(0x19f):{const _0x15af3c=WarpGrepArgsSchema[_0x14fdc4(0xf8)](_0x274de6);if(!_0x15af3c['success'])return{'content':[{'type':_0x14fdc4(0x19c),'text':_0x14fdc4(0x1d1)+_0x15af3c[_0x14fdc4(0x1a3)]}],'isError':!![]};const _0x8167a4=_0x42f119=>{const _0x257d67=_0x14fdc4,_0x1c8372=[];for(const _0x4300bb of _0x42f119||[]){const _0x155c0f=_0x4300bb[_0x257d67(0x14c)],_0x11168d=_0x4300bb[_0x257d67(0x19b)];if(_0x155c0f===_0x257d67(0x13b)&&_0x11168d){const _0x3c74f1=_0x11168d[_0x257d67(0x1af)]('\x0a')[_0x257d67(0x1e2)](_0x111e0d=>_0x111e0d[_0x257d67(0x170)]());for(const _0x315283 of _0x3c74f1){const _0x119194=_0x315283[_0x257d67(0x1b6)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x119194){_0x1c8372[_0x257d67(0x1a2)](_0x257d67(0x14e)+_0x119194[0x1]+'\x27\x20'+_0x119194[0x2]);continue;}const _0x578673=_0x315283['match'](/^read\s+(.+)$/);if(_0x578673){_0x1c8372[_0x257d67(0x1a2)](_0x257d67(0x126)+_0x578673[0x1]);continue;}const _0x5a66fd=_0x315283[_0x257d67(0x1b6)](/^list_directory\s+(.+)$/);if(_0x5a66fd){_0x1c8372[_0x257d67(0x1a2)](_0x257d67(0x1b4)+_0x5a66fd[0x1]);continue;}}}}return _0x1c8372;};try{const _0x4c2cca=a0_0x1e61d5[_0x14fdc4(0x158)](_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)]),_0x4bdf6f=new LocalRipgrepProvider(_0x4c2cca),_0x5808fd=await runWarpGrep({'query':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0x1a1)],'repoRoot':_0x4c2cca,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4bdf6f});let _0x23071d='';if(_0x5808fd[_0x14fdc4(0x147)]==='completed'&&_0x5808fd[_0x14fdc4(0xfc)]?.[_0x14fdc4(0x167)]?.[_0x14fdc4(0x164)]){const _0x1b40d9=_0x5808fd[_0x14fdc4(0xfc)][_0x14fdc4(0x167)][_0x14fdc4(0x164)],_0x36644c=[],_0x157687=[_0x14fdc4(0x1dc)];for(const _0x501aac of _0x5808fd['messages']){const _0x4b9fa2=_0x501aac[_0x14fdc4(0x14c)],_0x443044=_0x501aac['content'];if(_0x4b9fa2===_0x14fdc4(0x13b)&&_0x443044){const _0x5b2387=_0x443044['split']('\x0a')[_0x14fdc4(0x1e2)](_0x5b0d43=>_0x5b0d43[_0x14fdc4(0x170)]());for(const _0x50a84d of _0x5b2387){const _0x1ac965=_0x50a84d['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1ac965){_0x157687['push'](_0x14fdc4(0x1e0)+_0x1ac965[0x1]+_0x14fdc4(0x143)+_0x1ac965[0x2]+'`');continue;}const _0x2a72f8=_0x50a84d[_0x14fdc4(0x1b6)](/^read\s+(.+)$/);if(_0x2a72f8){_0x157687[_0x14fdc4(0x1a2)](_0x14fdc4(0x15e)+_0x2a72f8[0x1]+'`');continue;}const _0x48f73c=_0x50a84d[_0x14fdc4(0x1b6)](/^list_directory\s+(.+)$/);if(_0x48f73c){_0x157687[_0x14fdc4(0x1a2)]('-\x20Listed\x20directory\x20`'+_0x48f73c[0x1]+'`');continue;}}}}_0x36644c['push'](_0x157687[_0x14fdc4(0x19e)]('\x0a'));const _0x1d0c3e=['','Relevant\x20context\x20found:'];for(const _0x1bef6c of _0x1b40d9){if(_0x1bef6c[_0x14fdc4(0x1b9)]==='*')_0x1d0c3e[_0x14fdc4(0x1a2)]('-\x20'+_0x1bef6c[_0x14fdc4(0x1ce)]+':*');else{if(Array['isArray'](_0x1bef6c['lines'])){const _0x4fb342=_0x1bef6c[_0x14fdc4(0x1b9)][_0x14fdc4(0x156)](([_0x5b0076,_0x2f3519])=>{if(_0x5b0076===_0x2f3519)return''+_0x5b0076;return _0x5b0076+'-'+_0x2f3519;});_0x1d0c3e[_0x14fdc4(0x1a2)]('-\x20'+_0x1bef6c[_0x14fdc4(0x1ce)]+':'+_0x4fb342[_0x14fdc4(0x19e)](','));}else _0x1d0c3e[_0x14fdc4(0x1a2)]('-\x20'+_0x1bef6c[_0x14fdc4(0x1ce)]+':*');}}_0x1d0c3e[_0x14fdc4(0x1a2)](''),_0x36644c[_0x14fdc4(0x1a2)](_0x1d0c3e['join']('\x0a')),_0x36644c[_0x14fdc4(0x1a2)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x438726=[];for(const _0x7196fa of _0x1b40d9){let _0x6a886d=a0_0x1e61d5[_0x14fdc4(0x158)](_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],_0x7196fa[_0x14fdc4(0x1ce)]),_0x1ed907=null,_0x2c028b=null;try{_0x1ed907=await a0_0x5622e8[_0x14fdc4(0x1db)](_0x6a886d,{'encoding':'utf-8'});}catch(_0x35dad9){const _0x11789c=fixPathRepetition(_0x6a886d);if(_0x11789c)try{_0x1ed907=await a0_0x5622e8['readFile'](_0x11789c,{'encoding':'utf-8'}),_0x6a886d=_0x11789c;}catch{_0x2c028b=_0x35dad9 instanceof Error?_0x35dad9:new Error(String(_0x35dad9));}else _0x2c028b=_0x35dad9 instanceof Error?_0x35dad9:new Error(String(_0x35dad9));}if(_0x1ed907!==null){const _0x91053d=_0x1ed907['split'](/\r?\n/),_0x10c3fe=[_0x14fdc4(0x104)+_0x7196fa['path']+'\x22>'];if(_0x7196fa['lines']==='*'||!Array[_0x14fdc4(0x168)](_0x7196fa[_0x14fdc4(0x1b9)]))for(let _0x1a176a=0x1;_0x1a176a<=_0x91053d[_0x14fdc4(0x166)];_0x1a176a++){const _0xafefe1=_0x91053d[_0x1a176a-0x1];_0x10c3fe[_0x14fdc4(0x1a2)](_0x1a176a+'|\x20'+_0xafefe1);}else for(const [_0x323b0b,_0x4f254a]of _0x7196fa[_0x14fdc4(0x1b9)]){_0x10c3fe[_0x14fdc4(0x166)]>0x1&&_0x10c3fe['push']('');for(let _0x5cfabe=_0x323b0b;_0x5cfabe<=_0x4f254a&&_0x5cfabe<=_0x91053d['length'];_0x5cfabe++){const _0x9d6dda=_0x91053d[_0x5cfabe-0x1];_0x10c3fe['push'](_0x5cfabe+'|\x20'+_0x9d6dda);}}_0x10c3fe[_0x14fdc4(0x1a2)](_0x14fdc4(0x1bc)),_0x438726[_0x14fdc4(0x1a2)](_0x10c3fe[_0x14fdc4(0x19e)]('\x0a'));}else _0x438726[_0x14fdc4(0x1a2)](_0x14fdc4(0x104)+_0x7196fa['path']+_0x14fdc4(0x161)+(_0x2c028b?.[_0x14fdc4(0x15b)]||_0x14fdc4(0x1bb))+_0x14fdc4(0x15d));}_0x36644c[_0x14fdc4(0x1a2)](_0x438726[_0x14fdc4(0x19e)]('\x0a\x0a')),_0x23071d=_0x36644c[_0x14fdc4(0x19e)]('\x0a');const _0x2ec46c=_0x5808fd[_0x14fdc4(0x12f)]?.[_0x14fdc4(0x1e2)](_0x2958dd=>_0x2958dd[_0x14fdc4(0x15b)]?.[_0x14fdc4(0x13f)](_0x14fdc4(0x13c)))||[];if(_0x2ec46c[_0x14fdc4(0x166)]>0x0){const _0x1f1fbb=_0x2ec46c['map'](_0x44a525=>_0x44a525['message'])[_0x14fdc4(0x19e)](';\x20');reportMorphError({'error_message':_0x1f1fbb,'error_type':'FileReadError','context':{'tool':_0x14fdc4(0x19f),'repo_path':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],'query':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0x1a1)],'model':_0x14fdc4(0xff),'termination_reason':_0x14fdc4(0x17c),'error_count':_0x2ec46c['length'],'is_timeout':![],'timings':_0x5808fd[_0x14fdc4(0x12b)],'files_attempted':_0x1b40d9[_0x14fdc4(0x156)](_0x4b2772=>({'path':_0x4b2772['path'],'lines':_0x4b2772[_0x14fdc4(0x1b9)]})),'tool_calls':_0x8167a4(_0x5808fd[_0x14fdc4(0x155)]),'messages':_0x5808fd[_0x14fdc4(0x155)]?.[_0x14fdc4(0x156)](_0x3e100e=>({'role':_0x3e100e[_0x14fdc4(0x14c)],'content':_0x3e100e[_0x14fdc4(0x19b)]})),'request_content':{'query':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0x1a1)],'repo_path':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],'repoRoot':a0_0x1e61d5['resolve'](_0x15af3c['data'][_0x14fdc4(0xfd)]),'model':_0x14fdc4(0xff)}},'source':_0x14fdc4(0x14b)})['catch'](()=>{});}}else{if(_0x5808fd[_0x14fdc4(0x147)]===_0x14fdc4(0x1a9)&&_0x5808fd[_0x14fdc4(0x12f)][_0x14fdc4(0x166)]>0x0){const _0x569358=_0x5808fd[_0x14fdc4(0x12f)][_0x14fdc4(0x156)](_0x4f035d=>_0x4f035d[_0x14fdc4(0x15b)])[_0x14fdc4(0x19e)](';\x20');_0x23071d=_0x14fdc4(0x1d8)+_0x569358;const _0x56d49b=_0x569358['toLowerCase']()['includes']('timeout')||_0x569358[_0x14fdc4(0x1ba)]()[_0x14fdc4(0xfb)](_0x14fdc4(0x171))||_0x569358[_0x14fdc4(0x1ba)]()['includes'](_0x14fdc4(0x1b1)),_0x438ce0=_0x5808fd[_0x14fdc4(0xfc)]?.['metadata']?.[_0x14fdc4(0x164)],_0x300bcb=_0x5808fd[_0x14fdc4(0x12f)][0x0];reportMorphError({'error_message':_0x569358,'error_type':_0x56d49b?_0x14fdc4(0x169):_0x300bcb?.[_0x14fdc4(0x122)]?.[_0x14fdc4(0x16a)]||'WarpGrepError','context':{'tool':_0x14fdc4(0x19f),'repo_path':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],'query':_0x15af3c['data'][_0x14fdc4(0x1a1)],'model':_0x14fdc4(0xff),'termination_reason':_0x5808fd[_0x14fdc4(0x147)],'error_count':_0x5808fd[_0x14fdc4(0x12f)][_0x14fdc4(0x166)],'is_timeout':_0x56d49b,'timings':_0x5808fd[_0x14fdc4(0x12b)],'files_attempted':_0x438ce0?.[_0x14fdc4(0x156)](_0x42ed79=>({'path':_0x42ed79['path'],'lines':_0x42ed79[_0x14fdc4(0x1b9)]})),'tool_calls':_0x8167a4(_0x5808fd['messages']),'messages':_0x5808fd['messages']?.[_0x14fdc4(0x156)](_0x16452e=>({'role':_0x16452e['role'],'content':_0x16452e['content']})),'request_content':{'query':_0x15af3c['data'][_0x14fdc4(0x1a1)],'repo_path':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],'repoRoot':a0_0x1e61d5[_0x14fdc4(0x158)](_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x300bcb?.[_0x14fdc4(0x141)]||undefined,'source':'mcp-filesystem'})[_0x14fdc4(0x119)](()=>{});}else _0x23071d=_0x14fdc4(0x1da);}return{'content':[{'type':_0x14fdc4(0x19c),'text':_0x23071d}]};}catch(_0xebad81){const _0x4f2919=_0xebad81 instanceof Error?_0xebad81['message']:String(_0xebad81),_0x7a2215=_0x4f2919[_0x14fdc4(0x1ba)]()[_0x14fdc4(0xfb)](_0x14fdc4(0x11e))||_0x4f2919[_0x14fdc4(0x1ba)]()[_0x14fdc4(0xfb)]('timed\x20out')||_0x4f2919[_0x14fdc4(0x1ba)]()[_0x14fdc4(0xfb)](_0x14fdc4(0x1b1))||_0xebad81 instanceof Error&&_0xebad81[_0x14fdc4(0x16a)]===_0x14fdc4(0x169);return reportMorphError({'error_message':_0x4f2919,'error_type':_0x7a2215?_0x14fdc4(0x169):_0xebad81 instanceof Error?_0xebad81[_0x14fdc4(0x122)]['name']:_0x14fdc4(0x148),'context':{'tool':_0x14fdc4(0x19f),'repo_path':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],'query':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0x1a1)],'model':_0x14fdc4(0xff),'is_timeout':_0x7a2215,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0x1a1)],'repo_path':_0x15af3c[_0x14fdc4(0x194)][_0x14fdc4(0xfd)],'repoRoot':a0_0x1e61d5[_0x14fdc4(0x158)](_0x15af3c[_0x14fdc4(0x194)]['repo_path']),'model':_0x14fdc4(0xff)}},'stack_trace':_0xebad81 instanceof Error?_0xebad81['stack']:undefined,'source':_0x14fdc4(0x14b)})[_0x14fdc4(0x119)](()=>{}),{'content':[{'type':'text','text':_0x14fdc4(0x1b5)+_0x4f2919}],'isError':![]};}}case _0x14fdc4(0x1de):{const _0x561ca4=CodebaseSearchArgsSchema['safeParse'](_0x274de6);if(!_0x561ca4[_0x14fdc4(0x150)])return{'content':[{'type':'text','text':_0x14fdc4(0x1d1)+_0x561ca4[_0x14fdc4(0x1a3)]}],'isError':!![]};try{const _0x36a6d3=MORPH_API_KEY;if(!_0x36a6d3)throw new Error(_0x14fdc4(0x102));const _0x5d2426=await executeCodebaseSearch({'query':_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0x10a)],'target_directories':_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0xfa)],'limit':_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0x1c5)]},{'apiKey':_0x36a6d3,'repoId':_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0x1a7)],'branch':_0x561ca4['data']['branch'],'commitHash':_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0x157)],'debug':![]});if(!_0x5d2426['success'])return{'content':[{'type':_0x14fdc4(0x19c),'text':'Search\x20failed:\x20'+_0x5d2426['error']}],'isError':!![]};const _0x290932=_0x5d2426[_0x14fdc4(0x160)][_0x14fdc4(0x166)]===0x0?_0x14fdc4(0x187)+_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0x10a)]+'\x22':_0x14fdc4(0x1c1)+_0x5d2426[_0x14fdc4(0x160)][_0x14fdc4(0x166)]+_0x14fdc4(0x165)+_0x5d2426[_0x14fdc4(0x1a0)][_0x14fdc4(0x195)]+'ms:\x0a\x0a'+_0x5d2426[_0x14fdc4(0x160)][_0x14fdc4(0x156)]((_0x56992f,_0x46eb81)=>_0x46eb81+0x1+'.\x20'+_0x56992f['filepath']+'\x20('+(_0x56992f['rerankScore']*0x64)['toFixed'](0x1)+_0x14fdc4(0x1d7)+('\x20\x20\x20Lines\x20'+_0x56992f[_0x14fdc4(0x182)]+'-'+_0x56992f[_0x14fdc4(0x1bf)]+'\x0a')+(_0x14fdc4(0x173)+_0x56992f[_0x14fdc4(0x19b)][_0x14fdc4(0x139)](0x0,0xc8)+(_0x56992f[_0x14fdc4(0x19b)]['length']>0xc8?_0x14fdc4(0x117):'')+'\x0a'))['join']('\x0a');return{'content':[{'type':_0x14fdc4(0x19c),'text':_0x290932}]};}catch(_0x47224){const _0xb9b3d8=_0x47224 instanceof Error?_0x47224[_0x14fdc4(0x15b)]:String(_0x47224);return reportMorphError({'error_message':_0xb9b3d8,'error_type':_0x47224 instanceof Error?_0x47224['constructor']['name']:_0x14fdc4(0x148),'context':{'tool':_0x14fdc4(0x1de),'query':_0x561ca4[_0x14fdc4(0x194)]['query'],'repo_id':_0x561ca4[_0x14fdc4(0x194)][_0x14fdc4(0x1a7)]},'stack_trace':_0x47224 instanceof Error?_0x47224[_0x14fdc4(0x141)]:undefined,'source':_0x14fdc4(0x14b)})[_0x14fdc4(0x119)](()=>{}),{'content':[{'type':_0x14fdc4(0x19c),'text':_0x14fdc4(0x1d8)+_0xb9b3d8}],'isError':!![]};}}default:throw new Error(_0x14fdc4(0x114)+_0x25e83a);}}catch(_0x2b0100){const _0x18adb5=_0x2b0100 instanceof Error?_0x2b0100[_0x14fdc4(0x15b)]:String(_0x2b0100);return reportMorphError({'error_message':_0x18adb5,'error_type':_0x2b0100 instanceof Error?_0x2b0100['constructor'][_0x14fdc4(0x16a)]:_0x14fdc4(0x148),'context':{'tool':name,'arguments':args?JSON[_0x14fdc4(0x176)](args)[_0x14fdc4(0x139)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x2b0100 instanceof Error?_0x2b0100['stack']:undefined,'source':_0x14fdc4(0x14b)})[_0x14fdc4(0x119)](()=>{}),{'content':[{'type':'text','text':_0x14fdc4(0x1d8)+_0x18adb5}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2c249b){const _0x49b1fa=a0_0x43f615,_0x25a279=await getValidRootDirectories(_0x2c249b);if(_0x25a279['length']>0x0)allowedDirectories=[..._0x25a279],console[_0x49b1fa(0x1a3)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x25a279[_0x49b1fa(0x166)]+_0x49b1fa(0x128));else{console[_0x49b1fa(0x1a3)](_0x49b1fa(0x1a8));if(ENABLE_WORKSPACE_MODE)try{const _0x85266d=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x85266d&&(allowedDirectories=[_0x85266d],console['error'](_0x49b1fa(0x15f)+_0x85266d));}catch(_0xdadd83){console[_0x49b1fa(0x1a3)](_0x49b1fa(0x197)+_0xdadd83);}}}server[a0_0x43f615(0x162)](RootsListChangedNotificationSchema,async()=>{const _0x333b3f=a0_0x43f615;try{const _0x5177f2=await server['listRoots']();_0x5177f2&&'roots'in _0x5177f2&&await updateAllowedDirectoriesFromRoots(_0x5177f2[_0x333b3f(0x10e)]);}catch(_0x56607a){console[_0x333b3f(0x1a3)]('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x56607a instanceof Error?_0x56607a['message']:String(_0x56607a));}}),server['oninitialized']=async()=>{const _0x31d6e1=a0_0x43f615,_0x2885dc=server[_0x31d6e1(0x135)]();if(_0x2885dc?.['roots'])try{const _0xb05103=await server[_0x31d6e1(0x112)]();_0xb05103&&_0x31d6e1(0x10e)in _0xb05103?await updateAllowedDirectoriesFromRoots(_0xb05103[_0x31d6e1(0x10e)]):console[_0x31d6e1(0x1a3)](_0x31d6e1(0x129));}catch(_0x461e68){console['error']('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x461e68 instanceof Error?_0x461e68[_0x31d6e1(0x15b)]:String(_0x461e68));}else{if(allowedDirectories[_0x31d6e1(0x166)]>0x0)console[_0x31d6e1(0x1a3)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x31d6e1(0x1a3)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};async function runServer(){const _0x171305=a0_0x43f615,_0x333b12=new StdioServerTransport();await server[_0x171305(0x11b)](_0x333b12),console[_0x171305(0x1a3)](_0x171305(0x1d3)),allowedDirectories[_0x171305(0x166)]===0x0&&console[_0x171305(0x1a3)](_0x171305(0x1bd));}runServer()[a0_0x43f615(0x119)](_0xb3c92f=>{const _0x4b199d=a0_0x43f615;console[_0x4b199d(0x1a3)](_0x4b199d(0x149),_0xb3c92f),process[_0x4b199d(0x130)](0x1);});
2
+ const a0_0x377217=a0_0x4a37;(function(_0x5a3560,_0x17e5f4){const _0x5c7cf4=a0_0x4a37,_0x479dff=_0x5a3560();while(!![]){try{const _0x762ec2=-parseInt(_0x5c7cf4(0x268))/0x1+parseInt(_0x5c7cf4(0x22d))/0x2*(parseInt(_0x5c7cf4(0x20c))/0x3)+parseInt(_0x5c7cf4(0x214))/0x4*(parseInt(_0x5c7cf4(0x1bb))/0x5)+-parseInt(_0x5c7cf4(0x28c))/0x6*(parseInt(_0x5c7cf4(0x1d7))/0x7)+-parseInt(_0x5c7cf4(0x22f))/0x8*(parseInt(_0x5c7cf4(0x245))/0x9)+-parseInt(_0x5c7cf4(0x290))/0xa*(parseInt(_0x5c7cf4(0x1c1))/0xb)+-parseInt(_0x5c7cf4(0x212))/0xc*(-parseInt(_0x5c7cf4(0x218))/0xd);if(_0x762ec2===_0x17e5f4)break;else _0x479dff['push'](_0x479dff['shift']());}catch(_0x1da4c5){_0x479dff['push'](_0x479dff['shift']());}}}(a0_0x47c8,0x4a751));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_0x501023 from'fs/promises';import a0_0x486aa6 from'path';import a0_0x325c81 from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x13eeb7 from'axios';function fixPathRepetition(_0x139c12){const _0x16dcec=a0_0x4a37,_0xa99d50=_0x139c12[_0x16dcec(0x1b8)](a0_0x486aa6[_0x16dcec(0x243)])[_0x16dcec(0x26c)](Boolean);if(_0xa99d50['length']<0x2)return null;for(let _0x1b64fe=Math['floor'](_0xa99d50['length']/0x2);_0x1b64fe>=0x1;_0x1b64fe--){for(let _0x1d9a68=0x0;_0x1d9a68<=_0xa99d50[_0x16dcec(0x23d)]-0x2*_0x1b64fe;_0x1d9a68++){const _0x40353d=_0xa99d50[_0x16dcec(0x1c4)](_0x1d9a68,_0x1d9a68+_0x1b64fe),_0x48bb1d=_0xa99d50[_0x16dcec(0x1c4)](_0x1d9a68+_0x1b64fe,_0x1d9a68+0x2*_0x1b64fe);if(_0x40353d['every']((_0x44de0e,_0x204409)=>_0x44de0e===_0x48bb1d[_0x204409])){const _0x1d9713=[..._0xa99d50[_0x16dcec(0x1c4)](0x0,_0x1d9a68),..._0xa99d50[_0x16dcec(0x1c4)](_0x1d9a68+_0x1b64fe)];return a0_0x486aa6['sep']+_0x1d9713[_0x16dcec(0x229)](a0_0x486aa6['sep']);}}}return null;}const args=process[a0_0x377217(0x225)]['slice'](0x2),ALL_TOOLS=[a0_0x377217(0x1c0),'warpgrep_codebase_search','codebase_search'],DEFAULT_TOOLS=[a0_0x377217(0x1c0),a0_0x377217(0x1bf)],ENABLED_TOOLS=process['env'][a0_0x377217(0x1dc)]?process[a0_0x377217(0x1e7)][a0_0x377217(0x1dc)]===a0_0x377217(0x1e8)?ALL_TOOLS:process['env'][a0_0x377217(0x1dc)][a0_0x377217(0x1b8)](',')['map'](_0x1113e6=>_0x1113e6[a0_0x377217(0x1cb)]()):DEFAULT_TOOLS;console['error']('Enabled\x20tools:\x20'+ENABLED_TOOLS[a0_0x377217(0x229)](',\x20'));const WORKSPACE_ROOT=process[a0_0x377217(0x1e7)][a0_0x377217(0x1d2)]||process['env'][a0_0x377217(0x23a)]||process[a0_0x377217(0x24f)](),ENABLE_WORKSPACE_MODE=process[a0_0x377217(0x1e7)][a0_0x377217(0x257)]!==a0_0x377217(0x21e),MORPH_API_KEY=process[a0_0x377217(0x1e7)][a0_0x377217(0x247)],MORPH_API_URL=process[a0_0x377217(0x1e7)][a0_0x377217(0x231)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x377217(0x1e7)][a0_0x377217(0x23c)]?parseInt(process[a0_0x377217(0x1e7)][a0_0x377217(0x23c)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x377217(0x1e4))&&!MORPH_API_KEY[a0_0x377217(0x1c5)](a0_0x377217(0x28a))&&console['error'](a0_0x377217(0x201));async function reportMorphError(_0x30bb1a){const _0x3b8e27=a0_0x377217;try{await a0_0x13eeb7[_0x3b8e27(0x211)](_0x3b8e27(0x22b),{..._0x30bb1a,'timestamp':new Date()[_0x3b8e27(0x270)](),'source':_0x30bb1a['source']||_0x3b8e27(0x22e)},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x377217(0x23d)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x377217(0x223)](a0_0x377217(0x1b5)),console[a0_0x377217(0x223)](a0_0x377217(0x281)),console[a0_0x377217(0x223)](a0_0x377217(0x1cf)),console[a0_0x377217(0x223)](a0_0x377217(0x232)),console[a0_0x377217(0x223)](a0_0x377217(0x266)),console[a0_0x377217(0x223)](a0_0x377217(0x261)));function normalizePath(_0x5cba59){const _0x12c2eb=a0_0x377217;return a0_0x486aa6[_0x12c2eb(0x22c)](_0x5cba59);}function a0_0x4a37(_0xe2e43,_0x4dc565){_0xe2e43=_0xe2e43-0x1af;const _0x47c88f=a0_0x47c8();let _0x4a37ec=_0x47c88f[_0xe2e43];return _0x4a37ec;}function expandHome(_0x183a24){const _0x415f44=a0_0x377217;if(_0x183a24[_0x415f44(0x1c5)]('~/')||_0x183a24==='~')return a0_0x486aa6['join'](a0_0x325c81[_0x415f44(0x217)](),_0x183a24[_0x415f44(0x1c4)](0x1));return _0x183a24;}let allowedDirectories=await Promise[a0_0x377217(0x1e8)](args[a0_0x377217(0x288)](async _0x2ab605=>{const _0x15546b=expandHome(_0x2ab605),_0x249f85=a0_0x486aa6['resolve'](_0x15546b);try{const _0x45ded9=await a0_0x501023['realpath'](_0x249f85);return normalizePath(_0x45ded9);}catch(_0x35a2e1){return normalizePath(_0x249f85);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x377217(0x23d)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x377217(0x26f)](workspaceDir),console['error']('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x39a6a4){console[a0_0x377217(0x223)]('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x39a6a4);}async function detectWorkspaceRoot(_0x331d92){const _0x281e9c=a0_0x377217;let _0x24340f=a0_0x486aa6['resolve'](_0x331d92);const _0x5913a9=[_0x281e9c(0x234),_0x281e9c(0x1f8),_0x281e9c(0x1d1),_0x281e9c(0x244),_0x281e9c(0x1ee),'go.mod','.cursor','tsconfig.json',_0x281e9c(0x1b3)];while(_0x24340f!==a0_0x486aa6[_0x281e9c(0x1d5)](_0x24340f)){for(const _0x309406 of _0x5913a9){const _0x5460d0=a0_0x486aa6['join'](_0x24340f,_0x309406);try{return await a0_0x501023[_0x281e9c(0x1b9)](_0x5460d0),normalizePath(_0x24340f);}catch{}}_0x24340f=a0_0x486aa6[_0x281e9c(0x1d5)](_0x24340f);}return normalizePath(_0x331d92);}await Promise[a0_0x377217(0x1e8)](args[a0_0x377217(0x288)](async _0x1f00fe=>{const _0x325b7d=a0_0x377217;try{const _0x7ae0e8=await a0_0x501023[_0x325b7d(0x203)](expandHome(_0x1f00fe));!_0x7ae0e8['isDirectory']()&&(console[_0x325b7d(0x223)]('Error:\x20'+_0x1f00fe+_0x325b7d(0x285)),process[_0x325b7d(0x1ce)](0x1));}catch(_0x2f46aa){console[_0x325b7d(0x223)]('Error\x20accessing\x20directory\x20'+_0x1f00fe+':',_0x2f46aa),process[_0x325b7d(0x1ce)](0x1);}}));async function validatePath(_0x2922a6){const _0x42e1b6=a0_0x377217,_0x519178=expandHome(_0x2922a6),_0x533a80=a0_0x486aa6[_0x42e1b6(0x296)](_0x519178);try{const _0x11dee3=await a0_0x501023[_0x42e1b6(0x213)](_0x533a80);return _0x11dee3;}catch(_0xe5973c){if(_0xe5973c[_0x42e1b6(0x1d4)]===_0x42e1b6(0x208)){const _0x543077=a0_0x486aa6[_0x42e1b6(0x1d5)](_0x533a80);try{const _0x1a9694=await a0_0x501023[_0x42e1b6(0x213)](_0x543077);return a0_0x486aa6[_0x42e1b6(0x229)](_0x1a9694,a0_0x486aa6[_0x42e1b6(0x210)](_0x533a80));}catch{throw new Error(_0x42e1b6(0x240)+_0x543077);}}throw _0xe5973c;}}const MorphEditFileArgsSchema=z[a0_0x377217(0x1af)]({'path':z[a0_0x377217(0x26e)](),'code_edit':z['string']()[a0_0x377217(0x267)](a0_0x377217(0x205)),'instruction':z[a0_0x377217(0x26e)]()[a0_0x377217(0x267)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0x377217(0x204)]()[a0_0x377217(0x282)](![])[a0_0x377217(0x267)](a0_0x377217(0x1f0))}),WarpGrepArgsSchema=z['object']({'search_string':z['string']()[a0_0x377217(0x267)](a0_0x377217(0x1ba)),'repo_path':z['string']()['describe']('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')}),CodebaseSearchArgsSchema=z[a0_0x377217(0x1af)]({'query':z['string']()[a0_0x377217(0x267)]('Natural\x20language\x20query\x20to\x20search\x20for\x20code'),'repoId':z[a0_0x377217(0x26e)]()[a0_0x377217(0x267)]('Repository\x20identifier'),'branch':z[a0_0x377217(0x26e)]()[a0_0x377217(0x1f7)]()['describe'](a0_0x377217(0x25e)),'commitHash':z[a0_0x377217(0x26e)]()[a0_0x377217(0x1f7)]()[a0_0x377217(0x267)]('Specific\x20commit\x20hash\x20to\x20search'),'target_directories':z['array'](z[a0_0x377217(0x26e)]())[a0_0x377217(0x282)]([])[a0_0x377217(0x267)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x377217(0x224)]()[a0_0x377217(0x1f7)]()[a0_0x377217(0x282)](0xa)[a0_0x377217(0x267)](a0_0x377217(0x200))}),server=new Server({'name':a0_0x377217(0x1b7),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x1b9166=a0_0x377217,_0x11cec5=[{'name':_0x1b9166(0x1c0),'description':_0x1b9166(0x1c8)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x1b9166(0x1ca)+_0x1b9166(0x216)+'Benefits:\x0a'+_0x1b9166(0x1c3)+_0x1b9166(0x1da)+_0x1b9166(0x1fb)+_0x1b9166(0x1c2)+_0x1b9166(0x292)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x1b9166(0x264)+_0x1b9166(0x23e)+_0x1b9166(0x259)+_0x1b9166(0x1c9)+_0x1b9166(0x233)+_0x1b9166(0x1d8)+_0x1b9166(0x1ed)+_0x1b9166(0x287)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+_0x1b9166(0x275)+_0x1b9166(0x24d),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x1b9166(0x1bf),'description':_0x1b9166(0x241)+_0x1b9166(0x1fd)+_0x1b9166(0x250)+_0x1b9166(0x221)+_0x1b9166(0x20a)+_0x1b9166(0x1fe)+_0x1b9166(0x25f)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x1b9166(0x28b),'description':_0x1b9166(0x20e)+_0x1b9166(0x26d)+_0x1b9166(0x269)+_0x1b9166(0x1fc)+_0x1b9166(0x273)+_0x1b9166(0x21f)+_0x1b9166(0x28d)+_0x1b9166(0x252)+_0x1b9166(0x299)+_0x1b9166(0x24b)+'Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x2cb4cf=_0x11cec5[_0x1b9166(0x26c)](_0x4f95c9=>{const _0x346ba7=_0x1b9166;if(!ENABLED_TOOLS['includes'](_0x4f95c9[_0x346ba7(0x237)]))return![];if('requiresApiKey'in _0x4f95c9&&_0x4f95c9[_0x346ba7(0x26b)]&&!MORPH_API_KEY)return console[_0x346ba7(0x223)]('Warning:\x20'+_0x4f95c9[_0x346ba7(0x237)]+_0x346ba7(0x227)),![];return!![];});return{'tools':_0x2cb4cf[_0x1b9166(0x288)](_0x3133c1=>({'name':_0x3133c1['name'],'description':_0x3133c1[_0x1b9166(0x25d)],'inputSchema':_0x3133c1['inputSchema']}))};}),server[a0_0x377217(0x23f)](CallToolRequestSchema,async _0x1bab4d=>{const _0x3de2c6=a0_0x377217;try{const {name:_0x45d5f8,arguments:_0x524985}=_0x1bab4d[_0x3de2c6(0x20d)];switch(_0x45d5f8){case _0x3de2c6(0x1c0):{const _0x32c165=MorphEditFileArgsSchema['safeParse'](_0x524985);if(!_0x32c165[_0x3de2c6(0x215)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x32c165[_0x3de2c6(0x223)]);const _0x136b75=await validatePath(_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x21a)]);let _0x3b3354=null,_0x34aff0=!![],_0x4c3c1e=null;try{_0x3b3354=await a0_0x501023[_0x3de2c6(0x248)](_0x136b75,_0x3de2c6(0x202));}catch(_0xf5a32a){const _0x48fd53=_0xf5a32a[_0x3de2c6(0x1d4)];_0x48fd53==='ENOENT'?(_0x34aff0=![],_0x3b3354=''):(_0x4c3c1e='Failed\x20to\x20read\x20file:\x20'+(_0x48fd53||_0x3de2c6(0x1df))+'\x20-\x20'+(_0xf5a32a instanceof Error?_0xf5a32a[_0x3de2c6(0x1e6)]:String(_0xf5a32a)),console['error']('Warning:\x20'+_0x4c3c1e));}try{const _0x352e29=MORPH_API_KEY;if(!_0x352e29)throw new Error(_0x3de2c6(0x1f9));const _0x1f9059=a0_0x486aa6[_0x3de2c6(0x1d5)](_0x136b75),_0x5205a6=a0_0x486aa6[_0x3de2c6(0x210)](_0x136b75),_0xfd50e9=await executeEditFile({'target_filepath':_0x5205a6,'code_edit':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x286)],'instructions':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x28e)]},{'morphApiKey':_0x352e29,'morphApiUrl':MORPH_API_URL,'baseDir':_0x1f9059,'autoWrite':!_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x228)],'generateUdiff':!![],'debug':![]});if(!_0xfd50e9[_0x3de2c6(0x215)])throw new Error(_0xfd50e9['error']||_0x3de2c6(0x298));const _0x4dfb6d=_0xfd50e9['udiff']||'';let _0x494617=0x3;while(_0x4dfb6d['includes']('`'[_0x3de2c6(0x1f6)](_0x494617))){_0x494617++;}const _0xc7112a='`'[_0x3de2c6(0x1f6)](_0x494617)+_0x3de2c6(0x254)+_0x4dfb6d+'`'['repeat'](_0x494617)+'\x0a\x0a';if(_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x228)])return{'content':[{'type':_0x3de2c6(0x1e5),'text':_0x3de2c6(0x1db)+(_0x34aff0?'':_0x3de2c6(0x24e))+':\x20'+_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x28e)]+'\x0a\x0a'+_0xc7112a+_0x3de2c6(0x284)+(_0x34aff0?_0x3de2c6(0x271):_0x3de2c6(0x25c))+'.'}]};return{'content':[{'type':_0x3de2c6(0x1e5),'text':'Morph\x20Edit\x20'+(_0x34aff0?_0x3de2c6(0x1bd):'Created\x20File')+':\x20'+_0x32c165['data']['instruction']+'\x0a\x0a'+_0xc7112a+_0x3de2c6(0x293)+(_0x34aff0?_0x3de2c6(0x263):_0x3de2c6(0x21c))+'\x20'+_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x21a)]}]};}catch(_0x52c561){const _0x28c6ec=_0x52c561 instanceof Error?_0x52c561[_0x3de2c6(0x1e6)]:String(_0x52c561);return reportMorphError({'error_message':_0x28c6ec,'error_type':_0x52c561 instanceof Error?_0x52c561[_0x3de2c6(0x289)][_0x3de2c6(0x237)]:'UnknownError','context':{'tool':_0x3de2c6(0x1c0),'file_path':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x21a)],'validated_path':_0x136b75,'instruction':_0x32c165['data'][_0x3de2c6(0x28e)],'model':_0x3de2c6(0x1ef),'dry_run':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x228)],'file_exists':_0x34aff0,'file_read_error':_0x4c3c1e,'file_readable':_0x3b3354!==null,'request_content':{'path':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x21a)],'code_edit':_0x32c165['data'][_0x3de2c6(0x286)],'instruction':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x28e)],'original_code':_0x3b3354!==null?_0x3b3354[_0x3de2c6(0x23d)]>0xc350?_0x3b3354[_0x3de2c6(0x1eb)](0x0,0xc350)+_0x3de2c6(0x21d)+_0x3b3354['length']+'\x20chars)':_0x3b3354:_0x3de2c6(0x1e3)+(_0x4c3c1e||_0x3de2c6(0x1f3))+']','original_code_length':_0x3b3354?.['length']??0x0,'model':_0x3de2c6(0x1ef),'dry_run':_0x32c165[_0x3de2c6(0x262)][_0x3de2c6(0x228)]}},'stack_trace':_0x52c561 instanceof Error?_0x52c561[_0x3de2c6(0x27a)]:undefined,'source':_0x3de2c6(0x22e)})[_0x3de2c6(0x1b0)](()=>{}),{'content':[{'type':'text','text':_0x3de2c6(0x1f4)+_0x28c6ec}],'isError':!![]};}}case _0x3de2c6(0x1bf):{const _0x5a0fff=WarpGrepArgsSchema[_0x3de2c6(0x27d)](_0x524985);if(!_0x5a0fff[_0x3de2c6(0x215)])return{'content':[{'type':'text','text':_0x3de2c6(0x1ea)+_0x5a0fff[_0x3de2c6(0x223)]}],'isError':!![]};const _0x4deaf1=_0x1841e4=>{const _0x1af4ef=_0x3de2c6,_0x58635e=[];for(const _0x4b07b6 of _0x1841e4||[]){const _0xc1dcf=_0x4b07b6['role'],_0x54d128=_0x4b07b6[_0x1af4ef(0x1bc)];if(_0xc1dcf===_0x1af4ef(0x1de)&&_0x54d128){const _0x30d956=_0x54d128[_0x1af4ef(0x1b8)]('\x0a')[_0x1af4ef(0x26c)](_0x30de41=>_0x30de41[_0x1af4ef(0x1cb)]());for(const _0x23578e of _0x30d956){const _0x1b60b7=_0x23578e[_0x1af4ef(0x1cc)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1b60b7){_0x58635e[_0x1af4ef(0x26f)](_0x1af4ef(0x294)+_0x1b60b7[0x1]+'\x27\x20'+_0x1b60b7[0x2]);continue;}const _0x11b405=_0x23578e[_0x1af4ef(0x1cc)](/^read\s+(.+)$/);if(_0x11b405){_0x58635e[_0x1af4ef(0x26f)]('read\x20'+_0x11b405[0x1]);continue;}const _0xd88a8c=_0x23578e[_0x1af4ef(0x1cc)](/^list_directory\s+(.+)$/);if(_0xd88a8c){_0x58635e[_0x1af4ef(0x26f)](_0x1af4ef(0x256)+_0xd88a8c[0x1]);continue;}}}}return _0x58635e;};try{const _0x209267=a0_0x486aa6[_0x3de2c6(0x296)](_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)]),_0x51adcf=new LocalRipgrepProvider(_0x209267),_0x1d6235=await runWarpGrep({'query':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x222)],'repoRoot':_0x209267,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x51adcf});let _0xcd6b71='';if(_0x1d6235[_0x3de2c6(0x1e9)]===_0x3de2c6(0x297)&&_0x1d6235['finish']?.[_0x3de2c6(0x23b)]?.[_0x3de2c6(0x236)]){const _0x1ed568=_0x1d6235[_0x3de2c6(0x20f)][_0x3de2c6(0x23b)][_0x3de2c6(0x236)],_0x2bab0d=[],_0x5cfd66=[_0x3de2c6(0x230)];for(const _0x340ac2 of _0x1d6235[_0x3de2c6(0x278)]){const _0x467d42=_0x340ac2[_0x3de2c6(0x1f1)],_0x51c2fc=_0x340ac2[_0x3de2c6(0x1bc)];if(_0x467d42===_0x3de2c6(0x1de)&&_0x51c2fc){const _0x4c63fb=_0x51c2fc['split']('\x0a')[_0x3de2c6(0x26c)](_0x46a8fe=>_0x46a8fe[_0x3de2c6(0x1cb)]());for(const _0x15f3fd of _0x4c63fb){const _0x340ea0=_0x15f3fd[_0x3de2c6(0x1cc)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x340ea0){_0x5cfd66[_0x3de2c6(0x26f)](_0x3de2c6(0x255)+_0x340ea0[0x1]+_0x3de2c6(0x220)+_0x340ea0[0x2]+'`');continue;}const _0x519df2=_0x15f3fd[_0x3de2c6(0x1cc)](/^read\s+(.+)$/);if(_0x519df2){_0x5cfd66[_0x3de2c6(0x26f)](_0x3de2c6(0x279)+_0x519df2[0x1]+'`');continue;}const _0x3dc8c0=_0x15f3fd[_0x3de2c6(0x1cc)](/^list_directory\s+(.+)$/);if(_0x3dc8c0){_0x5cfd66[_0x3de2c6(0x26f)](_0x3de2c6(0x280)+_0x3dc8c0[0x1]+'`');continue;}}}}_0x2bab0d[_0x3de2c6(0x26f)](_0x5cfd66[_0x3de2c6(0x229)]('\x0a'));const _0x249cf8=['',_0x3de2c6(0x1cd)];for(const _0x4cfc55 of _0x1ed568){if(_0x4cfc55['lines']==='*')_0x249cf8[_0x3de2c6(0x26f)]('-\x20'+_0x4cfc55[_0x3de2c6(0x21a)]+':*');else{if(Array[_0x3de2c6(0x27e)](_0x4cfc55[_0x3de2c6(0x1e1)])){const _0x3715a6=_0x4cfc55[_0x3de2c6(0x1e1)][_0x3de2c6(0x288)](([_0x43891c,_0xbe1ce0])=>{if(_0x43891c===_0xbe1ce0)return''+_0x43891c;return _0x43891c+'-'+_0xbe1ce0;});_0x249cf8[_0x3de2c6(0x26f)]('-\x20'+_0x4cfc55['path']+':'+_0x3715a6[_0x3de2c6(0x229)](','));}else _0x249cf8[_0x3de2c6(0x26f)]('-\x20'+_0x4cfc55[_0x3de2c6(0x21a)]+':*');}}_0x249cf8[_0x3de2c6(0x26f)](''),_0x2bab0d[_0x3de2c6(0x26f)](_0x249cf8['join']('\x0a')),_0x2bab0d['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x14a47f=[];for(const _0x486389 of _0x1ed568){let _0x1c3648=a0_0x486aa6[_0x3de2c6(0x296)](_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)],_0x486389[_0x3de2c6(0x21a)]),_0x4ffcb9=null,_0x402bca=null;try{_0x4ffcb9=await a0_0x501023[_0x3de2c6(0x248)](_0x1c3648,{'encoding':_0x3de2c6(0x202)});}catch(_0x1c6a2c){const _0x25e620=fixPathRepetition(_0x1c3648);if(_0x25e620)try{_0x4ffcb9=await a0_0x501023['readFile'](_0x25e620,{'encoding':_0x3de2c6(0x202)}),_0x1c3648=_0x25e620;}catch{_0x402bca=_0x1c6a2c instanceof Error?_0x1c6a2c:new Error(String(_0x1c6a2c));}else _0x402bca=_0x1c6a2c instanceof Error?_0x1c6a2c:new Error(String(_0x1c6a2c));}if(_0x4ffcb9!==null){const _0x4e0088=_0x4ffcb9[_0x3de2c6(0x1b8)](/\r?\n/),_0x523ad8=[_0x3de2c6(0x239)+_0x486389[_0x3de2c6(0x21a)]+'\x22>'];if(_0x486389[_0x3de2c6(0x1e1)]==='*'||!Array[_0x3de2c6(0x27e)](_0x486389[_0x3de2c6(0x1e1)]))for(let _0x5598ea=0x1;_0x5598ea<=_0x4e0088['length'];_0x5598ea++){const _0x4c25de=_0x4e0088[_0x5598ea-0x1];_0x523ad8['push'](_0x5598ea+'|\x20'+_0x4c25de);}else for(const [_0xd1388b,_0x5eef1f]of _0x486389[_0x3de2c6(0x1e1)]){_0x523ad8[_0x3de2c6(0x23d)]>0x1&&_0x523ad8[_0x3de2c6(0x26f)]('');for(let _0x3098e1=_0xd1388b;_0x3098e1<=_0x5eef1f&&_0x3098e1<=_0x4e0088[_0x3de2c6(0x23d)];_0x3098e1++){const _0x131a25=_0x4e0088[_0x3098e1-0x1];_0x523ad8[_0x3de2c6(0x26f)](_0x3098e1+'|\x20'+_0x131a25);}}_0x523ad8[_0x3de2c6(0x26f)](_0x3de2c6(0x206)),_0x14a47f[_0x3de2c6(0x26f)](_0x523ad8[_0x3de2c6(0x229)]('\x0a'));}else _0x14a47f[_0x3de2c6(0x26f)](_0x3de2c6(0x239)+_0x486389['path']+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x402bca?.['message']||_0x3de2c6(0x1b2))+_0x3de2c6(0x1dd));}_0x2bab0d[_0x3de2c6(0x26f)](_0x14a47f[_0x3de2c6(0x229)]('\x0a\x0a')),_0xcd6b71=_0x2bab0d[_0x3de2c6(0x229)]('\x0a');const _0x3f3523=_0x1d6235[_0x3de2c6(0x21b)]?.['filter'](_0x3eb66f=>_0x3eb66f[_0x3de2c6(0x1e6)]?.['startsWith'](_0x3de2c6(0x253)))||[];if(_0x3f3523[_0x3de2c6(0x23d)]>0x0){const _0x39a1b6=_0x3f3523[_0x3de2c6(0x288)](_0xad96db=>_0xad96db[_0x3de2c6(0x1e6)])[_0x3de2c6(0x229)](';\x20');reportMorphError({'error_message':_0x39a1b6,'error_type':_0x3de2c6(0x235),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x5a0fff['data'][_0x3de2c6(0x1d6)],'query':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x222)],'model':_0x3de2c6(0x1b1),'termination_reason':_0x3de2c6(0x274),'error_count':_0x3f3523[_0x3de2c6(0x23d)],'is_timeout':![],'timings':_0x1d6235[_0x3de2c6(0x1e0)],'files_attempted':_0x1ed568[_0x3de2c6(0x288)](_0x293fd1=>({'path':_0x293fd1[_0x3de2c6(0x21a)],'lines':_0x293fd1['lines']})),'tool_calls':_0x4deaf1(_0x1d6235[_0x3de2c6(0x278)]),'messages':_0x1d6235[_0x3de2c6(0x278)]?.['map'](_0x3f1b96=>({'role':_0x3f1b96[_0x3de2c6(0x1f1)],'content':_0x3f1b96[_0x3de2c6(0x1bc)]})),'request_content':{'query':_0x5a0fff['data'][_0x3de2c6(0x222)],'repo_path':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)],'repoRoot':a0_0x486aa6[_0x3de2c6(0x296)](_0x5a0fff['data'][_0x3de2c6(0x1d6)]),'model':_0x3de2c6(0x1b1)}},'source':_0x3de2c6(0x22e)})[_0x3de2c6(0x1b0)](()=>{});}}else{if(_0x1d6235[_0x3de2c6(0x1e9)]===_0x3de2c6(0x260)&&_0x1d6235[_0x3de2c6(0x21b)][_0x3de2c6(0x23d)]>0x0){const _0x5d3bef=_0x1d6235[_0x3de2c6(0x21b)][_0x3de2c6(0x288)](_0x522a23=>_0x522a23[_0x3de2c6(0x1e6)])[_0x3de2c6(0x229)](';\x20');_0xcd6b71=_0x3de2c6(0x1b4)+_0x5d3bef;const _0x287e3a=_0x5d3bef[_0x3de2c6(0x1d3)]()['includes'](_0x3de2c6(0x258))||_0x5d3bef[_0x3de2c6(0x1d3)]()[_0x3de2c6(0x295)]('timed\x20out')||_0x5d3bef[_0x3de2c6(0x1d3)]()[_0x3de2c6(0x295)](_0x3de2c6(0x1b6)),_0x5a6a1c=_0x1d6235[_0x3de2c6(0x20f)]?.['metadata']?.['files'],_0x30b34d=_0x1d6235[_0x3de2c6(0x21b)][0x0];reportMorphError({'error_message':_0x5d3bef,'error_type':_0x287e3a?_0x3de2c6(0x25b):_0x30b34d?.[_0x3de2c6(0x289)]?.[_0x3de2c6(0x237)]||_0x3de2c6(0x24c),'context':{'tool':_0x3de2c6(0x1bf),'repo_path':_0x5a0fff[_0x3de2c6(0x262)]['repo_path'],'query':_0x5a0fff[_0x3de2c6(0x262)]['search_string'],'model':_0x3de2c6(0x1b1),'termination_reason':_0x1d6235[_0x3de2c6(0x1e9)],'error_count':_0x1d6235[_0x3de2c6(0x21b)]['length'],'is_timeout':_0x287e3a,'timings':_0x1d6235[_0x3de2c6(0x1e0)],'files_attempted':_0x5a6a1c?.['map'](_0x1ac348=>({'path':_0x1ac348[_0x3de2c6(0x21a)],'lines':_0x1ac348[_0x3de2c6(0x1e1)]})),'tool_calls':_0x4deaf1(_0x1d6235[_0x3de2c6(0x278)]),'messages':_0x1d6235['messages']?.['map'](_0x44d3b9=>({'role':_0x44d3b9[_0x3de2c6(0x1f1)],'content':_0x44d3b9[_0x3de2c6(0x1bc)]})),'request_content':{'query':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x222)],'repo_path':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)],'repoRoot':a0_0x486aa6['resolve'](_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)]),'model':_0x3de2c6(0x1b1)}},'stack_trace':_0x30b34d?.[_0x3de2c6(0x27a)]||undefined,'source':'mcp-filesystem'})[_0x3de2c6(0x1b0)](()=>{});}else _0xcd6b71='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0xcd6b71}]};}catch(_0x1a51d6){const _0x2e8d93=_0x1a51d6 instanceof Error?_0x1a51d6[_0x3de2c6(0x1e6)]:String(_0x1a51d6),_0x4f6c2a=_0x2e8d93[_0x3de2c6(0x1d3)]()['includes'](_0x3de2c6(0x258))||_0x2e8d93[_0x3de2c6(0x1d3)]()['includes'](_0x3de2c6(0x28f))||_0x2e8d93[_0x3de2c6(0x1d3)]()['includes'](_0x3de2c6(0x1b6))||_0x1a51d6 instanceof Error&&_0x1a51d6[_0x3de2c6(0x237)]==='TimeoutError';return reportMorphError({'error_message':_0x2e8d93,'error_type':_0x4f6c2a?_0x3de2c6(0x25b):_0x1a51d6 instanceof Error?_0x1a51d6[_0x3de2c6(0x289)][_0x3de2c6(0x237)]:_0x3de2c6(0x1f5),'context':{'tool':_0x3de2c6(0x1bf),'repo_path':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)],'query':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x222)],'model':_0x3de2c6(0x1b1),'is_timeout':_0x4f6c2a,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x5a0fff['data'][_0x3de2c6(0x222)],'repo_path':_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)],'repoRoot':a0_0x486aa6[_0x3de2c6(0x296)](_0x5a0fff[_0x3de2c6(0x262)][_0x3de2c6(0x1d6)]),'model':_0x3de2c6(0x1b1)}},'stack_trace':_0x1a51d6 instanceof Error?_0x1a51d6['stack']:undefined,'source':'mcp-filesystem'})[_0x3de2c6(0x1b0)](()=>{}),{'content':[{'type':_0x3de2c6(0x1e5),'text':_0x3de2c6(0x1c7)+_0x2e8d93}],'isError':![]};}}case _0x3de2c6(0x28b):{const _0xe71eb2=CodebaseSearchArgsSchema['safeParse'](_0x524985);if(!_0xe71eb2[_0x3de2c6(0x215)])return{'content':[{'type':_0x3de2c6(0x1e5),'text':_0x3de2c6(0x1ea)+_0xe71eb2['error']}],'isError':!![]};try{const _0x3b369b=MORPH_API_KEY;if(!_0x3b369b)throw new Error(_0x3de2c6(0x1ff));const _0x54fe7a=await executeCodebaseSearch({'query':_0xe71eb2[_0x3de2c6(0x262)]['query'],'target_directories':_0xe71eb2[_0x3de2c6(0x262)][_0x3de2c6(0x1e2)],'limit':_0xe71eb2[_0x3de2c6(0x262)]['limit']},{'apiKey':_0x3b369b,'repoId':_0xe71eb2[_0x3de2c6(0x262)][_0x3de2c6(0x27f)],'branch':_0xe71eb2['data'][_0x3de2c6(0x25a)],'commitHash':_0xe71eb2[_0x3de2c6(0x262)]['commitHash'],'debug':![]});if(!_0x54fe7a['success'])return{'content':[{'type':_0x3de2c6(0x1e5),'text':_0x3de2c6(0x1d0)+_0x54fe7a['error']}],'isError':!![]};const _0x54a3c3=_0x54fe7a['results'][_0x3de2c6(0x23d)]===0x0?_0x3de2c6(0x26a)+_0xe71eb2[_0x3de2c6(0x262)][_0x3de2c6(0x277)]+'\x22':_0x3de2c6(0x1fa)+_0x54fe7a[_0x3de2c6(0x207)][_0x3de2c6(0x23d)]+_0x3de2c6(0x238)+_0x54fe7a[_0x3de2c6(0x209)]['searchTimeMs']+'ms:\x0a\x0a'+_0x54fe7a[_0x3de2c6(0x207)][_0x3de2c6(0x288)]((_0x3fdb63,_0x49b830)=>_0x49b830+0x1+'.\x20'+_0x3fdb63[_0x3de2c6(0x20b)]+'\x20('+(_0x3fdb63['rerankScore']*0x64)['toFixed'](0x1)+_0x3de2c6(0x24a)+('\x20\x20\x20Lines\x20'+_0x3fdb63[_0x3de2c6(0x249)]+'-'+_0x3fdb63[_0x3de2c6(0x272)]+'\x0a')+('\x20\x20\x20'+_0x3fdb63[_0x3de2c6(0x1bc)]['substring'](0x0,0xc8)+(_0x3fdb63['content'][_0x3de2c6(0x23d)]>0xc8?_0x3de2c6(0x291):'')+'\x0a'))['join']('\x0a');return{'content':[{'type':'text','text':_0x54a3c3}]};}catch(_0x49fd7b){const _0x47ded9=_0x49fd7b instanceof Error?_0x49fd7b[_0x3de2c6(0x1e6)]:String(_0x49fd7b);return reportMorphError({'error_message':_0x47ded9,'error_type':_0x49fd7b instanceof Error?_0x49fd7b[_0x3de2c6(0x289)][_0x3de2c6(0x237)]:_0x3de2c6(0x1f5),'context':{'tool':'codebase_search','query':_0xe71eb2[_0x3de2c6(0x262)]['query'],'repo_id':_0xe71eb2['data'][_0x3de2c6(0x27f)]},'stack_trace':_0x49fd7b instanceof Error?_0x49fd7b[_0x3de2c6(0x27a)]:undefined,'source':_0x3de2c6(0x22e)})[_0x3de2c6(0x1b0)](()=>{}),{'content':[{'type':_0x3de2c6(0x1e5),'text':'Error:\x20'+_0x47ded9}],'isError':!![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x45d5f8);}}catch(_0x572934){const _0xa247c1=_0x572934 instanceof Error?_0x572934[_0x3de2c6(0x1e6)]:String(_0x572934);return reportMorphError({'error_message':_0xa247c1,'error_type':_0x572934 instanceof Error?_0x572934['constructor']['name']:_0x3de2c6(0x1f5),'context':{'tool':name,'arguments':args?JSON[_0x3de2c6(0x226)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x3de2c6(0x246)},'stack_trace':_0x572934 instanceof Error?_0x572934[_0x3de2c6(0x27a)]:undefined,'source':_0x3de2c6(0x22e)})[_0x3de2c6(0x1b0)](()=>{}),{'content':[{'type':_0x3de2c6(0x1e5),'text':_0x3de2c6(0x1b4)+_0xa247c1}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x17016f){const _0x2fb649=a0_0x377217,_0x495698=await getValidRootDirectories(_0x17016f);if(_0x495698['length']>0x0)allowedDirectories=[..._0x495698],console[_0x2fb649(0x223)](_0x2fb649(0x276)+_0x495698[_0x2fb649(0x23d)]+_0x2fb649(0x219));else{console[_0x2fb649(0x223)](_0x2fb649(0x251));if(ENABLE_WORKSPACE_MODE)try{const _0x17cd98=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x17cd98&&(allowedDirectories=[_0x17cd98],console[_0x2fb649(0x223)](_0x2fb649(0x283)+_0x17cd98));}catch(_0x475b61){console[_0x2fb649(0x223)](_0x2fb649(0x1ec)+_0x475b61);}}}server[a0_0x377217(0x1be)](RootsListChangedNotificationSchema,async()=>{const _0x4849f9=a0_0x377217;try{const _0x216b04=await server['listRoots']();_0x216b04&&'roots'in _0x216b04&&await updateAllowedDirectoriesFromRoots(_0x216b04['roots']);}catch(_0x24d8fb){console[_0x4849f9(0x223)](_0x4849f9(0x22a),_0x24d8fb instanceof Error?_0x24d8fb['message']:String(_0x24d8fb));}}),server['oninitialized']=async()=>{const _0x2f7ba9=a0_0x377217,_0x612a3=server[_0x2f7ba9(0x1c6)]();if(_0x612a3?.['roots'])try{const _0x5ef3bb=await server['listRoots']();_0x5ef3bb&&_0x2f7ba9(0x1d9)in _0x5ef3bb?await updateAllowedDirectoriesFromRoots(_0x5ef3bb[_0x2f7ba9(0x1d9)]):console['error'](_0x2f7ba9(0x1f2));}catch(_0x48f6fb){console[_0x2f7ba9(0x223)]('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x48f6fb instanceof Error?_0x48f6fb[_0x2f7ba9(0x1e6)]:String(_0x48f6fb));}else{if(allowedDirectories['length']>0x0)console['error'](_0x2f7ba9(0x265),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x2f7ba9(0x223)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x2f7ba9(0x242));}}};async function runServer(){const _0x3d8ced=a0_0x377217,_0x479895=new StdioServerTransport();await server[_0x3d8ced(0x27c)](_0x479895),console[_0x3d8ced(0x223)](_0x3d8ced(0x27b)),allowedDirectories['length']===0x0&&console[_0x3d8ced(0x223)]('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}function a0_0x47c8(){const _0x5cf3d2=['117GRtUOQ','params','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','finish','basename','post','120MeVrYB','realpath','8usGTDI','success','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','homedir','275145ashthd','\x20valid\x20directories','path','errors','created','\x0a...\x20(truncated,\x20total:\x20','false','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','\x27\x20in\x20`','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','search_string','error','number','argv','stringify','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','dryRun','join','Failed\x20to\x20request\x20roots\x20from\x20client:','https://morphllm.com/api/error-report','normalize','23338ofHOWX','mcp-filesystem','152GDqykM','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','MORPH_API_URL','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','.git','FileReadError','files','name','\x20results\x20in\x20','<file\x20path=\x22','PWD','metadata','MORPH_WARP_GREP_TIMEOUT','length','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','setRequestHandler','Parent\x20directory\x20does\x20not\x20exist:\x20','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','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.','sep','Cargo.toml','137871mVmXkm','0.2.0','MORPH_API_KEY','readFile','startLine','%\x20match)\x0a','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','WarpGrepError','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','\x20(new\x20file)','cwd','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','File\x20read\x20error:','diff\x0a','-\x20Grepped\x20\x27','list_directory\x20','ENABLE_WORKSPACE_MODE','timeout','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','branch','TimeoutError','create\x20this\x20file','description','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','terminated','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','data','applied\x20edits\x20to','For\x20deletions:\x0a','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','describe','88596MCClem','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','No\x20results\x20found\x20for\x20query:\x20\x22','requiresApiKey','filter','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','string','push','toISOString','apply\x20these\x20changes','endLine','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','completed_with_file_errors','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','query','messages','-\x20Read\x20file\x20`','stack','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','connect','safeParse','isArray','repoId','-\x20Listed\x20directory\x20`','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','default','Fallback:\x20Using\x20workspace\x20root\x20','Use\x20dryRun=false\x20to\x20','\x20is\x20not\x20a\x20directory','code_edit','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','map','constructor','morph-','codebase_search','84kTXXAq','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','instruction','timed\x20out','390xxtbxa','...','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Successfully\x20','grep\x20\x27','includes','resolve','completed','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','object','catch','morph-warp-grep-v1-1111v0','Unknown\x20error','composer.json','Error:\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','etimedout','morph-mcp','split','access','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','1161245ylOvMz','content','Applied','setNotificationHandler','warpgrep_codebase_search','edit_file','6963iJWxGG','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','slice','startsWith','getClientCapabilities','Error\x20running\x20fast\x20context\x20search:\x20','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Rules:\x0a','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','trim','match','Relevant\x20context\x20found:','exit','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Search\x20failed:\x20','package.json','WORKSPACE_ROOT','toLowerCase','code','dirname','repo_path','210959FDtPjE','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','roots','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','🔍\x20Morph\x20Edit\x20Preview','ENABLED_TOOLS','\x0a</file>','assistant','unknown','timings','lines','target_directories','[could\x20not\x20read\x20file:\x20','sk-','text','message','env','all','terminationReason','Invalid\x20arguments:\x20','substring','Warning:\x20Workspace\x20fallback\x20failed:\x20','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','pyproject.toml','morph-v3-fast','Preview\x20changes\x20without\x20applying\x20them.','role','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','unknown\x20error','❌\x20Morph\x20Edit\x20Failed:\x20','UnknownError','repeat','optional','.vscode','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Found\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Benefits:\x0a','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','Max\x20results\x20to\x20return','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','utf-8','stat','boolean','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','</file>','results','ENOENT','stats','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','filepath'];a0_0x47c8=function(){return _0x5cf3d2;};return a0_0x47c8();}runServer()[a0_0x377217(0x1b0)](_0x323bc4=>{const _0x47b15e=a0_0x377217;console[_0x47b15e(0x223)]('Fatal\x20error\x20running\x20server:',_0x323bc4),process[_0x47b15e(0x1ce)](0x1);});
@@ -1 +1 @@
1
- (function(_0x3859bc,_0x2ba935){const _0x5b3928=a1_0x30be,_0x30a997=_0x3859bc();while(!![]){try{const _0x195551=-parseInt(_0x5b3928(0xaa))/0x1+-parseInt(_0x5b3928(0x9c))/0x2*(parseInt(_0x5b3928(0xa4))/0x3)+-parseInt(_0x5b3928(0xa3))/0x4*(parseInt(_0x5b3928(0x9b))/0x5)+parseInt(_0x5b3928(0x99))/0x6+parseInt(_0x5b3928(0xa8))/0x7+parseInt(_0x5b3928(0x98))/0x8+-parseInt(_0x5b3928(0x9e))/0x9*(-parseInt(_0x5b3928(0xa2))/0xa);if(_0x195551===_0x2ba935)break;else _0x30a997['push'](_0x30a997['shift']());}catch(_0x268e8d){_0x30a997['push'](_0x30a997['shift']());}}}(a1_0xf050,0xf03f2));function a1_0x30be(_0x582733,_0x21104e){_0x582733=_0x582733-0x98;const _0xf0508e=a1_0xf050();let _0x30be58=_0xf0508e[_0x582733];return _0x30be58;}import a1_0x590d3c from'path';import a1_0x5968ad from'os';export function convertToWindowsPath(_0x4986ab){const _0x1155c1=a1_0x30be;if(_0x4986ab[_0x1155c1(0xa6)](_0x1155c1(0x9d))){const _0xee3b0f=_0x4986ab[_0x1155c1(0x9a)](0x5)['toUpperCase'](),_0x212af3=_0x4986ab[_0x1155c1(0xa1)](0x6)[_0x1155c1(0xac)](/\//g,'\x5c');return _0xee3b0f+':'+_0x212af3;}if(_0x4986ab[_0x1155c1(0xad)](/^\/[a-zA-Z]\//)){const _0x5e3caf=_0x4986ab[_0x1155c1(0x9a)](0x1)[_0x1155c1(0x9f)](),_0x27f779=_0x4986ab[_0x1155c1(0xa1)](0x2)[_0x1155c1(0xac)](/\//g,'\x5c');return _0x5e3caf+':'+_0x27f779;}if(_0x4986ab[_0x1155c1(0xad)](/^[a-zA-Z]:/))return _0x4986ab[_0x1155c1(0xac)](/\//g,'\x5c');return _0x4986ab;}function a1_0xf050(){const _0x3d1f87=['charAt','40005bYkzqw','1848294hJmPDG','/mnt/','9Niusxc','toUpperCase','test','slice','19076630YqiixB','280AoeDsu','6KbZRvt','join','startsWith','substring','4990321YzXhZG','normalize','418553zeGNms','trim','replace','match','homedir','3572528vmMjZg','4463010uYugpN'];a1_0xf050=function(){return _0x3d1f87;};return a1_0xf050();}export function normalizePath(_0x2ac6d0){const _0x1d2f09=a1_0x30be;_0x2ac6d0=_0x2ac6d0[_0x1d2f09(0xab)]()['replace'](/^["']|["']$/g,'');const _0x265505=_0x2ac6d0[_0x1d2f09(0xa6)]('/')&&!_0x2ac6d0[_0x1d2f09(0xad)](/^\/mnt\/[a-z]\//i)&&!_0x2ac6d0['match'](/^\/[a-zA-Z]\//);if(_0x265505)return _0x2ac6d0[_0x1d2f09(0xac)](/\/+/g,'/')[_0x1d2f09(0xac)](/\/+$/,'');_0x2ac6d0=convertToWindowsPath(_0x2ac6d0);if(_0x2ac6d0[_0x1d2f09(0xa6)]('\x5c\x5c')){let _0x5b297c=_0x2ac6d0;_0x5b297c=_0x5b297c['replace'](/^\\{2,}/,'\x5c\x5c');const _0x2d6bab=_0x5b297c[_0x1d2f09(0xa7)](0x2)['replace'](/\\\\/g,'\x5c');_0x2ac6d0='\x5c\x5c'+_0x2d6bab;}else _0x2ac6d0=_0x2ac6d0['replace'](/\\\\/g,'\x5c');let _0x4f0852=a1_0x590d3c[_0x1d2f09(0xa9)](_0x2ac6d0);_0x2ac6d0[_0x1d2f09(0xa6)]('\x5c\x5c')&&!_0x4f0852[_0x1d2f09(0xa6)]('\x5c\x5c')&&(_0x4f0852='\x5c'+_0x4f0852);if(_0x4f0852[_0x1d2f09(0xad)](/^[a-zA-Z]:/)){let _0x570462=_0x4f0852['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x1d2f09(0xa0)](_0x570462)&&(_0x570462=_0x570462[_0x1d2f09(0x9a)](0x0)['toUpperCase']()+_0x570462['slice'](0x1)),_0x570462;}return _0x4f0852[_0x1d2f09(0xac)](/\//g,'\x5c');}export function expandHome(_0x26483a){const _0x1bd507=a1_0x30be;if(_0x26483a['startsWith']('~/')||_0x26483a==='~')return a1_0x590d3c[_0x1bd507(0xa5)](a1_0x5968ad[_0x1bd507(0xae)](),_0x26483a[_0x1bd507(0xa1)](0x1));return _0x26483a;}
1
+ (function(_0x2e64bd,_0x4d238d){const _0x1bc7c8=a1_0x2e03,_0x4d0a1f=_0x2e64bd();while(!![]){try{const _0x328777=-parseInt(_0x1bc7c8(0x84))/0x1+parseInt(_0x1bc7c8(0x83))/0x2+-parseInt(_0x1bc7c8(0x80))/0x3*(-parseInt(_0x1bc7c8(0x7c))/0x4)+parseInt(_0x1bc7c8(0x7a))/0x5*(-parseInt(_0x1bc7c8(0x77))/0x6)+-parseInt(_0x1bc7c8(0x81))/0x7+parseInt(_0x1bc7c8(0x75))/0x8*(parseInt(_0x1bc7c8(0x6f))/0x9)+parseInt(_0x1bc7c8(0x70))/0xa;if(_0x328777===_0x4d238d)break;else _0x4d0a1f['push'](_0x4d0a1f['shift']());}catch(_0x5abb9d){_0x4d0a1f['push'](_0x4d0a1f['shift']());}}}(a1_0xa1d0,0xc0a94));function a1_0xa1d0(){const _0x5e911e=['charAt','toUpperCase','10107wPDmvW','8518181Ztigrf','replace','1289224daFRFg','776444uOKAki','/mnt/','8188956lzNBJj','16702720lwUoXv','slice','normalize','trim','homedir','8ryQhqZ','join','70986OkEdyG','startsWith','test','335XnYkrB','substring','416XAxILz','match'];a1_0xa1d0=function(){return _0x5e911e;};return a1_0xa1d0();}import a1_0x4ac56e from'path';import a1_0x1c5a7f from'os';export function convertToWindowsPath(_0x5cdfa2){const _0x4f670c=a1_0x2e03;if(_0x5cdfa2[_0x4f670c(0x78)](_0x4f670c(0x85))){const _0x24f026=_0x5cdfa2[_0x4f670c(0x7e)](0x5)[_0x4f670c(0x7f)](),_0x2ec79f=_0x5cdfa2['slice'](0x6)[_0x4f670c(0x82)](/\//g,'\x5c');return _0x24f026+':'+_0x2ec79f;}if(_0x5cdfa2[_0x4f670c(0x7d)](/^\/[a-zA-Z]\//)){const _0x216098=_0x5cdfa2[_0x4f670c(0x7e)](0x1)[_0x4f670c(0x7f)](),_0xef5196=_0x5cdfa2[_0x4f670c(0x71)](0x2)[_0x4f670c(0x82)](/\//g,'\x5c');return _0x216098+':'+_0xef5196;}if(_0x5cdfa2[_0x4f670c(0x7d)](/^[a-zA-Z]:/))return _0x5cdfa2[_0x4f670c(0x82)](/\//g,'\x5c');return _0x5cdfa2;}function a1_0x2e03(_0x4a9fde,_0x393409){_0x4a9fde=_0x4a9fde-0x6f;const _0xa1d0f3=a1_0xa1d0();let _0x2e0384=_0xa1d0f3[_0x4a9fde];return _0x2e0384;}export function normalizePath(_0xe8bcbb){const _0x5bb724=a1_0x2e03;_0xe8bcbb=_0xe8bcbb[_0x5bb724(0x73)]()['replace'](/^["']|["']$/g,'');const _0x12dbb2=_0xe8bcbb[_0x5bb724(0x78)]('/')&&!_0xe8bcbb[_0x5bb724(0x7d)](/^\/mnt\/[a-z]\//i)&&!_0xe8bcbb[_0x5bb724(0x7d)](/^\/[a-zA-Z]\//);if(_0x12dbb2)return _0xe8bcbb[_0x5bb724(0x82)](/\/+/g,'/')['replace'](/\/+$/,'');_0xe8bcbb=convertToWindowsPath(_0xe8bcbb);if(_0xe8bcbb[_0x5bb724(0x78)]('\x5c\x5c')){let _0x1214a0=_0xe8bcbb;_0x1214a0=_0x1214a0[_0x5bb724(0x82)](/^\\{2,}/,'\x5c\x5c');const _0x20fa6a=_0x1214a0[_0x5bb724(0x7b)](0x2)['replace'](/\\\\/g,'\x5c');_0xe8bcbb='\x5c\x5c'+_0x20fa6a;}else _0xe8bcbb=_0xe8bcbb[_0x5bb724(0x82)](/\\\\/g,'\x5c');let _0x3282a8=a1_0x4ac56e[_0x5bb724(0x72)](_0xe8bcbb);_0xe8bcbb['startsWith']('\x5c\x5c')&&!_0x3282a8[_0x5bb724(0x78)]('\x5c\x5c')&&(_0x3282a8='\x5c'+_0x3282a8);if(_0x3282a8[_0x5bb724(0x7d)](/^[a-zA-Z]:/)){let _0x23721f=_0x3282a8[_0x5bb724(0x82)](/\//g,'\x5c');return/^[a-z]:/[_0x5bb724(0x79)](_0x23721f)&&(_0x23721f=_0x23721f['charAt'](0x0)['toUpperCase']()+_0x23721f['slice'](0x1)),_0x23721f;}return _0x3282a8['replace'](/\//g,'\x5c');}export function expandHome(_0x1d53d8){const _0x52a9ff=a1_0x2e03;if(_0x1d53d8[_0x52a9ff(0x78)]('~/')||_0x1d53d8==='~')return a1_0x4ac56e[_0x52a9ff(0x76)](a1_0x1c5a7f[_0x52a9ff(0x74)](),_0x1d53d8[_0x52a9ff(0x71)](0x1));return _0x1d53d8;}
@@ -1 +1 @@
1
- (function(_0x2b8439,_0x321781){const _0x1c6537=a2_0x2995,_0x415572=_0x2b8439();while(!![]){try{const _0x1ef702=parseInt(_0x1c6537(0x1f8))/0x1*(-parseInt(_0x1c6537(0x1fc))/0x2)+parseInt(_0x1c6537(0x1ff))/0x3+parseInt(_0x1c6537(0x1fe))/0x4*(parseInt(_0x1c6537(0x1f6))/0x5)+parseInt(_0x1c6537(0x1ee))/0x6+-parseInt(_0x1c6537(0x1f7))/0x7+parseInt(_0x1c6537(0x1f1))/0x8+-parseInt(_0x1c6537(0x1f5))/0x9*(-parseInt(_0x1c6537(0x1f3))/0xa);if(_0x1ef702===_0x321781)break;else _0x415572['push'](_0x415572['shift']());}catch(_0x1ccaf0){_0x415572['push'](_0x415572['shift']());}}}(a2_0x42cb,0xcf76f));import a2_0x1a81fe from'path';function a2_0x2995(_0x383260,_0x1a969b){_0x383260=_0x383260-0x1ed;const _0x42cb9a=a2_0x42cb();let _0x29950c=_0x42cb9a[_0x383260];return _0x29950c;}function a2_0x42cb(){const _0x4b4ad8=['10MdMdRk','8218903wCfuVB','14aMKaAe','string','length','isArray','12114lbqPza','normalize','226504WKAYUx','640026XxbvNV','isAbsolute','612972xpPPyb','Path\x20must\x20be\x20absolute\x20after\x20normalization','resolve','10788536MbjmCp','sep','190kvduHd','startsWith','156969BMSXSF'];a2_0x42cb=function(){return _0x4b4ad8;};return a2_0x42cb();}export function isPathWithinAllowedDirectories(_0x2d1bcf,_0x1325d0){const _0x467ec8=a2_0x2995;if(typeof _0x2d1bcf!==_0x467ec8(0x1f9)||!Array[_0x467ec8(0x1fb)](_0x1325d0))return![];if(!_0x2d1bcf||_0x1325d0[_0x467ec8(0x1fa)]===0x0)return![];if(_0x2d1bcf['includes']('\x00'))return![];let _0x31d94d;try{_0x31d94d=a2_0x1a81fe[_0x467ec8(0x1f0)](a2_0x1a81fe['normalize'](_0x2d1bcf));}catch{return![];}if(!a2_0x1a81fe[_0x467ec8(0x1ed)](_0x31d94d))throw new Error(_0x467ec8(0x1ef));return _0x1325d0['some'](_0x3f6304=>{const _0xb74e27=_0x467ec8;if(typeof _0x3f6304!==_0xb74e27(0x1f9)||!_0x3f6304)return![];if(_0x3f6304['includes']('\x00'))return![];let _0x28875a;try{_0x28875a=a2_0x1a81fe[_0xb74e27(0x1f0)](a2_0x1a81fe[_0xb74e27(0x1fd)](_0x3f6304));}catch{return![];}if(!a2_0x1a81fe[_0xb74e27(0x1ed)](_0x28875a))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x31d94d===_0x28875a)return!![];if(_0x28875a===a2_0x1a81fe[_0xb74e27(0x1f2)])return _0x31d94d['startsWith'](a2_0x1a81fe[_0xb74e27(0x1f2)]);return _0x31d94d[_0xb74e27(0x1f4)](_0x28875a+a2_0x1a81fe[_0xb74e27(0x1f2)]);});}
1
+ (function(_0x25b06e,_0x3e1557){const _0x51e58e=a2_0x2ed5,_0x4b969e=_0x25b06e();while(!![]){try{const _0x37d4b6=-parseInt(_0x51e58e(0x19d))/0x1+parseInt(_0x51e58e(0x195))/0x2+-parseInt(_0x51e58e(0x1a4))/0x3+-parseInt(_0x51e58e(0x1a3))/0x4*(-parseInt(_0x51e58e(0x19a))/0x5)+-parseInt(_0x51e58e(0x194))/0x6+parseInt(_0x51e58e(0x197))/0x7*(-parseInt(_0x51e58e(0x199))/0x8)+parseInt(_0x51e58e(0x19c))/0x9;if(_0x37d4b6===_0x3e1557)break;else _0x4b969e['push'](_0x4b969e['shift']());}catch(_0x5f0f7c){_0x4b969e['push'](_0x4b969e['shift']());}}}(a2_0x3fab,0x3a082));import a2_0x2e77fd from'path';function a2_0x2ed5(_0x15ba43,_0x5685dc){_0x15ba43=_0x15ba43-0x193;const _0x3fab00=a2_0x3fab();let _0x2ed551=_0x3fab00[_0x15ba43];return _0x2ed551;}function a2_0x3fab(){const _0x15cad3=['5muoCkq','sep','3936132kKtquY','47375CkNfqo','startsWith','isArray','string','isAbsolute','includes','729944nquiYG','1128144gjJWHG','resolve','410976gEAsEU','854908BuDwcr','normalize','7tZQlpr','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','2541368cYZuCq'];a2_0x3fab=function(){return _0x15cad3;};return a2_0x3fab();}export function isPathWithinAllowedDirectories(_0x5f012c,_0x28b058){const _0x1bacd8=a2_0x2ed5;if(typeof _0x5f012c!==_0x1bacd8(0x1a0)||!Array[_0x1bacd8(0x19f)](_0x28b058))return![];if(!_0x5f012c||_0x28b058['length']===0x0)return![];if(_0x5f012c[_0x1bacd8(0x1a2)]('\x00'))return![];let _0x1a9bc2;try{_0x1a9bc2=a2_0x2e77fd[_0x1bacd8(0x193)](a2_0x2e77fd[_0x1bacd8(0x196)](_0x5f012c));}catch{return![];}if(!a2_0x2e77fd['isAbsolute'](_0x1a9bc2))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x28b058['some'](_0x442b7e=>{const _0x1a9eee=_0x1bacd8;if(typeof _0x442b7e!=='string'||!_0x442b7e)return![];if(_0x442b7e[_0x1a9eee(0x1a2)]('\x00'))return![];let _0x4fa07a;try{_0x4fa07a=a2_0x2e77fd['resolve'](a2_0x2e77fd[_0x1a9eee(0x196)](_0x442b7e));}catch{return![];}if(!a2_0x2e77fd[_0x1a9eee(0x1a1)](_0x4fa07a))throw new Error(_0x1a9eee(0x198));if(_0x1a9bc2===_0x4fa07a)return!![];if(_0x4fa07a===a2_0x2e77fd[_0x1a9eee(0x19b)])return _0x1a9bc2['startsWith'](a2_0x2e77fd[_0x1a9eee(0x19b)]);return _0x1a9bc2[_0x1a9eee(0x19e)](_0x4fa07a+a2_0x2e77fd[_0x1a9eee(0x19b)]);});}
@@ -1 +1 @@
1
- (function(_0x2f29ef,_0x4c826f){const _0x4471f9=a3_0x4315,_0x2733c1=_0x2f29ef();while(!![]){try{const _0x2b2415=parseInt(_0x4471f9(0x7d))/0x1+-parseInt(_0x4471f9(0x7f))/0x2*(parseInt(_0x4471f9(0x81))/0x3)+-parseInt(_0x4471f9(0x89))/0x4+parseInt(_0x4471f9(0x78))/0x5*(-parseInt(_0x4471f9(0x76))/0x6)+-parseInt(_0x4471f9(0x75))/0x7*(-parseInt(_0x4471f9(0x80))/0x8)+parseInt(_0x4471f9(0x83))/0x9+-parseInt(_0x4471f9(0x84))/0xa*(-parseInt(_0x4471f9(0x7a))/0xb);if(_0x2b2415===_0x4c826f)break;else _0x2733c1['push'](_0x2733c1['shift']());}catch(_0x13b9a9){_0x2733c1['push'](_0x2733c1['shift']());}}}(a3_0x50c3,0xf30a1));import{promises as a3_0x18fb62}from'fs';import a3_0x40c106 from'path';import a3_0x4b81d3 from'os';import{normalizePath}from'./path-utils.js';function a3_0x4315(_0x1c895e,_0xfa3226){_0x1c895e=_0x1c895e-0x73;const _0x50c318=a3_0x50c3();let _0x4315bb=_0x50c318[_0x1c895e];return _0x4315bb;}async function parseRootUri(_0x472ad2){const _0x1b267f=a3_0x4315;try{const _0x144440=_0x472ad2[_0x1b267f(0x86)]('file://')?_0x472ad2['slice'](0x7):_0x472ad2,_0x77c19c=_0x144440[_0x1b267f(0x86)]('~/')||_0x144440==='~'?a3_0x40c106[_0x1b267f(0x7c)](a3_0x4b81d3[_0x1b267f(0x77)](),_0x144440['slice'](0x1)):_0x144440,_0x1cbf10=a3_0x40c106[_0x1b267f(0x79)](_0x77c19c),_0xaece0a=await a3_0x18fb62[_0x1b267f(0x82)](_0x1cbf10);return normalizePath(_0xaece0a);}catch{return null;}}function a3_0x50c3(){const _0x52ad26=['join','1968706udEoom','message','111856qSmUtH','290360HntOOd','96LcCINU','realpath','943308FHWkBd','10XPJcTy','push','startsWith','isDirectory','\x20due\x20to\x20error:\x20','6922172lHBzjk','Skipping\x20invalid\x20directory:\x20','uri','161QVUJGt','87480xvTLjL','homedir','115uZQFXY','resolve','21370415ZYZFjF','error'];a3_0x50c3=function(){return _0x52ad26;};return a3_0x50c3();}function formatDirectoryError(_0x58db77,_0x314be1,_0x58c803){const _0x2aea24=a3_0x4315;if(_0x58c803)return'Skipping\x20'+_0x58c803+':\x20'+_0x58db77;const _0x2037b7=_0x314be1 instanceof Error?_0x314be1[_0x2aea24(0x7e)]:String(_0x314be1);return _0x2aea24(0x73)+_0x58db77+_0x2aea24(0x88)+_0x2037b7;}export async function getValidRootDirectories(_0x20675c){const _0x1a7815=a3_0x4315,_0x37cad1=[];for(const _0x453613 of _0x20675c){const _0x59b868=await parseRootUri(_0x453613[_0x1a7815(0x74)]);if(!_0x59b868){console[_0x1a7815(0x7b)](formatDirectoryError(_0x453613[_0x1a7815(0x74)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x3c4f0c=await a3_0x18fb62['stat'](_0x59b868);_0x3c4f0c[_0x1a7815(0x87)]()?_0x37cad1[_0x1a7815(0x85)](_0x59b868):console[_0x1a7815(0x7b)](formatDirectoryError(_0x59b868,undefined,'non-directory\x20root'));}catch(_0xe04c82){console[_0x1a7815(0x7b)](formatDirectoryError(_0x59b868,_0xe04c82));}}return _0x37cad1;}
1
+ (function(_0x2c5c98,_0x3ef6eb){const _0x1acdb1=a3_0x36e1,_0x4cd9b3=_0x2c5c98();while(!![]){try{const _0x4eb326=parseInt(_0x1acdb1(0x193))/0x1+parseInt(_0x1acdb1(0x19c))/0x2+-parseInt(_0x1acdb1(0x199))/0x3*(-parseInt(_0x1acdb1(0x1a1))/0x4)+parseInt(_0x1acdb1(0x191))/0x5+-parseInt(_0x1acdb1(0x198))/0x6*(parseInt(_0x1acdb1(0x1a3))/0x7)+parseInt(_0x1acdb1(0x195))/0x8*(-parseInt(_0x1acdb1(0x19e))/0x9)+-parseInt(_0x1acdb1(0x19b))/0xa;if(_0x4eb326===_0x3ef6eb)break;else _0x4cd9b3['push'](_0x4cd9b3['shift']());}catch(_0x3c6927){_0x4cd9b3['push'](_0x4cd9b3['shift']());}}}(a3_0x3459,0xb8c4e));import{promises as a3_0x4802cb}from'fs';import a3_0x46777c from'path';import a3_0x35834f from'os';function a3_0x36e1(_0x500671,_0xbe798a){_0x500671=_0x500671-0x18f;const _0x3459a6=a3_0x3459();let _0x36e169=_0x3459a6[_0x500671];return _0x36e169;}function a3_0x3459(){const _0x4d4467=['438URBekB','27351mkxwdq','homedir','3839220kyrlAH','177240iJNZch','file://','9YPVMZN','startsWith','resolve','44yVvaNX','non-directory\x20root','35161kAiXAM','join','error','isDirectory','Skipping\x20invalid\x20directory:\x20','\x20due\x20to\x20error:\x20','2895260CQDUur','invalid\x20path\x20or\x20inaccessible','1468283MVseBz','message','5830616JNzmvt','uri','slice'];a3_0x3459=function(){return _0x4d4467;};return a3_0x3459();}import{normalizePath}from'./path-utils.js';async function parseRootUri(_0xfdcdc4){const _0x2414e8=a3_0x36e1;try{const _0x5e70e9=_0xfdcdc4[_0x2414e8(0x19f)](_0x2414e8(0x19d))?_0xfdcdc4['slice'](0x7):_0xfdcdc4,_0x48abc5=_0x5e70e9[_0x2414e8(0x19f)]('~/')||_0x5e70e9==='~'?a3_0x46777c[_0x2414e8(0x1a4)](a3_0x35834f[_0x2414e8(0x19a)](),_0x5e70e9[_0x2414e8(0x197)](0x1)):_0x5e70e9,_0x51b30e=a3_0x46777c[_0x2414e8(0x1a0)](_0x48abc5),_0x34a8b9=await a3_0x4802cb['realpath'](_0x51b30e);return normalizePath(_0x34a8b9);}catch{return null;}}function formatDirectoryError(_0x593a97,_0x10d988,_0x5a21d9){const _0x33afd4=a3_0x36e1;if(_0x5a21d9)return'Skipping\x20'+_0x5a21d9+':\x20'+_0x593a97;const _0x1e546d=_0x10d988 instanceof Error?_0x10d988[_0x33afd4(0x194)]:String(_0x10d988);return _0x33afd4(0x18f)+_0x593a97+_0x33afd4(0x190)+_0x1e546d;}export async function getValidRootDirectories(_0x249288){const _0xa4bf69=a3_0x36e1,_0x574739=[];for(const _0x2304b8 of _0x249288){const _0x4d79e9=await parseRootUri(_0x2304b8[_0xa4bf69(0x196)]);if(!_0x4d79e9){console[_0xa4bf69(0x1a5)](formatDirectoryError(_0x2304b8[_0xa4bf69(0x196)],undefined,_0xa4bf69(0x192)));continue;}try{const _0x47c55e=await a3_0x4802cb['stat'](_0x4d79e9);_0x47c55e[_0xa4bf69(0x1a6)]()?_0x574739['push'](_0x4d79e9):console['error'](formatDirectoryError(_0x4d79e9,undefined,_0xa4bf69(0x1a2)));}catch(_0x52d60b){console[_0xa4bf69(0x1a5)](formatDirectoryError(_0x4d79e9,_0x52d60b));}}return _0x574739;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.55",
3
+ "version": "0.8.57",
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.82",
38
+ "@morphllm/morphsdk": "0.2.84",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",