@morphllm/morphmcp 0.8.62 → 0.8.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0xdab3d8=a0_0x4bc3;(function(_0x375564,_0x54cb0c){const _0x12995a=a0_0x4bc3,_0x58dc4f=_0x375564();while(!![]){try{const _0x2e0f40=parseInt(_0x12995a(0x226))/0x1*(parseInt(_0x12995a(0x1bb))/0x2)+parseInt(_0x12995a(0x20b))/0x3+-parseInt(_0x12995a(0x255))/0x4+-parseInt(_0x12995a(0x25d))/0x5*(-parseInt(_0x12995a(0x1e5))/0x6)+-parseInt(_0x12995a(0x1e6))/0x7*(parseInt(_0x12995a(0x26a))/0x8)+-parseInt(_0x12995a(0x202))/0x9+parseInt(_0x12995a(0x1a1))/0xa*(parseInt(_0x12995a(0x1e9))/0xb);if(_0x2e0f40===_0x54cb0c)break;else _0x58dc4f['push'](_0x58dc4f['shift']());}catch(_0x45d84c){_0x58dc4f['push'](_0x58dc4f['shift']());}}}(a0_0x89d8,0x6def5));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_0x1821d2 from'fs/promises';import a0_0x369cc9 from'path';import a0_0x253d81 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_0x4b5e00 from'axios';function fixPathRepetition(_0x3c9b00){const _0x547ad6=a0_0x4bc3,_0x549d45=_0x3c9b00['split'](a0_0x369cc9[_0x547ad6(0x1dc)])[_0x547ad6(0x1c5)](Boolean);if(_0x549d45[_0x547ad6(0x27b)]<0x2)return null;for(let _0x3ee2f6=Math[_0x547ad6(0x227)](_0x549d45['length']/0x2);_0x3ee2f6>=0x1;_0x3ee2f6--){for(let _0x278dac=0x0;_0x278dac<=_0x549d45['length']-0x2*_0x3ee2f6;_0x278dac++){const _0x1ebd27=_0x549d45[_0x547ad6(0x25e)](_0x278dac,_0x278dac+_0x3ee2f6),_0x31cb68=_0x549d45[_0x547ad6(0x25e)](_0x278dac+_0x3ee2f6,_0x278dac+0x2*_0x3ee2f6);if(_0x1ebd27['every']((_0x501c73,_0x4bbf62)=>_0x501c73===_0x31cb68[_0x4bbf62])){const _0x16f66e=[..._0x549d45[_0x547ad6(0x25e)](0x0,_0x278dac),..._0x549d45[_0x547ad6(0x25e)](_0x278dac+_0x3ee2f6)];return a0_0x369cc9[_0x547ad6(0x1dc)]+_0x16f66e[_0x547ad6(0x260)](a0_0x369cc9[_0x547ad6(0x1dc)]);}}}return null;}const args=process[a0_0xdab3d8(0x1fe)][a0_0xdab3d8(0x25e)](0x2),ALL_TOOLS=[a0_0xdab3d8(0x223),'warpgrep_codebase_search',a0_0xdab3d8(0x1fc)],DEFAULT_TOOLS=[a0_0xdab3d8(0x223),a0_0xdab3d8(0x1aa)],ENABLED_TOOLS=process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x27d)]?process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x27d)]==='all'?ALL_TOOLS:process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x27d)][a0_0xdab3d8(0x1e2)](',')[a0_0xdab3d8(0x1ac)](_0x35e670=>_0x35e670[a0_0xdab3d8(0x1e4)]()):DEFAULT_TOOLS;console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x1a5)+ENABLED_TOOLS[a0_0xdab3d8(0x260)](',\x20'));const WORKSPACE_ROOT=process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x258)]||process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x25b)]||process[a0_0xdab3d8(0x245)](),ENABLE_WORKSPACE_MODE=process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x253)]!==a0_0xdab3d8(0x1ab),MORPH_API_KEY=process[a0_0xdab3d8(0x1d4)]['MORPH_API_KEY'],MORPH_API_URL=process['env'][a0_0xdab3d8(0x281)],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0xdab3d8(0x235)]?parseInt(process[a0_0xdab3d8(0x1d4)][a0_0xdab3d8(0x235)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0xdab3d8(0x1b0)](a0_0xdab3d8(0x1d3))&&!MORPH_API_KEY['startsWith'](a0_0xdab3d8(0x27e))&&console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x225));async function reportMorphError(_0x5a75c6){const _0x123980=a0_0xdab3d8;try{await a0_0x4b5e00[_0x123980(0x203)](_0x123980(0x246),{..._0x5a75c6,'timestamp':new Date()['toISOString'](),'source':_0x5a75c6['source']||_0x123980(0x240)},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x123980(0x27a)+MORPH_API_KEY}});}catch{}}args[a0_0xdab3d8(0x27b)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x24c)),console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x27f)),console['error'](a0_0xdab3d8(0x266)),console['error'](a0_0xdab3d8(0x1eb)),console['error'](a0_0xdab3d8(0x20e)),console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x1c8)));function normalizePath(_0x2144ce){return a0_0x369cc9['normalize'](_0x2144ce);}function expandHome(_0x1886b2){const _0x26176d=a0_0xdab3d8;if(_0x1886b2[_0x26176d(0x1b0)]('~/')||_0x1886b2==='~')return a0_0x369cc9[_0x26176d(0x260)](a0_0x253d81['homedir'](),_0x1886b2[_0x26176d(0x25e)](0x1));return _0x1886b2;}let allowedDirectories=await Promise[a0_0xdab3d8(0x278)](args['map'](async _0x10d777=>{const _0x71eb4b=a0_0xdab3d8,_0x122076=expandHome(_0x10d777),_0x339b86=a0_0x369cc9[_0x71eb4b(0x1bf)](_0x122076);try{const _0xb04dfc=await a0_0x1821d2['realpath'](_0x339b86);return normalizePath(_0xb04dfc);}catch(_0x1f76fe){return normalizePath(_0x339b86);}}));function a0_0x4bc3(_0x3fe97a,_0x1f9cbb){_0x3fe97a=_0x3fe97a-0x19b;const _0x89d858=a0_0x89d8();let _0x4bc3aa=_0x89d858[_0x3fe97a];return _0x4bc3aa;}if(ENABLE_WORKSPACE_MODE&&args[a0_0xdab3d8(0x27b)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x1da)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x34380c){console[a0_0xdab3d8(0x1a8)](a0_0xdab3d8(0x222)+a0_0x34380c);}async function detectWorkspaceRoot(_0x2e2436){const _0x211b08=a0_0xdab3d8;let _0x2c21dd=a0_0x369cc9['resolve'](_0x2e2436);const _0x21e827=[_0x211b08(0x213),_0x211b08(0x1d2),_0x211b08(0x1fa),_0x211b08(0x1ea),_0x211b08(0x21a),_0x211b08(0x1ce),_0x211b08(0x1b5),_0x211b08(0x1a7),'composer.json'];while(_0x2c21dd!==a0_0x369cc9['dirname'](_0x2c21dd)){for(const _0x2a9b87 of _0x21e827){const _0x184225=a0_0x369cc9[_0x211b08(0x260)](_0x2c21dd,_0x2a9b87);try{return await a0_0x1821d2[_0x211b08(0x1c4)](_0x184225),normalizePath(_0x2c21dd);}catch{}}_0x2c21dd=a0_0x369cc9['dirname'](_0x2c21dd);}return normalizePath(_0x2e2436);}await Promise[a0_0xdab3d8(0x278)](args[a0_0xdab3d8(0x1ac)](async _0x4cd1f1=>{const _0x580554=a0_0xdab3d8;try{const _0x141aea=await a0_0x1821d2[_0x580554(0x1cd)](expandHome(_0x4cd1f1));!_0x141aea['isDirectory']()&&(console[_0x580554(0x1a8)](_0x580554(0x1e0)+_0x4cd1f1+_0x580554(0x208)),process[_0x580554(0x236)](0x1));}catch(_0x50bd93){console[_0x580554(0x1a8)]('Error\x20accessing\x20directory\x20'+_0x4cd1f1+':',_0x50bd93),process[_0x580554(0x236)](0x1);}}));async function validatePath(_0x1528b5){const _0x59a64f=a0_0xdab3d8,_0x30479c=expandHome(_0x1528b5),_0x4913d3=a0_0x369cc9['resolve'](_0x30479c);try{const _0x4bd4d1=await a0_0x1821d2[_0x59a64f(0x1df)](_0x4913d3);return _0x4bd4d1;}catch(_0x55fbca){if(_0x55fbca[_0x59a64f(0x256)]===_0x59a64f(0x21c)){const _0x3d805f=a0_0x369cc9[_0x59a64f(0x26b)](_0x4913d3);try{const _0x43cfb4=await a0_0x1821d2[_0x59a64f(0x1df)](_0x3d805f);return a0_0x369cc9['join'](_0x43cfb4,a0_0x369cc9['basename'](_0x4913d3));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x3d805f);}}throw _0x55fbca;}}function a0_0x89d8(){const _0x346057=['path','PWD','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','10eMjKIc','slice','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','join','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','repeat','0.2.0','repoId','describe','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','message','Here\x20is\x20the\x20content\x20of\x20files:\x0a','files','1445656FMrjcj','dirname','object','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','startLine','utf-8','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Benefits:\x0a','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','catch','File\x20read\x20error:','isArray','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','results','all','<file\x20path=\x22','Bearer\x20','length','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','ENABLED_TOOLS','morph-','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','assistant','MORPH_API_URL','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','Created\x20File','safeParse','lines','boolean','requiresApiKey','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','success','58510YDkaRk','</file>','setRequestHandler','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Enabled\x20tools:\x20','code_edit','tsconfig.json','error','FileReadError','warpgrep_codebase_search','false','map','morph-v3-fast','\x20\x20\x20Lines\x20','target_directories','startsWith','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','branch','For\x20deletions:\x0a','array','.cursor','optional','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','TimeoutError','\x27\x20in\x20`','terminated','493948AnJlJK','Failed\x20to\x20read\x20file:\x20','Fallback:\x20Using\x20workspace\x20root\x20','timeout','resolve','number','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','default','access','filter','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Found\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','[could\x20not\x20read\x20file:\x20','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','dryRun','limit','stat','go.mod','listRoots','-\x20Grepped\x20\x27','constructor','.vscode','sk-','env','oninitialized','messages','repo_path','roots','Applied','Workspace\x20mode\x20enabled:\x20Using\x20','search_string','sep','connect','unknown\x20error','realpath','Error:\x20','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','split','morph-warp-grep-v1-1111v0','trim','627870ShRWUR','14TymHPd','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','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','1364dVvDHi','Cargo.toml','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20chars)','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','readFile','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','timings','Search\x20failed:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','runWarpGrep_call','apply\x20these\x20changes','stringify','unknown','instruction','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','data','package.json','timed\x20out','codebase_search','stats','argv','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','applied\x20edits\x20to','\x0a...\x20(truncated,\x20total:\x20','2256921WlMTmc','post','Invalid\x20arguments:\x20','UnknownError','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','etimedout','\x20is\x20not\x20a\x20directory','No\x20results\x20found\x20for\x20query:\x20\x22','commitHash','1181655WewWXP','Fatal\x20error\x20running\x20server:','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','create\x20this\x20file','content','.git','completed_with_file_errors','filepath','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','\x20valid\x20directories','read\x20','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','pyproject.toml','params','ENOENT','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','stack','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','searchTimeMs','name','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','edit_file','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','1LFOaaA','floor','Morph\x20FastApply\x20failed\x20without\x20error\x20message','morph-mcp','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','push','toLowerCase','created','Warning:\x20','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','finish','string','Rules:\x0a','toFixed','match','MORPH_WARP_GREP_TIMEOUT','exit','\x20-\x20','endLine','\x20(new\x20file)','❌\x20Morph\x20Edit\x20Failed:\x20','query','substring','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','\x0a</file>','list_directory\x20','mcp-filesystem','text','Error\x20running\x20fast\x20context\x20search:\x20','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','inputSchema','cwd','https://morphllm.com/api/error-report','terminationReason','includes','udiff','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','Failed\x20to\x20request\x20roots\x20from\x20client:','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','role','metadata','rerankScore','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','ENABLE_WORKSPACE_MODE','Successfully\x20','2052788HHkEhh','code','errors','WORKSPACE_ROOT','Specific\x20commit\x20hash\x20to\x20search'];a0_0x89d8=function(){return _0x346057;};return a0_0x89d8();}const MorphEditFileArgsSchema=z[a0_0xdab3d8(0x26c)]({'path':z[a0_0xdab3d8(0x231)](),'code_edit':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x265)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x265)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0xdab3d8(0x19d)]()['default'](![])[a0_0xdab3d8(0x265)]('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z[a0_0xdab3d8(0x26c)]({'search_string':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x265)](a0_0xdab3d8(0x19f)),'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_0xdab3d8(0x26c)]({'query':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x265)]('Natural\x20language\x20query\x20to\x20search\x20for\x20code'),'repoId':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x265)]('Repository\x20identifier'),'branch':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x1b6)]()['describe'](a0_0xdab3d8(0x1ed)),'commitHash':z[a0_0xdab3d8(0x231)]()[a0_0xdab3d8(0x1b6)]()['describe'](a0_0xdab3d8(0x259)),'target_directories':z[a0_0xdab3d8(0x1b4)](z['string']())[a0_0xdab3d8(0x1c3)]([])[a0_0xdab3d8(0x265)](a0_0xdab3d8(0x22f)),'limit':z[a0_0xdab3d8(0x1c0)]()[a0_0xdab3d8(0x1b6)]()[a0_0xdab3d8(0x1c3)](0xa)[a0_0xdab3d8(0x265)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0xdab3d8(0x229),'version':a0_0xdab3d8(0x263)},{'capabilities':{'tools':{}}});server[a0_0xdab3d8(0x1a3)](ListToolsRequestSchema,async()=>{const _0x254641=a0_0xdab3d8,_0x5b2add=[{'name':_0x254641(0x223),'description':_0x254641(0x1c6)+_0x254641(0x25f)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x254641(0x1c1)+'Benefits:\x0a'+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x254641(0x1ca)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+_0x254641(0x20d)+_0x254641(0x1a4)+_0x254641(0x21f)+_0x254641(0x1b3)+_0x254641(0x25c)+_0x254641(0x1b7)+_0x254641(0x232)+_0x254641(0x272)+_0x254641(0x276)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x254641(0x23d)+_0x254641(0x20f)+_0x254641(0x243)+_0x254641(0x1ff),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x254641(0x1aa),'description':_0x254641(0x216)+_0x254641(0x1ef)+_0x254641(0x1e8)+_0x254641(0x219)+_0x254641(0x224)+'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'+_0x254641(0x24a)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':'**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a'+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x254641(0x24e)+_0x254641(0x271)+_0x254641(0x1f8)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x254641(0x1b1)+_0x254641(0x206)+_0x254641(0x282)+_0x254641(0x1e1)+_0x254641(0x210),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x203a65=_0x5b2add[_0x254641(0x1c5)](_0x453313=>{const _0x167f87=_0x254641;if(!ENABLED_TOOLS[_0x167f87(0x248)](_0x453313[_0x167f87(0x221)]))return![];if(_0x167f87(0x19e)in _0x453313&&_0x453313[_0x167f87(0x19e)]&&!MORPH_API_KEY)return console[_0x167f87(0x1a8)](_0x167f87(0x22e)+_0x453313[_0x167f87(0x221)]+_0x167f87(0x261)),![];return!![];});return{'tools':_0x203a65[_0x254641(0x1ac)](_0x8cb9ee=>({'name':_0x8cb9ee[_0x254641(0x221)],'description':_0x8cb9ee['description'],'inputSchema':_0x8cb9ee[_0x254641(0x244)]}))};}),server[a0_0xdab3d8(0x1a3)](CallToolRequestSchema,async _0x3ec89b=>{const _0x51e21e=a0_0xdab3d8;try{const {name:_0x69a882,arguments:_0xde3037}=_0x3ec89b[_0x51e21e(0x21b)];switch(_0x69a882){case'edit_file':{const _0x2e8bde=MorphEditFileArgsSchema['safeParse'](_0xde3037);if(!_0x2e8bde[_0x51e21e(0x1a0)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x2e8bde[_0x51e21e(0x1a8)]);const _0x2bf156=await validatePath(_0x2e8bde[_0x51e21e(0x1f9)][_0x51e21e(0x25a)]);let _0x5caecb=null,_0xa9ee26=!![],_0x3eaf4a=null;try{_0x5caecb=await a0_0x1821d2[_0x51e21e(0x1ee)](_0x2bf156,_0x51e21e(0x26f));}catch(_0x99980e){const _0x2aad64=_0x99980e[_0x51e21e(0x256)];_0x2aad64===_0x51e21e(0x21c)?(_0xa9ee26=![],_0x5caecb=''):(_0x3eaf4a=_0x51e21e(0x1bc)+(_0x2aad64||_0x51e21e(0x1f6))+_0x51e21e(0x237)+(_0x99980e instanceof Error?_0x99980e[_0x51e21e(0x267)]:String(_0x99980e)),console[_0x51e21e(0x1a8)](_0x51e21e(0x22e)+_0x3eaf4a));}try{const _0x438741=MORPH_API_KEY;if(!_0x438741)throw new Error(_0x51e21e(0x24d));const _0x173597=a0_0x369cc9['dirname'](_0x2bf156),_0x24f521=a0_0x369cc9['basename'](_0x2bf156),_0x123dd9=await executeEditFile({'target_filepath':_0x24f521,'code_edit':_0x2e8bde[_0x51e21e(0x1f9)]['code_edit'],'instructions':_0x2e8bde[_0x51e21e(0x1f9)][_0x51e21e(0x1f7)]},{'morphApiKey':_0x438741,'morphApiUrl':MORPH_API_URL,'baseDir':_0x173597,'autoWrite':!_0x2e8bde['data'][_0x51e21e(0x1cb)],'generateUdiff':!![],'debug':![]});if(!_0x123dd9[_0x51e21e(0x1a0)])throw new Error(_0x123dd9['error']||_0x51e21e(0x228));const _0x31ae9a=_0x123dd9[_0x51e21e(0x249)]||'';let _0x269c2b=0x3;while(_0x31ae9a['includes']('`'[_0x51e21e(0x262)](_0x269c2b))){_0x269c2b++;}const _0x4f0459='`'[_0x51e21e(0x262)](_0x269c2b)+'diff\x0a'+_0x31ae9a+'`'[_0x51e21e(0x262)](_0x269c2b)+'\x0a\x0a';if(_0x2e8bde[_0x51e21e(0x1f9)]['dryRun'])return{'content':[{'type':_0x51e21e(0x241),'text':'🔍\x20Morph\x20Edit\x20Preview'+(_0xa9ee26?'':_0x51e21e(0x239))+':\x20'+_0x2e8bde[_0x51e21e(0x1f9)][_0x51e21e(0x1f7)]+'\x0a\x0a'+_0x4f0459+'Use\x20dryRun=false\x20to\x20'+(_0xa9ee26?_0x51e21e(0x1f4):_0x51e21e(0x211))+'.'}]};return{'content':[{'type':_0x51e21e(0x241),'text':'Morph\x20Edit\x20'+(_0xa9ee26?_0x51e21e(0x1d9):_0x51e21e(0x283))+':\x20'+_0x2e8bde[_0x51e21e(0x1f9)]['instruction']+'\x0a\x0a'+_0x4f0459+_0x51e21e(0x254)+(_0xa9ee26?_0x51e21e(0x200):_0x51e21e(0x22d))+'\x20'+_0x2e8bde[_0x51e21e(0x1f9)][_0x51e21e(0x25a)]}]};}catch(_0x25f12e){const _0x15a1ad=_0x25f12e instanceof Error?_0x25f12e[_0x51e21e(0x267)]:String(_0x25f12e);return reportMorphError({'error_message':_0x15a1ad,'error_type':_0x25f12e instanceof Error?_0x25f12e['constructor'][_0x51e21e(0x221)]:_0x51e21e(0x205),'context':{'tool':_0x51e21e(0x223),'file_path':_0x2e8bde[_0x51e21e(0x1f9)]['path'],'validated_path':_0x2bf156,'instruction':_0x2e8bde[_0x51e21e(0x1f9)][_0x51e21e(0x1f7)],'model':_0x51e21e(0x1ad),'dry_run':_0x2e8bde[_0x51e21e(0x1f9)]['dryRun'],'file_exists':_0xa9ee26,'file_read_error':_0x3eaf4a,'file_readable':_0x5caecb!==null,'request_content':{'path':_0x2e8bde[_0x51e21e(0x1f9)]['path'],'code_edit':_0x2e8bde['data'][_0x51e21e(0x1a6)],'instruction':_0x2e8bde['data'][_0x51e21e(0x1f7)],'original_code':_0x5caecb!==null?_0x5caecb[_0x51e21e(0x27b)]>0xc350?_0x5caecb[_0x51e21e(0x23c)](0x0,0xc350)+_0x51e21e(0x201)+_0x5caecb[_0x51e21e(0x27b)]+_0x51e21e(0x1ec):_0x5caecb:_0x51e21e(0x1c9)+(_0x3eaf4a||_0x51e21e(0x1de))+']','original_code_length':_0x5caecb?.[_0x51e21e(0x27b)]??0x0,'model':'morph-v3-fast','dry_run':_0x2e8bde['data']['dryRun']}},'stack_trace':_0x25f12e instanceof Error?_0x25f12e[_0x51e21e(0x21e)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x51e21e(0x241),'text':_0x51e21e(0x23a)+_0x15a1ad}],'isError':!![]};}}case'warpgrep_codebase_search':{const _0x4be38b=WarpGrepArgsSchema[_0x51e21e(0x19b)](_0xde3037);if(!_0x4be38b['success'])return{'content':[{'type':'text','text':_0x51e21e(0x204)+_0x4be38b[_0x51e21e(0x1a8)]}],'isError':!![]};const _0xcb9aee=_0x241fe8=>{const _0x46cb99=_0x51e21e,_0x2f834b=[];for(const _0x52e637 of _0x241fe8||[]){const _0x370d7b=_0x52e637[_0x46cb99(0x24f)],_0x2d0acf=_0x52e637[_0x46cb99(0x212)];if(_0x370d7b===_0x46cb99(0x280)&&_0x2d0acf){const _0x286094=_0x2d0acf[_0x46cb99(0x1e2)]('\x0a')[_0x46cb99(0x1c5)](_0x589dc5=>_0x589dc5['trim']());for(const _0x3c195d of _0x286094){const _0x5df682=_0x3c195d[_0x46cb99(0x234)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x5df682){_0x2f834b[_0x46cb99(0x22b)]('grep\x20\x27'+_0x5df682[0x1]+'\x27\x20'+_0x5df682[0x2]);continue;}const _0x32d7f3=_0x3c195d['match'](/^read\s+(.+)$/);if(_0x32d7f3){_0x2f834b['push'](_0x46cb99(0x218)+_0x32d7f3[0x1]);continue;}const _0x5ed034=_0x3c195d['match'](/^list_directory\s+(.+)$/);if(_0x5ed034){_0x2f834b[_0x46cb99(0x22b)](_0x46cb99(0x23f)+_0x5ed034[0x1]);continue;}}}}return _0x2f834b;};try{const _0x31e017=a0_0x369cc9[_0x51e21e(0x1bf)](_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)]),_0x10bd39=new LocalRipgrepProvider(_0x31e017),_0x558caf=await runWarpGrep({'query':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1db)],'repoRoot':_0x31e017,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x10bd39});let _0x553d63='';if(_0x558caf[_0x51e21e(0x247)]==='completed'&&_0x558caf['finish']?.[_0x51e21e(0x250)]?.[_0x51e21e(0x269)]){const _0x2b9496=_0x558caf['finish']['metadata'][_0x51e21e(0x269)],_0xcef0c4=[],_0xe4a103=[_0x51e21e(0x26d)];for(const _0x421614 of _0x558caf[_0x51e21e(0x1d6)]){const _0x3b7b9f=_0x421614['role'],_0x51cd8a=_0x421614[_0x51e21e(0x212)];if(_0x3b7b9f==='assistant'&&_0x51cd8a){const _0x2fc428=_0x51cd8a[_0x51e21e(0x1e2)]('\x0a')['filter'](_0x19822a=>_0x19822a['trim']());for(const _0xc36d1e of _0x2fc428){const _0xea9772=_0xc36d1e[_0x51e21e(0x234)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0xea9772){_0xe4a103[_0x51e21e(0x22b)](_0x51e21e(0x1d0)+_0xea9772[0x1]+_0x51e21e(0x1b9)+_0xea9772[0x2]+'`');continue;}const _0x102fb7=_0xc36d1e[_0x51e21e(0x234)](/^read\s+(.+)$/);if(_0x102fb7){_0xe4a103[_0x51e21e(0x22b)]('-\x20Read\x20file\x20`'+_0x102fb7[0x1]+'`');continue;}const _0x7f08d1=_0xc36d1e[_0x51e21e(0x234)](/^list_directory\s+(.+)$/);if(_0x7f08d1){_0xe4a103[_0x51e21e(0x22b)]('-\x20Listed\x20directory\x20`'+_0x7f08d1[0x1]+'`');continue;}}}}_0xcef0c4[_0x51e21e(0x22b)](_0xe4a103['join']('\x0a'));const _0x2fb68=['','Relevant\x20context\x20found:'];for(const _0x26b30c of _0x2b9496){if(_0x26b30c[_0x51e21e(0x19c)]==='*')_0x2fb68[_0x51e21e(0x22b)]('-\x20'+_0x26b30c[_0x51e21e(0x25a)]+':*');else{if(Array[_0x51e21e(0x275)](_0x26b30c[_0x51e21e(0x19c)])){const _0x372375=_0x26b30c[_0x51e21e(0x19c)][_0x51e21e(0x1ac)](([_0xec33c4,_0x554f9c])=>{if(_0xec33c4===_0x554f9c)return''+_0xec33c4;return _0xec33c4+'-'+_0x554f9c;});_0x2fb68[_0x51e21e(0x22b)]('-\x20'+_0x26b30c[_0x51e21e(0x25a)]+':'+_0x372375[_0x51e21e(0x260)](','));}else _0x2fb68[_0x51e21e(0x22b)]('-\x20'+_0x26b30c[_0x51e21e(0x25a)]+':*');}}_0x2fb68[_0x51e21e(0x22b)](''),_0xcef0c4['push'](_0x2fb68[_0x51e21e(0x260)]('\x0a')),_0xcef0c4['push'](_0x51e21e(0x268));const _0x2c9810=[];for(const _0x1d978e of _0x2b9496){let _0x188773=a0_0x369cc9[_0x51e21e(0x1bf)](_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)],_0x1d978e[_0x51e21e(0x25a)]),_0x3141dd=null,_0x540d37=null;try{_0x3141dd=await a0_0x1821d2[_0x51e21e(0x1ee)](_0x188773,{'encoding':_0x51e21e(0x26f)});}catch(_0xdf0d30){const _0x5258f5=fixPathRepetition(_0x188773);if(_0x5258f5)try{_0x3141dd=await a0_0x1821d2[_0x51e21e(0x1ee)](_0x5258f5,{'encoding':_0x51e21e(0x26f)}),_0x188773=_0x5258f5;}catch{_0x540d37=_0xdf0d30 instanceof Error?_0xdf0d30:new Error(String(_0xdf0d30));}else _0x540d37=_0xdf0d30 instanceof Error?_0xdf0d30:new Error(String(_0xdf0d30));}if(_0x3141dd!==null){const _0x56d294=_0x3141dd[_0x51e21e(0x1e2)](/\r?\n/),_0x25f7e0=[_0x51e21e(0x279)+_0x1d978e[_0x51e21e(0x25a)]+'\x22>'];if(_0x1d978e[_0x51e21e(0x19c)]==='*'||!Array['isArray'](_0x1d978e[_0x51e21e(0x19c)]))for(let _0x565bec=0x1;_0x565bec<=_0x56d294[_0x51e21e(0x27b)];_0x565bec++){const _0x2732ea=_0x56d294[_0x565bec-0x1];_0x25f7e0[_0x51e21e(0x22b)](_0x565bec+'|\x20'+_0x2732ea);}else for(const [_0x3b17db,_0x16e8fd]of _0x1d978e['lines']){_0x25f7e0[_0x51e21e(0x27b)]>0x1&&_0x25f7e0[_0x51e21e(0x22b)]('');for(let _0x5486bb=_0x3b17db;_0x5486bb<=_0x16e8fd&&_0x5486bb<=_0x56d294[_0x51e21e(0x27b)];_0x5486bb++){const _0x24797a=_0x56d294[_0x5486bb-0x1];_0x25f7e0[_0x51e21e(0x22b)](_0x5486bb+'|\x20'+_0x24797a);}}_0x25f7e0[_0x51e21e(0x22b)](_0x51e21e(0x1a2)),_0x2c9810[_0x51e21e(0x22b)](_0x25f7e0[_0x51e21e(0x260)]('\x0a'));}else _0x2c9810['push'](_0x51e21e(0x279)+_0x1d978e[_0x51e21e(0x25a)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x540d37?.[_0x51e21e(0x267)]||'Unknown\x20error')+_0x51e21e(0x23e));}_0xcef0c4['push'](_0x2c9810[_0x51e21e(0x260)]('\x0a\x0a')),_0x553d63=_0xcef0c4[_0x51e21e(0x260)]('\x0a');const _0x4dd53b=_0x558caf['errors']?.[_0x51e21e(0x1c5)](_0x4dbe84=>_0x4dbe84[_0x51e21e(0x267)]?.['startsWith'](_0x51e21e(0x274)))||[];if(_0x4dd53b[_0x51e21e(0x27b)]>0x0){const _0x321bbf=_0x4dd53b[_0x51e21e(0x1ac)](_0x3d8059=>_0x3d8059['message'])[_0x51e21e(0x260)](';\x20');reportMorphError({'error_message':_0x321bbf,'error_type':_0x51e21e(0x1a9),'context':{'tool':_0x51e21e(0x1aa),'repo_path':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)],'query':_0x4be38b[_0x51e21e(0x1f9)]['search_string'],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x51e21e(0x214),'error_count':_0x4dd53b[_0x51e21e(0x27b)],'is_timeout':![],'timings':_0x558caf[_0x51e21e(0x1f0)],'files_attempted':_0x2b9496['map'](_0x2eaec8=>({'path':_0x2eaec8[_0x51e21e(0x25a)],'lines':_0x2eaec8[_0x51e21e(0x19c)]})),'tool_calls':_0xcb9aee(_0x558caf['messages']),'messages':_0x558caf['messages']?.['map'](_0x14d661=>({'role':_0x14d661[_0x51e21e(0x24f)],'content':_0x14d661[_0x51e21e(0x212)]})),'request_content':{'query':_0x4be38b['data'][_0x51e21e(0x1db)],'repo_path':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)],'repoRoot':a0_0x369cc9[_0x51e21e(0x1bf)](_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)]),'model':_0x51e21e(0x1e3)}},'source':_0x51e21e(0x240)})['catch'](()=>{});}}else{if(_0x558caf[_0x51e21e(0x247)]===_0x51e21e(0x1ba)&&_0x558caf['errors'][_0x51e21e(0x27b)]>0x0){const _0x5bb7b1=_0x558caf[_0x51e21e(0x257)][_0x51e21e(0x1ac)](_0x26764a=>_0x26764a[_0x51e21e(0x267)])[_0x51e21e(0x260)](';\x20');_0x553d63='Error:\x20'+_0x5bb7b1;const _0x4d2ece=_0x5bb7b1['toLowerCase']()[_0x51e21e(0x248)](_0x51e21e(0x1be))||_0x5bb7b1[_0x51e21e(0x22c)]()['includes']('timed\x20out')||_0x5bb7b1[_0x51e21e(0x22c)]()[_0x51e21e(0x248)](_0x51e21e(0x207)),_0x28990f=_0x558caf[_0x51e21e(0x230)]?.[_0x51e21e(0x250)]?.[_0x51e21e(0x269)],_0x4c8359=_0x558caf[_0x51e21e(0x257)][0x0];reportMorphError({'error_message':_0x5bb7b1,'error_type':_0x4d2ece?_0x51e21e(0x1b8):_0x4c8359?.[_0x51e21e(0x1d1)]?.[_0x51e21e(0x221)]||'WarpGrepError','context':{'tool':_0x51e21e(0x1aa),'repo_path':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)],'query':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1db)],'model':_0x51e21e(0x1e3),'termination_reason':_0x558caf['terminationReason'],'error_count':_0x558caf['errors'][_0x51e21e(0x27b)],'is_timeout':_0x4d2ece,'timings':_0x558caf[_0x51e21e(0x1f0)],'files_attempted':_0x28990f?.[_0x51e21e(0x1ac)](_0xc58493=>({'path':_0xc58493[_0x51e21e(0x25a)],'lines':_0xc58493[_0x51e21e(0x19c)]})),'tool_calls':_0xcb9aee(_0x558caf[_0x51e21e(0x1d6)]),'messages':_0x558caf[_0x51e21e(0x1d6)]?.[_0x51e21e(0x1ac)](_0x4af7d1=>({'role':_0x4af7d1[_0x51e21e(0x24f)],'content':_0x4af7d1['content']})),'request_content':{'query':_0x4be38b['data'][_0x51e21e(0x1db)],'repo_path':_0x4be38b[_0x51e21e(0x1f9)]['repo_path'],'repoRoot':a0_0x369cc9[_0x51e21e(0x1bf)](_0x4be38b[_0x51e21e(0x1f9)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x4c8359?.[_0x51e21e(0x21e)]||undefined,'source':'mcp-filesystem'})[_0x51e21e(0x273)](()=>{});}else _0x553d63=_0x51e21e(0x1c2);}return{'content':[{'type':'text','text':_0x553d63}]};}catch(_0xf48713){const _0x433114=_0xf48713 instanceof Error?_0xf48713[_0x51e21e(0x267)]:String(_0xf48713),_0x103f95=_0x433114[_0x51e21e(0x22c)]()[_0x51e21e(0x248)](_0x51e21e(0x1be))||_0x433114[_0x51e21e(0x22c)]()['includes'](_0x51e21e(0x1fb))||_0x433114[_0x51e21e(0x22c)]()[_0x51e21e(0x248)]('etimedout')||_0xf48713 instanceof Error&&_0xf48713[_0x51e21e(0x221)]==='TimeoutError';return reportMorphError({'error_message':_0x433114,'error_type':_0x103f95?'TimeoutError':_0xf48713 instanceof Error?_0xf48713[_0x51e21e(0x1d1)][_0x51e21e(0x221)]:_0x51e21e(0x205),'context':{'tool':_0x51e21e(0x1aa),'repo_path':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)],'query':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1db)],'model':_0x51e21e(0x1e3),'is_timeout':_0x103f95,'exception_phase':_0x51e21e(0x1f3),'request_content':{'query':_0x4be38b['data'][_0x51e21e(0x1db)],'repo_path':_0x4be38b[_0x51e21e(0x1f9)][_0x51e21e(0x1d7)],'repoRoot':a0_0x369cc9[_0x51e21e(0x1bf)](_0x4be38b['data'][_0x51e21e(0x1d7)]),'model':_0x51e21e(0x1e3)}},'stack_trace':_0xf48713 instanceof Error?_0xf48713['stack']:undefined,'source':'mcp-filesystem'})[_0x51e21e(0x273)](()=>{}),{'content':[{'type':_0x51e21e(0x241),'text':_0x51e21e(0x242)+_0x433114}],'isError':![]};}}case _0x51e21e(0x1fc):{const _0x1c0696=CodebaseSearchArgsSchema[_0x51e21e(0x19b)](_0xde3037);if(!_0x1c0696[_0x51e21e(0x1a0)])return{'content':[{'type':_0x51e21e(0x241),'text':'Invalid\x20arguments:\x20'+_0x1c0696[_0x51e21e(0x1a8)]}],'isError':!![]};try{const _0x5f0e8f=MORPH_API_KEY;if(!_0x5f0e8f)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x29e81c=await executeCodebaseSearch({'query':_0x1c0696[_0x51e21e(0x1f9)][_0x51e21e(0x23b)],'target_directories':_0x1c0696[_0x51e21e(0x1f9)][_0x51e21e(0x1af)],'limit':_0x1c0696[_0x51e21e(0x1f9)][_0x51e21e(0x1cc)]},{'apiKey':_0x5f0e8f,'repoId':_0x1c0696['data'][_0x51e21e(0x264)],'branch':_0x1c0696[_0x51e21e(0x1f9)][_0x51e21e(0x1b2)],'commitHash':_0x1c0696[_0x51e21e(0x1f9)][_0x51e21e(0x20a)],'debug':![]});if(!_0x29e81c['success'])return{'content':[{'type':_0x51e21e(0x241),'text':_0x51e21e(0x1f1)+_0x29e81c[_0x51e21e(0x1a8)]}],'isError':!![]};const _0x3c4b3a=_0x29e81c[_0x51e21e(0x277)][_0x51e21e(0x27b)]===0x0?_0x51e21e(0x209)+_0x1c0696[_0x51e21e(0x1f9)][_0x51e21e(0x23b)]+'\x22':_0x51e21e(0x1c7)+_0x29e81c[_0x51e21e(0x277)][_0x51e21e(0x27b)]+'\x20results\x20in\x20'+_0x29e81c[_0x51e21e(0x1fd)][_0x51e21e(0x220)]+'ms:\x0a\x0a'+_0x29e81c[_0x51e21e(0x277)][_0x51e21e(0x1ac)]((_0x33b01c,_0x4d98a5)=>_0x4d98a5+0x1+'.\x20'+_0x33b01c[_0x51e21e(0x215)]+'\x20('+(_0x33b01c[_0x51e21e(0x251)]*0x64)[_0x51e21e(0x233)](0x1)+'%\x20match)\x0a'+(_0x51e21e(0x1ae)+_0x33b01c[_0x51e21e(0x26e)]+'-'+_0x33b01c[_0x51e21e(0x238)]+'\x0a')+('\x20\x20\x20'+_0x33b01c['content'][_0x51e21e(0x23c)](0x0,0xc8)+(_0x33b01c['content'][_0x51e21e(0x27b)]>0xc8?'...':'')+'\x0a'))[_0x51e21e(0x260)]('\x0a');return{'content':[{'type':'text','text':_0x3c4b3a}]};}catch(_0x2a56dc){const _0x51c7af=_0x2a56dc instanceof Error?_0x2a56dc[_0x51e21e(0x267)]:String(_0x2a56dc);return reportMorphError({'error_message':_0x51c7af,'error_type':_0x2a56dc instanceof Error?_0x2a56dc[_0x51e21e(0x1d1)][_0x51e21e(0x221)]:_0x51e21e(0x205),'context':{'tool':'codebase_search','query':_0x1c0696['data'][_0x51e21e(0x23b)],'repo_id':_0x1c0696['data'][_0x51e21e(0x264)]},'stack_trace':_0x2a56dc instanceof Error?_0x2a56dc[_0x51e21e(0x21e)]:undefined,'source':_0x51e21e(0x240)})['catch'](()=>{}),{'content':[{'type':'text','text':_0x51e21e(0x1e0)+_0x51c7af}],'isError':!![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x69a882);}}catch(_0x189dfc){const _0x20ba10=_0x189dfc instanceof Error?_0x189dfc[_0x51e21e(0x267)]:String(_0x189dfc);return reportMorphError({'error_message':_0x20ba10,'error_type':_0x189dfc instanceof Error?_0x189dfc[_0x51e21e(0x1d1)][_0x51e21e(0x221)]:'UnknownError','context':{'tool':name,'arguments':args?JSON[_0x51e21e(0x1f5)](args)[_0x51e21e(0x23c)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x189dfc instanceof Error?_0x189dfc[_0x51e21e(0x21e)]:undefined,'source':_0x51e21e(0x240)})[_0x51e21e(0x273)](()=>{}),{'content':[{'type':_0x51e21e(0x241),'text':'Error:\x20'+_0x20ba10}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2f5524){const _0x175dbd=a0_0xdab3d8,_0x2dd379=await getValidRootDirectories(_0x2f5524);if(_0x2dd379['length']>0x0)allowedDirectories=[..._0x2dd379],console[_0x175dbd(0x1a8)](_0x175dbd(0x252)+_0x2dd379[_0x175dbd(0x27b)]+_0x175dbd(0x217));else{console[_0x175dbd(0x1a8)](_0x175dbd(0x21d));if(ENABLE_WORKSPACE_MODE)try{const _0x52a02e=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x52a02e&&(allowedDirectories=[_0x52a02e],console[_0x175dbd(0x1a8)](_0x175dbd(0x1bd)+_0x52a02e));}catch(_0x3670c5){console[_0x175dbd(0x1a8)]('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x3670c5);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x73c126=a0_0xdab3d8;try{const _0x4e92c3=await server[_0x73c126(0x1cf)]();_0x4e92c3&&_0x73c126(0x1d8)in _0x4e92c3&&await updateAllowedDirectoriesFromRoots(_0x4e92c3[_0x73c126(0x1d8)]);}catch(_0x187d29){console[_0x73c126(0x1a8)](_0x73c126(0x24b),_0x187d29 instanceof Error?_0x187d29['message']:String(_0x187d29));}}),server[a0_0xdab3d8(0x1d5)]=async()=>{const _0x3ad1d6=a0_0xdab3d8,_0x40a0c7=server['getClientCapabilities']();if(_0x40a0c7?.[_0x3ad1d6(0x1d8)])try{const _0x3654ef=await server['listRoots']();_0x3654ef&&'roots'in _0x3654ef?await updateAllowedDirectoriesFromRoots(_0x3654ef['roots']):console[_0x3ad1d6(0x1a8)]('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x51069c){console[_0x3ad1d6(0x1a8)](_0x3ad1d6(0x27c),_0x51069c instanceof Error?_0x51069c['message']:String(_0x51069c));}else{if(allowedDirectories[_0x3ad1d6(0x27b)]>0x0)console[_0x3ad1d6(0x1a8)](_0x3ad1d6(0x270),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x3ad1d6(0x1a8)](_0x3ad1d6(0x22a));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 _0x18de9e=a0_0xdab3d8,_0x38994c=new StdioServerTransport();await server[_0x18de9e(0x1dd)](_0x38994c),console[_0x18de9e(0x1a8)](_0x18de9e(0x1f2)),allowedDirectories['length']===0x0&&console[_0x18de9e(0x1a8)](_0x18de9e(0x1e7));}runServer()[a0_0xdab3d8(0x273)](_0x5143f6=>{const _0x50bc74=a0_0xdab3d8;console[_0x50bc74(0x1a8)](_0x50bc74(0x20c),_0x5143f6),process[_0x50bc74(0x236)](0x1);});
|
|
2
|
+
const a0_0x57d526=a0_0xbbd4;(function(_0x25527f,_0xb8d2a8){const _0x26198d=a0_0xbbd4,_0xb8afcc=_0x25527f();while(!![]){try{const _0x2049c5=parseInt(_0x26198d(0x281))/0x1*(parseInt(_0x26198d(0x1f8))/0x2)+parseInt(_0x26198d(0x20e))/0x3+-parseInt(_0x26198d(0x2b5))/0x4*(parseInt(_0x26198d(0x22d))/0x5)+-parseInt(_0x26198d(0x25c))/0x6+-parseInt(_0x26198d(0x255))/0x7+parseInt(_0x26198d(0x1f4))/0x8+parseInt(_0x26198d(0x257))/0x9*(-parseInt(_0x26198d(0x29b))/0xa);if(_0x2049c5===_0xb8d2a8)break;else _0xb8afcc['push'](_0xb8afcc['shift']());}catch(_0x13469a){_0xb8afcc['push'](_0xb8afcc['shift']());}}}(a0_0x156e,0x459fe));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x156e(){const _0x518dca=['-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','https://morphllm.com/api/error-report','string','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','toLowerCase','repeat','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','length','WORKSPACE_ROOT','10iGRQgv','basename','message','Preview\x20changes\x20without\x20applying\x20them.','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','match','all','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','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','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','create\x20this\x20file','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','target_directories','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','env','assistant','runWarpGrep_call','Created\x20File','codebase_search','inputSchema','Successfully\x20','Error\x20accessing\x20directory\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','roots','332pTBenH','repoId','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','pyproject.toml','timings','morph-mcp','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','edit_file','sep','push','Fatal\x20error\x20running\x20server:','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','substring','ms:\x0a\x0a','MORPH_WARP_GREP_TIMEOUT','Error\x20running\x20fast\x20context\x20search:\x20','files','...','list_directory\x20','MORPH_API_URL','source','isDirectory','created','catch','Rules:\x0a','branch','join','-\x20Listed\x20directory\x20`','timed\x20out','<file\x20path=\x22','errors','unknown\x20error','\x20results\x20in\x20','split','Found\x20','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','Use\x20dryRun=false\x20to\x20','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','Failed\x20to\x20read\x20file:\x20','normalize','floor','WarpGrepError','Warning:\x20Workspace\x20fallback\x20failed:\x20','grep\x20\x27','Unknown\x20tool:\x20','1227104TBcjxF','\x0a...\x20(truncated,\x20total:\x20','\x20\x20\x20Lines\x20','ENABLED_TOOLS','64gKJIgx','startLine','role','🔍\x20Morph\x20Edit\x20Preview','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','safeParse','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','resolve','instruction','number','Morph\x20FastApply\x20failed\x20without\x20error\x20message','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','No\x20results\x20found\x20for\x20query:\x20\x22','utf-8','optional','FileReadError','Error:\x20','object','Warning:\x20','map','153042PpmiOZ','morph-v3-fast','oninitialized','array','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','-\x20Read\x20file\x20`','getClientCapabilities','path','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','listRoots','apply\x20these\x20changes','MORPH_API_KEY','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','toFixed','filepath','\x20-\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','isArray','0.2.0','access','Max\x20results\x20to\x20return','Cargo.toml','tsconfig.json','etimedout','timeout','content','filter','data','code','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','6070kcKnXN','error','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','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','warpgrep_codebase_search','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','ENABLE_WORKSPACE_MODE','\x20(new\x20file)','</file>','messages','application/json','Workspace\x20mode\x20enabled:\x20Using\x20','completed','toISOString','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','diff\x0a','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','TimeoutError','cwd','post','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','Natural\x20language\x20query\x20to\x20search\x20for\x20code','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','repo_path','text','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','PWD','every','argv','query','terminationReason','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','Repository\x20identifier','code_edit','readFile','startsWith','default','exit','Applied','metadata','318661wozijM','For\x20deletions:\x0a','1210950MhCuvl','success','-\x20Grepped\x20\x27','morph-warp-grep-v1-1111v0','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','46950cvdgyx','trim','Search\x20failed:\x20','Fallback:\x20Using\x20workspace\x20root\x20','connect','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','mcp-filesystem','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','results','search_string','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','go.mod','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','stack','Invalid\x20arguments:\x20','requiresApiKey','package.json','\x22>\x0aError\x20reading\x20file:\x20','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','dryRun','finish','ENOENT','params','slice','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','realpath','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','UnknownError','.cursor','lines','includes','endLine','stat','11545BQxOkm','Parent\x20directory\x20does\x20not\x20exist:\x20','Benefits:\x0a','stringify','setRequestHandler','describe','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','name','boolean','constructor','description','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','\x20is\x20not\x20a\x20directory','Unknown\x20error','dirname','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'];a0_0x156e=function(){return _0x518dca;};return a0_0x156e();}import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x2d2303 from'fs/promises';import a0_0x2aed09 from'path';import a0_0x292f99 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_0x33c09c from'axios';function fixPathRepetition(_0x40fdb0){const _0x541b90=a0_0xbbd4,_0x4d3204=_0x40fdb0['split'](a0_0x2aed09[_0x541b90(0x2bd)])[_0x541b90(0x229)](Boolean);if(_0x4d3204['length']<0x2)return null;for(let _0x25ba37=Math[_0x541b90(0x1ef)](_0x4d3204['length']/0x2);_0x25ba37>=0x1;_0x25ba37--){for(let _0x590093=0x0;_0x590093<=_0x4d3204[_0x541b90(0x299)]-0x2*_0x25ba37;_0x590093++){const _0x39aed8=_0x4d3204[_0x541b90(0x274)](_0x590093,_0x590093+_0x25ba37),_0x2b4672=_0x4d3204[_0x541b90(0x274)](_0x590093+_0x25ba37,_0x590093+0x2*_0x25ba37);if(_0x39aed8[_0x541b90(0x248)]((_0x2af23d,_0x51f7a0)=>_0x2af23d===_0x2b4672[_0x51f7a0])){const _0x4ce05a=[..._0x4d3204[_0x541b90(0x274)](0x0,_0x590093),..._0x4d3204[_0x541b90(0x274)](_0x590093+_0x25ba37)];return a0_0x2aed09[_0x541b90(0x2bd)]+_0x4ce05a[_0x541b90(0x1e1)](a0_0x2aed09[_0x541b90(0x2bd)]);}}}return null;}const args=process[a0_0x57d526(0x249)][a0_0x57d526(0x274)](0x2),ALL_TOOLS=[a0_0x57d526(0x2bc),a0_0x57d526(0x231),a0_0x57d526(0x2af)],DEFAULT_TOOLS=[a0_0x57d526(0x2bc),a0_0x57d526(0x231)],ENABLED_TOOLS=process[a0_0x57d526(0x2ab)][a0_0x57d526(0x1f7)]?process[a0_0x57d526(0x2ab)][a0_0x57d526(0x1f7)]===a0_0x57d526(0x2a1)?ALL_TOOLS:process[a0_0x57d526(0x2ab)]['ENABLED_TOOLS']['split'](',')[a0_0x57d526(0x20d)](_0x5e795f=>_0x5e795f[a0_0x57d526(0x25d)]()):DEFAULT_TOOLS;console[a0_0x57d526(0x22e)]('Enabled\x20tools:\x20'+ENABLED_TOOLS[a0_0x57d526(0x1e1)](',\x20'));const WORKSPACE_ROOT=process[a0_0x57d526(0x2ab)][a0_0x57d526(0x29a)]||process[a0_0x57d526(0x2ab)][a0_0x57d526(0x247)]||process[a0_0x57d526(0x23f)](),ENABLE_WORKSPACE_MODE=process[a0_0x57d526(0x2ab)][a0_0x57d526(0x233)]!=='false',MORPH_API_KEY=process['env'][a0_0x57d526(0x219)],MORPH_API_URL=process[a0_0x57d526(0x2ab)][a0_0x57d526(0x2c8)],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x57d526(0x2c3)]?parseInt(process[a0_0x57d526(0x2ab)][a0_0x57d526(0x2c3)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x57d526(0x250)]('sk-')&&!MORPH_API_KEY['startsWith']('morph-')&&console[a0_0x57d526(0x22e)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x1c17d5){const _0x29f940=a0_0x57d526;try{await a0_0x33c09c[_0x29f940(0x240)](_0x29f940(0x293),{..._0x1c17d5,'timestamp':new Date()[_0x29f940(0x23a)](),'source':_0x1c17d5[_0x29f940(0x2c9)]||'mcp-filesystem'},{'timeout':0x1388,'headers':{'Content-Type':_0x29f940(0x237),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x57d526(0x299)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x57d526(0x22e)](a0_0x57d526(0x2aa)),console[a0_0x57d526(0x22e)](a0_0x57d526(0x21a)),console['error'](a0_0x57d526(0x291)),console[a0_0x57d526(0x22e)](a0_0x57d526(0x263)),console[a0_0x57d526(0x22e)]('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console[a0_0x57d526(0x22e)](a0_0x57d526(0x243)));function a0_0xbbd4(_0x170321,_0x2ae1fd){_0x170321=_0x170321-0x1de;const _0x156ef6=a0_0x156e();let _0xbbd40a=_0x156ef6[_0x170321];return _0xbbd40a;}function normalizePath(_0xe3d57d){const _0x46ce8f=a0_0x57d526;return a0_0x2aed09[_0x46ce8f(0x1ee)](_0xe3d57d);}function expandHome(_0x2aa376){const _0x381d85=a0_0x57d526;if(_0x2aa376['startsWith']('~/')||_0x2aa376==='~')return a0_0x2aed09['join'](a0_0x292f99['homedir'](),_0x2aa376[_0x381d85(0x274)](0x1));return _0x2aa376;}let allowedDirectories=await Promise['all'](args[a0_0x57d526(0x20d)](async _0xbdce18=>{const _0x4ad422=a0_0x57d526,_0x4f29f8=expandHome(_0xbdce18),_0x3e8362=a0_0x2aed09[_0x4ad422(0x201)](_0x4f29f8);try{const _0x4fe63e=await a0_0x2d2303[_0x4ad422(0x277)](_0x3e8362);return normalizePath(_0x4fe63e);}catch(_0x2bf52d){return normalizePath(_0x3e8362);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x57d526(0x2be)](workspaceDir),console[a0_0x57d526(0x22e)](a0_0x57d526(0x238)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x5b0aea){console['error'](a0_0x57d526(0x275)+a0_0x5b0aea);}async function detectWorkspaceRoot(_0x4f135f){const _0x5ec91d=a0_0x57d526;let _0x3e18e3=a0_0x2aed09[_0x5ec91d(0x201)](_0x4f135f);const _0x4a7eb9=['.git','.vscode',_0x5ec91d(0x26d),_0x5ec91d(0x224),_0x5ec91d(0x2b8),_0x5ec91d(0x267),_0x5ec91d(0x27c),_0x5ec91d(0x225),'composer.json'];while(_0x3e18e3!==a0_0x2aed09[_0x5ec91d(0x290)](_0x3e18e3)){for(const _0x10ea90 of _0x4a7eb9){const _0x2b10fc=a0_0x2aed09[_0x5ec91d(0x1e1)](_0x3e18e3,_0x10ea90);try{return await a0_0x2d2303[_0x5ec91d(0x222)](_0x2b10fc),normalizePath(_0x3e18e3);}catch{}}_0x3e18e3=a0_0x2aed09[_0x5ec91d(0x290)](_0x3e18e3);}return normalizePath(_0x4f135f);}await Promise['all'](args[a0_0x57d526(0x20d)](async _0x575860=>{const _0x2e0170=a0_0x57d526;try{const _0x4b3d08=await a0_0x2d2303[_0x2e0170(0x280)](expandHome(_0x575860));!_0x4b3d08[_0x2e0170(0x2ca)]()&&(console[_0x2e0170(0x22e)](_0x2e0170(0x20a)+_0x575860+_0x2e0170(0x28e)),process[_0x2e0170(0x252)](0x1));}catch(_0x368002){console[_0x2e0170(0x22e)](_0x2e0170(0x2b2)+_0x575860+':',_0x368002),process[_0x2e0170(0x252)](0x1);}}));async function validatePath(_0x58a32e){const _0x5bd136=a0_0x57d526,_0x4f55d1=expandHome(_0x58a32e),_0x4c62a9=a0_0x2aed09[_0x5bd136(0x201)](_0x4f55d1);try{const _0x5b6f68=await a0_0x2d2303[_0x5bd136(0x277)](_0x4c62a9);return _0x5b6f68;}catch(_0x1fd2f3){if(_0x1fd2f3['code']==='ENOENT'){const _0x444660=a0_0x2aed09[_0x5bd136(0x290)](_0x4c62a9);try{const _0x7ea4ea=await a0_0x2d2303[_0x5bd136(0x277)](_0x444660);return a0_0x2aed09[_0x5bd136(0x1e1)](_0x7ea4ea,a0_0x2aed09[_0x5bd136(0x29c)](_0x4c62a9));}catch{throw new Error(_0x5bd136(0x282)+_0x444660);}}throw _0x1fd2f3;}}const MorphEditFileArgsSchema=z[a0_0x57d526(0x20b)]({'path':z[a0_0x57d526(0x294)](),'code_edit':z['string']()[a0_0x57d526(0x286)](a0_0x57d526(0x232)),'instruction':z['string']()[a0_0x57d526(0x286)](a0_0x57d526(0x279)),'dryRun':z[a0_0x57d526(0x28a)]()[a0_0x57d526(0x251)](![])[a0_0x57d526(0x286)](a0_0x57d526(0x29e))}),WarpGrepArgsSchema=z[a0_0x57d526(0x20b)]({'search_string':z[a0_0x57d526(0x294)]()[a0_0x57d526(0x286)](a0_0x57d526(0x2a2)),'repo_path':z[a0_0x57d526(0x294)]()[a0_0x57d526(0x286)](a0_0x57d526(0x298))}),CodebaseSearchArgsSchema=z[a0_0x57d526(0x20b)]({'query':z[a0_0x57d526(0x294)]()['describe'](a0_0x57d526(0x242)),'repoId':z[a0_0x57d526(0x294)]()[a0_0x57d526(0x286)](a0_0x57d526(0x24d)),'branch':z[a0_0x57d526(0x294)]()[a0_0x57d526(0x208)]()['describe'](a0_0x57d526(0x23d)),'commitHash':z[a0_0x57d526(0x294)]()[a0_0x57d526(0x208)]()[a0_0x57d526(0x286)]('Specific\x20commit\x20hash\x20to\x20search'),'target_directories':z[a0_0x57d526(0x211)](z[a0_0x57d526(0x294)]())[a0_0x57d526(0x251)]([])['describe']('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x57d526(0x203)]()[a0_0x57d526(0x208)]()[a0_0x57d526(0x251)](0xa)['describe'](a0_0x57d526(0x223))}),server=new Server({'name':a0_0x57d526(0x2ba),'version':a0_0x57d526(0x221)},{'capabilities':{'tools':{}}});server[a0_0x57d526(0x285)](ListToolsRequestSchema,async()=>{const _0x751ef1=a0_0x57d526,_0x1c5394=[{'name':_0x751ef1(0x2bc),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x751ef1(0x22f)+_0x751ef1(0x29f)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0x751ef1(0x283)+_0x751ef1(0x287)+_0x751ef1(0x205)+_0x751ef1(0x1ff)+_0x751ef1(0x268)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x751ef1(0x200)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x751ef1(0x256)+_0x751ef1(0x288)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x751ef1(0x1df)+_0x751ef1(0x23b)+_0x751ef1(0x2c0)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x751ef1(0x292)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x751ef1(0x230),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x751ef1(0x2a6)+_0x751ef1(0x2a3)+_0x751ef1(0x25b)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+_0x751ef1(0x269)+_0x751ef1(0x216)+_0x751ef1(0x24c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x751ef1(0x2af),'description':_0x751ef1(0x2a8)+_0x751ef1(0x241)+_0x751ef1(0x2b7)+_0x751ef1(0x283)+_0x751ef1(0x26f)+_0x751ef1(0x2bb)+_0x751ef1(0x1fd)+_0x751ef1(0x21f)+_0x751ef1(0x1ec)+_0x751ef1(0x1ea)+_0x751ef1(0x295),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x25493d=_0x1c5394[_0x751ef1(0x229)](_0x548a51=>{const _0x198352=_0x751ef1;if(!ENABLED_TOOLS[_0x198352(0x27e)](_0x548a51['name']))return![];if(_0x198352(0x26c)in _0x548a51&&_0x548a51[_0x198352(0x26c)]&&!MORPH_API_KEY)return console['error'](_0x198352(0x20c)+_0x548a51[_0x198352(0x289)]+_0x198352(0x2a4)),![];return!![];});return{'tools':_0x25493d[_0x751ef1(0x20d)](_0x5ef183=>({'name':_0x5ef183['name'],'description':_0x5ef183[_0x751ef1(0x28c)],'inputSchema':_0x5ef183[_0x751ef1(0x2b0)]}))};}),server[a0_0x57d526(0x285)](CallToolRequestSchema,async _0xc58ca=>{const _0x221fd8=a0_0x57d526;try{const {name:_0x276ec0,arguments:_0x2187e0}=_0xc58ca[_0x221fd8(0x273)];switch(_0x276ec0){case _0x221fd8(0x2bc):{const _0x364699=MorphEditFileArgsSchema['safeParse'](_0x2187e0);if(!_0x364699[_0x221fd8(0x258)])throw new Error(_0x221fd8(0x1fc)+_0x364699[_0x221fd8(0x22e)]);const _0x3bdc9c=await validatePath(_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x215)]);let _0x549bc7=null,_0x4cf51b=!![],_0x7414a0=null;try{_0x549bc7=await a0_0x2d2303['readFile'](_0x3bdc9c,_0x221fd8(0x207));}catch(_0x37985f){const _0x3a66b0=_0x37985f[_0x221fd8(0x22b)];_0x3a66b0===_0x221fd8(0x272)?(_0x4cf51b=![],_0x549bc7=''):(_0x7414a0=_0x221fd8(0x1ed)+(_0x3a66b0||'unknown')+_0x221fd8(0x21d)+(_0x37985f instanceof Error?_0x37985f[_0x221fd8(0x29d)]:String(_0x37985f)),console[_0x221fd8(0x22e)](_0x221fd8(0x20c)+_0x7414a0));}try{const _0x34a41b=MORPH_API_KEY;if(!_0x34a41b)throw new Error(_0x221fd8(0x266));const _0x14f259=a0_0x2aed09[_0x221fd8(0x290)](_0x3bdc9c),_0x920477=a0_0x2aed09[_0x221fd8(0x29c)](_0x3bdc9c),_0x195ecc=await executeEditFile({'target_filepath':_0x920477,'code_edit':_0x364699[_0x221fd8(0x22a)]['code_edit'],'instructions':_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x202)]},{'morphApiKey':_0x34a41b,'morphApiUrl':MORPH_API_URL,'baseDir':_0x14f259,'autoWrite':!_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x270)],'generateUdiff':!![],'debug':![]});if(!_0x195ecc[_0x221fd8(0x258)])throw new Error(_0x195ecc[_0x221fd8(0x22e)]||_0x221fd8(0x204));const _0x44328e=_0x195ecc['udiff']||'';let _0x36839a=0x3;while(_0x44328e[_0x221fd8(0x27e)]('`'[_0x221fd8(0x297)](_0x36839a))){_0x36839a++;}const _0x3bc0f8='`'[_0x221fd8(0x297)](_0x36839a)+_0x221fd8(0x23c)+_0x44328e+'`'[_0x221fd8(0x297)](_0x36839a)+'\x0a\x0a';if(_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x270)])return{'content':[{'type':_0x221fd8(0x245),'text':_0x221fd8(0x1fb)+(_0x4cf51b?'':_0x221fd8(0x234))+':\x20'+_0x364699[_0x221fd8(0x22a)]['instruction']+'\x0a\x0a'+_0x3bc0f8+_0x221fd8(0x1eb)+(_0x4cf51b?_0x221fd8(0x218):_0x221fd8(0x2a5))+'.'}]};return{'content':[{'type':_0x221fd8(0x245),'text':'Morph\x20Edit\x20'+(_0x4cf51b?_0x221fd8(0x253):_0x221fd8(0x2ae))+':\x20'+_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x202)]+'\x0a\x0a'+_0x3bc0f8+_0x221fd8(0x2b1)+(_0x4cf51b?'applied\x20edits\x20to':_0x221fd8(0x2cb))+'\x20'+_0x364699['data'][_0x221fd8(0x215)]}]};}catch(_0x4262bc){const _0x3464d0=_0x4262bc instanceof Error?_0x4262bc[_0x221fd8(0x29d)]:String(_0x4262bc);return reportMorphError({'error_message':_0x3464d0,'error_type':_0x4262bc instanceof Error?_0x4262bc[_0x221fd8(0x28b)]['name']:'UnknownError','context':{'tool':_0x221fd8(0x2bc),'file_path':_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x215)],'validated_path':_0x3bdc9c,'instruction':_0x364699['data'][_0x221fd8(0x202)],'model':_0x221fd8(0x20f),'dry_run':_0x364699['data'][_0x221fd8(0x270)],'file_exists':_0x4cf51b,'file_read_error':_0x7414a0,'file_readable':_0x549bc7!==null,'request_content':{'path':_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x215)],'code_edit':_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x24e)],'instruction':_0x364699['data'][_0x221fd8(0x202)],'original_code':_0x549bc7!==null?_0x549bc7[_0x221fd8(0x299)]>0xc350?_0x549bc7[_0x221fd8(0x2c1)](0x0,0xc350)+_0x221fd8(0x1f5)+_0x549bc7['length']+'\x20chars)':_0x549bc7:'[could\x20not\x20read\x20file:\x20'+(_0x7414a0||_0x221fd8(0x1e6))+']','original_code_length':_0x549bc7?.[_0x221fd8(0x299)]??0x0,'model':_0x221fd8(0x20f),'dry_run':_0x364699[_0x221fd8(0x22a)][_0x221fd8(0x270)]}},'stack_trace':_0x4262bc instanceof Error?_0x4262bc[_0x221fd8(0x26a)]:undefined,'source':_0x221fd8(0x262)})['catch'](()=>{}),{'content':[{'type':_0x221fd8(0x245),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x3464d0}],'isError':!![]};}}case _0x221fd8(0x231):{const _0x2a75ce=WarpGrepArgsSchema[_0x221fd8(0x1fe)](_0x2187e0);if(!_0x2a75ce['success'])return{'content':[{'type':'text','text':_0x221fd8(0x26b)+_0x2a75ce[_0x221fd8(0x22e)]}],'isError':!![]};const _0x1c1d0b=_0x55b2c6=>{const _0x4b1973=_0x221fd8,_0x3c47ce=[];for(const _0x1c41f5 of _0x55b2c6||[]){const _0x5a2644=_0x1c41f5[_0x4b1973(0x1fa)],_0x8d7bd5=_0x1c41f5[_0x4b1973(0x228)];if(_0x5a2644===_0x4b1973(0x2ac)&&_0x8d7bd5){const _0x7e845c=_0x8d7bd5[_0x4b1973(0x1e8)]('\x0a')[_0x4b1973(0x229)](_0x3330ed=>_0x3330ed[_0x4b1973(0x25d)]());for(const _0x137f5d of _0x7e845c){const _0x1b7306=_0x137f5d['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1b7306){_0x3c47ce['push'](_0x4b1973(0x1f2)+_0x1b7306[0x1]+'\x27\x20'+_0x1b7306[0x2]);continue;}const _0x1a7c90=_0x137f5d[_0x4b1973(0x2a0)](/^read\s+(.+)$/);if(_0x1a7c90){_0x3c47ce[_0x4b1973(0x2be)]('read\x20'+_0x1a7c90[0x1]);continue;}const _0x3500c8=_0x137f5d[_0x4b1973(0x2a0)](/^list_directory\s+(.+)$/);if(_0x3500c8){_0x3c47ce[_0x4b1973(0x2be)](_0x4b1973(0x2c7)+_0x3500c8[0x1]);continue;}}}}return _0x3c47ce;};try{const _0x262862=a0_0x2aed09[_0x221fd8(0x201)](_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x244)]),_0xa11335=new LocalRipgrepProvider(_0x262862),_0x16b444=await runWarpGrep({'query':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x265)],'repoRoot':_0x262862,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xa11335});let _0x491510='';if(_0x16b444[_0x221fd8(0x24b)]===_0x221fd8(0x239)&&_0x16b444[_0x221fd8(0x271)]?.[_0x221fd8(0x254)]?.[_0x221fd8(0x2c5)]){const _0x4c8bfd=_0x16b444[_0x221fd8(0x271)]['metadata'][_0x221fd8(0x2c5)],_0x3c007d=[],_0x6e502d=[_0x221fd8(0x27a)];for(const _0x46ea53 of _0x16b444['messages']){const _0x598ba4=_0x46ea53[_0x221fd8(0x1fa)],_0x4a7673=_0x46ea53['content'];if(_0x598ba4===_0x221fd8(0x2ac)&&_0x4a7673){const _0x4bde27=_0x4a7673[_0x221fd8(0x1e8)]('\x0a')[_0x221fd8(0x229)](_0x4dceee=>_0x4dceee[_0x221fd8(0x25d)]());for(const _0xa1185f of _0x4bde27){const _0x2af505=_0xa1185f[_0x221fd8(0x2a0)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x2af505){_0x6e502d[_0x221fd8(0x2be)](_0x221fd8(0x259)+_0x2af505[0x1]+'\x27\x20in\x20`'+_0x2af505[0x2]+'`');continue;}const _0xce990a=_0xa1185f['match'](/^read\s+(.+)$/);if(_0xce990a){_0x6e502d[_0x221fd8(0x2be)](_0x221fd8(0x213)+_0xce990a[0x1]+'`');continue;}const _0x3aaf85=_0xa1185f[_0x221fd8(0x2a0)](/^list_directory\s+(.+)$/);if(_0x3aaf85){_0x6e502d['push'](_0x221fd8(0x1e2)+_0x3aaf85[0x1]+'`');continue;}}}}_0x3c007d[_0x221fd8(0x2be)](_0x6e502d[_0x221fd8(0x1e1)]('\x0a'));const _0xb341e3=['','Relevant\x20context\x20found:'];for(const _0x91665d of _0x4c8bfd){if(_0x91665d['lines']==='*')_0xb341e3[_0x221fd8(0x2be)]('-\x20'+_0x91665d[_0x221fd8(0x215)]+':*');else{if(Array['isArray'](_0x91665d[_0x221fd8(0x27d)])){const _0x3cdd6b=_0x91665d[_0x221fd8(0x27d)][_0x221fd8(0x20d)](([_0x27ae78,_0x50dada])=>{if(_0x27ae78===_0x50dada)return''+_0x27ae78;return _0x27ae78+'-'+_0x50dada;});_0xb341e3['push']('-\x20'+_0x91665d[_0x221fd8(0x215)]+':'+_0x3cdd6b[_0x221fd8(0x1e1)](','));}else _0xb341e3['push']('-\x20'+_0x91665d[_0x221fd8(0x215)]+':*');}}_0xb341e3[_0x221fd8(0x2be)](''),_0x3c007d['push'](_0xb341e3['join']('\x0a')),_0x3c007d[_0x221fd8(0x2be)](_0x221fd8(0x21e));const _0x33867c=[];for(const _0x576313 of _0x4c8bfd){let _0x320726=a0_0x2aed09[_0x221fd8(0x201)](_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x244)],_0x576313[_0x221fd8(0x215)]),_0xa5420c=null,_0x5ad58e=null;try{_0xa5420c=await a0_0x2d2303[_0x221fd8(0x24f)](_0x320726,{'encoding':_0x221fd8(0x207)});}catch(_0x5abb7b){const _0x477167=fixPathRepetition(_0x320726);if(_0x477167)try{_0xa5420c=await a0_0x2d2303['readFile'](_0x477167,{'encoding':'utf-8'}),_0x320726=_0x477167;}catch{_0x5ad58e=_0x5abb7b instanceof Error?_0x5abb7b:new Error(String(_0x5abb7b));}else _0x5ad58e=_0x5abb7b instanceof Error?_0x5abb7b:new Error(String(_0x5abb7b));}if(_0xa5420c!==null){const _0x4b7d42=_0xa5420c[_0x221fd8(0x1e8)](/\r?\n/),_0x644c46=[_0x221fd8(0x1e4)+_0x576313[_0x221fd8(0x215)]+'\x22>'];if(_0x576313[_0x221fd8(0x27d)]==='*'||!Array[_0x221fd8(0x220)](_0x576313[_0x221fd8(0x27d)]))for(let _0x389da4=0x1;_0x389da4<=_0x4b7d42['length'];_0x389da4++){const _0x33babe=_0x4b7d42[_0x389da4-0x1];_0x644c46[_0x221fd8(0x2be)](_0x389da4+'|\x20'+_0x33babe);}else for(const [_0x492255,_0x19f677]of _0x576313[_0x221fd8(0x27d)]){_0x644c46['length']>0x1&&_0x644c46['push']('');for(let _0x4b302e=_0x492255;_0x4b302e<=_0x19f677&&_0x4b302e<=_0x4b7d42[_0x221fd8(0x299)];_0x4b302e++){const _0x251bf6=_0x4b7d42[_0x4b302e-0x1];_0x644c46[_0x221fd8(0x2be)](_0x4b302e+'|\x20'+_0x251bf6);}}_0x644c46['push'](_0x221fd8(0x235)),_0x33867c['push'](_0x644c46['join']('\x0a'));}else _0x33867c['push']('<file\x20path=\x22'+_0x576313[_0x221fd8(0x215)]+_0x221fd8(0x26e)+(_0x5ad58e?.[_0x221fd8(0x29d)]||_0x221fd8(0x28f))+'\x0a</file>');}_0x3c007d[_0x221fd8(0x2be)](_0x33867c[_0x221fd8(0x1e1)]('\x0a\x0a')),_0x491510=_0x3c007d[_0x221fd8(0x1e1)]('\x0a');const _0x3d9b97=_0x16b444['errors']?.[_0x221fd8(0x229)](_0x176840=>_0x176840[_0x221fd8(0x29d)]?.[_0x221fd8(0x250)]('File\x20read\x20error:'))||[];if(_0x3d9b97[_0x221fd8(0x299)]>0x0){const _0x397dfb=_0x3d9b97['map'](_0x591c13=>_0x591c13[_0x221fd8(0x29d)])[_0x221fd8(0x1e1)](';\x20');reportMorphError({'error_message':_0x397dfb,'error_type':_0x221fd8(0x209),'context':{'tool':_0x221fd8(0x231),'repo_path':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x244)],'query':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x265)],'model':_0x221fd8(0x25a),'termination_reason':'completed_with_file_errors','error_count':_0x3d9b97['length'],'is_timeout':![],'timings':_0x16b444[_0x221fd8(0x2b9)],'files_attempted':_0x4c8bfd[_0x221fd8(0x20d)](_0x512303=>({'path':_0x512303[_0x221fd8(0x215)],'lines':_0x512303[_0x221fd8(0x27d)]})),'tool_calls':_0x1c1d0b(_0x16b444[_0x221fd8(0x236)]),'messages':_0x16b444[_0x221fd8(0x236)]?.['map'](_0x587372=>({'role':_0x587372[_0x221fd8(0x1fa)],'content':_0x587372[_0x221fd8(0x228)]})),'request_content':{'query':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x265)],'repo_path':_0x2a75ce[_0x221fd8(0x22a)]['repo_path'],'repoRoot':a0_0x2aed09[_0x221fd8(0x201)](_0x2a75ce[_0x221fd8(0x22a)]['repo_path']),'model':_0x221fd8(0x25a)}},'source':_0x221fd8(0x262)})['catch'](()=>{});}}else{if(_0x16b444[_0x221fd8(0x24b)]==='terminated'&&_0x16b444[_0x221fd8(0x1e5)][_0x221fd8(0x299)]>0x0){const _0x16a15e=_0x16b444['errors'][_0x221fd8(0x20d)](_0x5058cc=>_0x5058cc[_0x221fd8(0x29d)])[_0x221fd8(0x1e1)](';\x20');_0x491510=_0x221fd8(0x20a)+_0x16a15e;const _0x3b34cf=_0x16a15e[_0x221fd8(0x296)]()[_0x221fd8(0x27e)](_0x221fd8(0x227))||_0x16a15e[_0x221fd8(0x296)]()[_0x221fd8(0x27e)](_0x221fd8(0x1e3))||_0x16a15e['toLowerCase']()[_0x221fd8(0x27e)](_0x221fd8(0x226)),_0x44e777=_0x16b444[_0x221fd8(0x271)]?.[_0x221fd8(0x254)]?.['files'],_0x45b804=_0x16b444['errors'][0x0];reportMorphError({'error_message':_0x16a15e,'error_type':_0x3b34cf?'TimeoutError':_0x45b804?.[_0x221fd8(0x28b)]?.[_0x221fd8(0x289)]||_0x221fd8(0x1f0),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x2a75ce[_0x221fd8(0x22a)]['repo_path'],'query':_0x2a75ce['data']['search_string'],'model':_0x221fd8(0x25a),'termination_reason':_0x16b444[_0x221fd8(0x24b)],'error_count':_0x16b444[_0x221fd8(0x1e5)][_0x221fd8(0x299)],'is_timeout':_0x3b34cf,'timings':_0x16b444[_0x221fd8(0x2b9)],'files_attempted':_0x44e777?.['map'](_0x18937c=>({'path':_0x18937c['path'],'lines':_0x18937c[_0x221fd8(0x27d)]})),'tool_calls':_0x1c1d0b(_0x16b444['messages']),'messages':_0x16b444[_0x221fd8(0x236)]?.[_0x221fd8(0x20d)](_0x3edb80=>({'role':_0x3edb80[_0x221fd8(0x1fa)],'content':_0x3edb80[_0x221fd8(0x228)]})),'request_content':{'query':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x265)],'repo_path':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x244)],'repoRoot':a0_0x2aed09[_0x221fd8(0x201)](_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x244)]),'model':_0x221fd8(0x25a)}},'stack_trace':_0x45b804?.[_0x221fd8(0x26a)]||undefined,'source':_0x221fd8(0x262)})[_0x221fd8(0x1de)](()=>{});}else _0x491510=_0x221fd8(0x22c);}return{'content':[{'type':_0x221fd8(0x245),'text':_0x491510}]};}catch(_0x1618ea){const _0x34182d=_0x1618ea instanceof Error?_0x1618ea[_0x221fd8(0x29d)]:String(_0x1618ea),_0x2e34ce=_0x34182d['toLowerCase']()[_0x221fd8(0x27e)](_0x221fd8(0x227))||_0x34182d[_0x221fd8(0x296)]()['includes'](_0x221fd8(0x1e3))||_0x34182d[_0x221fd8(0x296)]()[_0x221fd8(0x27e)](_0x221fd8(0x226))||_0x1618ea instanceof Error&&_0x1618ea[_0x221fd8(0x289)]===_0x221fd8(0x23e);return reportMorphError({'error_message':_0x34182d,'error_type':_0x2e34ce?_0x221fd8(0x23e):_0x1618ea instanceof Error?_0x1618ea[_0x221fd8(0x28b)]['name']:_0x221fd8(0x27b),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x2a75ce[_0x221fd8(0x22a)]['repo_path'],'query':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x265)],'model':_0x221fd8(0x25a),'is_timeout':_0x2e34ce,'exception_phase':_0x221fd8(0x2ad),'request_content':{'query':_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x265)],'repo_path':_0x2a75ce['data'][_0x221fd8(0x244)],'repoRoot':a0_0x2aed09[_0x221fd8(0x201)](_0x2a75ce[_0x221fd8(0x22a)][_0x221fd8(0x244)]),'model':_0x221fd8(0x25a)}},'stack_trace':_0x1618ea instanceof Error?_0x1618ea['stack']:undefined,'source':_0x221fd8(0x262)})[_0x221fd8(0x1de)](()=>{}),{'content':[{'type':_0x221fd8(0x245),'text':_0x221fd8(0x2c4)+_0x34182d}],'isError':![]};}}case _0x221fd8(0x2af):{const _0x28a063=CodebaseSearchArgsSchema[_0x221fd8(0x1fe)](_0x2187e0);if(!_0x28a063[_0x221fd8(0x258)])return{'content':[{'type':_0x221fd8(0x245),'text':_0x221fd8(0x26b)+_0x28a063[_0x221fd8(0x22e)]}],'isError':!![]};try{const _0x506834=MORPH_API_KEY;if(!_0x506834)throw new Error(_0x221fd8(0x28d));const _0x1ffe5a=await executeCodebaseSearch({'query':_0x28a063[_0x221fd8(0x22a)]['query'],'target_directories':_0x28a063[_0x221fd8(0x22a)][_0x221fd8(0x2a7)],'limit':_0x28a063[_0x221fd8(0x22a)]['limit']},{'apiKey':_0x506834,'repoId':_0x28a063[_0x221fd8(0x22a)][_0x221fd8(0x2b6)],'branch':_0x28a063[_0x221fd8(0x22a)][_0x221fd8(0x1e0)],'commitHash':_0x28a063[_0x221fd8(0x22a)]['commitHash'],'debug':![]});if(!_0x1ffe5a[_0x221fd8(0x258)])return{'content':[{'type':'text','text':_0x221fd8(0x25e)+_0x1ffe5a['error']}],'isError':!![]};const _0x5a2f74=_0x1ffe5a[_0x221fd8(0x264)][_0x221fd8(0x299)]===0x0?_0x221fd8(0x206)+_0x28a063[_0x221fd8(0x22a)][_0x221fd8(0x24a)]+'\x22':_0x221fd8(0x1e9)+_0x1ffe5a[_0x221fd8(0x264)][_0x221fd8(0x299)]+_0x221fd8(0x1e7)+_0x1ffe5a['stats']['searchTimeMs']+_0x221fd8(0x2c2)+_0x1ffe5a[_0x221fd8(0x264)][_0x221fd8(0x20d)]((_0x344088,_0x11eb5a)=>_0x11eb5a+0x1+'.\x20'+_0x344088[_0x221fd8(0x21c)]+'\x20('+(_0x344088['rerankScore']*0x64)[_0x221fd8(0x21b)](0x1)+'%\x20match)\x0a'+(_0x221fd8(0x1f6)+_0x344088[_0x221fd8(0x1f9)]+'-'+_0x344088[_0x221fd8(0x27f)]+'\x0a')+('\x20\x20\x20'+_0x344088[_0x221fd8(0x228)][_0x221fd8(0x2c1)](0x0,0xc8)+(_0x344088[_0x221fd8(0x228)]['length']>0xc8?_0x221fd8(0x2c6):'')+'\x0a'))[_0x221fd8(0x1e1)]('\x0a');return{'content':[{'type':_0x221fd8(0x245),'text':_0x5a2f74}]};}catch(_0x1ec1fa){const _0x1def57=_0x1ec1fa instanceof Error?_0x1ec1fa[_0x221fd8(0x29d)]:String(_0x1ec1fa);return reportMorphError({'error_message':_0x1def57,'error_type':_0x1ec1fa instanceof Error?_0x1ec1fa[_0x221fd8(0x28b)]['name']:_0x221fd8(0x27b),'context':{'tool':_0x221fd8(0x2af),'query':_0x28a063[_0x221fd8(0x22a)]['query'],'repo_id':_0x28a063['data'][_0x221fd8(0x2b6)]},'stack_trace':_0x1ec1fa instanceof Error?_0x1ec1fa[_0x221fd8(0x26a)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x221fd8(0x245),'text':_0x221fd8(0x20a)+_0x1def57}],'isError':!![]};}}default:throw new Error(_0x221fd8(0x1f3)+_0x276ec0);}}catch(_0x4d8649){const _0x30340e=_0x4d8649 instanceof Error?_0x4d8649['message']:String(_0x4d8649);return reportMorphError({'error_message':_0x30340e,'error_type':_0x4d8649 instanceof Error?_0x4d8649[_0x221fd8(0x28b)][_0x221fd8(0x289)]:_0x221fd8(0x27b),'context':{'tool':name,'arguments':args?JSON[_0x221fd8(0x284)](args)[_0x221fd8(0x2c1)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x4d8649 instanceof Error?_0x4d8649[_0x221fd8(0x26a)]:undefined,'source':_0x221fd8(0x262)})[_0x221fd8(0x1de)](()=>{}),{'content':[{'type':_0x221fd8(0x245),'text':_0x221fd8(0x20a)+_0x30340e}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3ba43e){const _0x3b3ebf=a0_0x57d526,_0x1b3a0d=await getValidRootDirectories(_0x3ba43e);if(_0x1b3a0d['length']>0x0)allowedDirectories=[..._0x1b3a0d],console[_0x3b3ebf(0x22e)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x1b3a0d[_0x3b3ebf(0x299)]+'\x20valid\x20directories');else{console[_0x3b3ebf(0x22e)](_0x3b3ebf(0x261));if(ENABLE_WORKSPACE_MODE)try{const _0xe9aeb1=await detectWorkspaceRoot(WORKSPACE_ROOT);_0xe9aeb1&&(allowedDirectories=[_0xe9aeb1],console['error'](_0x3b3ebf(0x25f)+_0xe9aeb1));}catch(_0x179002){console[_0x3b3ebf(0x22e)](_0x3b3ebf(0x1f1)+_0x179002);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x3c977a=a0_0x57d526;try{const _0x4d5a56=await server[_0x3c977a(0x217)]();_0x4d5a56&&'roots'in _0x4d5a56&&await updateAllowedDirectoriesFromRoots(_0x4d5a56[_0x3c977a(0x2b4)]);}catch(_0x3e97bb){console[_0x3c977a(0x22e)]('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x3e97bb instanceof Error?_0x3e97bb['message']:String(_0x3e97bb));}}),server[a0_0x57d526(0x210)]=async()=>{const _0x13ff18=a0_0x57d526,_0x22d524=server[_0x13ff18(0x214)]();if(_0x22d524?.[_0x13ff18(0x2b4)])try{const _0x52c8e6=await server[_0x13ff18(0x217)]();_0x52c8e6&&'roots'in _0x52c8e6?await updateAllowedDirectoriesFromRoots(_0x52c8e6[_0x13ff18(0x2b4)]):console[_0x13ff18(0x22e)](_0x13ff18(0x2b3));}catch(_0x2e9b9e){console[_0x13ff18(0x22e)](_0x13ff18(0x2a9),_0x2e9b9e instanceof Error?_0x2e9b9e[_0x13ff18(0x29d)]:String(_0x2e9b9e));}else{if(allowedDirectories[_0x13ff18(0x299)]>0x0)console['error'](_0x13ff18(0x212),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x13ff18(0x22e)](_0x13ff18(0x276));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 _0x8feaa3=a0_0x57d526,_0x1815eb=new StdioServerTransport();await server[_0x8feaa3(0x260)](_0x1815eb),console[_0x8feaa3(0x22e)](_0x8feaa3(0x246)),allowedDirectories['length']===0x0&&console[_0x8feaa3(0x22e)](_0x8feaa3(0x278));}runServer()[a0_0x57d526(0x1de)](_0x5a51f7=>{const _0x346e0d=a0_0x57d526;console[_0x346e0d(0x22e)](_0x346e0d(0x2bf),_0x5a51f7),process[_0x346e0d(0x252)](0x1);});
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a1_0x5d33(){const _0x5d8c92=['12042UUDRLY','test','match','replace','105369ntFZQo','138894MAhLsX','813sTMKKq','290sgBrnN','trim','5fHunkY','startsWith','456cKJQnS','9312576vMdSet','join','4148ufgvLa','198342mpDOPY','normalize','charAt','178OPSJmp','1423AvoYEC','slice','toUpperCase','/mnt/'];a1_0x5d33=function(){return _0x5d8c92;};return a1_0x5d33();}(function(_0x16b2e6,_0x525841){const _0x5a94c1=a1_0xd9bc,_0x2412a1=_0x16b2e6();while(!![]){try{const _0x7c0d27=-parseInt(_0x5a94c1(0x14a))/0x1*(parseInt(_0x5a94c1(0x149))/0x2)+-parseInt(_0x5a94c1(0x154))/0x3*(parseInt(_0x5a94c1(0x15c))/0x4)+parseInt(_0x5a94c1(0x157))/0x5*(parseInt(_0x5a94c1(0x15d))/0x6)+-parseInt(_0x5a94c1(0x153))/0x7+parseInt(_0x5a94c1(0x159))/0x8*(parseInt(_0x5a94c1(0x14e))/0x9)+parseInt(_0x5a94c1(0x155))/0xa*(-parseInt(_0x5a94c1(0x152))/0xb)+parseInt(_0x5a94c1(0x15a))/0xc;if(_0x7c0d27===_0x525841)break;else _0x2412a1['push'](_0x2412a1['shift']());}catch(_0xeb6b9b){_0x2412a1['push'](_0x2412a1['shift']());}}}(a1_0x5d33,0x2bf60));import a1_0x34a467 from'path';import a1_0x3eb0cf from'os';export function convertToWindowsPath(_0x5279e2){const _0x6a6d12=a1_0xd9bc;if(_0x5279e2[_0x6a6d12(0x158)](_0x6a6d12(0x14d))){const _0x2467c6=_0x5279e2[_0x6a6d12(0x15f)](0x5)[_0x6a6d12(0x14c)](),_0x1ea8a1=_0x5279e2[_0x6a6d12(0x14b)](0x6)['replace'](/\//g,'\x5c');return _0x2467c6+':'+_0x1ea8a1;}if(_0x5279e2['match'](/^\/[a-zA-Z]\//)){const _0x167d21=_0x5279e2['charAt'](0x1)['toUpperCase'](),_0x31b8b4=_0x5279e2[_0x6a6d12(0x14b)](0x2)[_0x6a6d12(0x151)](/\//g,'\x5c');return _0x167d21+':'+_0x31b8b4;}if(_0x5279e2['match'](/^[a-zA-Z]:/))return _0x5279e2['replace'](/\//g,'\x5c');return _0x5279e2;}export function normalizePath(_0x25a709){const _0x224e7d=a1_0xd9bc;_0x25a709=_0x25a709[_0x224e7d(0x156)]()[_0x224e7d(0x151)](/^["']|["']$/g,'');const _0x577bee=_0x25a709[_0x224e7d(0x158)]('/')&&!_0x25a709[_0x224e7d(0x150)](/^\/mnt\/[a-z]\//i)&&!_0x25a709['match'](/^\/[a-zA-Z]\//);if(_0x577bee)return _0x25a709['replace'](/\/+/g,'/')['replace'](/\/+$/,'');_0x25a709=convertToWindowsPath(_0x25a709);if(_0x25a709['startsWith']('\x5c\x5c')){let _0x78110c=_0x25a709;_0x78110c=_0x78110c['replace'](/^\\{2,}/,'\x5c\x5c');const _0x4ec682=_0x78110c['substring'](0x2)[_0x224e7d(0x151)](/\\\\/g,'\x5c');_0x25a709='\x5c\x5c'+_0x4ec682;}else _0x25a709=_0x25a709['replace'](/\\\\/g,'\x5c');let _0x57afe0=a1_0x34a467[_0x224e7d(0x15e)](_0x25a709);_0x25a709[_0x224e7d(0x158)]('\x5c\x5c')&&!_0x57afe0[_0x224e7d(0x158)]('\x5c\x5c')&&(_0x57afe0='\x5c'+_0x57afe0);if(_0x57afe0[_0x224e7d(0x150)](/^[a-zA-Z]:/)){let _0x13f6d9=_0x57afe0['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x224e7d(0x14f)](_0x13f6d9)&&(_0x13f6d9=_0x13f6d9[_0x224e7d(0x15f)](0x0)['toUpperCase']()+_0x13f6d9['slice'](0x1)),_0x13f6d9;}return _0x57afe0[_0x224e7d(0x151)](/\//g,'\x5c');}function a1_0xd9bc(_0x48122b,_0x57a67f){_0x48122b=_0x48122b-0x149;const _0x5d337e=a1_0x5d33();let _0xd9bce1=_0x5d337e[_0x48122b];return _0xd9bce1;}export function expandHome(_0x270deb){const _0x55b139=a1_0xd9bc;if(_0x270deb[_0x55b139(0x158)]('~/')||_0x270deb==='~')return a1_0x34a467[_0x55b139(0x15b)](a1_0x3eb0cf['homedir'](),_0x270deb[_0x55b139(0x14b)](0x1));return _0x270deb;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a2_0x5b14(){const _0xa09f6a=['873696bCMgmf','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some','1569205oEciyE','3731480wliQbJ','resolve','4ZudCdR','Path\x20must\x20be\x20absolute\x20after\x20normalization','2517606UEmUOO','2976DaFgVv','isAbsolute','20979ZEgKhP','includes','normalize','startsWith','4635400KtpZmQ','1786160lCTsLt','sep','length','string'];a2_0x5b14=function(){return _0xa09f6a;};return a2_0x5b14();}(function(_0x1b6d9b,_0x2929c2){const _0x4be1f8=a2_0x22da,_0x1534e3=_0x1b6d9b();while(!![]){try{const _0x46e99a=-parseInt(_0x4be1f8(0x74))/0x1+parseInt(_0x4be1f8(0x77))/0x2*(parseInt(_0x4be1f8(0x85))/0x3)+-parseInt(_0x4be1f8(0x75))/0x4+parseInt(_0x4be1f8(0x80))/0x5+-parseInt(_0x4be1f8(0x7a))/0x6*(-parseInt(_0x4be1f8(0x7c))/0x7)+parseInt(_0x4be1f8(0x81))/0x8+parseInt(_0x4be1f8(0x79))/0x9;if(_0x46e99a===_0x2929c2)break;else _0x1534e3['push'](_0x1534e3['shift']());}catch(_0x141e22){_0x1534e3['push'](_0x1534e3['shift']());}}}(a2_0x5b14,0xf3679));import a2_0x532966 from'path';function a2_0x22da(_0x1277bb,_0x15f5d3){_0x1277bb=_0x1277bb-0x73;const _0x5b149f=a2_0x5b14();let _0x22da86=_0x5b149f[_0x1277bb];return _0x22da86;}export function isPathWithinAllowedDirectories(_0x30b077,_0x38c5e8){const _0x29bbe3=a2_0x22da;if(typeof _0x30b077!==_0x29bbe3(0x84)||!Array['isArray'](_0x38c5e8))return![];if(!_0x30b077||_0x38c5e8[_0x29bbe3(0x83)]===0x0)return![];if(_0x30b077['includes']('\x00'))return![];let _0x3ae63c;try{_0x3ae63c=a2_0x532966[_0x29bbe3(0x76)](a2_0x532966[_0x29bbe3(0x7e)](_0x30b077));}catch{return![];}if(!a2_0x532966[_0x29bbe3(0x7b)](_0x3ae63c))throw new Error(_0x29bbe3(0x78));return _0x38c5e8[_0x29bbe3(0x73)](_0x1862c4=>{const _0xa9ef86=_0x29bbe3;if(typeof _0x1862c4!==_0xa9ef86(0x84)||!_0x1862c4)return![];if(_0x1862c4[_0xa9ef86(0x7d)]('\x00'))return![];let _0x148eac;try{_0x148eac=a2_0x532966['resolve'](a2_0x532966[_0xa9ef86(0x7e)](_0x1862c4));}catch{return![];}if(!a2_0x532966[_0xa9ef86(0x7b)](_0x148eac))throw new Error(_0xa9ef86(0x86));if(_0x3ae63c===_0x148eac)return!![];if(_0x148eac===a2_0x532966['sep'])return _0x3ae63c[_0xa9ef86(0x7f)](a2_0x532966[_0xa9ef86(0x82)]);return _0x3ae63c['startsWith'](_0x148eac+a2_0x532966['sep']);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1b89d8,_0x1636c7){const _0x507b62=a3_0x271b,_0x4f1fd3=_0x1b89d8();while(!![]){try{const _0x2bc9f0=parseInt(_0x507b62(0x153))/0x1+-parseInt(_0x507b62(0x156))/0x2*(-parseInt(_0x507b62(0x151))/0x3)+-parseInt(_0x507b62(0x164))/0x4*(-parseInt(_0x507b62(0x15b))/0x5)+-parseInt(_0x507b62(0x163))/0x6*(parseInt(_0x507b62(0x15a))/0x7)+parseInt(_0x507b62(0x165))/0x8*(parseInt(_0x507b62(0x158))/0x9)+parseInt(_0x507b62(0x166))/0xa+-parseInt(_0x507b62(0x160))/0xb;if(_0x2bc9f0===_0x1636c7)break;else _0x4f1fd3['push'](_0x4f1fd3['shift']());}catch(_0x3bd192){_0x4f1fd3['push'](_0x4f1fd3['shift']());}}}(a3_0x17b8,0xd6d1b));import{promises as a3_0x480b73}from'fs';import a3_0x4df6ff from'path';import a3_0x5ab031 from'os';import{normalizePath}from'./path-utils.js';function a3_0x271b(_0x26ed09,_0x5493c6){_0x26ed09=_0x26ed09-0x14f;const _0x17b816=a3_0x17b8();let _0x271b33=_0x17b816[_0x26ed09];return _0x271b33;}async function parseRootUri(_0x3982d6){const _0x173e0b=a3_0x271b;try{const _0x3c35a1=_0x3982d6[_0x173e0b(0x14f)](_0x173e0b(0x159))?_0x3982d6[_0x173e0b(0x150)](0x7):_0x3982d6,_0x534170=_0x3c35a1[_0x173e0b(0x14f)]('~/')||_0x3c35a1==='~'?a3_0x4df6ff['join'](a3_0x5ab031[_0x173e0b(0x162)](),_0x3c35a1[_0x173e0b(0x150)](0x1)):_0x3c35a1,_0x4db439=a3_0x4df6ff[_0x173e0b(0x15e)](_0x534170),_0x5b4019=await a3_0x480b73[_0x173e0b(0x155)](_0x4db439);return normalizePath(_0x5b4019);}catch{return null;}}function a3_0x17b8(){const _0x4375ea=['14827540xskHYn','uri','startsWith','slice','27771meEApB','error','169912sGejNS','Skipping\x20','realpath','22qzmoLq','Skipping\x20invalid\x20directory:\x20','10374192IhwVaB','file://','595rhEbFV','5zmdMAp','stat','isDirectory','resolve','invalid\x20path\x20or\x20inaccessible','6533395BGVaOy','non-directory\x20root','homedir','111270uqcBKa','571952MfIlQV','8YCmWyh'];a3_0x17b8=function(){return _0x4375ea;};return a3_0x17b8();}function formatDirectoryError(_0x598751,_0x135581,_0x2b1deb){const _0x21b255=a3_0x271b;if(_0x2b1deb)return _0x21b255(0x154)+_0x2b1deb+':\x20'+_0x598751;const _0x20839e=_0x135581 instanceof Error?_0x135581['message']:String(_0x135581);return _0x21b255(0x157)+_0x598751+'\x20due\x20to\x20error:\x20'+_0x20839e;}export async function getValidRootDirectories(_0x307ef6){const _0xfc2b53=a3_0x271b,_0x90118d=[];for(const _0x20898d of _0x307ef6){const _0x4bef35=await parseRootUri(_0x20898d['uri']);if(!_0x4bef35){console[_0xfc2b53(0x152)](formatDirectoryError(_0x20898d[_0xfc2b53(0x167)],undefined,_0xfc2b53(0x15f)));continue;}try{const _0x15deec=await a3_0x480b73[_0xfc2b53(0x15c)](_0x4bef35);_0x15deec[_0xfc2b53(0x15d)]()?_0x90118d['push'](_0x4bef35):console[_0xfc2b53(0x152)](formatDirectoryError(_0x4bef35,undefined,_0xfc2b53(0x161)));}catch(_0xed1f8c){console[_0xfc2b53(0x152)](formatDirectoryError(_0x4bef35,_0xed1f8c));}}return _0x90118d;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.63",
|
|
4
4
|
"description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Morph (https://morphllm.com)",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google/generative-ai": "^0.21.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
38
|
-
"@morphllm/morphsdk": "0.2.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.90",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|