@morphllm/morphmcp 0.8.59 → 0.8.61

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
- const a0_0x42bd9c=a0_0x3832;(function(_0x1e90f1,_0x882244){const _0x2516fd=a0_0x3832,_0x368e1b=_0x1e90f1();while(!![]){try{const _0x5a49ad=-parseInt(_0x2516fd(0x177))/0x1+-parseInt(_0x2516fd(0x17a))/0x2+-parseInt(_0x2516fd(0x1a0))/0x3*(-parseInt(_0x2516fd(0xf0))/0x4)+-parseInt(_0x2516fd(0x15d))/0x5+parseInt(_0x2516fd(0x1ac))/0x6+parseInt(_0x2516fd(0x162))/0x7+parseInt(_0x2516fd(0x19d))/0x8*(parseInt(_0x2516fd(0xfb))/0x9);if(_0x5a49ad===_0x882244)break;else _0x368e1b['push'](_0x368e1b['shift']());}catch(_0x57ef0d){_0x368e1b['push'](_0x368e1b['shift']());}}}(a0_0x1a3b,0xce179));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x1a3b(){const _0x510fa1=['1072994taARGj','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','pyproject.toml','search_string','errors','completed','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','map','repoId','roots','package.json','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Unknown\x20tool:\x20','files','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Fatal\x20error\x20running\x20server:','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','read\x20','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','Error\x20accessing\x20directory\x20','query','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','every','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','\x20chars)','setRequestHandler','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','setNotificationHandler','text','0.2.0','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','[could\x20not\x20read\x20file:\x20','104pIfeLD','morph-v3-fast','stats','3rgDrRW','Repository\x20identifier','UnknownError','messages','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','WarpGrepError','%\x20match)\x0a','endLine','Applied','Failed\x20to\x20request\x20roots\x20from\x20client:','toISOString','safeParse','6606168uPSBVh','results','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','optional','describe','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','.cursor','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','substring','data','Workspace\x20mode\x20enabled:\x20Using\x20','Invalid\x20arguments:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\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','<file\x20path=\x22','basename','boolean','timeout','Created\x20File','morph-mcp','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','toLowerCase','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Found\x20','.git','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','length','post','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','create\x20this\x20file','false','-\x20Grepped\x20\x27','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','\x20results\x20in\x20','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','\x20as\x20allowed\x20directory','includes','ENABLED_TOOLS','For\x20deletions:\x0a','\x0a...\x20(truncated,\x20total:\x20','1376636HSwAlq','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','Enabled\x20tools:\x20','env','catch','startsWith','Fallback:\x20Using\x20workspace\x20root\x20','role','code_edit','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','string','354267npEKjP','\x20\x20\x20Lines\x20','edit_file','limit','all','Error\x20running\x20fast\x20context\x20search:\x20','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','Natural\x20language\x20query\x20to\x20search\x20for\x20code','Benefits:\x0a','number','dirname','warpgrep_codebase_search','❌\x20Morph\x20Edit\x20Failed:\x20','TimeoutError','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','PWD','.vscode','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','sep','Specific\x20commit\x20hash\x20to\x20search','slice','startLine','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','success','default','dryRun','MORPH_WARP_GREP_TIMEOUT','name','rerankScore','Error:\x20','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','ENOENT','runWarpGrep_call','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','filepath','</file>','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','filter','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','utf-8','object','\x20valid\x20directories','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','lines','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','stringify','\x20is\x20not\x20a\x20directory','stack','isDirectory','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','terminated','constructor','Morph\x20Edit\x20','Relevant\x20context\x20found:','\x0a</file>','resolve','push','match','stat','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Rules:\x0a','Unknown\x20error','terminationReason','timed\x20out','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','message','oninitialized','etimedout','path','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','instruction','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','tsconfig.json','trim','\x20\x20\x20','isArray','Successfully\x20','code','repo_path','metadata','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','content','applied\x20edits\x20to','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','searchTimeMs','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.','udiff','readFile','error','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','array','ENABLE_WORKSPACE_MODE','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','finish','Warning:\x20','assistant','homedir','2556365tyriLW','morph-warp-grep-v1-1111v0','\x20-\x20','-\x20Read\x20file\x20`','join','7659624wmjmlc','realpath','completed_with_file_errors','inputSchema','unknown','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','grep\x20\x27','...','codebase_search','Preview\x20changes\x20without\x20applying\x20them.','Search\x20failed:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','repeat','\x27\x20in\x20`','Warning:\x20Workspace\x20fallback\x20failed:\x20','created','toFixed','\x22>\x0aError\x20reading\x20file:\x20','exit','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','split','1159215ACYGvA','mcp-filesystem','requiresApiKey'];a0_0x1a3b=function(){return _0x510fa1;};return a0_0x1a3b();}import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x454bdf from'fs/promises';import a0_0x2676d5 from'path';import a0_0x1e56d3 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_0x5c8ed0 from'axios';function fixPathRepetition(_0x1acd28){const _0x8365be=a0_0x3832,_0x1d9330=_0x1acd28['split'](a0_0x2676d5[_0x8365be(0x10d)])[_0x8365be(0x120)](Boolean);if(_0x1d9330[_0x8365be(0xe0)]<0x2)return null;for(let _0x3cd0ef=Math['floor'](_0x1d9330[_0x8365be(0xe0)]/0x2);_0x3cd0ef>=0x1;_0x3cd0ef--){for(let _0x828e24=0x0;_0x828e24<=_0x1d9330[_0x8365be(0xe0)]-0x2*_0x3cd0ef;_0x828e24++){const _0x29104e=_0x1d9330['slice'](_0x828e24,_0x828e24+_0x3cd0ef),_0x3342d3=_0x1d9330[_0x8365be(0x10f)](_0x828e24+_0x3cd0ef,_0x828e24+0x2*_0x3cd0ef);if(_0x29104e[_0x8365be(0x192)]((_0x4693e4,_0x17a7e2)=>_0x4693e4===_0x3342d3[_0x17a7e2])){const _0x103d6b=[..._0x1d9330['slice'](0x0,_0x828e24),..._0x1d9330[_0x8365be(0x10f)](_0x828e24+_0x3cd0ef)];return a0_0x2676d5[_0x8365be(0x10d)]+_0x103d6b[_0x8365be(0x161)](a0_0x2676d5['sep']);}}}return null;}const args=process['argv'][a0_0x42bd9c(0x10f)](0x2),ALL_TOOLS=[a0_0x42bd9c(0xfd),a0_0x42bd9c(0x106),'codebase_search'],DEFAULT_TOOLS=[a0_0x42bd9c(0xfd),a0_0x42bd9c(0x106)],ENABLED_TOOLS=process[a0_0x42bd9c(0xf3)]['ENABLED_TOOLS']?process[a0_0x42bd9c(0xf3)][a0_0x42bd9c(0xed)]===a0_0x42bd9c(0xff)?ALL_TOOLS:process[a0_0x42bd9c(0xf3)]['ENABLED_TOOLS']['split'](',')['map'](_0x581cae=>_0x581cae[a0_0x42bd9c(0x144)]()):DEFAULT_TOOLS;console[a0_0x42bd9c(0x153)](a0_0x42bd9c(0xf2)+ENABLED_TOOLS[a0_0x42bd9c(0x161)](',\x20'));const WORKSPACE_ROOT=process[a0_0x42bd9c(0xf3)]['WORKSPACE_ROOT']||process[a0_0x42bd9c(0xf3)][a0_0x42bd9c(0x10a)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x42bd9c(0xf3)][a0_0x42bd9c(0x157)]!==a0_0x42bd9c(0xe4),MORPH_API_KEY=process[a0_0x42bd9c(0xf3)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x42bd9c(0xf3)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x42bd9c(0xf3)][a0_0x42bd9c(0x115)]?parseInt(process[a0_0x42bd9c(0xf3)][a0_0x42bd9c(0x115)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x42bd9c(0xf5)]('sk-')&&!MORPH_API_KEY[a0_0x42bd9c(0xf5)]('morph-')&&console[a0_0x42bd9c(0x153)](a0_0x42bd9c(0x191));async function reportMorphError(_0x38391f){const _0x3551cf=a0_0x42bd9c;try{await a0_0x5c8ed0[_0x3551cf(0xe1)]('https://morphllm.com/api/error-report',{..._0x38391f,'timestamp':new Date()[_0x3551cf(0x1aa)](),'source':_0x38391f['source']||_0x3551cf(0x178)},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x42bd9c(0x153)](a0_0x42bd9c(0x185)),console['error'](a0_0x42bd9c(0x13b)),console['error']('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),console[a0_0x42bd9c(0x153)]('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),console['error']('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console[a0_0x42bd9c(0x153)](a0_0x42bd9c(0xdc)));function a0_0x3832(_0x5b0d85,_0x33c5a8){_0x5b0d85=_0x5b0d85-0xd5;const _0x1a3b46=a0_0x1a3b();let _0x3832e1=_0x1a3b46[_0x5b0d85];return _0x3832e1;}function normalizePath(_0xd2cb54){return a0_0x2676d5['normalize'](_0xd2cb54);}function expandHome(_0x319de3){const _0x563d04=a0_0x42bd9c;if(_0x319de3[_0x563d04(0xf5)]('~/')||_0x319de3==='~')return a0_0x2676d5[_0x563d04(0x161)](a0_0x1e56d3[_0x563d04(0x15c)](),_0x319de3['slice'](0x1));return _0x319de3;}let allowedDirectories=await Promise['all'](args['map'](async _0x23c09b=>{const _0x5f282f=a0_0x42bd9c,_0x58a096=expandHome(_0x23c09b),_0x113880=a0_0x2676d5[_0x5f282f(0x132)](_0x58a096);try{const _0x346262=await a0_0x454bdf[_0x5f282f(0x163)](_0x113880);return normalizePath(_0x346262);}catch(_0x3bf73c){return normalizePath(_0x113880);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x42bd9c(0xe0)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console[a0_0x42bd9c(0x153)](a0_0x42bd9c(0x1b7)+workspaceDir+a0_0x42bd9c(0xeb)));}catch(a0_0xe6e9c0){console['error'](a0_0x42bd9c(0x186)+a0_0xe6e9c0);}async function detectWorkspaceRoot(_0x166987){const _0x46302c=a0_0x42bd9c;let _0x20b576=a0_0x2676d5['resolve'](_0x166987);const _0x25440a=[_0x46302c(0xde),_0x46302c(0x10b),_0x46302c(0x184),'Cargo.toml',_0x46302c(0x17c),'go.mod',_0x46302c(0x1b2),_0x46302c(0x143),'composer.json'];while(_0x20b576!==a0_0x2676d5[_0x46302c(0x105)](_0x20b576)){for(const _0x32c02d of _0x25440a){const _0xc3ee89=a0_0x2676d5['join'](_0x20b576,_0x32c02d);try{return await a0_0x454bdf['access'](_0xc3ee89),normalizePath(_0x20b576);}catch{}}_0x20b576=a0_0x2676d5[_0x46302c(0x105)](_0x20b576);}return normalizePath(_0x166987);}await Promise[a0_0x42bd9c(0xff)](args[a0_0x42bd9c(0x181)](async _0x246326=>{const _0x200a67=a0_0x42bd9c;try{const _0xfa1d72=await a0_0x454bdf[_0x200a67(0x135)](expandHome(_0x246326));!_0xfa1d72[_0x200a67(0x12b)]()&&(console[_0x200a67(0x153)](_0x200a67(0x118)+_0x246326+_0x200a67(0x129)),process[_0x200a67(0x174)](0x1));}catch(_0x2a4d17){console['error'](_0x200a67(0x18f)+_0x246326+':',_0x2a4d17),process[_0x200a67(0x174)](0x1);}}));async function validatePath(_0x65f82c){const _0x39eb80=a0_0x42bd9c,_0x29f2f0=expandHome(_0x65f82c),_0x22073d=a0_0x2676d5[_0x39eb80(0x132)](_0x29f2f0);try{const _0x3691fc=await a0_0x454bdf[_0x39eb80(0x163)](_0x22073d);return _0x3691fc;}catch(_0x12cc96){if(_0x12cc96[_0x39eb80(0x148)]===_0x39eb80(0x11a)){const _0x447f03=a0_0x2676d5[_0x39eb80(0x105)](_0x22073d);try{const _0x4c59e2=await a0_0x454bdf[_0x39eb80(0x163)](_0x447f03);return a0_0x2676d5[_0x39eb80(0x161)](_0x4c59e2,a0_0x2676d5['basename'](_0x22073d));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x447f03);}}throw _0x12cc96;}}const MorphEditFileArgsSchema=z['object']({'path':z['string'](),'code_edit':z[a0_0x42bd9c(0xfa)]()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z['string']()[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x193)),'dryRun':z[a0_0x42bd9c(0xd6)]()[a0_0x42bd9c(0x113)](![])[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x16b))}),WarpGrepArgsSchema=z[a0_0x42bd9c(0x123)]({'search_string':z['string']()[a0_0x42bd9c(0x1b0)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'repo_path':z[a0_0x42bd9c(0xfa)]()[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x14b))}),CodebaseSearchArgsSchema=z[a0_0x42bd9c(0x123)]({'query':z[a0_0x42bd9c(0xfa)]()['describe'](a0_0x42bd9c(0x102)),'repoId':z['string']()[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x1a1)),'branch':z[a0_0x42bd9c(0xfa)]()[a0_0x42bd9c(0x1af)]()[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x17b)),'commitHash':z[a0_0x42bd9c(0xfa)]()['optional']()[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x10e)),'target_directories':z[a0_0x42bd9c(0x156)](z[a0_0x42bd9c(0xfa)]())['default']([])[a0_0x42bd9c(0x1b0)](a0_0x42bd9c(0x155)),'limit':z[a0_0x42bd9c(0x104)]()[a0_0x42bd9c(0x1af)]()[a0_0x42bd9c(0x113)](0xa)[a0_0x42bd9c(0x1b0)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x42bd9c(0xd9),'version':a0_0x42bd9c(0x19a)},{'capabilities':{'tools':{}}});server[a0_0x42bd9c(0x195)](ListToolsRequestSchema,async()=>{const _0x46bfa6=a0_0x42bd9c,_0x5115b5=[{'name':_0x46bfa6(0xfd),'description':_0x46bfa6(0x10c)+_0x46bfa6(0x196)+_0x46bfa6(0xea)+_0x46bfa6(0x109)+_0x46bfa6(0x103)+_0x46bfa6(0xf1)+_0x46bfa6(0x111)+_0x46bfa6(0x1b9)+_0x46bfa6(0xf9)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x46bfa6(0x175)+_0x46bfa6(0x1b4)+_0x46bfa6(0xee)+_0x46bfa6(0x167)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x46bfa6(0x137)+_0x46bfa6(0x197)+_0x46bfa6(0x187)+_0x46bfa6(0x158)+_0x46bfa6(0x119)+_0x46bfa6(0x180)+_0x46bfa6(0xe8)+_0x46bfa6(0x18e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x46bfa6(0x106),'description':_0x46bfa6(0xe2)+_0x46bfa6(0x1ba)+_0x46bfa6(0xdf)+_0x46bfa6(0x125)+_0x46bfa6(0x154)+_0x46bfa6(0x11f)+_0x46bfa6(0xe6)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x46bfa6(0x16a),'description':_0x46bfa6(0xe9)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x46bfa6(0x12c)+_0x46bfa6(0x103)+_0x46bfa6(0x127)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x46bfa6(0x18a)+_0x46bfa6(0x101)+_0x46bfa6(0x140)+_0x46bfa6(0x11c)+_0x46bfa6(0x121),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x138fea=_0x5115b5['filter'](_0x38bc23=>{const _0x331041=_0x46bfa6;if(!ENABLED_TOOLS[_0x331041(0xec)](_0x38bc23[_0x331041(0x116)]))return![];if(_0x331041(0x179)in _0x38bc23&&_0x38bc23[_0x331041(0x179)]&&!MORPH_API_KEY)return console[_0x331041(0x153)](_0x331041(0x15a)+_0x38bc23[_0x331041(0x116)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x138fea[_0x46bfa6(0x181)](_0x2dc480=>({'name':_0x2dc480[_0x46bfa6(0x116)],'description':_0x2dc480['description'],'inputSchema':_0x2dc480[_0x46bfa6(0x165)]}))};}),server[a0_0x42bd9c(0x195)](CallToolRequestSchema,async _0x1615d1=>{const _0x1d6e32=a0_0x42bd9c;try{const {name:_0x3ed86c,arguments:_0x107d20}=_0x1615d1['params'];switch(_0x3ed86c){case _0x1d6e32(0xfd):{const _0x5eb16a=MorphEditFileArgsSchema['safeParse'](_0x107d20);if(!_0x5eb16a[_0x1d6e32(0x112)])throw new Error(_0x1d6e32(0x18c)+_0x5eb16a[_0x1d6e32(0x153)]);const _0x12511b=await validatePath(_0x5eb16a['data'][_0x1d6e32(0x13f)]);let _0x5593a4=null,_0x49fafa=!![],_0x5b60e8=null;try{_0x5593a4=await a0_0x454bdf['readFile'](_0x12511b,'utf-8');}catch(_0x382d39){const _0x3d8078=_0x382d39['code'];_0x3d8078===_0x1d6e32(0x11a)?(_0x49fafa=![],_0x5593a4=''):(_0x5b60e8='Failed\x20to\x20read\x20file:\x20'+(_0x3d8078||_0x1d6e32(0x166))+_0x1d6e32(0x15f)+(_0x382d39 instanceof Error?_0x382d39[_0x1d6e32(0x13c)]:String(_0x382d39)),console[_0x1d6e32(0x153)](_0x1d6e32(0x15a)+_0x5b60e8));}try{const _0x229321=MORPH_API_KEY;if(!_0x229321)throw new Error(_0x1d6e32(0x136));const _0x15649e=a0_0x2676d5[_0x1d6e32(0x105)](_0x12511b),_0x4bd2e7=a0_0x2676d5[_0x1d6e32(0xd5)](_0x12511b),_0x332d42=await executeEditFile({'target_filepath':_0x4bd2e7,'code_edit':_0x5eb16a['data'][_0x1d6e32(0xf8)],'instructions':_0x5eb16a[_0x1d6e32(0x1b6)]['instruction']},{'morphApiKey':_0x229321,'morphApiUrl':MORPH_API_URL,'baseDir':_0x15649e,'autoWrite':!_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x114)],'generateUdiff':!![],'debug':![]});if(!_0x332d42[_0x1d6e32(0x112)])throw new Error(_0x332d42['error']||_0x1d6e32(0x1b3));const _0x1f6060=_0x332d42[_0x1d6e32(0x151)]||'';let _0x378642=0x3;while(_0x1f6060['includes']('`'['repeat'](_0x378642))){_0x378642++;}const _0x4a07b0='`'[_0x1d6e32(0x16e)](_0x378642)+'diff\x0a'+_0x1f6060+'`'['repeat'](_0x378642)+'\x0a\x0a';if(_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x114)])return{'content':[{'type':'text','text':'🔍\x20Morph\x20Edit\x20Preview'+(_0x49fafa?'':'\x20(new\x20file)')+':\x20'+_0x5eb16a['data']['instruction']+'\x0a\x0a'+_0x4a07b0+'Use\x20dryRun=false\x20to\x20'+(_0x49fafa?'apply\x20these\x20changes':_0x1d6e32(0xe3))+'.'}]};return{'content':[{'type':_0x1d6e32(0x199),'text':_0x1d6e32(0x12f)+(_0x49fafa?_0x1d6e32(0x1a8):_0x1d6e32(0xd8))+':\x20'+_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x141)]+'\x0a\x0a'+_0x4a07b0+_0x1d6e32(0x147)+(_0x49fafa?_0x1d6e32(0x14d):_0x1d6e32(0x171))+'\x20'+_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x13f)]}]};}catch(_0x4ad911){const _0x214a91=_0x4ad911 instanceof Error?_0x4ad911[_0x1d6e32(0x13c)]:String(_0x4ad911);return reportMorphError({'error_message':_0x214a91,'error_type':_0x4ad911 instanceof Error?_0x4ad911[_0x1d6e32(0x12e)]['name']:_0x1d6e32(0x1a2),'context':{'tool':_0x1d6e32(0xfd),'file_path':_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x13f)],'validated_path':_0x12511b,'instruction':_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x141)],'model':_0x1d6e32(0x19e),'dry_run':_0x5eb16a['data'][_0x1d6e32(0x114)],'file_exists':_0x49fafa,'file_read_error':_0x5b60e8,'file_readable':_0x5593a4!==null,'request_content':{'path':_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x13f)],'code_edit':_0x5eb16a['data'][_0x1d6e32(0xf8)],'instruction':_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x141)],'original_code':_0x5593a4!==null?_0x5593a4['length']>0xc350?_0x5593a4[_0x1d6e32(0x1b5)](0x0,0xc350)+_0x1d6e32(0xef)+_0x5593a4[_0x1d6e32(0xe0)]+_0x1d6e32(0x194):_0x5593a4:_0x1d6e32(0x19c)+(_0x5b60e8||'unknown\x20error')+']','original_code_length':_0x5593a4?.[_0x1d6e32(0xe0)]??0x0,'model':_0x1d6e32(0x19e),'dry_run':_0x5eb16a[_0x1d6e32(0x1b6)][_0x1d6e32(0x114)]}},'stack_trace':_0x4ad911 instanceof Error?_0x4ad911[_0x1d6e32(0x12a)]:undefined,'source':_0x1d6e32(0x178)})[_0x1d6e32(0xf4)](()=>{}),{'content':[{'type':_0x1d6e32(0x199),'text':_0x1d6e32(0x107)+_0x214a91}],'isError':!![]};}}case _0x1d6e32(0x106):{const _0x1312df=WarpGrepArgsSchema['safeParse'](_0x107d20);if(!_0x1312df['success'])return{'content':[{'type':_0x1d6e32(0x199),'text':_0x1d6e32(0x1b8)+_0x1312df[_0x1d6e32(0x153)]}],'isError':!![]};const _0x1d12f4=_0x5c4087=>{const _0x39ef8f=_0x1d6e32,_0x23d895=[];for(const _0x51b063 of _0x5c4087||[]){const _0x409beb=_0x51b063[_0x39ef8f(0xf7)],_0x112b34=_0x51b063[_0x39ef8f(0x14c)];if(_0x409beb===_0x39ef8f(0x15b)&&_0x112b34){const _0x466c2e=_0x112b34[_0x39ef8f(0x176)]('\x0a')['filter'](_0x1997fa=>_0x1997fa[_0x39ef8f(0x144)]());for(const _0x590e3a of _0x466c2e){const _0x35f86c=_0x590e3a[_0x39ef8f(0x134)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x35f86c){_0x23d895['push'](_0x39ef8f(0x168)+_0x35f86c[0x1]+'\x27\x20'+_0x35f86c[0x2]);continue;}const _0x1f4bb4=_0x590e3a[_0x39ef8f(0x134)](/^read\s+(.+)$/);if(_0x1f4bb4){_0x23d895[_0x39ef8f(0x133)](_0x39ef8f(0x18d)+_0x1f4bb4[0x1]);continue;}const _0x3f5aa4=_0x590e3a[_0x39ef8f(0x134)](/^list_directory\s+(.+)$/);if(_0x3f5aa4){_0x23d895[_0x39ef8f(0x133)]('list_directory\x20'+_0x3f5aa4[0x1]);continue;}}}}return _0x23d895;};try{const _0x4f35cc=a0_0x2676d5[_0x1d6e32(0x132)](_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)]),_0x63fb2=new LocalRipgrepProvider(_0x4f35cc),_0x642e8c=await runWarpGrep({'query':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x17d)],'repoRoot':_0x4f35cc,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x63fb2});let _0x539a04='';if(_0x642e8c['terminationReason']===_0x1d6e32(0x17f)&&_0x642e8c[_0x1d6e32(0x159)]?.[_0x1d6e32(0x14a)]?.[_0x1d6e32(0x189)]){const _0x178639=_0x642e8c[_0x1d6e32(0x159)][_0x1d6e32(0x14a)][_0x1d6e32(0x189)],_0x538198=[],_0x32b15a=[_0x1d6e32(0x19b)];for(const _0x3488a2 of _0x642e8c[_0x1d6e32(0x1a3)]){const _0x420b0f=_0x3488a2[_0x1d6e32(0xf7)],_0x211f03=_0x3488a2[_0x1d6e32(0x14c)];if(_0x420b0f===_0x1d6e32(0x15b)&&_0x211f03){const _0x4581fe=_0x211f03[_0x1d6e32(0x176)]('\x0a')['filter'](_0x6a1492=>_0x6a1492['trim']());for(const _0x5a2404 of _0x4581fe){const _0x3d055e=_0x5a2404[_0x1d6e32(0x134)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x3d055e){_0x32b15a['push'](_0x1d6e32(0xe5)+_0x3d055e[0x1]+_0x1d6e32(0x16f)+_0x3d055e[0x2]+'`');continue;}const _0x2084ec=_0x5a2404[_0x1d6e32(0x134)](/^read\s+(.+)$/);if(_0x2084ec){_0x32b15a[_0x1d6e32(0x133)](_0x1d6e32(0x160)+_0x2084ec[0x1]+'`');continue;}const _0xb91ed1=_0x5a2404[_0x1d6e32(0x134)](/^list_directory\s+(.+)$/);if(_0xb91ed1){_0x32b15a['push']('-\x20Listed\x20directory\x20`'+_0xb91ed1[0x1]+'`');continue;}}}}_0x538198[_0x1d6e32(0x133)](_0x32b15a[_0x1d6e32(0x161)]('\x0a'));const _0x983221=['',_0x1d6e32(0x130)];for(const _0x3261b0 of _0x178639){if(_0x3261b0[_0x1d6e32(0x126)]==='*')_0x983221[_0x1d6e32(0x133)]('-\x20'+_0x3261b0['path']+':*');else{if(Array[_0x1d6e32(0x146)](_0x3261b0[_0x1d6e32(0x126)])){const _0x2a9711=_0x3261b0['lines'][_0x1d6e32(0x181)](([_0x1934f8,_0x5b3a5e])=>{if(_0x1934f8===_0x5b3a5e)return''+_0x1934f8;return _0x1934f8+'-'+_0x5b3a5e;});_0x983221['push']('-\x20'+_0x3261b0[_0x1d6e32(0x13f)]+':'+_0x2a9711[_0x1d6e32(0x161)](','));}else _0x983221[_0x1d6e32(0x133)]('-\x20'+_0x3261b0[_0x1d6e32(0x13f)]+':*');}}_0x983221[_0x1d6e32(0x133)](''),_0x538198['push'](_0x983221['join']('\x0a')),_0x538198[_0x1d6e32(0x133)](_0x1d6e32(0x16d));const _0x458294=[];for(const _0x2b32c5 of _0x178639){let _0x34f980=a0_0x2676d5['resolve'](_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],_0x2b32c5[_0x1d6e32(0x13f)]),_0x431327=null,_0x2ef198=null;try{_0x431327=await a0_0x454bdf[_0x1d6e32(0x152)](_0x34f980,{'encoding':_0x1d6e32(0x122)});}catch(_0x298db2){const _0x3b6e57=fixPathRepetition(_0x34f980);if(_0x3b6e57)try{_0x431327=await a0_0x454bdf[_0x1d6e32(0x152)](_0x3b6e57,{'encoding':_0x1d6e32(0x122)}),_0x34f980=_0x3b6e57;}catch{_0x2ef198=_0x298db2 instanceof Error?_0x298db2:new Error(String(_0x298db2));}else _0x2ef198=_0x298db2 instanceof Error?_0x298db2:new Error(String(_0x298db2));}if(_0x431327!==null){const _0x4dd440=_0x431327[_0x1d6e32(0x176)](/\r?\n/),_0x5cdeba=[_0x1d6e32(0x1bb)+_0x2b32c5[_0x1d6e32(0x13f)]+'\x22>'];if(_0x2b32c5[_0x1d6e32(0x126)]==='*'||!Array[_0x1d6e32(0x146)](_0x2b32c5[_0x1d6e32(0x126)]))for(let _0x4e35c0=0x1;_0x4e35c0<=_0x4dd440[_0x1d6e32(0xe0)];_0x4e35c0++){const _0x466373=_0x4dd440[_0x4e35c0-0x1];_0x5cdeba['push'](_0x4e35c0+'|\x20'+_0x466373);}else for(const [_0x102b55,_0x3aaab6]of _0x2b32c5[_0x1d6e32(0x126)]){_0x5cdeba['length']>0x1&&_0x5cdeba[_0x1d6e32(0x133)]('');for(let _0x2a7d73=_0x102b55;_0x2a7d73<=_0x3aaab6&&_0x2a7d73<=_0x4dd440[_0x1d6e32(0xe0)];_0x2a7d73++){const _0x1b00e7=_0x4dd440[_0x2a7d73-0x1];_0x5cdeba[_0x1d6e32(0x133)](_0x2a7d73+'|\x20'+_0x1b00e7);}}_0x5cdeba[_0x1d6e32(0x133)](_0x1d6e32(0x11e)),_0x458294[_0x1d6e32(0x133)](_0x5cdeba[_0x1d6e32(0x161)]('\x0a'));}else _0x458294[_0x1d6e32(0x133)](_0x1d6e32(0x1bb)+_0x2b32c5['path']+_0x1d6e32(0x173)+(_0x2ef198?.[_0x1d6e32(0x13c)]||_0x1d6e32(0x138))+_0x1d6e32(0x131));}_0x538198['push'](_0x458294['join']('\x0a\x0a')),_0x539a04=_0x538198[_0x1d6e32(0x161)]('\x0a');const _0x375442=_0x642e8c['errors']?.[_0x1d6e32(0x120)](_0x391974=>_0x391974[_0x1d6e32(0x13c)]?.[_0x1d6e32(0xf5)]('File\x20read\x20error:'))||[];if(_0x375442[_0x1d6e32(0xe0)]>0x0){const _0xa750d3=_0x375442[_0x1d6e32(0x181)](_0x2d1a0a=>_0x2d1a0a[_0x1d6e32(0x13c)])[_0x1d6e32(0x161)](';\x20');reportMorphError({'error_message':_0xa750d3,'error_type':'FileReadError','context':{'tool':'warpgrep_codebase_search','repo_path':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],'query':_0x1312df['data'][_0x1d6e32(0x17d)],'model':_0x1d6e32(0x15e),'termination_reason':_0x1d6e32(0x164),'error_count':_0x375442[_0x1d6e32(0xe0)],'is_timeout':![],'timings':_0x642e8c['timings'],'files_attempted':_0x178639['map'](_0x3b6cc2=>({'path':_0x3b6cc2[_0x1d6e32(0x13f)],'lines':_0x3b6cc2[_0x1d6e32(0x126)]})),'tool_calls':_0x1d12f4(_0x642e8c[_0x1d6e32(0x1a3)]),'messages':_0x642e8c[_0x1d6e32(0x1a3)]?.[_0x1d6e32(0x181)](_0x4e2071=>({'role':_0x4e2071['role'],'content':_0x4e2071[_0x1d6e32(0x14c)]})),'request_content':{'query':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x17d)],'repo_path':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],'repoRoot':a0_0x2676d5[_0x1d6e32(0x132)](_0x1312df['data']['repo_path']),'model':_0x1d6e32(0x15e)}},'source':_0x1d6e32(0x178)})['catch'](()=>{});}}else{if(_0x642e8c['terminationReason']===_0x1d6e32(0x12d)&&_0x642e8c['errors']['length']>0x0){const _0x23daab=_0x642e8c[_0x1d6e32(0x17e)]['map'](_0x134b9b=>_0x134b9b[_0x1d6e32(0x13c)])[_0x1d6e32(0x161)](';\x20');_0x539a04=_0x1d6e32(0x118)+_0x23daab;const _0x561877=_0x23daab[_0x1d6e32(0xdb)]()[_0x1d6e32(0xec)]('timeout')||_0x23daab[_0x1d6e32(0xdb)]()[_0x1d6e32(0xec)]('timed\x20out')||_0x23daab[_0x1d6e32(0xdb)]()[_0x1d6e32(0xec)](_0x1d6e32(0x13e)),_0x18e0f1=_0x642e8c['finish']?.['metadata']?.[_0x1d6e32(0x189)],_0x23dc81=_0x642e8c[_0x1d6e32(0x17e)][0x0];reportMorphError({'error_message':_0x23daab,'error_type':_0x561877?_0x1d6e32(0x108):_0x23dc81?.['constructor']?.[_0x1d6e32(0x116)]||_0x1d6e32(0x1a5),'context':{'tool':_0x1d6e32(0x106),'repo_path':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],'query':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x17d)],'model':_0x1d6e32(0x15e),'termination_reason':_0x642e8c[_0x1d6e32(0x139)],'error_count':_0x642e8c['errors']['length'],'is_timeout':_0x561877,'timings':_0x642e8c['timings'],'files_attempted':_0x18e0f1?.['map'](_0x562cca=>({'path':_0x562cca[_0x1d6e32(0x13f)],'lines':_0x562cca[_0x1d6e32(0x126)]})),'tool_calls':_0x1d12f4(_0x642e8c[_0x1d6e32(0x1a3)]),'messages':_0x642e8c[_0x1d6e32(0x1a3)]?.[_0x1d6e32(0x181)](_0x1cf14e=>({'role':_0x1cf14e[_0x1d6e32(0xf7)],'content':_0x1cf14e[_0x1d6e32(0x14c)]})),'request_content':{'query':_0x1312df[_0x1d6e32(0x1b6)]['search_string'],'repo_path':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],'repoRoot':a0_0x2676d5[_0x1d6e32(0x132)](_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)]),'model':_0x1d6e32(0x15e)}},'stack_trace':_0x23dc81?.[_0x1d6e32(0x12a)]||undefined,'source':_0x1d6e32(0x178)})['catch'](()=>{});}else _0x539a04=_0x1d6e32(0x1b1);}return{'content':[{'type':_0x1d6e32(0x199),'text':_0x539a04}]};}catch(_0xc38f27){const _0x5ae10c=_0xc38f27 instanceof Error?_0xc38f27[_0x1d6e32(0x13c)]:String(_0xc38f27),_0x2ced5f=_0x5ae10c[_0x1d6e32(0xdb)]()[_0x1d6e32(0xec)](_0x1d6e32(0xd7))||_0x5ae10c[_0x1d6e32(0xdb)]()[_0x1d6e32(0xec)](_0x1d6e32(0x13a))||_0x5ae10c['toLowerCase']()['includes'](_0x1d6e32(0x13e))||_0xc38f27 instanceof Error&&_0xc38f27[_0x1d6e32(0x116)]===_0x1d6e32(0x108);return reportMorphError({'error_message':_0x5ae10c,'error_type':_0x2ced5f?_0x1d6e32(0x108):_0xc38f27 instanceof Error?_0xc38f27[_0x1d6e32(0x12e)]['name']:_0x1d6e32(0x1a2),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],'query':_0x1312df['data']['search_string'],'model':_0x1d6e32(0x15e),'is_timeout':_0x2ced5f,'exception_phase':_0x1d6e32(0x11b),'request_content':{'query':_0x1312df['data'][_0x1d6e32(0x17d)],'repo_path':_0x1312df[_0x1d6e32(0x1b6)][_0x1d6e32(0x149)],'repoRoot':a0_0x2676d5[_0x1d6e32(0x132)](_0x1312df['data'][_0x1d6e32(0x149)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0xc38f27 instanceof Error?_0xc38f27[_0x1d6e32(0x12a)]:undefined,'source':_0x1d6e32(0x178)})[_0x1d6e32(0xf4)](()=>{}),{'content':[{'type':_0x1d6e32(0x199),'text':_0x1d6e32(0x100)+_0x5ae10c}],'isError':![]};}}case'codebase_search':{const _0x3be874=CodebaseSearchArgsSchema[_0x1d6e32(0x1ab)](_0x107d20);if(!_0x3be874[_0x1d6e32(0x112)])return{'content':[{'type':_0x1d6e32(0x199),'text':_0x1d6e32(0x1b8)+_0x3be874[_0x1d6e32(0x153)]}],'isError':!![]};try{const _0xc32402=MORPH_API_KEY;if(!_0xc32402)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x5be578=await executeCodebaseSearch({'query':_0x3be874['data']['query'],'target_directories':_0x3be874['data']['target_directories'],'limit':_0x3be874[_0x1d6e32(0x1b6)][_0x1d6e32(0xfe)]},{'apiKey':_0xc32402,'repoId':_0x3be874[_0x1d6e32(0x1b6)]['repoId'],'branch':_0x3be874[_0x1d6e32(0x1b6)]['branch'],'commitHash':_0x3be874['data']['commitHash'],'debug':![]});if(!_0x5be578[_0x1d6e32(0x112)])return{'content':[{'type':'text','text':_0x1d6e32(0x16c)+_0x5be578[_0x1d6e32(0x153)]}],'isError':!![]};const _0x585be6=_0x5be578[_0x1d6e32(0x1ad)][_0x1d6e32(0xe0)]===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x3be874[_0x1d6e32(0x1b6)][_0x1d6e32(0x190)]+'\x22':_0x1d6e32(0xdd)+_0x5be578[_0x1d6e32(0x1ad)][_0x1d6e32(0xe0)]+_0x1d6e32(0xe7)+_0x5be578[_0x1d6e32(0x19f)][_0x1d6e32(0x14f)]+'ms:\x0a\x0a'+_0x5be578[_0x1d6e32(0x1ad)][_0x1d6e32(0x181)]((_0x47202b,_0x4231db)=>_0x4231db+0x1+'.\x20'+_0x47202b[_0x1d6e32(0x11d)]+'\x20('+(_0x47202b[_0x1d6e32(0x117)]*0x64)[_0x1d6e32(0x172)](0x1)+_0x1d6e32(0x1a6)+(_0x1d6e32(0xfc)+_0x47202b[_0x1d6e32(0x110)]+'-'+_0x47202b[_0x1d6e32(0x1a7)]+'\x0a')+(_0x1d6e32(0x145)+_0x47202b[_0x1d6e32(0x14c)][_0x1d6e32(0x1b5)](0x0,0xc8)+(_0x47202b[_0x1d6e32(0x14c)][_0x1d6e32(0xe0)]>0xc8?_0x1d6e32(0x169):'')+'\x0a'))['join']('\x0a');return{'content':[{'type':_0x1d6e32(0x199),'text':_0x585be6}]};}catch(_0x5b26dc){const _0x3f093b=_0x5b26dc instanceof Error?_0x5b26dc['message']:String(_0x5b26dc);return reportMorphError({'error_message':_0x3f093b,'error_type':_0x5b26dc instanceof Error?_0x5b26dc[_0x1d6e32(0x12e)][_0x1d6e32(0x116)]:_0x1d6e32(0x1a2),'context':{'tool':_0x1d6e32(0x16a),'query':_0x3be874['data']['query'],'repo_id':_0x3be874[_0x1d6e32(0x1b6)][_0x1d6e32(0x182)]},'stack_trace':_0x5b26dc instanceof Error?_0x5b26dc['stack']:undefined,'source':_0x1d6e32(0x178)})[_0x1d6e32(0xf4)](()=>{}),{'content':[{'type':_0x1d6e32(0x199),'text':_0x1d6e32(0x118)+_0x3f093b}],'isError':!![]};}}default:throw new Error(_0x1d6e32(0x188)+_0x3ed86c);}}catch(_0x289e95){const _0x28900a=_0x289e95 instanceof Error?_0x289e95['message']:String(_0x289e95);return reportMorphError({'error_message':_0x28900a,'error_type':_0x289e95 instanceof Error?_0x289e95[_0x1d6e32(0x12e)][_0x1d6e32(0x116)]:_0x1d6e32(0x1a2),'context':{'tool':name,'arguments':args?JSON[_0x1d6e32(0x128)](args)[_0x1d6e32(0x1b5)](0x0,0x1f4):undefined,'mcp_server_version':_0x1d6e32(0x19a)},'stack_trace':_0x289e95 instanceof Error?_0x289e95[_0x1d6e32(0x12a)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':'text','text':_0x1d6e32(0x118)+_0x28900a}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5e69d0){const _0x1d6ad4=a0_0x42bd9c,_0x560c0d=await getValidRootDirectories(_0x5e69d0);if(_0x560c0d[_0x1d6ad4(0xe0)]>0x0)allowedDirectories=[..._0x560c0d],console[_0x1d6ad4(0x153)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x560c0d[_0x1d6ad4(0xe0)]+_0x1d6ad4(0x124));else{console[_0x1d6ad4(0x153)](_0x1d6ad4(0x1ae));if(ENABLE_WORKSPACE_MODE)try{const _0x5a27e0=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x5a27e0&&(allowedDirectories=[_0x5a27e0],console[_0x1d6ad4(0x153)](_0x1d6ad4(0xf6)+_0x5a27e0));}catch(_0x324b33){console['error'](_0x1d6ad4(0x170)+_0x324b33);}}}server[a0_0x42bd9c(0x198)](RootsListChangedNotificationSchema,async()=>{const _0x19107a=a0_0x42bd9c;try{const _0x3b2a07=await server['listRoots']();_0x3b2a07&&_0x19107a(0x183)in _0x3b2a07&&await updateAllowedDirectoriesFromRoots(_0x3b2a07[_0x19107a(0x183)]);}catch(_0x5e0024){console[_0x19107a(0x153)](_0x19107a(0x1a9),_0x5e0024 instanceof Error?_0x5e0024['message']:String(_0x5e0024));}}),server[a0_0x42bd9c(0x13d)]=async()=>{const _0x21fe1f=a0_0x42bd9c,_0x2f0a4b=server['getClientCapabilities']();if(_0x2f0a4b?.['roots'])try{const _0x56d1f4=await server['listRoots']();_0x56d1f4&&_0x21fe1f(0x183)in _0x56d1f4?await updateAllowedDirectoriesFromRoots(_0x56d1f4[_0x21fe1f(0x183)]):console[_0x21fe1f(0x153)]('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x2e3dbc){console[_0x21fe1f(0x153)]('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x2e3dbc instanceof Error?_0x2e3dbc[_0x21fe1f(0x13c)]:String(_0x2e3dbc));}else{if(allowedDirectories[_0x21fe1f(0xe0)]>0x0)console[_0x21fe1f(0x153)](_0x21fe1f(0xda),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console['error'](_0x21fe1f(0x14e));else throw new Error(_0x21fe1f(0x150));}}};async function runServer(){const _0x3ad11f=a0_0x42bd9c,_0x184825=new StdioServerTransport();await server['connect'](_0x184825),console[_0x3ad11f(0x153)](_0x3ad11f(0x1a4)),allowedDirectories[_0x3ad11f(0xe0)]===0x0&&console[_0x3ad11f(0x153)](_0x3ad11f(0x142));}runServer()[a0_0x42bd9c(0xf4)](_0x1e7c5e=>{const _0x4c2eee=a0_0x42bd9c;console['error'](_0x4c2eee(0x18b),_0x1e7c5e),process[_0x4c2eee(0x174)](0x1);});
2
+ const a0_0x310433=a0_0x50c1;(function(_0x25b956,_0x21347a){const _0x46f2f4=a0_0x50c1,_0x2a6b87=_0x25b956();while(!![]){try{const _0x1db45f=parseInt(_0x46f2f4(0xd4))/0x1+-parseInt(_0x46f2f4(0x1ad))/0x2*(-parseInt(_0x46f2f4(0xd6))/0x3)+parseInt(_0x46f2f4(0x128))/0x4*(parseInt(_0x46f2f4(0x165))/0x5)+-parseInt(_0x46f2f4(0x186))/0x6+parseInt(_0x46f2f4(0x1a6))/0x7+-parseInt(_0x46f2f4(0xe7))/0x8+-parseInt(_0x46f2f4(0x1b4))/0x9;if(_0x1db45f===_0x21347a)break;else _0x2a6b87['push'](_0x2a6b87['shift']());}catch(_0x1b8d69){_0x2a6b87['push'](_0x2a6b87['shift']());}}}(a0_0x5e0f,0x63fb3));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_0x1b47bd from'fs/promises';import a0_0x3bdf79 from'path';function a0_0x5e0f(){const _0x259163=['tsconfig.json','match','default','toISOString','5724558tLAYlx','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','endLine','object','Natural\x20language\x20query\x20to\x20search\x20for\x20code','For\x20deletions:\x0a','File\x20read\x20error:','495160oduKDJ','\x20\x20\x20Lines\x20','basename','setNotificationHandler','resolve','false','Failed\x20to\x20read\x20file:\x20','5611977GzZNbY','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Error:\x20','slice','finish','</file>','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','stack','connect','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','roots','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\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','133908BYBraR','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','6pIqEJa','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','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','MORPH_API_URL','❌\x20Morph\x20Edit\x20Failed:\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Preview\x20changes\x20without\x20applying\x20them.','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','data','repeat','FileReadError','files','all','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','Benefits:\x0a','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','[could\x20not\x20read\x20file:\x20','2006504SSqvVU','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','realpath','message','string','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Relevant\x20context\x20found:','created','Fallback:\x20Using\x20workspace\x20root\x20','\x0a</file>','setRequestHandler','\x20\x20\x20','success','application/json','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','env','constructor','toLowerCase','getClientCapabilities','homedir','split','-\x20Read\x20file\x20`','startLine','morph-','pyproject.toml','error','MORPH_API_KEY','mcp-filesystem','https://morphllm.com/api/error-report','filter','sep','params','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','text','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','trim','Parent\x20directory\x20does\x20not\x20exist:\x20','...','limit','role','🔍\x20Morph\x20Edit\x20Preview','isArray','Error\x20running\x20fast\x20context\x20search:\x20','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','Enabled\x20tools:\x20','floor','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','errors','\x20as\x20allowed\x20directory','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','assistant','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','%\x20match)\x0a','readFile','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','timed\x20out','path','WORKSPACE_ROOT','exit','code_edit','substring','listRoots','276DkFSpp','source','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','Warning:\x20Workspace\x20fallback\x20failed:\x20','Rules:\x0a','ENABLE_WORKSPACE_MODE','target_directories','Specific\x20commit\x20hash\x20to\x20search','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','\x20chars)','cwd','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','branch','startsWith','\x20is\x20not\x20a\x20directory','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Search\x20failed:\x20','.cursor','repoId','Invalid\x20arguments:\x20','composer.json','codebase_search','unknown','.vscode','query','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','utf-8','searchTimeMs','optional','create\x20this\x20file','unknown\x20error','Fatal\x20error\x20running\x20server:','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','map','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','.git','list_directory\x20','morph-warp-grep-v1-1111v0','edit_file','udiff','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','access','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','join','metadata','\x20-\x20','Max\x20results\x20to\x20return','stats','instruction','timings','rerankScore','content','dirname','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','morph-v3-fast','name','etimedout','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','MORPH_WARP_GREP_TIMEOUT','\x20valid\x20directories','4195vZECjx','PWD','length','terminated','morph-mcp','<file\x20path=\x22','search_string','post','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','catch','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','stringify','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','ENOENT','number','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Repository\x20identifier','includes','terminationReason','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','Created\x20File','dryRun','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','messages','description','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','completed','results','toFixed','filepath','Warning:\x20','warpgrep_codebase_search','Unknown\x20tool:\x20','1325184pxKIrv','runWarpGrep_call','apply\x20these\x20changes','0.2.0','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','code','requiresApiKey','Workspace\x20mode\x20enabled:\x20Using\x20','ENABLED_TOOLS','repo_path','lines','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','-\x20Grepped\x20\x27','\x20(new\x20file)','Found\x20','UnknownError','\x27\x20in\x20`','push','safeParse','WarpGrepError','describe','inputSchema','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','timeout','go.mod','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'];a0_0x5e0f=function(){return _0x259163;};return a0_0x5e0f();}import a0_0x424ca7 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_0x35638b from'axios';function fixPathRepetition(_0x263ab6){const _0x5c2a82=a0_0x50c1,_0x34820f=_0x263ab6[_0x5c2a82(0xfb)](a0_0x3bdf79[_0x5c2a82(0x105)])[_0x5c2a82(0x104)](Boolean);if(_0x34820f[_0x5c2a82(0x167)]<0x2)return null;for(let _0x33372b=Math[_0x5c2a82(0x116)](_0x34820f[_0x5c2a82(0x167)]/0x2);_0x33372b>=0x1;_0x33372b--){for(let _0x45e8b4=0x0;_0x45e8b4<=_0x34820f['length']-0x2*_0x33372b;_0x45e8b4++){const _0x24434b=_0x34820f['slice'](_0x45e8b4,_0x45e8b4+_0x33372b),_0x47a837=_0x34820f[_0x5c2a82(0xca)](_0x45e8b4+_0x33372b,_0x45e8b4+0x2*_0x33372b);if(_0x24434b['every']((_0x57896e,_0x1714a2)=>_0x57896e===_0x47a837[_0x1714a2])){const _0x3a76d7=[..._0x34820f[_0x5c2a82(0xca)](0x0,_0x45e8b4),..._0x34820f[_0x5c2a82(0xca)](_0x45e8b4+_0x33372b)];return a0_0x3bdf79['sep']+_0x3a76d7[_0x5c2a82(0x154)](a0_0x3bdf79[_0x5c2a82(0x105)]);}}}return null;}const args=process['argv']['slice'](0x2),ALL_TOOLS=[a0_0x310433(0x14f),a0_0x310433(0x184),a0_0x310433(0x13d)],DEFAULT_TOOLS=[a0_0x310433(0x14f),'warpgrep_codebase_search'],ENABLED_TOOLS=process['env'][a0_0x310433(0x18f)]?process[a0_0x310433(0xf6)][a0_0x310433(0x18f)]===a0_0x310433(0xe2)?ALL_TOOLS:process['env']['ENABLED_TOOLS'][a0_0x310433(0xfb)](',')[a0_0x310433(0x14a)](_0x39c8af=>_0x39c8af[a0_0x310433(0x10c)]()):DEFAULT_TOOLS;console[a0_0x310433(0x100)](a0_0x310433(0x115)+ENABLED_TOOLS[a0_0x310433(0x154)](',\x20'));function a0_0x50c1(_0x99c9b0,_0x3f0b6b){_0x99c9b0=_0x99c9b0-0xc9;const _0x5e0fcf=a0_0x5e0f();let _0x50c103=_0x5e0fcf[_0x99c9b0];return _0x50c103;}const WORKSPACE_ROOT=process['env'][a0_0x310433(0x123)]||process[a0_0x310433(0xf6)][a0_0x310433(0x166)]||process[a0_0x310433(0x132)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x310433(0x12d)]!==a0_0x310433(0x1b2),MORPH_API_KEY=process['env'][a0_0x310433(0x101)],MORPH_API_URL=process[a0_0x310433(0xf6)][a0_0x310433(0xd9)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x310433(0xf6)][a0_0x310433(0x163)]?parseInt(process[a0_0x310433(0xf6)][a0_0x310433(0x163)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY[a0_0x310433(0x135)](a0_0x310433(0xfe))&&console[a0_0x310433(0x100)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x127469){const _0x5d8546=a0_0x310433;try{await a0_0x35638b[_0x5d8546(0x16c)](_0x5d8546(0x103),{..._0x127469,'timestamp':new Date()[_0x5d8546(0x1a5)](),'source':_0x127469[_0x5d8546(0x129)]||'mcp-filesystem'},{'timeout':0x1388,'headers':{'Content-Type':_0x5d8546(0xf4),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x310433(0x167)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x310433(0x100)](a0_0x310433(0x10b)),console[a0_0x310433(0x100)]('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console['error'](a0_0x310433(0x16d)),console[a0_0x310433(0x100)](a0_0x310433(0x178)),console[a0_0x310433(0x100)](a0_0x310433(0xe8)),console['error'](a0_0x310433(0xcd)));function normalizePath(_0x42cc5e){return a0_0x3bdf79['normalize'](_0x42cc5e);}function expandHome(_0xe80491){const _0x555a52=a0_0x310433;if(_0xe80491[_0x555a52(0x135)]('~/')||_0xe80491==='~')return a0_0x3bdf79[_0x555a52(0x154)](a0_0x424ca7[_0x555a52(0xfa)](),_0xe80491['slice'](0x1));return _0xe80491;}let allowedDirectories=await Promise[a0_0x310433(0xe2)](args[a0_0x310433(0x14a)](async _0x217e81=>{const _0x242e39=a0_0x310433,_0x29285f=expandHome(_0x217e81),_0x4bc1bf=a0_0x3bdf79[_0x242e39(0x1b1)](_0x29285f);try{const _0x1a1f87=await a0_0x1b47bd[_0x242e39(0xe9)](_0x4bc1bf);return normalizePath(_0x1a1f87);}catch(_0x501563){return normalizePath(_0x4bc1bf);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x310433(0x167)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x310433(0x198)](workspaceDir),console[a0_0x310433(0x100)](a0_0x310433(0x18e)+workspaceDir+a0_0x310433(0x119)));}catch(a0_0x398747){console['error'](a0_0x310433(0x120)+a0_0x398747);}async function detectWorkspaceRoot(_0x37dd46){const _0x19cbe4=a0_0x310433;let _0x138ace=a0_0x3bdf79[_0x19cbe4(0x1b1)](_0x37dd46);const _0x45eac4=[_0x19cbe4(0x14c),_0x19cbe4(0x13f),'package.json','Cargo.toml',_0x19cbe4(0xff),_0x19cbe4(0x1a0),_0x19cbe4(0x139),_0x19cbe4(0x1a2),_0x19cbe4(0x13c)];while(_0x138ace!==a0_0x3bdf79['dirname'](_0x138ace)){for(const _0xda4caa of _0x45eac4){const _0x4a0528=a0_0x3bdf79[_0x19cbe4(0x154)](_0x138ace,_0xda4caa);try{return await a0_0x1b47bd[_0x19cbe4(0x152)](_0x4a0528),normalizePath(_0x138ace);}catch{}}_0x138ace=a0_0x3bdf79[_0x19cbe4(0x15d)](_0x138ace);}return normalizePath(_0x37dd46);}await Promise['all'](args[a0_0x310433(0x14a)](async _0x2bc836=>{const _0x3dbc0d=a0_0x310433;try{const _0x559935=await a0_0x1b47bd['stat'](expandHome(_0x2bc836));!_0x559935['isDirectory']()&&(console['error'](_0x3dbc0d(0xc9)+_0x2bc836+_0x3dbc0d(0x136)),process[_0x3dbc0d(0x124)](0x1));}catch(_0x44176f){console[_0x3dbc0d(0x100)]('Error\x20accessing\x20directory\x20'+_0x2bc836+':',_0x44176f),process['exit'](0x1);}}));async function validatePath(_0x1e3365){const _0x36d48c=a0_0x310433,_0x2b4a4f=expandHome(_0x1e3365),_0x148bac=a0_0x3bdf79[_0x36d48c(0x1b1)](_0x2b4a4f);try{const _0x4f1838=await a0_0x1b47bd['realpath'](_0x148bac);return _0x4f1838;}catch(_0x413e8a){if(_0x413e8a[_0x36d48c(0x18c)]===_0x36d48c(0x172)){const _0xca7e75=a0_0x3bdf79[_0x36d48c(0x15d)](_0x148bac);try{const _0x5d1800=await a0_0x1b47bd[_0x36d48c(0xe9)](_0xca7e75);return a0_0x3bdf79[_0x36d48c(0x154)](_0x5d1800,a0_0x3bdf79[_0x36d48c(0x1af)](_0x148bac));}catch{throw new Error(_0x36d48c(0x10d)+_0xca7e75);}}throw _0x413e8a;}}const MorphEditFileArgsSchema=z[a0_0x310433(0x1a9)]({'path':z[a0_0x310433(0xeb)](),'code_edit':z[a0_0x310433(0xeb)]()[a0_0x310433(0x19b)](a0_0x310433(0xd8)),'instruction':z['string']()[a0_0x310433(0x19b)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z['boolean']()[a0_0x310433(0x1a4)](![])[a0_0x310433(0x19b)](a0_0x310433(0xdc))}),WarpGrepArgsSchema=z[a0_0x310433(0x1a9)]({'search_string':z['string']()[a0_0x310433(0x19b)](a0_0x310433(0x114)),'repo_path':z[a0_0x310433(0xeb)]()[a0_0x310433(0x19b)]('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_0x310433(0x1a9)]({'query':z[a0_0x310433(0xeb)]()[a0_0x310433(0x19b)](a0_0x310433(0x1aa)),'repoId':z[a0_0x310433(0xeb)]()[a0_0x310433(0x19b)](a0_0x310433(0x175)),'branch':z[a0_0x310433(0xeb)]()[a0_0x310433(0x145)]()[a0_0x310433(0x19b)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x310433(0xeb)]()[a0_0x310433(0x145)]()[a0_0x310433(0x19b)](a0_0x310433(0x12f)),'target_directories':z['array'](z[a0_0x310433(0xeb)]())[a0_0x310433(0x1a4)]([])['describe'](a0_0x310433(0x137)),'limit':z[a0_0x310433(0x173)]()[a0_0x310433(0x145)]()[a0_0x310433(0x1a4)](0xa)[a0_0x310433(0x19b)](a0_0x310433(0x157))}),server=new Server({'name':a0_0x310433(0x169),'version':a0_0x310433(0x189)},{'capabilities':{'tools':{}}});server[a0_0x310433(0xf1)](ListToolsRequestSchema,async()=>{const _0x491c33=a0_0x310433,_0x2fe6c0=[{'name':'edit_file','description':_0x491c33(0x149)+_0x491c33(0x18b)+_0x491c33(0x153)+_0x491c33(0xd2)+_0x491c33(0xe4)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x491c33(0x11a)+_0x491c33(0x142)+_0x491c33(0x14b)+_0x491c33(0x1b5)+_0x491c33(0x16f)+_0x491c33(0x107)+_0x491c33(0x1ab)+_0x491c33(0x17b)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x491c33(0x12c)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x491c33(0x1a7)+_0x491c33(0xec)+_0x491c33(0x1a1)+_0x491c33(0xd0)+_0x491c33(0xf5)+_0x491c33(0xd3),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x491c33(0xe3)+_0x491c33(0xd7)+_0x491c33(0x162)+_0x491c33(0x192)+_0x491c33(0x12a)+_0x491c33(0x130)+_0x491c33(0x10a)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x491c33(0x13d),'description':_0x491c33(0x19e)+_0x491c33(0x15e)+_0x491c33(0x133)+_0x491c33(0xe4)+_0x491c33(0xe5)+_0x491c33(0x17e)+_0x491c33(0xd5)+_0x491c33(0x18a)+_0x491c33(0x11c)+'Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20'+_0x491c33(0x117),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x2970ae=_0x2fe6c0[_0x491c33(0x104)](_0x3618fe=>{const _0xe56eb6=_0x491c33;if(!ENABLED_TOOLS[_0xe56eb6(0x176)](_0x3618fe[_0xe56eb6(0x160)]))return![];if(_0xe56eb6(0x18d)in _0x3618fe&&_0x3618fe[_0xe56eb6(0x18d)]&&!MORPH_API_KEY)return console[_0xe56eb6(0x100)](_0xe56eb6(0x183)+_0x3618fe[_0xe56eb6(0x160)]+_0xe56eb6(0x108)),![];return!![];});return{'tools':_0x2970ae[_0x491c33(0x14a)](_0x39bcc9=>({'name':_0x39bcc9[_0x491c33(0x160)],'description':_0x39bcc9[_0x491c33(0x17d)],'inputSchema':_0x39bcc9[_0x491c33(0x19c)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x519438=>{const _0x4c0e5f=a0_0x310433;try{const {name:_0x51a47b,arguments:_0xdda55b}=_0x519438[_0x4c0e5f(0x106)];switch(_0x51a47b){case _0x4c0e5f(0x14f):{const _0x26c5dc=MorphEditFileArgsSchema[_0x4c0e5f(0x199)](_0xdda55b);if(!_0x26c5dc['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x26c5dc[_0x4c0e5f(0x100)]);const _0x50162b=await validatePath(_0x26c5dc[_0x4c0e5f(0xde)]['path']);let _0x82d860=null,_0x1a3c80=!![],_0x1d71fb=null;try{_0x82d860=await a0_0x1b47bd['readFile'](_0x50162b,_0x4c0e5f(0x143));}catch(_0x36efc7){const _0x2e5ded=_0x36efc7[_0x4c0e5f(0x18c)];_0x2e5ded==='ENOENT'?(_0x1a3c80=![],_0x82d860=''):(_0x1d71fb=_0x4c0e5f(0x1b3)+(_0x2e5ded||_0x4c0e5f(0x13e))+_0x4c0e5f(0x156)+(_0x36efc7 instanceof Error?_0x36efc7['message']:String(_0x36efc7)),console[_0x4c0e5f(0x100)]('Warning:\x20'+_0x1d71fb));}try{const _0x1a2ad4=MORPH_API_KEY;if(!_0x1a2ad4)throw new Error(_0x4c0e5f(0x174));const _0x5a8339=a0_0x3bdf79[_0x4c0e5f(0x15d)](_0x50162b),_0xa4ad33=a0_0x3bdf79[_0x4c0e5f(0x1af)](_0x50162b),_0x1abe52=await executeEditFile({'target_filepath':_0xa4ad33,'code_edit':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x125)],'instructions':_0x26c5dc[_0x4c0e5f(0xde)]['instruction']},{'morphApiKey':_0x1a2ad4,'morphApiUrl':MORPH_API_URL,'baseDir':_0x5a8339,'autoWrite':!_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x17a)],'generateUdiff':!![],'debug':![]});if(!_0x1abe52[_0x4c0e5f(0xf3)])throw new Error(_0x1abe52['error']||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x5e345f=_0x1abe52[_0x4c0e5f(0x150)]||'';let _0x11fa71=0x3;while(_0x5e345f[_0x4c0e5f(0x176)]('`'['repeat'](_0x11fa71))){_0x11fa71++;}const _0x3b2db7='`'[_0x4c0e5f(0xdf)](_0x11fa71)+'diff\x0a'+_0x5e345f+'`'[_0x4c0e5f(0xdf)](_0x11fa71)+'\x0a\x0a';if(_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x17a)])return{'content':[{'type':'text','text':_0x4c0e5f(0x111)+(_0x1a3c80?'':_0x4c0e5f(0x194))+':\x20'+_0x26c5dc[_0x4c0e5f(0xde)]['instruction']+'\x0a\x0a'+_0x3b2db7+'Use\x20dryRun=false\x20to\x20'+(_0x1a3c80?_0x4c0e5f(0x188):_0x4c0e5f(0x146))+'.'}]};return{'content':[{'type':'text','text':'Morph\x20Edit\x20'+(_0x1a3c80?'Applied':_0x4c0e5f(0x179))+':\x20'+_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x159)]+'\x0a\x0a'+_0x3b2db7+'Successfully\x20'+(_0x1a3c80?'applied\x20edits\x20to':_0x4c0e5f(0xee))+'\x20'+_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x122)]}]};}catch(_0x119575){const _0xe09faf=_0x119575 instanceof Error?_0x119575[_0x4c0e5f(0xea)]:String(_0x119575);return reportMorphError({'error_message':_0xe09faf,'error_type':_0x119575 instanceof Error?_0x119575[_0x4c0e5f(0xf7)][_0x4c0e5f(0x160)]:'UnknownError','context':{'tool':'edit_file','file_path':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x122)],'validated_path':_0x50162b,'instruction':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x159)],'model':'morph-v3-fast','dry_run':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x17a)],'file_exists':_0x1a3c80,'file_read_error':_0x1d71fb,'file_readable':_0x82d860!==null,'request_content':{'path':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x122)],'code_edit':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x125)],'instruction':_0x26c5dc[_0x4c0e5f(0xde)][_0x4c0e5f(0x159)],'original_code':_0x82d860!==null?_0x82d860[_0x4c0e5f(0x167)]>0xc350?_0x82d860[_0x4c0e5f(0x126)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x82d860[_0x4c0e5f(0x167)]+_0x4c0e5f(0x131):_0x82d860:_0x4c0e5f(0xe6)+(_0x1d71fb||_0x4c0e5f(0x147))+']','original_code_length':_0x82d860?.[_0x4c0e5f(0x167)]??0x0,'model':_0x4c0e5f(0x15f),'dry_run':_0x26c5dc['data'][_0x4c0e5f(0x17a)]}},'stack_trace':_0x119575 instanceof Error?_0x119575[_0x4c0e5f(0xce)]:undefined,'source':_0x4c0e5f(0x102)})['catch'](()=>{}),{'content':[{'type':'text','text':_0x4c0e5f(0xda)+_0xe09faf}],'isError':!![]};}}case'warpgrep_codebase_search':{const _0x414135=WarpGrepArgsSchema['safeParse'](_0xdda55b);if(!_0x414135[_0x4c0e5f(0xf3)])return{'content':[{'type':_0x4c0e5f(0x109),'text':_0x4c0e5f(0x13b)+_0x414135[_0x4c0e5f(0x100)]}],'isError':!![]};const _0x54110d=_0x3b7d56=>{const _0x32eb7d=_0x4c0e5f,_0x369d1c=[];for(const _0x521db6 of _0x3b7d56||[]){const _0x36c3b4=_0x521db6[_0x32eb7d(0x110)],_0x396388=_0x521db6[_0x32eb7d(0x15c)];if(_0x36c3b4===_0x32eb7d(0x11b)&&_0x396388){const _0x5b28d9=_0x396388[_0x32eb7d(0xfb)]('\x0a')[_0x32eb7d(0x104)](_0x210823=>_0x210823[_0x32eb7d(0x10c)]());for(const _0x36018b of _0x5b28d9){const _0x52479c=_0x36018b[_0x32eb7d(0x1a3)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x52479c){_0x369d1c[_0x32eb7d(0x198)]('grep\x20\x27'+_0x52479c[0x1]+'\x27\x20'+_0x52479c[0x2]);continue;}const _0xf611b1=_0x36018b[_0x32eb7d(0x1a3)](/^read\s+(.+)$/);if(_0xf611b1){_0x369d1c[_0x32eb7d(0x198)]('read\x20'+_0xf611b1[0x1]);continue;}const _0x33bbd7=_0x36018b[_0x32eb7d(0x1a3)](/^list_directory\s+(.+)$/);if(_0x33bbd7){_0x369d1c[_0x32eb7d(0x198)](_0x32eb7d(0x14d)+_0x33bbd7[0x1]);continue;}}}}return _0x369d1c;};try{const _0x65d6f8=a0_0x3bdf79[_0x4c0e5f(0x1b1)](_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)]),_0x38b050=new LocalRipgrepProvider(_0x65d6f8),_0x22275a=await runWarpGrep({'query':_0x414135['data'][_0x4c0e5f(0x16b)],'repoRoot':_0x65d6f8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x38b050});let _0x8ff19='';if(_0x22275a['terminationReason']===_0x4c0e5f(0x17f)&&_0x22275a['finish']?.[_0x4c0e5f(0x155)]?.[_0x4c0e5f(0xe1)]){const _0x3d5b22=_0x22275a[_0x4c0e5f(0xcb)]['metadata'][_0x4c0e5f(0xe1)],_0x8734cb=[],_0x3b9eaa=[_0x4c0e5f(0x11d)];for(const _0xcd26e of _0x22275a[_0x4c0e5f(0x17c)]){const _0x434b74=_0xcd26e[_0x4c0e5f(0x110)],_0x230398=_0xcd26e[_0x4c0e5f(0x15c)];if(_0x434b74===_0x4c0e5f(0x11b)&&_0x230398){const _0x261a6c=_0x230398[_0x4c0e5f(0xfb)]('\x0a')[_0x4c0e5f(0x104)](_0x4644b7=>_0x4644b7[_0x4c0e5f(0x10c)]());for(const _0x2b2011 of _0x261a6c){const _0x5995c1=_0x2b2011[_0x4c0e5f(0x1a3)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x5995c1){_0x3b9eaa[_0x4c0e5f(0x198)](_0x4c0e5f(0x193)+_0x5995c1[0x1]+_0x4c0e5f(0x197)+_0x5995c1[0x2]+'`');continue;}const _0x344d5b=_0x2b2011[_0x4c0e5f(0x1a3)](/^read\s+(.+)$/);if(_0x344d5b){_0x3b9eaa[_0x4c0e5f(0x198)](_0x4c0e5f(0xfc)+_0x344d5b[0x1]+'`');continue;}const _0x389c35=_0x2b2011[_0x4c0e5f(0x1a3)](/^list_directory\s+(.+)$/);if(_0x389c35){_0x3b9eaa[_0x4c0e5f(0x198)]('-\x20Listed\x20directory\x20`'+_0x389c35[0x1]+'`');continue;}}}}_0x8734cb[_0x4c0e5f(0x198)](_0x3b9eaa['join']('\x0a'));const _0x240c63=['',_0x4c0e5f(0xed)];for(const _0xbe058c of _0x3d5b22){if(_0xbe058c[_0x4c0e5f(0x191)]==='*')_0x240c63['push']('-\x20'+_0xbe058c[_0x4c0e5f(0x122)]+':*');else{if(Array[_0x4c0e5f(0x112)](_0xbe058c[_0x4c0e5f(0x191)])){const _0xbc3a3d=_0xbe058c[_0x4c0e5f(0x191)][_0x4c0e5f(0x14a)](([_0x304acf,_0x4e51db])=>{if(_0x304acf===_0x4e51db)return''+_0x304acf;return _0x304acf+'-'+_0x4e51db;});_0x240c63[_0x4c0e5f(0x198)]('-\x20'+_0xbe058c[_0x4c0e5f(0x122)]+':'+_0xbc3a3d[_0x4c0e5f(0x154)](','));}else _0x240c63[_0x4c0e5f(0x198)]('-\x20'+_0xbe058c[_0x4c0e5f(0x122)]+':*');}}_0x240c63[_0x4c0e5f(0x198)](''),_0x8734cb[_0x4c0e5f(0x198)](_0x240c63[_0x4c0e5f(0x154)]('\x0a')),_0x8734cb[_0x4c0e5f(0x198)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x304d3b=[];for(const _0x1fc19a of _0x3d5b22){let _0x440e14=a0_0x3bdf79[_0x4c0e5f(0x1b1)](_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)],_0x1fc19a[_0x4c0e5f(0x122)]),_0x3eb7cf=null,_0x4ff5df=null;try{_0x3eb7cf=await a0_0x1b47bd[_0x4c0e5f(0x11f)](_0x440e14,{'encoding':_0x4c0e5f(0x143)});}catch(_0x39f336){const _0x2e5e6f=fixPathRepetition(_0x440e14);if(_0x2e5e6f)try{_0x3eb7cf=await a0_0x1b47bd[_0x4c0e5f(0x11f)](_0x2e5e6f,{'encoding':_0x4c0e5f(0x143)}),_0x440e14=_0x2e5e6f;}catch{_0x4ff5df=_0x39f336 instanceof Error?_0x39f336:new Error(String(_0x39f336));}else _0x4ff5df=_0x39f336 instanceof Error?_0x39f336:new Error(String(_0x39f336));}if(_0x3eb7cf!==null){const _0x38eb5c=_0x3eb7cf[_0x4c0e5f(0xfb)](/\r?\n/),_0x4a99cf=[_0x4c0e5f(0x16a)+_0x1fc19a[_0x4c0e5f(0x122)]+'\x22>'];if(_0x1fc19a[_0x4c0e5f(0x191)]==='*'||!Array['isArray'](_0x1fc19a[_0x4c0e5f(0x191)]))for(let _0x5e1fbe=0x1;_0x5e1fbe<=_0x38eb5c[_0x4c0e5f(0x167)];_0x5e1fbe++){const _0x1572e2=_0x38eb5c[_0x5e1fbe-0x1];_0x4a99cf[_0x4c0e5f(0x198)](_0x5e1fbe+'|\x20'+_0x1572e2);}else for(const [_0x1c178b,_0x38d29f]of _0x1fc19a['lines']){_0x4a99cf[_0x4c0e5f(0x167)]>0x1&&_0x4a99cf[_0x4c0e5f(0x198)]('');for(let _0xea468e=_0x1c178b;_0xea468e<=_0x38d29f&&_0xea468e<=_0x38eb5c[_0x4c0e5f(0x167)];_0xea468e++){const _0x14c9d0=_0x38eb5c[_0xea468e-0x1];_0x4a99cf[_0x4c0e5f(0x198)](_0xea468e+'|\x20'+_0x14c9d0);}}_0x4a99cf['push'](_0x4c0e5f(0xcc)),_0x304d3b[_0x4c0e5f(0x198)](_0x4a99cf[_0x4c0e5f(0x154)]('\x0a'));}else _0x304d3b[_0x4c0e5f(0x198)]('<file\x20path=\x22'+_0x1fc19a[_0x4c0e5f(0x122)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x4ff5df?.['message']||'Unknown\x20error')+_0x4c0e5f(0xf0));}_0x8734cb[_0x4c0e5f(0x198)](_0x304d3b[_0x4c0e5f(0x154)]('\x0a\x0a')),_0x8ff19=_0x8734cb[_0x4c0e5f(0x154)]('\x0a');const _0x4ce2ee=_0x22275a[_0x4c0e5f(0x118)]?.[_0x4c0e5f(0x104)](_0x3cd33c=>_0x3cd33c[_0x4c0e5f(0xea)]?.[_0x4c0e5f(0x135)](_0x4c0e5f(0x1ac)))||[];if(_0x4ce2ee[_0x4c0e5f(0x167)]>0x0){const _0x24c3cd=_0x4ce2ee['map'](_0x2b73b4=>_0x2b73b4[_0x4c0e5f(0xea)])[_0x4c0e5f(0x154)](';\x20');reportMorphError({'error_message':_0x24c3cd,'error_type':_0x4c0e5f(0xe0),'context':{'tool':_0x4c0e5f(0x184),'repo_path':_0x414135[_0x4c0e5f(0xde)]['repo_path'],'query':_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x16b)],'model':_0x4c0e5f(0x14e),'termination_reason':'completed_with_file_errors','error_count':_0x4ce2ee[_0x4c0e5f(0x167)],'is_timeout':![],'timings':_0x22275a['timings'],'files_attempted':_0x3d5b22[_0x4c0e5f(0x14a)](_0x4fd0a5=>({'path':_0x4fd0a5['path'],'lines':_0x4fd0a5['lines']})),'tool_calls':_0x54110d(_0x22275a[_0x4c0e5f(0x17c)]),'messages':_0x22275a['messages']?.['map'](_0x3cc466=>({'role':_0x3cc466['role'],'content':_0x3cc466[_0x4c0e5f(0x15c)]})),'request_content':{'query':_0x414135['data'][_0x4c0e5f(0x16b)],'repo_path':_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)],'repoRoot':a0_0x3bdf79[_0x4c0e5f(0x1b1)](_0x414135[_0x4c0e5f(0xde)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'source':_0x4c0e5f(0x102)})[_0x4c0e5f(0x16e)](()=>{});}}else{if(_0x22275a[_0x4c0e5f(0x177)]===_0x4c0e5f(0x168)&&_0x22275a[_0x4c0e5f(0x118)][_0x4c0e5f(0x167)]>0x0){const _0x1ffe89=_0x22275a[_0x4c0e5f(0x118)][_0x4c0e5f(0x14a)](_0x4087b5=>_0x4087b5[_0x4c0e5f(0xea)])[_0x4c0e5f(0x154)](';\x20');_0x8ff19=_0x4c0e5f(0xc9)+_0x1ffe89;const _0x3f08a0=_0x1ffe89['toLowerCase']()[_0x4c0e5f(0x176)](_0x4c0e5f(0x19f))||_0x1ffe89[_0x4c0e5f(0xf8)]()[_0x4c0e5f(0x176)](_0x4c0e5f(0x121))||_0x1ffe89['toLowerCase']()['includes'](_0x4c0e5f(0x161)),_0x55fa22=_0x22275a['finish']?.['metadata']?.[_0x4c0e5f(0xe1)],_0x5a2bc7=_0x22275a['errors'][0x0];reportMorphError({'error_message':_0x1ffe89,'error_type':_0x3f08a0?'TimeoutError':_0x5a2bc7?.[_0x4c0e5f(0xf7)]?.[_0x4c0e5f(0x160)]||_0x4c0e5f(0x19a),'context':{'tool':_0x4c0e5f(0x184),'repo_path':_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)],'query':_0x414135[_0x4c0e5f(0xde)]['search_string'],'model':_0x4c0e5f(0x14e),'termination_reason':_0x22275a[_0x4c0e5f(0x177)],'error_count':_0x22275a[_0x4c0e5f(0x118)][_0x4c0e5f(0x167)],'is_timeout':_0x3f08a0,'timings':_0x22275a[_0x4c0e5f(0x15a)],'files_attempted':_0x55fa22?.[_0x4c0e5f(0x14a)](_0x4b991e=>({'path':_0x4b991e['path'],'lines':_0x4b991e[_0x4c0e5f(0x191)]})),'tool_calls':_0x54110d(_0x22275a[_0x4c0e5f(0x17c)]),'messages':_0x22275a[_0x4c0e5f(0x17c)]?.[_0x4c0e5f(0x14a)](_0x6932e2=>({'role':_0x6932e2[_0x4c0e5f(0x110)],'content':_0x6932e2['content']})),'request_content':{'query':_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x16b)],'repo_path':_0x414135[_0x4c0e5f(0xde)]['repo_path'],'repoRoot':a0_0x3bdf79[_0x4c0e5f(0x1b1)](_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x5a2bc7?.[_0x4c0e5f(0xce)]||undefined,'source':'mcp-filesystem'})[_0x4c0e5f(0x16e)](()=>{});}else _0x8ff19='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x4c0e5f(0x109),'text':_0x8ff19}]};}catch(_0xfd03f7){const _0x5e2816=_0xfd03f7 instanceof Error?_0xfd03f7['message']:String(_0xfd03f7),_0x14c42c=_0x5e2816[_0x4c0e5f(0xf8)]()[_0x4c0e5f(0x176)](_0x4c0e5f(0x19f))||_0x5e2816[_0x4c0e5f(0xf8)]()[_0x4c0e5f(0x176)](_0x4c0e5f(0x121))||_0x5e2816[_0x4c0e5f(0xf8)]()[_0x4c0e5f(0x176)](_0x4c0e5f(0x161))||_0xfd03f7 instanceof Error&&_0xfd03f7[_0x4c0e5f(0x160)]==='TimeoutError';return reportMorphError({'error_message':_0x5e2816,'error_type':_0x14c42c?'TimeoutError':_0xfd03f7 instanceof Error?_0xfd03f7['constructor']['name']:_0x4c0e5f(0x196),'context':{'tool':_0x4c0e5f(0x184),'repo_path':_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)],'query':_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x16b)],'model':_0x4c0e5f(0x14e),'is_timeout':_0x14c42c,'exception_phase':_0x4c0e5f(0x187),'request_content':{'query':_0x414135['data'][_0x4c0e5f(0x16b)],'repo_path':_0x414135[_0x4c0e5f(0xde)]['repo_path'],'repoRoot':a0_0x3bdf79['resolve'](_0x414135[_0x4c0e5f(0xde)][_0x4c0e5f(0x190)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0xfd03f7 instanceof Error?_0xfd03f7[_0x4c0e5f(0xce)]:undefined,'source':'mcp-filesystem'})[_0x4c0e5f(0x16e)](()=>{}),{'content':[{'type':'text','text':_0x4c0e5f(0x113)+_0x5e2816}],'isError':![]};}}case'codebase_search':{const _0x201109=CodebaseSearchArgsSchema[_0x4c0e5f(0x199)](_0xdda55b);if(!_0x201109[_0x4c0e5f(0xf3)])return{'content':[{'type':_0x4c0e5f(0x109),'text':_0x4c0e5f(0x13b)+_0x201109[_0x4c0e5f(0x100)]}],'isError':!![]};try{const _0x546a45=MORPH_API_KEY;if(!_0x546a45)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x1e7ebc=await executeCodebaseSearch({'query':_0x201109[_0x4c0e5f(0xde)]['query'],'target_directories':_0x201109['data'][_0x4c0e5f(0x12e)],'limit':_0x201109['data'][_0x4c0e5f(0x10f)]},{'apiKey':_0x546a45,'repoId':_0x201109['data'][_0x4c0e5f(0x13a)],'branch':_0x201109[_0x4c0e5f(0xde)][_0x4c0e5f(0x134)],'commitHash':_0x201109[_0x4c0e5f(0xde)]['commitHash'],'debug':![]});if(!_0x1e7ebc[_0x4c0e5f(0xf3)])return{'content':[{'type':'text','text':_0x4c0e5f(0x138)+_0x1e7ebc['error']}],'isError':!![]};const _0x2ead10=_0x1e7ebc[_0x4c0e5f(0x180)][_0x4c0e5f(0x167)]===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x201109[_0x4c0e5f(0xde)][_0x4c0e5f(0x140)]+'\x22':_0x4c0e5f(0x195)+_0x1e7ebc[_0x4c0e5f(0x180)][_0x4c0e5f(0x167)]+'\x20results\x20in\x20'+_0x1e7ebc[_0x4c0e5f(0x158)][_0x4c0e5f(0x144)]+'ms:\x0a\x0a'+_0x1e7ebc[_0x4c0e5f(0x180)][_0x4c0e5f(0x14a)]((_0x148ffd,_0x2136c7)=>_0x2136c7+0x1+'.\x20'+_0x148ffd[_0x4c0e5f(0x182)]+'\x20('+(_0x148ffd[_0x4c0e5f(0x15b)]*0x64)[_0x4c0e5f(0x181)](0x1)+_0x4c0e5f(0x11e)+(_0x4c0e5f(0x1ae)+_0x148ffd[_0x4c0e5f(0xfd)]+'-'+_0x148ffd[_0x4c0e5f(0x1a8)]+'\x0a')+(_0x4c0e5f(0xf2)+_0x148ffd['content'][_0x4c0e5f(0x126)](0x0,0xc8)+(_0x148ffd[_0x4c0e5f(0x15c)]['length']>0xc8?_0x4c0e5f(0x10e):'')+'\x0a'))[_0x4c0e5f(0x154)]('\x0a');return{'content':[{'type':_0x4c0e5f(0x109),'text':_0x2ead10}]};}catch(_0x58df28){const _0x3ce5a2=_0x58df28 instanceof Error?_0x58df28[_0x4c0e5f(0xea)]:String(_0x58df28);return reportMorphError({'error_message':_0x3ce5a2,'error_type':_0x58df28 instanceof Error?_0x58df28['constructor'][_0x4c0e5f(0x160)]:_0x4c0e5f(0x196),'context':{'tool':_0x4c0e5f(0x13d),'query':_0x201109[_0x4c0e5f(0xde)]['query'],'repo_id':_0x201109[_0x4c0e5f(0xde)][_0x4c0e5f(0x13a)]},'stack_trace':_0x58df28 instanceof Error?_0x58df28[_0x4c0e5f(0xce)]:undefined,'source':_0x4c0e5f(0x102)})[_0x4c0e5f(0x16e)](()=>{}),{'content':[{'type':_0x4c0e5f(0x109),'text':'Error:\x20'+_0x3ce5a2}],'isError':!![]};}}default:throw new Error(_0x4c0e5f(0x185)+_0x51a47b);}}catch(_0x529568){const _0x5d790d=_0x529568 instanceof Error?_0x529568[_0x4c0e5f(0xea)]:String(_0x529568);return reportMorphError({'error_message':_0x5d790d,'error_type':_0x529568 instanceof Error?_0x529568[_0x4c0e5f(0xf7)][_0x4c0e5f(0x160)]:_0x4c0e5f(0x196),'context':{'tool':name,'arguments':args?JSON[_0x4c0e5f(0x170)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x4c0e5f(0x189)},'stack_trace':_0x529568 instanceof Error?_0x529568[_0x4c0e5f(0xce)]:undefined,'source':_0x4c0e5f(0x102)})[_0x4c0e5f(0x16e)](()=>{}),{'content':[{'type':_0x4c0e5f(0x109),'text':_0x4c0e5f(0xc9)+_0x5d790d}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3c5aff){const _0x127dc2=a0_0x310433,_0x4ceaa3=await getValidRootDirectories(_0x3c5aff);if(_0x4ceaa3['length']>0x0)allowedDirectories=[..._0x4ceaa3],console[_0x127dc2(0x100)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x4ceaa3[_0x127dc2(0x167)]+_0x127dc2(0x164));else{console[_0x127dc2(0x100)](_0x127dc2(0x141));if(ENABLE_WORKSPACE_MODE)try{const _0x158120=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x158120&&(allowedDirectories=[_0x158120],console[_0x127dc2(0x100)](_0x127dc2(0xef)+_0x158120));}catch(_0x517c40){console[_0x127dc2(0x100)](_0x127dc2(0x12b)+_0x517c40);}}}server[a0_0x310433(0x1b0)](RootsListChangedNotificationSchema,async()=>{const _0x1aac57=a0_0x310433;try{const _0x20d7a1=await server[_0x1aac57(0x127)]();_0x20d7a1&&_0x1aac57(0xd1)in _0x20d7a1&&await updateAllowedDirectoriesFromRoots(_0x20d7a1['roots']);}catch(_0x3e406e){console['error']('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x3e406e instanceof Error?_0x3e406e[_0x1aac57(0xea)]:String(_0x3e406e));}}),server['oninitialized']=async()=>{const _0x4be710=a0_0x310433,_0x1199bc=server[_0x4be710(0xf9)]();if(_0x1199bc?.[_0x4be710(0xd1)])try{const _0x27f0f5=await server['listRoots']();_0x27f0f5&&'roots'in _0x27f0f5?await updateAllowedDirectoriesFromRoots(_0x27f0f5[_0x4be710(0xd1)]):console['error'](_0x4be710(0xdd));}catch(_0x553336){console[_0x4be710(0x100)](_0x4be710(0xdb),_0x553336 instanceof Error?_0x553336['message']:String(_0x553336));}else{if(allowedDirectories['length']>0x0)console[_0x4be710(0x100)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console['error'](_0x4be710(0x19d));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 _0x2f6bad=a0_0x310433,_0x4c6415=new StdioServerTransport();await server[_0x2f6bad(0xcf)](_0x4c6415),console[_0x2f6bad(0x100)](_0x2f6bad(0x171)),allowedDirectories['length']===0x0&&console['error'](_0x2f6bad(0x151));}runServer()[a0_0x310433(0x16e)](_0x648c3d=>{const _0x354923=a0_0x310433;console['error'](_0x354923(0x148),_0x648c3d),process['exit'](0x1);});
@@ -1 +1 @@
1
- (function(_0x138ba3,_0x2dc229){const _0x6c8e7=a1_0x42df,_0x59715a=_0x138ba3();while(!![]){try{const _0x24415a=parseInt(_0x6c8e7(0x190))/0x1+parseInt(_0x6c8e7(0x182))/0x2+parseInt(_0x6c8e7(0x18f))/0x3*(-parseInt(_0x6c8e7(0x187))/0x4)+parseInt(_0x6c8e7(0x188))/0x5*(-parseInt(_0x6c8e7(0x180))/0x6)+-parseInt(_0x6c8e7(0x17c))/0x7+parseInt(_0x6c8e7(0x18d))/0x8*(-parseInt(_0x6c8e7(0x17e))/0x9)+parseInt(_0x6c8e7(0x185))/0xa*(parseInt(_0x6c8e7(0x17f))/0xb);if(_0x24415a===_0x2dc229)break;else _0x59715a['push'](_0x59715a['shift']());}catch(_0xaee400){_0x59715a['push'](_0x59715a['shift']());}}}(a1_0x3d99,0x60376));function a1_0x42df(_0x54d082,_0x266eee){_0x54d082=_0x54d082-0x17b;const _0x3d9908=a1_0x3d99();let _0x42df7c=_0x3d9908[_0x54d082];return _0x42df7c;}import a1_0x2ad0a5 from'path';import a1_0x5460c8 from'os';export function convertToWindowsPath(_0x3a932e){const _0x2e4eaf=a1_0x42df;if(_0x3a932e['startsWith'](_0x2e4eaf(0x186))){const _0x205c90=_0x3a932e[_0x2e4eaf(0x18c)](0x5)[_0x2e4eaf(0x183)](),_0x1f817b=_0x3a932e[_0x2e4eaf(0x17b)](0x6)[_0x2e4eaf(0x17d)](/\//g,'\x5c');return _0x205c90+':'+_0x1f817b;}if(_0x3a932e[_0x2e4eaf(0x184)](/^\/[a-zA-Z]\//)){const _0x218bbc=_0x3a932e[_0x2e4eaf(0x18c)](0x1)[_0x2e4eaf(0x183)](),_0xdd812c=_0x3a932e[_0x2e4eaf(0x17b)](0x2)[_0x2e4eaf(0x17d)](/\//g,'\x5c');return _0x218bbc+':'+_0xdd812c;}if(_0x3a932e[_0x2e4eaf(0x184)](/^[a-zA-Z]:/))return _0x3a932e[_0x2e4eaf(0x17d)](/\//g,'\x5c');return _0x3a932e;}export function normalizePath(_0x40f46e){const _0xa8e4c5=a1_0x42df;_0x40f46e=_0x40f46e[_0xa8e4c5(0x181)]()['replace'](/^["']|["']$/g,'');const _0x1813f8=_0x40f46e[_0xa8e4c5(0x18a)]('/')&&!_0x40f46e[_0xa8e4c5(0x184)](/^\/mnt\/[a-z]\//i)&&!_0x40f46e[_0xa8e4c5(0x184)](/^\/[a-zA-Z]\//);if(_0x1813f8)return _0x40f46e['replace'](/\/+/g,'/')[_0xa8e4c5(0x17d)](/\/+$/,'');_0x40f46e=convertToWindowsPath(_0x40f46e);if(_0x40f46e[_0xa8e4c5(0x18a)]('\x5c\x5c')){let _0x273f80=_0x40f46e;_0x273f80=_0x273f80['replace'](/^\\{2,}/,'\x5c\x5c');const _0x3d7318=_0x273f80['substring'](0x2)[_0xa8e4c5(0x17d)](/\\\\/g,'\x5c');_0x40f46e='\x5c\x5c'+_0x3d7318;}else _0x40f46e=_0x40f46e[_0xa8e4c5(0x17d)](/\\\\/g,'\x5c');let _0x1d166b=a1_0x2ad0a5[_0xa8e4c5(0x18e)](_0x40f46e);_0x40f46e[_0xa8e4c5(0x18a)]('\x5c\x5c')&&!_0x1d166b[_0xa8e4c5(0x18a)]('\x5c\x5c')&&(_0x1d166b='\x5c'+_0x1d166b);if(_0x1d166b['match'](/^[a-zA-Z]:/)){let _0x4ad53d=_0x1d166b[_0xa8e4c5(0x17d)](/\//g,'\x5c');return/^[a-z]:/[_0xa8e4c5(0x18b)](_0x4ad53d)&&(_0x4ad53d=_0x4ad53d[_0xa8e4c5(0x18c)](0x0)[_0xa8e4c5(0x183)]()+_0x4ad53d[_0xa8e4c5(0x17b)](0x1)),_0x4ad53d;}return _0x1d166b['replace'](/\//g,'\x5c');}function a1_0x3d99(){const _0x315f2e=['474347pouEWg','join','slice','157920zJEIkN','replace','27963fdvKMJ','1481436ukuLHR','400926JkfbOh','trim','80678kRUWyH','toUpperCase','match','90ImPtpJ','/mnt/','4936ZBEdzZ','15VyeLzn','homedir','startsWith','test','charAt','1672KZyqNf','normalize','1119lHOEWW'];a1_0x3d99=function(){return _0x315f2e;};return a1_0x3d99();}export function expandHome(_0x50c546){const _0x4b39c4=a1_0x42df;if(_0x50c546[_0x4b39c4(0x18a)]('~/')||_0x50c546==='~')return a1_0x2ad0a5[_0x4b39c4(0x191)](a1_0x5460c8[_0x4b39c4(0x189)](),_0x50c546[_0x4b39c4(0x17b)](0x1));return _0x50c546;}
1
+ (function(_0x5d6e3d,_0x5eaf7d){const _0xfa2d2=a1_0x54c1,_0x18659e=_0x5d6e3d();while(!![]){try{const _0x1a9cec=parseInt(_0xfa2d2(0x145))/0x1*(parseInt(_0xfa2d2(0x149))/0x2)+-parseInt(_0xfa2d2(0x13a))/0x3+parseInt(_0xfa2d2(0x14b))/0x4+-parseInt(_0xfa2d2(0x14a))/0x5*(-parseInt(_0xfa2d2(0x144))/0x6)+-parseInt(_0xfa2d2(0x140))/0x7+parseInt(_0xfa2d2(0x137))/0x8+-parseInt(_0xfa2d2(0x139))/0x9;if(_0x1a9cec===_0x5eaf7d)break;else _0x18659e['push'](_0x18659e['shift']());}catch(_0x521ff9){_0x18659e['push'](_0x18659e['shift']());}}}(a1_0x5296,0x6e359));function a1_0x5296(){const _0x5264f8=['2035128vnvfWm','match','replace','charAt','test','substring','4794671IyStDN','slice','/mnt/','startsWith','222EsCSem','151QLdSpR','toUpperCase','normalize','join','4686mLXJdJ','74735TkEHft','1407956RxWRhh','6938648AbUiGJ','homedir','2802654SLAyUh'];a1_0x5296=function(){return _0x5264f8;};return a1_0x5296();}function a1_0x54c1(_0x11dbe9,_0x4e71cc){_0x11dbe9=_0x11dbe9-0x137;const _0x529672=a1_0x5296();let _0x54c11a=_0x529672[_0x11dbe9];return _0x54c11a;}import a1_0x418df4 from'path';import a1_0x24c2a3 from'os';export function convertToWindowsPath(_0x44f567){const _0x2be700=a1_0x54c1;if(_0x44f567['startsWith'](_0x2be700(0x142))){const _0x15a523=_0x44f567[_0x2be700(0x13d)](0x5)['toUpperCase'](),_0x58f5d0=_0x44f567['slice'](0x6)[_0x2be700(0x13c)](/\//g,'\x5c');return _0x15a523+':'+_0x58f5d0;}if(_0x44f567[_0x2be700(0x13b)](/^\/[a-zA-Z]\//)){const _0x7c925b=_0x44f567[_0x2be700(0x13d)](0x1)['toUpperCase'](),_0x526909=_0x44f567[_0x2be700(0x141)](0x2)[_0x2be700(0x13c)](/\//g,'\x5c');return _0x7c925b+':'+_0x526909;}if(_0x44f567[_0x2be700(0x13b)](/^[a-zA-Z]:/))return _0x44f567['replace'](/\//g,'\x5c');return _0x44f567;}export function normalizePath(_0x27080e){const _0xf4eab=a1_0x54c1;_0x27080e=_0x27080e['trim']()['replace'](/^["']|["']$/g,'');const _0x2e5df3=_0x27080e[_0xf4eab(0x143)]('/')&&!_0x27080e[_0xf4eab(0x13b)](/^\/mnt\/[a-z]\//i)&&!_0x27080e['match'](/^\/[a-zA-Z]\//);if(_0x2e5df3)return _0x27080e[_0xf4eab(0x13c)](/\/+/g,'/')[_0xf4eab(0x13c)](/\/+$/,'');_0x27080e=convertToWindowsPath(_0x27080e);if(_0x27080e[_0xf4eab(0x143)]('\x5c\x5c')){let _0x2d6c7b=_0x27080e;_0x2d6c7b=_0x2d6c7b[_0xf4eab(0x13c)](/^\\{2,}/,'\x5c\x5c');const _0x50aba3=_0x2d6c7b[_0xf4eab(0x13f)](0x2)['replace'](/\\\\/g,'\x5c');_0x27080e='\x5c\x5c'+_0x50aba3;}else _0x27080e=_0x27080e[_0xf4eab(0x13c)](/\\\\/g,'\x5c');let _0x1524bd=a1_0x418df4[_0xf4eab(0x147)](_0x27080e);_0x27080e['startsWith']('\x5c\x5c')&&!_0x1524bd['startsWith']('\x5c\x5c')&&(_0x1524bd='\x5c'+_0x1524bd);if(_0x1524bd[_0xf4eab(0x13b)](/^[a-zA-Z]:/)){let _0x3414f0=_0x1524bd[_0xf4eab(0x13c)](/\//g,'\x5c');return/^[a-z]:/[_0xf4eab(0x13e)](_0x3414f0)&&(_0x3414f0=_0x3414f0['charAt'](0x0)[_0xf4eab(0x146)]()+_0x3414f0['slice'](0x1)),_0x3414f0;}return _0x1524bd[_0xf4eab(0x13c)](/\//g,'\x5c');}export function expandHome(_0x346898){const _0x3b94cc=a1_0x54c1;if(_0x346898[_0x3b94cc(0x143)]('~/')||_0x346898==='~')return a1_0x418df4[_0x3b94cc(0x148)](a1_0x24c2a3[_0x3b94cc(0x138)](),_0x346898[_0x3b94cc(0x141)](0x1));return _0x346898;}
@@ -1 +1 @@
1
- (function(_0x555dbe,_0x3e694e){const _0x21c3d7=a2_0x2bff,_0x4b8413=_0x555dbe();while(!![]){try{const _0x206ba1=-parseInt(_0x21c3d7(0x13c))/0x1*(parseInt(_0x21c3d7(0x140))/0x2)+-parseInt(_0x21c3d7(0x149))/0x3*(parseInt(_0x21c3d7(0x148))/0x4)+parseInt(_0x21c3d7(0x13d))/0x5+-parseInt(_0x21c3d7(0x13a))/0x6*(-parseInt(_0x21c3d7(0x141))/0x7)+-parseInt(_0x21c3d7(0x13f))/0x8+-parseInt(_0x21c3d7(0x138))/0x9+parseInt(_0x21c3d7(0x139))/0xa;if(_0x206ba1===_0x3e694e)break;else _0x4b8413['push'](_0x4b8413['shift']());}catch(_0x1f76ff){_0x4b8413['push'](_0x4b8413['shift']());}}}(a2_0x16fe,0x82769));import a2_0x2fce9a from'path';function a2_0x2bff(_0x58c338,_0xe1e03d){_0x58c338=_0x58c338-0x138;const _0x16fe1b=a2_0x16fe();let _0x2bffaa=_0x16fe1b[_0x58c338];return _0x2bffaa;}export function isPathWithinAllowedDirectories(_0xc1141d,_0xe75abc){const _0x24fd91=a2_0x2bff;if(typeof _0xc1141d!==_0x24fd91(0x146)||!Array['isArray'](_0xe75abc))return![];if(!_0xc1141d||_0xe75abc['length']===0x0)return![];if(_0xc1141d[_0x24fd91(0x144)]('\x00'))return![];let _0x16d824;try{_0x16d824=a2_0x2fce9a[_0x24fd91(0x145)](a2_0x2fce9a[_0x24fd91(0x143)](_0xc1141d));}catch{return![];}if(!a2_0x2fce9a[_0x24fd91(0x147)](_0x16d824))throw new Error(_0x24fd91(0x142));return _0xe75abc[_0x24fd91(0x13e)](_0xf42d6a=>{const _0x872008=_0x24fd91;if(typeof _0xf42d6a!==_0x872008(0x146)||!_0xf42d6a)return![];if(_0xf42d6a['includes']('\x00'))return![];let _0x259b16;try{_0x259b16=a2_0x2fce9a['resolve'](a2_0x2fce9a[_0x872008(0x143)](_0xf42d6a));}catch{return![];}if(!a2_0x2fce9a[_0x872008(0x147)](_0x259b16))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x16d824===_0x259b16)return!![];if(_0x259b16===a2_0x2fce9a[_0x872008(0x13b)])return _0x16d824[_0x872008(0x14a)](a2_0x2fce9a['sep']);return _0x16d824['startsWith'](_0x259b16+a2_0x2fce9a[_0x872008(0x13b)]);});}function a2_0x16fe(){const _0xca180f=['7MwhWTN','Path\x20must\x20be\x20absolute\x20after\x20normalization','normalize','includes','resolve','string','isAbsolute','1607564ERoaSF','3AaReYt','startsWith','4564377Yjryri','20548990GvqUVR','2489646SvZzqn','sep','113537ZnegkH','1323965XxshOJ','some','3971624wDoJst','14AEeLTU'];a2_0x16fe=function(){return _0xca180f;};return a2_0x16fe();}
1
+ (function(_0x365f78,_0x1fc609){const _0x2f5f25=a2_0x541d,_0xa78ca0=_0x365f78();while(!![]){try{const _0x10232d=-parseInt(_0x2f5f25(0xb6))/0x1+parseInt(_0x2f5f25(0xc2))/0x2*(parseInt(_0x2f5f25(0xc3))/0x3)+parseInt(_0x2f5f25(0xbf))/0x4+-parseInt(_0x2f5f25(0xb9))/0x5+parseInt(_0x2f5f25(0xb8))/0x6+-parseInt(_0x2f5f25(0xc1))/0x7+-parseInt(_0x2f5f25(0xc0))/0x8*(parseInt(_0x2f5f25(0xba))/0x9);if(_0x10232d===_0x1fc609)break;else _0xa78ca0['push'](_0xa78ca0['shift']());}catch(_0x4ddc2a){_0xa78ca0['push'](_0xa78ca0['shift']());}}}(a2_0x22d2,0x89a4e));function a2_0x541d(_0xb2ff96,_0x245170){_0xb2ff96=_0xb2ff96-0xb6;const _0x22d253=a2_0x22d2();let _0x541d45=_0x22d253[_0xb2ff96];return _0x541d45;}import a2_0x3287aa from'path';export function isPathWithinAllowedDirectories(_0x373523,_0x3b6883){const _0x41aa53=a2_0x541d;if(typeof _0x373523!==_0x41aa53(0xc5)||!Array['isArray'](_0x3b6883))return![];if(!_0x373523||_0x3b6883['length']===0x0)return![];if(_0x373523[_0x41aa53(0xbb)]('\x00'))return![];let _0x4aac15;try{_0x4aac15=a2_0x3287aa[_0x41aa53(0xbd)](a2_0x3287aa[_0x41aa53(0xbc)](_0x373523));}catch{return![];}if(!a2_0x3287aa['isAbsolute'](_0x4aac15))throw new Error(_0x41aa53(0xb7));return _0x3b6883['some'](_0x46209d=>{const _0x528bb5=_0x41aa53;if(typeof _0x46209d!==_0x528bb5(0xc5)||!_0x46209d)return![];if(_0x46209d['includes']('\x00'))return![];let _0x2262f9;try{_0x2262f9=a2_0x3287aa['resolve'](a2_0x3287aa[_0x528bb5(0xbc)](_0x46209d));}catch{return![];}if(!a2_0x3287aa['isAbsolute'](_0x2262f9))throw new Error(_0x528bb5(0xc4));if(_0x4aac15===_0x2262f9)return!![];if(_0x2262f9===a2_0x3287aa[_0x528bb5(0xbe)])return _0x4aac15['startsWith'](a2_0x3287aa[_0x528bb5(0xbe)]);return _0x4aac15['startsWith'](_0x2262f9+a2_0x3287aa[_0x528bb5(0xbe)]);});}function a2_0x22d2(){const _0x11426d=['resolve','sep','4411732TcnZTA','112792dhJfhv','1957298lStCjF','432ZLKBkI','11670oozBKB','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','string','487815nmtscb','Path\x20must\x20be\x20absolute\x20after\x20normalization','4939650wyepeW','2311990xBNpfX','621nAQnLn','includes','normalize'];a2_0x22d2=function(){return _0x11426d;};return a2_0x22d2();}
@@ -1 +1 @@
1
- function a3_0x30dd(){const _0x5b1bb3=['uri','isDirectory','join','Skipping\x20','startsWith','homedir','error','file://','263738QMtMsG','push','1403133VIyHYz','message','659968UydiZU','invalid\x20path\x20or\x20inaccessible','\x20due\x20to\x20error:\x20','12491032rVqfqW','278570mtnPhJ','134868aBIhjg','slice','realpath','75czhPgr','non-directory\x20root','4333581zSrPFj'];a3_0x30dd=function(){return _0x5b1bb3;};return a3_0x30dd();}(function(_0x48c9cf,_0x747a6d){const _0x249bac=a3_0xd45f,_0x33793d=_0x48c9cf();while(!![]){try{const _0xe029d0=parseInt(_0x249bac(0x1ee))/0x1+-parseInt(_0x249bac(0x1f6))/0x2+-parseInt(_0x249bac(0x1f0))/0x3+parseInt(_0x249bac(0x1f2))/0x4+-parseInt(_0x249bac(0x1fa))/0x5*(parseInt(_0x249bac(0x1f7))/0x6)+-parseInt(_0x249bac(0x1e5))/0x7+parseInt(_0x249bac(0x1f5))/0x8;if(_0xe029d0===_0x747a6d)break;else _0x33793d['push'](_0x33793d['shift']());}catch(_0x2b47d1){_0x33793d['push'](_0x33793d['shift']());}}}(a3_0x30dd,0x6836c));import{promises as a3_0x19c731}from'fs';import a3_0x59e514 from'path';import a3_0x215866 from'os';import{normalizePath}from'./path-utils.js';function a3_0xd45f(_0x6dda61,_0x5616b5){_0x6dda61=_0x6dda61-0x1e4;const _0x30dd85=a3_0x30dd();let _0xd45ffe=_0x30dd85[_0x6dda61];return _0xd45ffe;}async function parseRootUri(_0x289910){const _0x2b4a78=a3_0xd45f;try{const _0x481383=_0x289910[_0x2b4a78(0x1ea)](_0x2b4a78(0x1ed))?_0x289910['slice'](0x7):_0x289910,_0x34a043=_0x481383[_0x2b4a78(0x1ea)]('~/')||_0x481383==='~'?a3_0x59e514[_0x2b4a78(0x1e8)](a3_0x215866[_0x2b4a78(0x1eb)](),_0x481383[_0x2b4a78(0x1f8)](0x1)):_0x481383,_0x41cef0=a3_0x59e514['resolve'](_0x34a043),_0x28a726=await a3_0x19c731[_0x2b4a78(0x1f9)](_0x41cef0);return normalizePath(_0x28a726);}catch{return null;}}function formatDirectoryError(_0x115074,_0x59276b,_0x57b756){const _0x10857f=a3_0xd45f;if(_0x57b756)return _0x10857f(0x1e9)+_0x57b756+':\x20'+_0x115074;const _0x506ab0=_0x59276b instanceof Error?_0x59276b[_0x10857f(0x1f1)]:String(_0x59276b);return'Skipping\x20invalid\x20directory:\x20'+_0x115074+_0x10857f(0x1f4)+_0x506ab0;}export async function getValidRootDirectories(_0x1dcd6c){const _0x4119f0=a3_0xd45f,_0x17a5f6=[];for(const _0xd3c809 of _0x1dcd6c){const _0x2ac524=await parseRootUri(_0xd3c809[_0x4119f0(0x1e6)]);if(!_0x2ac524){console[_0x4119f0(0x1ec)](formatDirectoryError(_0xd3c809[_0x4119f0(0x1e6)],undefined,_0x4119f0(0x1f3)));continue;}try{const _0x32e0e4=await a3_0x19c731['stat'](_0x2ac524);_0x32e0e4[_0x4119f0(0x1e7)]()?_0x17a5f6[_0x4119f0(0x1ef)](_0x2ac524):console['error'](formatDirectoryError(_0x2ac524,undefined,_0x4119f0(0x1e4)));}catch(_0x53e512){console[_0x4119f0(0x1ec)](formatDirectoryError(_0x2ac524,_0x53e512));}}return _0x17a5f6;}
1
+ (function(_0x491d3b,_0x2dcfa0){const _0x118de2=a3_0x5056,_0x20a0af=_0x491d3b();while(!![]){try{const _0x5f01e3=-parseInt(_0x118de2(0x1e2))/0x1+-parseInt(_0x118de2(0x1d9))/0x2+-parseInt(_0x118de2(0x1e4))/0x3*(-parseInt(_0x118de2(0x1d8))/0x4)+parseInt(_0x118de2(0x1dc))/0x5+parseInt(_0x118de2(0x1de))/0x6+-parseInt(_0x118de2(0x1e3))/0x7*(parseInt(_0x118de2(0x1dd))/0x8)+parseInt(_0x118de2(0x1ea))/0x9*(-parseInt(_0x118de2(0x1e8))/0xa);if(_0x5f01e3===_0x2dcfa0)break;else _0x20a0af['push'](_0x20a0af['shift']());}catch(_0x322f19){_0x20a0af['push'](_0x20a0af['shift']());}}}(a3_0x3f52,0x690df));function a3_0x5056(_0x12efbc,_0x50f159){_0x12efbc=_0x12efbc-0x1d5;const _0x3f5243=a3_0x3f52();let _0x5056a9=_0x3f5243[_0x12efbc];return _0x5056a9;}import{promises as a3_0x561b8c}from'fs';function a3_0x3f52(){const _0x22a324=['uri','25614OVQeDa','7vexImq','123oiEeik','slice','Skipping\x20','non-directory\x20root','10820trTeQK','stat','468XkJmSN','realpath','file://','error','\x20due\x20to\x20error:\x20','12276jeeJiD','97888AyfYpl','join','message','639700kUQPjN','1894824WnuJgV','3265254NxJkaT','startsWith','homedir'];a3_0x3f52=function(){return _0x22a324;};return a3_0x3f52();}import a3_0xf9cc2 from'path';import a3_0x5a52a5 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x127736){const _0x3f6197=a3_0x5056;try{const _0x51db3b=_0x127736[_0x3f6197(0x1df)](_0x3f6197(0x1d5))?_0x127736[_0x3f6197(0x1e5)](0x7):_0x127736,_0xcc74c3=_0x51db3b['startsWith']('~/')||_0x51db3b==='~'?a3_0xf9cc2[_0x3f6197(0x1da)](a3_0x5a52a5[_0x3f6197(0x1e0)](),_0x51db3b['slice'](0x1)):_0x51db3b,_0xc6577d=a3_0xf9cc2['resolve'](_0xcc74c3),_0x6aa281=await a3_0x561b8c[_0x3f6197(0x1eb)](_0xc6577d);return normalizePath(_0x6aa281);}catch{return null;}}function formatDirectoryError(_0x5dbe9c,_0x567a51,_0x27a82a){const _0x122160=a3_0x5056;if(_0x27a82a)return _0x122160(0x1e6)+_0x27a82a+':\x20'+_0x5dbe9c;const _0x5b9702=_0x567a51 instanceof Error?_0x567a51[_0x122160(0x1db)]:String(_0x567a51);return'Skipping\x20invalid\x20directory:\x20'+_0x5dbe9c+_0x122160(0x1d7)+_0x5b9702;}export async function getValidRootDirectories(_0x16d294){const _0x4c2fa5=a3_0x5056,_0x10ae93=[];for(const _0x26b070 of _0x16d294){const _0x5e45cf=await parseRootUri(_0x26b070[_0x4c2fa5(0x1e1)]);if(!_0x5e45cf){console[_0x4c2fa5(0x1d6)](formatDirectoryError(_0x26b070[_0x4c2fa5(0x1e1)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x4d7dc5=await a3_0x561b8c[_0x4c2fa5(0x1e9)](_0x5e45cf);_0x4d7dc5['isDirectory']()?_0x10ae93['push'](_0x5e45cf):console[_0x4c2fa5(0x1d6)](formatDirectoryError(_0x5e45cf,undefined,_0x4c2fa5(0x1e7)));}catch(_0x39c9b0){console[_0x4c2fa5(0x1d6)](formatDirectoryError(_0x5e45cf,_0x39c9b0));}}return _0x10ae93;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.59",
3
+ "version": "0.8.61",
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.86",
38
+ "@morphllm/morphsdk": "0.2.88",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",