@morphllm/morphmcp 0.8.115 → 0.8.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x15caa6=a0_0x4531;(function(_0x2af475,_0x2ce4e9){const _0xcfcf35=a0_0x4531,_0x585fe5=_0x2af475();while(!![]){try{const _0x2cb485=-parseInt(_0xcfcf35(0x255))/0x1+parseInt(_0xcfcf35(0x2c4))/0x2+parseInt(_0xcfcf35(0x207))/0x3*(-parseInt(_0xcfcf35(0x1c5))/0x4)+-parseInt(_0xcfcf35(0x2d6))/0x5+parseInt(_0xcfcf35(0x1e4))/0x6*(-parseInt(_0xcfcf35(0x2ab))/0x7)+parseInt(_0xcfcf35(0x2a5))/0x8+parseInt(_0xcfcf35(0x2a3))/0x9*(parseInt(_0xcfcf35(0x1d4))/0xa);if(_0x2cb485===_0x2ce4e9)break;else _0x585fe5['push'](_0x585fe5['shift']());}catch(_0x47a74f){_0x585fe5['push'](_0x585fe5['shift']());}}}(a0_0x2632,0x9af5c));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_0x397b2d from'fs/promises';import a0_0x1fe176 from'path';import a0_0x3b7341 from'os';import{createRequire}from'module';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,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x5b8c76 from'axios';function fixPathRepetition(_0x2d4116){const _0x3bf4f4=a0_0x4531,_0x267e6d=_0x2d4116['split'](a0_0x1fe176[_0x3bf4f4(0x276)])[_0x3bf4f4(0x1cb)](Boolean);if(_0x267e6d[_0x3bf4f4(0x2a9)]<0x2)return null;for(let _0x147543=Math[_0x3bf4f4(0x1e0)](_0x267e6d[_0x3bf4f4(0x2a9)]/0x2);_0x147543>=0x1;_0x147543--){for(let _0x22f94d=0x0;_0x22f94d<=_0x267e6d[_0x3bf4f4(0x2a9)]-0x2*_0x147543;_0x22f94d++){const _0x1087b8=_0x267e6d['slice'](_0x22f94d,_0x22f94d+_0x147543),_0x5be626=_0x267e6d[_0x3bf4f4(0x2ba)](_0x22f94d+_0x147543,_0x22f94d+0x2*_0x147543);if(_0x1087b8[_0x3bf4f4(0x245)]((_0x68a7c6,_0x307b17)=>_0x68a7c6===_0x5be626[_0x307b17])){const _0x5135a7=[..._0x267e6d[_0x3bf4f4(0x2ba)](0x0,_0x22f94d),..._0x267e6d[_0x3bf4f4(0x2ba)](_0x22f94d+_0x147543)];return a0_0x1fe176[_0x3bf4f4(0x276)]+_0x5135a7[_0x3bf4f4(0x2c3)](a0_0x1fe176[_0x3bf4f4(0x276)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x22ffd=a0_0x4531;try{const _0xe8dea4=require(_0x22ffd(0x2d4));return _0xe8dea4[_0x22ffd(0x253)]??'unknown';}catch(_0x117568){return console[_0x22ffd(0x1d5)](_0x22ffd(0x270),_0x117568),_0x22ffd(0x2af);}}function printHelp(){const _0x425e63=a0_0x4531;console[_0x425e63(0x1c2)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x425e63(0x1c2)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console['log'](_0x425e63(0x27a)),console[_0x425e63(0x1c2)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x425e63(0x1c2)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x425e63(0x1c2)](_0x425e63(0x1c3)),console['log']('\x0aExamples:'),console[_0x425e63(0x1c2)](_0x425e63(0x290)),console[_0x425e63(0x1c2)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}function a0_0x4531(_0x5b5cd5,_0x3ffaff){_0x5b5cd5=_0x5b5cd5-0x1be;const _0x263233=a0_0x2632();let _0x453124=_0x263233[_0x5b5cd5];return _0x453124;}const cliArgs=process[a0_0x15caa6(0x2a7)][a0_0x15caa6(0x2ba)](0x2),VERSION_FLAGS=new Set([a0_0x15caa6(0x1f7),'-v','-V']),HELP_FLAGS=new Set([a0_0x15caa6(0x208),'-h']);cliArgs[a0_0x15caa6(0x2c9)](_0x484a92=>VERSION_FLAGS[a0_0x15caa6(0x209)](_0x484a92))&&(console[a0_0x15caa6(0x1c2)](a0_0x15caa6(0x20f)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x15caa6(0x2c9)](_0xe765a8=>HELP_FLAGS[a0_0x15caa6(0x209)](_0xe765a8))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x34d177){const _0x3a6e3f=a0_0x15caa6;for(let _0x4161b2=0x0;_0x4161b2<cliArgs['length'];_0x4161b2++){const _0x20360e=cliArgs[_0x4161b2];if(_0x20360e[_0x3a6e3f(0x284)]('--'+_0x34d177+'='))return _0x20360e[_0x3a6e3f(0x2ba)](('--'+_0x34d177+'=')[_0x3a6e3f(0x2a9)]);if(_0x20360e==='--'+_0x34d177&&_0x4161b2+0x1<cliArgs[_0x3a6e3f(0x2a9)])return cliArgs[_0x4161b2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x15caa6(0x209)](arg)||HELP_FLAGS[a0_0x15caa6(0x209)](arg))continue;if(arg[a0_0x15caa6(0x284)](a0_0x15caa6(0x2dc)))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x15caa6(0x2ce)](arg);}const WORKSPACE_ROOT=process[a0_0x15caa6(0x297)]['WORKSPACE_ROOT']||process['env'][a0_0x15caa6(0x23d)]||process[a0_0x15caa6(0x26c)](),ENABLE_WORKSPACE_MODE=process[a0_0x15caa6(0x297)][a0_0x15caa6(0x266)]!==a0_0x15caa6(0x211),MORPH_API_KEY=getCliArg(a0_0x15caa6(0x235))??process[a0_0x15caa6(0x297)][a0_0x15caa6(0x252)],MORPH_API_URL=process[a0_0x15caa6(0x297)][a0_0x15caa6(0x244)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x15caa6(0x297)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x15caa6(0x297)][a0_0x15caa6(0x25a)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x15caa6(0x284)](a0_0x15caa6(0x2d3))&&!MORPH_API_KEY[a0_0x15caa6(0x284)](a0_0x15caa6(0x215))&&console[a0_0x15caa6(0x1d5)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x8933c8){const _0x14f1c0=a0_0x15caa6;try{await a0_0x5b8c76[_0x14f1c0(0x288)]('https://morphllm.com/api/error-report',{..._0x8933c8,'timestamp':new Date()[_0x14f1c0(0x217)](),'source':_0x8933c8[_0x14f1c0(0x2c5)]||_0x14f1c0(0x204)},{'timeout':0x1388,'headers':{'Content-Type':_0x14f1c0(0x2dd),'Authorization':_0x14f1c0(0x1fc)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x15caa6(0x1d5)](a0_0x15caa6(0x221)),console[a0_0x15caa6(0x1d5)]('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console[a0_0x15caa6(0x1d5)](a0_0x15caa6(0x24c)),console['error'](a0_0x15caa6(0x29e)),console[a0_0x15caa6(0x1d5)](a0_0x15caa6(0x2da)),console[a0_0x15caa6(0x1d5)](a0_0x15caa6(0x2c6)));function normalizePath(_0xf82e87){const _0x289804=a0_0x15caa6;return a0_0x1fe176[_0x289804(0x1df)](_0xf82e87);}function a0_0x2632(){const _0x16cbf2=['MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','map','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Morph\x20FastApply\x20failed\x20without\x20error\x20message','[warpgrep_github_search]\x20Done\x20in\x20','warn','Fallback:\x20Using\x20workspace\x20root\x20','Error\x20running\x20fast\x20context\x20search:\x20','dirname','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','isArray','RipgrepNotAvailable','files','array','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','setRequestHandler','search_string','Unknown\x20tool:\x20','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a',',\x20removed\x20','UnknownError','api-key','Workspace\x20mode\x20enabled:\x20Using\x20','now','instruction','node_modules','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','branch','Unknown\x20error','PWD','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','Cargo.toml','success','etimedout','ms.\x20Success:\x20','results','MORPH_API_URL','every','morph-warp-grep-v1-1111v0','.\x20Changes:\x20','code_edit','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','-\x20Grepped\x20\x27','.git','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','%\x20match)\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','SubToolError','[warpgrep_github_search]\x20Failed\x20in\x20','\x20-\x20','MORPH_API_KEY','version','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','635296TSecup','Created\x20File','repo_path','code','\x20error(s)','MORPH_WARP_GREP_TIMEOUT','No\x20results\x20found\x20for\x20query:\x20\x22','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','boolean','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','pyproject.toml','stats','list_directory\x20','filepath',',\x20modified\x20','Search\x20failed:\x20','ENABLE_WORKSPACE_MODE','startLine','PathError','metadata','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','cwd','Preview\x20changes\x20without\x20applying\x20them.','Error:\x20','finish','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','describe','setNotificationHandler','unknown\x20error','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','sep','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','0.2.0','runWarpGrep_call','\x0aOptions:','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','timeout','content','targetDirectories','errors','codebase_search','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','user','github_url','startsWith','listRoots','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','requiresApiKey','post','linesModified','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','connect','stack','toFixed','Error\x20accessing\x20directory\x20','\x20\x20morph-mcp','Invalid\x20arguments:\x20','data','Warning:\x20Workspace\x20fallback\x20failed:\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20(new\x20file)','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','env','description','...','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','.vscode','\x20for:\x20\x22','role','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','For\x20deletions:\x0a','query','toLowerCase','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','81hjtEmP','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','6712568ZcWFEV','terminationReason','argv','roots','length','</file>','21910yRPqDT','path','lines','SymlinkError','unknown','ENOENT','split','tsconfig.json','Here\x20is\x20the\x20content\x20of\x20files:\x0a','\x0a</file>','warpgrep_codebase_search','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','name','slice','realpath','-\x20Read\x20file\x20`','Applied','assistant','exit','timings','message','substring','join','1917434SqRbSg','source','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','number','Morph\x20Edit\x20Preview','some','completed_with_file_errors','catch','min','\x22>\x0aError\x20reading\x20file:\x20','push','Max\x20results\x20to\x20return','repoId','messages','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','sk-','../package.json','match','2292840ErPcUm','all','access','completionId','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Benefits:\x0a','--api-key=','application/json','stringify','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Relevant\x20context\x20found:','Repository\x20identifier','Found\x20','searchGitHub','-\x20Listed\x20directory\x20`','\x20is\x20not\x20a\x20directory','homedir','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','log','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Warning:\x20','1420YfSBsq','indexOf','rerankScore','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','constructor','❌\x20Morph\x20Edit\x20Failed:\x20','filter','TimeoutError','WarpGrepError','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','.cursor','includes','read','trim','.\x20Path:\x20','1772380ygNqQD','error','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','params','dryRun','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','edit_file','\x20\x20\x20','morph-v3-fast','FileReadError','owner_repo','normalize','floor','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','GitHub\x20search\x20failed:\x20','1104PleELN','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','\x20results\x20in\x20','Failed\x20to\x20read\x20file:\x20','morph-mcp','enum','[warpgrep_github_search]\x20Searching\x20','read\x20','utf-8','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','linesRemoved','linesAdded','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','added\x20','basename','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','readFile','text','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','--version','timed\x20out','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','commitHash','\x0a...\x20(truncated,\x20total:\x20','Bearer\x20','BinaryFile','string','[could\x20not\x20read\x20file:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','FileNotFound','mcp-filesystem','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','warpgrep_github_search','9198wGVuQf','--help','has','RipgrepError','Specific\x20commit\x20hash\x20to\x20search','<file\x20path=\x22','default','ReadError','@morphllm/morphmcp\x20','ms:','false','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','changes','resolve','morph-','object','toISOString','stat','optional','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','safeParse','\x27\x20in\x20`','inputSchema'];a0_0x2632=function(){return _0x16cbf2;};return a0_0x2632();}function expandHome(_0x2b3dbf){const _0x3a6f0b=a0_0x15caa6;if(_0x2b3dbf[_0x3a6f0b(0x284)]('~/')||_0x2b3dbf==='~')return a0_0x1fe176['join'](a0_0x3b7341[_0x3a6f0b(0x1c0)](),_0x2b3dbf['slice'](0x1));return _0x2b3dbf;}let allowedDirectories=await Promise['all'](args['map'](async _0x4466db=>{const _0x3636e3=expandHome(_0x4466db),_0x1d48a8=a0_0x1fe176['resolve'](_0x3636e3);try{const _0x3c3c2d=await a0_0x397b2d['realpath'](_0x1d48a8);return normalizePath(_0x3c3c2d);}catch(_0x52423e){return normalizePath(_0x1d48a8);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x15caa6(0x2a9)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x15caa6(0x2ce)](workspaceDir),console[a0_0x15caa6(0x1d5)](a0_0x15caa6(0x236)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x5a70ea){console[a0_0x15caa6(0x1d5)]('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x5a70ea);}async function detectWorkspaceRoot(_0x46581d){const _0x18a4bd=a0_0x15caa6;let _0x27e69a=a0_0x1fe176[_0x18a4bd(0x214)](_0x46581d);const _0x4b5c02=[_0x18a4bd(0x24b),_0x18a4bd(0x29b),'package.json',_0x18a4bd(0x23f),_0x18a4bd(0x260),'go.mod',_0x18a4bd(0x1cf),_0x18a4bd(0x2b2),'composer.json'];while(_0x27e69a!==a0_0x1fe176['dirname'](_0x27e69a)){for(const _0x41ded4 of _0x4b5c02){const _0x4a9e02=a0_0x1fe176['join'](_0x27e69a,_0x41ded4);try{return await a0_0x397b2d[_0x18a4bd(0x2d8)](_0x4a9e02),normalizePath(_0x27e69a);}catch{}}_0x27e69a=a0_0x1fe176[_0x18a4bd(0x228)](_0x27e69a);}return normalizePath(_0x46581d);}await Promise[a0_0x15caa6(0x2d7)](args[a0_0x15caa6(0x220)](async _0x5061ae=>{const _0x444cee=a0_0x15caa6;try{const _0x31c6cc=await a0_0x397b2d[_0x444cee(0x218)](expandHome(_0x5061ae));!_0x31c6cc['isDirectory']()&&(console['error'](_0x444cee(0x26e)+_0x5061ae+_0x444cee(0x1bf)),process[_0x444cee(0x2bf)](0x1));}catch(_0x3b4c5d){console[_0x444cee(0x1d5)](_0x444cee(0x28f)+_0x5061ae+':',_0x3b4c5d),process[_0x444cee(0x2bf)](0x1);}}));async function validatePath(_0x2056fd){const _0x9bab3f=a0_0x15caa6,_0x2c446b=expandHome(_0x2056fd),_0x59e028=a0_0x1fe176[_0x9bab3f(0x214)](_0x2c446b);try{const _0x451f6a=await a0_0x397b2d[_0x9bab3f(0x2bb)](_0x59e028);return _0x451f6a;}catch(_0x564ffe){if(_0x564ffe[_0x9bab3f(0x258)]===_0x9bab3f(0x2b0)){const _0x4e7902=a0_0x1fe176[_0x9bab3f(0x228)](_0x59e028);try{const _0x23d596=await a0_0x397b2d[_0x9bab3f(0x2bb)](_0x4e7902);return a0_0x1fe176['join'](_0x23d596,a0_0x1fe176[_0x9bab3f(0x1f2)](_0x59e028));}catch{throw new Error(_0x9bab3f(0x200)+_0x4e7902);}}throw _0x564ffe;}}const MorphEditFileArgsSchema=z[a0_0x15caa6(0x216)]({'path':z[a0_0x15caa6(0x1fe)](),'code_edit':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x23a)),'instruction':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x254)),'dryRun':z[a0_0x15caa6(0x25d)]()[a0_0x15caa6(0x20d)](![])[a0_0x15caa6(0x272)](a0_0x15caa6(0x26d))}),WarpGrepArgsSchema=z[a0_0x15caa6(0x216)]({'search_string':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x1e1)),'repo_path':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x1d6)),'search_type':z[a0_0x15caa6(0x1e9)]([a0_0x15caa6(0x20d),a0_0x15caa6(0x239)])[a0_0x15caa6(0x219)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x2d2))}),WarpGrepGitHubArgsSchema=z[a0_0x15caa6(0x216)]({'search_string':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x1e1)),'github_url':z[a0_0x15caa6(0x1fe)]()['optional']()['describe']('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z['string']()[a0_0x15caa6(0x219)]()[a0_0x15caa6(0x272)](a0_0x15caa6(0x1c1)),'branch':z['string']()[a0_0x15caa6(0x219)]()['describe'](a0_0x15caa6(0x229))}),CodebaseSearchArgsSchema=z[a0_0x15caa6(0x216)]({'query':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x272)]('Natural\x20language\x20query\x20to\x20search\x20for\x20code'),'repoId':z[a0_0x15caa6(0x1fe)]()['describe'](a0_0x15caa6(0x2e1)),'branch':z[a0_0x15caa6(0x1fe)]()[a0_0x15caa6(0x219)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z['string']()['optional']()[a0_0x15caa6(0x272)](a0_0x15caa6(0x20b)),'targetDirectories':z[a0_0x15caa6(0x22d)](z['string']())[a0_0x15caa6(0x20d)]([])[a0_0x15caa6(0x272)](a0_0x15caa6(0x1e2)),'limit':z[a0_0x15caa6(0x2c7)]()[a0_0x15caa6(0x219)]()['default'](0xa)[a0_0x15caa6(0x272)](a0_0x15caa6(0x2cf))}),server=new Server({'name':a0_0x15caa6(0x1e8),'version':a0_0x15caa6(0x278)},{'capabilities':{'tools':{}}});server[a0_0x15caa6(0x22f)](ListToolsRequestSchema,async()=>{const _0x8ea41a=a0_0x15caa6,_0x50eb81=[{'name':'edit_file','description':_0x8ea41a(0x222)+_0x8ea41a(0x271)+_0x8ea41a(0x1ce)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0x8ea41a(0x2db)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x8ea41a(0x1f0)+_0x8ea41a(0x25e)+_0x8ea41a(0x23e)+_0x8ea41a(0x1c8)+_0x8ea41a(0x296)+_0x8ea41a(0x29a)+_0x8ea41a(0x29f)+_0x8ea41a(0x286)+_0x8ea41a(0x2b8)+'Rules:\x0a'+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x8ea41a(0x25c)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x8ea41a(0x1f9)+_0x8ea41a(0x2a2)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x8ea41a(0x2a4),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x8ea41a(0x2b5),'description':_0x8ea41a(0x275)+_0x8ea41a(0x201)+_0x8ea41a(0x1ed)+_0x8ea41a(0x26b)+_0x8ea41a(0x2b7)+_0x8ea41a(0x1f3)+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':_0x8ea41a(0x280),'description':_0x8ea41a(0x212)+_0x8ea41a(0x232)+_0x8ea41a(0x1d9)+'Benefits:\x0a'+_0x8ea41a(0x28a)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x8ea41a(0x28b)+_0x8ea41a(0x2b6)+_0x8ea41a(0x1e5)+_0x8ea41a(0x27b)+_0x8ea41a(0x1f6),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x3bd71f=_0x50eb81[_0x8ea41a(0x1cb)](_0x332487=>{const _0x229931=_0x8ea41a;if(_0x229931(0x287)in _0x332487&&_0x332487[_0x229931(0x287)]&&!MORPH_API_KEY)return console['error'](_0x229931(0x1c4)+_0x332487['name']+_0x229931(0x202)),![];return!![];});return{'tools':_0x3bd71f['map'](_0x515fd9=>({'name':_0x515fd9['name'],'description':_0x515fd9[_0x8ea41a(0x298)],'inputSchema':_0x515fd9[_0x8ea41a(0x21d)]}))};}),server[a0_0x15caa6(0x22f)](CallToolRequestSchema,async _0x5b0931=>{const _0x5f1d5b=a0_0x15caa6;try{const {name:_0x296bec,arguments:_0x2721fe}=_0x5b0931[_0x5f1d5b(0x1d7)];switch(_0x296bec){case _0x5f1d5b(0x1da):{const _0x49a3c6=MorphEditFileArgsSchema[_0x5f1d5b(0x21b)](_0x2721fe);if(!_0x49a3c6[_0x5f1d5b(0x240)])throw new Error(_0x5f1d5b(0x22e)+_0x49a3c6[_0x5f1d5b(0x1d5)]);const _0x553779=await validatePath(_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x2ac)]);let _0x2d6d30=null,_0x349bef=!![],_0x3f7b51=null;try{_0x2d6d30=await a0_0x397b2d[_0x5f1d5b(0x1f4)](_0x553779,_0x5f1d5b(0x1ec));}catch(_0xae454c){const _0x1732fa=_0xae454c[_0x5f1d5b(0x258)];_0x1732fa===_0x5f1d5b(0x2b0)?(_0x349bef=![],_0x2d6d30=''):(_0x3f7b51=_0x5f1d5b(0x1e7)+(_0x1732fa||_0x5f1d5b(0x2af))+_0x5f1d5b(0x251)+(_0xae454c instanceof Error?_0xae454c['message']:String(_0xae454c)),console[_0x5f1d5b(0x1d5)]('Warning:\x20'+_0x3f7b51));}let _0x4e9941;try{const _0x2d2072=MORPH_API_KEY;if(!_0x2d2072)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x52c983=a0_0x1fe176[_0x5f1d5b(0x228)](_0x553779),_0xd623aa=a0_0x1fe176['basename'](_0x553779),_0x3d25ea=await executeEditFile({'target_filepath':_0xd623aa,'code_edit':_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x248)],'instructions':_0x49a3c6['data'][_0x5f1d5b(0x238)]},{'morphApiKey':_0x2d2072,'morphApiUrl':MORPH_API_URL,'baseDir':_0x52c983,'autoWrite':!_0x49a3c6['data'][_0x5f1d5b(0x1d8)],'generateUdiff':![],'debug':![]});_0x4e9941=_0x3d25ea[_0x5f1d5b(0x2d9)];if(!_0x3d25ea[_0x5f1d5b(0x240)])throw new Error(_0x3d25ea[_0x5f1d5b(0x1d5)]||_0x5f1d5b(0x223));const _0x3f2622=_0x3d25ea[_0x5f1d5b(0x213)],_0x473ae3=_0x5f1d5b(0x1f1)+_0x3f2622[_0x5f1d5b(0x1ef)]+_0x5f1d5b(0x233)+_0x3f2622[_0x5f1d5b(0x1ee)]+_0x5f1d5b(0x264)+_0x3f2622[_0x5f1d5b(0x289)];if(_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x1d8)])return{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x2c8)+(_0x349bef?'':_0x5f1d5b(0x295))+':\x20'+_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x238)]+'.\x20Changes:\x20'+_0x473ae3+_0x5f1d5b(0x1d3)+_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x2ac)]+'.'}]};return{'content':[{'type':'text','text':'Morph\x20Edit\x20'+(_0x349bef?_0x5f1d5b(0x2bd):_0x5f1d5b(0x256))+':\x20'+_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x238)]+_0x5f1d5b(0x247)+_0x473ae3+_0x5f1d5b(0x1d3)+_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x2ac)]+'.'}]};}catch(_0x5233cb){const _0x446a6f=_0x5233cb instanceof Error?_0x5233cb[_0x5f1d5b(0x2c1)]:String(_0x5233cb);return reportMorphError({'error_message':_0x446a6f,'error_type':_0x5233cb instanceof Error?_0x5233cb[_0x5f1d5b(0x1c9)][_0x5f1d5b(0x2b9)]:'UnknownError','context':{'tool':_0x5f1d5b(0x1da),'completion_id':_0x4e9941,'file_path':_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x2ac)],'validated_path':_0x553779,'instruction':_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x238)],'model':_0x5f1d5b(0x1dc),'dry_run':_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x1d8)],'file_exists':_0x349bef,'file_read_error':_0x3f7b51,'file_readable':_0x2d6d30!==null,'request_content':{'path':_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x2ac)],'code_edit':_0x49a3c6[_0x5f1d5b(0x292)]['code_edit'],'instruction':_0x49a3c6[_0x5f1d5b(0x292)][_0x5f1d5b(0x238)],'original_code':_0x2d6d30!==null?_0x2d6d30[_0x5f1d5b(0x2a9)]>0xc350?_0x2d6d30[_0x5f1d5b(0x2c2)](0x0,0xc350)+_0x5f1d5b(0x1fb)+_0x2d6d30['length']+'\x20chars)':_0x2d6d30:_0x5f1d5b(0x1ff)+(_0x3f7b51||_0x5f1d5b(0x274))+']','original_code_length':_0x2d6d30?.[_0x5f1d5b(0x2a9)]??0x0,'model':_0x5f1d5b(0x1dc),'dry_run':_0x49a3c6['data']['dryRun']}},'stack_trace':_0x5233cb instanceof Error?_0x5233cb[_0x5f1d5b(0x28d)]:undefined,'source':_0x5f1d5b(0x204)})['catch'](()=>{}),{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x1ca)+_0x446a6f}],'isError':!![]};}}case _0x5f1d5b(0x2b5):{const _0x17dc7c=WarpGrepArgsSchema[_0x5f1d5b(0x21b)](_0x2721fe);if(!_0x17dc7c['success'])return{'content':[{'type':_0x5f1d5b(0x1f5),'text':'Invalid\x20arguments:\x20'+_0x17dc7c[_0x5f1d5b(0x1d5)]}],'isError':!![]};const _0x19f572=_0x164ffb=>{const _0x5b4a39=_0x5f1d5b,_0x3135c1=[];for(const _0x81d9ee of _0x164ffb||[]){const _0x4dde25=_0x81d9ee[_0x5b4a39(0x29d)],_0x5273cb=_0x81d9ee[_0x5b4a39(0x27d)];if(_0x4dde25===_0x5b4a39(0x2be)&&_0x5273cb){const _0xd297a8=_0x5273cb[_0x5b4a39(0x2b1)]('\x0a')['filter'](_0x5ee67e=>_0x5ee67e[_0x5b4a39(0x1d2)]());for(const _0x29a3be of _0xd297a8){const _0x3e2ccd=_0x29a3be[_0x5b4a39(0x2d5)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x3e2ccd){_0x3135c1['push']('grep\x20\x27'+_0x3e2ccd[0x1]+'\x27\x20'+_0x3e2ccd[0x2]);continue;}const _0x504b63=_0x29a3be[_0x5b4a39(0x2d5)](/^read\s+(.+)$/);if(_0x504b63){_0x3135c1[_0x5b4a39(0x2ce)](_0x5b4a39(0x1eb)+_0x504b63[0x1]);continue;}const _0xc24c19=_0x29a3be[_0x5b4a39(0x2d5)](/^list_directory\s+(.+)$/);if(_0xc24c19){_0x3135c1[_0x5b4a39(0x2ce)](_0x5b4a39(0x262)+_0xc24c19[0x1]);continue;}}}}return _0x3135c1;},_0x4bdf16=_0x30d44b=>{const _0xc4d802=_0x5f1d5b,_0x47b484=[];if(!_0x30d44b||!Array[_0xc4d802(0x22a)](_0x30d44b))return _0x47b484;const _0x26ea6d=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0xc4d802(0x203),'tool':_0xc4d802(0x1d1)},{'pattern':/\[PATH ERROR\]/,'error_type':_0xc4d802(0x268),'tool':_0xc4d802(0x1d1)},{'pattern':/\[READ ERROR\]/,'error_type':_0xc4d802(0x20e),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0xc4d802(0x1fd),'tool':_0xc4d802(0x1d1)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0xc4d802(0x20a),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0xc4d802(0x22b),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0xc4d802(0x1fd),'tool':_0xc4d802(0x1d1)},{'pattern':/\[SYMLINK\]/,'error_type':_0xc4d802(0x2ae),'tool':_0xc4d802(0x1d1)},{'pattern':/not a text file/,'error_type':_0xc4d802(0x1fd),'tool':_0xc4d802(0x1d1)},{'pattern':/symbolic link/,'error_type':_0xc4d802(0x2ae),'tool':_0xc4d802(0x1d1)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':'read'},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x2dd066=0x0;for(const _0x37f322 of _0x30d44b){if(_0x37f322[_0xc4d802(0x29d)]===_0xc4d802(0x282)){_0x2dd066++;const _0x371386=_0x37f322[_0xc4d802(0x27d)];if(!_0x371386||typeof _0x371386!==_0xc4d802(0x1fe))continue;for(const {pattern:_0x218ac5,error_type:_0x456e54,tool:_0x56434d}of _0x26ea6d){const _0xbbca=_0x371386[_0xc4d802(0x2d5)](new RegExp(_0x218ac5['source'],'g'));if(_0xbbca)for(const _0x48451f of _0xbbca){const _0x3f7a02=_0x371386[_0xc4d802(0x1c6)](_0x48451f),_0x5b0f72=_0x371386['substring'](_0x3f7a02,Math[_0xc4d802(0x2cc)](_0x3f7a02+0xc8,_0x371386[_0xc4d802(0x2a9)]));_0x47b484['push']({'tool':_0x56434d,'error_type':_0x456e54,'error_message':_0x5b0f72[_0xc4d802(0x2b1)]('\x0a')[0x0],'turn':_0x2dd066});}}}}return _0x47b484;};try{const _0x109b8e=a0_0x1fe176[_0x5f1d5b(0x214)](_0x17dc7c[_0x5f1d5b(0x292)]['repo_path']),_0x587104=_0x17dc7c[_0x5f1d5b(0x292)]['search_type'],_0x5eb6d5=_0x587104==='node_modules'?{'allowNames':[_0x5f1d5b(0x239)]}:undefined,_0x344cd6=new LocalRipgrepProvider(_0x109b8e,undefined,_0x5eb6d5),_0x20d932=await runWarpGrep({'query':_0x17dc7c[_0x5f1d5b(0x292)]['search_string'],'repoRoot':_0x109b8e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x344cd6,'search_type':_0x587104}),_0x15aa89=_0x4bdf16(_0x20d932['messages']);_0x15aa89[_0x5f1d5b(0x2a9)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x15aa89[_0x5f1d5b(0x2a9)]+_0x5f1d5b(0x259),'error_type':_0x5f1d5b(0x24f),'level':_0x5f1d5b(0x225),'tool':'warpgrep_codebase_search','context':{'repo_path':_0x17dc7c['data'][_0x5f1d5b(0x257)],'query':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x230)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x20d932[_0x5f1d5b(0x2a6)],'sub_tool_errors':_0x15aa89,'timings':_0x20d932[_0x5f1d5b(0x2c0)],'tool_calls':_0x19f572(_0x20d932[_0x5f1d5b(0x2d1)]),'messages':_0x20d932[_0x5f1d5b(0x2d1)]?.[_0x5f1d5b(0x220)](_0x2907b3=>({'role':_0x2907b3[_0x5f1d5b(0x29d)],'content':_0x2907b3[_0x5f1d5b(0x27d)]}))},'source':_0x5f1d5b(0x204)})[_0x5f1d5b(0x2cb)](()=>{});let _0x2d66e1='';if(_0x20d932['terminationReason']==='completed'&&_0x20d932[_0x5f1d5b(0x26f)]?.[_0x5f1d5b(0x269)]?.[_0x5f1d5b(0x22c)]){const _0xc37a46=_0x20d932[_0x5f1d5b(0x26f)][_0x5f1d5b(0x269)][_0x5f1d5b(0x22c)];if(_0xc37a46[_0x5f1d5b(0x2a9)]===0x0)return _0x2d66e1=_0x20d932[_0x5f1d5b(0x26f)]['payload']||_0x5f1d5b(0x277),{'content':[{'type':'text','text':_0x2d66e1}]};const _0x53cabc=[],_0x557bce=[_0x5f1d5b(0x294)];for(const _0x264eb9 of _0x20d932['messages']){const _0x131c83=_0x264eb9[_0x5f1d5b(0x29d)],_0x23689f=_0x264eb9['content'];if(_0x131c83===_0x5f1d5b(0x2be)&&_0x23689f){const _0x2cb4b8=_0x23689f[_0x5f1d5b(0x2b1)]('\x0a')[_0x5f1d5b(0x1cb)](_0xd890c6=>_0xd890c6[_0x5f1d5b(0x1d2)]());for(const _0xa354c2 of _0x2cb4b8){const _0x4d1651=_0xa354c2[_0x5f1d5b(0x2d5)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x4d1651){_0x557bce[_0x5f1d5b(0x2ce)](_0x5f1d5b(0x24a)+_0x4d1651[0x1]+_0x5f1d5b(0x21c)+_0x4d1651[0x2]+'`');continue;}const _0x3e261a=_0xa354c2[_0x5f1d5b(0x2d5)](/^read\s+(.+)$/);if(_0x3e261a){_0x557bce[_0x5f1d5b(0x2ce)](_0x5f1d5b(0x2bc)+_0x3e261a[0x1]+'`');continue;}const _0x506852=_0xa354c2[_0x5f1d5b(0x2d5)](/^list_directory\s+(.+)$/);if(_0x506852){_0x557bce[_0x5f1d5b(0x2ce)](_0x5f1d5b(0x1be)+_0x506852[0x1]+'`');continue;}}}}_0x53cabc['push'](_0x557bce[_0x5f1d5b(0x2c3)]('\x0a'));const _0x2acad7=['',_0x5f1d5b(0x2e0)];for(const _0x2ecde8 of _0xc37a46){if(_0x2ecde8[_0x5f1d5b(0x2ad)]==='*')_0x2acad7['push']('-\x20'+_0x2ecde8['path']+':*');else{if(Array[_0x5f1d5b(0x22a)](_0x2ecde8[_0x5f1d5b(0x2ad)])){const _0x53e203=_0x2ecde8[_0x5f1d5b(0x2ad)]['map'](([_0x6c6075,_0x9be05e])=>{if(_0x6c6075===_0x9be05e)return''+_0x6c6075;return _0x6c6075+'-'+_0x9be05e;});_0x2acad7[_0x5f1d5b(0x2ce)]('-\x20'+_0x2ecde8[_0x5f1d5b(0x2ac)]+':'+_0x53e203['join'](','));}else _0x2acad7[_0x5f1d5b(0x2ce)]('-\x20'+_0x2ecde8[_0x5f1d5b(0x2ac)]+':*');}}_0x2acad7[_0x5f1d5b(0x2ce)](''),_0x53cabc[_0x5f1d5b(0x2ce)](_0x2acad7[_0x5f1d5b(0x2c3)]('\x0a')),_0x53cabc[_0x5f1d5b(0x2ce)](_0x5f1d5b(0x2b3));const _0x17b67f=[];for(const _0x496fee of _0xc37a46){let _0x1a6d12=a0_0x1fe176[_0x5f1d5b(0x214)](_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x257)],_0x496fee[_0x5f1d5b(0x2ac)]),_0x5434d6=null,_0xb694fc=null;try{_0x5434d6=await a0_0x397b2d['readFile'](_0x1a6d12,{'encoding':_0x5f1d5b(0x1ec)});}catch(_0x5a6cba){const _0x3bb5ee=fixPathRepetition(_0x1a6d12);if(_0x3bb5ee)try{_0x5434d6=await a0_0x397b2d[_0x5f1d5b(0x1f4)](_0x3bb5ee,{'encoding':_0x5f1d5b(0x1ec)}),_0x1a6d12=_0x3bb5ee;}catch{_0xb694fc=_0x5a6cba instanceof Error?_0x5a6cba:new Error(String(_0x5a6cba));}else _0xb694fc=_0x5a6cba instanceof Error?_0x5a6cba:new Error(String(_0x5a6cba));}if(_0x5434d6!==null){const _0x345265=_0x5434d6[_0x5f1d5b(0x2b1)](/\r?\n/),_0x693fee=[_0x5f1d5b(0x20c)+_0x496fee[_0x5f1d5b(0x2ac)]+'\x22>'];if(_0x496fee[_0x5f1d5b(0x2ad)]==='*'||!Array[_0x5f1d5b(0x22a)](_0x496fee['lines']))for(let _0x2a56dd=0x1;_0x2a56dd<=_0x345265[_0x5f1d5b(0x2a9)];_0x2a56dd++){const _0x11d257=_0x345265[_0x2a56dd-0x1];_0x693fee[_0x5f1d5b(0x2ce)](_0x2a56dd+'|\x20'+_0x11d257);}else for(const [_0x125587,_0x48d67a]of _0x496fee['lines']){_0x693fee[_0x5f1d5b(0x2a9)]>0x1&&_0x693fee[_0x5f1d5b(0x2ce)]('');for(let _0x2eca38=_0x125587;_0x2eca38<=_0x48d67a&&_0x2eca38<=_0x345265[_0x5f1d5b(0x2a9)];_0x2eca38++){const _0x341c23=_0x345265[_0x2eca38-0x1];_0x693fee[_0x5f1d5b(0x2ce)](_0x2eca38+'|\x20'+_0x341c23);}}_0x693fee['push'](_0x5f1d5b(0x2aa)),_0x17b67f[_0x5f1d5b(0x2ce)](_0x693fee[_0x5f1d5b(0x2c3)]('\x0a'));}else _0x17b67f[_0x5f1d5b(0x2ce)](_0x5f1d5b(0x20c)+_0x496fee[_0x5f1d5b(0x2ac)]+_0x5f1d5b(0x2cd)+(_0xb694fc?.[_0x5f1d5b(0x2c1)]||_0x5f1d5b(0x23c))+_0x5f1d5b(0x2b4));}_0x53cabc['push'](_0x17b67f[_0x5f1d5b(0x2c3)]('\x0a\x0a')),_0x2d66e1=_0x53cabc[_0x5f1d5b(0x2c3)]('\x0a');const _0x16abc8=_0x20d932[_0x5f1d5b(0x27f)]?.[_0x5f1d5b(0x1cb)](_0x510a53=>_0x510a53[_0x5f1d5b(0x2c1)]?.[_0x5f1d5b(0x284)]('File\x20read\x20error:'))||[];if(_0x16abc8[_0x5f1d5b(0x2a9)]>0x0){const _0x1c85ba=_0x16abc8['map'](_0x54667e=>_0x54667e[_0x5f1d5b(0x2c1)])[_0x5f1d5b(0x2c3)](';\x20');reportMorphError({'error_message':_0x1c85ba,'error_type':_0x5f1d5b(0x1dd),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x257)],'query':_0x17dc7c['data'][_0x5f1d5b(0x230)],'model':_0x5f1d5b(0x246),'termination_reason':_0x5f1d5b(0x2ca),'error_count':_0x16abc8[_0x5f1d5b(0x2a9)],'is_timeout':![],'timings':_0x20d932[_0x5f1d5b(0x2c0)],'files_attempted':_0xc37a46['map'](_0x31ab6c=>({'path':_0x31ab6c[_0x5f1d5b(0x2ac)],'lines':_0x31ab6c[_0x5f1d5b(0x2ad)]})),'tool_calls':_0x19f572(_0x20d932[_0x5f1d5b(0x2d1)]),'messages':_0x20d932[_0x5f1d5b(0x2d1)]?.['map'](_0x49b600=>({'role':_0x49b600['role'],'content':_0x49b600[_0x5f1d5b(0x27d)]})),'request_content':{'query':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x230)],'repo_path':_0x17dc7c[_0x5f1d5b(0x292)]['repo_path'],'repoRoot':a0_0x1fe176['resolve'](_0x17dc7c[_0x5f1d5b(0x292)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'source':_0x5f1d5b(0x204)})[_0x5f1d5b(0x2cb)](()=>{});}}else{if(_0x20d932['terminationReason']==='terminated'&&_0x20d932[_0x5f1d5b(0x27f)]['length']>0x0){const _0x247f9f=_0x20d932[_0x5f1d5b(0x27f)][_0x5f1d5b(0x220)](_0x5608ee=>_0x5608ee[_0x5f1d5b(0x2c1)])['join'](';\x20');_0x2d66e1=_0x5f1d5b(0x26e)+_0x247f9f;const _0x3c1f15=_0x247f9f[_0x5f1d5b(0x2a1)]()[_0x5f1d5b(0x1d0)](_0x5f1d5b(0x27c))||_0x247f9f[_0x5f1d5b(0x2a1)]()[_0x5f1d5b(0x1d0)]('timed\x20out')||_0x247f9f[_0x5f1d5b(0x2a1)]()[_0x5f1d5b(0x1d0)](_0x5f1d5b(0x241)),_0x3383a0=_0x20d932[_0x5f1d5b(0x26f)]?.['metadata']?.[_0x5f1d5b(0x22c)],_0xe41ada=_0x20d932['errors'][0x0];reportMorphError({'error_message':_0x247f9f,'error_type':_0x3c1f15?_0x5f1d5b(0x1cc):_0xe41ada?.[_0x5f1d5b(0x1c9)]?.[_0x5f1d5b(0x2b9)]||_0x5f1d5b(0x1cd),'context':{'tool':_0x5f1d5b(0x2b5),'repo_path':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x257)],'query':_0x17dc7c['data']['search_string'],'model':_0x5f1d5b(0x246),'termination_reason':_0x20d932['terminationReason'],'error_count':_0x20d932[_0x5f1d5b(0x27f)][_0x5f1d5b(0x2a9)],'is_timeout':_0x3c1f15,'timings':_0x20d932['timings'],'files_attempted':_0x3383a0?.[_0x5f1d5b(0x220)](_0x43a434=>({'path':_0x43a434[_0x5f1d5b(0x2ac)],'lines':_0x43a434[_0x5f1d5b(0x2ad)]})),'tool_calls':_0x19f572(_0x20d932[_0x5f1d5b(0x2d1)]),'messages':_0x20d932[_0x5f1d5b(0x2d1)]?.[_0x5f1d5b(0x220)](_0x335328=>({'role':_0x335328[_0x5f1d5b(0x29d)],'content':_0x335328[_0x5f1d5b(0x27d)]})),'request_content':{'query':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x230)],'repo_path':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x257)],'repoRoot':a0_0x1fe176[_0x5f1d5b(0x214)](_0x17dc7c[_0x5f1d5b(0x292)]['repo_path']),'model':_0x5f1d5b(0x246)}},'stack_trace':_0xe41ada?.[_0x5f1d5b(0x28d)]||undefined,'source':_0x5f1d5b(0x204)})[_0x5f1d5b(0x2cb)](()=>{});}else _0x2d66e1='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x2d66e1}]};}catch(_0x188251){const _0x33b196=_0x188251 instanceof Error?_0x188251['message']:String(_0x188251),_0x3c2444=_0x33b196[_0x5f1d5b(0x2a1)]()['includes'](_0x5f1d5b(0x27c))||_0x33b196[_0x5f1d5b(0x2a1)]()[_0x5f1d5b(0x1d0)](_0x5f1d5b(0x1f8))||_0x33b196[_0x5f1d5b(0x2a1)]()[_0x5f1d5b(0x1d0)](_0x5f1d5b(0x241))||_0x188251 instanceof Error&&_0x188251['name']===_0x5f1d5b(0x1cc);return reportMorphError({'error_message':_0x33b196,'error_type':_0x3c2444?_0x5f1d5b(0x1cc):_0x188251 instanceof Error?_0x188251[_0x5f1d5b(0x1c9)][_0x5f1d5b(0x2b9)]:'UnknownError','context':{'tool':'warpgrep_codebase_search','repo_path':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x257)],'query':_0x17dc7c['data'][_0x5f1d5b(0x230)],'model':_0x5f1d5b(0x246),'is_timeout':_0x3c2444,'exception_phase':_0x5f1d5b(0x279),'request_content':{'query':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x230)],'repo_path':_0x17dc7c[_0x5f1d5b(0x292)][_0x5f1d5b(0x257)],'repoRoot':a0_0x1fe176[_0x5f1d5b(0x214)](_0x17dc7c[_0x5f1d5b(0x292)]['repo_path']),'model':_0x5f1d5b(0x246)}},'stack_trace':_0x188251 instanceof Error?_0x188251['stack']:undefined,'source':_0x5f1d5b(0x204)})[_0x5f1d5b(0x2cb)](()=>{}),{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x227)+_0x33b196}],'isError':![]};}}case _0x5f1d5b(0x206):{const _0x556212=WarpGrepGitHubArgsSchema[_0x5f1d5b(0x21b)](_0x2721fe);if(!_0x556212[_0x5f1d5b(0x240)])return{'content':[{'type':_0x5f1d5b(0x1f5),'text':'Invalid\x20arguments:\x20'+_0x556212[_0x5f1d5b(0x1d5)]}],'isError':!![]};const _0x3108d3=_0x556212['data'][_0x5f1d5b(0x283)]||_0x556212['data'][_0x5f1d5b(0x1de)];if(!_0x3108d3)return{'content':[{'type':'text','text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x19429d=MORPH_API_KEY;if(!_0x19429d)throw new Error(_0x5f1d5b(0x21e));const _0x1dac67=Date[_0x5f1d5b(0x237)]();console[_0x5f1d5b(0x1d5)](_0x5f1d5b(0x1ea)+_0x3108d3+_0x5f1d5b(0x29c)+_0x556212[_0x5f1d5b(0x292)][_0x5f1d5b(0x230)]+'\x22');try{const _0x5a0ecb=new WarpGrepClient({'morphApiKey':_0x19429d,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4e5835=await _0x5a0ecb[_0x5f1d5b(0x2e3)]({'query':_0x556212[_0x5f1d5b(0x292)][_0x5f1d5b(0x230)],'github':_0x3108d3,'branch':_0x556212[_0x5f1d5b(0x292)][_0x5f1d5b(0x23b)]}),_0x12b9d9=Date[_0x5f1d5b(0x237)]()-_0x1dac67;console[_0x5f1d5b(0x1d5)](_0x5f1d5b(0x224)+_0x12b9d9+_0x5f1d5b(0x242)+_0x4e5835[_0x5f1d5b(0x240)]);const _0x47aee2=formatResult(_0x4e5835);return{'content':[{'type':'text','text':_0x47aee2}]};}catch(_0x3f1e26){const _0x314576=Date[_0x5f1d5b(0x237)]()-_0x1dac67,_0x2fca58=_0x3f1e26 instanceof Error?_0x3f1e26[_0x5f1d5b(0x2c1)]:String(_0x3f1e26);return console[_0x5f1d5b(0x1d5)](_0x5f1d5b(0x250)+_0x314576+_0x5f1d5b(0x210),_0x2fca58),reportMorphError({'error_message':_0x2fca58,'error_type':_0x3f1e26 instanceof Error?_0x3f1e26[_0x5f1d5b(0x1c9)][_0x5f1d5b(0x2b9)]:'UnknownError','context':{'tool':_0x5f1d5b(0x206),'github_url':_0x3108d3,'search_string':_0x556212['data'][_0x5f1d5b(0x230)],'branch':_0x556212[_0x5f1d5b(0x292)]['branch']},'stack_trace':_0x3f1e26 instanceof Error?_0x3f1e26[_0x5f1d5b(0x28d)]:undefined,'source':'mcp-filesystem','tool':_0x5f1d5b(0x206),'latency_ms':_0x314576})['catch'](()=>{}),{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x1e3)+_0x2fca58}],'isError':![]};}}case _0x5f1d5b(0x280):{const _0xed27dc=CodebaseSearchArgsSchema['safeParse'](_0x2721fe);if(!_0xed27dc[_0x5f1d5b(0x240)])return{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x291)+_0xed27dc['error']}],'isError':!![]};try{const _0x24f4c1=MORPH_API_KEY;if(!_0x24f4c1)throw new Error(_0x5f1d5b(0x26a));const _0x43e04e=_0xed27dc['data'][_0x5f1d5b(0x27e)],_0x47dfc6=await executeCodebaseSearch({'query':_0xed27dc[_0x5f1d5b(0x292)][_0x5f1d5b(0x2a0)],'target_directories':_0x43e04e,'limit':_0xed27dc['data']['limit']},{'apiKey':_0x24f4c1,'repoId':_0xed27dc[_0x5f1d5b(0x292)][_0x5f1d5b(0x2d0)],'branch':_0xed27dc[_0x5f1d5b(0x292)][_0x5f1d5b(0x23b)],'commitHash':_0xed27dc[_0x5f1d5b(0x292)][_0x5f1d5b(0x1fa)],'debug':![]});if(!_0x47dfc6[_0x5f1d5b(0x240)])return{'content':[{'type':'text','text':_0x5f1d5b(0x265)+_0x47dfc6[_0x5f1d5b(0x1d5)]}],'isError':!![]};const _0x1d54c0=_0x47dfc6[_0x5f1d5b(0x243)][_0x5f1d5b(0x2a9)]===0x0?_0x5f1d5b(0x25b)+_0xed27dc['data'][_0x5f1d5b(0x2a0)]+'\x22':_0x5f1d5b(0x2e2)+_0x47dfc6['results'][_0x5f1d5b(0x2a9)]+_0x5f1d5b(0x1e6)+_0x47dfc6[_0x5f1d5b(0x261)]['searchTimeMs']+'ms:\x0a\x0a'+_0x47dfc6[_0x5f1d5b(0x243)][_0x5f1d5b(0x220)]((_0x5ae61d,_0x48c99e)=>_0x48c99e+0x1+'.\x20'+_0x5ae61d[_0x5f1d5b(0x263)]+'\x20('+(_0x5ae61d[_0x5f1d5b(0x1c7)]*0x64)[_0x5f1d5b(0x28e)](0x1)+_0x5f1d5b(0x24d)+('\x20\x20\x20Lines\x20'+_0x5ae61d[_0x5f1d5b(0x267)]+'-'+_0x5ae61d['endLine']+'\x0a')+(_0x5f1d5b(0x1db)+_0x5ae61d[_0x5f1d5b(0x27d)][_0x5f1d5b(0x2c2)](0x0,0xc8)+(_0x5ae61d[_0x5f1d5b(0x27d)][_0x5f1d5b(0x2a9)]>0xc8?_0x5f1d5b(0x299):'')+'\x0a'))[_0x5f1d5b(0x2c3)]('\x0a');return{'content':[{'type':'text','text':_0x1d54c0}]};}catch(_0x59935a){const _0x45ea12=_0x59935a instanceof Error?_0x59935a[_0x5f1d5b(0x2c1)]:String(_0x59935a);return reportMorphError({'error_message':_0x45ea12,'error_type':_0x59935a instanceof Error?_0x59935a['constructor'][_0x5f1d5b(0x2b9)]:_0x5f1d5b(0x234),'context':{'tool':_0x5f1d5b(0x280),'query':_0xed27dc[_0x5f1d5b(0x292)]['query'],'repo_id':_0xed27dc[_0x5f1d5b(0x292)][_0x5f1d5b(0x2d0)],'target_directories':_0xed27dc[_0x5f1d5b(0x292)][_0x5f1d5b(0x27e)]},'stack_trace':_0x59935a instanceof Error?_0x59935a[_0x5f1d5b(0x28d)]:undefined,'source':_0x5f1d5b(0x204)})[_0x5f1d5b(0x2cb)](()=>{}),{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x26e)+_0x45ea12}],'isError':!![]};}}default:throw new Error(_0x5f1d5b(0x231)+_0x296bec);}}catch(_0x140f4f){const _0x45ca8f=_0x140f4f instanceof Error?_0x140f4f[_0x5f1d5b(0x2c1)]:String(_0x140f4f);return reportMorphError({'error_message':_0x45ca8f,'error_type':_0x140f4f instanceof Error?_0x140f4f[_0x5f1d5b(0x1c9)][_0x5f1d5b(0x2b9)]:'UnknownError','context':{'tool':name,'arguments':args?JSON[_0x5f1d5b(0x2de)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x5f1d5b(0x278)},'stack_trace':_0x140f4f instanceof Error?_0x140f4f[_0x5f1d5b(0x28d)]:undefined,'source':_0x5f1d5b(0x204)})[_0x5f1d5b(0x2cb)](()=>{}),{'content':[{'type':_0x5f1d5b(0x1f5),'text':_0x5f1d5b(0x26e)+_0x45ca8f}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x45a317){const _0x1b841e=a0_0x15caa6,_0x2b5fbd=await getValidRootDirectories(_0x45a317);if(_0x2b5fbd[_0x1b841e(0x2a9)]>0x0)allowedDirectories=[..._0x2b5fbd],console[_0x1b841e(0x1d5)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x2b5fbd[_0x1b841e(0x2a9)]+'\x20valid\x20directories');else{console[_0x1b841e(0x1d5)](_0x1b841e(0x21a));if(ENABLE_WORKSPACE_MODE)try{const _0x5ea4dd=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x5ea4dd&&(allowedDirectories=[_0x5ea4dd],console[_0x1b841e(0x1d5)](_0x1b841e(0x226)+_0x5ea4dd));}catch(_0x190d66){console['error'](_0x1b841e(0x293)+_0x190d66);}}}server[a0_0x15caa6(0x273)](RootsListChangedNotificationSchema,async()=>{const _0x18c3a8=a0_0x15caa6;try{const _0x402afe=await server[_0x18c3a8(0x285)]();_0x402afe&&'roots'in _0x402afe&&await updateAllowedDirectoriesFromRoots(_0x402afe['roots']);}catch(_0x13f636){console[_0x18c3a8(0x1d5)](_0x18c3a8(0x24e),_0x13f636 instanceof Error?_0x13f636[_0x18c3a8(0x2c1)]:String(_0x13f636));}}),server['oninitialized']=async()=>{const _0x4828ff=a0_0x15caa6,_0x4360ad=server['getClientCapabilities']();if(_0x4360ad?.[_0x4828ff(0x2a8)])try{const _0xe0ffa1=await server['listRoots']();_0xe0ffa1&&_0x4828ff(0x2a8)in _0xe0ffa1?await updateAllowedDirectoriesFromRoots(_0xe0ffa1[_0x4828ff(0x2a8)]):console[_0x4828ff(0x1d5)](_0x4828ff(0x281));}catch(_0x154376){console[_0x4828ff(0x1d5)](_0x4828ff(0x2df),_0x154376 instanceof Error?_0x154376[_0x4828ff(0x2c1)]:String(_0x154376));}else{if(allowedDirectories[_0x4828ff(0x2a9)]>0x0)console[_0x4828ff(0x1d5)](_0x4828ff(0x249),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x4828ff(0x1d5)](_0x4828ff(0x25f));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 _0x62b0e7=a0_0x15caa6,_0x265e6e=new StdioServerTransport();await server[_0x62b0e7(0x28c)](_0x265e6e),console[_0x62b0e7(0x1d5)](_0x62b0e7(0x205)),allowedDirectories['length']===0x0&&console[_0x62b0e7(0x1d5)](_0x62b0e7(0x21f));}runServer()[a0_0x15caa6(0x2cb)](_0x3d4659=>{const _0x5ab567=a0_0x15caa6;console[_0x5ab567(0x1d5)]('Fatal\x20error\x20running\x20server:',_0x3d4659),process[_0x5ab567(0x2bf)](0x1);});
|
|
2
|
+
const a0_0xe5ec39=a0_0x58d2;(function(_0x9f9d22,_0x1b1622){const _0x5a2e48=a0_0x58d2,_0x13b4c2=_0x9f9d22();while(!![]){try{const _0x5c49e2=-parseInt(_0x5a2e48(0x138))/0x1+-parseInt(_0x5a2e48(0x21b))/0x2+-parseInt(_0x5a2e48(0x216))/0x3+-parseInt(_0x5a2e48(0x1ba))/0x4+parseInt(_0x5a2e48(0x168))/0x5+-parseInt(_0x5a2e48(0x1d5))/0x6+parseInt(_0x5a2e48(0x1e7))/0x7*(parseInt(_0x5a2e48(0x18b))/0x8);if(_0x5c49e2===_0x1b1622)break;else _0x13b4c2['push'](_0x13b4c2['shift']());}catch(_0x485ee3){_0x13b4c2['push'](_0x13b4c2['shift']());}}}(a0_0x31a6,0x86482));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_0x3c04d7 from'fs/promises';import a0_0x3d8b09 from'path';import a0_0x3e8986 from'os';import{createRequire}from'module';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,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';function a0_0x58d2(_0xb2f25f,_0x54ce73){_0xb2f25f=_0xb2f25f-0x127;const _0x31a668=a0_0x31a6();let _0x58d254=_0x31a668[_0xb2f25f];return _0x58d254;}import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x99a8c9 from'axios';function fixPathRepetition(_0xa76687){const _0x1abef9=a0_0x58d2,_0x59eecc=_0xa76687[_0x1abef9(0x18d)](a0_0x3d8b09[_0x1abef9(0x134)])[_0x1abef9(0x188)](Boolean);if(_0x59eecc['length']<0x2)return null;for(let _0x2a9b1b=Math[_0x1abef9(0x1f4)](_0x59eecc[_0x1abef9(0x1e5)]/0x2);_0x2a9b1b>=0x1;_0x2a9b1b--){for(let _0x1f1ff4=0x0;_0x1f1ff4<=_0x59eecc[_0x1abef9(0x1e5)]-0x2*_0x2a9b1b;_0x1f1ff4++){const _0xe64b3c=_0x59eecc['slice'](_0x1f1ff4,_0x1f1ff4+_0x2a9b1b),_0x234fec=_0x59eecc[_0x1abef9(0x1c8)](_0x1f1ff4+_0x2a9b1b,_0x1f1ff4+0x2*_0x2a9b1b);if(_0xe64b3c[_0x1abef9(0x1fb)]((_0x4a98d0,_0x449ecc)=>_0x4a98d0===_0x234fec[_0x449ecc])){const _0x14ab04=[..._0x59eecc[_0x1abef9(0x1c8)](0x0,_0x1f1ff4),..._0x59eecc[_0x1abef9(0x1c8)](_0x1f1ff4+_0x2a9b1b)];return a0_0x3d8b09[_0x1abef9(0x134)]+_0x14ab04[_0x1abef9(0x19a)](a0_0x3d8b09[_0x1abef9(0x134)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x5d0378=a0_0x58d2;try{const _0x261785=require(_0x5d0378(0x164));return _0x261785['version']??_0x5d0378(0x236);}catch(_0x2e13a0){return console['error'](_0x5d0378(0x23d),_0x2e13a0),_0x5d0378(0x236);}}function printHelp(){const _0x44939a=a0_0x58d2;console[_0x44939a(0x1b6)](_0x44939a(0x21f)+getPackageVersion()),console[_0x44939a(0x1b6)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x44939a(0x1b6)]('\x0aOptions:'),console[_0x44939a(0x1b6)](_0x44939a(0x1c9)),console[_0x44939a(0x1b6)](_0x44939a(0x178)),console[_0x44939a(0x1b6)](_0x44939a(0x194)),console['log'](_0x44939a(0x13e)),console[_0x44939a(0x1b6)](_0x44939a(0x1ed)),console[_0x44939a(0x1b6)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0xe5ec39(0x1c8)](0x2),VERSION_FLAGS=new Set([a0_0xe5ec39(0x1ee),'-v','-V']),HELP_FLAGS=new Set([a0_0xe5ec39(0x1d4),'-h']);cliArgs['some'](_0x504faf=>VERSION_FLAGS['has'](_0x504faf))&&(console['log'](a0_0xe5ec39(0x21f)+getPackageVersion()),process[a0_0xe5ec39(0x20f)](0x0));cliArgs['some'](_0x5aa037=>HELP_FLAGS[a0_0xe5ec39(0x241)](_0x5aa037))&&(printHelp(),process[a0_0xe5ec39(0x20f)](0x0));function getCliArg(_0x3dc72b){const _0x1a6252=a0_0xe5ec39;for(let _0x34586b=0x0;_0x34586b<cliArgs[_0x1a6252(0x1e5)];_0x34586b++){const _0x32e8a9=cliArgs[_0x34586b];if(_0x32e8a9[_0x1a6252(0x191)]('--'+_0x3dc72b+'='))return _0x32e8a9[_0x1a6252(0x1c8)](('--'+_0x3dc72b+'=')['length']);if(_0x32e8a9==='--'+_0x3dc72b&&_0x34586b+0x1<cliArgs[_0x1a6252(0x1e5)])return cliArgs[_0x34586b+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0xe5ec39(0x241)](arg)||HELP_FLAGS[a0_0xe5ec39(0x241)](arg))continue;if(arg[a0_0xe5ec39(0x191)](a0_0xe5ec39(0x220)))continue;if(arg===a0_0xe5ec39(0x16a)){i++;continue;}args[a0_0xe5ec39(0x17f)](arg);}const WORKSPACE_ROOT=process['env'][a0_0xe5ec39(0x136)]||process['env'][a0_0xe5ec39(0x227)]||process[a0_0xe5ec39(0x1d0)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0xe5ec39(0x170)]!==a0_0xe5ec39(0x14c),MORPH_API_KEY=getCliArg(a0_0xe5ec39(0x1c1))??process[a0_0xe5ec39(0x140)][a0_0xe5ec39(0x18f)],MORPH_API_URL=process['env'][a0_0xe5ec39(0x225)],MORPH_WARP_GREP_TIMEOUT=process[a0_0xe5ec39(0x140)][a0_0xe5ec39(0x1be)]?parseInt(process['env']['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY[a0_0xe5ec39(0x191)](a0_0xe5ec39(0x239))&&console[a0_0xe5ec39(0x1eb)](a0_0xe5ec39(0x1bb));async function reportMorphError(_0x143bae){const _0x370ee7=a0_0xe5ec39;try{await a0_0x99a8c9[_0x370ee7(0x204)](_0x370ee7(0x17c),{..._0x143bae,'timestamp':new Date()[_0x370ee7(0x15d)](),'source':_0x143bae[_0x370ee7(0x1db)]||_0x370ee7(0x205)},{'timeout':0x1388,'headers':{'Content-Type':_0x370ee7(0x137),'Authorization':_0x370ee7(0x18e)+MORPH_API_KEY}});}catch{}}args[a0_0xe5ec39(0x1e5)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0xe5ec39(0x1eb)](a0_0xe5ec39(0x148)),console[a0_0xe5ec39(0x1eb)](a0_0xe5ec39(0x1ae)),console[a0_0xe5ec39(0x1eb)](a0_0xe5ec39(0x1e2)),console[a0_0xe5ec39(0x1eb)]('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),console[a0_0xe5ec39(0x1eb)]('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console[a0_0xe5ec39(0x1eb)]('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x59aac0){const _0x251299=a0_0xe5ec39;return a0_0x3d8b09[_0x251299(0x1c0)](_0x59aac0);}function expandHome(_0x23db2d){const _0x48cb21=a0_0xe5ec39;if(_0x23db2d[_0x48cb21(0x191)]('~/')||_0x23db2d==='~')return a0_0x3d8b09[_0x48cb21(0x19a)](a0_0x3e8986[_0x48cb21(0x1ce)](),_0x23db2d['slice'](0x1));return _0x23db2d;}function a0_0x31a6(){const _0x33ff6d=['match','substring','.vscode','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','1843710jILSVI','completed_with_file_errors','string','Relevant\x20context\x20found:','@morphllm/morphmcp\x20','--api-key=','...','RipgrepNotAvailable','Workspace\x20mode\x20enabled:\x20Using\x20','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','MORPH_API_URL','linesRemoved','PWD','path','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','runWarpGrep_call','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','access','getClientCapabilities','timeout','indexOf','<file\x20path=\x22','resolve','params','read','unknown','\x20\x20\x20Lines\x20','\x20error(s)','morph-','\x20as\x20allowed\x20directory','realpath','tsconfig.json','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','No\x20results\x20found\x20for\x20query:\x20\x22','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','has','edit_file','TimeoutError','messages','role','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','linesModified','files','etimedout','BinaryFile','text','RipgrepError','owner_repo','pyproject.toml','node_modules','\x20chars)','.git','[warpgrep_github_search]\x20Searching\x20','GitHub\x20search\x20failed:\x20','\x20is\x20not\x20a\x20directory','sep','.\x20Path:\x20','WORKSPACE_ROOT','application/json','476215Oiqeuc','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Created\x20File','filepath','map','data','\x0aExamples:',',\x20modified\x20','env','ReadError','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','Fallback:\x20Using\x20workspace\x20root\x20','inputSchema','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','finish','branch','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','-\x20Read\x20file\x20`','read\x20','\x20valid\x20directories','false','number','Max\x20results\x20to\x20return','search_string','timings','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Morph\x20Edit\x20','SubToolError','Applied','Error\x20running\x20fast\x20context\x20search:\x20','FileNotFound','ENOENT','\x27\x20in\x20`','Error\x20accessing\x20directory\x20','constructor','morph-warp-grep-v1-1111v0','go.mod','toISOString','min','metadata','❌\x20Morph\x20Edit\x20Failed:\x20','WarpGrep\x20sub-tool\x20errors:\x20','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','terminationReason','../package.json','codebase_search','WarpGrepError','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','693835CffZwe','Unknown\x20error','--api-key','setRequestHandler','name','warpgrep_codebase_search','Natural\x20language\x20query\x20to\x20search\x20for\x20code','Specific\x20commit\x20hash\x20to\x20search','ENABLE_WORKSPACE_MODE','0.2.0','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','query','message','.\x20Changes:\x20','Unknown\x20tool:\x20','lines','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','requiresApiKey','Error:\x20','trim','https://morphllm.com/api/error-report','startLine','safeParse','push','Benefits:\x0a','\x20\x20\x20','Preview\x20changes\x20without\x20applying\x20them.','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Failed\x20to\x20request\x20roots\x20from\x20client:','Morph\x20FastApply\x20failed\x20without\x20error\x20message','filter','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','stringify','8wpxoss','Found\x20','split','Bearer\x20','MORPH_API_KEY','Fatal\x20error\x20running\x20server:','startsWith','includes','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','toLowerCase','description','Warning:\x20Workspace\x20fallback\x20failed:\x20','[could\x20not\x20read\x20file:\x20','join','describe','rerankScore','stats','connect','</file>','grep','basename','array','Invalid\x20arguments:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','ms:\x0a\x0a','\x22>\x0aError\x20reading\x20file:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','morph-v3-fast','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','dryRun','catch','warpgrep_github_search','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x20for:\x20\x22','search_type','errors','.cursor','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','commitHash','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','log','stat','assistant','readFile','1931640Vrxfwg','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','repoId','timed\x20out','MORPH_WARP_GREP_TIMEOUT','listRoots','normalize','api-key','oninitialized','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','-\x20Listed\x20directory\x20`','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','slice','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Parent\x20directory\x20does\x20not\x20exist:\x20','list_directory\x20','homedir','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','cwd','PathError','ms:','\x20results\x20in\x20','--help','3659082gEYoiP','roots','dirname','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','FileReadError','source','stack','isDirectory','Repository\x20identifier','now','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','boolean','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','utf-8','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','length','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','24905993ALBpNH','repo_path','Warning:\x20','isArray','error','default','\x20\x20morph-mcp','--version','ToolException','targetDirectories','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','code_edit','floor','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','File\x20read\x20error:','setNotificationHandler','success','object','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','every','terminated','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','endLine','optional','instruction','payload','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','enum','post','mcp-filesystem','[warpgrep_github_search]\x20Done\x20in\x20','code','results','UnknownError','content','Morph\x20Edit\x20Preview','package.json','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','completed','exit','Failed\x20to\x20read\x20file:\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','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.','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','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','1967763krBGon'];a0_0x31a6=function(){return _0x33ff6d;};return a0_0x31a6();}let allowedDirectories=await Promise['all'](args[a0_0xe5ec39(0x13c)](async _0x377653=>{const _0x4f233c=a0_0xe5ec39,_0x4d5122=expandHome(_0x377653),_0x413729=a0_0x3d8b09['resolve'](_0x4d5122);try{const _0x1632bd=await a0_0x3c04d7[_0x4f233c(0x23b)](_0x413729);return normalizePath(_0x1632bd);}catch(_0x5e362f){return normalizePath(_0x413729);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0xe5ec39(0x1e5)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0xe5ec39(0x17f)](workspaceDir),console['error'](a0_0xe5ec39(0x223)+workspaceDir+a0_0xe5ec39(0x23a)));}catch(a0_0x15e51a){console[a0_0xe5ec39(0x1eb)]('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x15e51a);}async function detectWorkspaceRoot(_0x54b2a4){const _0x27bdba=a0_0xe5ec39;let _0xacf354=a0_0x3d8b09[_0x27bdba(0x233)](_0x54b2a4);const _0x39c834=[_0x27bdba(0x130),_0x27bdba(0x219),_0x27bdba(0x20c),'Cargo.toml',_0x27bdba(0x12d),_0x27bdba(0x15c),_0x27bdba(0x1b2),_0x27bdba(0x23c),'composer.json'];while(_0xacf354!==a0_0x3d8b09[_0x27bdba(0x1d7)](_0xacf354)){for(const _0x229305 of _0x39c834){const _0x23fbcd=a0_0x3d8b09[_0x27bdba(0x19a)](_0xacf354,_0x229305);try{return await a0_0x3c04d7[_0x27bdba(0x22e)](_0x23fbcd),normalizePath(_0xacf354);}catch{}}_0xacf354=a0_0x3d8b09[_0x27bdba(0x1d7)](_0xacf354);}return normalizePath(_0x54b2a4);}await Promise['all'](args[a0_0xe5ec39(0x13c)](async _0x1edb1a=>{const _0x57fdb8=a0_0xe5ec39;try{const _0x2a937e=await a0_0x3c04d7[_0x57fdb8(0x1b7)](expandHome(_0x1edb1a));!_0x2a937e[_0x57fdb8(0x1dd)]()&&(console[_0x57fdb8(0x1eb)](_0x57fdb8(0x17a)+_0x1edb1a+_0x57fdb8(0x133)),process['exit'](0x1));}catch(_0x35546c){console[_0x57fdb8(0x1eb)](_0x57fdb8(0x159)+_0x1edb1a+':',_0x35546c),process[_0x57fdb8(0x20f)](0x1);}}));async function validatePath(_0x455a16){const _0x13afb6=a0_0xe5ec39,_0xfa9403=expandHome(_0x455a16),_0x47ef1a=a0_0x3d8b09[_0x13afb6(0x233)](_0xfa9403);try{const _0x507027=await a0_0x3c04d7[_0x13afb6(0x23b)](_0x47ef1a);return _0x507027;}catch(_0x450a4b){if(_0x450a4b[_0x13afb6(0x207)]===_0x13afb6(0x157)){const _0x3ca930=a0_0x3d8b09[_0x13afb6(0x1d7)](_0x47ef1a);try{const _0x1cfd22=await a0_0x3c04d7['realpath'](_0x3ca930);return a0_0x3d8b09['join'](_0x1cfd22,a0_0x3d8b09[_0x13afb6(0x1a1)](_0x47ef1a));}catch{throw new Error(_0x13afb6(0x1cc)+_0x3ca930);}}throw _0x450a4b;}}const MorphEditFileArgsSchema=z[a0_0xe5ec39(0x1f9)]({'path':z[a0_0xe5ec39(0x21d)](),'code_edit':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x1a9)),'instruction':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x211)),'dryRun':z[a0_0xe5ec39(0x1e1)]()['default'](![])[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x182))}),WarpGrepArgsSchema=z[a0_0xe5ec39(0x1f9)]({'search_string':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x1d8)),'repo_path':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x214)),'search_type':z[a0_0xe5ec39(0x203)]([a0_0xe5ec39(0x1ec),a0_0xe5ec39(0x12e)])[a0_0xe5ec39(0x1ff)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x21a))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()[a0_0xe5ec39(0x19b)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'github_url':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x1ff)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x185)),'owner_repo':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x1ff)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x1b5)),'branch':z[a0_0xe5ec39(0x21d)]()[a0_0xe5ec39(0x1ff)]()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x184))}),CodebaseSearchArgsSchema=z[a0_0xe5ec39(0x1f9)]({'query':z['string']()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x16e)),'repoId':z['string']()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x1de)),'branch':z[a0_0xe5ec39(0x21d)]()['optional']()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x1d9)),'commitHash':z[a0_0xe5ec39(0x21d)]()['optional']()[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x16f)),'targetDirectories':z[a0_0xe5ec39(0x1a2)](z[a0_0xe5ec39(0x21d)]())[a0_0xe5ec39(0x1ec)]([])['describe']('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0xe5ec39(0x14d)]()['optional']()['default'](0xa)[a0_0xe5ec39(0x19b)](a0_0xe5ec39(0x14e))}),server=new Server({'name':'morph-mcp','version':a0_0xe5ec39(0x171)},{'capabilities':{'tools':{}}});server[a0_0xe5ec39(0x16b)](ListToolsRequestSchema,async()=>{const _0x50793f=a0_0xe5ec39,_0x3a54e9=[{'name':'edit_file','description':_0x50793f(0x195)+_0x50793f(0x1ca)+_0x50793f(0x246)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+_0x50793f(0x183)+_0x50793f(0x23f)+_0x50793f(0x151)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+_0x50793f(0x1e6)+_0x50793f(0x1c7)+_0x50793f(0x1c3)+'For\x20deletions:\x0a'+_0x50793f(0x167)+_0x50793f(0x162)+'Rules:\x0a'+_0x50793f(0x145)+_0x50793f(0x22d)+_0x50793f(0x22c)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x50793f(0x212)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x50793f(0x193),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':'A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20'+_0x50793f(0x224)+_0x50793f(0x142)+_0x50793f(0x1ad)+_0x50793f(0x189)+_0x50793f(0x1cf)+_0x50793f(0x229)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x50793f(0x240)+_0x50793f(0x1c5)+'🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a'+_0x50793f(0x180)+_0x50793f(0x202)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x50793f(0x139)+'-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a'+_0x50793f(0x22b)+_0x50793f(0x1f5)+_0x50793f(0x1fa),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x22eca1=_0x3a54e9[_0x50793f(0x188)](_0x175894=>{const _0x364bc2=_0x50793f;if(_0x364bc2(0x179)in _0x175894&&_0x175894[_0x364bc2(0x179)]&&!MORPH_API_KEY)return console[_0x364bc2(0x1eb)](_0x364bc2(0x1e9)+_0x175894['name']+_0x364bc2(0x1cb)),![];return!![];});return{'tools':_0x22eca1[_0x50793f(0x13c)](_0x31090b=>({'name':_0x31090b[_0x50793f(0x16c)],'description':_0x31090b[_0x50793f(0x197)],'inputSchema':_0x31090b[_0x50793f(0x144)]}))};}),server[a0_0xe5ec39(0x16b)](CallToolRequestSchema,async _0x4ab4ba=>{const _0x30066b=a0_0xe5ec39;try{const {name:_0x2e307e,arguments:_0x36b002}=_0x4ab4ba[_0x30066b(0x234)];switch(_0x2e307e){case _0x30066b(0x242):{const _0x2e5693=MorphEditFileArgsSchema[_0x30066b(0x17e)](_0x36b002);if(!_0x2e5693['success'])throw new Error(_0x30066b(0x1b3)+_0x2e5693[_0x30066b(0x1eb)]);const _0x124786=await validatePath(_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x228)]);let _0x4bf3de=null,_0x51f892=!![],_0x427330=null;try{_0x4bf3de=await a0_0x3c04d7[_0x30066b(0x1b9)](_0x124786,'utf-8');}catch(_0x32e5c5){const _0x140376=_0x32e5c5[_0x30066b(0x207)];_0x140376==='ENOENT'?(_0x51f892=![],_0x4bf3de=''):(_0x427330=_0x30066b(0x210)+(_0x140376||_0x30066b(0x236))+'\x20-\x20'+(_0x32e5c5 instanceof Error?_0x32e5c5['message']:String(_0x32e5c5)),console['error'](_0x30066b(0x1e9)+_0x427330));}let _0x4598c0;try{const _0x4153bf=MORPH_API_KEY;if(!_0x4153bf)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x121908=a0_0x3d8b09[_0x30066b(0x1d7)](_0x124786),_0x437a15=a0_0x3d8b09[_0x30066b(0x1a1)](_0x124786),_0xd9f74a=await executeEditFile({'target_filepath':_0x437a15,'code_edit':_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x1f3)],'instructions':_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x200)]},{'morphApiKey':_0x4153bf,'morphApiUrl':MORPH_API_URL,'baseDir':_0x121908,'autoWrite':!_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x1aa)],'generateUdiff':![],'debug':![]});_0x4598c0=_0xd9f74a['completionId'];if(!_0xd9f74a[_0x30066b(0x1f8)])throw new Error(_0xd9f74a[_0x30066b(0x1eb)]||_0x30066b(0x187));const _0x1cf9e7=_0xd9f74a['changes'],_0x6bd1e3='added\x20'+_0x1cf9e7['linesAdded']+',\x20removed\x20'+_0x1cf9e7[_0x30066b(0x226)]+_0x30066b(0x13f)+_0x1cf9e7[_0x30066b(0x247)];if(_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x1aa)])return{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x20b)+(_0x51f892?'':'\x20(new\x20file)')+':\x20'+_0x2e5693['data']['instruction']+_0x30066b(0x175)+_0x6bd1e3+_0x30066b(0x135)+_0x2e5693['data']['path']+'.'}]};return{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x152)+(_0x51f892?_0x30066b(0x154):_0x30066b(0x13a))+':\x20'+_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x200)]+_0x30066b(0x175)+_0x6bd1e3+'.\x20Path:\x20'+_0x2e5693['data']['path']+'.'}]};}catch(_0x1e3211){const _0x4919c6=_0x1e3211 instanceof Error?_0x1e3211[_0x30066b(0x174)]:String(_0x1e3211);return reportMorphError({'error_message':_0x4919c6,'error_type':_0x1e3211 instanceof Error?_0x1e3211[_0x30066b(0x15a)][_0x30066b(0x16c)]:'UnknownError','context':{'tool':'edit_file','completion_id':_0x4598c0,'file_path':_0x2e5693['data']['path'],'validated_path':_0x124786,'instruction':_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x200)],'model':_0x30066b(0x1a8),'dry_run':_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x1aa)],'file_exists':_0x51f892,'file_read_error':_0x427330,'file_readable':_0x4bf3de!==null,'request_content':{'path':_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x228)],'code_edit':_0x2e5693['data'][_0x30066b(0x1f3)],'instruction':_0x2e5693['data'][_0x30066b(0x200)],'original_code':_0x4bf3de!==null?_0x4bf3de['length']>0xc350?_0x4bf3de[_0x30066b(0x218)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x4bf3de[_0x30066b(0x1e5)]+_0x30066b(0x12f):_0x4bf3de:_0x30066b(0x199)+(_0x427330||'unknown\x20error')+']','original_code_length':_0x4bf3de?.['length']??0x0,'model':_0x30066b(0x1a8),'dry_run':_0x2e5693[_0x30066b(0x13d)][_0x30066b(0x1aa)]}},'stack_trace':_0x1e3211 instanceof Error?_0x1e3211[_0x30066b(0x1dc)]:undefined,'source':'mcp-filesystem'})[_0x30066b(0x1ab)](()=>{}),{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x160)+_0x4919c6}],'isError':!![]};}}case _0x30066b(0x16d):{const _0x46c764=WarpGrepArgsSchema['safeParse'](_0x36b002);if(!_0x46c764[_0x30066b(0x1f8)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x46c764['error']}],'isError':!![]};const _0x4e20d5=_0x307a67=>{const _0x2f6fa5=_0x30066b,_0x1ab25d=[];for(const _0x27fd31 of _0x307a67||[]){const _0x2c03d7=_0x27fd31[_0x2f6fa5(0x245)],_0x5bd55f=_0x27fd31[_0x2f6fa5(0x20a)];if(_0x2c03d7===_0x2f6fa5(0x1b8)&&_0x5bd55f){const _0x6b8064=_0x5bd55f[_0x2f6fa5(0x18d)]('\x0a')[_0x2f6fa5(0x188)](_0x133f9d=>_0x133f9d[_0x2f6fa5(0x17b)]());for(const _0x117902 of _0x6b8064){const _0x387371=_0x117902['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x387371){_0x1ab25d[_0x2f6fa5(0x17f)]('grep\x20\x27'+_0x387371[0x1]+'\x27\x20'+_0x387371[0x2]);continue;}const _0x5a3979=_0x117902[_0x2f6fa5(0x217)](/^read\s+(.+)$/);if(_0x5a3979){_0x1ab25d['push'](_0x2f6fa5(0x14a)+_0x5a3979[0x1]);continue;}const _0x564fe1=_0x117902['match'](/^list_directory\s+(.+)$/);if(_0x564fe1){_0x1ab25d['push'](_0x2f6fa5(0x1cd)+_0x564fe1[0x1]);continue;}}}}return _0x1ab25d;},_0x1f2a40=_0x3aa4ea=>{const _0x30bef1=_0x30066b,_0x3ca75e=[];if(!_0x3aa4ea||!Array[_0x30bef1(0x1ea)](_0x3aa4ea))return _0x3ca75e;const _0x159418=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x30bef1(0x156),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x30bef1(0x1d1),'tool':_0x30bef1(0x235)},{'pattern':/\[READ ERROR\]/,'error_type':_0x30bef1(0x141),'tool':_0x30bef1(0x235)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x30bef1(0x235)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x30bef1(0x12b),'tool':_0x30bef1(0x1a0)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x30bef1(0x222),'tool':_0x30bef1(0x1a0)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x30bef1(0x129),'tool':_0x30bef1(0x235)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x30bef1(0x235)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x30bef1(0x235)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x30bef1(0x235)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x30bef1(0x235)},{'pattern':/status="error"/,'error_type':_0x30bef1(0x1ef),'tool':_0x30bef1(0x236)}];let _0x561bf3=0x0;for(const _0x5edd93 of _0x3aa4ea){if(_0x5edd93[_0x30bef1(0x245)]==='user'){_0x561bf3++;const _0x5ae187=_0x5edd93[_0x30bef1(0x20a)];if(!_0x5ae187||typeof _0x5ae187!==_0x30bef1(0x21d))continue;for(const {pattern:_0x5f093f,error_type:_0x5a37ae,tool:_0x568101}of _0x159418){const _0x3853ab=_0x5ae187[_0x30bef1(0x217)](new RegExp(_0x5f093f[_0x30bef1(0x1db)],'g'));if(_0x3853ab)for(const _0x2dd407 of _0x3853ab){const _0x3047a2=_0x5ae187[_0x30bef1(0x231)](_0x2dd407),_0x489ae5=_0x5ae187['substring'](_0x3047a2,Math[_0x30bef1(0x15e)](_0x3047a2+0xc8,_0x5ae187[_0x30bef1(0x1e5)]));_0x3ca75e[_0x30bef1(0x17f)]({'tool':_0x568101,'error_type':_0x5a37ae,'error_message':_0x489ae5[_0x30bef1(0x18d)]('\x0a')[0x0],'turn':_0x561bf3});}}}}return _0x3ca75e;};try{const _0x30646f=a0_0x3d8b09['resolve'](_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)]),_0x538b4a=_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1b0)],_0x254248=_0x538b4a===_0x30066b(0x12e)?{'allowNames':['node_modules']}:undefined,_0x223625=new LocalRipgrepProvider(_0x30646f,undefined,_0x254248),_0x1512ef=await runWarpGrep({'query':_0x46c764[_0x30066b(0x13d)]['search_string'],'repoRoot':_0x30646f,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x223625,'search_type':_0x538b4a}),_0x3bfce9=_0x1f2a40(_0x1512ef[_0x30066b(0x244)]);_0x3bfce9[_0x30066b(0x1e5)]>0x0&&reportMorphError({'error_message':_0x30066b(0x161)+_0x3bfce9['length']+_0x30066b(0x238),'error_type':_0x30066b(0x153),'level':'warn','tool':_0x30066b(0x16d),'context':{'repo_path':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)],'query':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x14f)],'model':_0x30066b(0x15b),'termination_reason':_0x1512ef[_0x30066b(0x163)],'sub_tool_errors':_0x3bfce9,'timings':_0x1512ef['timings'],'tool_calls':_0x4e20d5(_0x1512ef[_0x30066b(0x244)]),'messages':_0x1512ef['messages']?.[_0x30066b(0x13c)](_0x3dc444=>({'role':_0x3dc444[_0x30066b(0x245)],'content':_0x3dc444[_0x30066b(0x20a)]}))},'source':_0x30066b(0x205)})[_0x30066b(0x1ab)](()=>{});let _0x129c27='';if(_0x1512ef[_0x30066b(0x163)]===_0x30066b(0x20e)&&_0x1512ef[_0x30066b(0x146)]?.['metadata']?.[_0x30066b(0x127)]){const _0x26b5ca=_0x1512ef['finish'][_0x30066b(0x15f)]['files'];if(_0x26b5ca[_0x30066b(0x1e5)]===0x0)return _0x129c27=_0x1512ef[_0x30066b(0x146)][_0x30066b(0x201)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x30066b(0x12a),'text':_0x129c27}]};const _0x32573c=[],_0x33c477=[_0x30066b(0x1f1)];for(const _0x3219a3 of _0x1512ef[_0x30066b(0x244)]){const _0x491855=_0x3219a3[_0x30066b(0x245)],_0x3c5b4a=_0x3219a3['content'];if(_0x491855===_0x30066b(0x1b8)&&_0x3c5b4a){const _0x1962ab=_0x3c5b4a[_0x30066b(0x18d)]('\x0a')[_0x30066b(0x188)](_0x15c483=>_0x15c483['trim']());for(const _0x2a4f2c of _0x1962ab){const _0x14d10d=_0x2a4f2c[_0x30066b(0x217)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x14d10d){_0x33c477[_0x30066b(0x17f)]('-\x20Grepped\x20\x27'+_0x14d10d[0x1]+_0x30066b(0x158)+_0x14d10d[0x2]+'`');continue;}const _0x169f40=_0x2a4f2c[_0x30066b(0x217)](/^read\s+(.+)$/);if(_0x169f40){_0x33c477[_0x30066b(0x17f)](_0x30066b(0x149)+_0x169f40[0x1]+'`');continue;}const _0xc0b4b=_0x2a4f2c['match'](/^list_directory\s+(.+)$/);if(_0xc0b4b){_0x33c477[_0x30066b(0x17f)](_0x30066b(0x1c6)+_0xc0b4b[0x1]+'`');continue;}}}}_0x32573c['push'](_0x33c477[_0x30066b(0x19a)]('\x0a'));const _0x8d4532=['',_0x30066b(0x21e)];for(const _0x3b2893 of _0x26b5ca){if(_0x3b2893['lines']==='*')_0x8d4532[_0x30066b(0x17f)]('-\x20'+_0x3b2893[_0x30066b(0x228)]+':*');else{if(Array['isArray'](_0x3b2893[_0x30066b(0x177)])){const _0x5675c6=_0x3b2893['lines'][_0x30066b(0x13c)](([_0x1f39a8,_0x40f7d3])=>{if(_0x1f39a8===_0x40f7d3)return''+_0x1f39a8;return _0x1f39a8+'-'+_0x40f7d3;});_0x8d4532[_0x30066b(0x17f)]('-\x20'+_0x3b2893[_0x30066b(0x228)]+':'+_0x5675c6[_0x30066b(0x19a)](','));}else _0x8d4532['push']('-\x20'+_0x3b2893[_0x30066b(0x228)]+':*');}}_0x8d4532[_0x30066b(0x17f)](''),_0x32573c['push'](_0x8d4532[_0x30066b(0x19a)]('\x0a')),_0x32573c[_0x30066b(0x17f)](_0x30066b(0x1a4));const _0x1ca91c=[];for(const _0x50a4c7 of _0x26b5ca){let _0x7081a9=a0_0x3d8b09[_0x30066b(0x233)](_0x46c764['data'][_0x30066b(0x1e8)],_0x50a4c7[_0x30066b(0x228)]),_0x407e8d=null,_0x4afb8e=null;try{_0x407e8d=await a0_0x3c04d7[_0x30066b(0x1b9)](_0x7081a9,{'encoding':_0x30066b(0x1e3)});}catch(_0x2e9536){const _0x126770=fixPathRepetition(_0x7081a9);if(_0x126770)try{_0x407e8d=await a0_0x3c04d7[_0x30066b(0x1b9)](_0x126770,{'encoding':'utf-8'}),_0x7081a9=_0x126770;}catch{_0x4afb8e=_0x2e9536 instanceof Error?_0x2e9536:new Error(String(_0x2e9536));}else _0x4afb8e=_0x2e9536 instanceof Error?_0x2e9536:new Error(String(_0x2e9536));}if(_0x407e8d!==null){const _0x1acce0=_0x407e8d[_0x30066b(0x18d)](/\r?\n/),_0x278b32=[_0x30066b(0x232)+_0x50a4c7[_0x30066b(0x228)]+'\x22>'];if(_0x50a4c7[_0x30066b(0x177)]==='*'||!Array[_0x30066b(0x1ea)](_0x50a4c7[_0x30066b(0x177)]))for(let _0x2137f5=0x1;_0x2137f5<=_0x1acce0[_0x30066b(0x1e5)];_0x2137f5++){const _0x4ca534=_0x1acce0[_0x2137f5-0x1];_0x278b32[_0x30066b(0x17f)](_0x2137f5+'|\x20'+_0x4ca534);}else for(const [_0xf786d0,_0x3f213a]of _0x50a4c7[_0x30066b(0x177)]){_0x278b32[_0x30066b(0x1e5)]>0x1&&_0x278b32['push']('');for(let _0x3a6d07=_0xf786d0;_0x3a6d07<=_0x3f213a&&_0x3a6d07<=_0x1acce0['length'];_0x3a6d07++){const _0x25272c=_0x1acce0[_0x3a6d07-0x1];_0x278b32[_0x30066b(0x17f)](_0x3a6d07+'|\x20'+_0x25272c);}}_0x278b32[_0x30066b(0x17f)](_0x30066b(0x19f)),_0x1ca91c['push'](_0x278b32[_0x30066b(0x19a)]('\x0a'));}else _0x1ca91c[_0x30066b(0x17f)](_0x30066b(0x232)+_0x50a4c7['path']+_0x30066b(0x1a6)+(_0x4afb8e?.[_0x30066b(0x174)]||_0x30066b(0x169))+'\x0a</file>');}_0x32573c[_0x30066b(0x17f)](_0x1ca91c[_0x30066b(0x19a)]('\x0a\x0a')),_0x129c27=_0x32573c['join']('\x0a');const _0x37fb2f=_0x1512ef[_0x30066b(0x1b1)]?.[_0x30066b(0x188)](_0x39d1f9=>_0x39d1f9[_0x30066b(0x174)]?.[_0x30066b(0x191)](_0x30066b(0x1f6)))||[];if(_0x37fb2f[_0x30066b(0x1e5)]>0x0){const _0x3ee232=_0x37fb2f[_0x30066b(0x13c)](_0x11f219=>_0x11f219[_0x30066b(0x174)])[_0x30066b(0x19a)](';\x20');reportMorphError({'error_message':_0x3ee232,'error_type':_0x30066b(0x1da),'context':{'tool':_0x30066b(0x16d),'repo_path':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)],'query':_0x46c764['data'][_0x30066b(0x14f)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x30066b(0x21c),'error_count':_0x37fb2f[_0x30066b(0x1e5)],'is_timeout':![],'timings':_0x1512ef[_0x30066b(0x150)],'files_attempted':_0x26b5ca[_0x30066b(0x13c)](_0x1c96d9=>({'path':_0x1c96d9[_0x30066b(0x228)],'lines':_0x1c96d9[_0x30066b(0x177)]})),'tool_calls':_0x4e20d5(_0x1512ef['messages']),'messages':_0x1512ef[_0x30066b(0x244)]?.['map'](_0x43215e=>({'role':_0x43215e['role'],'content':_0x43215e[_0x30066b(0x20a)]})),'request_content':{'query':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x14f)],'repo_path':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)],'repoRoot':a0_0x3d8b09[_0x30066b(0x233)](_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)]),'model':_0x30066b(0x15b)}},'source':_0x30066b(0x205)})[_0x30066b(0x1ab)](()=>{});}}else{if(_0x1512ef[_0x30066b(0x163)]===_0x30066b(0x1fc)&&_0x1512ef[_0x30066b(0x1b1)][_0x30066b(0x1e5)]>0x0){const _0xee90df=_0x1512ef['errors'][_0x30066b(0x13c)](_0x35d0ec=>_0x35d0ec[_0x30066b(0x174)])['join'](';\x20');_0x129c27=_0x30066b(0x17a)+_0xee90df;const _0x7ac94b=_0xee90df['toLowerCase']()[_0x30066b(0x192)](_0x30066b(0x230))||_0xee90df[_0x30066b(0x196)]()['includes'](_0x30066b(0x1bd))||_0xee90df[_0x30066b(0x196)]()[_0x30066b(0x192)](_0x30066b(0x128)),_0xf66cab=_0x1512ef[_0x30066b(0x146)]?.['metadata']?.[_0x30066b(0x127)],_0x238659=_0x1512ef[_0x30066b(0x1b1)][0x0];reportMorphError({'error_message':_0xee90df,'error_type':_0x7ac94b?'TimeoutError':_0x238659?.['constructor']?.[_0x30066b(0x16c)]||_0x30066b(0x166),'context':{'tool':_0x30066b(0x16d),'repo_path':_0x46c764['data'][_0x30066b(0x1e8)],'query':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x14f)],'model':_0x30066b(0x15b),'termination_reason':_0x1512ef[_0x30066b(0x163)],'error_count':_0x1512ef[_0x30066b(0x1b1)][_0x30066b(0x1e5)],'is_timeout':_0x7ac94b,'timings':_0x1512ef[_0x30066b(0x150)],'files_attempted':_0xf66cab?.[_0x30066b(0x13c)](_0x255baa=>({'path':_0x255baa[_0x30066b(0x228)],'lines':_0x255baa[_0x30066b(0x177)]})),'tool_calls':_0x4e20d5(_0x1512ef[_0x30066b(0x244)]),'messages':_0x1512ef[_0x30066b(0x244)]?.['map'](_0x20c0b3=>({'role':_0x20c0b3['role'],'content':_0x20c0b3[_0x30066b(0x20a)]})),'request_content':{'query':_0x46c764['data'][_0x30066b(0x14f)],'repo_path':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)],'repoRoot':a0_0x3d8b09[_0x30066b(0x233)](_0x46c764['data'][_0x30066b(0x1e8)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x238659?.[_0x30066b(0x1dc)]||undefined,'source':_0x30066b(0x205)})[_0x30066b(0x1ab)](()=>{});}else _0x129c27=_0x30066b(0x1e4);}return{'content':[{'type':_0x30066b(0x12a),'text':_0x129c27}]};}catch(_0x51cb3c){const _0xa795bf=_0x51cb3c instanceof Error?_0x51cb3c[_0x30066b(0x174)]:String(_0x51cb3c),_0x17a6ba=_0xa795bf[_0x30066b(0x196)]()['includes']('timeout')||_0xa795bf[_0x30066b(0x196)]()[_0x30066b(0x192)](_0x30066b(0x1bd))||_0xa795bf['toLowerCase']()[_0x30066b(0x192)](_0x30066b(0x128))||_0x51cb3c instanceof Error&&_0x51cb3c['name']===_0x30066b(0x243);return reportMorphError({'error_message':_0xa795bf,'error_type':_0x17a6ba?_0x30066b(0x243):_0x51cb3c instanceof Error?_0x51cb3c[_0x30066b(0x15a)][_0x30066b(0x16c)]:_0x30066b(0x209),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x46c764['data'][_0x30066b(0x1e8)],'query':_0x46c764[_0x30066b(0x13d)]['search_string'],'model':'morph-warp-grep-v1-1111v0','is_timeout':_0x17a6ba,'exception_phase':_0x30066b(0x22a),'request_content':{'query':_0x46c764['data'][_0x30066b(0x14f)],'repo_path':_0x46c764[_0x30066b(0x13d)][_0x30066b(0x1e8)],'repoRoot':a0_0x3d8b09[_0x30066b(0x233)](_0x46c764[_0x30066b(0x13d)]['repo_path']),'model':_0x30066b(0x15b)}},'stack_trace':_0x51cb3c instanceof Error?_0x51cb3c[_0x30066b(0x1dc)]:undefined,'source':_0x30066b(0x205)})[_0x30066b(0x1ab)](()=>{}),{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x155)+_0xa795bf}],'isError':![]};}}case _0x30066b(0x1ac):{const _0x149d1f=WarpGrepGitHubArgsSchema[_0x30066b(0x17e)](_0x36b002);if(!_0x149d1f[_0x30066b(0x1f8)])return{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x1a3)+_0x149d1f[_0x30066b(0x1eb)]}],'isError':!![]};const _0x572636=_0x149d1f[_0x30066b(0x13d)]['github_url']||_0x149d1f[_0x30066b(0x13d)][_0x30066b(0x12c)];if(!_0x572636)return{'content':[{'type':_0x30066b(0x12a),'text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x17a781=MORPH_API_KEY;if(!_0x17a781)throw new Error(_0x30066b(0x1fd));const _0x3fb8bc=Date[_0x30066b(0x1df)]();console[_0x30066b(0x1eb)](_0x30066b(0x131)+_0x572636+_0x30066b(0x1af)+_0x149d1f['data']['search_string']+'\x22');try{const _0x1dd10e=new WarpGrepClient({'morphApiKey':_0x17a781,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x331b10=await _0x1dd10e['searchGitHub']({'query':_0x149d1f[_0x30066b(0x13d)][_0x30066b(0x14f)],'github':_0x572636,'branch':_0x149d1f['data'][_0x30066b(0x147)]}),_0x3b3338=Date[_0x30066b(0x1df)]()-_0x3fb8bc;console[_0x30066b(0x1eb)](_0x30066b(0x206)+_0x3b3338+'ms.\x20Success:\x20'+_0x331b10['success']);const _0x9fa4cf=formatResult(_0x331b10);return{'content':[{'type':'text','text':_0x9fa4cf}]};}catch(_0x1acd6a){const _0x3be084=Date[_0x30066b(0x1df)]()-_0x3fb8bc,_0x502a97=_0x1acd6a instanceof Error?_0x1acd6a[_0x30066b(0x174)]:String(_0x1acd6a);return console['error']('[warpgrep_github_search]\x20Failed\x20in\x20'+_0x3be084+_0x30066b(0x1d2),_0x502a97),reportMorphError({'error_message':_0x502a97,'error_type':_0x1acd6a instanceof Error?_0x1acd6a[_0x30066b(0x15a)]['name']:'UnknownError','context':{'tool':_0x30066b(0x1ac),'github_url':_0x572636,'search_string':_0x149d1f[_0x30066b(0x13d)]['search_string'],'branch':_0x149d1f[_0x30066b(0x13d)][_0x30066b(0x147)]},'stack_trace':_0x1acd6a instanceof Error?_0x1acd6a[_0x30066b(0x1dc)]:undefined,'source':_0x30066b(0x205),'tool':_0x30066b(0x1ac),'latency_ms':_0x3be084})[_0x30066b(0x1ab)](()=>{}),{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x132)+_0x502a97}],'isError':![]};}}case _0x30066b(0x165):{const _0x1c5a74=CodebaseSearchArgsSchema['safeParse'](_0x36b002);if(!_0x1c5a74[_0x30066b(0x1f8)])return{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x1a3)+_0x1c5a74[_0x30066b(0x1eb)]}],'isError':!![]};try{const _0x4bc840=MORPH_API_KEY;if(!_0x4bc840)throw new Error(_0x30066b(0x1f2));const _0xc6a0a3=_0x1c5a74['data']['targetDirectories'],_0x1a8f6f=await executeCodebaseSearch({'query':_0x1c5a74[_0x30066b(0x13d)]['query'],'target_directories':_0xc6a0a3,'limit':_0x1c5a74['data']['limit']},{'apiKey':_0x4bc840,'repoId':_0x1c5a74[_0x30066b(0x13d)][_0x30066b(0x1bc)],'branch':_0x1c5a74[_0x30066b(0x13d)][_0x30066b(0x147)],'commitHash':_0x1c5a74[_0x30066b(0x13d)][_0x30066b(0x1b4)],'debug':![]});if(!_0x1a8f6f['success'])return{'content':[{'type':_0x30066b(0x12a),'text':'Search\x20failed:\x20'+_0x1a8f6f[_0x30066b(0x1eb)]}],'isError':!![]};const _0x40b3be=_0x1a8f6f[_0x30066b(0x208)]['length']===0x0?_0x30066b(0x23e)+_0x1c5a74[_0x30066b(0x13d)][_0x30066b(0x173)]+'\x22':_0x30066b(0x18c)+_0x1a8f6f[_0x30066b(0x208)][_0x30066b(0x1e5)]+_0x30066b(0x1d3)+_0x1a8f6f[_0x30066b(0x19d)]['searchTimeMs']+_0x30066b(0x1a5)+_0x1a8f6f[_0x30066b(0x208)]['map']((_0x288501,_0x4c093f)=>_0x4c093f+0x1+'.\x20'+_0x288501[_0x30066b(0x13b)]+'\x20('+(_0x288501[_0x30066b(0x19c)]*0x64)['toFixed'](0x1)+'%\x20match)\x0a'+(_0x30066b(0x237)+_0x288501[_0x30066b(0x17d)]+'-'+_0x288501[_0x30066b(0x1fe)]+'\x0a')+(_0x30066b(0x181)+_0x288501[_0x30066b(0x20a)]['substring'](0x0,0xc8)+(_0x288501[_0x30066b(0x20a)][_0x30066b(0x1e5)]>0xc8?_0x30066b(0x221):'')+'\x0a'))[_0x30066b(0x19a)]('\x0a');return{'content':[{'type':_0x30066b(0x12a),'text':_0x40b3be}]};}catch(_0x479220){const _0x3d0acb=_0x479220 instanceof Error?_0x479220[_0x30066b(0x174)]:String(_0x479220);return reportMorphError({'error_message':_0x3d0acb,'error_type':_0x479220 instanceof Error?_0x479220[_0x30066b(0x15a)][_0x30066b(0x16c)]:_0x30066b(0x209),'context':{'tool':_0x30066b(0x165),'query':_0x1c5a74['data']['query'],'repo_id':_0x1c5a74[_0x30066b(0x13d)][_0x30066b(0x1bc)],'target_directories':_0x1c5a74[_0x30066b(0x13d)][_0x30066b(0x1f0)]},'stack_trace':_0x479220 instanceof Error?_0x479220[_0x30066b(0x1dc)]:undefined,'source':_0x30066b(0x205)})[_0x30066b(0x1ab)](()=>{}),{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x17a)+_0x3d0acb}],'isError':!![]};}}default:throw new Error(_0x30066b(0x176)+_0x2e307e);}}catch(_0x3bdd2b){const _0x2f3fe8=_0x3bdd2b instanceof Error?_0x3bdd2b[_0x30066b(0x174)]:String(_0x3bdd2b);return reportMorphError({'error_message':_0x2f3fe8,'error_type':_0x3bdd2b instanceof Error?_0x3bdd2b[_0x30066b(0x15a)][_0x30066b(0x16c)]:_0x30066b(0x209),'context':{'tool':name,'arguments':args?JSON[_0x30066b(0x18a)](args)[_0x30066b(0x218)](0x0,0x1f4):undefined,'mcp_server_version':_0x30066b(0x171)},'stack_trace':_0x3bdd2b instanceof Error?_0x3bdd2b[_0x30066b(0x1dc)]:undefined,'source':'mcp-filesystem'})[_0x30066b(0x1ab)](()=>{}),{'content':[{'type':_0x30066b(0x12a),'text':_0x30066b(0x17a)+_0x2f3fe8}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x518382){const _0x5d3b30=a0_0xe5ec39,_0x44627a=await getValidRootDirectories(_0x518382);if(_0x44627a[_0x5d3b30(0x1e5)]>0x0)allowedDirectories=[..._0x44627a],console[_0x5d3b30(0x1eb)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x44627a[_0x5d3b30(0x1e5)]+_0x5d3b30(0x14b));else{console[_0x5d3b30(0x1eb)](_0x5d3b30(0x20d));if(ENABLE_WORKSPACE_MODE)try{const _0x34f180=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x34f180&&(allowedDirectories=[_0x34f180],console['error'](_0x5d3b30(0x143)+_0x34f180));}catch(_0x198c5c){console[_0x5d3b30(0x1eb)](_0x5d3b30(0x198)+_0x198c5c);}}}server[a0_0xe5ec39(0x1f7)](RootsListChangedNotificationSchema,async()=>{const _0x479f39=a0_0xe5ec39;try{const _0x35c343=await server[_0x479f39(0x1bf)]();_0x35c343&&'roots'in _0x35c343&&await updateAllowedDirectoriesFromRoots(_0x35c343[_0x479f39(0x1d6)]);}catch(_0x31445c){console[_0x479f39(0x1eb)](_0x479f39(0x186),_0x31445c instanceof Error?_0x31445c[_0x479f39(0x174)]:String(_0x31445c));}}),server[a0_0xe5ec39(0x1c2)]=async()=>{const _0x839428=a0_0xe5ec39,_0x49f1c1=server[_0x839428(0x22f)]();if(_0x49f1c1?.[_0x839428(0x1d6)])try{const _0x577903=await server[_0x839428(0x1bf)]();_0x577903&&_0x839428(0x1d6)in _0x577903?await updateAllowedDirectoriesFromRoots(_0x577903['roots']):console[_0x839428(0x1eb)](_0x839428(0x215));}catch(_0xf5bbb5){console['error']('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0xf5bbb5 instanceof Error?_0xf5bbb5[_0x839428(0x174)]:String(_0xf5bbb5));}else{if(allowedDirectories[_0x839428(0x1e5)]>0x0)console[_0x839428(0x1eb)](_0x839428(0x1a7),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console['error'](_0x839428(0x1e0));else throw new Error(_0x839428(0x213));}}};async function runServer(){const _0x24d8aa=a0_0xe5ec39,_0x59408b=new StdioServerTransport();await server[_0x24d8aa(0x19e)](_0x59408b),console[_0x24d8aa(0x1eb)](_0x24d8aa(0x1c4)),allowedDirectories['length']===0x0&&console[_0x24d8aa(0x1eb)](_0x24d8aa(0x172));}runServer()['catch'](_0x460896=>{const _0x1caad5=a0_0xe5ec39;console[_0x1caad5(0x1eb)](_0x1caad5(0x190),_0x460896),process[_0x1caad5(0x20f)](0x1);});
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x122268,_0x36bffb){const _0x230777=a1_0x4aa8,_0x1a532d=_0x122268();while(!![]){try{const _0x4929a9=-parseInt(_0x230777(0x8f))/0x1*(parseInt(_0x230777(0x86))/0x2)+-parseInt(_0x230777(0x8e))/0x3*(-parseInt(_0x230777(0x94))/0x4)+-parseInt(_0x230777(0x80))/0x5*(parseInt(_0x230777(0x7c))/0x6)+-parseInt(_0x230777(0x7f))/0x7*(-parseInt(_0x230777(0x81))/0x8)+parseInt(_0x230777(0x8b))/0x9*(parseInt(_0x230777(0x89))/0xa)+parseInt(_0x230777(0x8c))/0xb*(-parseInt(_0x230777(0x82))/0xc)+parseInt(_0x230777(0x85))/0xd*(-parseInt(_0x230777(0x7e))/0xe);if(_0x4929a9===_0x36bffb)break;else _0x1a532d['push'](_0x1a532d['shift']());}catch(_0x48392d){_0x1a532d['push'](_0x1a532d['shift']());}}}(a1_0x2f68,0xe5113));import a1_0x5c147a from'path';function a1_0x4aa8(_0x540190,_0x5e1ac4){_0x540190=_0x540190-0x7c;const _0x2f6814=a1_0x2f68();let _0x4aa803=_0x2f6814[_0x540190];return _0x4aa803;}import a1_0x8c18f2 from'os';export function convertToWindowsPath(_0x342771){const _0x25a79c=a1_0x4aa8;if(_0x342771['startsWith'](_0x25a79c(0x92))){const _0x262712=_0x342771[_0x25a79c(0x87)](0x5)[_0x25a79c(0x8d)](),_0x16d063=_0x342771[_0x25a79c(0x93)](0x6)[_0x25a79c(0x88)](/\//g,'\x5c');return _0x262712+':'+_0x16d063;}if(_0x342771[_0x25a79c(0x90)](/^\/[a-zA-Z]\//)){const _0x501e2e=_0x342771[_0x25a79c(0x87)](0x1)[_0x25a79c(0x8d)](),_0x46d473=_0x342771[_0x25a79c(0x93)](0x2)[_0x25a79c(0x88)](/\//g,'\x5c');return _0x501e2e+':'+_0x46d473;}if(_0x342771['match'](/^[a-zA-Z]:/))return _0x342771['replace'](/\//g,'\x5c');return _0x342771;}export function normalizePath(_0x877d4a){const _0x36a391=a1_0x4aa8;_0x877d4a=_0x877d4a[_0x36a391(0x83)]()[_0x36a391(0x88)](/^["']|["']$/g,'');const _0x17873d=_0x877d4a[_0x36a391(0x8a)]('/')&&!_0x877d4a[_0x36a391(0x90)](/^\/mnt\/[a-z]\//i)&&!_0x877d4a[_0x36a391(0x90)](/^\/[a-zA-Z]\//);if(_0x17873d)return _0x877d4a['replace'](/\/+/g,'/')['replace'](/\/+$/,'');_0x877d4a=convertToWindowsPath(_0x877d4a);if(_0x877d4a[_0x36a391(0x8a)]('\x5c\x5c')){let _0x306845=_0x877d4a;_0x306845=_0x306845[_0x36a391(0x88)](/^\\{2,}/,'\x5c\x5c');const _0x441c2e=_0x306845['substring'](0x2)[_0x36a391(0x88)](/\\\\/g,'\x5c');_0x877d4a='\x5c\x5c'+_0x441c2e;}else _0x877d4a=_0x877d4a[_0x36a391(0x88)](/\\\\/g,'\x5c');let _0x27acab=a1_0x5c147a['normalize'](_0x877d4a);_0x877d4a[_0x36a391(0x8a)]('\x5c\x5c')&&!_0x27acab[_0x36a391(0x8a)]('\x5c\x5c')&&(_0x27acab='\x5c'+_0x27acab);if(_0x27acab['match'](/^[a-zA-Z]:/)){let _0x292c75=_0x27acab[_0x36a391(0x88)](/\//g,'\x5c');return/^[a-z]:/[_0x36a391(0x7d)](_0x292c75)&&(_0x292c75=_0x292c75[_0x36a391(0x87)](0x0)[_0x36a391(0x8d)]()+_0x292c75[_0x36a391(0x93)](0x1)),_0x292c75;}return _0x27acab[_0x36a391(0x88)](/\//g,'\x5c');}function a1_0x2f68(){const _0x34973a=['9ujvNJw','1210zylwbA','toUpperCase','501gJUcIu','502KcgZqk','match','homedir','/mnt/','slice','32484jKSjfP','708grClvX','test','14SPZoGH','5689964ICAJwO','71965ecyizu','16UDjbtM','112740IXCBFe','trim','join','9093539YTufwR','248aaYlYY','charAt','replace','14499230CWLsWd','startsWith'];a1_0x2f68=function(){return _0x34973a;};return a1_0x2f68();}export function expandHome(_0x2a2855){const _0x1b49f3=a1_0x4aa8;if(_0x2a2855[_0x1b49f3(0x8a)]('~/')||_0x2a2855==='~')return a1_0x5c147a[_0x1b49f3(0x84)](a1_0x8c18f2[_0x1b49f3(0x91)](),_0x2a2855[_0x1b49f3(0x93)](0x1));return _0x2a2855;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4d637a,_0xe6f553){const _0x6b49d8=a2_0x3679,_0x131392=_0x4d637a();while(!![]){try{const _0x3d3776=parseInt(_0x6b49d8(0x12b))/0x1*(-parseInt(_0x6b49d8(0x127))/0x2)+parseInt(_0x6b49d8(0x118))/0x3*(-parseInt(_0x6b49d8(0x11f))/0x4)+parseInt(_0x6b49d8(0x11a))/0x5+parseInt(_0x6b49d8(0x11e))/0x6+parseInt(_0x6b49d8(0x120))/0x7+-parseInt(_0x6b49d8(0x11b))/0x8*(parseInt(_0x6b49d8(0x119))/0x9)+parseInt(_0x6b49d8(0x11d))/0xa*(-parseInt(_0x6b49d8(0x129))/0xb);if(_0x3d3776===_0xe6f553)break;else _0x131392['push'](_0x131392['shift']());}catch(_0x43880a){_0x131392['push'](_0x131392['shift']());}}}(a2_0x477b,0x3ffbc));import a2_0x453dc5 from'path';export function isPathWithinAllowedDirectories(_0x25a42f,_0x74ed12){const _0x269a85=a2_0x3679;if(typeof _0x25a42f!=='string'||!Array['isArray'](_0x74ed12))return![];if(!_0x25a42f||_0x74ed12[_0x269a85(0x12c)]===0x0)return![];if(_0x25a42f[_0x269a85(0x124)]('\x00'))return![];let _0x566c84;try{_0x566c84=a2_0x453dc5[_0x269a85(0x121)](a2_0x453dc5[_0x269a85(0x11c)](_0x25a42f));}catch{return![];}if(!a2_0x453dc5[_0x269a85(0x128)](_0x566c84))throw new Error(_0x269a85(0x122));return _0x74ed12[_0x269a85(0x126)](_0x53767b=>{const _0x11b55a=_0x269a85;if(typeof _0x53767b!=='string'||!_0x53767b)return![];if(_0x53767b['includes']('\x00'))return![];let _0x3611b7;try{_0x3611b7=a2_0x453dc5[_0x11b55a(0x121)](a2_0x453dc5['normalize'](_0x53767b));}catch{return![];}if(!a2_0x453dc5[_0x11b55a(0x128)](_0x3611b7))throw new Error(_0x11b55a(0x125));if(_0x566c84===_0x3611b7)return!![];if(_0x3611b7===a2_0x453dc5[_0x11b55a(0x123)])return _0x566c84[_0x11b55a(0x12a)](a2_0x453dc5['sep']);return _0x566c84['startsWith'](_0x3611b7+a2_0x453dc5[_0x11b55a(0x123)]);});}function a2_0x3679(_0x278e36,_0x216fa6){_0x278e36=_0x278e36-0x118;const _0x477b9a=a2_0x477b();let _0x3679d8=_0x477b9a[_0x278e36];return _0x3679d8;}function a2_0x477b(){const _0x3b36ec=['normalize','145260PGZbXd','2877030qoTTSX','4QVUfdu','3439002sGMGuh','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','sep','includes','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some','10skHQGL','isAbsolute','264uThoUs','startsWith','34003rvvbPK','length','633309wewqiS','1166877NHZHqC','753400cjPKpj','8qStJXC'];a2_0x477b=function(){return _0x3b36ec;};return a2_0x477b();}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x44e214,_0x44be46){const _0x1c3e88=a3_0x4899,_0x141355=_0x44e214();while(!![]){try{const _0xcd5b6c=-parseInt(_0x1c3e88(0x188))/0x1+-parseInt(_0x1c3e88(0x189))/0x2+-parseInt(_0x1c3e88(0x17d))/0x3*(parseInt(_0x1c3e88(0x174))/0x4)+-parseInt(_0x1c3e88(0x183))/0x5*(-parseInt(_0x1c3e88(0x18a))/0x6)+-parseInt(_0x1c3e88(0x182))/0x7*(parseInt(_0x1c3e88(0x18b))/0x8)+parseInt(_0x1c3e88(0x186))/0x9+parseInt(_0x1c3e88(0x181))/0xa;if(_0xcd5b6c===_0x44be46)break;else _0x141355['push'](_0x141355['shift']());}catch(_0x97d059){_0x141355['push'](_0x141355['shift']());}}}(a3_0x93f1,0x27733));import{promises as a3_0x465d4b}from'fs';function a3_0x93f1(){const _0x310ab7=['join','230731tcGMrH','304198eYbKUw','65796tfAZYB','200HzexzS','message','68PujHIY','uri','error','\x20due\x20to\x20error:\x20','startsWith','invalid\x20path\x20or\x20inaccessible','isDirectory','non-directory\x20root','Skipping\x20','23073MOYCMy','Skipping\x20invalid\x20directory:\x20','push','stat','8960810wmrmkc','88557PrjFjU','25MUasor','slice','resolve','364752kSgtYB'];a3_0x93f1=function(){return _0x310ab7;};return a3_0x93f1();}import a3_0x32286d from'path';function a3_0x4899(_0x3a952c,_0xb69ea4){_0x3a952c=_0x3a952c-0x173;const _0x93f1c2=a3_0x93f1();let _0x48992f=_0x93f1c2[_0x3a952c];return _0x48992f;}import a3_0x44875f from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x512927){const _0xb8c4db=a3_0x4899;try{const _0x236208=_0x512927[_0xb8c4db(0x178)]('file://')?_0x512927[_0xb8c4db(0x184)](0x7):_0x512927,_0xc7fcb7=_0x236208['startsWith']('~/')||_0x236208==='~'?a3_0x32286d[_0xb8c4db(0x187)](a3_0x44875f['homedir'](),_0x236208[_0xb8c4db(0x184)](0x1)):_0x236208,_0x5916f5=a3_0x32286d[_0xb8c4db(0x185)](_0xc7fcb7),_0x327db4=await a3_0x465d4b['realpath'](_0x5916f5);return normalizePath(_0x327db4);}catch{return null;}}function formatDirectoryError(_0x524c6b,_0x2244da,_0x33be22){const _0x4b05c3=a3_0x4899;if(_0x33be22)return _0x4b05c3(0x17c)+_0x33be22+':\x20'+_0x524c6b;const _0x418a47=_0x2244da instanceof Error?_0x2244da[_0x4b05c3(0x173)]:String(_0x2244da);return _0x4b05c3(0x17e)+_0x524c6b+_0x4b05c3(0x177)+_0x418a47;}export async function getValidRootDirectories(_0x4b612a){const _0x4a6998=a3_0x4899,_0x1d4c5b=[];for(const _0x20ca31 of _0x4b612a){const _0x49e26b=await parseRootUri(_0x20ca31[_0x4a6998(0x175)]);if(!_0x49e26b){console[_0x4a6998(0x176)](formatDirectoryError(_0x20ca31[_0x4a6998(0x175)],undefined,_0x4a6998(0x179)));continue;}try{const _0x4be62b=await a3_0x465d4b[_0x4a6998(0x180)](_0x49e26b);_0x4be62b[_0x4a6998(0x17a)]()?_0x1d4c5b[_0x4a6998(0x17f)](_0x49e26b):console[_0x4a6998(0x176)](formatDirectoryError(_0x49e26b,undefined,_0x4a6998(0x17b)));}catch(_0x3815f2){console[_0x4a6998(0x176)](formatDirectoryError(_0x49e26b,_0x3815f2));}}return _0x1d4c5b;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.116",
|
|
4
4
|
"description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Morph (https://morphllm.com)",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google/generative-ai": "^0.21.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
38
|
-
"@morphllm/morphsdk": "0.2.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.131",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|