@performance-agent/mcp-server 1.0.1 β 1.0.6
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 +400 -25
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +783 -47
- package/dist/index.js.map +1 -1
- package/dist/prompts/jmx_prompt.txt +262 -0
- package/dist/prompts/prompts/jmx_prompt.txt +262 -0
- package/dist/tools/azure-infra/config-parser.d.ts +14 -0
- package/dist/tools/azure-infra/config-parser.d.ts.map +1 -0
- package/dist/tools/azure-infra/config-parser.js +361 -0
- package/dist/tools/azure-infra/config-parser.js.map +1 -0
- package/dist/tools/azure-infra/index.d.ts +52 -0
- package/dist/tools/azure-infra/index.d.ts.map +1 -0
- package/dist/tools/azure-infra/index.js +448 -0
- package/dist/tools/azure-infra/index.js.map +1 -0
- package/dist/tools/azure-infra/terraform-generator.d.ts +19 -0
- package/dist/tools/azure-infra/terraform-generator.d.ts.map +1 -0
- package/dist/tools/azure-infra/terraform-generator.js +458 -0
- package/dist/tools/azure-infra/terraform-generator.js.map +1 -0
- package/dist/tools/azure-infra/types.d.ts +123 -0
- package/dist/tools/azure-infra/types.d.ts.map +1 -0
- package/dist/tools/azure-infra/types.js +95 -0
- package/dist/tools/azure-infra/types.js.map +1 -0
- package/dist/tools/cloud-executor/index.d.ts +78 -0
- package/dist/tools/cloud-executor/index.d.ts.map +1 -0
- package/dist/tools/cloud-executor/index.js +528 -0
- package/dist/tools/cloud-executor/index.js.map +1 -0
- package/dist/tools/cloud-executor/result-analyzer.d.ts +65 -0
- package/dist/tools/cloud-executor/result-analyzer.d.ts.map +1 -0
- package/dist/tools/cloud-executor/result-analyzer.js +367 -0
- package/dist/tools/cloud-executor/result-analyzer.js.map +1 -0
- package/dist/tools/cloud-executor/vm-metrics.d.ts +87 -0
- package/dist/tools/cloud-executor/vm-metrics.d.ts.map +1 -0
- package/dist/tools/cloud-executor/vm-metrics.js +506 -0
- package/dist/tools/cloud-executor/vm-metrics.js.map +1 -0
- package/dist/tools/jmx-generator/index.d.ts +20 -0
- package/dist/tools/jmx-generator/index.d.ts.map +1 -0
- package/dist/tools/jmx-generator/index.js +115 -0
- package/dist/tools/jmx-generator/index.js.map +1 -0
- package/dist/tools/jmx-generator/sanitizer.d.ts +19 -0
- package/dist/tools/jmx-generator/sanitizer.d.ts.map +1 -0
- package/dist/tools/jmx-generator/sanitizer.js +166 -0
- package/dist/tools/jmx-generator/sanitizer.js.map +1 -0
- package/package.json +5 -2
- package/scripts/copy-prompts.js +46 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Performance Agent MCP Server
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server that provides
|
|
3
|
+
A Model Context Protocol (MCP) server that provides 7 core development tools for VS Code and GitHub Copilot.
|
|
4
4
|
|
|
5
5
|
## π― Features
|
|
6
6
|
|
|
@@ -9,6 +9,10 @@ A Model Context Protocol (MCP) server that provides 3 core development tools for
|
|
|
9
9
|
| **generateJMXFromSwagger** | Convert Swagger/OpenAPI specs to JMeter performance test scripts |
|
|
10
10
|
| **analyzeCodeComplexity** | Analyze cyclomatic complexity in local git repositories |
|
|
11
11
|
| **profileFunctionPerformance** | Profile function execution time and identify slow functions |
|
|
12
|
+
| **provisionAzureVM** | Provision Azure VMs from natural language descriptions |
|
|
13
|
+
| **runCloudPerformanceTest** | Execute JMeter tests on Azure VMs with automated provisioning |
|
|
14
|
+
| **analyzeTestResults** | Analyze JMeter test results with comprehensive metrics and VM performance data |
|
|
15
|
+
| **getVMMetrics** | Fetch Azure VM performance metrics (CPU, Memory, Network, Disk) during tests |
|
|
12
16
|
|
|
13
17
|
---
|
|
14
18
|
|
|
@@ -20,6 +24,11 @@ A Model Context Protocol (MCP) server that provides 3 core development tools for
|
|
|
20
24
|
- Git
|
|
21
25
|
- VS Code with GitHub Copilot
|
|
22
26
|
|
|
27
|
+
### Platform Support
|
|
28
|
+
β
**Windows** - Fully supported
|
|
29
|
+
β
**macOS** - Fully supported
|
|
30
|
+
β
**Linux** - Fully supported
|
|
31
|
+
|
|
23
32
|
### Install Dependencies
|
|
24
33
|
|
|
25
34
|
```bash
|
|
@@ -28,6 +37,8 @@ npm install
|
|
|
28
37
|
npm run build
|
|
29
38
|
```
|
|
30
39
|
|
|
40
|
+
> **Note:** Build script is cross-platform and works on Windows, macOS, and Linux.
|
|
41
|
+
|
|
31
42
|
### Optional: Enhanced Python Analysis
|
|
32
43
|
|
|
33
44
|
For more accurate Python complexity analysis:
|
|
@@ -46,7 +57,18 @@ pip install radon
|
|
|
46
57
|
|
|
47
58
|
For local development and testing:
|
|
48
59
|
|
|
49
|
-
#### Step 1:
|
|
60
|
+
#### Step 1: Configure Azure OpenAI
|
|
61
|
+
|
|
62
|
+
Create `.env` file in the mcp-server directory:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
OPENAI_ENDPOINT=https://your-openai-endpoint.openai.azure.com
|
|
66
|
+
OPENAI_API_KEY=your-api-key-here
|
|
67
|
+
OPENAI_DEPLOYMENT=gpt-4
|
|
68
|
+
OPENAI_API_VERSION=2024-02-15-preview
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Step 2: Create/Edit `.vscode/mcp.json`
|
|
50
72
|
|
|
51
73
|
```json
|
|
52
74
|
{
|
|
@@ -57,21 +79,16 @@ For local development and testing:
|
|
|
57
79
|
"/Users/amanraj/Documents/CodeWorkspace/Performance-Agent/mcp-server/dist/index.js"
|
|
58
80
|
],
|
|
59
81
|
"env": {
|
|
60
|
-
"
|
|
82
|
+
"OPENAI_ENDPOINT": "https://your-openai-endpoint.openai.azure.com",
|
|
83
|
+
"OPENAI_API_KEY": "your-api-key-here",
|
|
84
|
+
"OPENAI_DEPLOYMENT": "gpt-4"
|
|
61
85
|
}
|
|
62
86
|
}
|
|
63
87
|
}
|
|
64
88
|
}
|
|
65
89
|
```
|
|
66
90
|
|
|
67
|
-
> **Replace** `/absolute/path/to/` with your actual path.
|
|
68
|
-
|
|
69
|
-
#### Step 2: Start Backend API (for JMX generation)
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
cd /path/to/Performance-Agent
|
|
73
|
-
python app.py
|
|
74
|
-
```
|
|
91
|
+
> **Replace** `/absolute/path/to/` with your actual path and add your Azure OpenAI credentials.
|
|
75
92
|
|
|
76
93
|
#### Step 3: Restart VS Code
|
|
77
94
|
|
|
@@ -99,7 +116,7 @@ npm publish --access public
|
|
|
99
116
|
**User Installation:**
|
|
100
117
|
|
|
101
118
|
```bash
|
|
102
|
-
npm install -g @performance-agent/mcp-server
|
|
119
|
+
npm install -g @performance-agent/mcp-server@latest
|
|
103
120
|
```
|
|
104
121
|
|
|
105
122
|
**User Configuration (`.vscode/mcp.json`):**
|
|
@@ -110,8 +127,11 @@ npm install -g @performance-agent/mcp-server
|
|
|
110
127
|
"performance-agent": {
|
|
111
128
|
"command": "performance-agent-mcp",
|
|
112
129
|
"env": {
|
|
113
|
-
"
|
|
114
|
-
"
|
|
130
|
+
"OPENAI_ENDPOINT": "https://your-openai-endpoint.openai.azure.com",
|
|
131
|
+
"OPENAI_API_KEY": "your-api-key-here",
|
|
132
|
+
"OPENAI_DEPLOYMENT": "gpt-5",
|
|
133
|
+
"OPENAI_API_VERSION": "2024-12-01-preview",
|
|
134
|
+
"DEBUG": "false"
|
|
115
135
|
}
|
|
116
136
|
}
|
|
117
137
|
}
|
|
@@ -282,6 +302,301 @@ Profile functions in my last commit
|
|
|
282
302
|
|
|
283
303
|
---
|
|
284
304
|
|
|
305
|
+
### Tool 4: Provision Azure VM
|
|
306
|
+
|
|
307
|
+
**In GitHub Copilot Chat:**
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
Create a large Ubuntu VM in East US for my web server
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
Provision a Windows 2022 VM with 4 cores and 16GB RAM
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
Set up a GPU VM for machine learning with 100GB disk
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Natural Language Examples:**
|
|
322
|
+
|
|
323
|
+
| Request | Resulting Configuration |
|
|
324
|
+
|---------|------------------------|
|
|
325
|
+
| "small Ubuntu VM in westeurope" | Standard_B1ms, Ubuntu 22.04, West Europe |
|
|
326
|
+
| "large Windows server with RDP" | Standard_D4s_v3, Windows 2022, Port 3389 open |
|
|
327
|
+
| "GPU VM for ML with public IP" | Standard_NC6s_v3, Ubuntu 22.04, NVIDIA V100 |
|
|
328
|
+
| "medium web server with auto-shutdown at 7pm" | Standard_D2s_v3, Ports 80/443, Auto-shutdown 19:00 |
|
|
329
|
+
| "spot instance for budget testing" | Spot priority, cost savings up to 90% |
|
|
330
|
+
|
|
331
|
+
**Parameters:**
|
|
332
|
+
|
|
333
|
+
| Parameter | Type | Required | Default | Description |
|
|
334
|
+
|-----------|------|----------|---------|-------------|
|
|
335
|
+
| `description` | string | No* | - | Natural language description of VM |
|
|
336
|
+
| `config` | object | No* | - | Structured VM configuration |
|
|
337
|
+
| `method` | string | No | `dry-run` | `dry-run`, `terraform`, `azure-cli` |
|
|
338
|
+
| `generateTerraform` | boolean | No | `true` | Generate Terraform files |
|
|
339
|
+
| `outputPath` | string | No | `cwd` | Directory for generated files |
|
|
340
|
+
|
|
341
|
+
*Either `description` or `config` is required
|
|
342
|
+
|
|
343
|
+
**VM Size Presets:**
|
|
344
|
+
|
|
345
|
+
| Preset | Size | CPUs | RAM | Best For |
|
|
346
|
+
|--------|------|------|-----|----------|
|
|
347
|
+
| `small` | Standard_B1ms | 1 | 2GB | Testing, dev |
|
|
348
|
+
| `medium` | Standard_D2s_v3 | 2 | 8GB | General purpose |
|
|
349
|
+
| `large` | Standard_D4s_v3 | 4 | 16GB | Production |
|
|
350
|
+
| `xlarge` | Standard_D8s_v3 | 8 | 32GB | High performance |
|
|
351
|
+
| `compute-optimized` | Standard_F4s_v2 | 4 | 8GB | CPU-intensive |
|
|
352
|
+
| `memory-optimized` | Standard_E4s_v3 | 4 | 32GB | Databases, caches |
|
|
353
|
+
| `gpu` | Standard_NC6s_v3 | 6 | 112GB | ML, AI, rendering |
|
|
354
|
+
|
|
355
|
+
**Supported Operating Systems:**
|
|
356
|
+
|
|
357
|
+
| OS | Keyword |
|
|
358
|
+
|----|---------|
|
|
359
|
+
| Ubuntu 22.04 LTS | `ubuntu`, `ubuntu-22.04`, `jammy` |
|
|
360
|
+
| Ubuntu 20.04 LTS | `ubuntu-20.04`, `focal` |
|
|
361
|
+
| Debian 11 | `debian`, `bullseye` |
|
|
362
|
+
| RHEL 8 | `rhel`, `red hat`, `centos` |
|
|
363
|
+
| Windows Server 2022 | `windows`, `windows-2022` |
|
|
364
|
+
| Windows Server 2019 | `windows-2019` |
|
|
365
|
+
|
|
366
|
+
**Example Response (dry-run):**
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"success": true,
|
|
371
|
+
"vmName": "my-web-server",
|
|
372
|
+
"resourceGroup": "rg-my-web-server",
|
|
373
|
+
"region": "eastus",
|
|
374
|
+
"vmSize": "Standard_D4s_v3",
|
|
375
|
+
"provisioningState": "DryRun",
|
|
376
|
+
"terraformGenerated": true,
|
|
377
|
+
"terraformPath": "/path/to/terraform/my-web-server",
|
|
378
|
+
"estimatedCost": {
|
|
379
|
+
"hourly": 0.192,
|
|
380
|
+
"monthly": 140.16,
|
|
381
|
+
"currency": "USD"
|
|
382
|
+
},
|
|
383
|
+
"message": "Dry run completed. Terraform files generated."
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Generated Terraform Structure:**
|
|
388
|
+
|
|
389
|
+
```
|
|
390
|
+
terraform/my-web-server/
|
|
391
|
+
βββ main.tf # Complete Terraform configuration
|
|
392
|
+
βββ terraform.tfvars.example # Variables template
|
|
393
|
+
βββ README.md # Quick start guide
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### Tool 5: Run Cloud Performance Test
|
|
399
|
+
|
|
400
|
+
**In GitHub Copilot Chat:**
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
Run performance test with my JMX script
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
Execute load test on Azure VM using performance-agent_generated.jmx
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Parameters:**
|
|
411
|
+
|
|
412
|
+
| Parameter | Type | Required | Default | Description |
|
|
413
|
+
|-----------|------|----------|---------|-------------|
|
|
414
|
+
| `jmx_file_path` | string | Yes | - | Path to JMeter JMX script |
|
|
415
|
+
| `vm_size` | string | No | `Standard_B1ms` | Azure VM size for test execution |
|
|
416
|
+
| `region` | string | No | `eastus` | Azure region for VM |
|
|
417
|
+
| `resource_group` | string | No | Auto-generated | Resource group name |
|
|
418
|
+
| `cleanup_after` | boolean | No | `true` | Delete VM after test |
|
|
419
|
+
|
|
420
|
+
**Example Response:**
|
|
421
|
+
|
|
422
|
+
```json
|
|
423
|
+
{
|
|
424
|
+
"success": true,
|
|
425
|
+
"vmName": "perf-test-vm",
|
|
426
|
+
"vmPublicIP": "20.10.30.40",
|
|
427
|
+
"resourceGroup": "rg-perf-test-agent",
|
|
428
|
+
"resultsPath": ".perf-output/test-results/test-2026-01-24T10-54-02-394Z/",
|
|
429
|
+
"summary": {
|
|
430
|
+
"totalRequests": 1000,
|
|
431
|
+
"successRate": 99.5,
|
|
432
|
+
"avgResponseTime": 245,
|
|
433
|
+
"throughput": 50
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
### Tool 6: Analyze Test Results
|
|
441
|
+
|
|
442
|
+
**In GitHub Copilot Chat:**
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
Analyze my test results
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
```
|
|
449
|
+
Show me performance metrics from the last test
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**Parameters:**
|
|
453
|
+
|
|
454
|
+
| Parameter | Type | Required | Description |
|
|
455
|
+
|-----------|------|----------|-------------|
|
|
456
|
+
| `result_file_path` | string | Yes | Path to JMeter results.jtl file |
|
|
457
|
+
| `resource_group` | string | No | Azure resource group for VM metrics |
|
|
458
|
+
| `vm_name` | string | No | VM name for infrastructure metrics |
|
|
459
|
+
| `test_start_time` | string | No | ISO 8601 timestamp for metrics time range |
|
|
460
|
+
| `test_end_time` | string | No | ISO 8601 timestamp for metrics time range |
|
|
461
|
+
|
|
462
|
+
**Example Response:**
|
|
463
|
+
|
|
464
|
+
```json
|
|
465
|
+
{
|
|
466
|
+
"success": true,
|
|
467
|
+
"summary": {
|
|
468
|
+
"totalRequests": 1000,
|
|
469
|
+
"successfulRequests": 995,
|
|
470
|
+
"errorRate": 0.5,
|
|
471
|
+
"avgResponseTime": 245.2,
|
|
472
|
+
"p95ResponseTime": 450,
|
|
473
|
+
"p99ResponseTime": 680,
|
|
474
|
+
"throughput": 50.2
|
|
475
|
+
},
|
|
476
|
+
"vmMetrics": {
|
|
477
|
+
"available": true,
|
|
478
|
+
"cpuUsage": { "avg": 45.2, "max": 78.5 },
|
|
479
|
+
"memoryUsage": { "avg": 62.3, "max": 85.1 },
|
|
480
|
+
"networkIO": { "inboundMBps": 12.5, "outboundMBps": 8.3 },
|
|
481
|
+
"diskIO": { "readMBps": 25.1, "writeMBps": 15.7 }
|
|
482
|
+
},
|
|
483
|
+
"insights": [
|
|
484
|
+
"β
All requests completed successfully with 0.5% error rate",
|
|
485
|
+
"β
Good response times - API performance is acceptable",
|
|
486
|
+
"β οΈ WARNING: VM Memory Usage - Avg 62.3%, Max 85.1% (High)"
|
|
487
|
+
],
|
|
488
|
+
"recommendations": [
|
|
489
|
+
"β οΈ Memory usage is high - consider increasing VM memory"
|
|
490
|
+
]
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
**VM Metrics Analysis:**
|
|
495
|
+
|
|
496
|
+
The tool automatically analyzes infrastructure performance and provides:
|
|
497
|
+
- π’ **Normal** - Metrics within acceptable ranges
|
|
498
|
+
- π **Warning** - Approaching limits (CPU >70%, Memory >80%)
|
|
499
|
+
- π΄ **Critical** - Exceeding limits (CPU >80%, Memory >90%)
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
### Tool 7: Get VM Metrics
|
|
504
|
+
|
|
505
|
+
**In GitHub Copilot Chat:**
|
|
506
|
+
|
|
507
|
+
```
|
|
508
|
+
Get VM metrics for perf-test-vm
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
Show me CPU and memory usage during the test
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
**Parameters:**
|
|
516
|
+
|
|
517
|
+
| Parameter | Type | Required | Default | Description |
|
|
518
|
+
|-----------|------|----------|---------|-------------|
|
|
519
|
+
| `resource_group` | string | Yes | - | Azure resource group name |
|
|
520
|
+
| `vm_name` | string | No | Auto-detected | VM name (detected from Terraform) |
|
|
521
|
+
| `time_range` | string | No | `1h` | `1h`, `6h`, `24h`, or `custom` |
|
|
522
|
+
| `start_time` | string | If custom | - | ISO 8601 start timestamp |
|
|
523
|
+
| `end_time` | string | If custom | - | ISO 8601 end timestamp |
|
|
524
|
+
| `metrics` | array | No | `['all']` | `['cpu', 'memory', 'network', 'disk']` or `['all']` |
|
|
525
|
+
|
|
526
|
+
**Example Response:**
|
|
527
|
+
|
|
528
|
+
```json
|
|
529
|
+
{
|
|
530
|
+
"success": true,
|
|
531
|
+
"resourceGroup": "rg-perf-test-new",
|
|
532
|
+
"vmName": "perf-test-vm",
|
|
533
|
+
"timeRange": "1h",
|
|
534
|
+
"metrics": {
|
|
535
|
+
"cpu": {
|
|
536
|
+
"average": 45.2,
|
|
537
|
+
"maximum": 78.5,
|
|
538
|
+
"minimum": 12.3,
|
|
539
|
+
"unit": "%",
|
|
540
|
+
"status": "normal",
|
|
541
|
+
"analysis": "β
CPU usage averaged 45.2% - Healthy utilization"
|
|
542
|
+
},
|
|
543
|
+
"memory": {
|
|
544
|
+
"average": 62.3,
|
|
545
|
+
"maximum": 85.1,
|
|
546
|
+
"minimum": 45.7,
|
|
547
|
+
"unit": "%",
|
|
548
|
+
"status": "warning",
|
|
549
|
+
"analysis": "β οΈ WARNING: Memory usage at 62.3% - VM is running high on memory"
|
|
550
|
+
},
|
|
551
|
+
"network": {
|
|
552
|
+
"bytesIn": { "total": 1250.5, "average": 12.5, "unit": "MB" },
|
|
553
|
+
"bytesOut": { "total": 830.2, "average": 8.3, "unit": "MB" },
|
|
554
|
+
"status": "normal"
|
|
555
|
+
},
|
|
556
|
+
"disk": {
|
|
557
|
+
"readBytes": { "total": 2510.3, "average": 25.1, "unit": "MB" },
|
|
558
|
+
"writeBytes": { "total": 1570.8, "average": 15.7, "unit": "MB" },
|
|
559
|
+
"iops": { "read": 450, "write": 320 },
|
|
560
|
+
"status": "normal"
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
"anomalies": [
|
|
564
|
+
"β οΈ WARNING: Memory usage at 62.3% - VM is running high on memory"
|
|
565
|
+
],
|
|
566
|
+
"summary": "β οΈ VM Performance Issues Detected: 1 anomaly found"
|
|
567
|
+
}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**Raw Metrics Debugging:**
|
|
571
|
+
|
|
572
|
+
All raw Azure Monitor data is saved to `.perf-output/vm-metrics-raw/<vm-name>-<timestamp>/` for verification:
|
|
573
|
+
- `vm-details.json` - Complete VM configuration (size, SKU)
|
|
574
|
+
- `cpu-raw.json` - Raw CPU metrics from Azure Monitor
|
|
575
|
+
- `memory-raw.json` - Raw memory data with calculation details (VM size, total memory bytes)
|
|
576
|
+
- `network-in-raw.json` / `network-out-raw.json` - Network traffic data
|
|
577
|
+
- `disk-read-raw.json` / `disk-write-raw.json` - Disk I/O data
|
|
578
|
+
- `summary.json` - Processed metrics with calculation formulas
|
|
579
|
+
|
|
580
|
+
**Memory Calculation Formula:**
|
|
581
|
+
```
|
|
582
|
+
Memory Usage % = ((Total Memory Bytes - Available Memory Bytes) / Total Memory Bytes) Γ 100
|
|
583
|
+
|
|
584
|
+
Example: Standard_B1ms (2GB total)
|
|
585
|
+
- Available: 700 MB
|
|
586
|
+
- Used: 1348 MB (66.4%)
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
**VM Metrics Thresholds:**
|
|
590
|
+
|
|
591
|
+
| Metric | Normal | Warning | Critical |
|
|
592
|
+
|--------|--------|---------|----------|
|
|
593
|
+
| **CPU** | < 70% | 70-80% | > 80% |
|
|
594
|
+
| **Memory** | < 80% | 80-90% | > 90% |
|
|
595
|
+
| **Network** | < 100 MB/s | 100-500 MB/s | > 500 MB/s |
|
|
596
|
+
| **Disk I/O** | < 50 MB/s | 50-100 MB/s | > 100 MB/s |
|
|
597
|
+
|
|
598
|
+
---
|
|
599
|
+
|
|
285
600
|
## π Complexity Thresholds
|
|
286
601
|
|
|
287
602
|
| Score | Risk Level | Recommendation |
|
|
@@ -346,6 +661,38 @@ Profile the performance of my functions
|
|
|
346
661
|
|
|
347
662
|
Identify slow functions and get optimization recommendations.
|
|
348
663
|
|
|
664
|
+
### Azure Infrastructure Provisioning
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
Create a large Ubuntu VM in East US with public IP and ports 22, 80, 443 open
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Generate Terraform/CLI commands to provision Azure VMs.
|
|
671
|
+
|
|
672
|
+
### Cloud Performance Testing
|
|
673
|
+
|
|
674
|
+
```
|
|
675
|
+
Run performance test with performance-agent_generated.jmx
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
Execute JMeter test on Azure VM with automated provisioning and cleanup.
|
|
679
|
+
|
|
680
|
+
### Infrastructure Monitoring
|
|
681
|
+
|
|
682
|
+
```
|
|
683
|
+
Get VM metrics for my test VM
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
Monitor CPU, memory, network, and disk usage during performance tests to identify bottlenecks.
|
|
687
|
+
|
|
688
|
+
### Test Result Analysis
|
|
689
|
+
|
|
690
|
+
```
|
|
691
|
+
Analyze my test results
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
Get comprehensive performance analysis with VM infrastructure metrics, insights, and actionable recommendations.
|
|
695
|
+
|
|
349
696
|
---
|
|
350
697
|
|
|
351
698
|
## ποΈ Architecture
|
|
@@ -370,6 +717,22 @@ Identify slow functions and get optimization recommendations.
|
|
|
370
717
|
β β Profiler β β
|
|
371
718
|
β βββββββββββββ β
|
|
372
719
|
β βββββββββββββ β
|
|
720
|
+
β β Azure VM ββββΌβββΊ Generates Terraform/Azure CLI
|
|
721
|
+
β β Provision β β
|
|
722
|
+
β βββββββββββββ β
|
|
723
|
+
β βββββββββββββ β
|
|
724
|
+
β βCloud Test ββββΌβββΊ Provisions VM, Runs JMeter, Fetches Results
|
|
725
|
+
β β Executor β β
|
|
726
|
+
β βββββββββββββ β
|
|
727
|
+
β βββββββββββββ β
|
|
728
|
+
β β VM MetricsββββΌβββΊ Azure Monitor API (CPU/Memory/Network/Disk)
|
|
729
|
+
β β Fetcher β β
|
|
730
|
+
β βββββββββββββ β
|
|
731
|
+
β βββββββββββββ β
|
|
732
|
+
β β Test ββββΌβββΊ Analyzes JTL + VM Metrics
|
|
733
|
+
β β Analyzer β β
|
|
734
|
+
β βββββββββββββ β
|
|
735
|
+
β βββββββββββββ β
|
|
373
736
|
β β JMX Gen ββββΌβββΊ Backend API (Flask)
|
|
374
737
|
β βββββββββββββ β
|
|
375
738
|
βββββββββββββββββββ
|
|
@@ -391,11 +754,21 @@ mcp-server/
|
|
|
391
754
|
β β βββ analyzers/
|
|
392
755
|
β β βββ python-analyzer.ts # Python (radon)
|
|
393
756
|
β β βββ javascript-analyzer.ts # JS/TS (escomplex)
|
|
394
|
-
β
|
|
395
|
-
β
|
|
396
|
-
β
|
|
397
|
-
β
|
|
398
|
-
β
|
|
757
|
+
β βββ function-profiler/
|
|
758
|
+
β β βββ index.ts # Profiler entry point
|
|
759
|
+
β β βββ types.ts # TypeScript interfaces
|
|
760
|
+
β β βββ python-profiler.ts # Python (timeit)
|
|
761
|
+
β β βββ javascript-profiler.ts # JS/TS profiler
|
|
762
|
+
β βββ azure-infra/
|
|
763
|
+
β β βββ index.ts # Azure provisioner entry point
|
|
764
|
+
β β βββ types.ts # VM configuration types
|
|
765
|
+
β β βββ config-parser.ts # Natural language parser
|
|
766
|
+
β β βββ terraform-generator.ts # Terraform/CLI generator
|
|
767
|
+
β βββ cloud-executor/
|
|
768
|
+
β βββ index.ts # Cloud test executor
|
|
769
|
+
β βββ vm-metrics.ts # Azure Monitor metrics fetcher
|
|
770
|
+
β βββ result-analyzer.ts # Test result analyzer with VM metrics
|
|
771
|
+
β βββ test-executor.ts # JMeter test execution on Azure
|
|
399
772
|
βββ dist/ # Compiled JavaScript
|
|
400
773
|
βββ package.json
|
|
401
774
|
βββ tsconfig.json
|
|
@@ -458,18 +831,20 @@ curl http://localhost:8000/health
|
|
|
458
831
|
## π Security
|
|
459
832
|
|
|
460
833
|
- All complexity analysis runs **locally** - no code sent externally
|
|
461
|
-
-
|
|
462
|
-
- HTTPS
|
|
834
|
+
- Azure OpenAI credentials stored in environment variables
|
|
835
|
+
- HTTPS for Azure OpenAI API calls
|
|
463
836
|
- No sensitive data logged
|
|
464
837
|
|
|
465
838
|
---
|
|
466
839
|
|
|
467
840
|
## π Environment Variables
|
|
468
841
|
|
|
469
|
-
| Variable |
|
|
470
|
-
|
|
471
|
-
| `
|
|
472
|
-
| `
|
|
842
|
+
| Variable | Required | Example | Description |
|
|
843
|
+
|----------|----------|---------|-------------|
|
|
844
|
+
| `OPENAI_ENDPOINT` | β
Yes | `https://your-openai.openai.azure.com` | Azure OpenAI endpoint URL |
|
|
845
|
+
| `OPENAI_API_KEY` | β
Yes | `your-api-key-here` | Azure OpenAI API key |
|
|
846
|
+
| `OPENAI_DEPLOYMENT` | β
Yes | `gpt-4` | Azure OpenAI deployment name |
|
|
847
|
+
| `OPENAI_API_VERSION` | No | `2024-02-15-preview` | Azure OpenAI API version |
|
|
473
848
|
|
|
474
849
|
---
|
|
475
850
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Performance Agent MCP Server
|
|
4
4
|
*
|
|
5
|
-
* This MCP server provides
|
|
5
|
+
* This MCP server provides 12 core tools:
|
|
6
6
|
* 1. Generate JMX scripts from Swagger/OpenAPI specifications
|
|
7
|
-
* 2.
|
|
8
|
-
* 3.
|
|
7
|
+
* 2. Prepare JMX for testing (workflow tool)
|
|
8
|
+
* 3. Analyze code complexity in local git repositories
|
|
9
|
+
* 4. Profile function execution time and identify slow functions
|
|
10
|
+
* 5. Provision Azure infrastructure (VMs) from natural language descriptions
|
|
11
|
+
* 6. List Azure subscriptions for user selection
|
|
12
|
+
* 7. Set active Azure subscription
|
|
13
|
+
* 8. List Azure resource groups for reuse
|
|
14
|
+
* 9. Run end-to-end cloud performance tests
|
|
15
|
+
* 10. Get VM size recommendations for JMX scripts
|
|
16
|
+
* 11. Cleanup Azure test infrastructure (Terraform destroy)
|
|
17
|
+
* 12. Analyze test results with VM metrics
|
|
18
|
+
* 13. Get Azure VM performance metrics (CPU, Memory, Network, Disk)
|
|
9
19
|
*
|
|
10
|
-
* Focused on local development and
|
|
20
|
+
* Focused on local development, code quality, cloud performance testing, and infrastructure monitoring.
|
|
11
21
|
*/
|
|
12
22
|
export {};
|
|
13
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;GAmBG"}
|