artillery-performance-mcp-server
Version:
MCP server for performance testing with Artillery.io
1 lines • 6.26 kB
JavaScript
const a4_0x25457f=a4_0x49fd;(function(_0x2017ba,_0x5d11cf){const _0x3fb126=a4_0x49fd,_0x430f26=_0x2017ba();while(!![]){try{const _0x114c79=parseInt(_0x3fb126(0x12d))/0x1*(parseInt(_0x3fb126(0x114))/0x2)+-parseInt(_0x3fb126(0x127))/0x3+-parseInt(_0x3fb126(0x113))/0x4+parseInt(_0x3fb126(0x10f))/0x5+-parseInt(_0x3fb126(0x111))/0x6*(-parseInt(_0x3fb126(0x107))/0x7)+parseInt(_0x3fb126(0x124))/0x8+parseInt(_0x3fb126(0x11f))/0x9*(-parseInt(_0x3fb126(0x122))/0xa);if(_0x114c79===_0x5d11cf)break;else _0x430f26['push'](_0x430f26['shift']());}catch(_0x44f211){_0x430f26['push'](_0x430f26['shift']());}}}(a4_0x5b96,0xd0567));import{ResourceTemplate}from'@modelcontextprotocol/sdk/server/mcp.js';import a4_0x40fa4e from'fs';import a4_0x1eb038 from'path';function a4_0x5b96(){const _0x583a2b=['url','string','join','Artillery\x20resources\x20registered\x20successfully','endsWith','6709805PozMbt','artillery://templates/{filename}','4722FHgUWQ','.yml','1974972sUgGkE','2kRvOGH','artillery://examples/http-get','../templates','existsSync','Failed\x20to\x20fetch\x20template:\x20','#\x20Artillery\x20Documentation\x20Resources\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a##\x20Official\x20Documentation\x0a-\x20Main\x20documentation:\x20https://www.artillery.io/docs\x0a-\x20HTTP\x20engine\x20docs:\x20https://www.artillery.io/docs/reference/engines/http\x0a-\x20Test\x20script\x20reference:\x20https://www.artillery.io/docs/reference/test-script\x0a\x0a##\x20Key\x20Concepts\x0a-\x20Artillery\x20test\x20scripts\x20are\x20written\x20in\x20YAML\x0a-\x20They\x20define\x20the\x20target\x20system,\x20load\x20phase\x20configuration,\x20and\x20scenarios\x0a-\x20Phases\x20control\x20how\x20virtual\x20users\x20are\x20created\x20over\x20time\x0a-\x20Scenarios\x20define\x20what\x20each\x20virtual\x20user\x20does\x0a-\x20Reports\x20can\x20be\x20generated\x20in\x20HTML,\x20JSON,\x20or\x20text\x20formats\x0a\x0a##\x20Basic\x20Structure\x0a```yaml\x0aconfig:\x0a\x20\x20target:\x20\x22https://example.com\x22\x0a\x20\x20phases:\x0a\x20\x20\x20\x20-\x20duration:\x2060\x0a\x20\x20\x20\x20\x20\x20arrivalRate:\x205\x0a\x20\x20\x20\x20\x20\x20name:\x20\x22Warm\x20up\x20phase\x22\x0a\x0ascenarios:\x0a\x20\x20-\x20name:\x20\x22Simple\x20flow\x22\x0a\x20\x20\x20\x20flow:\x0a\x20\x20\x20\x20\x20\x20-\x20get:\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20url:\x20\x22/api/status\x22\x0a```\x0a','artillery://examples/complex-flow','Error\x20fetching\x20HTTP\x20GET\x20template:\x20','error','resource','Invalid\x20filename:\x20','9CBkYMB','readFileSync','artillery://templates','23573580PymLOw','http-get.yml','9878792zXtsHg','filter','info','2712144OCPGVK','utf-8','href','template','Error\x20fetching\x20complex\x20flow\x20template:\x20','templates','831515xTBAQm','complex-flow.yml','artillery://templates/','10675AuDyXi','artillery-docs','Failed\x20to\x20fetch\x20complex\x20flow\x20template'];a4_0x5b96=function(){return _0x583a2b;};return a4_0x5b96();}function a4_0x49fd(_0x5e1005,_0x61fe1c){const _0x5b962e=a4_0x5b96();return a4_0x49fd=function(_0x49fd16,_0x9c0fa0){_0x49fd16=_0x49fd16-0x106;let _0x5c1547=_0x5b962e[_0x49fd16];return _0x5c1547;},a4_0x49fd(_0x5e1005,_0x61fe1c);}import{fileURLToPath}from'url';import a4_0x2b191b from'../utils/logger.js';import{readTemplate}from'../utils/file-utils.js';const __dirname=a4_0x1eb038['dirname'](fileURLToPath(import.meta[a4_0x25457f(0x10a)])),TEMPLATES_DIR=a4_0x1eb038['resolve'](__dirname,a4_0x25457f(0x116));export async function registerResources(_0x1c0079){const _0x188b1e=a4_0x25457f;a4_0x2b191b[_0x188b1e(0x126)]('Registering\x20Artillery\x20template\x20resources'),_0x1c0079[_0x188b1e(0x11d)](_0x188b1e(0x12c),_0x188b1e(0x121),async _0x4ae3f2=>{const _0x4fee4b=_0x188b1e;try{const _0x27e49d=a4_0x40fa4e['readdirSync'](TEMPLATES_DIR)[_0x4fee4b(0x125)](_0x321e9f=>_0x321e9f[_0x4fee4b(0x10e)](_0x4fee4b(0x112)))['map'](_0x300047=>({'name':_0x300047,'path':_0x4fee4b(0x106)+_0x300047}));return{'contents':[{'uri':_0x4ae3f2[_0x4fee4b(0x129)],'text':JSON['stringify'](_0x27e49d,null,0x2)}]};}catch(_0x316d6c){a4_0x2b191b['error']('Error\x20listing\x20templates:\x20'+_0x316d6c);throw new Error('Failed\x20to\x20list\x20templates');}}),_0x1c0079[_0x188b1e(0x11d)](_0x188b1e(0x12a),new ResourceTemplate(_0x188b1e(0x110),{'list':undefined}),async(_0x482638,{filename:_0x1b0de2})=>{const _0x8638e3=_0x188b1e;try{if(typeof _0x1b0de2!==_0x8638e3(0x10b))throw new Error(_0x8638e3(0x11e)+_0x1b0de2);const _0x30b4ca=a4_0x1eb038[_0x8638e3(0x10c)](TEMPLATES_DIR,_0x1b0de2);if(!a4_0x40fa4e[_0x8638e3(0x117)](_0x30b4ca))throw new Error('Template\x20not\x20found:\x20'+_0x1b0de2);const _0x43cb4f=a4_0x40fa4e[_0x8638e3(0x120)](_0x30b4ca,_0x8638e3(0x128));return{'contents':[{'uri':_0x482638[_0x8638e3(0x129)],'text':_0x43cb4f}]};}catch(_0x17dd17){a4_0x2b191b[_0x8638e3(0x11c)]('Error\x20fetching\x20template\x20'+_0x1b0de2+':\x20'+_0x17dd17);throw new Error(_0x8638e3(0x118)+_0x1b0de2);}}),_0x1c0079[_0x188b1e(0x11d)]('http-get-template',_0x188b1e(0x115),async _0x515a75=>{const _0x778843=_0x188b1e;try{const _0x413a3e=readTemplate(_0x778843(0x123));return{'contents':[{'uri':_0x515a75[_0x778843(0x129)],'text':_0x413a3e}]};}catch(_0x44b770){a4_0x2b191b[_0x778843(0x11c)](_0x778843(0x11b)+_0x44b770);throw new Error('Failed\x20to\x20fetch\x20HTTP\x20GET\x20template');}}),_0x1c0079['resource']('http-post-template','artillery://examples/http-post',async _0x2cc278=>{const _0xcf9c49=_0x188b1e;try{const _0x11eb53=readTemplate('http-post.yml');return{'contents':[{'uri':_0x2cc278[_0xcf9c49(0x129)],'text':_0x11eb53}]};}catch(_0x52d063){a4_0x2b191b[_0xcf9c49(0x11c)]('Error\x20fetching\x20HTTP\x20POST\x20template:\x20'+_0x52d063);throw new Error('Failed\x20to\x20fetch\x20HTTP\x20POST\x20template');}}),_0x1c0079['resource']('complex-flow-template',_0x188b1e(0x11a),async _0x1d2aa3=>{const _0x4305ae=_0x188b1e;try{const _0x44111c=readTemplate(_0x4305ae(0x12e));return{'contents':[{'uri':_0x1d2aa3['href'],'text':_0x44111c}]};}catch(_0x244d43){a4_0x2b191b['error'](_0x4305ae(0x12b)+_0x244d43);throw new Error(_0x4305ae(0x109));}}),_0x1c0079['resource'](_0x188b1e(0x108),'artillery://docs',async _0x46f497=>{const _0x305151=_0x188b1e;return{'contents':[{'uri':_0x46f497['href'],'text':_0x305151(0x119)}]};}),a4_0x2b191b['info'](_0x188b1e(0x10d));}