@morphllm/morphmcp 0.8.52 → 0.8.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -100,6 +100,8 @@ Output: List of files with specific line ranges + actual code content
100
100
  |----------|-------------|---------|
101
101
  | `MORPH_API_KEY` | Your API key from [morphllm.com](https://morphllm.com) | Required |
102
102
  | `ENABLED_TOOLS` | Comma-separated list or `all` | `edit_file,warpgrep_codebase_search` |
103
+ | `MORPH_API_URL` | Override Morph API base URL for custom proxies | `https://api.morphllm.com` |
104
+ | `MORPH_WARP_GREP_TIMEOUT` | Timeout for warp grep model calls in ms | `30000` |
103
105
 
104
106
  ### Customize enabled tools
105
107
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x4a28af=a0_0x547b;(function(_0x537a22,_0x5b2e0c){const _0x459b18=a0_0x547b,_0x5a805b=_0x537a22();while(!![]){try{const _0x5bc840=-parseInt(_0x459b18(0x11a))/0x1+parseInt(_0x459b18(0xfa))/0x2+parseInt(_0x459b18(0x11b))/0x3*(parseInt(_0x459b18(0xd2))/0x4)+-parseInt(_0x459b18(0x149))/0x5*(-parseInt(_0x459b18(0x119))/0x6)+parseInt(_0x459b18(0xde))/0x7+-parseInt(_0x459b18(0x1a0))/0x8+parseInt(_0x459b18(0x186))/0x9;if(_0x5bc840===_0x5b2e0c)break;else _0x5a805b['push'](_0x5a805b['shift']());}catch(_0x26f15c){_0x5a805b['push'](_0x5a805b['shift']());}}}(a0_0x4a69,0xe7558));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_0xe0f2b2 from'fs/promises';import a0_0x25d93e from'path';import a0_0xd76319 from'os';import{z}from'zod';function a0_0x4a69(){const _0x2eb87d=['stat','unknown\x20error','Cargo.toml','commitHash','Search\x20failed:\x20','completed','stringify','branch','Repository\x20identifier','TimeoutError','all','length','Natural\x20language\x20query\x20to\x20search\x20for\x20code','dryRun','morph-warp-grep-v1-1111v0','post','morph-v3-fast','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','ENOENT','catch','edit_file','mcp-filesystem','content','name','isArray','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','terminationReason','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Error:\x20','Bearer\x20','composer.json','repeat','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','Found\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','homedir','stack','\x22>\x0aError\x20reading\x20file:\x20','map','\x20results\x20in\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','join','\x0a...\x20(truncated,\x20total:\x20','morph-mcp','code_edit','application/json','1075266yTIpOA','UnknownError','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','inputSchema','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','params','roots','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','finish','includes','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','toFixed','error','\x27\x20in\x20`','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','Warning:\x20','access','Morph\x20FastApply\x20failed\x20without\x20error\x20message','\x20is\x20not\x20a\x20directory','Here\x20is\x20the\x20content\x20of\x20files:\x0a','runWarpGrep_call','assistant','substring','pyproject.toml','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','7984224ISPIBt','utf-8','Failed\x20to\x20request\x20roots\x20from\x20client:','File\x20read\x20error:','Warning:\x20Workspace\x20fallback\x20failed:\x20','Rules:\x0a','ms:\x0a\x0a','<file\x20path=\x22','%\x20match)\x0a','getClientCapabilities','\x20-\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','safeParse','number','WORKSPACE_ROOT','Created\x20File','toLowerCase','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','query','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','PWD','\x20chars)','readFile','match','.cursor','rerankScore','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','metadata','object','etimedout','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','success','Max\x20results\x20to\x20return','1080632ttJGYB','describe','timed\x20out','filter','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','default','Error\x20accessing\x20directory\x20','🔍\x20Morph\x20Edit\x20Preview','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','push','instruction','codebase_search','7415968wrMqqO','searchTimeMs','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','ENABLED_TOOLS','filepath','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Enabled\x20tools:\x20','lines','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','listRoots','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','split','repoId','udiff','-\x20Grepped\x20\x27','list_directory\x20','constructor','go.mod','cwd','false','normalize','❌\x20Morph\x20Edit\x20Failed:\x20','created','floor','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','toISOString','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','1575678Nxfxqe','sep','Unknown\x20error','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','description','messages','dirname','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','WarpGrepError','read\x20','exit','optional','-\x20Read\x20file\x20`','basename','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Preview\x20changes\x20without\x20applying\x20them.','[could\x20not\x20read\x20file:\x20','Morph\x20Edit\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','trim','0.2.0','Error\x20running\x20fast\x20context\x20search:\x20','role','\x20\x20\x20Lines\x20','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','completed_with_file_errors','warpgrep_codebase_search','stats','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','17682eYucSc','1061505QXBYgG','9Xhupxu','Use\x20dryRun=false\x20to\x20','create\x20this\x20file','every','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Relevant\x20context\x20found:','terminated','Invalid\x20arguments:\x20','realpath','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','\x20\x20\x20','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','search_string','slice','applied\x20edits\x20to','apply\x20these\x20changes','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','unknown','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','endLine','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','data','Benefits:\x0a','repo_path','Applied','source','env','text','files','oninitialized','string','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','morph-','message','path','package.json','\x20as\x20allowed\x20directory','argv','diff\x0a','https://morphllm.com/api/error-report','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','results','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','resolve','390XXzwMv','startsWith','setRequestHandler','errors','MORPH_API_KEY','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','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Successfully\x20','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','requiresApiKey','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.','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','No\x20results\x20found\x20for\x20query:\x20\x22','Specific\x20commit\x20hash\x20to\x20search'];a0_0x4a69=function(){return _0x2eb87d;};return a0_0x4a69();}import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x2a8f43 from'axios';function fixPathRepetition(_0x423a0c){const _0x31821e=a0_0x547b,_0x3daaf2=_0x423a0c[_0x31821e(0xe9)](a0_0x25d93e[_0x31821e(0xfb)])[_0x31821e(0xd5)](Boolean);if(_0x3daaf2[_0x31821e(0x162)]<0x2)return null;for(let _0x4172f7=Math[_0x31821e(0xf5)](_0x3daaf2[_0x31821e(0x162)]/0x2);_0x4172f7>=0x1;_0x4172f7--){for(let _0x1a6058=0x0;_0x1a6058<=_0x3daaf2[_0x31821e(0x162)]-0x2*_0x4172f7;_0x1a6058++){const _0x547455=_0x3daaf2[_0x31821e(0x129)](_0x1a6058,_0x1a6058+_0x4172f7),_0x387b33=_0x3daaf2[_0x31821e(0x129)](_0x1a6058+_0x4172f7,_0x1a6058+0x2*_0x4172f7);if(_0x547455[_0x31821e(0x11e)]((_0x5caab7,_0x3ff61d)=>_0x5caab7===_0x387b33[_0x3ff61d])){const _0x20d70e=[..._0x3daaf2['slice'](0x0,_0x1a6058),..._0x3daaf2[_0x31821e(0x129)](_0x1a6058+_0x4172f7)];return a0_0x25d93e[_0x31821e(0xfb)]+_0x20d70e[_0x31821e(0x181)](a0_0x25d93e[_0x31821e(0xfb)]);}}}return null;}const args=process[a0_0x4a28af(0x142)][a0_0x4a28af(0x129)](0x2),ALL_TOOLS=['edit_file',a0_0x4a28af(0x116),'codebase_search'],DEFAULT_TOOLS=[a0_0x4a28af(0x16b),a0_0x4a28af(0x116)],ENABLED_TOOLS=process[a0_0x4a28af(0x137)][a0_0x4a28af(0xe1)]?process[a0_0x4a28af(0x137)][a0_0x4a28af(0xe1)]===a0_0x4a28af(0x161)?ALL_TOOLS:process[a0_0x4a28af(0x137)][a0_0x4a28af(0xe1)][a0_0x4a28af(0xe9)](',')[a0_0x4a28af(0x17e)](_0x33772b=>_0x33772b[a0_0x4a28af(0x10f)]()):DEFAULT_TOOLS;function a0_0x547b(_0x3c1985,_0x31b884){_0x3c1985=_0x3c1985-0xc2;const _0x4a695e=a0_0x4a69();let _0x547beb=_0x4a695e[_0x3c1985];return _0x547beb;}console[a0_0x4a28af(0x193)](a0_0x4a28af(0xe4)+ENABLED_TOOLS[a0_0x4a28af(0x181)](',\x20'));const WORKSPACE_ROOT=process[a0_0x4a28af(0x137)][a0_0x4a28af(0x1ae)]||process['env'][a0_0x4a28af(0xc4)]||process[a0_0x4a28af(0xf0)](),ENABLE_WORKSPACE_MODE=process['env']['ENABLE_WORKSPACE_MODE']!==a0_0x4a28af(0xf1),MORPH_API_KEY=process[a0_0x4a28af(0x137)][a0_0x4a28af(0x14d)],MORPH_API_URL=process[a0_0x4a28af(0x137)]['MORPH_API_URL'];MORPH_API_KEY&&!MORPH_API_KEY[a0_0x4a28af(0x14a)]('sk-')&&!MORPH_API_KEY[a0_0x4a28af(0x14a)](a0_0x4a28af(0x13d))&&console[a0_0x4a28af(0x193)](a0_0x4a28af(0x127));async function reportMorphError(_0x3eb18e){const _0x98fcd9=a0_0x4a28af;try{await a0_0x2a8f43[_0x98fcd9(0x166)](_0x98fcd9(0x144),{..._0x3eb18e,'timestamp':new Date()[_0x98fcd9(0xf8)](),'source':_0x3eb18e[_0x98fcd9(0x136)]||_0x98fcd9(0x16c)},{'timeout':0x1388,'headers':{'Content-Type':_0x98fcd9(0x185),'Authorization':_0x98fcd9(0x174)+MORPH_API_KEY}});}catch{}}args[a0_0x4a28af(0x162)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x4a28af(0x193)](a0_0x4a28af(0x180)),console['error'](a0_0x4a28af(0x147)),console['error'](a0_0x4a28af(0x179)),console[a0_0x4a28af(0x193)](a0_0x4a28af(0xfd)),console[a0_0x4a28af(0x193)](a0_0x4a28af(0x1b2)),console[a0_0x4a28af(0x193)](a0_0x4a28af(0x154)));function normalizePath(_0x21bda2){const _0x1cf940=a0_0x4a28af;return a0_0x25d93e[_0x1cf940(0xf2)](_0x21bda2);}function expandHome(_0x17ed67){const _0x17e62d=a0_0x4a28af;if(_0x17ed67[_0x17e62d(0x14a)]('~/')||_0x17ed67==='~')return a0_0x25d93e['join'](a0_0xd76319[_0x17e62d(0x17b)](),_0x17ed67['slice'](0x1));return _0x17ed67;}let allowedDirectories=await Promise[a0_0x4a28af(0x161)](args[a0_0x4a28af(0x17e)](async _0x1d1571=>{const _0xd98c9d=a0_0x4a28af,_0xeedcf4=expandHome(_0x1d1571),_0x388ed5=a0_0x25d93e[_0xd98c9d(0x148)](_0xeedcf4);try{const _0x1d295f=await a0_0xe0f2b2[_0xd98c9d(0x123)](_0x388ed5);return normalizePath(_0x1d295f);}catch(_0x30303d){return normalizePath(_0x388ed5);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4a28af(0x162)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console[a0_0x4a28af(0x193)]('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x4a28af(0x141)));}catch(a0_0x163ced){console[a0_0x4a28af(0x193)](a0_0x4a28af(0x124)+a0_0x163ced);}async function detectWorkspaceRoot(_0x2e7877){const _0x14ddd7=a0_0x4a28af;let _0x4a2273=a0_0x25d93e[_0x14ddd7(0x148)](_0x2e7877);const _0x35c80e=['.git','.vscode',_0x14ddd7(0x140),_0x14ddd7(0x159),_0x14ddd7(0x19e),_0x14ddd7(0xef),_0x14ddd7(0xc8),'tsconfig.json',_0x14ddd7(0x175)];while(_0x4a2273!==a0_0x25d93e['dirname'](_0x4a2273)){for(const _0x5f4e0c of _0x35c80e){const _0xbd2bc1=a0_0x25d93e[_0x14ddd7(0x181)](_0x4a2273,_0x5f4e0c);try{return await a0_0xe0f2b2[_0x14ddd7(0x197)](_0xbd2bc1),normalizePath(_0x4a2273);}catch{}}_0x4a2273=a0_0x25d93e[_0x14ddd7(0x100)](_0x4a2273);}return normalizePath(_0x2e7877);}await Promise[a0_0x4a28af(0x161)](args[a0_0x4a28af(0x17e)](async _0x1dff2d=>{const _0x3e1dd3=a0_0x4a28af;try{const _0x4fc8fb=await a0_0xe0f2b2[_0x3e1dd3(0x157)](expandHome(_0x1dff2d));!_0x4fc8fb['isDirectory']()&&(console['error'](_0x3e1dd3(0x173)+_0x1dff2d+_0x3e1dd3(0x199)),process['exit'](0x1));}catch(_0x13a20e){console[_0x3e1dd3(0x193)](_0x3e1dd3(0xd8)+_0x1dff2d+':',_0x13a20e),process[_0x3e1dd3(0x104)](0x1);}}));async function validatePath(_0x4a4f37){const _0x30e317=a0_0x4a28af,_0x546ed3=expandHome(_0x4a4f37),_0xb347f7=a0_0x25d93e[_0x30e317(0x148)](_0x546ed3);try{const _0x549d94=await a0_0xe0f2b2['realpath'](_0xb347f7);return _0x549d94;}catch(_0x22b6d5){if(_0x22b6d5['code']===_0x30e317(0x169)){const _0x20a898=a0_0x25d93e['dirname'](_0xb347f7);try{const _0x4b4a5e=await a0_0xe0f2b2[_0x30e317(0x123)](_0x20a898);return a0_0x25d93e[_0x30e317(0x181)](_0x4b4a5e,a0_0x25d93e[_0x30e317(0x107)](_0xb347f7));}catch{throw new Error(_0x30e317(0x125)+_0x20a898);}}throw _0x22b6d5;}}const MorphEditFileArgsSchema=z[a0_0x4a28af(0xcd)]({'path':z[a0_0x4a28af(0x13b)](),'code_edit':z['string']()[a0_0x4a28af(0xd3)](a0_0x4a28af(0x12e)),'instruction':z[a0_0x4a28af(0x13b)]()[a0_0x4a28af(0xd3)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z['boolean']()['default'](![])[a0_0x4a28af(0xd3)](a0_0x4a28af(0x10b))}),WarpGrepArgsSchema=z[a0_0x4a28af(0xcd)]({'search_string':z['string']()[a0_0x4a28af(0xd3)](a0_0x4a28af(0x109)),'repo_path':z['string']()[a0_0x4a28af(0xd3)](a0_0x4a28af(0x14e))}),CodebaseSearchArgsSchema=z[a0_0x4a28af(0xcd)]({'query':z['string']()[a0_0x4a28af(0xd3)](a0_0x4a28af(0x163)),'repoId':z[a0_0x4a28af(0x13b)]()[a0_0x4a28af(0xd3)](a0_0x4a28af(0x15f)),'branch':z[a0_0x4a28af(0x13b)]()[a0_0x4a28af(0x105)]()['describe'](a0_0x4a28af(0x131)),'commitHash':z[a0_0x4a28af(0x13b)]()[a0_0x4a28af(0x105)]()[a0_0x4a28af(0xd3)](a0_0x4a28af(0x156)),'target_directories':z['array'](z[a0_0x4a28af(0x13b)]())[a0_0x4a28af(0xd7)]([])[a0_0x4a28af(0xd3)](a0_0x4a28af(0x118)),'limit':z[a0_0x4a28af(0x1ad)]()[a0_0x4a28af(0x105)]()[a0_0x4a28af(0xd7)](0xa)[a0_0x4a28af(0xd3)](a0_0x4a28af(0xd1))}),server=new Server({'name':a0_0x4a28af(0x183),'version':a0_0x4a28af(0x110)},{'capabilities':{'tools':{}}});server[a0_0x4a28af(0x14b)](ListToolsRequestSchema,async()=>{const _0x1c70df=a0_0x4a28af,_0x3a5314=[{'name':_0x1c70df(0x16b),'description':_0x1c70df(0x114)+_0x1c70df(0x168)+_0x1c70df(0xc3)+_0x1c70df(0x191)+_0x1c70df(0x133)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x1c70df(0x190)+_0x1c70df(0x1ab)+_0x1c70df(0xcf)+_0x1c70df(0x151)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+'For\x20deletions:\x0a'+_0x1c70df(0xcb)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x1c70df(0x1a5)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x1c70df(0x11f)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x1c70df(0xf7)+_0x1c70df(0x145)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x1c70df(0x13c),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x1c70df(0x12c)+_0x1c70df(0xe0)+_0x1c70df(0x177)+_0x1c70df(0x130)+_0x1c70df(0xda)+_0x1c70df(0xe6)+_0x1c70df(0x195)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x1c70df(0xdd),'description':_0x1c70df(0x17a)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x1c70df(0xd6)+_0x1c70df(0x133)+_0x1c70df(0x101)+_0x1c70df(0x18a)+_0x1c70df(0x108)+_0x1c70df(0xf6)+_0x1c70df(0xe8)+_0x1c70df(0x1b1)+_0x1c70df(0x19f),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0xe53acf=_0x3a5314['filter'](_0x50b5bf=>{const _0x5cdbe3=_0x1c70df;if(!ENABLED_TOOLS[_0x5cdbe3(0x18f)](_0x50b5bf[_0x5cdbe3(0x16e)]))return![];if(_0x5cdbe3(0x152)in _0x50b5bf&&_0x50b5bf[_0x5cdbe3(0x152)]&&!MORPH_API_KEY)return console[_0x5cdbe3(0x193)]('Warning:\x20'+_0x50b5bf[_0x5cdbe3(0x16e)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0xe53acf[_0x1c70df(0x17e)](_0x371dd2=>({'name':_0x371dd2[_0x1c70df(0x16e)],'description':_0x371dd2[_0x1c70df(0xfe)],'inputSchema':_0x371dd2[_0x1c70df(0x189)]}))};}),server[a0_0x4a28af(0x14b)](CallToolRequestSchema,async _0x4b14aa=>{const _0x525ad4=a0_0x4a28af;try{const {name:_0x4944f5,arguments:_0x490167}=_0x4b14aa[_0x525ad4(0x18b)];switch(_0x4944f5){case _0x525ad4(0x16b):{const _0x2393d8=MorphEditFileArgsSchema[_0x525ad4(0x1ac)](_0x490167);if(!_0x2393d8[_0x525ad4(0xd0)])throw new Error(_0x525ad4(0x14f)+_0x2393d8[_0x525ad4(0x193)]);const _0xc3096f=await validatePath(_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x13f)]);let _0x15bab4=null,_0x4114a5=!![],_0xacfe7e=null;try{_0x15bab4=await a0_0xe0f2b2[_0x525ad4(0xc6)](_0xc3096f,_0x525ad4(0x1a1));}catch(_0x35b0a0){const _0x31282e=_0x35b0a0['code'];_0x31282e===_0x525ad4(0x169)?(_0x4114a5=![],_0x15bab4=''):(_0xacfe7e='Failed\x20to\x20read\x20file:\x20'+(_0x31282e||_0x525ad4(0x12d))+_0x525ad4(0x1aa)+(_0x35b0a0 instanceof Error?_0x35b0a0[_0x525ad4(0x13e)]:String(_0x35b0a0)),console[_0x525ad4(0x193)](_0x525ad4(0x196)+_0xacfe7e));}try{const _0x15109e=MORPH_API_KEY;if(!_0x15109e)throw new Error(_0x525ad4(0x10a));const _0x42cd13=a0_0x25d93e[_0x525ad4(0x100)](_0xc3096f),_0x3ad516=a0_0x25d93e['basename'](_0xc3096f),_0x1ef4a7=await executeEditFile({'target_filepath':_0x3ad516,'code_edit':_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x184)],'instructions':_0x2393d8[_0x525ad4(0x132)]['instruction']},{'morphApiKey':_0x15109e,'morphApiUrl':MORPH_API_URL,'baseDir':_0x42cd13,'autoWrite':!_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x164)],'generateUdiff':!![],'debug':![]});if(!_0x1ef4a7[_0x525ad4(0xd0)])throw new Error(_0x1ef4a7['error']||_0x525ad4(0x198));const _0x38cd2e=_0x1ef4a7[_0x525ad4(0xeb)]||'';let _0x1de086=0x3;while(_0x38cd2e[_0x525ad4(0x18f)]('`'[_0x525ad4(0x176)](_0x1de086))){_0x1de086++;}const _0x297d99='`'['repeat'](_0x1de086)+_0x525ad4(0x143)+_0x38cd2e+'`'['repeat'](_0x1de086)+'\x0a\x0a';if(_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x164)])return{'content':[{'type':_0x525ad4(0x138),'text':_0x525ad4(0xd9)+(_0x4114a5?'':'\x20(new\x20file)')+':\x20'+_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0xdc)]+'\x0a\x0a'+_0x297d99+_0x525ad4(0x11c)+(_0x4114a5?_0x525ad4(0x12b):_0x525ad4(0x11d))+'.'}]};return{'content':[{'type':'text','text':_0x525ad4(0x10d)+(_0x4114a5?_0x525ad4(0x135):_0x525ad4(0x1af))+':\x20'+_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0xdc)]+'\x0a\x0a'+_0x297d99+_0x525ad4(0x150)+(_0x4114a5?_0x525ad4(0x12a):_0x525ad4(0xf4))+'\x20'+_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x13f)]}]};}catch(_0x3949ce){const _0x1898f9=_0x3949ce instanceof Error?_0x3949ce['message']:String(_0x3949ce);return reportMorphError({'error_message':_0x1898f9,'error_type':_0x3949ce instanceof Error?_0x3949ce[_0x525ad4(0xee)][_0x525ad4(0x16e)]:_0x525ad4(0x187),'context':{'tool':'edit_file','file_path':_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x13f)],'validated_path':_0xc3096f,'instruction':_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0xdc)],'model':_0x525ad4(0x167),'dry_run':_0x2393d8['data'][_0x525ad4(0x164)],'file_exists':_0x4114a5,'file_read_error':_0xacfe7e,'file_readable':_0x15bab4!==null,'request_content':{'path':_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x13f)],'code_edit':_0x2393d8['data'][_0x525ad4(0x184)],'instruction':_0x2393d8[_0x525ad4(0x132)]['instruction'],'original_code':_0x15bab4!==null?_0x15bab4[_0x525ad4(0x162)]>0xc350?_0x15bab4[_0x525ad4(0x19d)](0x0,0xc350)+_0x525ad4(0x182)+_0x15bab4[_0x525ad4(0x162)]+_0x525ad4(0xc5):_0x15bab4:_0x525ad4(0x10c)+(_0xacfe7e||_0x525ad4(0x158))+']','original_code_length':_0x15bab4?.['length']??0x0,'model':'morph-v3-fast','dry_run':_0x2393d8[_0x525ad4(0x132)][_0x525ad4(0x164)]}},'stack_trace':_0x3949ce instanceof Error?_0x3949ce[_0x525ad4(0x17c)]:undefined,'source':_0x525ad4(0x16c)})[_0x525ad4(0x16a)](()=>{}),{'content':[{'type':'text','text':_0x525ad4(0xf3)+_0x1898f9}],'isError':!![]};}}case _0x525ad4(0x116):{const _0xf32fe3=WarpGrepArgsSchema['safeParse'](_0x490167);if(!_0xf32fe3[_0x525ad4(0xd0)])return{'content':[{'type':_0x525ad4(0x138),'text':'Invalid\x20arguments:\x20'+_0xf32fe3[_0x525ad4(0x193)]}],'isError':!![]};const _0xc83d1b=_0x2652c8=>{const _0x32867e=_0x525ad4,_0x1966f7=[];for(const _0x134480 of _0x2652c8||[]){const _0x150e0f=_0x134480['role'],_0x32a21f=_0x134480['content'];if(_0x150e0f===_0x32867e(0x19c)&&_0x32a21f){const _0x30fb0f=_0x32a21f[_0x32867e(0xe9)]('\x0a')['filter'](_0x14e695=>_0x14e695[_0x32867e(0x10f)]());for(const _0x19e254 of _0x30fb0f){const _0xb3b3bf=_0x19e254[_0x32867e(0xc7)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0xb3b3bf){_0x1966f7[_0x32867e(0xdb)]('grep\x20\x27'+_0xb3b3bf[0x1]+'\x27\x20'+_0xb3b3bf[0x2]);continue;}const _0x28081d=_0x19e254[_0x32867e(0xc7)](/^read\s+(.+)$/);if(_0x28081d){_0x1966f7['push'](_0x32867e(0x103)+_0x28081d[0x1]);continue;}const _0x4d63e1=_0x19e254[_0x32867e(0xc7)](/^list_directory\s+(.+)$/);if(_0x4d63e1){_0x1966f7[_0x32867e(0xdb)](_0x32867e(0xed)+_0x4d63e1[0x1]);continue;}}}}return _0x1966f7;};try{const _0x1b430a=a0_0x25d93e['resolve'](_0xf32fe3[_0x525ad4(0x132)]['repo_path']),_0x3c3540=new LocalRipgrepProvider(_0x1b430a),_0x285599=await runWarpGrep({'query':_0xf32fe3[_0x525ad4(0x132)]['search_string'],'repoRoot':_0x1b430a,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'provider':_0x3c3540});let _0x525cdd='';if(_0x285599[_0x525ad4(0x171)]===_0x525ad4(0x15c)&&_0x285599['finish']?.[_0x525ad4(0xcc)]?.[_0x525ad4(0x139)]){const _0x2b74c7=_0x285599['finish']['metadata']['files'],_0x8816c0=[],_0x293e6f=[_0x525ad4(0xca)];for(const _0x13fd80 of _0x285599[_0x525ad4(0xff)]){const _0x17c713=_0x13fd80[_0x525ad4(0x112)],_0x494863=_0x13fd80[_0x525ad4(0x16d)];if(_0x17c713===_0x525ad4(0x19c)&&_0x494863){const _0x5667f7=_0x494863['split']('\x0a')[_0x525ad4(0xd5)](_0x2e1f57=>_0x2e1f57[_0x525ad4(0x10f)]());for(const _0x1d4878 of _0x5667f7){const _0x41000c=_0x1d4878['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x41000c){_0x293e6f[_0x525ad4(0xdb)](_0x525ad4(0xec)+_0x41000c[0x1]+_0x525ad4(0x194)+_0x41000c[0x2]+'`');continue;}const _0x17f900=_0x1d4878[_0x525ad4(0xc7)](/^read\s+(.+)$/);if(_0x17f900){_0x293e6f[_0x525ad4(0xdb)](_0x525ad4(0x106)+_0x17f900[0x1]+'`');continue;}const _0x403832=_0x1d4878[_0x525ad4(0xc7)](/^list_directory\s+(.+)$/);if(_0x403832){_0x293e6f[_0x525ad4(0xdb)]('-\x20Listed\x20directory\x20`'+_0x403832[0x1]+'`');continue;}}}}_0x8816c0['push'](_0x293e6f['join']('\x0a'));const _0x4ad5f2=['',_0x525ad4(0x120)];for(const _0x2b3b4e of _0x2b74c7){if(_0x2b3b4e[_0x525ad4(0xe5)]==='*')_0x4ad5f2[_0x525ad4(0xdb)]('-\x20'+_0x2b3b4e[_0x525ad4(0x13f)]+':*');else{if(Array[_0x525ad4(0x16f)](_0x2b3b4e[_0x525ad4(0xe5)])){const _0x5924ab=_0x2b3b4e['lines'][_0x525ad4(0x17e)](([_0x2d0ecd,_0x2e7e5e])=>{if(_0x2d0ecd===_0x2e7e5e)return''+_0x2d0ecd;return _0x2d0ecd+'-'+_0x2e7e5e;});_0x4ad5f2[_0x525ad4(0xdb)]('-\x20'+_0x2b3b4e[_0x525ad4(0x13f)]+':'+_0x5924ab[_0x525ad4(0x181)](','));}else _0x4ad5f2[_0x525ad4(0xdb)]('-\x20'+_0x2b3b4e[_0x525ad4(0x13f)]+':*');}}_0x4ad5f2['push'](''),_0x8816c0[_0x525ad4(0xdb)](_0x4ad5f2[_0x525ad4(0x181)]('\x0a')),_0x8816c0[_0x525ad4(0xdb)](_0x525ad4(0x19a));const _0x4b42d9=[];for(const _0x3a0e5c of _0x2b74c7){let _0x47cd2c=a0_0x25d93e[_0x525ad4(0x148)](_0xf32fe3['data']['repo_path'],_0x3a0e5c[_0x525ad4(0x13f)]),_0x582f50=null,_0x13fe05=null;try{_0x582f50=await a0_0xe0f2b2[_0x525ad4(0xc6)](_0x47cd2c,{'encoding':_0x525ad4(0x1a1)});}catch(_0x33c4ff){const _0x2b132b=fixPathRepetition(_0x47cd2c);if(_0x2b132b)try{_0x582f50=await a0_0xe0f2b2['readFile'](_0x2b132b,{'encoding':'utf-8'}),_0x47cd2c=_0x2b132b;}catch{_0x13fe05=_0x33c4ff instanceof Error?_0x33c4ff:new Error(String(_0x33c4ff));}else _0x13fe05=_0x33c4ff instanceof Error?_0x33c4ff:new Error(String(_0x33c4ff));}if(_0x582f50!==null){const _0x28b24a=_0x582f50[_0x525ad4(0xe9)](/\r?\n/),_0x224ecb=[_0x525ad4(0x1a7)+_0x3a0e5c[_0x525ad4(0x13f)]+'\x22>'];if(_0x3a0e5c['lines']==='*'||!Array[_0x525ad4(0x16f)](_0x3a0e5c[_0x525ad4(0xe5)]))for(let _0x45b69f=0x1;_0x45b69f<=_0x28b24a[_0x525ad4(0x162)];_0x45b69f++){const _0x52c2cf=_0x28b24a[_0x45b69f-0x1];_0x224ecb[_0x525ad4(0xdb)](_0x45b69f+'|\x20'+_0x52c2cf);}else for(const [_0x420a54,_0x33f2c7]of _0x3a0e5c[_0x525ad4(0xe5)]){_0x224ecb['length']>0x1&&_0x224ecb[_0x525ad4(0xdb)]('');for(let _0x1d99a7=_0x420a54;_0x1d99a7<=_0x33f2c7&&_0x1d99a7<=_0x28b24a[_0x525ad4(0x162)];_0x1d99a7++){const _0x367f5c=_0x28b24a[_0x1d99a7-0x1];_0x224ecb[_0x525ad4(0xdb)](_0x1d99a7+'|\x20'+_0x367f5c);}}_0x224ecb['push']('</file>'),_0x4b42d9['push'](_0x224ecb['join']('\x0a'));}else _0x4b42d9['push'](_0x525ad4(0x1a7)+_0x3a0e5c[_0x525ad4(0x13f)]+_0x525ad4(0x17d)+(_0x13fe05?.[_0x525ad4(0x13e)]||_0x525ad4(0xfc))+'\x0a</file>');}_0x8816c0[_0x525ad4(0xdb)](_0x4b42d9['join']('\x0a\x0a')),_0x525cdd=_0x8816c0[_0x525ad4(0x181)]('\x0a');const _0x3ae5b1=_0x285599[_0x525ad4(0x14c)]?.['filter'](_0x2feee0=>_0x2feee0[_0x525ad4(0x13e)]?.['startsWith'](_0x525ad4(0x1a3)))||[];if(_0x3ae5b1[_0x525ad4(0x162)]>0x0){const _0x1b5531=_0x3ae5b1[_0x525ad4(0x17e)](_0xb10e88=>_0xb10e88[_0x525ad4(0x13e)])[_0x525ad4(0x181)](';\x20');reportMorphError({'error_message':_0x1b5531,'error_type':'FileReadError','context':{'tool':_0x525ad4(0x116),'repo_path':_0xf32fe3['data']['repo_path'],'query':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x128)],'model':_0x525ad4(0x165),'termination_reason':_0x525ad4(0x115),'error_count':_0x3ae5b1[_0x525ad4(0x162)],'is_timeout':![],'files_attempted':_0x2b74c7[_0x525ad4(0x17e)](_0x413278=>({'path':_0x413278['path'],'lines':_0x413278[_0x525ad4(0xe5)]})),'tool_calls':_0xc83d1b(_0x285599[_0x525ad4(0xff)]),'messages':_0x285599['messages']?.['map'](_0x2d6b86=>({'role':_0x2d6b86[_0x525ad4(0x112)],'content':_0x2d6b86[_0x525ad4(0x16d)]})),'request_content':{'query':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x128)],'repo_path':_0xf32fe3['data'][_0x525ad4(0x134)],'repoRoot':a0_0x25d93e['resolve'](_0xf32fe3[_0x525ad4(0x132)]['repo_path']),'model':_0x525ad4(0x165)}},'source':_0x525ad4(0x16c)})[_0x525ad4(0x16a)](()=>{});}}else{if(_0x285599[_0x525ad4(0x171)]===_0x525ad4(0x121)&&_0x285599[_0x525ad4(0x14c)][_0x525ad4(0x162)]>0x0){const _0x42642e=_0x285599[_0x525ad4(0x14c)][_0x525ad4(0x17e)](_0x23fc28=>_0x23fc28[_0x525ad4(0x13e)])[_0x525ad4(0x181)](';\x20');_0x525cdd=_0x525ad4(0x173)+_0x42642e;const _0xd16d90=_0x42642e[_0x525ad4(0x1b0)]()[_0x525ad4(0x18f)]('timeout')||_0x42642e[_0x525ad4(0x1b0)]()[_0x525ad4(0x18f)]('timed\x20out')||_0x42642e[_0x525ad4(0x1b0)]()['includes']('etimedout'),_0x116c6b=_0x285599[_0x525ad4(0x18e)]?.[_0x525ad4(0xcc)]?.['files'],_0x344c1f=_0x285599[_0x525ad4(0x14c)][0x0];reportMorphError({'error_message':_0x42642e,'error_type':_0xd16d90?_0x525ad4(0x160):_0x344c1f?.[_0x525ad4(0xee)]?.[_0x525ad4(0x16e)]||_0x525ad4(0x102),'context':{'tool':_0x525ad4(0x116),'repo_path':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x134)],'query':_0xf32fe3[_0x525ad4(0x132)]['search_string'],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x285599[_0x525ad4(0x171)],'error_count':_0x285599[_0x525ad4(0x14c)][_0x525ad4(0x162)],'is_timeout':_0xd16d90,'files_attempted':_0x116c6b?.[_0x525ad4(0x17e)](_0x1bff3b=>({'path':_0x1bff3b[_0x525ad4(0x13f)],'lines':_0x1bff3b['lines']})),'tool_calls':_0xc83d1b(_0x285599[_0x525ad4(0xff)]),'messages':_0x285599[_0x525ad4(0xff)]?.['map'](_0x3d2e82=>({'role':_0x3d2e82[_0x525ad4(0x112)],'content':_0x3d2e82[_0x525ad4(0x16d)]})),'request_content':{'query':_0xf32fe3['data']['search_string'],'repo_path':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x134)],'repoRoot':a0_0x25d93e[_0x525ad4(0x148)](_0xf32fe3['data']['repo_path']),'model':_0x525ad4(0x165)}},'stack_trace':_0x344c1f?.[_0x525ad4(0x17c)]||undefined,'source':_0x525ad4(0x16c)})[_0x525ad4(0x16a)](()=>{});}else _0x525cdd='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x525cdd}]};}catch(_0x392b45){const _0x4654eb=_0x392b45 instanceof Error?_0x392b45['message']:String(_0x392b45),_0x484e20=_0x4654eb['toLowerCase']()[_0x525ad4(0x18f)]('timeout')||_0x4654eb['toLowerCase']()['includes'](_0x525ad4(0xd4))||_0x4654eb[_0x525ad4(0x1b0)]()['includes'](_0x525ad4(0xce))||_0x392b45 instanceof Error&&_0x392b45[_0x525ad4(0x16e)]===_0x525ad4(0x160);return reportMorphError({'error_message':_0x4654eb,'error_type':_0x484e20?_0x525ad4(0x160):_0x392b45 instanceof Error?_0x392b45[_0x525ad4(0xee)][_0x525ad4(0x16e)]:_0x525ad4(0x187),'context':{'tool':'warpgrep_codebase_search','repo_path':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x134)],'query':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x128)],'model':_0x525ad4(0x165),'is_timeout':_0x484e20,'exception_phase':_0x525ad4(0x19b),'request_content':{'query':_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x128)],'repo_path':_0xf32fe3[_0x525ad4(0x132)]['repo_path'],'repoRoot':a0_0x25d93e['resolve'](_0xf32fe3[_0x525ad4(0x132)][_0x525ad4(0x134)]),'model':_0x525ad4(0x165)}},'stack_trace':_0x392b45 instanceof Error?_0x392b45[_0x525ad4(0x17c)]:undefined,'source':'mcp-filesystem'})[_0x525ad4(0x16a)](()=>{}),{'content':[{'type':_0x525ad4(0x138),'text':_0x525ad4(0x111)+_0x4654eb}],'isError':![]};}}case _0x525ad4(0xdd):{const _0x1ac9cb=CodebaseSearchArgsSchema['safeParse'](_0x490167);if(!_0x1ac9cb[_0x525ad4(0xd0)])return{'content':[{'type':_0x525ad4(0x138),'text':_0x525ad4(0x122)+_0x1ac9cb[_0x525ad4(0x193)]}],'isError':!![]};try{const _0x6b92b6=MORPH_API_KEY;if(!_0x6b92b6)throw new Error(_0x525ad4(0x10e));const _0x2ef76a=await executeCodebaseSearch({'query':_0x1ac9cb[_0x525ad4(0x132)][_0x525ad4(0xc2)],'target_directories':_0x1ac9cb['data']['target_directories'],'limit':_0x1ac9cb[_0x525ad4(0x132)]['limit']},{'apiKey':_0x6b92b6,'repoId':_0x1ac9cb[_0x525ad4(0x132)][_0x525ad4(0xea)],'branch':_0x1ac9cb['data'][_0x525ad4(0x15e)],'commitHash':_0x1ac9cb[_0x525ad4(0x132)][_0x525ad4(0x15a)],'debug':![]});if(!_0x2ef76a[_0x525ad4(0xd0)])return{'content':[{'type':_0x525ad4(0x138),'text':_0x525ad4(0x15b)+_0x2ef76a[_0x525ad4(0x193)]}],'isError':!![]};const _0x3881f3=_0x2ef76a['results']['length']===0x0?_0x525ad4(0x155)+_0x1ac9cb['data'][_0x525ad4(0xc2)]+'\x22':_0x525ad4(0x178)+_0x2ef76a['results'][_0x525ad4(0x162)]+_0x525ad4(0x17f)+_0x2ef76a[_0x525ad4(0x117)][_0x525ad4(0xdf)]+_0x525ad4(0x1a6)+_0x2ef76a[_0x525ad4(0x146)][_0x525ad4(0x17e)]((_0x26435d,_0x2d5457)=>_0x2d5457+0x1+'.\x20'+_0x26435d[_0x525ad4(0xe2)]+'\x20('+(_0x26435d[_0x525ad4(0xc9)]*0x64)[_0x525ad4(0x192)](0x1)+_0x525ad4(0x1a8)+(_0x525ad4(0x113)+_0x26435d['startLine']+'-'+_0x26435d[_0x525ad4(0x12f)]+'\x0a')+(_0x525ad4(0x126)+_0x26435d[_0x525ad4(0x16d)][_0x525ad4(0x19d)](0x0,0xc8)+(_0x26435d[_0x525ad4(0x16d)]['length']>0xc8?'...':'')+'\x0a'))[_0x525ad4(0x181)]('\x0a');return{'content':[{'type':_0x525ad4(0x138),'text':_0x3881f3}]};}catch(_0x54be5e){const _0x3c3790=_0x54be5e instanceof Error?_0x54be5e[_0x525ad4(0x13e)]:String(_0x54be5e);return reportMorphError({'error_message':_0x3c3790,'error_type':_0x54be5e instanceof Error?_0x54be5e['constructor'][_0x525ad4(0x16e)]:'UnknownError','context':{'tool':_0x525ad4(0xdd),'query':_0x1ac9cb[_0x525ad4(0x132)][_0x525ad4(0xc2)],'repo_id':_0x1ac9cb[_0x525ad4(0x132)][_0x525ad4(0xea)]},'stack_trace':_0x54be5e instanceof Error?_0x54be5e['stack']:undefined,'source':_0x525ad4(0x16c)})['catch'](()=>{}),{'content':[{'type':_0x525ad4(0x138),'text':_0x525ad4(0x173)+_0x3c3790}],'isError':!![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x4944f5);}}catch(_0x86d5f8){const _0x5c6708=_0x86d5f8 instanceof Error?_0x86d5f8[_0x525ad4(0x13e)]:String(_0x86d5f8);return reportMorphError({'error_message':_0x5c6708,'error_type':_0x86d5f8 instanceof Error?_0x86d5f8[_0x525ad4(0xee)][_0x525ad4(0x16e)]:_0x525ad4(0x187),'context':{'tool':name,'arguments':args?JSON[_0x525ad4(0x15d)](args)[_0x525ad4(0x19d)](0x0,0x1f4):undefined,'mcp_server_version':_0x525ad4(0x110)},'stack_trace':_0x86d5f8 instanceof Error?_0x86d5f8[_0x525ad4(0x17c)]:undefined,'source':_0x525ad4(0x16c)})[_0x525ad4(0x16a)](()=>{}),{'content':[{'type':_0x525ad4(0x138),'text':'Error:\x20'+_0x5c6708}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x59730f){const _0x30aa3e=a0_0x4a28af,_0x21d192=await getValidRootDirectories(_0x59730f);if(_0x21d192[_0x30aa3e(0x162)]>0x0)allowedDirectories=[..._0x21d192],console[_0x30aa3e(0x193)](_0x30aa3e(0xe3)+_0x21d192[_0x30aa3e(0x162)]+'\x20valid\x20directories');else{console['error'](_0x30aa3e(0x188));if(ENABLE_WORKSPACE_MODE)try{const _0x3384da=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x3384da&&(allowedDirectories=[_0x3384da],console[_0x30aa3e(0x193)]('Fallback:\x20Using\x20workspace\x20root\x20'+_0x3384da));}catch(_0x5558e0){console[_0x30aa3e(0x193)](_0x30aa3e(0x1a4)+_0x5558e0);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x4279ca=a0_0x4a28af;try{const _0x45b097=await server[_0x4279ca(0xe7)]();_0x45b097&&_0x4279ca(0x18c)in _0x45b097&&await updateAllowedDirectoriesFromRoots(_0x45b097['roots']);}catch(_0x231d50){console[_0x4279ca(0x193)](_0x4279ca(0x1a2),_0x231d50 instanceof Error?_0x231d50[_0x4279ca(0x13e)]:String(_0x231d50));}}),server[a0_0x4a28af(0x13a)]=async()=>{const _0x3feaf7=a0_0x4a28af,_0x1ab49a=server[_0x3feaf7(0x1a9)]();if(_0x1ab49a?.['roots'])try{const _0x27f46a=await server[_0x3feaf7(0xe7)]();_0x27f46a&&'roots'in _0x27f46a?await updateAllowedDirectoriesFromRoots(_0x27f46a[_0x3feaf7(0x18c)]):console[_0x3feaf7(0x193)]('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x25864f){console[_0x3feaf7(0x193)](_0x3feaf7(0xf9),_0x25864f instanceof Error?_0x25864f[_0x3feaf7(0x13e)]:String(_0x25864f));}else{if(allowedDirectories['length']>0x0)console[_0x3feaf7(0x193)](_0x3feaf7(0x172),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x3feaf7(0x193)](_0x3feaf7(0x18d));else throw new Error(_0x3feaf7(0x153));}}};async function runServer(){const _0x3fca40=a0_0x4a28af,_0xb9b879=new StdioServerTransport();await server['connect'](_0xb9b879),console[_0x3fca40(0x193)]('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories['length']===0x0&&console['error'](_0x3fca40(0x170));}runServer()[a0_0x4a28af(0x16a)](_0x436bfb=>{console['error']('Fatal\x20error\x20running\x20server:',_0x436bfb),process['exit'](0x1);});
2
+ const a0_0x1e7825=a0_0x1f65;(function(_0x7445d4,_0xc7966f){const _0xbb25a8=a0_0x1f65,_0x4a7a53=_0x7445d4();while(!![]){try{const _0x3f36a4=-parseInt(_0xbb25a8(0x29b))/0x1+parseInt(_0xbb25a8(0x231))/0x2*(parseInt(_0xbb25a8(0x26e))/0x3)+parseInt(_0xbb25a8(0x2c2))/0x4*(parseInt(_0xbb25a8(0x2cc))/0x5)+-parseInt(_0xbb25a8(0x284))/0x6*(parseInt(_0xbb25a8(0x2a3))/0x7)+-parseInt(_0xbb25a8(0x286))/0x8*(-parseInt(_0xbb25a8(0x298))/0x9)+-parseInt(_0xbb25a8(0x271))/0xa+parseInt(_0xbb25a8(0x2c9))/0xb*(parseInt(_0xbb25a8(0x1ed))/0xc);if(_0x3f36a4===_0xc7966f)break;else _0x4a7a53['push'](_0x4a7a53['shift']());}catch(_0x561995){_0x4a7a53['push'](_0x4a7a53['shift']());}}}(a0_0x58c8,0x91f2f));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_0x132037 from'fs/promises';import a0_0x3887f6 from'path';import a0_0x311102 from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';function a0_0x1f65(_0xdc253a,_0x5b7652){_0xdc253a=_0xdc253a-0x1e2;const _0x58c890=a0_0x58c8();let _0x1f65dc=_0x58c890[_0xdc253a];return _0x1f65dc;}import a0_0x3d782c from'axios';function fixPathRepetition(_0x109c05){const _0x3efcc0=a0_0x1f65,_0x2a255c=_0x109c05[_0x3efcc0(0x228)](a0_0x3887f6[_0x3efcc0(0x2cf)])[_0x3efcc0(0x219)](Boolean);if(_0x2a255c[_0x3efcc0(0x261)]<0x2)return null;for(let _0x49dc10=Math[_0x3efcc0(0x1f0)](_0x2a255c[_0x3efcc0(0x261)]/0x2);_0x49dc10>=0x1;_0x49dc10--){for(let _0x1d16ff=0x0;_0x1d16ff<=_0x2a255c['length']-0x2*_0x49dc10;_0x1d16ff++){const _0x2fda44=_0x2a255c[_0x3efcc0(0x2d1)](_0x1d16ff,_0x1d16ff+_0x49dc10),_0x5f511a=_0x2a255c[_0x3efcc0(0x2d1)](_0x1d16ff+_0x49dc10,_0x1d16ff+0x2*_0x49dc10);if(_0x2fda44[_0x3efcc0(0x216)]((_0x225b45,_0x2c6e81)=>_0x225b45===_0x5f511a[_0x2c6e81])){const _0x2298eb=[..._0x2a255c[_0x3efcc0(0x2d1)](0x0,_0x1d16ff),..._0x2a255c[_0x3efcc0(0x2d1)](_0x1d16ff+_0x49dc10)];return a0_0x3887f6[_0x3efcc0(0x2cf)]+_0x2298eb[_0x3efcc0(0x264)](a0_0x3887f6[_0x3efcc0(0x2cf)]);}}}return null;}const args=process[a0_0x1e7825(0x225)][a0_0x1e7825(0x2d1)](0x2),ALL_TOOLS=['edit_file',a0_0x1e7825(0x299),a0_0x1e7825(0x218)],DEFAULT_TOOLS=[a0_0x1e7825(0x29a),a0_0x1e7825(0x299)],ENABLED_TOOLS=process['env'][a0_0x1e7825(0x20a)]?process['env']['ENABLED_TOOLS']===a0_0x1e7825(0x2a1)?ALL_TOOLS:process[a0_0x1e7825(0x1f7)][a0_0x1e7825(0x20a)][a0_0x1e7825(0x228)](',')[a0_0x1e7825(0x26d)](_0x15e3ac=>_0x15e3ac[a0_0x1e7825(0x257)]()):DEFAULT_TOOLS;console[a0_0x1e7825(0x250)](a0_0x1e7825(0x20b)+ENABLED_TOOLS[a0_0x1e7825(0x264)](',\x20'));const WORKSPACE_ROOT=process['env'][a0_0x1e7825(0x26c)]||process[a0_0x1e7825(0x1f7)][a0_0x1e7825(0x211)]||process[a0_0x1e7825(0x2c1)](),ENABLE_WORKSPACE_MODE=process[a0_0x1e7825(0x1f7)][a0_0x1e7825(0x254)]!=='false',MORPH_API_KEY=process[a0_0x1e7825(0x1f7)][a0_0x1e7825(0x1ec)],MORPH_API_URL=process[a0_0x1e7825(0x1f7)][a0_0x1e7825(0x21b)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x1e7825(0x1f7)][a0_0x1e7825(0x24f)]?parseInt(process['env'][a0_0x1e7825(0x24f)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x1e7825(0x1ef)]('sk-')&&!MORPH_API_KEY[a0_0x1e7825(0x1ef)](a0_0x1e7825(0x1f9))&&console[a0_0x1e7825(0x250)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x1a181e){const _0x50a5f8=a0_0x1e7825;try{await a0_0x3d782c['post'](_0x50a5f8(0x1f3),{..._0x1a181e,'timestamp':new Date()[_0x50a5f8(0x233)](),'source':_0x1a181e[_0x50a5f8(0x24c)]||_0x50a5f8(0x2da)},{'timeout':0x1388,'headers':{'Content-Type':_0x50a5f8(0x2c6),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x1e7825(0x261)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x1e7825(0x250)]('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),console['error'](a0_0x1e7825(0x229)),console[a0_0x1e7825(0x250)](a0_0x1e7825(0x23a)),console['error'](a0_0x1e7825(0x28c)),console[a0_0x1e7825(0x250)]('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console[a0_0x1e7825(0x250)]('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0xb4c0cf){const _0x508333=a0_0x1e7825;return a0_0x3887f6[_0x508333(0x1fa)](_0xb4c0cf);}function expandHome(_0x4fa5c3){const _0x244e4b=a0_0x1e7825;if(_0x4fa5c3['startsWith']('~/')||_0x4fa5c3==='~')return a0_0x3887f6[_0x244e4b(0x264)](a0_0x311102[_0x244e4b(0x20f)](),_0x4fa5c3[_0x244e4b(0x2d1)](0x1));return _0x4fa5c3;}let allowedDirectories=await Promise[a0_0x1e7825(0x2a1)](args['map'](async _0xb6b644=>{const _0x6695ff=a0_0x1e7825,_0x304b81=expandHome(_0xb6b644),_0x58ff18=a0_0x3887f6[_0x6695ff(0x2d6)](_0x304b81);try{const _0x5bce66=await a0_0x132037['realpath'](_0x58ff18);return normalizePath(_0x5bce66);}catch(_0x2f16b0){return normalizePath(_0x58ff18);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x1e7825(0x261)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x1e7825(0x23c)](workspaceDir),console[a0_0x1e7825(0x250)]('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x1e7825(0x25b)));}catch(a0_0x1e4b51){console[a0_0x1e7825(0x250)](a0_0x1e7825(0x28d)+a0_0x1e4b51);}async function detectWorkspaceRoot(_0x352d66){const _0x380dd2=a0_0x1e7825;let _0x1154bc=a0_0x3887f6[_0x380dd2(0x2d6)](_0x352d66);const _0x2bfa56=[_0x380dd2(0x217),_0x380dd2(0x281),_0x380dd2(0x2d8),_0x380dd2(0x1eb),_0x380dd2(0x2c0),_0x380dd2(0x268),_0x380dd2(0x27b),_0x380dd2(0x220),_0x380dd2(0x249)];while(_0x1154bc!==a0_0x3887f6['dirname'](_0x1154bc)){for(const _0x419fe8 of _0x2bfa56){const _0x3a66e0=a0_0x3887f6['join'](_0x1154bc,_0x419fe8);try{return await a0_0x132037['access'](_0x3a66e0),normalizePath(_0x1154bc);}catch{}}_0x1154bc=a0_0x3887f6['dirname'](_0x1154bc);}return normalizePath(_0x352d66);}await Promise['all'](args['map'](async _0x546209=>{const _0x4e5a24=a0_0x1e7825;try{const _0x329997=await a0_0x132037[_0x4e5a24(0x23e)](expandHome(_0x546209));!_0x329997[_0x4e5a24(0x1f2)]()&&(console[_0x4e5a24(0x250)](_0x4e5a24(0x2be)+_0x546209+_0x4e5a24(0x289)),process[_0x4e5a24(0x22b)](0x1));}catch(_0x2cc6ce){console['error'](_0x4e5a24(0x2aa)+_0x546209+':',_0x2cc6ce),process['exit'](0x1);}}));async function validatePath(_0x326eb6){const _0x303053=a0_0x1e7825,_0x56d4d5=expandHome(_0x326eb6),_0x157df8=a0_0x3887f6[_0x303053(0x2d6)](_0x56d4d5);try{const _0x34abb3=await a0_0x132037['realpath'](_0x157df8);return _0x34abb3;}catch(_0x44a35d){if(_0x44a35d[_0x303053(0x293)]===_0x303053(0x24d)){const _0x1448d2=a0_0x3887f6[_0x303053(0x212)](_0x157df8);try{const _0xd0dc38=await a0_0x132037[_0x303053(0x2cd)](_0x1448d2);return a0_0x3887f6[_0x303053(0x264)](_0xd0dc38,a0_0x3887f6[_0x303053(0x2ce)](_0x157df8));}catch{throw new Error(_0x303053(0x22a)+_0x1448d2);}}throw _0x44a35d;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x1e7825(0x260)](),'code_edit':z[a0_0x1e7825(0x260)]()[a0_0x1e7825(0x2a5)](a0_0x1e7825(0x25e)),'instruction':z[a0_0x1e7825(0x260)]()[a0_0x1e7825(0x2a5)](a0_0x1e7825(0x25f)),'dryRun':z['boolean']()[a0_0x1e7825(0x245)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x1e7825(0x260)]()[a0_0x1e7825(0x2a5)](a0_0x1e7825(0x272)),'repo_path':z[a0_0x1e7825(0x260)]()[a0_0x1e7825(0x2a5)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos')}),CodebaseSearchArgsSchema=z[a0_0x1e7825(0x224)]({'query':z[a0_0x1e7825(0x260)]()[a0_0x1e7825(0x2a5)](a0_0x1e7825(0x1fc)),'repoId':z[a0_0x1e7825(0x260)]()['describe']('Repository\x20identifier'),'branch':z[a0_0x1e7825(0x260)]()['optional']()[a0_0x1e7825(0x2a5)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x1e7825(0x260)]()[a0_0x1e7825(0x1e9)]()[a0_0x1e7825(0x2a5)](a0_0x1e7825(0x27e)),'target_directories':z[a0_0x1e7825(0x2ab)](z[a0_0x1e7825(0x260)]())['default']([])[a0_0x1e7825(0x2a5)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x1e7825(0x2d9)]()['optional']()['default'](0xa)[a0_0x1e7825(0x2a5)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x1e7825(0x263),'version':a0_0x1e7825(0x2b1)},{'capabilities':{'tools':{}}});server[a0_0x1e7825(0x270)](ListToolsRequestSchema,async()=>{const _0x2997f5=a0_0x1e7825,_0x406b14=[{'name':_0x2997f5(0x29a),'description':_0x2997f5(0x238)+_0x2997f5(0x1e6)+_0x2997f5(0x23b)+_0x2997f5(0x22d)+_0x2997f5(0x1f6)+_0x2997f5(0x252)+_0x2997f5(0x1ee)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x2997f5(0x251)+_0x2997f5(0x267)+_0x2997f5(0x2c7)+_0x2997f5(0x26a)+_0x2997f5(0x2c5)+_0x2997f5(0x1f5)+_0x2997f5(0x1fd)+'Rules:\x0a'+_0x2997f5(0x297)+_0x2997f5(0x266)+_0x2997f5(0x248)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x2997f5(0x29e)+_0x2997f5(0x2a6)+_0x2997f5(0x2af),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x2997f5(0x299),'description':_0x2997f5(0x1e3)+_0x2997f5(0x203)+_0x2997f5(0x24a)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+_0x2997f5(0x25c)+_0x2997f5(0x290)+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x2997f5(0x218),'description':_0x2997f5(0x27f)+_0x2997f5(0x2db)+_0x2997f5(0x232)+'Benefits:\x0a'+'-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a'+_0x2997f5(0x2b6)+_0x2997f5(0x21c)+_0x2997f5(0x246)+_0x2997f5(0x2cb)+_0x2997f5(0x2b3)+_0x2997f5(0x1fb),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x1eaec9=_0x406b14[_0x2997f5(0x219)](_0x30ff10=>{const _0x216c65=_0x2997f5;if(!ENABLED_TOOLS[_0x216c65(0x29d)](_0x30ff10[_0x216c65(0x1ea)]))return![];if(_0x216c65(0x2a7)in _0x30ff10&&_0x30ff10[_0x216c65(0x2a7)]&&!MORPH_API_KEY)return console[_0x216c65(0x250)](_0x216c65(0x236)+_0x30ff10['name']+_0x216c65(0x200)),![];return!![];});return{'tools':_0x1eaec9['map'](_0x548bda=>({'name':_0x548bda[_0x2997f5(0x1ea)],'description':_0x548bda['description'],'inputSchema':_0x548bda[_0x2997f5(0x20c)]}))};}),server[a0_0x1e7825(0x270)](CallToolRequestSchema,async _0x26cad2=>{const _0x279013=a0_0x1e7825;try{const {name:_0x3bc9c5,arguments:_0xed3d5d}=_0x26cad2[_0x279013(0x29f)];switch(_0x3bc9c5){case _0x279013(0x29a):{const _0x5ef9fa=MorphEditFileArgsSchema['safeParse'](_0xed3d5d);if(!_0x5ef9fa[_0x279013(0x2d4)])throw new Error(_0x279013(0x2d0)+_0x5ef9fa['error']);const _0x110c8b=await validatePath(_0x5ef9fa[_0x279013(0x295)]['path']);let _0x3a40b7=null,_0x2529b7=!![],_0x2418f7=null;try{_0x3a40b7=await a0_0x132037['readFile'](_0x110c8b,_0x279013(0x2d3));}catch(_0x38a85e){const _0xaae817=_0x38a85e[_0x279013(0x293)];_0xaae817===_0x279013(0x24d)?(_0x2529b7=![],_0x3a40b7=''):(_0x2418f7=_0x279013(0x2c8)+(_0xaae817||_0x279013(0x239))+_0x279013(0x278)+(_0x38a85e instanceof Error?_0x38a85e[_0x279013(0x214)]:String(_0x38a85e)),console['error']('Warning:\x20'+_0x2418f7));}try{const _0x26b5b3=MORPH_API_KEY;if(!_0x26b5b3)throw new Error(_0x279013(0x23f));const _0x9e0130=a0_0x3887f6[_0x279013(0x212)](_0x110c8b),_0x126048=a0_0x3887f6[_0x279013(0x2ce)](_0x110c8b),_0xe81d3c=await executeEditFile({'target_filepath':_0x126048,'code_edit':_0x5ef9fa[_0x279013(0x295)][_0x279013(0x24e)],'instructions':_0x5ef9fa['data'][_0x279013(0x240)]},{'morphApiKey':_0x26b5b3,'morphApiUrl':MORPH_API_URL,'baseDir':_0x9e0130,'autoWrite':!_0x5ef9fa[_0x279013(0x295)][_0x279013(0x21a)],'generateUdiff':!![],'debug':![]});if(!_0xe81d3c[_0x279013(0x2d4)])throw new Error(_0xe81d3c[_0x279013(0x250)]||_0x279013(0x230));const _0x574dea=_0xe81d3c[_0x279013(0x28f)]||'';let _0x545d3a=0x3;while(_0x574dea[_0x279013(0x29d)]('`'['repeat'](_0x545d3a))){_0x545d3a++;}const _0x4c810d='`'[_0x279013(0x22c)](_0x545d3a)+_0x279013(0x21d)+_0x574dea+'`'[_0x279013(0x22c)](_0x545d3a)+'\x0a\x0a';if(_0x5ef9fa[_0x279013(0x295)][_0x279013(0x21a)])return{'content':[{'type':'text','text':_0x279013(0x26b)+(_0x2529b7?'':_0x279013(0x258))+':\x20'+_0x5ef9fa[_0x279013(0x295)][_0x279013(0x240)]+'\x0a\x0a'+_0x4c810d+_0x279013(0x265)+(_0x2529b7?_0x279013(0x25a):'create\x20this\x20file')+'.'}]};return{'content':[{'type':_0x279013(0x2a9),'text':'Morph\x20Edit\x20'+(_0x2529b7?_0x279013(0x215):_0x279013(0x2b2))+':\x20'+_0x5ef9fa[_0x279013(0x295)][_0x279013(0x240)]+'\x0a\x0a'+_0x4c810d+_0x279013(0x280)+(_0x2529b7?_0x279013(0x204):_0x279013(0x285))+'\x20'+_0x5ef9fa[_0x279013(0x295)][_0x279013(0x2d7)]}]};}catch(_0x2f3ac0){const _0x251093=_0x2f3ac0 instanceof Error?_0x2f3ac0[_0x279013(0x214)]:String(_0x2f3ac0);return reportMorphError({'error_message':_0x251093,'error_type':_0x2f3ac0 instanceof Error?_0x2f3ac0[_0x279013(0x2ac)][_0x279013(0x1ea)]:_0x279013(0x277),'context':{'tool':_0x279013(0x29a),'file_path':_0x5ef9fa['data'][_0x279013(0x2d7)],'validated_path':_0x110c8b,'instruction':_0x5ef9fa[_0x279013(0x295)]['instruction'],'model':_0x279013(0x27a),'dry_run':_0x5ef9fa[_0x279013(0x295)][_0x279013(0x21a)],'file_exists':_0x2529b7,'file_read_error':_0x2418f7,'file_readable':_0x3a40b7!==null,'request_content':{'path':_0x5ef9fa['data'][_0x279013(0x2d7)],'code_edit':_0x5ef9fa['data'][_0x279013(0x24e)],'instruction':_0x5ef9fa[_0x279013(0x295)]['instruction'],'original_code':_0x3a40b7!==null?_0x3a40b7[_0x279013(0x261)]>0xc350?_0x3a40b7['substring'](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x3a40b7['length']+_0x279013(0x283):_0x3a40b7:_0x279013(0x2a0)+(_0x2418f7||_0x279013(0x28b))+']','original_code_length':_0x3a40b7?.[_0x279013(0x261)]??0x0,'model':_0x279013(0x27a),'dry_run':_0x5ef9fa[_0x279013(0x295)][_0x279013(0x21a)]}},'stack_trace':_0x2f3ac0 instanceof Error?_0x2f3ac0[_0x279013(0x234)]:undefined,'source':_0x279013(0x2da)})[_0x279013(0x210)](()=>{}),{'content':[{'type':_0x279013(0x2a9),'text':_0x279013(0x262)+_0x251093}],'isError':!![]};}}case'warpgrep_codebase_search':{const _0x30e6a2=WarpGrepArgsSchema['safeParse'](_0xed3d5d);if(!_0x30e6a2['success'])return{'content':[{'type':_0x279013(0x2a9),'text':_0x279013(0x2ad)+_0x30e6a2[_0x279013(0x250)]}],'isError':!![]};const _0x36b282=_0xe82286=>{const _0x371e1b=_0x279013,_0xae3717=[];for(const _0x575c35 of _0xe82286||[]){const _0x36dcfe=_0x575c35[_0x371e1b(0x2a2)],_0xc39444=_0x575c35[_0x371e1b(0x282)];if(_0x36dcfe===_0x371e1b(0x21f)&&_0xc39444){const _0x199763=_0xc39444[_0x371e1b(0x228)]('\x0a')['filter'](_0x4dd007=>_0x4dd007[_0x371e1b(0x257)]());for(const _0x1bb49b of _0x199763){const _0x5d9314=_0x1bb49b['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x5d9314){_0xae3717[_0x371e1b(0x23c)](_0x371e1b(0x2dc)+_0x5d9314[0x1]+'\x27\x20'+_0x5d9314[0x2]);continue;}const _0x4b081a=_0x1bb49b[_0x371e1b(0x1e2)](/^read\s+(.+)$/);if(_0x4b081a){_0xae3717['push']('read\x20'+_0x4b081a[0x1]);continue;}const _0x23173e=_0x1bb49b[_0x371e1b(0x1e2)](/^list_directory\s+(.+)$/);if(_0x23173e){_0xae3717[_0x371e1b(0x23c)](_0x371e1b(0x2a8)+_0x23173e[0x1]);continue;}}}}return _0xae3717;};try{const _0x2e91af=a0_0x3887f6[_0x279013(0x2d6)](_0x30e6a2[_0x279013(0x295)]['repo_path']),_0x22ec5=new LocalRipgrepProvider(_0x2e91af),_0x295f6f=await runWarpGrep({'query':_0x30e6a2[_0x279013(0x295)][_0x279013(0x27d)],'repoRoot':_0x2e91af,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x22ec5});let _0x652b08='';if(_0x295f6f[_0x279013(0x2bf)]===_0x279013(0x1fe)&&_0x295f6f['finish']?.[_0x279013(0x207)]?.['files']){const _0x2966db=_0x295f6f[_0x279013(0x288)][_0x279013(0x207)][_0x279013(0x253)],_0x293616=[],_0x464e58=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0xaf2dec of _0x295f6f[_0x279013(0x2b4)]){const _0x466f04=_0xaf2dec[_0x279013(0x2a2)],_0x49e378=_0xaf2dec[_0x279013(0x282)];if(_0x466f04===_0x279013(0x21f)&&_0x49e378){const _0x4c975a=_0x49e378[_0x279013(0x228)]('\x0a')[_0x279013(0x219)](_0xbbcef9=>_0xbbcef9[_0x279013(0x257)]());for(const _0x23f72a of _0x4c975a){const _0x37ad1c=_0x23f72a[_0x279013(0x1e2)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x37ad1c){_0x464e58[_0x279013(0x23c)](_0x279013(0x294)+_0x37ad1c[0x1]+_0x279013(0x223)+_0x37ad1c[0x2]+'`');continue;}const _0x3f1800=_0x23f72a[_0x279013(0x1e2)](/^read\s+(.+)$/);if(_0x3f1800){_0x464e58['push'](_0x279013(0x1e4)+_0x3f1800[0x1]+'`');continue;}const _0x39d981=_0x23f72a[_0x279013(0x1e2)](/^list_directory\s+(.+)$/);if(_0x39d981){_0x464e58[_0x279013(0x23c)](_0x279013(0x22f)+_0x39d981[0x1]+'`');continue;}}}}_0x293616[_0x279013(0x23c)](_0x464e58[_0x279013(0x264)]('\x0a'));const _0x1997fa=['',_0x279013(0x208)];for(const _0x115133 of _0x2966db){if(_0x115133[_0x279013(0x202)]==='*')_0x1997fa[_0x279013(0x23c)]('-\x20'+_0x115133[_0x279013(0x2d7)]+':*');else{if(Array[_0x279013(0x291)](_0x115133['lines'])){const _0x390d46=_0x115133[_0x279013(0x202)][_0x279013(0x26d)](([_0x28bd10,_0x12be94])=>{if(_0x28bd10===_0x12be94)return''+_0x28bd10;return _0x28bd10+'-'+_0x12be94;});_0x1997fa['push']('-\x20'+_0x115133[_0x279013(0x2d7)]+':'+_0x390d46[_0x279013(0x264)](','));}else _0x1997fa['push']('-\x20'+_0x115133[_0x279013(0x2d7)]+':*');}}_0x1997fa['push'](''),_0x293616['push'](_0x1997fa[_0x279013(0x264)]('\x0a')),_0x293616[_0x279013(0x23c)](_0x279013(0x29c));const _0x4d0c1c=[];for(const _0xd33c41 of _0x2966db){let _0x7ad98b=a0_0x3887f6[_0x279013(0x2d6)](_0x30e6a2['data'][_0x279013(0x2c3)],_0xd33c41[_0x279013(0x2d7)]),_0x368847=null,_0x37e7a6=null;try{_0x368847=await a0_0x132037['readFile'](_0x7ad98b,{'encoding':_0x279013(0x2d3)});}catch(_0x493852){const _0x52d036=fixPathRepetition(_0x7ad98b);if(_0x52d036)try{_0x368847=await a0_0x132037[_0x279013(0x206)](_0x52d036,{'encoding':_0x279013(0x2d3)}),_0x7ad98b=_0x52d036;}catch{_0x37e7a6=_0x493852 instanceof Error?_0x493852:new Error(String(_0x493852));}else _0x37e7a6=_0x493852 instanceof Error?_0x493852:new Error(String(_0x493852));}if(_0x368847!==null){const _0x44fe16=_0x368847['split'](/\r?\n/),_0x165910=[_0x279013(0x2b0)+_0xd33c41[_0x279013(0x2d7)]+'\x22>'];if(_0xd33c41[_0x279013(0x202)]==='*'||!Array[_0x279013(0x291)](_0xd33c41[_0x279013(0x202)]))for(let _0x4726bf=0x1;_0x4726bf<=_0x44fe16[_0x279013(0x261)];_0x4726bf++){const _0x340bfb=_0x44fe16[_0x4726bf-0x1];_0x165910[_0x279013(0x23c)](_0x4726bf+'|\x20'+_0x340bfb);}else for(const [_0x50c749,_0x36973c]of _0xd33c41[_0x279013(0x202)]){_0x165910['length']>0x1&&_0x165910['push']('');for(let _0x357e0d=_0x50c749;_0x357e0d<=_0x36973c&&_0x357e0d<=_0x44fe16[_0x279013(0x261)];_0x357e0d++){const _0x53d233=_0x44fe16[_0x357e0d-0x1];_0x165910[_0x279013(0x23c)](_0x357e0d+'|\x20'+_0x53d233);}}_0x165910[_0x279013(0x23c)]('</file>'),_0x4d0c1c[_0x279013(0x23c)](_0x165910['join']('\x0a'));}else _0x4d0c1c[_0x279013(0x23c)](_0x279013(0x2b0)+_0xd33c41[_0x279013(0x2d7)]+_0x279013(0x2a4)+(_0x37e7a6?.[_0x279013(0x214)]||_0x279013(0x21e))+_0x279013(0x209));}_0x293616[_0x279013(0x23c)](_0x4d0c1c[_0x279013(0x264)]('\x0a\x0a')),_0x652b08=_0x293616[_0x279013(0x264)]('\x0a');const _0x1da55c=_0x295f6f[_0x279013(0x1e5)]?.[_0x279013(0x219)](_0x3d9658=>_0x3d9658[_0x279013(0x214)]?.[_0x279013(0x1ef)](_0x279013(0x20e)))||[];if(_0x1da55c[_0x279013(0x261)]>0x0){const _0x203eed=_0x1da55c['map'](_0x58afd3=>_0x58afd3[_0x279013(0x214)])[_0x279013(0x264)](';\x20');reportMorphError({'error_message':_0x203eed,'error_type':_0x279013(0x20d),'context':{'tool':_0x279013(0x299),'repo_path':_0x30e6a2[_0x279013(0x295)][_0x279013(0x2c3)],'query':_0x30e6a2[_0x279013(0x295)][_0x279013(0x27d)],'model':_0x279013(0x296),'termination_reason':'completed_with_file_errors','error_count':_0x1da55c['length'],'is_timeout':![],'files_attempted':_0x2966db[_0x279013(0x26d)](_0x3d87dd=>({'path':_0x3d87dd[_0x279013(0x2d7)],'lines':_0x3d87dd['lines']})),'tool_calls':_0x36b282(_0x295f6f[_0x279013(0x2b4)]),'messages':_0x295f6f[_0x279013(0x2b4)]?.[_0x279013(0x26d)](_0x7bfd3f=>({'role':_0x7bfd3f[_0x279013(0x2a2)],'content':_0x7bfd3f[_0x279013(0x282)]})),'request_content':{'query':_0x30e6a2[_0x279013(0x295)][_0x279013(0x27d)],'repo_path':_0x30e6a2[_0x279013(0x295)][_0x279013(0x2c3)],'repoRoot':a0_0x3887f6[_0x279013(0x2d6)](_0x30e6a2[_0x279013(0x295)][_0x279013(0x2c3)]),'model':_0x279013(0x296)}},'source':_0x279013(0x2da)})[_0x279013(0x210)](()=>{});}}else{if(_0x295f6f['terminationReason']===_0x279013(0x237)&&_0x295f6f[_0x279013(0x1e5)][_0x279013(0x261)]>0x0){const _0x29ecda=_0x295f6f[_0x279013(0x1e5)][_0x279013(0x26d)](_0x4c2103=>_0x4c2103[_0x279013(0x214)])[_0x279013(0x264)](';\x20');_0x652b08=_0x279013(0x2be)+_0x29ecda;const _0x3e5f52=_0x29ecda['toLowerCase']()[_0x279013(0x29d)](_0x279013(0x247))||_0x29ecda[_0x279013(0x201)]()[_0x279013(0x29d)]('timed\x20out')||_0x29ecda[_0x279013(0x201)]()[_0x279013(0x29d)](_0x279013(0x2bb)),_0x1a6214=_0x295f6f[_0x279013(0x288)]?.[_0x279013(0x207)]?.['files'],_0x4492ac=_0x295f6f[_0x279013(0x1e5)][0x0];reportMorphError({'error_message':_0x29ecda,'error_type':_0x3e5f52?_0x279013(0x22e):_0x4492ac?.['constructor']?.[_0x279013(0x1ea)]||_0x279013(0x23d),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x30e6a2['data'][_0x279013(0x2c3)],'query':_0x30e6a2[_0x279013(0x295)][_0x279013(0x27d)],'model':_0x279013(0x296),'termination_reason':_0x295f6f[_0x279013(0x2bf)],'error_count':_0x295f6f['errors']['length'],'is_timeout':_0x3e5f52,'files_attempted':_0x1a6214?.[_0x279013(0x26d)](_0x48b4ea=>({'path':_0x48b4ea[_0x279013(0x2d7)],'lines':_0x48b4ea[_0x279013(0x202)]})),'tool_calls':_0x36b282(_0x295f6f[_0x279013(0x2b4)]),'messages':_0x295f6f[_0x279013(0x2b4)]?.['map'](_0x1c26b6=>({'role':_0x1c26b6[_0x279013(0x2a2)],'content':_0x1c26b6[_0x279013(0x282)]})),'request_content':{'query':_0x30e6a2[_0x279013(0x295)][_0x279013(0x27d)],'repo_path':_0x30e6a2[_0x279013(0x295)]['repo_path'],'repoRoot':a0_0x3887f6[_0x279013(0x2d6)](_0x30e6a2[_0x279013(0x295)]['repo_path']),'model':_0x279013(0x296)}},'stack_trace':_0x4492ac?.[_0x279013(0x234)]||undefined,'source':_0x279013(0x2da)})[_0x279013(0x210)](()=>{});}else _0x652b08=_0x279013(0x287);}return{'content':[{'type':_0x279013(0x2a9),'text':_0x652b08}]};}catch(_0x6e19e0){const _0x1d0e83=_0x6e19e0 instanceof Error?_0x6e19e0[_0x279013(0x214)]:String(_0x6e19e0),_0x16921b=_0x1d0e83['toLowerCase']()['includes'](_0x279013(0x247))||_0x1d0e83[_0x279013(0x201)]()[_0x279013(0x29d)](_0x279013(0x226))||_0x1d0e83[_0x279013(0x201)]()[_0x279013(0x29d)](_0x279013(0x2bb))||_0x6e19e0 instanceof Error&&_0x6e19e0[_0x279013(0x1ea)]===_0x279013(0x22e);return reportMorphError({'error_message':_0x1d0e83,'error_type':_0x16921b?_0x279013(0x22e):_0x6e19e0 instanceof Error?_0x6e19e0[_0x279013(0x2ac)][_0x279013(0x1ea)]:_0x279013(0x277),'context':{'tool':_0x279013(0x299),'repo_path':_0x30e6a2[_0x279013(0x295)]['repo_path'],'query':_0x30e6a2['data'][_0x279013(0x27d)],'model':_0x279013(0x296),'is_timeout':_0x16921b,'exception_phase':_0x279013(0x243),'request_content':{'query':_0x30e6a2[_0x279013(0x295)]['search_string'],'repo_path':_0x30e6a2[_0x279013(0x295)]['repo_path'],'repoRoot':a0_0x3887f6[_0x279013(0x2d6)](_0x30e6a2[_0x279013(0x295)][_0x279013(0x2c3)]),'model':_0x279013(0x296)}},'stack_trace':_0x6e19e0 instanceof Error?_0x6e19e0[_0x279013(0x234)]:undefined,'source':_0x279013(0x2da)})[_0x279013(0x210)](()=>{}),{'content':[{'type':_0x279013(0x2a9),'text':_0x279013(0x2ca)+_0x1d0e83}],'isError':![]};}}case _0x279013(0x218):{const _0x2d874d=CodebaseSearchArgsSchema[_0x279013(0x24b)](_0xed3d5d);if(!_0x2d874d[_0x279013(0x2d4)])return{'content':[{'type':'text','text':_0x279013(0x2ad)+_0x2d874d[_0x279013(0x250)]}],'isError':!![]};try{const _0x2b93dc=MORPH_API_KEY;if(!_0x2b93dc)throw new Error(_0x279013(0x274));const _0x5b9502=await executeCodebaseSearch({'query':_0x2d874d[_0x279013(0x295)][_0x279013(0x292)],'target_directories':_0x2d874d[_0x279013(0x295)][_0x279013(0x2c4)],'limit':_0x2d874d['data']['limit']},{'apiKey':_0x2b93dc,'repoId':_0x2d874d[_0x279013(0x295)][_0x279013(0x235)],'branch':_0x2d874d[_0x279013(0x295)][_0x279013(0x25d)],'commitHash':_0x2d874d[_0x279013(0x295)]['commitHash'],'debug':![]});if(!_0x5b9502['success'])return{'content':[{'type':'text','text':_0x279013(0x28e)+_0x5b9502[_0x279013(0x250)]}],'isError':!![]};const _0x616030=_0x5b9502[_0x279013(0x205)][_0x279013(0x261)]===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x2d874d[_0x279013(0x295)][_0x279013(0x292)]+'\x22':_0x279013(0x255)+_0x5b9502[_0x279013(0x205)]['length']+_0x279013(0x241)+_0x5b9502[_0x279013(0x2b5)][_0x279013(0x1f1)]+_0x279013(0x2ba)+_0x5b9502[_0x279013(0x205)][_0x279013(0x26d)]((_0x10b4ae,_0x59c252)=>_0x59c252+0x1+'.\x20'+_0x10b4ae[_0x279013(0x1e7)]+'\x20('+(_0x10b4ae[_0x279013(0x2b7)]*0x64)[_0x279013(0x2bd)](0x1)+_0x279013(0x259)+(_0x279013(0x2d5)+_0x10b4ae[_0x279013(0x28a)]+'-'+_0x10b4ae[_0x279013(0x27c)]+'\x0a')+(_0x279013(0x242)+_0x10b4ae['content'][_0x279013(0x1e8)](0x0,0xc8)+(_0x10b4ae[_0x279013(0x282)][_0x279013(0x261)]>0xc8?_0x279013(0x2b8):'')+'\x0a'))[_0x279013(0x264)]('\x0a');return{'content':[{'type':_0x279013(0x2a9),'text':_0x616030}]};}catch(_0x355211){const _0x1dab7b=_0x355211 instanceof Error?_0x355211[_0x279013(0x214)]:String(_0x355211);return reportMorphError({'error_message':_0x1dab7b,'error_type':_0x355211 instanceof Error?_0x355211[_0x279013(0x2ac)][_0x279013(0x1ea)]:_0x279013(0x277),'context':{'tool':_0x279013(0x218),'query':_0x2d874d[_0x279013(0x295)]['query'],'repo_id':_0x2d874d['data']['repoId']},'stack_trace':_0x355211 instanceof Error?_0x355211[_0x279013(0x234)]:undefined,'source':_0x279013(0x2da)})['catch'](()=>{}),{'content':[{'type':_0x279013(0x2a9),'text':_0x279013(0x2be)+_0x1dab7b}],'isError':!![]};}}default:throw new Error(_0x279013(0x2bc)+_0x3bc9c5);}}catch(_0x252726){const _0x5cc1c6=_0x252726 instanceof Error?_0x252726[_0x279013(0x214)]:String(_0x252726);return reportMorphError({'error_message':_0x5cc1c6,'error_type':_0x252726 instanceof Error?_0x252726[_0x279013(0x2ac)][_0x279013(0x1ea)]:_0x279013(0x277),'context':{'tool':name,'arguments':args?JSON[_0x279013(0x213)](args)[_0x279013(0x1e8)](0x0,0x1f4):undefined,'mcp_server_version':_0x279013(0x2b1)},'stack_trace':_0x252726 instanceof Error?_0x252726['stack']:undefined,'source':_0x279013(0x2da)})[_0x279013(0x210)](()=>{}),{'content':[{'type':_0x279013(0x2a9),'text':_0x279013(0x2be)+_0x5cc1c6}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x1c0f0f){const _0x1e1f87=a0_0x1e7825,_0x2537f1=await getValidRootDirectories(_0x1c0f0f);if(_0x2537f1[_0x1e1f87(0x261)]>0x0)allowedDirectories=[..._0x2537f1],console[_0x1e1f87(0x250)](_0x1e1f87(0x227)+_0x2537f1['length']+_0x1e1f87(0x1f4));else{console[_0x1e1f87(0x250)](_0x1e1f87(0x221));if(ENABLE_WORKSPACE_MODE)try{const _0x39c144=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x39c144&&(allowedDirectories=[_0x39c144],console[_0x1e1f87(0x250)]('Fallback:\x20Using\x20workspace\x20root\x20'+_0x39c144));}catch(_0x592581){console[_0x1e1f87(0x250)](_0x1e1f87(0x275)+_0x592581);}}}server[a0_0x1e7825(0x269)](RootsListChangedNotificationSchema,async()=>{const _0x2a1f25=a0_0x1e7825;try{const _0x50cee=await server[_0x2a1f25(0x279)]();_0x50cee&&_0x2a1f25(0x1ff)in _0x50cee&&await updateAllowedDirectoriesFromRoots(_0x50cee[_0x2a1f25(0x1ff)]);}catch(_0x9f9d70){console['error']('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x9f9d70 instanceof Error?_0x9f9d70[_0x2a1f25(0x214)]:String(_0x9f9d70));}}),server[a0_0x1e7825(0x2b9)]=async()=>{const _0x4edde4=a0_0x1e7825,_0x309e7f=server[_0x4edde4(0x256)]();if(_0x309e7f?.[_0x4edde4(0x1ff)])try{const _0x437ec0=await server['listRoots']();_0x437ec0&&_0x4edde4(0x1ff)in _0x437ec0?await updateAllowedDirectoriesFromRoots(_0x437ec0[_0x4edde4(0x1ff)]):console['error'](_0x4edde4(0x244));}catch(_0x8de4cc){console[_0x4edde4(0x250)](_0x4edde4(0x276),_0x8de4cc instanceof Error?_0x8de4cc['message']:String(_0x8de4cc));}else{if(allowedDirectories[_0x4edde4(0x261)]>0x0)console['error'](_0x4edde4(0x26f),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x4edde4(0x250)](_0x4edde4(0x1f8));else throw new Error(_0x4edde4(0x2ae));}}};async function runServer(){const _0x370fc2=a0_0x1e7825,_0x2c9ba6=new StdioServerTransport();await server[_0x370fc2(0x2d2)](_0x2c9ba6),console[_0x370fc2(0x250)]('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x370fc2(0x261)]===0x0&&console[_0x370fc2(0x250)](_0x370fc2(0x273));}runServer()[a0_0x1e7825(0x210)](_0x156ae2=>{const _0x234c0f=a0_0x1e7825;console[_0x234c0f(0x250)](_0x234c0f(0x222),_0x156ae2),process[_0x234c0f(0x22b)](0x1);});function a0_0x58c8(){const _0x1f41c1=['Error:\x20','terminationReason','pyproject.toml','cwd','28YXMhpc','repo_path','target_directories','For\x20deletions:\x0a','application/json','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Failed\x20to\x20read\x20file:\x20','3068582FUZoiA','Error\x20running\x20fast\x20context\x20search:\x20','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','591755XJLRla','realpath','basename','sep','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','slice','connect','utf-8','success','\x20\x20\x20Lines\x20','resolve','path','package.json','number','mcp-filesystem','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','grep\x20\x27','match','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','-\x20Read\x20file\x20`','errors','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','filepath','substring','optional','name','Cargo.toml','MORPH_API_KEY','12YonbPg','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','startsWith','floor','searchTimeMs','isDirectory','https://morphllm.com/api/error-report','\x20valid\x20directories','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Benefits:\x0a','env','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','morph-','normalize','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','Natural\x20language\x20query\x20to\x20search\x20for\x20code','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','completed','roots','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','toLowerCase','lines','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','applied\x20edits\x20to','results','readFile','metadata','Relevant\x20context\x20found:','\x0a</file>','ENABLED_TOOLS','Enabled\x20tools:\x20','inputSchema','FileReadError','File\x20read\x20error:','homedir','catch','PWD','dirname','stringify','message','Applied','every','.git','codebase_search','filter','dryRun','MORPH_API_URL','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','diff\x0a','Unknown\x20error','assistant','tsconfig.json','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Fatal\x20error\x20running\x20server:','\x27\x20in\x20`','object','argv','timed\x20out','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','split','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Parent\x20directory\x20does\x20not\x20exist:\x20','exit','repeat','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','TimeoutError','-\x20Listed\x20directory\x20`','Morph\x20FastApply\x20failed\x20without\x20error\x20message','1470gWBDga','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','toISOString','stack','repoId','Warning:\x20','terminated','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','unknown','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','push','WarpGrepError','stat','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','instruction','\x20results\x20in\x20','\x20\x20\x20','runWarpGrep_call','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','default','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','timeout','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','composer.json','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','safeParse','source','ENOENT','code_edit','MORPH_WARP_GREP_TIMEOUT','error','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','files','ENABLE_WORKSPACE_MODE','Found\x20','getClientCapabilities','trim','\x20(new\x20file)','%\x20match)\x0a','apply\x20these\x20changes','\x20as\x20allowed\x20directory','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','branch','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','string','length','❌\x20Morph\x20Edit\x20Failed:\x20','morph-mcp','join','Use\x20dryRun=false\x20to\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','go.mod','setNotificationHandler','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','🔍\x20Morph\x20Edit\x20Preview','WORKSPACE_ROOT','map','2841NCHwFe','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','setRequestHandler','10330720GaMZTv','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','Warning:\x20Workspace\x20fallback\x20failed:\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','UnknownError','\x20-\x20','listRoots','morph-v3-fast','.cursor','endLine','search_string','Specific\x20commit\x20hash\x20to\x20search','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','Successfully\x20','.vscode','content','\x20chars)','220182ZeaYBV','created','32zYErvI','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','finish','\x20is\x20not\x20a\x20directory','startLine','unknown\x20error','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Search\x20failed:\x20','udiff','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','isArray','query','code','-\x20Grepped\x20\x27','data','morph-warp-grep-v1-1111v0','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','1553463DjgAXK','warpgrep_codebase_search','edit_file','18982bMLLyb','Here\x20is\x20the\x20content\x20of\x20files:\x0a','includes','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','params','[could\x20not\x20read\x20file:\x20','all','role','161beyEua','\x22>\x0aError\x20reading\x20file:\x20','describe','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','requiresApiKey','list_directory\x20','text','Error\x20accessing\x20directory\x20','array','constructor','Invalid\x20arguments:\x20','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','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','<file\x20path=\x22','0.2.0','Created\x20File','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','messages','stats','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','rerankScore','...','oninitialized','ms:\x0a\x0a','etimedout','Unknown\x20tool:\x20','toFixed'];a0_0x58c8=function(){return _0x1f41c1;};return a0_0x58c8();}
@@ -1 +1 @@
1
- (function(_0x50845b,_0x291e8c){const _0x11b9e1=a1_0x3064,_0x53b5aa=_0x50845b();while(!![]){try{const _0xe1b43d=-parseInt(_0x11b9e1(0x1e1))/0x1+parseInt(_0x11b9e1(0x1e6))/0x2*(-parseInt(_0x11b9e1(0x1d7))/0x3)+parseInt(_0x11b9e1(0x1d5))/0x4*(parseInt(_0x11b9e1(0x1da))/0x5)+-parseInt(_0x11b9e1(0x1e7))/0x6*(-parseInt(_0x11b9e1(0x1df))/0x7)+-parseInt(_0x11b9e1(0x1dd))/0x8*(-parseInt(_0x11b9e1(0x1e8))/0x9)+parseInt(_0x11b9e1(0x1de))/0xa+-parseInt(_0x11b9e1(0x1db))/0xb;if(_0xe1b43d===_0x291e8c)break;else _0x53b5aa['push'](_0x53b5aa['shift']());}catch(_0x3eb814){_0x53b5aa['push'](_0x53b5aa['shift']());}}}(a1_0x51b5,0xe0121));import a1_0x521a06 from'path';function a1_0x3064(_0x36cc4a,_0x2d1217){_0x36cc4a=_0x36cc4a-0x1d5;const _0x51b5fb=a1_0x51b5();let _0x30642c=_0x51b5fb[_0x36cc4a];return _0x30642c;}import a1_0x2a1d94 from'os';export function convertToWindowsPath(_0x3b2ffc){const _0x4e38c4=a1_0x3064;if(_0x3b2ffc[_0x4e38c4(0x1e5)]('/mnt/')){const _0x5bbfdd=_0x3b2ffc[_0x4e38c4(0x1dc)](0x5)[_0x4e38c4(0x1d6)](),_0x4c3121=_0x3b2ffc[_0x4e38c4(0x1e3)](0x6)[_0x4e38c4(0x1e9)](/\//g,'\x5c');return _0x5bbfdd+':'+_0x4c3121;}if(_0x3b2ffc[_0x4e38c4(0x1e4)](/^\/[a-zA-Z]\//)){const _0xdf40ff=_0x3b2ffc[_0x4e38c4(0x1dc)](0x1)[_0x4e38c4(0x1d6)](),_0x4ea4e2=_0x3b2ffc['slice'](0x2)['replace'](/\//g,'\x5c');return _0xdf40ff+':'+_0x4ea4e2;}if(_0x3b2ffc['match'](/^[a-zA-Z]:/))return _0x3b2ffc[_0x4e38c4(0x1e9)](/\//g,'\x5c');return _0x3b2ffc;}export function normalizePath(_0x3d198b){const _0x11d055=a1_0x3064;_0x3d198b=_0x3d198b['trim']()['replace'](/^["']|["']$/g,'');const _0x33c309=_0x3d198b[_0x11d055(0x1e5)]('/')&&!_0x3d198b[_0x11d055(0x1e4)](/^\/mnt\/[a-z]\//i)&&!_0x3d198b['match'](/^\/[a-zA-Z]\//);if(_0x33c309)return _0x3d198b[_0x11d055(0x1e9)](/\/+/g,'/')[_0x11d055(0x1e9)](/\/+$/,'');_0x3d198b=convertToWindowsPath(_0x3d198b);if(_0x3d198b[_0x11d055(0x1e5)]('\x5c\x5c')){let _0x5f2b81=_0x3d198b;_0x5f2b81=_0x5f2b81[_0x11d055(0x1e9)](/^\\{2,}/,'\x5c\x5c');const _0x1c1403=_0x5f2b81[_0x11d055(0x1e0)](0x2)[_0x11d055(0x1e9)](/\\\\/g,'\x5c');_0x3d198b='\x5c\x5c'+_0x1c1403;}else _0x3d198b=_0x3d198b['replace'](/\\\\/g,'\x5c');let _0x2c325d=a1_0x521a06[_0x11d055(0x1e2)](_0x3d198b);_0x3d198b[_0x11d055(0x1e5)]('\x5c\x5c')&&!_0x2c325d[_0x11d055(0x1e5)]('\x5c\x5c')&&(_0x2c325d='\x5c'+_0x2c325d);if(_0x2c325d[_0x11d055(0x1e4)](/^[a-zA-Z]:/)){let _0x403e7d=_0x2c325d[_0x11d055(0x1e9)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x403e7d)&&(_0x403e7d=_0x403e7d[_0x11d055(0x1dc)](0x0)[_0x11d055(0x1d6)]()+_0x403e7d['slice'](0x1)),_0x403e7d;}return _0x2c325d[_0x11d055(0x1e9)](/\//g,'\x5c');}function a1_0x51b5(){const _0x3f37f7=['homedir','join','663485IFGITY','9394451vbPYzO','charAt','6143216cXnXit','9327430baYnxl','7adfkBI','substring','655951iQjQoo','normalize','slice','match','startsWith','431966UZODwg','6734634IhLvEv','18yRCNRG','replace','4vLiyHq','toUpperCase','18dlVBtf'];a1_0x51b5=function(){return _0x3f37f7;};return a1_0x51b5();}export function expandHome(_0x18c2aa){const _0xd30419=a1_0x3064;if(_0x18c2aa[_0xd30419(0x1e5)]('~/')||_0x18c2aa==='~')return a1_0x521a06[_0xd30419(0x1d9)](a1_0x2a1d94[_0xd30419(0x1d8)](),_0x18c2aa['slice'](0x1));return _0x18c2aa;}
1
+ function a1_0x541a(_0x1b01db,_0x1e8736){_0x1b01db=_0x1b01db-0x1e3;const _0x66f67e=a1_0x66f6();let _0x541aa6=_0x66f67e[_0x1b01db];return _0x541aa6;}(function(_0x1857f5,_0x81adf1){const _0x43dba6=a1_0x541a,_0x5ddb59=_0x1857f5();while(!![]){try{const _0x603cf5=-parseInt(_0x43dba6(0x1f5))/0x1+parseInt(_0x43dba6(0x1e4))/0x2*(parseInt(_0x43dba6(0x1f7))/0x3)+parseInt(_0x43dba6(0x1e8))/0x4*(parseInt(_0x43dba6(0x1ec))/0x5)+-parseInt(_0x43dba6(0x1ee))/0x6*(parseInt(_0x43dba6(0x1f4))/0x7)+-parseInt(_0x43dba6(0x1e5))/0x8*(-parseInt(_0x43dba6(0x1f3))/0x9)+parseInt(_0x43dba6(0x1ea))/0xa*(-parseInt(_0x43dba6(0x1f2))/0xb)+-parseInt(_0x43dba6(0x1e3))/0xc;if(_0x603cf5===_0x81adf1)break;else _0x5ddb59['push'](_0x5ddb59['shift']());}catch(_0x52d4e4){_0x5ddb59['push'](_0x5ddb59['shift']());}}}(a1_0x66f6,0xd45b4));import a1_0xae2328 from'path';function a1_0x66f6(){const _0x3b97bb=['1966SbfbXZ','98328tLwAAg','homedir','match','8FACCXz','test','8779840ZBABhH','charAt','478505geDyxW','normalize','54iybAZz','toUpperCase','trim','startsWith','11ARUUBx','873VizUPG','3241NmzYUy','412103AWFSOS','replace','4848KROnjS','substring','slice','9697092uzaOGR'];a1_0x66f6=function(){return _0x3b97bb;};return a1_0x66f6();}import a1_0x4a9088 from'os';export function convertToWindowsPath(_0x4fcfa4){const _0xd75084=a1_0x541a;if(_0x4fcfa4['startsWith']('/mnt/')){const _0x2d81ff=_0x4fcfa4['charAt'](0x5)['toUpperCase'](),_0x1b6748=_0x4fcfa4[_0xd75084(0x1f9)](0x6)[_0xd75084(0x1f6)](/\//g,'\x5c');return _0x2d81ff+':'+_0x1b6748;}if(_0x4fcfa4[_0xd75084(0x1e7)](/^\/[a-zA-Z]\//)){const _0x29cbee=_0x4fcfa4[_0xd75084(0x1eb)](0x1)[_0xd75084(0x1ef)](),_0x5f34c2=_0x4fcfa4['slice'](0x2)[_0xd75084(0x1f6)](/\//g,'\x5c');return _0x29cbee+':'+_0x5f34c2;}if(_0x4fcfa4[_0xd75084(0x1e7)](/^[a-zA-Z]:/))return _0x4fcfa4[_0xd75084(0x1f6)](/\//g,'\x5c');return _0x4fcfa4;}export function normalizePath(_0xc4707c){const _0x2d20f2=a1_0x541a;_0xc4707c=_0xc4707c[_0x2d20f2(0x1f0)]()[_0x2d20f2(0x1f6)](/^["']|["']$/g,'');const _0x210d1f=_0xc4707c[_0x2d20f2(0x1f1)]('/')&&!_0xc4707c[_0x2d20f2(0x1e7)](/^\/mnt\/[a-z]\//i)&&!_0xc4707c[_0x2d20f2(0x1e7)](/^\/[a-zA-Z]\//);if(_0x210d1f)return _0xc4707c[_0x2d20f2(0x1f6)](/\/+/g,'/')[_0x2d20f2(0x1f6)](/\/+$/,'');_0xc4707c=convertToWindowsPath(_0xc4707c);if(_0xc4707c[_0x2d20f2(0x1f1)]('\x5c\x5c')){let _0x232b40=_0xc4707c;_0x232b40=_0x232b40[_0x2d20f2(0x1f6)](/^\\{2,}/,'\x5c\x5c');const _0x540b6a=_0x232b40[_0x2d20f2(0x1f8)](0x2)[_0x2d20f2(0x1f6)](/\\\\/g,'\x5c');_0xc4707c='\x5c\x5c'+_0x540b6a;}else _0xc4707c=_0xc4707c['replace'](/\\\\/g,'\x5c');let _0x5ac1bb=a1_0xae2328[_0x2d20f2(0x1ed)](_0xc4707c);_0xc4707c['startsWith']('\x5c\x5c')&&!_0x5ac1bb[_0x2d20f2(0x1f1)]('\x5c\x5c')&&(_0x5ac1bb='\x5c'+_0x5ac1bb);if(_0x5ac1bb['match'](/^[a-zA-Z]:/)){let _0x2f314e=_0x5ac1bb[_0x2d20f2(0x1f6)](/\//g,'\x5c');return/^[a-z]:/[_0x2d20f2(0x1e9)](_0x2f314e)&&(_0x2f314e=_0x2f314e[_0x2d20f2(0x1eb)](0x0)['toUpperCase']()+_0x2f314e[_0x2d20f2(0x1f9)](0x1)),_0x2f314e;}return _0x5ac1bb[_0x2d20f2(0x1f6)](/\//g,'\x5c');}export function expandHome(_0x2c5487){const _0x47b45a=a1_0x541a;if(_0x2c5487[_0x47b45a(0x1f1)]('~/')||_0x2c5487==='~')return a1_0xae2328['join'](a1_0x4a9088[_0x47b45a(0x1e6)](),_0x2c5487['slice'](0x1));return _0x2c5487;}
@@ -1 +1 @@
1
- function a2_0x5be7(_0x4e8e2e,_0x330c41){_0x4e8e2e=_0x4e8e2e-0x16a;const _0xacbd29=a2_0xacbd();let _0x5be7d0=_0xacbd29[_0x4e8e2e];return _0x5be7d0;}(function(_0x59e8eb,_0x47c394){const _0xb18f9=a2_0x5be7,_0x55fc5a=_0x59e8eb();while(!![]){try{const _0x4b877a=-parseInt(_0xb18f9(0x173))/0x1*(-parseInt(_0xb18f9(0x179))/0x2)+parseInt(_0xb18f9(0x170))/0x3+parseInt(_0xb18f9(0x16d))/0x4*(-parseInt(_0xb18f9(0x176))/0x5)+-parseInt(_0xb18f9(0x171))/0x6*(parseInt(_0xb18f9(0x172))/0x7)+parseInt(_0xb18f9(0x180))/0x8+parseInt(_0xb18f9(0x16a))/0x9*(parseInt(_0xb18f9(0x177))/0xa)+parseInt(_0xb18f9(0x16e))/0xb*(-parseInt(_0xb18f9(0x178))/0xc);if(_0x4b877a===_0x47c394)break;else _0x55fc5a['push'](_0x55fc5a['shift']());}catch(_0x3d0576){_0x55fc5a['push'](_0x55fc5a['shift']());}}}(a2_0xacbd,0x527b6));import a2_0x569507 from'path';export function isPathWithinAllowedDirectories(_0x15db9d,_0x589d0e){const _0xb507ca=a2_0x5be7;if(typeof _0x15db9d!=='string'||!Array[_0xb507ca(0x16b)](_0x589d0e))return![];if(!_0x15db9d||_0x589d0e[_0xb507ca(0x175)]===0x0)return![];if(_0x15db9d[_0xb507ca(0x174)]('\x00'))return![];let _0x1be6c7;try{_0x1be6c7=a2_0x569507['resolve'](a2_0x569507[_0xb507ca(0x17c)](_0x15db9d));}catch{return![];}if(!a2_0x569507['isAbsolute'](_0x1be6c7))throw new Error(_0xb507ca(0x16f));return _0x589d0e['some'](_0x2fa14c=>{const _0x52a4b8=_0xb507ca;if(typeof _0x2fa14c!==_0x52a4b8(0x17a)||!_0x2fa14c)return![];if(_0x2fa14c[_0x52a4b8(0x174)]('\x00'))return![];let _0x435857;try{_0x435857=a2_0x569507[_0x52a4b8(0x17e)](a2_0x569507[_0x52a4b8(0x17c)](_0x2fa14c));}catch{return![];}if(!a2_0x569507[_0x52a4b8(0x16c)](_0x435857))throw new Error(_0x52a4b8(0x17f));if(_0x1be6c7===_0x435857)return!![];if(_0x435857===a2_0x569507[_0x52a4b8(0x17d)])return _0x1be6c7[_0x52a4b8(0x17b)](a2_0x569507['sep']);return _0x1be6c7[_0x52a4b8(0x17b)](_0x435857+a2_0x569507[_0x52a4b8(0x17d)]);});}function a2_0xacbd(){const _0x23ab0b=['1782954jQHapO','1708242EYaKds','7cijajU','8nJTRCC','includes','length','2530CxBkYN','528170cQgQXH','2248356nAabpP','78398ghkohz','string','startsWith','normalize','sep','resolve','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','2715624mUiDtn','18xMVVfB','isArray','isAbsolute','2812AGNKfN','22SuJcxJ','Path\x20must\x20be\x20absolute\x20after\x20normalization'];a2_0xacbd=function(){return _0x23ab0b;};return a2_0xacbd();}
1
+ function a2_0x540a(_0x599029,_0x284df5){_0x599029=_0x599029-0x1db;const _0x135030=a2_0x1350();let _0x540a9f=_0x135030[_0x599029];return _0x540a9f;}(function(_0x5c668e,_0x20009a){const _0x2bc7d8=a2_0x540a,_0x2d2b3d=_0x5c668e();while(!![]){try{const _0x2d407e=-parseInt(_0x2bc7d8(0x1e2))/0x1+parseInt(_0x2bc7d8(0x1e9))/0x2+parseInt(_0x2bc7d8(0x1dd))/0x3+parseInt(_0x2bc7d8(0x1e6))/0x4+parseInt(_0x2bc7d8(0x1e4))/0x5*(parseInt(_0x2bc7d8(0x1e8))/0x6)+-parseInt(_0x2bc7d8(0x1dc))/0x7+-parseInt(_0x2bc7d8(0x1db))/0x8*(parseInt(_0x2bc7d8(0x1e1))/0x9);if(_0x2d407e===_0x20009a)break;else _0x2d2b3d['push'](_0x2d2b3d['shift']());}catch(_0x5bf977){_0x2d2b3d['push'](_0x2d2b3d['shift']());}}}(a2_0x1350,0xed623));import a2_0x321162 from'path';function a2_0x1350(){const _0x347fd8=['string','length','18HJfNjt','272203omkSkt','normalize','143860VidChb','some','2229024MytiSH','resolve','216ZEawOS','2432000fZhosO','isAbsolute','sep','7875472sxzwPe','9224705gjoMfq','5166483FPgKNn','includes'];a2_0x1350=function(){return _0x347fd8;};return a2_0x1350();}export function isPathWithinAllowedDirectories(_0x19a2bb,_0x271684){const _0x5b90ce=a2_0x540a;if(typeof _0x19a2bb!==_0x5b90ce(0x1df)||!Array['isArray'](_0x271684))return![];if(!_0x19a2bb||_0x271684[_0x5b90ce(0x1e0)]===0x0)return![];if(_0x19a2bb[_0x5b90ce(0x1de)]('\x00'))return![];let _0x3ba04a;try{_0x3ba04a=a2_0x321162[_0x5b90ce(0x1e7)](a2_0x321162['normalize'](_0x19a2bb));}catch{return![];}if(!a2_0x321162['isAbsolute'](_0x3ba04a))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x271684[_0x5b90ce(0x1e5)](_0x2890a2=>{const _0x3861d9=_0x5b90ce;if(typeof _0x2890a2!==_0x3861d9(0x1df)||!_0x2890a2)return![];if(_0x2890a2[_0x3861d9(0x1de)]('\x00'))return![];let _0xfb655;try{_0xfb655=a2_0x321162[_0x3861d9(0x1e7)](a2_0x321162[_0x3861d9(0x1e3)](_0x2890a2));}catch{return![];}if(!a2_0x321162[_0x3861d9(0x1ea)](_0xfb655))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x3ba04a===_0xfb655)return!![];if(_0xfb655===a2_0x321162['sep'])return _0x3ba04a['startsWith'](a2_0x321162[_0x3861d9(0x1eb)]);return _0x3ba04a['startsWith'](_0xfb655+a2_0x321162['sep']);});}
@@ -1 +1 @@
1
- function a3_0x5040(_0x3fe68e,_0x4dfd0f){_0x3fe68e=_0x3fe68e-0x128;const _0xefa0cf=a3_0xefa0();let _0x504091=_0xefa0cf[_0x3fe68e];return _0x504091;}(function(_0x11977c,_0x147d31){const _0x1b95b7=a3_0x5040,_0xba9f60=_0x11977c();while(!![]){try{const _0xb86ec7=parseInt(_0x1b95b7(0x13b))/0x1+-parseInt(_0x1b95b7(0x139))/0x2+parseInt(_0x1b95b7(0x12c))/0x3+-parseInt(_0x1b95b7(0x12e))/0x4*(parseInt(_0x1b95b7(0x12a))/0x5)+-parseInt(_0x1b95b7(0x131))/0x6*(parseInt(_0x1b95b7(0x129))/0x7)+parseInt(_0x1b95b7(0x13f))/0x8*(-parseInt(_0x1b95b7(0x140))/0x9)+-parseInt(_0x1b95b7(0x136))/0xa*(-parseInt(_0x1b95b7(0x12f))/0xb);if(_0xb86ec7===_0x147d31)break;else _0xba9f60['push'](_0xba9f60['shift']());}catch(_0x2d3303){_0xba9f60['push'](_0xba9f60['shift']());}}}(a3_0xefa0,0xa4590));import{promises as a3_0x3e4b97}from'fs';import a3_0x2e1c94 from'path';import a3_0x732bd0 from'os';import{normalizePath}from'./path-utils.js';function a3_0xefa0(){const _0x368632=['join','stat','17760440ZRYJpH','slice','push','981790IFETIN','Skipping\x20invalid\x20directory:\x20','478013qLGJFh','isDirectory','file://','uri','5584FlUtSm','3951eIwPef','Skipping\x20','7OBewjm','3688370luKqry','error','2073057JlVRfW','non-directory\x20root','4WQngVZ','11MjvlCj','realpath','4421502rVDeoc','\x20due\x20to\x20error:\x20','resolve'];a3_0xefa0=function(){return _0x368632;};return a3_0xefa0();}async function parseRootUri(_0x3fd90f){const _0x1ab21f=a3_0x5040;try{const _0x17fbf5=_0x3fd90f['startsWith'](_0x1ab21f(0x13d))?_0x3fd90f[_0x1ab21f(0x137)](0x7):_0x3fd90f,_0x323560=_0x17fbf5['startsWith']('~/')||_0x17fbf5==='~'?a3_0x2e1c94[_0x1ab21f(0x134)](a3_0x732bd0['homedir'](),_0x17fbf5[_0x1ab21f(0x137)](0x1)):_0x17fbf5,_0xfb3484=a3_0x2e1c94[_0x1ab21f(0x133)](_0x323560),_0x2b1e56=await a3_0x3e4b97[_0x1ab21f(0x130)](_0xfb3484);return normalizePath(_0x2b1e56);}catch{return null;}}function formatDirectoryError(_0x35bd2f,_0x4c53b0,_0x39d9bf){const _0x525e93=a3_0x5040;if(_0x39d9bf)return _0x525e93(0x128)+_0x39d9bf+':\x20'+_0x35bd2f;const _0x298f3e=_0x4c53b0 instanceof Error?_0x4c53b0['message']:String(_0x4c53b0);return _0x525e93(0x13a)+_0x35bd2f+_0x525e93(0x132)+_0x298f3e;}export async function getValidRootDirectories(_0x5c9109){const _0x1a2fd6=a3_0x5040,_0x2c201c=[];for(const _0x30d2dc of _0x5c9109){const _0x58186a=await parseRootUri(_0x30d2dc['uri']);if(!_0x58186a){console['error'](formatDirectoryError(_0x30d2dc[_0x1a2fd6(0x13e)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x1e4342=await a3_0x3e4b97[_0x1a2fd6(0x135)](_0x58186a);_0x1e4342[_0x1a2fd6(0x13c)]()?_0x2c201c[_0x1a2fd6(0x138)](_0x58186a):console[_0x1a2fd6(0x12b)](formatDirectoryError(_0x58186a,undefined,_0x1a2fd6(0x12d)));}catch(_0x56407a){console[_0x1a2fd6(0x12b)](formatDirectoryError(_0x58186a,_0x56407a));}}return _0x2c201c;}
1
+ (function(_0x47e711,_0x141b08){const _0x53c496=a3_0x5a17,_0xb5f600=_0x47e711();while(!![]){try{const _0x5951a6=parseInt(_0x53c496(0x1b2))/0x1*(-parseInt(_0x53c496(0x1ae))/0x2)+parseInt(_0x53c496(0x1a3))/0x3+-parseInt(_0x53c496(0x1b1))/0x4+-parseInt(_0x53c496(0x1a0))/0x5*(parseInt(_0x53c496(0x19f))/0x6)+-parseInt(_0x53c496(0x1b3))/0x7+-parseInt(_0x53c496(0x1a9))/0x8+parseInt(_0x53c496(0x1a1))/0x9;if(_0x5951a6===_0x141b08)break;else _0xb5f600['push'](_0xb5f600['shift']());}catch(_0x1ccd59){_0xb5f600['push'](_0xb5f600['shift']());}}}(a3_0x1628,0xde036));import{promises as a3_0x77f28a}from'fs';import a3_0x1cecc3 from'path';function a3_0x1628(){const _0x2ad4f9=['14UTuNhW','homedir','resolve','3316924SmUYBc','153860Fifnfy','7997556tJjRxe','Skipping\x20','Skipping\x20invalid\x20directory:\x20','6dRewTI','605340DMEMUx','40199805RsTLxk','error','1574706kQbKOd','uri','invalid\x20path\x20or\x20inaccessible','startsWith','realpath','message','7298832KBaVZM','file://','non-directory\x20root','slice','isDirectory'];a3_0x1628=function(){return _0x2ad4f9;};return a3_0x1628();}import a3_0x29410c from'os';import{normalizePath}from'./path-utils.js';function a3_0x5a17(_0x5f14cc,_0x3c35e6){_0x5f14cc=_0x5f14cc-0x19e;const _0x1628ea=a3_0x1628();let _0x5a176e=_0x1628ea[_0x5f14cc];return _0x5a176e;}async function parseRootUri(_0x4d750b){const _0x44ee96=a3_0x5a17;try{const _0x5a9090=_0x4d750b[_0x44ee96(0x1a6)](_0x44ee96(0x1aa))?_0x4d750b[_0x44ee96(0x1ac)](0x7):_0x4d750b,_0x518386=_0x5a9090[_0x44ee96(0x1a6)]('~/')||_0x5a9090==='~'?a3_0x1cecc3['join'](a3_0x29410c[_0x44ee96(0x1af)](),_0x5a9090[_0x44ee96(0x1ac)](0x1)):_0x5a9090,_0x3bc43c=a3_0x1cecc3[_0x44ee96(0x1b0)](_0x518386),_0x5e0877=await a3_0x77f28a[_0x44ee96(0x1a7)](_0x3bc43c);return normalizePath(_0x5e0877);}catch{return null;}}function formatDirectoryError(_0x23cfe5,_0x516f72,_0x2dfe55){const _0x160f00=a3_0x5a17;if(_0x2dfe55)return _0x160f00(0x1b4)+_0x2dfe55+':\x20'+_0x23cfe5;const _0x52a9e9=_0x516f72 instanceof Error?_0x516f72[_0x160f00(0x1a8)]:String(_0x516f72);return _0x160f00(0x19e)+_0x23cfe5+'\x20due\x20to\x20error:\x20'+_0x52a9e9;}export async function getValidRootDirectories(_0x2dadbd){const _0x4f0d0b=a3_0x5a17,_0x32d0dc=[];for(const _0xc766d8 of _0x2dadbd){const _0x130216=await parseRootUri(_0xc766d8[_0x4f0d0b(0x1a4)]);if(!_0x130216){console['error'](formatDirectoryError(_0xc766d8[_0x4f0d0b(0x1a4)],undefined,_0x4f0d0b(0x1a5)));continue;}try{const _0x52c47a=await a3_0x77f28a['stat'](_0x130216);_0x52c47a[_0x4f0d0b(0x1ad)]()?_0x32d0dc['push'](_0x130216):console[_0x4f0d0b(0x1a2)](formatDirectoryError(_0x130216,undefined,_0x4f0d0b(0x1ab)));}catch(_0x12a2fe){console[_0x4f0d0b(0x1a2)](formatDirectoryError(_0x130216,_0x12a2fe));}}return _0x32d0dc;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.52",
3
+ "version": "0.8.54",
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.81",
38
+ "@morphllm/morphsdk": "0.2.82",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",