@morphllm/morphmcp 0.8.47 → 0.8.51

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
@@ -30,7 +30,8 @@ Add to `.cursor/mcp.json`:
30
30
  "command": "npx",
31
31
  "args": ["-y", "@morphllm/morphmcp"],
32
32
  "env": {
33
- "MORPH_API_KEY": "sk-xxx"
33
+ "MORPH_API_KEY": "sk-xxx",
34
+ "ENABLED_TOOLS": "warpgrep_codebase_search"
34
35
  }
35
36
  }
36
37
  }
@@ -49,7 +50,8 @@ Add to `.vscode/mcp.json`:
49
50
  "command": "npx",
50
51
  "args": ["-y", "@morphllm/morphmcp"],
51
52
  "env": {
52
- "MORPH_API_KEY": "sk-xxx"
53
+ "MORPH_API_KEY": "sk-xxx",
54
+ "ENABLED_TOOLS": "edit_file,warpgrep_codebase_search"
53
55
  }
54
56
  }
55
57
  }
@@ -126,3 +128,5 @@ ENABLED_TOOLS=warpgrep_codebase_search
126
128
  ## License
127
129
 
128
130
  MIT
131
+
132
+ <!-- Published with npm Trusted Publishing -->
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x3d32fb=a0_0x4919;(function(_0x492814,_0x185d46){const _0x151443=a0_0x4919,_0x536c0b=_0x492814();while(!![]){try{const _0x52f97e=parseInt(_0x151443(0xe7))/0x1*(parseInt(_0x151443(0x11c))/0x2)+-parseInt(_0x151443(0x177))/0x3*(-parseInt(_0x151443(0x114))/0x4)+-parseInt(_0x151443(0x174))/0x5*(parseInt(_0x151443(0xff))/0x6)+parseInt(_0x151443(0x102))/0x7+-parseInt(_0x151443(0x15d))/0x8*(parseInt(_0x151443(0x97))/0x9)+parseInt(_0x151443(0x95))/0xa+-parseInt(_0x151443(0xb5))/0xb*(-parseInt(_0x151443(0xaf))/0xc);if(_0x52f97e===_0x185d46)break;else _0x536c0b['push'](_0x536c0b['shift']());}catch(_0x114e94){_0x536c0b['push'](_0x536c0b['shift']());}}}(a0_0x5bc9,0x1c27d));function a0_0x5bc9(){const _0x30ad52=['WORKSPACE_ROOT','Bearer\x20','commitHash','Error\x20accessing\x20directory\x20','messages','argv','Natural\x20language\x20query\x20to\x20search\x20for\x20code','Preview\x20changes\x20without\x20applying\x20them.','runWarpGrep_call','rerankScore','\x22>\x0aError\x20reading\x20file:\x20','params','12SgOAAO','list_directory\x20','optional','unknown','default','homedir','3738218fncHvr','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','tsconfig.json','PWD','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','-\x20Grepped\x20\x27','Benefits:\x0a','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','apply\x20these\x20changes','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','resolve','MORPH_API_KEY','length','message','Successfully\x20','substring','trim','requiresApiKey','ENABLED_TOOLS','includes','filepath','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','lines','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','stringify','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','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','constructor','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20is\x20not\x20a\x20directory','Applied','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','.vscode','all','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','morph-warp-grep-v1-1111v0','grep\x20\x27','realpath','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','number','morph-mcp','setRequestHandler','udiff','text','etimedout','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','timeout','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','UnknownError','MORPH_API_URL','113TIswbs','%\x20match)\x0a','TimeoutError','\x0a</file>','🔍\x20Morph\x20Edit\x20Preview','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','Cargo.toml','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','Unknown\x20tool:\x20','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','connect','filter','created','Search\x20failed:\x20','Found\x20','.cursor','Rules:\x0a','Warning:\x20','stats','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','❌\x20Morph\x20Edit\x20Failed:\x20','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','name','Morph\x20Edit\x20','6oQwFwE','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','diff\x0a','184856rdbnte','ENABLE_WORKSPACE_MODE','utf-8','toISOString','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','terminated','repo_path','Warning:\x20Workspace\x20fallback\x20failed:\x20','.git','Failed\x20to\x20read\x20file:\x20','branch','readFile','applied\x20edits\x20to','catch','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','files','-\x20Listed\x20directory\x20`','12xcomyM','...','\x20as\x20allowed\x20directory','string','search_string','Failed\x20to\x20request\x20roots\x20from\x20client:','split','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','542dRwyAM','push','describe','pyproject.toml','Enabled\x20tools:\x20','env','ms:\x0a\x0a','dirname','getClientCapabilities','error','composer.json','No\x20results\x20found\x20for\x20query:\x20\x22','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','post','errors','boolean','listRoots','warpgrep_codebase_search','0.2.0','endLine','dryRun','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','inputSchema','toLowerCase','false','role','WarpGrepError','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','normalize','code_edit','edit_file','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.','Invalid\x20arguments:\x20','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Error:\x20','object','unknown\x20error','\x27\x20in\x20`','<file\x20path=\x22','timed\x20out','mcp-filesystem','code','assistant','source','Error\x20running\x20fast\x20context\x20search:\x20','join','</file>','path','map','ENOENT','metadata','\x0a...\x20(truncated,\x20total:\x20','exit','instruction','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','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','repeat','Workspace\x20mode\x20enabled:\x20Using\x20','match','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x20\x20\x20','roots','Parent\x20directory\x20does\x20not\x20exist:\x20','772808cofGGS','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','Max\x20results\x20to\x20return','\x20(new\x20file)','description','Repository\x20identifier','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','startsWith','Created\x20File','limit','oninitialized','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','\x20\x20\x20Lines\x20','File\x20read\x20error:','basename','codebase_search','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','\x20chars)','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','stack','finish','1084535Wvcmsi','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','For\x20deletions:\x0a','41916zzjYjS','terminationReason','success','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','content','query','cwd','FileReadError','866490tkqjwL','Fatal\x20error\x20running\x20server:','18PGCGsf','\x20results\x20in\x20','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','startLine','access','Specific\x20commit\x20hash\x20to\x20search','slice','data','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','-\x20Read\x20file\x20`','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','repoId'];a0_0x5bc9=function(){return _0x30ad52;};return a0_0x5bc9();}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_0x3970a5 from'fs/promises';import a0_0x54f756 from'path';import a0_0x15500f from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x3a3a93 from'axios';const args=process[a0_0x3d32fb(0xa8)]['slice'](0x2),ALL_TOOLS=[a0_0x3d32fb(0x13b),a0_0x3d32fb(0x12d),a0_0x3d32fb(0x16e)],DEFAULT_TOOLS=[a0_0x3d32fb(0x13b),a0_0x3d32fb(0x12d)],ENABLED_TOOLS=process[a0_0x3d32fb(0x121)]['ENABLED_TOOLS']?process['env'][a0_0x3d32fb(0xc7)]==='all'?ALL_TOOLS:process[a0_0x3d32fb(0x121)][a0_0x3d32fb(0xc7)]['split'](',')[a0_0x3d32fb(0x14d)](_0x4f36c4=>_0x4f36c4[a0_0x3d32fb(0xc5)]()):DEFAULT_TOOLS;console[a0_0x3d32fb(0x125)](a0_0x3d32fb(0x120)+ENABLED_TOOLS[a0_0x3d32fb(0x14a)](',\x20'));const WORKSPACE_ROOT=process[a0_0x3d32fb(0x121)][a0_0x3d32fb(0xa3)]||process[a0_0x3d32fb(0x121)][a0_0x3d32fb(0xb8)]||process[a0_0x3d32fb(0x17d)](),ENABLE_WORKSPACE_MODE=process[a0_0x3d32fb(0x121)][a0_0x3d32fb(0x103)]!==a0_0x3d32fb(0x134),MORPH_API_KEY=process[a0_0x3d32fb(0x121)][a0_0x3d32fb(0xc0)],MORPH_API_URL=process['env'][a0_0x3d32fb(0xe6)];MORPH_API_KEY&&!MORPH_API_KEY[a0_0x3d32fb(0x165)]('sk-')&&!MORPH_API_KEY[a0_0x3d32fb(0x165)]('morph-')&&console[a0_0x3d32fb(0x125)]('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x123d6c){const _0x3a9e0a=a0_0x3d32fb;try{await a0_0x3a3a93[_0x3a9e0a(0x129)]('https://morphllm.com/api/error-report',{..._0x123d6c,'timestamp':new Date()[_0x3a9e0a(0x105)](),'source':_0x123d6c[_0x3a9e0a(0x148)]||_0x3a9e0a(0x145)},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x3a9e0a(0xa4)+MORPH_API_KEY}});}catch{}}args[a0_0x3d32fb(0xc1)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x3d32fb(0x125)](a0_0x3d32fb(0xcf)),console[a0_0x3d32fb(0x125)](a0_0x3d32fb(0x154)),console[a0_0x3d32fb(0x125)]('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),console[a0_0x3d32fb(0x125)](a0_0x3d32fb(0xd1)),console[a0_0x3d32fb(0x125)](a0_0x3d32fb(0xb6)),console['error']('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x13b56d){const _0x34ec1b=a0_0x3d32fb;return a0_0x54f756[_0x34ec1b(0x139)](_0x13b56d);}function expandHome(_0x11bfa1){const _0x191abb=a0_0x3d32fb;if(_0x11bfa1['startsWith']('~/')||_0x11bfa1==='~')return a0_0x54f756[_0x191abb(0x14a)](a0_0x15500f[_0x191abb(0xb4)](),_0x11bfa1[_0x191abb(0x9d)](0x1));return _0x11bfa1;}let allowedDirectories=await Promise[a0_0x3d32fb(0xd6)](args[a0_0x3d32fb(0x14d)](async _0x2201b1=>{const _0x3fd464=a0_0x3d32fb,_0x4e23f7=expandHome(_0x2201b1),_0x2a457c=a0_0x54f756[_0x3fd464(0xbf)](_0x4e23f7);try{const _0xae52c7=await a0_0x3970a5['realpath'](_0x2a457c);return normalizePath(_0xae52c7);}catch(_0x49371b){return normalizePath(_0x2a457c);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x3d32fb(0x11d)](workspaceDir),console['error'](a0_0x3d32fb(0x157)+workspaceDir+a0_0x3d32fb(0x116)));}catch(a0_0x15a58a){console['error']('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x15a58a);}function a0_0x4919(_0x2c1f7b,_0x2ee2e2){_0x2c1f7b=_0x2c1f7b-0x94;const _0x5bc95c=a0_0x5bc9();let _0x491944=_0x5bc95c[_0x2c1f7b];return _0x491944;}async function detectWorkspaceRoot(_0x524baf){const _0x2bd29e=a0_0x3d32fb;let _0x514b5b=a0_0x54f756['resolve'](_0x524baf);const _0x362b93=[_0x2bd29e(0x10a),_0x2bd29e(0xd5),'package.json',_0x2bd29e(0xed),_0x2bd29e(0x11f),'go.mod',_0x2bd29e(0xf6),_0x2bd29e(0xb7),_0x2bd29e(0x126)];while(_0x514b5b!==a0_0x54f756[_0x2bd29e(0x123)](_0x514b5b)){for(const _0x1c1bcf of _0x362b93){const _0x4a94cb=a0_0x54f756[_0x2bd29e(0x14a)](_0x514b5b,_0x1c1bcf);try{return await a0_0x3970a5[_0x2bd29e(0x9b)](_0x4a94cb),normalizePath(_0x514b5b);}catch{}}_0x514b5b=a0_0x54f756[_0x2bd29e(0x123)](_0x514b5b);}return normalizePath(_0x524baf);}await Promise['all'](args[a0_0x3d32fb(0x14d)](async _0x525af8=>{const _0x12c9a7=a0_0x3d32fb;try{const _0x5111b1=await a0_0x3970a5['stat'](expandHome(_0x525af8));!_0x5111b1['isDirectory']()&&(console[_0x12c9a7(0x125)](_0x12c9a7(0x13f)+_0x525af8+_0x12c9a7(0xd2)),process[_0x12c9a7(0x151)](0x1));}catch(_0x4061e9){console['error'](_0x12c9a7(0xa6)+_0x525af8+':',_0x4061e9),process[_0x12c9a7(0x151)](0x1);}}));async function validatePath(_0x4fc43d){const _0x42e116=a0_0x3d32fb,_0x52d1c6=expandHome(_0x4fc43d),_0x3b5ecd=a0_0x54f756[_0x42e116(0xbf)](_0x52d1c6);try{const _0x5e7a0f=await a0_0x3970a5['realpath'](_0x3b5ecd);return _0x5e7a0f;}catch(_0x237336){if(_0x237336['code']===_0x42e116(0x14e)){const _0x11158d=a0_0x54f756[_0x42e116(0x123)](_0x3b5ecd);try{const _0xbb0781=await a0_0x3970a5[_0x42e116(0xda)](_0x11158d);return a0_0x54f756[_0x42e116(0x14a)](_0xbb0781,a0_0x54f756[_0x42e116(0x16d)](_0x3b5ecd));}catch{throw new Error(_0x42e116(0x15c)+_0x11158d);}}throw _0x237336;}}const MorphEditFileArgsSchema=z[a0_0x3d32fb(0x140)]({'path':z['string'](),'code_edit':z['string']()[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0x13e)),'instruction':z[a0_0x3d32fb(0x117)]()[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0x175)),'dryRun':z[a0_0x3d32fb(0x12b)]()[a0_0x3d32fb(0xb3)](![])['describe'](a0_0x3d32fb(0xaa))}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x3d32fb(0x117)]()[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0x138)),'repo_path':z[a0_0x3d32fb(0x117)]()['describe']('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos')}),CodebaseSearchArgsSchema=z[a0_0x3d32fb(0x140)]({'query':z[a0_0x3d32fb(0x117)]()['describe'](a0_0x3d32fb(0xa9)),'repoId':z[a0_0x3d32fb(0x117)]()['describe'](a0_0x3d32fb(0x163)),'branch':z[a0_0x3d32fb(0x117)]()[a0_0x3d32fb(0xb1)]()[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0x99)),'commitHash':z[a0_0x3d32fb(0x117)]()['optional']()[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0x9c)),'target_directories':z['array'](z['string']())[a0_0x3d32fb(0xb3)]([])[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0xfa)),'limit':z[a0_0x3d32fb(0xdc)]()[a0_0x3d32fb(0xb1)]()[a0_0x3d32fb(0xb3)](0xa)[a0_0x3d32fb(0x11e)](a0_0x3d32fb(0x160))}),server=new Server({'name':a0_0x3d32fb(0xdd),'version':a0_0x3d32fb(0x12e)},{'capabilities':{'tools':{}}});server[a0_0x3d32fb(0xde)](ListToolsRequestSchema,async()=>{const _0x423734=a0_0x3d32fb,_0x2ed34f=[{'name':'edit_file','description':_0x423734(0x164)+_0x423734(0x11b)+_0x423734(0x16f)+_0x423734(0x110)+_0x423734(0xbb)+_0x423734(0x171)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x423734(0x128)+_0x423734(0xf0)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x423734(0x15e)+_0x423734(0x176)+_0x423734(0xdb)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x423734(0xf7)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x423734(0x16a)+_0x423734(0x155)+_0x423734(0x100)+_0x423734(0x106)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x423734(0x153),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x423734(0x12d),'description':'A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20'+'This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20'+_0x423734(0xce)+_0x423734(0xec)+_0x423734(0x169)+_0x423734(0xee)+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':_0x423734(0x16e),'description':_0x423734(0xcc)+_0x423734(0x17a)+_0x423734(0x15f)+_0x423734(0xbb)+_0x423734(0x111)+_0x423734(0x9f)+_0x423734(0xbe)+'-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a'+_0x423734(0xfc)+_0x423734(0xd7)+'Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0xe5f7a0=_0x2ed34f[_0x423734(0xf2)](_0x4a0136=>{const _0x4a49f6=_0x423734;if(!ENABLED_TOOLS[_0x4a49f6(0xc8)](_0x4a0136[_0x4a49f6(0xfd)]))return![];if(_0x4a49f6(0xc6)in _0x4a0136&&_0x4a0136[_0x4a49f6(0xc6)]&&!MORPH_API_KEY)return console[_0x4a49f6(0x125)](_0x4a49f6(0xf8)+_0x4a0136['name']+_0x4a49f6(0xa1)),![];return!![];});return{'tools':_0xe5f7a0[_0x423734(0x14d)](_0x3b239d=>({'name':_0x3b239d[_0x423734(0xfd)],'description':_0x3b239d[_0x423734(0x162)],'inputSchema':_0x3b239d[_0x423734(0x132)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x358f51=>{const _0xa8c2b8=a0_0x3d32fb;try{const {name:_0xf604a6,arguments:_0x3286e4}=_0x358f51[_0xa8c2b8(0xae)];switch(_0xf604a6){case _0xa8c2b8(0x13b):{const _0x25ef42=MorphEditFileArgsSchema['safeParse'](_0x3286e4);if(!_0x25ef42[_0xa8c2b8(0x179)])throw new Error(_0xa8c2b8(0xca)+_0x25ef42[_0xa8c2b8(0x125)]);const _0x1d73c6=await validatePath(_0x25ef42[_0xa8c2b8(0x9e)]['path']);let _0x350ab0=null,_0x4f3b43=!![],_0x7383e3=null;try{_0x350ab0=await a0_0x3970a5[_0xa8c2b8(0x10d)](_0x1d73c6,_0xa8c2b8(0x104));}catch(_0x2e6387){const _0x5737b1=_0x2e6387[_0xa8c2b8(0x146)];_0x5737b1==='ENOENT'?(_0x4f3b43=![],_0x350ab0=''):(_0x7383e3=_0xa8c2b8(0x10b)+(_0x5737b1||_0xa8c2b8(0xb2))+'\x20-\x20'+(_0x2e6387 instanceof Error?_0x2e6387[_0xa8c2b8(0xc2)]:String(_0x2e6387)),console[_0xa8c2b8(0x125)](_0xa8c2b8(0xf8)+_0x7383e3));}try{const _0x2dfa5b=MORPH_API_KEY;if(!_0x2dfa5b)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x147139=a0_0x54f756[_0xa8c2b8(0x123)](_0x1d73c6),_0x10e29a=a0_0x54f756[_0xa8c2b8(0x16d)](_0x1d73c6),_0x187252=await executeEditFile({'target_filepath':_0x10e29a,'code_edit':_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x13a)],'instructions':_0x25ef42['data'][_0xa8c2b8(0x152)]},{'morphApiKey':_0x2dfa5b,'morphApiUrl':MORPH_API_URL,'baseDir':_0x147139,'autoWrite':!_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x130)],'generateUdiff':!![],'debug':![]});if(!_0x187252[_0xa8c2b8(0x179)])throw new Error(_0x187252[_0xa8c2b8(0x125)]||_0xa8c2b8(0x137));const _0x308121=_0x187252[_0xa8c2b8(0xdf)]||'';let _0x88967c=0x3;while(_0x308121[_0xa8c2b8(0xc8)]('`'[_0xa8c2b8(0x156)](_0x88967c))){_0x88967c++;}const _0x3dc5fb='`'['repeat'](_0x88967c)+_0xa8c2b8(0x101)+_0x308121+'`'['repeat'](_0x88967c)+'\x0a\x0a';if(_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x130)])return{'content':[{'type':_0xa8c2b8(0xe0),'text':_0xa8c2b8(0xeb)+(_0x4f3b43?'':_0xa8c2b8(0x161))+':\x20'+_0x25ef42['data'][_0xa8c2b8(0x152)]+'\x0a\x0a'+_0x3dc5fb+'Use\x20dryRun=false\x20to\x20'+(_0x4f3b43?_0xa8c2b8(0xbd):'create\x20this\x20file')+'.'}]};return{'content':[{'type':'text','text':_0xa8c2b8(0xfe)+(_0x4f3b43?_0xa8c2b8(0xd3):_0xa8c2b8(0x166))+':\x20'+_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x152)]+'\x0a\x0a'+_0x3dc5fb+_0xa8c2b8(0xc3)+(_0x4f3b43?_0xa8c2b8(0x10e):_0xa8c2b8(0xf3))+'\x20'+_0x25ef42[_0xa8c2b8(0x9e)]['path']}]};}catch(_0x3c0875){const _0x145c7b=_0x3c0875 instanceof Error?_0x3c0875[_0xa8c2b8(0xc2)]:String(_0x3c0875);return reportMorphError({'error_message':_0x145c7b,'error_type':_0x3c0875 instanceof Error?_0x3c0875[_0xa8c2b8(0xd0)][_0xa8c2b8(0xfd)]:'UnknownError','context':{'tool':_0xa8c2b8(0x13b),'file_path':_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x14c)],'validated_path':_0x1d73c6,'instruction':_0x25ef42[_0xa8c2b8(0x9e)]['instruction'],'model':'morph-v3-fast','dry_run':_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x130)],'file_exists':_0x4f3b43,'file_read_error':_0x7383e3,'file_readable':_0x350ab0!==null,'request_content':{'path':_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x14c)],'code_edit':_0x25ef42[_0xa8c2b8(0x9e)]['code_edit'],'instruction':_0x25ef42[_0xa8c2b8(0x9e)][_0xa8c2b8(0x152)],'original_code':_0x350ab0!==null?_0x350ab0[_0xa8c2b8(0xc1)]>0xc350?_0x350ab0['substring'](0x0,0xc350)+_0xa8c2b8(0x150)+_0x350ab0[_0xa8c2b8(0xc1)]+_0xa8c2b8(0x170):_0x350ab0:'[could\x20not\x20read\x20file:\x20'+(_0x7383e3||_0xa8c2b8(0x141))+']','original_code_length':_0x350ab0?.[_0xa8c2b8(0xc1)]??0x0,'model':'morph-v3-fast','dry_run':_0x25ef42['data']['dryRun']}},'stack_trace':_0x3c0875 instanceof Error?_0x3c0875['stack']:undefined,'source':_0xa8c2b8(0x145)})[_0xa8c2b8(0x10f)](()=>{}),{'content':[{'type':'text','text':_0xa8c2b8(0xfb)+_0x145c7b}],'isError':!![]};}}case _0xa8c2b8(0x12d):{const _0xe22275=WarpGrepArgsSchema['safeParse'](_0x3286e4);if(!_0xe22275[_0xa8c2b8(0x179)])return{'content':[{'type':'text','text':_0xa8c2b8(0x13d)+_0xe22275['error']}],'isError':!![]};const _0x47557c=_0x2c330a=>{const _0x365346=_0xa8c2b8,_0x5c2d94=[];for(const _0x17862a of _0x2c330a||[]){const _0x17b6c1=_0x17862a[_0x365346(0x135)],_0x1efb34=_0x17862a[_0x365346(0x17b)];if(_0x17b6c1===_0x365346(0x147)&&_0x1efb34){const _0x49d037=_0x1efb34[_0x365346(0x11a)]('\x0a')[_0x365346(0xf2)](_0x4fcb23=>_0x4fcb23[_0x365346(0xc5)]());for(const _0x33d81c of _0x49d037){const _0x1040c4=_0x33d81c[_0x365346(0x158)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1040c4){_0x5c2d94[_0x365346(0x11d)](_0x365346(0xd9)+_0x1040c4[0x1]+'\x27\x20'+_0x1040c4[0x2]);continue;}const _0x22ac94=_0x33d81c[_0x365346(0x158)](/^read\s+(.+)$/);if(_0x22ac94){_0x5c2d94['push']('read\x20'+_0x22ac94[0x1]);continue;}const _0x513e54=_0x33d81c[_0x365346(0x158)](/^list_directory\s+(.+)$/);if(_0x513e54){_0x5c2d94[_0x365346(0x11d)](_0x365346(0xb0)+_0x513e54[0x1]);continue;}}}}return _0x5c2d94;};try{const _0x2ddd09=a0_0x54f756['resolve'](_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)]),_0x5b949a=new LocalRipgrepProvider(_0x2ddd09),_0x4927f7=await runWarpGrep({'query':_0xe22275['data'][_0xa8c2b8(0x118)],'repoRoot':_0x2ddd09,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'provider':_0x5b949a});let _0x5812ca='';if(_0x4927f7[_0xa8c2b8(0x178)]==='completed'&&_0x4927f7['finish']?.[_0xa8c2b8(0x14f)]?.[_0xa8c2b8(0x112)]){const _0x2daa31=_0x4927f7[_0xa8c2b8(0x173)][_0xa8c2b8(0x14f)]['files'],_0x2ba491=[],_0x5e1c7d=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x558571 of _0x4927f7[_0xa8c2b8(0xa7)]){const _0x3f4fa1=_0x558571[_0xa8c2b8(0x135)],_0x161f1a=_0x558571['content'];if(_0x3f4fa1===_0xa8c2b8(0x147)&&_0x161f1a){const _0x6f1969=_0x161f1a['split']('\x0a')[_0xa8c2b8(0xf2)](_0x15af4a=>_0x15af4a[_0xa8c2b8(0xc5)]());for(const _0x2731f0 of _0x6f1969){const _0x355898=_0x2731f0[_0xa8c2b8(0x158)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x355898){_0x5e1c7d['push'](_0xa8c2b8(0xba)+_0x355898[0x1]+_0xa8c2b8(0x142)+_0x355898[0x2]+'`');continue;}const _0x451ab5=_0x2731f0['match'](/^read\s+(.+)$/);if(_0x451ab5){_0x5e1c7d[_0xa8c2b8(0x11d)](_0xa8c2b8(0xa0)+_0x451ab5[0x1]+'`');continue;}const _0x5445f8=_0x2731f0[_0xa8c2b8(0x158)](/^list_directory\s+(.+)$/);if(_0x5445f8){_0x5e1c7d['push'](_0xa8c2b8(0x113)+_0x5445f8[0x1]+'`');continue;}}}}_0x2ba491[_0xa8c2b8(0x11d)](_0x5e1c7d[_0xa8c2b8(0x14a)]('\x0a'));const _0xb6d4c5=['','Relevant\x20context\x20found:'];for(const _0x5ef8f3 of _0x2daa31){if(_0x5ef8f3[_0xa8c2b8(0xcb)]==='*')_0xb6d4c5['push']('-\x20'+_0x5ef8f3['path']+':*');else{if(Array['isArray'](_0x5ef8f3[_0xa8c2b8(0xcb)])){const _0x5d9b30=_0x5ef8f3[_0xa8c2b8(0xcb)][_0xa8c2b8(0x14d)](([_0x435e98,_0x1493a3])=>{if(_0x435e98===_0x1493a3)return''+_0x435e98;return _0x435e98+'-'+_0x1493a3;});_0xb6d4c5[_0xa8c2b8(0x11d)]('-\x20'+_0x5ef8f3[_0xa8c2b8(0x14c)]+':'+_0x5d9b30[_0xa8c2b8(0x14a)](','));}else _0xb6d4c5[_0xa8c2b8(0x11d)]('-\x20'+_0x5ef8f3['path']+':*');}}_0xb6d4c5['push'](''),_0x2ba491[_0xa8c2b8(0x11d)](_0xb6d4c5['join']('\x0a')),_0x2ba491['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x46ce43=[];for(const _0x1f6370 of _0x2daa31){const _0x1c5a44=a0_0x54f756[_0xa8c2b8(0xbf)](_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)],_0x1f6370[_0xa8c2b8(0x14c)]);try{const _0x1a8379=await a0_0x3970a5['readFile'](_0x1c5a44,{'encoding':'utf-8'}),_0x5eafaf=_0x1a8379['split'](/\r?\n/),_0x537f4d=[_0xa8c2b8(0x143)+_0x1f6370['path']+'\x22>'];if(_0x1f6370[_0xa8c2b8(0xcb)]==='*'||!Array['isArray'](_0x1f6370[_0xa8c2b8(0xcb)]))for(let _0x570a27=0x1;_0x570a27<=_0x5eafaf[_0xa8c2b8(0xc1)];_0x570a27++){const _0x1926ed=_0x5eafaf[_0x570a27-0x1];_0x537f4d[_0xa8c2b8(0x11d)](_0x570a27+'|\x20'+_0x1926ed);}else for(const [_0x250dab,_0x3e5747]of _0x1f6370[_0xa8c2b8(0xcb)]){_0x537f4d[_0xa8c2b8(0xc1)]>0x1&&_0x537f4d[_0xa8c2b8(0x11d)]('');for(let _0x4b2880=_0x250dab;_0x4b2880<=_0x3e5747&&_0x4b2880<=_0x5eafaf[_0xa8c2b8(0xc1)];_0x4b2880++){const _0x36f917=_0x5eafaf[_0x4b2880-0x1];_0x537f4d['push'](_0x4b2880+'|\x20'+_0x36f917);}}_0x537f4d['push'](_0xa8c2b8(0x14b)),_0x46ce43[_0xa8c2b8(0x11d)](_0x537f4d[_0xa8c2b8(0x14a)]('\x0a'));}catch(_0x5e220b){_0x46ce43[_0xa8c2b8(0x11d)](_0xa8c2b8(0x143)+_0x1f6370[_0xa8c2b8(0x14c)]+_0xa8c2b8(0xad)+(_0x5e220b instanceof Error?_0x5e220b[_0xa8c2b8(0xc2)]:String(_0x5e220b))+_0xa8c2b8(0xea));}}_0x2ba491['push'](_0x46ce43['join']('\x0a\x0a')),_0x5812ca=_0x2ba491[_0xa8c2b8(0x14a)]('\x0a');const _0x572137=_0x4927f7['errors']?.[_0xa8c2b8(0xf2)](_0x28a97f=>_0x28a97f[_0xa8c2b8(0xc2)]?.[_0xa8c2b8(0x165)](_0xa8c2b8(0x16c)))||[];if(_0x572137[_0xa8c2b8(0xc1)]>0x0){const _0x2f7667=_0x572137[_0xa8c2b8(0x14d)](_0x36c697=>_0x36c697['message'])[_0xa8c2b8(0x14a)](';\x20');reportMorphError({'error_message':_0x2f7667,'error_type':_0xa8c2b8(0x94),'context':{'tool':_0xa8c2b8(0x12d),'repo_path':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)],'query':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x118)],'model':_0xa8c2b8(0xd8),'termination_reason':'completed_with_file_errors','error_count':_0x572137['length'],'is_timeout':![],'files_attempted':_0x2daa31[_0xa8c2b8(0x14d)](_0x24bdad=>({'path':_0x24bdad[_0xa8c2b8(0x14c)],'lines':_0x24bdad[_0xa8c2b8(0xcb)]})),'tool_calls':_0x47557c(_0x4927f7[_0xa8c2b8(0xa7)]),'messages':_0x4927f7[_0xa8c2b8(0xa7)]?.[_0xa8c2b8(0x14d)](_0x437fa7=>({'role':_0x437fa7[_0xa8c2b8(0x135)],'content':_0x437fa7['content']})),'request_content':{'query':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x118)],'repo_path':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)],'repoRoot':a0_0x54f756[_0xa8c2b8(0xbf)](_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)]),'model':_0xa8c2b8(0xd8)}},'source':_0xa8c2b8(0x145)})['catch'](()=>{});}}else{if(_0x4927f7[_0xa8c2b8(0x178)]===_0xa8c2b8(0x107)&&_0x4927f7[_0xa8c2b8(0x12a)][_0xa8c2b8(0xc1)]>0x0){const _0x291d55=_0x4927f7[_0xa8c2b8(0x12a)][_0xa8c2b8(0x14d)](_0x236f5b=>_0x236f5b[_0xa8c2b8(0xc2)])['join'](';\x20');_0x5812ca='Error:\x20'+_0x291d55;const _0x329199=_0x291d55[_0xa8c2b8(0x133)]()[_0xa8c2b8(0xc8)](_0xa8c2b8(0xe3))||_0x291d55[_0xa8c2b8(0x133)]()[_0xa8c2b8(0xc8)](_0xa8c2b8(0x144))||_0x291d55[_0xa8c2b8(0x133)]()[_0xa8c2b8(0xc8)]('etimedout'),_0x3d5959=_0x4927f7[_0xa8c2b8(0x173)]?.[_0xa8c2b8(0x14f)]?.['files'],_0x3680e3=_0x4927f7[_0xa8c2b8(0x12a)][0x0];reportMorphError({'error_message':_0x291d55,'error_type':_0x329199?_0xa8c2b8(0xe9):_0x3680e3?.['constructor']?.['name']||_0xa8c2b8(0x136),'context':{'tool':_0xa8c2b8(0x12d),'repo_path':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)],'query':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x118)],'model':_0xa8c2b8(0xd8),'termination_reason':_0x4927f7[_0xa8c2b8(0x178)],'error_count':_0x4927f7[_0xa8c2b8(0x12a)][_0xa8c2b8(0xc1)],'is_timeout':_0x329199,'files_attempted':_0x3d5959?.[_0xa8c2b8(0x14d)](_0x395897=>({'path':_0x395897[_0xa8c2b8(0x14c)],'lines':_0x395897[_0xa8c2b8(0xcb)]})),'tool_calls':_0x47557c(_0x4927f7[_0xa8c2b8(0xa7)]),'messages':_0x4927f7[_0xa8c2b8(0xa7)]?.['map'](_0x5a6635=>({'role':_0x5a6635[_0xa8c2b8(0x135)],'content':_0x5a6635[_0xa8c2b8(0x17b)]})),'request_content':{'query':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x118)],'repo_path':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)],'repoRoot':a0_0x54f756[_0xa8c2b8(0xbf)](_0xe22275[_0xa8c2b8(0x9e)]['repo_path']),'model':_0xa8c2b8(0xd8)}},'stack_trace':_0x3680e3?.['stack']||undefined,'source':_0xa8c2b8(0x145)})[_0xa8c2b8(0x10f)](()=>{});}else _0x5812ca='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x5812ca}]};}catch(_0x532db6){const _0x485a0d=_0x532db6 instanceof Error?_0x532db6[_0xa8c2b8(0xc2)]:String(_0x532db6),_0x3b7ebf=_0x485a0d[_0xa8c2b8(0x133)]()[_0xa8c2b8(0xc8)]('timeout')||_0x485a0d[_0xa8c2b8(0x133)]()['includes']('timed\x20out')||_0x485a0d[_0xa8c2b8(0x133)]()[_0xa8c2b8(0xc8)](_0xa8c2b8(0xe1))||_0x532db6 instanceof Error&&_0x532db6['name']===_0xa8c2b8(0xe9);return reportMorphError({'error_message':_0x485a0d,'error_type':_0x3b7ebf?'TimeoutError':_0x532db6 instanceof Error?_0x532db6[_0xa8c2b8(0xd0)][_0xa8c2b8(0xfd)]:_0xa8c2b8(0xe5),'context':{'tool':_0xa8c2b8(0x12d),'repo_path':_0xe22275[_0xa8c2b8(0x9e)]['repo_path'],'query':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x118)],'model':_0xa8c2b8(0xd8),'is_timeout':_0x3b7ebf,'exception_phase':_0xa8c2b8(0xab),'request_content':{'query':_0xe22275[_0xa8c2b8(0x9e)]['search_string'],'repo_path':_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)],'repoRoot':a0_0x54f756['resolve'](_0xe22275[_0xa8c2b8(0x9e)][_0xa8c2b8(0x108)]),'model':_0xa8c2b8(0xd8)}},'stack_trace':_0x532db6 instanceof Error?_0x532db6[_0xa8c2b8(0x172)]:undefined,'source':_0xa8c2b8(0x145)})[_0xa8c2b8(0x10f)](()=>{}),{'content':[{'type':_0xa8c2b8(0xe0),'text':_0xa8c2b8(0x149)+_0x485a0d}],'isError':![]};}}case _0xa8c2b8(0x16e):{const _0x2d1ecf=CodebaseSearchArgsSchema['safeParse'](_0x3286e4);if(!_0x2d1ecf[_0xa8c2b8(0x179)])return{'content':[{'type':_0xa8c2b8(0xe0),'text':_0xa8c2b8(0x13d)+_0x2d1ecf[_0xa8c2b8(0x125)]}],'isError':!![]};try{const _0x4c9617=MORPH_API_KEY;if(!_0x4c9617)throw new Error(_0xa8c2b8(0xd4));const _0x38bcb0=await executeCodebaseSearch({'query':_0x2d1ecf['data'][_0xa8c2b8(0x17c)],'target_directories':_0x2d1ecf[_0xa8c2b8(0x9e)]['target_directories'],'limit':_0x2d1ecf['data'][_0xa8c2b8(0x167)]},{'apiKey':_0x4c9617,'repoId':_0x2d1ecf[_0xa8c2b8(0x9e)][_0xa8c2b8(0xa2)],'branch':_0x2d1ecf[_0xa8c2b8(0x9e)][_0xa8c2b8(0x10c)],'commitHash':_0x2d1ecf[_0xa8c2b8(0x9e)][_0xa8c2b8(0xa5)],'debug':![]});if(!_0x38bcb0['success'])return{'content':[{'type':'text','text':_0xa8c2b8(0xf4)+_0x38bcb0['error']}],'isError':!![]};const _0x4f9244=_0x38bcb0['results'][_0xa8c2b8(0xc1)]===0x0?_0xa8c2b8(0x127)+_0x2d1ecf['data']['query']+'\x22':_0xa8c2b8(0xf5)+_0x38bcb0['results'][_0xa8c2b8(0xc1)]+_0xa8c2b8(0x98)+_0x38bcb0[_0xa8c2b8(0xf9)]['searchTimeMs']+_0xa8c2b8(0x122)+_0x38bcb0['results'][_0xa8c2b8(0x14d)]((_0x4ff0a7,_0x4d194a)=>_0x4d194a+0x1+'.\x20'+_0x4ff0a7[_0xa8c2b8(0xc9)]+'\x20('+(_0x4ff0a7[_0xa8c2b8(0xac)]*0x64)['toFixed'](0x1)+_0xa8c2b8(0xe8)+(_0xa8c2b8(0x16b)+_0x4ff0a7[_0xa8c2b8(0x9a)]+'-'+_0x4ff0a7[_0xa8c2b8(0x12f)]+'\x0a')+(_0xa8c2b8(0x15a)+_0x4ff0a7[_0xa8c2b8(0x17b)][_0xa8c2b8(0xc4)](0x0,0xc8)+(_0x4ff0a7[_0xa8c2b8(0x17b)][_0xa8c2b8(0xc1)]>0xc8?_0xa8c2b8(0x115):'')+'\x0a'))['join']('\x0a');return{'content':[{'type':'text','text':_0x4f9244}]};}catch(_0x2608b8){const _0x5a837c=_0x2608b8 instanceof Error?_0x2608b8['message']:String(_0x2608b8);return reportMorphError({'error_message':_0x5a837c,'error_type':_0x2608b8 instanceof Error?_0x2608b8[_0xa8c2b8(0xd0)][_0xa8c2b8(0xfd)]:'UnknownError','context':{'tool':_0xa8c2b8(0x16e),'query':_0x2d1ecf['data'][_0xa8c2b8(0x17c)],'repo_id':_0x2d1ecf['data'][_0xa8c2b8(0xa2)]},'stack_trace':_0x2608b8 instanceof Error?_0x2608b8[_0xa8c2b8(0x172)]:undefined,'source':'mcp-filesystem'})[_0xa8c2b8(0x10f)](()=>{}),{'content':[{'type':_0xa8c2b8(0xe0),'text':_0xa8c2b8(0x13f)+_0x5a837c}],'isError':!![]};}}default:throw new Error(_0xa8c2b8(0xef)+_0xf604a6);}}catch(_0x38a01f){const _0x53eed0=_0x38a01f instanceof Error?_0x38a01f[_0xa8c2b8(0xc2)]:String(_0x38a01f);return reportMorphError({'error_message':_0x53eed0,'error_type':_0x38a01f instanceof Error?_0x38a01f[_0xa8c2b8(0xd0)][_0xa8c2b8(0xfd)]:_0xa8c2b8(0xe5),'context':{'tool':name,'arguments':args?JSON[_0xa8c2b8(0xcd)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0xa8c2b8(0x12e)},'stack_trace':_0x38a01f instanceof Error?_0x38a01f[_0xa8c2b8(0x172)]:undefined,'source':_0xa8c2b8(0x145)})[_0xa8c2b8(0x10f)](()=>{}),{'content':[{'type':_0xa8c2b8(0xe0),'text':_0xa8c2b8(0x13f)+_0x53eed0}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x170a39){const _0x3ae583=a0_0x3d32fb,_0x3397a2=await getValidRootDirectories(_0x170a39);if(_0x3397a2['length']>0x0)allowedDirectories=[..._0x3397a2],console['error'](_0x3ae583(0x159)+_0x3397a2[_0x3ae583(0xc1)]+'\x20valid\x20directories');else{console[_0x3ae583(0x125)]('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x15929f=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x15929f&&(allowedDirectories=[_0x15929f],console[_0x3ae583(0x125)]('Fallback:\x20Using\x20workspace\x20root\x20'+_0x15929f));}catch(_0x8e668b){console[_0x3ae583(0x125)](_0x3ae583(0x109)+_0x8e668b);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0xe86dc1=a0_0x3d32fb;try{const _0x564c83=await server[_0xe86dc1(0x12c)]();_0x564c83&&_0xe86dc1(0x15b)in _0x564c83&&await updateAllowedDirectoriesFromRoots(_0x564c83[_0xe86dc1(0x15b)]);}catch(_0x4944d9){console['error'](_0xe86dc1(0x119),_0x4944d9 instanceof Error?_0x4944d9[_0xe86dc1(0xc2)]:String(_0x4944d9));}}),server[a0_0x3d32fb(0x168)]=async()=>{const _0x1b978c=a0_0x3d32fb,_0x2c727e=server[_0x1b978c(0x124)]();if(_0x2c727e?.[_0x1b978c(0x15b)])try{const _0x239c7c=await server[_0x1b978c(0x12c)]();_0x239c7c&&'roots'in _0x239c7c?await updateAllowedDirectoriesFromRoots(_0x239c7c[_0x1b978c(0x15b)]):console[_0x1b978c(0x125)](_0x1b978c(0x131));}catch(_0x3009c5){console['error'](_0x1b978c(0xe2),_0x3009c5 instanceof Error?_0x3009c5['message']:String(_0x3009c5));}else{if(allowedDirectories[_0x1b978c(0xc1)]>0x0)console[_0x1b978c(0x125)](_0x1b978c(0xe4),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console['error'](_0x1b978c(0xbc));else throw new Error(_0x1b978c(0x13c));}}};async function runServer(){const _0x2d1517=a0_0x3d32fb,_0x38f93e=new StdioServerTransport();await server[_0x2d1517(0xf1)](_0x38f93e),console[_0x2d1517(0x125)]('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x2d1517(0xc1)]===0x0&&console['error'](_0x2d1517(0xb9));}runServer()[a0_0x3d32fb(0x10f)](_0x2fea87=>{const _0x511391=a0_0x3d32fb;console[_0x511391(0x125)](_0x511391(0x96),_0x2fea87),process[_0x511391(0x151)](0x1);});
2
+ const a0_0x2878ee=a0_0x43c2;(function(_0x33e45e,_0x186855){const _0x23c676=a0_0x43c2,_0x30abed=_0x33e45e();while(!![]){try{const _0xc95a80=-parseInt(_0x23c676(0x138))/0x1+parseInt(_0x23c676(0x10c))/0x2*(parseInt(_0x23c676(0xf8))/0x3)+parseInt(_0x23c676(0x134))/0x4*(parseInt(_0x23c676(0xcd))/0x5)+parseInt(_0x23c676(0xfa))/0x6*(-parseInt(_0x23c676(0x11d))/0x7)+parseInt(_0x23c676(0x16e))/0x8*(parseInt(_0x23c676(0x17a))/0x9)+parseInt(_0x23c676(0xde))/0xa+-parseInt(_0x23c676(0x187))/0xb;if(_0xc95a80===_0x186855)break;else _0x30abed['push'](_0x30abed['shift']());}catch(_0x2feb47){_0x30abed['push'](_0x30abed['shift']());}}}(a0_0x2299,0xeffba));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_0x4e9f2c from'fs/promises';import a0_0x1442c6 from'path';import a0_0x589b3b from'os';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider}from'@morphllm/morphsdk/tools/warp-grep';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x592ca2 from'axios';function fixPathRepetition(_0x333203){const _0x1dbb44=a0_0x43c2,_0x5640b5=_0x333203['split'](a0_0x1442c6[_0x1dbb44(0xb0)])[_0x1dbb44(0x179)](Boolean);if(_0x5640b5[_0x1dbb44(0xab)]<0x2)return null;for(let _0x486274=Math[_0x1dbb44(0xf3)](_0x5640b5[_0x1dbb44(0xab)]/0x2);_0x486274>=0x1;_0x486274--){for(let _0x5a18a5=0x0;_0x5a18a5<=_0x5640b5['length']-0x2*_0x486274;_0x5a18a5++){const _0x25650e=_0x5640b5[_0x1dbb44(0x16d)](_0x5a18a5,_0x5a18a5+_0x486274),_0x58e2d9=_0x5640b5['slice'](_0x5a18a5+_0x486274,_0x5a18a5+0x2*_0x486274);if(_0x25650e['every']((_0x155937,_0x5c8dd1)=>_0x155937===_0x58e2d9[_0x5c8dd1])){const _0x3590ee=[..._0x5640b5[_0x1dbb44(0x16d)](0x0,_0x5a18a5),..._0x5640b5['slice'](_0x5a18a5+_0x486274)];return a0_0x1442c6[_0x1dbb44(0xb0)]+_0x3590ee[_0x1dbb44(0x120)](a0_0x1442c6[_0x1dbb44(0xb0)]);}}}return null;}const args=process[a0_0x2878ee(0xef)][a0_0x2878ee(0x16d)](0x2),ALL_TOOLS=['edit_file','warpgrep_codebase_search',a0_0x2878ee(0xd0)],DEFAULT_TOOLS=[a0_0x2878ee(0xc2),a0_0x2878ee(0xcc)],ENABLED_TOOLS=process[a0_0x2878ee(0x17e)][a0_0x2878ee(0xac)]?process[a0_0x2878ee(0x17e)]['ENABLED_TOOLS']===a0_0x2878ee(0x130)?ALL_TOOLS:process[a0_0x2878ee(0x17e)][a0_0x2878ee(0xac)][a0_0x2878ee(0x17f)](',')[a0_0x2878ee(0x124)](_0x3f0333=>_0x3f0333[a0_0x2878ee(0x139)]()):DEFAULT_TOOLS;console['error'](a0_0x2878ee(0xc7)+ENABLED_TOOLS[a0_0x2878ee(0x120)](',\x20'));const WORKSPACE_ROOT=process['env'][a0_0x2878ee(0xa0)]||process[a0_0x2878ee(0x17e)]['PWD']||process[a0_0x2878ee(0x159)](),ENABLE_WORKSPACE_MODE=process[a0_0x2878ee(0x17e)][a0_0x2878ee(0x177)]!==a0_0x2878ee(0x15f),MORPH_API_KEY=process[a0_0x2878ee(0x17e)][a0_0x2878ee(0x135)],MORPH_API_URL=process[a0_0x2878ee(0x17e)]['MORPH_API_URL'];MORPH_API_KEY&&!MORPH_API_KEY[a0_0x2878ee(0xdd)]('sk-')&&!MORPH_API_KEY['startsWith'](a0_0x2878ee(0xc9))&&console['error'](a0_0x2878ee(0x131));async function reportMorphError(_0x337774){const _0x2a6d64=a0_0x2878ee;try{await a0_0x592ca2[_0x2a6d64(0x116)]('https://morphllm.com/api/error-report',{..._0x337774,'timestamp':new Date()['toISOString'](),'source':_0x337774[_0x2a6d64(0x176)]||_0x2a6d64(0xb9)},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x2a6d64(0x152)+MORPH_API_KEY}});}catch{}}function a0_0x2299(){const _0x1d26b6=['split','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','readFile','applied\x20edits\x20to','ENOENT','dryRun','Natural\x20language\x20query\x20to\x20search\x20for\x20code','Warning:\x20Workspace\x20fallback\x20failed:\x20','5149375aDrGYo','WORKSPACE_ROOT','commitHash','content','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','push','oninitialized','unknown','Unknown\x20error','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','etimedout','safeParse','length','ENABLED_TOOLS','toLowerCase','-\x20Read\x20file\x20`','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','sep','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','TimeoutError','\x22>\x0aError\x20reading\x20file:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','describe','search_string','Rules:\x0a','mcp-filesystem','role','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','\x20(new\x20file)','roots','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','\x20is\x20not\x20a\x20directory','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','File\x20read\x20error:','edit_file','message','dirname','Workspace\x20mode\x20enabled:\x20Using\x20','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','Enabled\x20tools:\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','morph-','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','Invalid\x20arguments:\x20','warpgrep_codebase_search','6780bOhtmG','results','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','codebase_search','<file\x20path=\x22','exit','error','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','target_directories','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','go.mod','Relevant\x20context\x20found:','Specific\x20commit\x20hash\x20to\x20search','object','constructor','startsWith','4314160yGFoxE','repo_path','pyproject.toml','text','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','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','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','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','package.json','array','Preview\x20changes\x20without\x20applying\x20them.','stack','searchTimeMs','completed_with_file_errors','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','argv','\x0a</file>','-\x20Grepped\x20\x27','setRequestHandler','floor','Warning:\x20','morph-warp-grep-v1-1111v0','realpath','access','3HJBbsU','lines','214494KcQARp','created','filepath','optional','\x20as\x20allowed\x20directory','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','timed\x20out','composer.json','setNotificationHandler','params','Search\x20failed:\x20','Found\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','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','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','For\x20deletions:\x0a','3338818ayfHas','requiresApiKey','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','terminationReason','timeout','Benefits:\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','terminated','morph-v3-fast','post','match','default','utf-8','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Error\x20running\x20fast\x20context\x20search:\x20','329YUQnSW','homedir','0.2.0','join','Applied','boolean','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','map','Fatal\x20error\x20running\x20server:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','-\x20Listed\x20directory\x20`','repeat','Error\x20accessing\x20directory\x20','string','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','files','Error:\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','instruction','all','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','metadata','1876mNMamz','MORPH_API_KEY','errors','branch','688974GfhSrh','trim','data','\x0a...\x20(truncated,\x20total:\x20','FileReadError','Cargo.toml','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','%\x20match)\x0a','No\x20results\x20found\x20for\x20query:\x20\x22','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','assistant','UnknownError','name','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Failed\x20to\x20request\x20roots\x20from\x20client:','create\x20this\x20file','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','unknown\x20error','grep\x20\x27','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.','catch','toFixed','Created\x20File','\x20\x20\x20Lines\x20','listRoots','substring','Bearer\x20','success','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','diff\x0a','path','basename','Successfully\x20','cwd','finish','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','Morph\x20Edit\x20','isArray','...','false','query','Use\x20dryRun=false\x20to\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','resolve','code','Repository\x20identifier','includes','\x20results\x20in\x20','\x27\x20in\x20`','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','number','read\x20','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','slice','24qvwKyy','\x20valid\x20directories','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Unknown\x20tool:\x20','udiff','endLine','code_edit','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','source','ENABLE_WORKSPACE_MODE','messages','filter','3250449UoYDom','\x20\x20\x20','[could\x20not\x20read\x20file:\x20','</file>','env'];a0_0x2299=function(){return _0x1d26b6;};return a0_0x2299();}args[a0_0x2878ee(0xab)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xa3)),console['error']('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xd6)),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xe7)),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0x148)),console[a0_0x2878ee(0xd3)](a0_0x2878ee(0xff)));function a0_0x43c2(_0x1f94f7,_0x41dbae){_0x1f94f7=_0x1f94f7-0xa0;const _0x229970=a0_0x2299();let _0x43c286=_0x229970[_0x1f94f7];return _0x43c286;}function normalizePath(_0x82fab5){return a0_0x1442c6['normalize'](_0x82fab5);}function expandHome(_0x571599){const _0x3a1573=a0_0x2878ee;if(_0x571599['startsWith']('~/')||_0x571599==='~')return a0_0x1442c6[_0x3a1573(0x120)](a0_0x589b3b[_0x3a1573(0x11e)](),_0x571599[_0x3a1573(0x16d)](0x1));return _0x571599;}let allowedDirectories=await Promise[a0_0x2878ee(0x130)](args[a0_0x2878ee(0x124)](async _0x2f6d21=>{const _0x5dbc7e=a0_0x2878ee,_0x46f320=expandHome(_0x2f6d21),_0x488bf3=a0_0x1442c6[_0x5dbc7e(0x163)](_0x46f320);try{const _0x1ef0bf=await a0_0x4e9f2c[_0x5dbc7e(0xf6)](_0x488bf3);return normalizePath(_0x1ef0bf);}catch(_0x4796b4){return normalizePath(_0x488bf3);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x2878ee(0xab)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x2878ee(0xa4)](workspaceDir),console['error'](a0_0x2878ee(0xc5)+workspaceDir+a0_0x2878ee(0xfe)));}catch(a0_0x290b22){console['error'](a0_0x2878ee(0x108)+a0_0x290b22);}async function detectWorkspaceRoot(_0x2c43ac){const _0x37b276=a0_0x2878ee;let _0x3e70cb=a0_0x1442c6[_0x37b276(0x163)](_0x2c43ac);const _0x1ff064=['.git','.vscode',_0x37b276(0xe8),_0x37b276(0x13d),_0x37b276(0xe0),_0x37b276(0xd8),'.cursor','tsconfig.json',_0x37b276(0x103)];while(_0x3e70cb!==a0_0x1442c6[_0x37b276(0xc4)](_0x3e70cb)){for(const _0x3716bc of _0x1ff064){const _0x493f51=a0_0x1442c6[_0x37b276(0x120)](_0x3e70cb,_0x3716bc);try{return await a0_0x4e9f2c[_0x37b276(0xf7)](_0x493f51),normalizePath(_0x3e70cb);}catch{}}_0x3e70cb=a0_0x1442c6['dirname'](_0x3e70cb);}return normalizePath(_0x2c43ac);}await Promise[a0_0x2878ee(0x130)](args['map'](async _0xf59a61=>{const _0x3bd5b0=a0_0x2878ee;try{const _0x517d20=await a0_0x4e9f2c['stat'](expandHome(_0xf59a61));!_0x517d20['isDirectory']()&&(console['error'](_0x3bd5b0(0x12d)+_0xf59a61+_0x3bd5b0(0xbf)),process[_0x3bd5b0(0xd2)](0x1));}catch(_0x45faef){console[_0x3bd5b0(0xd3)](_0x3bd5b0(0x129)+_0xf59a61+':',_0x45faef),process[_0x3bd5b0(0xd2)](0x1);}}));async function validatePath(_0x1fb78c){const _0xa5374d=a0_0x2878ee,_0x2487af=expandHome(_0x1fb78c),_0x8fb536=a0_0x1442c6[_0xa5374d(0x163)](_0x2487af);try{const _0x51fff6=await a0_0x4e9f2c[_0xa5374d(0xf6)](_0x8fb536);return _0x51fff6;}catch(_0x1d9f4d){if(_0x1d9f4d[_0xa5374d(0x164)]===_0xa5374d(0x183)){const _0x531cc4=a0_0x1442c6[_0xa5374d(0xc4)](_0x8fb536);try{const _0x3df03f=await a0_0x4e9f2c[_0xa5374d(0xf6)](_0x531cc4);return a0_0x1442c6[_0xa5374d(0x120)](_0x3df03f,a0_0x1442c6[_0xa5374d(0x157)](_0x8fb536));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x531cc4);}}throw _0x1d9f4d;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x2878ee(0x12a)](),'code_edit':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x10a)),'instruction':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0xb2)),'dryRun':z[a0_0x2878ee(0x122)]()[a0_0x2878ee(0x118)](![])['describe'](a0_0x2878ee(0xea))}),WarpGrepArgsSchema=z[a0_0x2878ee(0xdb)]({'search_string':z[a0_0x2878ee(0x12a)]()['describe'](a0_0x2878ee(0xb1)),'repo_path':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x109))}),CodebaseSearchArgsSchema=z[a0_0x2878ee(0xdb)]({'query':z['string']()['describe'](a0_0x2878ee(0x185)),'repoId':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x165)),'branch':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xfd)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0x100)),'commitHash':z[a0_0x2878ee(0x12a)]()[a0_0x2878ee(0xfd)]()[a0_0x2878ee(0xb6)](a0_0x2878ee(0xda)),'target_directories':z[a0_0x2878ee(0xe9)](z[a0_0x2878ee(0x12a)]())[a0_0x2878ee(0x118)]([])['describe'](a0_0x2878ee(0xee)),'limit':z[a0_0x2878ee(0x16a)]()[a0_0x2878ee(0xfd)]()[a0_0x2878ee(0x118)](0xa)[a0_0x2878ee(0xb6)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x2878ee(0x11f)},{'capabilities':{'tools':{}}});server[a0_0x2878ee(0xf2)](ListToolsRequestSchema,async()=>{const _0x332435=a0_0x2878ee,_0x25c1ac=[{'name':_0x332435(0xc2),'description':_0x332435(0x11b)+_0x332435(0x141)+_0x332435(0xc0)+_0x332435(0x112)+_0x332435(0x111)+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x332435(0x180)+_0x332435(0x170)+_0x332435(0x11a)+_0x332435(0xe5)+_0x332435(0xbb)+_0x332435(0x123)+_0x332435(0x10b)+_0x332435(0xe3)+_0x332435(0xbe)+_0x332435(0xb8)+_0x332435(0x12e)+_0x332435(0x175)+_0x332435(0x16c)+_0x332435(0xaf)+_0x332435(0x113)+_0x332435(0xcf)+_0x332435(0xe2),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x332435(0xca)+'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'+_0x332435(0x154)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.'+_0x332435(0xe4)+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x332435(0xd4)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x332435(0xc6)+'Benefits:\x0a'+_0x332435(0x169)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x332435(0x101)+_0x332435(0x15b)+_0x332435(0x13e)+_0x332435(0x132)+'Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x27eacf=_0x25c1ac[_0x332435(0x179)](_0x2ddd9c=>{const _0x43ccd6=_0x332435;if(!ENABLED_TOOLS[_0x43ccd6(0x166)](_0x2ddd9c['name']))return![];if(_0x43ccd6(0x10d)in _0x2ddd9c&&_0x2ddd9c[_0x43ccd6(0x10d)]&&!MORPH_API_KEY)return console[_0x43ccd6(0xd3)](_0x43ccd6(0xf4)+_0x2ddd9c[_0x43ccd6(0x144)]+_0x43ccd6(0x145)),![];return!![];});return{'tools':_0x27eacf[_0x332435(0x124)](_0x5ba2b7=>({'name':_0x5ba2b7[_0x332435(0x144)],'description':_0x5ba2b7['description'],'inputSchema':_0x5ba2b7['inputSchema']}))};}),server[a0_0x2878ee(0xf2)](CallToolRequestSchema,async _0x5509cf=>{const _0x32dbaf=a0_0x2878ee;try{const {name:_0x4eb32a,arguments:_0x1066ed}=_0x5509cf[_0x32dbaf(0x105)];switch(_0x4eb32a){case _0x32dbaf(0xc2):{const _0x44e6e4=MorphEditFileArgsSchema[_0x32dbaf(0xaa)](_0x1066ed);if(!_0x44e6e4['success'])throw new Error(_0x32dbaf(0xa8)+_0x44e6e4['error']);const _0x5505ca=await validatePath(_0x44e6e4['data'][_0x32dbaf(0x156)]);let _0x386c5a=null,_0x109f44=!![],_0x4c0b53=null;try{_0x386c5a=await a0_0x4e9f2c[_0x32dbaf(0x181)](_0x5505ca,_0x32dbaf(0x119));}catch(_0x120495){const _0x201957=_0x120495[_0x32dbaf(0x164)];_0x201957==='ENOENT'?(_0x109f44=![],_0x386c5a=''):(_0x4c0b53='Failed\x20to\x20read\x20file:\x20'+(_0x201957||_0x32dbaf(0xa6))+'\x20-\x20'+(_0x120495 instanceof Error?_0x120495['message']:String(_0x120495)),console['error'](_0x32dbaf(0xf4)+_0x4c0b53));}try{const _0x5afebb=MORPH_API_KEY;if(!_0x5afebb)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x3d43bc=a0_0x1442c6[_0x32dbaf(0xc4)](_0x5505ca),_0x210880=a0_0x1442c6[_0x32dbaf(0x157)](_0x5505ca),_0x2a7867=await executeEditFile({'target_filepath':_0x210880,'code_edit':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x174)],'instructions':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x12f)]},{'morphApiKey':_0x5afebb,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3d43bc,'autoWrite':!_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x184)],'generateUdiff':!![],'debug':![]});if(!_0x2a7867[_0x32dbaf(0x153)])throw new Error(_0x2a7867[_0x32dbaf(0xd3)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x536b1f=_0x2a7867[_0x32dbaf(0x172)]||'';let _0x41824a=0x3;while(_0x536b1f[_0x32dbaf(0x166)]('`'[_0x32dbaf(0x128)](_0x41824a))){_0x41824a++;}const _0xebad9a='`'['repeat'](_0x41824a)+_0x32dbaf(0x155)+_0x536b1f+'`'[_0x32dbaf(0x128)](_0x41824a)+'\x0a\x0a';if(_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x184)])return{'content':[{'type':_0x32dbaf(0xe1),'text':'🔍\x20Morph\x20Edit\x20Preview'+(_0x109f44?'':_0x32dbaf(0xbc))+':\x20'+_0x44e6e4[_0x32dbaf(0x13a)]['instruction']+'\x0a\x0a'+_0xebad9a+_0x32dbaf(0x161)+(_0x109f44?'apply\x20these\x20changes':_0x32dbaf(0x147))+'.'}]};return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0x15c)+(_0x109f44?_0x32dbaf(0x121):_0x32dbaf(0x14e))+':\x20'+_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x12f)]+'\x0a\x0a'+_0xebad9a+_0x32dbaf(0x158)+(_0x109f44?_0x32dbaf(0x182):_0x32dbaf(0xfb))+'\x20'+_0x44e6e4['data'][_0x32dbaf(0x156)]}]};}catch(_0x290644){const _0x3bfd96=_0x290644 instanceof Error?_0x290644[_0x32dbaf(0xc3)]:String(_0x290644);return reportMorphError({'error_message':_0x3bfd96,'error_type':_0x290644 instanceof Error?_0x290644[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:_0x32dbaf(0x143),'context':{'tool':'edit_file','file_path':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x156)],'validated_path':_0x5505ca,'instruction':_0x44e6e4['data']['instruction'],'model':_0x32dbaf(0x115),'dry_run':_0x44e6e4['data'][_0x32dbaf(0x184)],'file_exists':_0x109f44,'file_read_error':_0x4c0b53,'file_readable':_0x386c5a!==null,'request_content':{'path':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x156)],'code_edit':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x174)],'instruction':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x12f)],'original_code':_0x386c5a!==null?_0x386c5a['length']>0xc350?_0x386c5a['substring'](0x0,0xc350)+_0x32dbaf(0x13b)+_0x386c5a[_0x32dbaf(0xab)]+'\x20chars)':_0x386c5a:_0x32dbaf(0x17c)+(_0x4c0b53||_0x32dbaf(0x149))+']','original_code_length':_0x386c5a?.[_0x32dbaf(0xab)]??0x0,'model':_0x32dbaf(0x115),'dry_run':_0x44e6e4[_0x32dbaf(0x13a)][_0x32dbaf(0x184)]}},'stack_trace':_0x290644 instanceof Error?_0x290644[_0x32dbaf(0xeb)]:undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x3bfd96}],'isError':!![]};}}case _0x32dbaf(0xcc):{const _0x3619fe=WarpGrepArgsSchema[_0x32dbaf(0xaa)](_0x1066ed);if(!_0x3619fe['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x3619fe[_0x32dbaf(0xd3)]}],'isError':!![]};const _0x175a7e=_0x1c69b0=>{const _0x5bf4a4=_0x32dbaf,_0x16d8fb=[];for(const _0x5feb14 of _0x1c69b0||[]){const _0x3701cc=_0x5feb14['role'],_0xd8e28=_0x5feb14['content'];if(_0x3701cc===_0x5bf4a4(0x142)&&_0xd8e28){const _0x199790=_0xd8e28['split']('\x0a')[_0x5bf4a4(0x179)](_0x45af79=>_0x45af79[_0x5bf4a4(0x139)]());for(const _0x45252f of _0x199790){const _0x4a4d09=_0x45252f['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x4a4d09){_0x16d8fb[_0x5bf4a4(0xa4)](_0x5bf4a4(0x14a)+_0x4a4d09[0x1]+'\x27\x20'+_0x4a4d09[0x2]);continue;}const _0x1a3f44=_0x45252f[_0x5bf4a4(0x117)](/^read\s+(.+)$/);if(_0x1a3f44){_0x16d8fb[_0x5bf4a4(0xa4)](_0x5bf4a4(0x16b)+_0x1a3f44[0x1]);continue;}const _0x38acae=_0x45252f[_0x5bf4a4(0x117)](/^list_directory\s+(.+)$/);if(_0x38acae){_0x16d8fb[_0x5bf4a4(0xa4)]('list_directory\x20'+_0x38acae[0x1]);continue;}}}}return _0x16d8fb;};try{const _0xefa848=a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)]),_0x1cf845=new LocalRipgrepProvider(_0xefa848),_0x122c1a=await runWarpGrep({'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'repoRoot':_0xefa848,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'provider':_0x1cf845});let _0x150814='';if(_0x122c1a[_0x32dbaf(0x10f)]==='completed'&&_0x122c1a['finish']?.[_0x32dbaf(0x133)]?.[_0x32dbaf(0x12c)]){const _0x5cb1bd=_0x122c1a['finish'][_0x32dbaf(0x133)][_0x32dbaf(0x12c)],_0x456174=[],_0x468ae2=[_0x32dbaf(0x126)];for(const _0x266142 of _0x122c1a[_0x32dbaf(0x178)]){const _0x2fa9ad=_0x266142['role'],_0x2dc6a1=_0x266142[_0x32dbaf(0xa2)];if(_0x2fa9ad==='assistant'&&_0x2dc6a1){const _0x3ec2f8=_0x2dc6a1[_0x32dbaf(0x17f)]('\x0a')['filter'](_0x307c0a=>_0x307c0a[_0x32dbaf(0x139)]());for(const _0x31ad6e of _0x3ec2f8){const _0x5de0f4=_0x31ad6e[_0x32dbaf(0x117)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x5de0f4){_0x468ae2[_0x32dbaf(0xa4)](_0x32dbaf(0xf1)+_0x5de0f4[0x1]+_0x32dbaf(0x168)+_0x5de0f4[0x2]+'`');continue;}const _0x23d5e8=_0x31ad6e['match'](/^read\s+(.+)$/);if(_0x23d5e8){_0x468ae2[_0x32dbaf(0xa4)](_0x32dbaf(0xae)+_0x23d5e8[0x1]+'`');continue;}const _0xe9ad54=_0x31ad6e[_0x32dbaf(0x117)](/^list_directory\s+(.+)$/);if(_0xe9ad54){_0x468ae2[_0x32dbaf(0xa4)](_0x32dbaf(0x127)+_0xe9ad54[0x1]+'`');continue;}}}}_0x456174[_0x32dbaf(0xa4)](_0x468ae2[_0x32dbaf(0x120)]('\x0a'));const _0x457e75=['',_0x32dbaf(0xd9)];for(const _0x39319d of _0x5cb1bd){if(_0x39319d[_0x32dbaf(0xf9)]==='*')_0x457e75[_0x32dbaf(0xa4)]('-\x20'+_0x39319d[_0x32dbaf(0x156)]+':*');else{if(Array['isArray'](_0x39319d[_0x32dbaf(0xf9)])){const _0x5dc90f=_0x39319d[_0x32dbaf(0xf9)][_0x32dbaf(0x124)](([_0x2305d6,_0x749bc5])=>{if(_0x2305d6===_0x749bc5)return''+_0x2305d6;return _0x2305d6+'-'+_0x749bc5;});_0x457e75[_0x32dbaf(0xa4)]('-\x20'+_0x39319d[_0x32dbaf(0x156)]+':'+_0x5dc90f[_0x32dbaf(0x120)](','));}else _0x457e75[_0x32dbaf(0xa4)]('-\x20'+_0x39319d['path']+':*');}}_0x457e75[_0x32dbaf(0xa4)](''),_0x456174[_0x32dbaf(0xa4)](_0x457e75[_0x32dbaf(0x120)]('\x0a')),_0x456174[_0x32dbaf(0xa4)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x54ab9f=[];for(const _0x5cd529 of _0x5cb1bd){let _0xebf57f=a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],_0x5cd529[_0x32dbaf(0x156)]),_0x1246e3=null,_0x2a40ed=null;try{_0x1246e3=await a0_0x4e9f2c[_0x32dbaf(0x181)](_0xebf57f,{'encoding':_0x32dbaf(0x119)});}catch(_0x5c47ab){const _0x5cc114=fixPathRepetition(_0xebf57f);if(_0x5cc114)try{_0x1246e3=await a0_0x4e9f2c[_0x32dbaf(0x181)](_0x5cc114,{'encoding':_0x32dbaf(0x119)}),_0xebf57f=_0x5cc114;}catch{_0x2a40ed=_0x5c47ab instanceof Error?_0x5c47ab:new Error(String(_0x5c47ab));}else _0x2a40ed=_0x5c47ab instanceof Error?_0x5c47ab:new Error(String(_0x5c47ab));}if(_0x1246e3!==null){const _0x7437bd=_0x1246e3['split'](/\r?\n/),_0x266bc1=[_0x32dbaf(0xd1)+_0x5cd529[_0x32dbaf(0x156)]+'\x22>'];if(_0x5cd529[_0x32dbaf(0xf9)]==='*'||!Array[_0x32dbaf(0x15d)](_0x5cd529['lines']))for(let _0x390483=0x1;_0x390483<=_0x7437bd[_0x32dbaf(0xab)];_0x390483++){const _0x5c43d3=_0x7437bd[_0x390483-0x1];_0x266bc1[_0x32dbaf(0xa4)](_0x390483+'|\x20'+_0x5c43d3);}else for(const [_0x575fbe,_0x1cb46d]of _0x5cd529[_0x32dbaf(0xf9)]){_0x266bc1['length']>0x1&&_0x266bc1[_0x32dbaf(0xa4)]('');for(let _0x3f5b6f=_0x575fbe;_0x3f5b6f<=_0x1cb46d&&_0x3f5b6f<=_0x7437bd[_0x32dbaf(0xab)];_0x3f5b6f++){const _0x3b9745=_0x7437bd[_0x3f5b6f-0x1];_0x266bc1[_0x32dbaf(0xa4)](_0x3f5b6f+'|\x20'+_0x3b9745);}}_0x266bc1[_0x32dbaf(0xa4)](_0x32dbaf(0x17d)),_0x54ab9f[_0x32dbaf(0xa4)](_0x266bc1[_0x32dbaf(0x120)]('\x0a'));}else _0x54ab9f[_0x32dbaf(0xa4)](_0x32dbaf(0xd1)+_0x5cd529['path']+_0x32dbaf(0xb4)+(_0x2a40ed?.[_0x32dbaf(0xc3)]||_0x32dbaf(0xa7))+_0x32dbaf(0xf0));}_0x456174[_0x32dbaf(0xa4)](_0x54ab9f[_0x32dbaf(0x120)]('\x0a\x0a')),_0x150814=_0x456174[_0x32dbaf(0x120)]('\x0a');const _0x592ddd=_0x122c1a[_0x32dbaf(0x136)]?.[_0x32dbaf(0x179)](_0x13a97f=>_0x13a97f[_0x32dbaf(0xc3)]?.['startsWith'](_0x32dbaf(0xc1)))||[];if(_0x592ddd[_0x32dbaf(0xab)]>0x0){const _0x594d25=_0x592ddd['map'](_0x5af9cc=>_0x5af9cc['message'])[_0x32dbaf(0x120)](';\x20');reportMorphError({'error_message':_0x594d25,'error_type':_0x32dbaf(0x13c),'context':{'tool':_0x32dbaf(0xcc),'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'model':_0x32dbaf(0xf5),'termination_reason':_0x32dbaf(0xed),'error_count':_0x592ddd['length'],'is_timeout':![],'files_attempted':_0x5cb1bd['map'](_0x545342=>({'path':_0x545342[_0x32dbaf(0x156)],'lines':_0x545342[_0x32dbaf(0xf9)]})),'tool_calls':_0x175a7e(_0x122c1a[_0x32dbaf(0x178)]),'messages':_0x122c1a['messages']?.[_0x32dbaf(0x124)](_0x2a325c=>({'role':_0x2a325c[_0x32dbaf(0xba)],'content':_0x2a325c['content']})),'request_content':{'query':_0x3619fe['data'][_0x32dbaf(0xb7)],'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'repoRoot':a0_0x1442c6['resolve'](_0x3619fe[_0x32dbaf(0x13a)]['repo_path']),'model':_0x32dbaf(0xf5)}},'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{});}}else{if(_0x122c1a[_0x32dbaf(0x10f)]===_0x32dbaf(0x114)&&_0x122c1a['errors']['length']>0x0){const _0x3bc5f3=_0x122c1a[_0x32dbaf(0x136)][_0x32dbaf(0x124)](_0x4c43c6=>_0x4c43c6[_0x32dbaf(0xc3)])[_0x32dbaf(0x120)](';\x20');_0x150814='Error:\x20'+_0x3bc5f3;const _0x5abe93=_0x3bc5f3[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0x110))||_0x3bc5f3[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0x102))||_0x3bc5f3[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0xa9)),_0x57302d=_0x122c1a[_0x32dbaf(0x15a)]?.[_0x32dbaf(0x133)]?.[_0x32dbaf(0x12c)],_0x86071=_0x122c1a[_0x32dbaf(0x136)][0x0];reportMorphError({'error_message':_0x3bc5f3,'error_type':_0x5abe93?_0x32dbaf(0xb3):_0x86071?.[_0x32dbaf(0xdc)]?.['name']||'WarpGrepError','context':{'tool':'warpgrep_codebase_search','repo_path':_0x3619fe['data']['repo_path'],'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x122c1a[_0x32dbaf(0x10f)],'error_count':_0x122c1a['errors'][_0x32dbaf(0xab)],'is_timeout':_0x5abe93,'files_attempted':_0x57302d?.[_0x32dbaf(0x124)](_0x4a4376=>({'path':_0x4a4376[_0x32dbaf(0x156)],'lines':_0x4a4376['lines']})),'tool_calls':_0x175a7e(_0x122c1a[_0x32dbaf(0x178)]),'messages':_0x122c1a[_0x32dbaf(0x178)]?.[_0x32dbaf(0x124)](_0x5405c7=>({'role':_0x5405c7[_0x32dbaf(0xba)],'content':_0x5405c7['content']})),'request_content':{'query':_0x3619fe[_0x32dbaf(0x13a)]['search_string'],'repo_path':_0x3619fe[_0x32dbaf(0x13a)]['repo_path'],'repoRoot':a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x86071?.[_0x32dbaf(0xeb)]||undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{});}else _0x150814=_0x32dbaf(0x10e);}return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x150814}]};}catch(_0x23a2d0){const _0xf611fa=_0x23a2d0 instanceof Error?_0x23a2d0['message']:String(_0x23a2d0),_0x33f135=_0xf611fa[_0x32dbaf(0xad)]()[_0x32dbaf(0x166)](_0x32dbaf(0x110))||_0xf611fa['toLowerCase']()[_0x32dbaf(0x166)](_0x32dbaf(0x102))||_0xf611fa[_0x32dbaf(0xad)]()['includes'](_0x32dbaf(0xa9))||_0x23a2d0 instanceof Error&&_0x23a2d0[_0x32dbaf(0x144)]==='TimeoutError';return reportMorphError({'error_message':_0xf611fa,'error_type':_0x33f135?_0x32dbaf(0xb3):_0x23a2d0 instanceof Error?_0x23a2d0[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:_0x32dbaf(0x143),'context':{'tool':_0x32dbaf(0xcc),'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'query':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xb7)],'model':'morph-warp-grep-v1-1111v0','is_timeout':_0x33f135,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x3619fe['data'][_0x32dbaf(0xb7)],'repo_path':_0x3619fe[_0x32dbaf(0x13a)][_0x32dbaf(0xdf)],'repoRoot':a0_0x1442c6[_0x32dbaf(0x163)](_0x3619fe['data'][_0x32dbaf(0xdf)]),'model':_0x32dbaf(0xf5)}},'stack_trace':_0x23a2d0 instanceof Error?_0x23a2d0['stack']:undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0x11c)+_0xf611fa}],'isError':![]};}}case _0x32dbaf(0xd0):{const _0x495e8c=CodebaseSearchArgsSchema[_0x32dbaf(0xaa)](_0x1066ed);if(!_0x495e8c[_0x32dbaf(0x153)])return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0xcb)+_0x495e8c['error']}],'isError':!![]};try{const _0x52c143=MORPH_API_KEY;if(!_0x52c143)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x3c3c7a=await executeCodebaseSearch({'query':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0x160)],'target_directories':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0xd5)],'limit':_0x495e8c[_0x32dbaf(0x13a)]['limit']},{'apiKey':_0x52c143,'repoId':_0x495e8c['data']['repoId'],'branch':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0x137)],'commitHash':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0xa1)],'debug':![]});if(!_0x3c3c7a[_0x32dbaf(0x153)])return{'content':[{'type':'text','text':_0x32dbaf(0x106)+_0x3c3c7a['error']}],'isError':!![]};const _0x4890ff=_0x3c3c7a[_0x32dbaf(0xce)][_0x32dbaf(0xab)]===0x0?_0x32dbaf(0x140)+_0x495e8c['data']['query']+'\x22':_0x32dbaf(0x107)+_0x3c3c7a[_0x32dbaf(0xce)]['length']+_0x32dbaf(0x167)+_0x3c3c7a['stats'][_0x32dbaf(0xec)]+'ms:\x0a\x0a'+_0x3c3c7a[_0x32dbaf(0xce)]['map']((_0xd5c00e,_0x511f68)=>_0x511f68+0x1+'.\x20'+_0xd5c00e[_0x32dbaf(0xfc)]+'\x20('+(_0xd5c00e['rerankScore']*0x64)[_0x32dbaf(0x14d)](0x1)+_0x32dbaf(0x13f)+(_0x32dbaf(0x14f)+_0xd5c00e['startLine']+'-'+_0xd5c00e[_0x32dbaf(0x173)]+'\x0a')+(_0x32dbaf(0x17b)+_0xd5c00e[_0x32dbaf(0xa2)][_0x32dbaf(0x151)](0x0,0xc8)+(_0xd5c00e[_0x32dbaf(0xa2)][_0x32dbaf(0xab)]>0xc8?_0x32dbaf(0x15e):'')+'\x0a'))[_0x32dbaf(0x120)]('\x0a');return{'content':[{'type':_0x32dbaf(0xe1),'text':_0x4890ff}]};}catch(_0x1b0bdb){const _0x31f12c=_0x1b0bdb instanceof Error?_0x1b0bdb[_0x32dbaf(0xc3)]:String(_0x1b0bdb);return reportMorphError({'error_message':_0x31f12c,'error_type':_0x1b0bdb instanceof Error?_0x1b0bdb[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:_0x32dbaf(0x143),'context':{'tool':_0x32dbaf(0xd0),'query':_0x495e8c[_0x32dbaf(0x13a)][_0x32dbaf(0x160)],'repo_id':_0x495e8c['data']['repoId']},'stack_trace':_0x1b0bdb instanceof Error?_0x1b0bdb[_0x32dbaf(0xeb)]:undefined,'source':_0x32dbaf(0xb9)})[_0x32dbaf(0x14c)](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':'Error:\x20'+_0x31f12c}],'isError':!![]};}}default:throw new Error(_0x32dbaf(0x171)+_0x4eb32a);}}catch(_0x59206f){const _0xc91385=_0x59206f instanceof Error?_0x59206f[_0x32dbaf(0xc3)]:String(_0x59206f);return reportMorphError({'error_message':_0xc91385,'error_type':_0x59206f instanceof Error?_0x59206f[_0x32dbaf(0xdc)][_0x32dbaf(0x144)]:'UnknownError','context':{'tool':name,'arguments':args?JSON['stringify'](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x32dbaf(0x11f)},'stack_trace':_0x59206f instanceof Error?_0x59206f[_0x32dbaf(0xeb)]:undefined,'source':_0x32dbaf(0xb9)})['catch'](()=>{}),{'content':[{'type':_0x32dbaf(0xe1),'text':_0x32dbaf(0x12d)+_0xc91385}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x6681df){const _0x2267ca=a0_0x2878ee,_0x3828ec=await getValidRootDirectories(_0x6681df);if(_0x3828ec[_0x2267ca(0xab)]>0x0)allowedDirectories=[..._0x3828ec],console[_0x2267ca(0xd3)](_0x2267ca(0xe6)+_0x3828ec[_0x2267ca(0xab)]+_0x2267ca(0x16f));else{console[_0x2267ca(0xd3)]('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x4e330d=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4e330d&&(allowedDirectories=[_0x4e330d],console['error']('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4e330d));}catch(_0x446329){console[_0x2267ca(0xd3)](_0x2267ca(0x186)+_0x446329);}}}server[a0_0x2878ee(0x104)](RootsListChangedNotificationSchema,async()=>{const _0x466692=a0_0x2878ee;try{const _0x19e550=await server['listRoots']();_0x19e550&&'roots'in _0x19e550&&await updateAllowedDirectoriesFromRoots(_0x19e550[_0x466692(0xbd)]);}catch(_0xdc24f0){console[_0x466692(0xd3)](_0x466692(0x146),_0xdc24f0 instanceof Error?_0xdc24f0[_0x466692(0xc3)]:String(_0xdc24f0));}}),server[a0_0x2878ee(0xa5)]=async()=>{const _0x1e07a2=a0_0x2878ee,_0xd9bba1=server['getClientCapabilities']();if(_0xd9bba1?.[_0x1e07a2(0xbd)])try{const _0x49cca4=await server[_0x1e07a2(0x150)]();_0x49cca4&&_0x1e07a2(0xbd)in _0x49cca4?await updateAllowedDirectoriesFromRoots(_0x49cca4[_0x1e07a2(0xbd)]):console[_0x1e07a2(0xd3)](_0x1e07a2(0xc8));}catch(_0x261337){console[_0x1e07a2(0xd3)](_0x1e07a2(0x162),_0x261337 instanceof Error?_0x261337[_0x1e07a2(0xc3)]:String(_0x261337));}else{if(allowedDirectories[_0x1e07a2(0xab)]>0x0)console['error'](_0x1e07a2(0x12b),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x1e07a2(0xd3)](_0x1e07a2(0xd7));else throw new Error(_0x1e07a2(0x14b));}}};async function runServer(){const _0x23e9de=a0_0x2878ee,_0x4724e8=new StdioServerTransport();await server['connect'](_0x4724e8),console[_0x23e9de(0xd3)](_0x23e9de(0xb5)),allowedDirectories[_0x23e9de(0xab)]===0x0&&console[_0x23e9de(0xd3)]('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x49d194=>{const _0x48152d=a0_0x2878ee;console[_0x48152d(0xd3)](_0x48152d(0x125),_0x49d194),process[_0x48152d(0xd2)](0x1);});
@@ -1 +1 @@
1
- (function(_0xcc4d61,_0x25ed21){const _0x1e6b41=a1_0x4c81,_0x3ba5ea=_0xcc4d61();while(!![]){try{const _0x205deb=parseInt(_0x1e6b41(0x195))/0x1+-parseInt(_0x1e6b41(0x18f))/0x2+parseInt(_0x1e6b41(0x18a))/0x3*(parseInt(_0x1e6b41(0x181))/0x4)+parseInt(_0x1e6b41(0x190))/0x5*(-parseInt(_0x1e6b41(0x186))/0x6)+-parseInt(_0x1e6b41(0x192))/0x7*(parseInt(_0x1e6b41(0x183))/0x8)+-parseInt(_0x1e6b41(0x17d))/0x9*(parseInt(_0x1e6b41(0x18d))/0xa)+-parseInt(_0x1e6b41(0x18e))/0xb*(-parseInt(_0x1e6b41(0x191))/0xc);if(_0x205deb===_0x25ed21)break;else _0x3ba5ea['push'](_0x3ba5ea['shift']());}catch(_0x1a7572){_0x3ba5ea['push'](_0x3ba5ea['shift']());}}}(a1_0x188a,0xca9e0));import a1_0x476ad3 from'path';import a1_0x84cd0b from'os';export function convertToWindowsPath(_0x15847a){const _0x17e393=a1_0x4c81;if(_0x15847a[_0x17e393(0x188)](_0x17e393(0x17f))){const _0x103efd=_0x15847a['charAt'](0x5)[_0x17e393(0x187)](),_0x164764=_0x15847a[_0x17e393(0x193)](0x6)['replace'](/\//g,'\x5c');return _0x103efd+':'+_0x164764;}if(_0x15847a[_0x17e393(0x18c)](/^\/[a-zA-Z]\//)){const _0x27d634=_0x15847a[_0x17e393(0x18b)](0x1)[_0x17e393(0x187)](),_0x5aa9e7=_0x15847a['slice'](0x2)['replace'](/\//g,'\x5c');return _0x27d634+':'+_0x5aa9e7;}if(_0x15847a[_0x17e393(0x18c)](/^[a-zA-Z]:/))return _0x15847a[_0x17e393(0x189)](/\//g,'\x5c');return _0x15847a;}function a1_0x4c81(_0x1522dd,_0x432d6e){_0x1522dd=_0x1522dd-0x17d;const _0x188a09=a1_0x188a();let _0x4c81c2=_0x188a09[_0x1522dd];return _0x4c81c2;}function a1_0x188a(){const _0x5bd0da=['join','1487884XXmxhY','substring','1096jFUwfx','normalize','trim','6fbFoWc','toUpperCase','startsWith','replace','3cshloN','charAt','match','20qctIoB','5520218ufCOZg','613272qJeYXG','7353105iOynxX','96wURHvQ','61621ksgwvd','slice','homedir','196573lSkuAV','3465270DljciQ','test','/mnt/'];a1_0x188a=function(){return _0x5bd0da;};return a1_0x188a();}export function normalizePath(_0x53c85e){const _0x526962=a1_0x4c81;_0x53c85e=_0x53c85e[_0x526962(0x185)]()['replace'](/^["']|["']$/g,'');const _0x556d9b=_0x53c85e[_0x526962(0x188)]('/')&&!_0x53c85e[_0x526962(0x18c)](/^\/mnt\/[a-z]\//i)&&!_0x53c85e[_0x526962(0x18c)](/^\/[a-zA-Z]\//);if(_0x556d9b)return _0x53c85e[_0x526962(0x189)](/\/+/g,'/')[_0x526962(0x189)](/\/+$/,'');_0x53c85e=convertToWindowsPath(_0x53c85e);if(_0x53c85e[_0x526962(0x188)]('\x5c\x5c')){let _0x116268=_0x53c85e;_0x116268=_0x116268[_0x526962(0x189)](/^\\{2,}/,'\x5c\x5c');const _0x948ea0=_0x116268[_0x526962(0x182)](0x2)[_0x526962(0x189)](/\\\\/g,'\x5c');_0x53c85e='\x5c\x5c'+_0x948ea0;}else _0x53c85e=_0x53c85e[_0x526962(0x189)](/\\\\/g,'\x5c');let _0x519ff3=a1_0x476ad3[_0x526962(0x184)](_0x53c85e);_0x53c85e[_0x526962(0x188)]('\x5c\x5c')&&!_0x519ff3[_0x526962(0x188)]('\x5c\x5c')&&(_0x519ff3='\x5c'+_0x519ff3);if(_0x519ff3[_0x526962(0x18c)](/^[a-zA-Z]:/)){let _0x4ec854=_0x519ff3[_0x526962(0x189)](/\//g,'\x5c');return/^[a-z]:/[_0x526962(0x17e)](_0x4ec854)&&(_0x4ec854=_0x4ec854[_0x526962(0x18b)](0x0)['toUpperCase']()+_0x4ec854[_0x526962(0x193)](0x1)),_0x4ec854;}return _0x519ff3[_0x526962(0x189)](/\//g,'\x5c');}export function expandHome(_0x5ca0f3){const _0x4ff117=a1_0x4c81;if(_0x5ca0f3[_0x4ff117(0x188)]('~/')||_0x5ca0f3==='~')return a1_0x476ad3[_0x4ff117(0x180)](a1_0x84cd0b[_0x4ff117(0x194)](),_0x5ca0f3[_0x4ff117(0x193)](0x1));return _0x5ca0f3;}
1
+ function a1_0x59d1(){const _0x196c79=['1631xybGVm','trim','11940tLSHOx','slice','substring','2554360GpiQlr','normalize','6903VmfulM','startsWith','charAt','21010pSSziH','4174795CJuDuj','toUpperCase','join','2412702nwGPjI','2671724BCiewS','replace','22013qEsqVV','52wkLAir','match'];a1_0x59d1=function(){return _0x196c79;};return a1_0x59d1();}(function(_0x3da7fe,_0x54014b){const _0x5419cb=a1_0xb2ec,_0x1d4c73=_0x3da7fe();while(!![]){try{const _0xbee275=-parseInt(_0x5419cb(0xfa))/0x1*(parseInt(_0x5419cb(0xfb))/0x2)+parseInt(_0x5419cb(0xf7))/0x3+-parseInt(_0x5419cb(0xf8))/0x4+-parseInt(_0x5419cb(0x108))/0x5+parseInt(_0x5419cb(0xff))/0x6*(parseInt(_0x5419cb(0xfd))/0x7)+-parseInt(_0x5419cb(0x102))/0x8+-parseInt(_0x5419cb(0x104))/0x9*(-parseInt(_0x5419cb(0x107))/0xa);if(_0xbee275===_0x54014b)break;else _0x1d4c73['push'](_0x1d4c73['shift']());}catch(_0x5c35d0){_0x1d4c73['push'](_0x1d4c73['shift']());}}}(a1_0x59d1,0x765f0));function a1_0xb2ec(_0x19c9f2,_0x539478){_0x19c9f2=_0x19c9f2-0xf6;const _0x59d129=a1_0x59d1();let _0xb2ec4f=_0x59d129[_0x19c9f2];return _0xb2ec4f;}import a1_0x4af3f7 from'path';import a1_0x1cf96c from'os';export function convertToWindowsPath(_0x2de552){const _0x1f25c7=a1_0xb2ec;if(_0x2de552[_0x1f25c7(0x105)]('/mnt/')){const _0x4d5822=_0x2de552['charAt'](0x5)[_0x1f25c7(0x109)](),_0x452cc9=_0x2de552[_0x1f25c7(0x100)](0x6)['replace'](/\//g,'\x5c');return _0x4d5822+':'+_0x452cc9;}if(_0x2de552[_0x1f25c7(0xfc)](/^\/[a-zA-Z]\//)){const _0x4af79e=_0x2de552[_0x1f25c7(0x106)](0x1)[_0x1f25c7(0x109)](),_0x395f5a=_0x2de552['slice'](0x2)[_0x1f25c7(0xf9)](/\//g,'\x5c');return _0x4af79e+':'+_0x395f5a;}if(_0x2de552[_0x1f25c7(0xfc)](/^[a-zA-Z]:/))return _0x2de552[_0x1f25c7(0xf9)](/\//g,'\x5c');return _0x2de552;}export function normalizePath(_0xc1cf94){const _0x16e7d5=a1_0xb2ec;_0xc1cf94=_0xc1cf94[_0x16e7d5(0xfe)]()['replace'](/^["']|["']$/g,'');const _0x54f5c9=_0xc1cf94['startsWith']('/')&&!_0xc1cf94[_0x16e7d5(0xfc)](/^\/mnt\/[a-z]\//i)&&!_0xc1cf94[_0x16e7d5(0xfc)](/^\/[a-zA-Z]\//);if(_0x54f5c9)return _0xc1cf94[_0x16e7d5(0xf9)](/\/+/g,'/')[_0x16e7d5(0xf9)](/\/+$/,'');_0xc1cf94=convertToWindowsPath(_0xc1cf94);if(_0xc1cf94[_0x16e7d5(0x105)]('\x5c\x5c')){let _0x2c4330=_0xc1cf94;_0x2c4330=_0x2c4330[_0x16e7d5(0xf9)](/^\\{2,}/,'\x5c\x5c');const _0x376d12=_0x2c4330[_0x16e7d5(0x101)](0x2)[_0x16e7d5(0xf9)](/\\\\/g,'\x5c');_0xc1cf94='\x5c\x5c'+_0x376d12;}else _0xc1cf94=_0xc1cf94[_0x16e7d5(0xf9)](/\\\\/g,'\x5c');let _0xda1ab=a1_0x4af3f7[_0x16e7d5(0x103)](_0xc1cf94);_0xc1cf94['startsWith']('\x5c\x5c')&&!_0xda1ab[_0x16e7d5(0x105)]('\x5c\x5c')&&(_0xda1ab='\x5c'+_0xda1ab);if(_0xda1ab['match'](/^[a-zA-Z]:/)){let _0x35ef02=_0xda1ab[_0x16e7d5(0xf9)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x35ef02)&&(_0x35ef02=_0x35ef02['charAt'](0x0)[_0x16e7d5(0x109)]()+_0x35ef02[_0x16e7d5(0x100)](0x1)),_0x35ef02;}return _0xda1ab[_0x16e7d5(0xf9)](/\//g,'\x5c');}export function expandHome(_0x33cbc4){const _0x58468e=a1_0xb2ec;if(_0x33cbc4[_0x58468e(0x105)]('~/')||_0x33cbc4==='~')return a1_0x4af3f7[_0x58468e(0xf6)](a1_0x1cf96c['homedir'](),_0x33cbc4[_0x58468e(0x100)](0x1));return _0x33cbc4;}
@@ -1 +1 @@
1
- function a2_0x2784(){const _0x397768=['normalize','2772336syiGgj','includes','14laEpeF','isArray','string','108xNqBOb','55aGFprr','Path\x20must\x20be\x20absolute\x20after\x20normalization','9115WOPOUZ','767780SDWzry','30nTSoyh','860sARWgN','33209527afFVWu','13596JGvEMA','99WnWFuO','2335560ejOXGd','899090yGcEcd','sep','resolve','some','length','21fPUctK','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization'];a2_0x2784=function(){return _0x397768;};return a2_0x2784();}function a2_0x111f(_0x3b4733,_0x4e92a5){_0x3b4733=_0x3b4733-0x175;const _0x278443=a2_0x2784();let _0x111ffb=_0x278443[_0x3b4733];return _0x111ffb;}(function(_0xe5d564,_0x4bdc05){const _0x465833=a2_0x111f,_0x237944=_0xe5d564();while(!![]){try{const _0xf2c35f=-parseInt(_0x465833(0x18c))/0x1*(-parseInt(_0x465833(0x189))/0x2)+parseInt(_0x465833(0x179))/0x3*(parseInt(_0x465833(0x177))/0x4)+-parseInt(_0x465833(0x175))/0x5*(-parseInt(_0x465833(0x176))/0x6)+parseInt(_0x465833(0x181))/0x7*(-parseInt(_0x465833(0x184))/0x8)+parseInt(_0x465833(0x17a))/0x9*(parseInt(_0x465833(0x17c))/0xa)+parseInt(_0x465833(0x18a))/0xb*(parseInt(_0x465833(0x17b))/0xc)+-parseInt(_0x465833(0x178))/0xd*(parseInt(_0x465833(0x186))/0xe);if(_0xf2c35f===_0x4bdc05)break;else _0x237944['push'](_0x237944['shift']());}catch(_0x1d80ab){_0x237944['push'](_0x237944['shift']());}}}(a2_0x2784,0x930ca));import a2_0x253c05 from'path';export function isPathWithinAllowedDirectories(_0x431903,_0x242936){const _0x50808d=a2_0x111f;if(typeof _0x431903!=='string'||!Array[_0x50808d(0x187)](_0x242936))return![];if(!_0x431903||_0x242936[_0x50808d(0x180)]===0x0)return![];if(_0x431903[_0x50808d(0x185)]('\x00'))return![];let _0x57a666;try{_0x57a666=a2_0x253c05[_0x50808d(0x17e)](a2_0x253c05[_0x50808d(0x183)](_0x431903));}catch{return![];}if(!a2_0x253c05['isAbsolute'](_0x57a666))throw new Error(_0x50808d(0x18b));return _0x242936[_0x50808d(0x17f)](_0x18702b=>{const _0x45fe3d=_0x50808d;if(typeof _0x18702b!==_0x45fe3d(0x188)||!_0x18702b)return![];if(_0x18702b[_0x45fe3d(0x185)]('\x00'))return![];let _0x180c8f;try{_0x180c8f=a2_0x253c05['resolve'](a2_0x253c05[_0x45fe3d(0x183)](_0x18702b));}catch{return![];}if(!a2_0x253c05['isAbsolute'](_0x180c8f))throw new Error(_0x45fe3d(0x182));if(_0x57a666===_0x180c8f)return!![];if(_0x180c8f===a2_0x253c05[_0x45fe3d(0x17d)])return _0x57a666['startsWith'](a2_0x253c05[_0x45fe3d(0x17d)]);return _0x57a666['startsWith'](_0x180c8f+a2_0x253c05[_0x45fe3d(0x17d)]);});}
1
+ function a2_0x49c1(){const _0x4f75ee=['51114600eQHRhM','219511YphMju','1629956goFyYi','39iKAnSy','isArray','resolve','includes','startsWith','361604nlNSIH','string','336AgtEfP','10341480huQvtu','Path\x20must\x20be\x20absolute\x20after\x20normalization','normalize','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','length','19632elijUk','6538440FQkxRH','isAbsolute'];a2_0x49c1=function(){return _0x4f75ee;};return a2_0x49c1();}(function(_0x2d81fc,_0x4d0e72){const _0xd33252=a2_0x3202,_0x5a7513=_0x2d81fc();while(!![]){try{const _0x394481=-parseInt(_0xd33252(0x102))/0x1+-parseInt(_0xd33252(0x103))/0x2+parseInt(_0xd33252(0x104))/0x3*(-parseInt(_0xd33252(0x109))/0x4)+-parseInt(_0xd33252(0xff))/0x5+-parseInt(_0xd33252(0xfe))/0x6*(parseInt(_0xd33252(0x10b))/0x7)+-parseInt(_0xd33252(0xf8))/0x8+parseInt(_0xd33252(0x101))/0x9;if(_0x394481===_0x4d0e72)break;else _0x5a7513['push'](_0x5a7513['shift']());}catch(_0x21d488){_0x5a7513['push'](_0x5a7513['shift']());}}}(a2_0x49c1,0xade4d));function a2_0x3202(_0x52fa13,_0xac0d1b){_0x52fa13=_0x52fa13-0xf8;const _0x49c10c=a2_0x49c1();let _0x3202a0=_0x49c10c[_0x52fa13];return _0x3202a0;}import a2_0x5bf8c6 from'path';export function isPathWithinAllowedDirectories(_0x10f087,_0x1e5e3f){const _0x180552=a2_0x3202;if(typeof _0x10f087!==_0x180552(0x10a)||!Array[_0x180552(0x105)](_0x1e5e3f))return![];if(!_0x10f087||_0x1e5e3f[_0x180552(0xfd)]===0x0)return![];if(_0x10f087[_0x180552(0x107)]('\x00'))return![];let _0xa9c9a8;try{_0xa9c9a8=a2_0x5bf8c6[_0x180552(0x106)](a2_0x5bf8c6[_0x180552(0xfa)](_0x10f087));}catch{return![];}if(!a2_0x5bf8c6[_0x180552(0x100)](_0xa9c9a8))throw new Error(_0x180552(0xf9));return _0x1e5e3f['some'](_0x8dff02=>{const _0x2ec9cf=_0x180552;if(typeof _0x8dff02!=='string'||!_0x8dff02)return![];if(_0x8dff02[_0x2ec9cf(0x107)]('\x00'))return![];let _0x5b4204;try{_0x5b4204=a2_0x5bf8c6[_0x2ec9cf(0x106)](a2_0x5bf8c6[_0x2ec9cf(0xfa)](_0x8dff02));}catch{return![];}if(!a2_0x5bf8c6['isAbsolute'](_0x5b4204))throw new Error(_0x2ec9cf(0xfb));if(_0xa9c9a8===_0x5b4204)return!![];if(_0x5b4204===a2_0x5bf8c6[_0x2ec9cf(0xfc)])return _0xa9c9a8[_0x2ec9cf(0x108)](a2_0x5bf8c6[_0x2ec9cf(0xfc)]);return _0xa9c9a8[_0x2ec9cf(0x108)](_0x5b4204+a2_0x5bf8c6[_0x2ec9cf(0xfc)]);});}
@@ -1 +1 @@
1
- (function(_0xe0eba9,_0x469ed6){const _0xd59600=a3_0x50cd,_0x402b39=_0xe0eba9();while(!![]){try{const _0xa35cd0=parseInt(_0xd59600(0xad))/0x1*(parseInt(_0xd59600(0xb9))/0x2)+-parseInt(_0xd59600(0xa5))/0x3+parseInt(_0xd59600(0xb4))/0x4*(-parseInt(_0xd59600(0xb8))/0x5)+-parseInt(_0xd59600(0xae))/0x6*(-parseInt(_0xd59600(0xa6))/0x7)+parseInt(_0xd59600(0xa0))/0x8*(parseInt(_0xd59600(0xb2))/0x9)+parseInt(_0xd59600(0xaa))/0xa*(parseInt(_0xd59600(0xa7))/0xb)+-parseInt(_0xd59600(0xb3))/0xc*(parseInt(_0xd59600(0xa8))/0xd);if(_0xa35cd0===_0x469ed6)break;else _0x402b39['push'](_0x402b39['shift']());}catch(_0x367b30){_0x402b39['push'](_0x402b39['shift']());}}}(a3_0x3533,0x800c3));function a3_0x3533(){const _0x10a4a3=['378234TyjTHN','message','slice','startsWith','9KXrcGl','168CiDrfq','1204OZUSPa','resolve','Skipping\x20','invalid\x20path\x20or\x20inaccessible','3785QFdkdi','898sPBNPC','stat','Skipping\x20invalid\x20directory:\x20','4623848FvmxFf','realpath','push','homedir','\x20due\x20to\x20error:\x20','1241226ouyLRH','49AvKhDA','22glrouq','804297eFgPti','error','54130GOoGSc','uri','isDirectory','2232zqZaKW'];a3_0x3533=function(){return _0x10a4a3;};return a3_0x3533();}function a3_0x50cd(_0x57a6fc,_0x29824e){_0x57a6fc=_0x57a6fc-0xa0;const _0x353317=a3_0x3533();let _0x50cd08=_0x353317[_0x57a6fc];return _0x50cd08;}import{promises as a3_0x39e713}from'fs';import a3_0xbdf1bb from'path';import a3_0xb0d2d6 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x15b68d){const _0x10510b=a3_0x50cd;try{const _0x433ce7=_0x15b68d[_0x10510b(0xb1)]('file://')?_0x15b68d[_0x10510b(0xb0)](0x7):_0x15b68d,_0x4ae8c3=_0x433ce7[_0x10510b(0xb1)]('~/')||_0x433ce7==='~'?a3_0xbdf1bb['join'](a3_0xb0d2d6[_0x10510b(0xa3)](),_0x433ce7[_0x10510b(0xb0)](0x1)):_0x433ce7,_0x482478=a3_0xbdf1bb[_0x10510b(0xb5)](_0x4ae8c3),_0x382959=await a3_0x39e713[_0x10510b(0xa1)](_0x482478);return normalizePath(_0x382959);}catch{return null;}}function formatDirectoryError(_0xc77055,_0x47150b,_0x104e17){const _0x1bfc99=a3_0x50cd;if(_0x104e17)return _0x1bfc99(0xb6)+_0x104e17+':\x20'+_0xc77055;const _0x172272=_0x47150b instanceof Error?_0x47150b[_0x1bfc99(0xaf)]:String(_0x47150b);return _0x1bfc99(0xbb)+_0xc77055+_0x1bfc99(0xa4)+_0x172272;}export async function getValidRootDirectories(_0x3ef4d9){const _0x598595=a3_0x50cd,_0x43e336=[];for(const _0x278455 of _0x3ef4d9){const _0x849086=await parseRootUri(_0x278455[_0x598595(0xab)]);if(!_0x849086){console[_0x598595(0xa9)](formatDirectoryError(_0x278455[_0x598595(0xab)],undefined,_0x598595(0xb7)));continue;}try{const _0x10188c=await a3_0x39e713[_0x598595(0xba)](_0x849086);_0x10188c[_0x598595(0xac)]()?_0x43e336[_0x598595(0xa2)](_0x849086):console[_0x598595(0xa9)](formatDirectoryError(_0x849086,undefined,'non-directory\x20root'));}catch(_0x3768e1){console[_0x598595(0xa9)](formatDirectoryError(_0x849086,_0x3768e1));}}return _0x43e336;}
1
+ function a3_0x2870(){const _0x542170=['1327660mAKZfn','isDirectory','1654494LFORJX','startsWith','invalid\x20path\x20or\x20inaccessible','push','error','636666bXGSJh','315zZcrHn','file://','38oHsFFW','slice','message','resolve','63ifDhfr','6765250gbLEwP','homedir','uri','2374164fqnwao','non-directory\x20root','stat','73919FDEgpa','join','Skipping\x20invalid\x20directory:\x20','realpath','1029032wZPblx'];a3_0x2870=function(){return _0x542170;};return a3_0x2870();}(function(_0x5dfe8c,_0x2188e0){const _0x469d47=a3_0xa08f,_0x27ff30=_0x5dfe8c();while(!![]){try{const _0x544c38=-parseInt(_0x469d47(0x1eb))/0x1*(parseInt(_0x469d47(0x1fa))/0x2)+-parseInt(_0x469d47(0x1f2))/0x3+parseInt(_0x469d47(0x1e8))/0x4+-parseInt(_0x469d47(0x1ff))/0x5+parseInt(_0x469d47(0x1f7))/0x6+-parseInt(_0x469d47(0x1fe))/0x7*(parseInt(_0x469d47(0x1ef))/0x8)+-parseInt(_0x469d47(0x1f8))/0x9*(-parseInt(_0x469d47(0x1f0))/0xa);if(_0x544c38===_0x2188e0)break;else _0x27ff30['push'](_0x27ff30['shift']());}catch(_0x56c976){_0x27ff30['push'](_0x27ff30['shift']());}}}(a3_0x2870,0xd6cb0));import{promises as a3_0x33ee92}from'fs';import a3_0x10955e from'path';import a3_0x25e3fe from'os';function a3_0xa08f(_0x4ddd62,_0x146e4d){_0x4ddd62=_0x4ddd62-0x1e8;const _0x287046=a3_0x2870();let _0xa08fa7=_0x287046[_0x4ddd62];return _0xa08fa7;}import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x46b2ff){const _0x347d4e=a3_0xa08f;try{const _0x5c7d6f=_0x46b2ff[_0x347d4e(0x1f3)](_0x347d4e(0x1f9))?_0x46b2ff[_0x347d4e(0x1fb)](0x7):_0x46b2ff,_0x3ae253=_0x5c7d6f[_0x347d4e(0x1f3)]('~/')||_0x5c7d6f==='~'?a3_0x10955e[_0x347d4e(0x1ec)](a3_0x25e3fe[_0x347d4e(0x200)](),_0x5c7d6f[_0x347d4e(0x1fb)](0x1)):_0x5c7d6f,_0x18c684=a3_0x10955e[_0x347d4e(0x1fd)](_0x3ae253),_0x4629f7=await a3_0x33ee92[_0x347d4e(0x1ee)](_0x18c684);return normalizePath(_0x4629f7);}catch{return null;}}function formatDirectoryError(_0x248c4e,_0xb77965,_0xc2b7d3){const _0x5051a7=a3_0xa08f;if(_0xc2b7d3)return'Skipping\x20'+_0xc2b7d3+':\x20'+_0x248c4e;const _0x27919=_0xb77965 instanceof Error?_0xb77965[_0x5051a7(0x1fc)]:String(_0xb77965);return _0x5051a7(0x1ed)+_0x248c4e+'\x20due\x20to\x20error:\x20'+_0x27919;}export async function getValidRootDirectories(_0x3cde9b){const _0x2e18d7=a3_0xa08f,_0x41c17f=[];for(const _0x57d6ec of _0x3cde9b){const _0x57009d=await parseRootUri(_0x57d6ec[_0x2e18d7(0x201)]);if(!_0x57009d){console[_0x2e18d7(0x1f6)](formatDirectoryError(_0x57d6ec[_0x2e18d7(0x201)],undefined,_0x2e18d7(0x1f4)));continue;}try{const _0xba2d0=await a3_0x33ee92[_0x2e18d7(0x1ea)](_0x57009d);_0xba2d0[_0x2e18d7(0x1f1)]()?_0x41c17f[_0x2e18d7(0x1f5)](_0x57009d):console[_0x2e18d7(0x1f6)](formatDirectoryError(_0x57009d,undefined,_0x2e18d7(0x1e9)));}catch(_0x493aa9){console[_0x2e18d7(0x1f6)](formatDirectoryError(_0x57009d,_0x493aa9));}}return _0x41c17f;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.47",
3
+ "version": "0.8.51",
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.74",
38
+ "@morphllm/morphsdk": "0.2.80",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",