@mithung/vunet-mcp-server 2.0.0

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 ADDED
@@ -0,0 +1,679 @@
1
+ # @vunet/mcp-server
2
+
3
+ [![npm version](https://badge.fury.io/js/%40vunet%2Fmcp-server.svg)](https://badge.fury.io/js/%40vunet%2Fmcp-server)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org)
6
+
7
+ **Model Context Protocol (MCP) Server for Vunet vuSmartMaps** - A multi-tenant observability platform integration similar to Dynatrace MCP.
8
+
9
+ Query metrics, traces, logs, and data models from your Vunet tenants using natural language through AI assistants like Claude, ChatGPT, or any MCP-compatible client.
10
+
11
+ ---
12
+
13
+ ## 🚀 Features
14
+
15
+ - ✅ **Multi-Tenant Support** - Connect to multiple Vunet tenants simultaneously
16
+ - 🔐 **Secure Authentication** - Session-based authentication with automatic token refresh
17
+ - 📊 **Comprehensive Data Access** - Query 80+ data models including:
18
+ - Kubernetes metrics
19
+ - Application traces
20
+ - Transaction volumes
21
+ - Infrastructure metrics
22
+ - Custom data models
23
+ - ⚡ **Flexible Querying** - Support for:
24
+ - Relative time ranges (`15m`, `1h`, `1d`, `1w`, `1M`, `1y`)
25
+ - Absolute time ranges (epoch timestamps)
26
+ - Dynamic filters and field selection
27
+ - Time-shift comparisons
28
+ - Threshold data inclusion
29
+ - 🔄 **Automatic Session Management** - Handles login, token refresh, and logout
30
+ - 🌐 **SSL/TLS Support** - Configurable SSL certificate verification
31
+ - 📦 **Easy Installation** - npm package ready for global or local use
32
+
33
+ ---
34
+
35
+ ## 📋 Table of Contents
36
+
37
+ - [Installation](#installation)
38
+ - [Quick Start](#quick-start)
39
+ - [Configuration](#configuration)
40
+ - [VS Code Configuration](#vs-code-configuration)
41
+ - [Multiple Tenants](#multiple-tenants)
42
+ - [Usage](#usage)
43
+ - [Available Tools](#available-tools)
44
+ - [Query Examples](#query-examples)
45
+ - [Data Models](#data-models)
46
+ - [Environment Variables](#environment-variables)
47
+ - [Troubleshooting](#troubleshooting)
48
+ - [Examples](#examples)
49
+ - [Contributing](#contributing)
50
+ - [License](#license)
51
+
52
+ ---
53
+
54
+ ## 📦 Installation
55
+
56
+ ### Global Installation (Recommended)
57
+
58
+ ```bash
59
+ npm install -g @vunet/mcp-server
60
+ ```
61
+
62
+ ### Local Installation
63
+
64
+ ```bash
65
+ npm install @vunet/mcp-server
66
+ ```
67
+
68
+ ### From Source
69
+
70
+ ```bash
71
+ git clone https://github.com/vunet-systems/vunet-mcp-server.git
72
+ cd vunet-mcp-server
73
+ npm install
74
+ npm link
75
+ ```
76
+
77
+ ---
78
+
79
+ ## 🚀 Quick Start
80
+
81
+ ### 1. Configure VS Code (or any MCP client)
82
+
83
+ Add to your `settings.json` or `.vscode/mcp.json`:
84
+
85
+ **Option A: Username/Password Authentication**
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "vunet": {
90
+ "command": "npx",
91
+ "args": ["@vunet/mcp-server"],
92
+ "env": {
93
+ "VUNET_TENANT_URL": "https://your-tenant.vunetsystems.com",
94
+ "VUNET_USERNAME": "your-username",
95
+ "VUNET_PASSWORD": "your-password",
96
+ "VUNET_BU_ID": "1",
97
+ "VUNET_VERIFY_SSL": "true"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ **Option B: Bearer Token Authentication (Recommended for CI/CD)**
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "vunet": {
109
+ "command": "npx",
110
+ "args": ["@vunet/mcp-server"],
111
+ "env": {
112
+ "VUNET_TENANT_URL": "https://your-tenant.vunetsystems.com",
113
+ "VUNET_BEARER_TOKEN": "your-bearer-token-here",
114
+ "VUNET_BU_ID": "1",
115
+ "VUNET_VERIFY_SSL": "true"
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ ### 2. Reload VS Code
123
+
124
+ Press `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac), then run:
125
+ ```
126
+ Developer: Reload Window
127
+ ```
128
+
129
+ ### 3. Start Using!
130
+
131
+ Open GitHub Copilot Chat or any MCP client and ask:
132
+ - "Show me Kubernetes metrics for the last 15 minutes"
133
+ - "What traces are taking more than 5 seconds?"
134
+ - "Get transaction volume for the last 24 hours"
135
+
136
+ ---
137
+
138
+ ## ⚙️ Configuration
139
+
140
+ ### VS Code Configuration
141
+
142
+ #### Single Tenant
143
+
144
+ Create or edit `.vscode/mcp.json` in your workspace:
145
+
146
+ **Using Username/Password:**
147
+ ```json
148
+ {
149
+ "mcpServers": {
150
+ "vunet": {
151
+ "command": "npx",
152
+ "args": ["@vunet/mcp-server"],
153
+ "env": {
154
+ "VUNET_TENANT_URL": "https://your-tenant.com",
155
+ "VUNET_USERNAME": "your-username",
156
+ "VUNET_PASSWORD": "your-password",
157
+ "VUNET_BU_ID": "1",
158
+ "VUNET_VERIFY_SSL": "true"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ **Using Bearer Token:**
166
+ ```json
167
+ {
168
+ "mcpServers": {
169
+ "vunet": {
170
+ "command": "npx",
171
+ "args": ["@vunet/mcp-server"],
172
+ "env": {
173
+ "VUNET_TENANT_URL": "https://your-tenant.com",
174
+ "VUNET_BEARER_TOKEN": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
175
+ "VUNET_BU_ID": "1",
176
+ "VUNET_VERIFY_SSL": "true"
177
+ }
178
+ }
179
+ }
180
+ }
181
+ ```
182
+
183
+ #### Multiple Tenants
184
+
185
+ ```json
186
+ {
187
+ "mcpServers": {
188
+ "vunet-production": {
189
+ "command": "npx",
190
+ "args": ["@vunet/mcp-server"],
191
+ "env": {
192
+ "VUNET_TENANT_URL": "https://prod.company.com",
193
+ "VUNET_USERNAME": "prod-user",
194
+ "VUNET_PASSWORD": "prod-password",
195
+ "VUNET_BU_ID": "1",
196
+ "VUNET_VERIFY_SSL": "true"
197
+ }
198
+ },
199
+ "vunet-staging": {
200
+ "command": "npx",
201
+ "args": ["@vunet/mcp-server"],
202
+ "env": {
203
+ "VUNET_TENANT_URL": "https://staging.company.com",
204
+ "VUNET_USERNAME": "staging-user",
205
+ "VUNET_PASSWORD": "staging-password",
206
+ "VUNET_BU_ID": "1",
207
+ "VUNET_VERIFY_SSL": "true"
208
+ }
209
+ },
210
+ "vunet-dev": {
211
+ "command": "node",
212
+ "args": ["C:\\path\\to\\local\\vunet-mcp-server\\index.js"],
213
+ "env": {
214
+ "VUNET_TENANT_URL": "https://dev.company.com",
215
+ "VUNET_USERNAME": "dev-user",
216
+ "VUNET_PASSWORD": "dev-password",
217
+ "VUNET_BU_ID": "1",
218
+ "VUNET_VERIFY_SSL": "false"
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ```
224
+
225
+ ### Windows Path Format
226
+
227
+ For local installations on Windows, use double backslashes or forward slashes:
228
+
229
+ ```json
230
+ {
231
+ "command": "C:\\Program Files\\nodejs\\node.exe",
232
+ "args": ["C:\\Projects\\vunet-mcp-server\\index.js"]
233
+ }
234
+ ```
235
+
236
+ Or:
237
+
238
+ ```json
239
+ {
240
+ "command": "C:/Program Files/nodejs/node.exe",
241
+ "args": ["C:/Projects/vunet-mcp-server/index.js"]
242
+ }
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 🛠️ Usage
248
+
249
+ ### Available Tools
250
+
251
+ #### 1. `vunet_query_metric`
252
+
253
+ Query any Vunet data model with flexible time ranges and filters.
254
+
255
+ **Parameters:**
256
+
257
+ | Parameter | Type | Required | Description | Example |
258
+ |-----------|------|----------|-------------|---------|
259
+ | `metric_name` | string | ✅ | Data model name | `"Trace Map Data"` |
260
+ | `relative_time` | string | ❌ | Relative time range | `"1h"`, `"24h"`, `"7d"` |
261
+ | `start_time` | string | ❌ | Start timestamp | `"1770886639"`, `"now-1h"` |
262
+ | `end_time` | string | ❌ | End timestamp | `"1770973039"`, `"now"` |
263
+ | `filters` | object | ❌ | Dynamic filters | `{"service": "ibmb"}` |
264
+ | `include` | string | ❌ | Include specific fields | `"timestamp,duration"` |
265
+ | `exclude` | string | ❌ | Exclude specific fields | `"raw_data"` |
266
+ | `thresholds` | boolean | ❌ | Include thresholds | `true` |
267
+ | `formatting` | string | ❌ | Response format | `"lama"` |
268
+ | `add_on_time_intervals` | array | ❌ | Additional time comparisons | `["1h_ago", "1d_ago"]` |
269
+ | `time_shift` | string | ❌ | Time shift for comparison | `"1d"` |
270
+
271
+ #### 2. `vunet_get_status`
272
+
273
+ Get current connection status and tenant information.
274
+
275
+ **Returns:**
276
+ - Connection status
277
+ - Tenant URL
278
+ - Authentication status
279
+ - Session expiry
280
+
281
+ #### 3. `vunet_list_data_models`
282
+
283
+ List common Vunet data models organized by category.
284
+
285
+ **Parameters:**
286
+
287
+ | Parameter | Type | Required | Description | Example |
288
+ |-----------|------|----------|-------------|---------|
289
+ | `category` | string | ❌ | Filter by category | `"all"`, `"apm"`, `"infrastructure"`, `"database"` |
290
+
291
+ **Categories:**
292
+ - `all` - All data models (default)
293
+ - `apm` - Application Performance Monitoring
294
+ - `infrastructure` - Kubernetes, servers, system resources
295
+ - `database` - Database performance metrics
296
+ - `network` - Network monitoring
297
+ - `business` - Business KPIs
298
+ - `logs` - Log analytics
299
+ - `security` - Security events
300
+
301
+ **Returns:**
302
+ - List of common data models by category
303
+ - Total count of listed models
304
+ - Usage instructions
305
+
306
+ ---
307
+
308
+ ### Query Examples
309
+
310
+ #### Example 1: Get Traces (Last 2 Days)
311
+
312
+ ```
313
+ Show me all traces from the last 2 days
314
+ ```
315
+
316
+ **Behind the scenes:**
317
+ ```json
318
+ {
319
+ "metric_name": "Trace Map Data",
320
+ "relative_time": "2d"
321
+ }
322
+ ```
323
+
324
+ #### Example 2: Filter Slow Traces
325
+
326
+ ```
327
+ Show traces with duration > 5 seconds in the last 24 hours
328
+ ```
329
+
330
+ **Post-processing with filters:**
331
+ ```json
332
+ {
333
+ "metric_name": "Trace Map Data",
334
+ "relative_time": "24h"
335
+ }
336
+ ```
337
+ Then filter where `duration > 5000` (milliseconds)
338
+
339
+ #### Example 3: Kubernetes Metrics
340
+
341
+ ```
342
+ Get Kubernetes pod metrics for the last 15 minutes
343
+ ```
344
+
345
+ ```json
346
+ {
347
+ "metric_name": "Kubernetes Pod Metrics",
348
+ "relative_time": "15m"
349
+ }
350
+ ```
351
+
352
+ #### Example 4: Transaction Volume by Service
353
+
354
+ ```
355
+ Show transaction volume by service for last hour
356
+ ```
357
+
358
+ ```json
359
+ {
360
+ "metric_name": "Traces Transaction Volume",
361
+ "relative_time": "1h",
362
+ "filters": {
363
+ "service": "ibmb"
364
+ }
365
+ }
366
+ ```
367
+
368
+ #### Example 5: Compare Performance (Time Shift)
369
+
370
+ ```
371
+ Compare current hour performance with 1 day ago
372
+ ```
373
+
374
+ ```json
375
+ {
376
+ "metric_name": "Trace Map Data",
377
+ "relative_time": "1h",
378
+ "time_shift": "1d"
379
+ }
380
+ ```
381
+
382
+ ---
383
+
384
+ ## 📊 Data Models
385
+
386
+ Common data models available (80+ total).
387
+
388
+ > **📖 Complete Reference:** See [DATA_MODELS.md](DATA_MODELS.md) for comprehensive list and examples.
389
+
390
+ > **🔧 Programmatic Access:** Use the `vunet_list_data_models` tool to get the curated list with category filtering.
391
+
392
+ ### Application Performance
393
+ - `Trace Map Data` - Individual trace spans with duration
394
+ - `Traces Transaction Volume` - Aggregated transaction counts
395
+ - `Application Response Time` - Response time metrics
396
+ - `Error Rate` - Error tracking and analysis
397
+
398
+ ### Infrastructure
399
+ - `Kubernetes Pod Metrics` - Pod-level metrics
400
+ - `Kubernetes Node Metrics` - Node-level metrics
401
+ - `Kubernetes Deployment Metrics` - Deployment tracking
402
+ - `CPU Usage` - CPU utilization
403
+ - `Memory Usage` - Memory consumption
404
+ - `Disk I/O` - Disk operations
405
+
406
+ ### Business Metrics
407
+ - `VuBank Metrics` - Custom business metrics
408
+ - `Transaction Success Rate` - Success/failure tracking
409
+ - `User Sessions` - Session analytics
410
+
411
+ ### Database
412
+ - `MySQL Performance` - MySQL metrics
413
+ - `Hibernate Query Performance` - ORM performance
414
+
415
+ ### Custom
416
+ - Custom data models defined in your tenant
417
+
418
+ **Quick Discovery:**
419
+ ```
420
+ # List all categories
421
+ vunet_list_data_models
422
+
423
+ # Filter by category
424
+ vunet_list_data_models --category apm
425
+ vunet_list_data_models --category infrastructure
426
+ ```
427
+
428
+ **Natural Language:**
429
+ ```
430
+ "What data models are available for APM?"
431
+ "Show me infrastructure metrics"
432
+ "List database performance models"
433
+ ```
434
+
435
+ ---
436
+
437
+ ## 🔐 Environment Variables
438
+
439
+ | Variable | Required | Default | Description |
440
+ |----------|----------|---------|-------------|
441
+ | `VUNET_TENANT_URL` | ✅ | - | Vunet tenant URL (e.g., `https://tenant.com`) |
442
+ | `VUNET_USERNAME` | ✅* | - | Username for authentication (*required if no bearer token) |
443
+ | `VUNET_PASSWORD` | ✅* | - | Password for authentication (*required if no bearer token) |
444
+ | `VUNET_BEARER_TOKEN` | ✅* | - | API bearer token (*required if no username/password) |
445
+ | `VUNET_BU_ID` | ❌ | `"1"` | Business Unit ID |
446
+ | `VUNET_VERIFY_SSL` | ❌ | `"true"` | Enable SSL verification (`"true"` or `"false"`) |
447
+
448
+ **Security Note:** Never commit credentials to version control. Use environment variables or secure credential stores.
449
+
450
+ ### Authentication Methods
451
+
452
+ **Method 1: Username/Password** (Auto-managed sessions)
453
+ - The server automatically logs in and manages session tokens
454
+ - Session tokens are refreshed automatically on expiry
455
+ - Ideal for interactive use
456
+
457
+ **Method 2: Bearer Token** (Long-lived API tokens)
458
+ - Use pre-generated API tokens from Vunet
459
+ - No session management needed
460
+ - Ideal for CI/CD, automation, and service accounts
461
+ - **How to get:** Generate from Vunet UI → Settings → API Tokens
462
+
463
+ **Note:** Provide either `VUNET_USERNAME`+`VUNET_PASSWORD` **OR** `VUNET_BEARER_TOKEN`, not both.
464
+
465
+ ---
466
+
467
+ ## 🐛 Troubleshooting
468
+
469
+ ### Common Issues
470
+
471
+ #### 1. "Node is not recognized as internal or external command"
472
+
473
+ **Solution:** Add Node.js to your system PATH or use full path:
474
+
475
+ ```json
476
+ {
477
+ "command": "C:\\Program Files\\nodejs\\node.exe",
478
+ "args": ["path\\to\\index.js"]
479
+ }
480
+ ```
481
+
482
+ #### 2. "Failed to authenticate to Vunet"
483
+
484
+ **Check:**
485
+ - ✅ Credentials are correct
486
+ - ✅ Tenant URL is accessible
487
+ - ✅ SSL verification settings match your environment
488
+ - ✅ Business Unit ID is correct
489
+
490
+ **Debug:**
491
+ ```bash
492
+ # Test authentication manually
493
+ curl -X POST https://your-tenant.com/vuSmartMaps/api/1/bu/1/auth/users/login/ \
494
+ -H "Content-Type: application/json" \
495
+ -d '{"username":"your-user","password":"your-pass"}'
496
+ ```
497
+
498
+ #### 3. "SSL Certificate Verification Failed"
499
+
500
+ **Solution:** For self-signed certificates or internal environments:
501
+
502
+ ```json
503
+ {
504
+ "env": {
505
+ "VUNET_VERIFY_SSL": "false"
506
+ }
507
+ }
508
+ ```
509
+
510
+ #### 4. MCP Server Not Showing in VS Code
511
+
512
+ **Steps:**
513
+ 1. Check `.vscode/mcp.json` or `settings.json` syntax
514
+ 2. Reload VS Code window (`Ctrl+Shift+P` → "Developer: Reload Window")
515
+ 3. Check VS Code output panel for errors
516
+ 4. Verify package is installed: `npm list -g @vunet/mcp-server`
517
+
518
+ #### 5. Empty or Missing Data
519
+
520
+ **Check:**
521
+ - ✅ Data model name is correct (case-sensitive)
522
+ - ✅ Time range has data
523
+ - ✅ Filters are not too restrictive
524
+ - ✅ Fields exist in the data model
525
+
526
+ ---
527
+
528
+ ## 📚 Examples
529
+
530
+ ### Example 1: Performance Analysis
531
+
532
+ ```
533
+ Create a report of all traces taking more than 5 seconds in the last 2 days
534
+ ```
535
+
536
+ **Result:** HTML report with:
537
+ - Slowest traces ranked
538
+ - Performance percentiles
539
+ - Error analysis
540
+ - Recommendations
541
+
542
+ ### Example 2: Multi-Tenant Monitoring
543
+
544
+ **Production:**
545
+ ```
546
+ @vunet-production show error rate for last hour
547
+ ```
548
+
549
+ **Staging:**
550
+ ```
551
+ @vunet-staging compare current performance with 1 day ago
552
+ ```
553
+
554
+ ### Example 3: Kubernetes Dashboard
555
+
556
+ ```
557
+ Create a Kubernetes dashboard showing pod health for the last 30 minutes
558
+ ```
559
+
560
+ **Result:** Interactive HTML dashboard with metrics visualization
561
+
562
+ ---
563
+
564
+ ## 🔧 Development
565
+
566
+ ### Run Locally
567
+
568
+ ```bash
569
+ git clone https://github.com/vunet-systems/vunet-mcp-server.git
570
+ cd vunet-mcp-server
571
+ npm install
572
+
573
+ # Set environment variables
574
+ export VUNET_TENANT_URL="https://your-tenant.com"
575
+ export VUNET_USERNAME="your-username"
576
+ export VUNET_PASSWORD="your-password"
577
+
578
+ # Run
579
+ npm start
580
+ ```
581
+
582
+ ### Watch Mode (Development)
583
+
584
+ ```bash
585
+ npm run dev
586
+ ```
587
+
588
+ ### Package for Distribution
589
+
590
+ ```bash
591
+ npm pack
592
+ ```
593
+
594
+ ---
595
+
596
+ ## 📝 API Reference
597
+
598
+ ### VunetMCPServer Class
599
+
600
+ ```javascript
601
+ class VunetMCPServer {
602
+ constructor()
603
+ async login()
604
+ async logout()
605
+ async ensureAuthenticated()
606
+ async queryMetric(metricName, queryParams)
607
+ buildQueryParams(args)
608
+ normalizeTenantUrl(url)
609
+ }
610
+ ```
611
+
612
+ ### Query Response Format
613
+
614
+ ```json
615
+ {
616
+ "metricData": [
617
+ {
618
+ "start_time": 1770886639,
619
+ "end_time": 1770973039,
620
+ "label": "Primary relative time",
621
+ "data": [
622
+ {
623
+ "timestamp": "2026-02-13 07:02:18.494",
624
+ "field1": "value1",
625
+ "field2": "value2"
626
+ }
627
+ ]
628
+ }
629
+ ]
630
+ }
631
+ ```
632
+
633
+ ---
634
+
635
+ ## 🤝 Contributing
636
+
637
+ Contributions are welcome! Please follow these steps:
638
+
639
+ 1. Fork the repository
640
+ 2. Create a feature branch: `git checkout -b feature/amazing-feature`
641
+ 3. Commit changes: `git commit -m 'Add amazing feature'`
642
+ 4. Push to branch: `git push origin feature/amazing-feature`
643
+ 5. Open a Pull Request
644
+
645
+ ---
646
+
647
+ ## 📄 License
648
+
649
+ MIT License - see [LICENSE](LICENSE) file for details
650
+
651
+ ---
652
+
653
+ ## 🙏 Acknowledgments
654
+
655
+ - Built with [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk)
656
+ - Inspired by [Dynatrace MCP Server](https://github.com/dynatrace/mcp-server)
657
+ - Powered by [Vunet vuSmartMaps](https://vunetsystems.com)
658
+
659
+ ---
660
+
661
+ ## 🔗 Links
662
+
663
+ - **Vunet Systems:** https://vunetsystems.com
664
+ - **MCP Protocol:** https://modelcontextprotocol.io
665
+ - **npm Package:** https://www.npmjs.com/package/@vunet/mcp-server
666
+ - **GitHub:** https://github.com/vunet-systems/vunet-mcp-server
667
+ - **Issues:** https://github.com/vunet-systems/vunet-mcp-server/issues
668
+
669
+ ---
670
+
671
+ ## 📞 Support
672
+
673
+ - **Documentation:** [GitHub Wiki](https://github.com/vunet-systems/vunet-mcp-server/wiki)
674
+ - **Issues:** [GitHub Issues](https://github.com/vunet-systems/vunet-mcp-server/issues)
675
+ - **Email:** support@vunetsystems.com
676
+
677
+ ---
678
+
679
+ **Made with ❤️ by Vunet Systems**