@last9/mcp-server 0.1.13 → 0.1.15

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
@@ -28,7 +28,7 @@ IDEs. Implements the following MCP
28
28
 
29
29
  **Prometheus/PromQL Tools:**
30
30
 
31
- - `promptheus_range_query`: Execute PromQL range queries for metrics data.
31
+ - `prometheus_range_query`: Execute PromQL range queries for metrics data.
32
32
  - `prometheus_instant_query`: Execute PromQL instant queries for metrics data.
33
33
  - `prometheus_label_values`: Get label values for PromQL queries.
34
34
  - `prometheus_labels`: Get available labels for PromQL queries.
@@ -41,10 +41,16 @@ IDEs. Implements the following MCP
41
41
  - `add_drop_rule`: Create a drop rule for logs at
42
42
  [Last9 Control Plane](https://last9.io/control-plane)
43
43
  - `get_service_logs`: Get raw log entries for a specific service over a time range. Can apply filters on severity and body.
44
+ - `get_log_attributes`: Get available log attributes (labels) for a specified time window.
44
45
 
45
46
  **Traces Management:**
46
47
 
47
48
  - `get_service_traces`: Query traces for a specific service with filtering options for span kinds, status codes, and other trace attributes.
49
+ - `get_trace_attributes`: Get available trace attributes (series) for a specified time window.
50
+
51
+ **Change Events:**
52
+
53
+ - `get_change_events`: Get change events from the last9_change_events prometheus metric over a given time range.
48
54
 
49
55
  **Alert Management:**
50
56
 
@@ -123,7 +129,7 @@ Parameters:
123
129
  - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
124
130
  - `env` (string, optional): Environment to filter by. Defaults to 'prod'.
125
131
 
126
- ### promptheus_range_query
132
+ ### prometheus_range_query
127
133
 
128
134
  Perform a Prometheus range query to get metrics data over a specified time range. Recommended to check available labels first using `prometheus_labels` tool.
129
135
 
@@ -268,6 +274,22 @@ Examples:
268
274
  - service_name="api" + severity_filters=["error"] + body_filters=["timeout"] → finds error logs containing "timeout"
269
275
  - service_name="web" + body_filters=["timeout", "failed", "error 500"] → finds logs containing any of these patterns
270
276
 
277
+ ### get_log_attributes
278
+
279
+ Get available log attributes (labels) for a specified time window. This tool retrieves all attribute names that exist in logs during the specified time range, which can be used for filtering and querying logs.
280
+
281
+ Parameters:
282
+
283
+ - `lookback_minutes` (integer, optional): Number of minutes to look back from now for the time window. Default: 15. Examples: 15, 30, 60.
284
+ - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes.
285
+ - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
286
+ - `region` (string, optional): AWS region to query. Leave empty to use default from configuration. Examples: ap-south-1, us-east-1, eu-west-1.
287
+
288
+ Returns:
289
+ - List of log attributes grouped into two categories:
290
+ - Log Attributes: Standard log fields like service, severity, body, level, etc.
291
+ - Resource Attributes: Resource-related fields prefixed with "resource_" like resource_k8s.pod.name, resource_service.name, etc.
292
+
271
293
  ### get_service_traces
272
294
 
273
295
  Query traces for a specific service with filtering options for span kinds, status codes, and other trace attributes. This tool retrieves distributed tracing data for debugging performance issues, understanding request flows, and analyzing service interactions.
@@ -294,11 +316,59 @@ Examples:
294
316
  - service_name="api" + span_kind=["server"] + status_code=["error"] → finds failed server-side traces
295
317
  - service_name="payment" + span_name="process_payment" + lookback_minutes=30 → finds payment processing traces from last 30 minutes
296
318
 
319
+ ### get_trace_attributes
320
+
321
+ Get available trace attributes (series) for a specified time window. This tool retrieves all attribute names that exist in traces during the specified time range, which can be used for filtering and querying traces.
322
+
323
+ Parameters:
324
+
325
+ - `lookback_minutes` (integer, optional): Number of minutes to look back from now for the time window. Default: 15. Examples: 15, 30, 60.
326
+ - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes.
327
+ - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
328
+ - `region` (string, optional): AWS region to query. Leave empty to use default from configuration. Examples: ap-south-1, us-east-1, eu-west-1.
329
+
330
+ Returns:
331
+ - An alphabetically sorted list of all available trace attributes (e.g., http.method, http.status_code, db.name, resource_service.name, duration, etc.)
332
+
333
+ ### get_change_events
334
+
335
+ Get change events from the last9_change_events prometheus metric over a given time range. Returns change events that occurred in the specified time window, including deployments, configuration changes, and other system modifications.
336
+
337
+ Parameters:
338
+
339
+ - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - lookback_minutes.
340
+ - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
341
+ - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60 minutes. Examples: 60, 30, 15.
342
+ - `service` (string, optional): Name of the service to filter change events for.
343
+ - `environment` (string, optional): Environment to filter by.
344
+ - `event_name` (string, optional): Name of the change event to filter by (use available_event_names to see valid values).
345
+
346
+ Returns:
347
+ - `available_event_names`: List of all available event types that can be used for filtering
348
+ - `change_events`: Array of timeseries data with metric labels and timestamp-value pairs
349
+ - `count`: Total number of change events returned
350
+ - `time_range`: Start and end time of the query window
351
+
352
+ Each change event includes:
353
+ - `metric`: Map of metric labels (service_name, env, event_type, message, etc.)
354
+ - `values`: Array of timestamp-value pairs representing the timeseries data
355
+
356
+ Common event types include: deployment, config_change, rollback, scale_up/scale_down, restart, upgrade/downgrade, maintenance, backup/restore, health_check, certificate, database.
357
+
358
+ Best practices:
359
+ 1. First call without event_name to get available_event_names
360
+ 2. Use exact event name from available_event_names for the event_name parameter
361
+ 3. Combine with other filters (service, environment, time) for precise results
362
+
297
363
  ## Installation
298
364
 
299
- You can install the Last9 Observability MCP server using either:
365
+ You can install and run the Last9 Observability MCP server in several ways:
366
+
367
+ ### Local Installation
300
368
 
301
- ### Homebrew
369
+ For local development and traditional STDIO usage:
370
+
371
+ #### Homebrew
302
372
 
303
373
  ```bash
304
374
  # Add the Last9 tap
@@ -308,7 +378,7 @@ brew tap last9/tap
308
378
  brew install last9-mcp
309
379
  ```
310
380
 
311
- ### NPM
381
+ #### NPM
312
382
 
313
383
  ```bash
314
384
  # Install globally
@@ -332,6 +402,8 @@ The Last9 MCP server requires the following environment variables:
332
402
  for accessing control plane APIs from
333
403
  [API Access](https://app.last9.io/settings/api-access)
334
404
 
405
+ ## Usage
406
+
335
407
  ## Usage with Claude Desktop
336
408
 
337
409
  Configure the Claude app to use the MCP server:
package/dist/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2024-present Last9
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/dist/README.md CHANGED
@@ -18,6 +18,7 @@ IDEs. Implements the following MCP
18
18
  [tools](https://modelcontextprotocol.io/docs/concepts/tools):
19
19
 
20
20
  **Observability & APM Tools:**
21
+
21
22
  - `get_exceptions`: Get the list of exceptions.
22
23
  - `get_service_summary`: Get service summary with throughput, error rate, and response time.
23
24
  - `get_service_environments`: Get available environments for services.
@@ -26,19 +27,27 @@ IDEs. Implements the following MCP
26
27
  - `get_service_dependency_graph`: Get service dependency graph showing incoming/outgoing dependencies.
27
28
 
28
29
  **Prometheus/PromQL Tools:**
30
+
29
31
  - `promptheus_range_query`: Execute PromQL range queries for metrics data.
30
32
  - `prometheus_instant_query`: Execute PromQL instant queries for metrics data.
31
33
  - `prometheus_label_values`: Get label values for PromQL queries.
32
34
  - `prometheus_labels`: Get available labels for PromQL queries.
33
35
 
34
36
  **Logs Management:**
37
+
35
38
  - `get_logs`: Get logs filtered by service name and/or severity level.
36
39
  - `get_drop_rules`: Get drop rules for logs that determine what logs get
37
40
  filtered out at [Last9 Control Plane](https://last9.io/control-plane)
38
41
  - `add_drop_rule`: Create a drop rule for logs at
39
42
  [Last9 Control Plane](https://last9.io/control-plane)
43
+ - `get_service_logs`: Get raw log entries for a specific service over a time range. Can apply filters on severity and body.
44
+
45
+ **Traces Management:**
46
+
47
+ - `get_service_traces`: Query traces for a specific service with filtering options for span kinds, status codes, and other trace attributes.
40
48
 
41
49
  **Alert Management:**
50
+
42
51
  - `get_alert_config`: Get alert configurations (alert rules) from Last9.
43
52
  - `get_alerts`: Get currently active alerts from Last9 monitoring system.
44
53
 
@@ -156,20 +165,19 @@ Parameters:
156
165
 
157
166
  ### get_logs
158
167
 
159
- Gets logs filtered by optional service name and/or severity level within a
160
- specified time range.
168
+ Gets logs filtered by service name and/or severity level within a specified time range. This tool now uses the advanced v2 logs API with physical index optimization for better performance.
169
+
170
+ **Note**: This tool now requires a `service_name` parameter and internally uses the same advanced infrastructure as `get_service_logs`.
161
171
 
162
172
  Parameters:
163
173
 
164
- - `service` (string, optional): Name of the service to get logs for.
165
- - `severity` (string, optional): Severity of the logs to get.
166
- - `lookback_minutes` (integer, recommended): Number of minutes to look back from
167
- now. Default: 60. Examples: 60, 30, 15.
168
- - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD
169
- HH:MM:SS). Leave empty to use lookback_minutes.
170
- - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD
171
- HH:MM:SS). Leave empty to default to current time.
174
+ - `service_name` (string, required): Name of the service to get logs for.
175
+ - `severity` (string, optional): Severity of the logs to get (automatically converted to severity_filters format).
176
+ - `lookback_minutes` (integer, recommended): Number of minutes to look back from now. Default: 60. Examples: 60, 30, 15.
177
+ - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes.
178
+ - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
172
179
  - `limit` (integer, optional): Maximum number of logs to return. Default: 20.
180
+ - `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
173
181
 
174
182
  ### get_drop_rules
175
183
 
@@ -237,13 +245,62 @@ Returns information about:
237
245
  - Metric degradation information
238
246
  - Group labels and annotations for each instance
239
247
 
248
+ ### get_service_logs
249
+
250
+ Get raw log entries for a specific service over a time range. This tool retrieves actual log entries including log messages, timestamps, severity levels, and other metadata. Useful for debugging issues, monitoring service behavior, and analyzing specific log patterns.
251
+
252
+ Parameters:
253
+
254
+ - `service_name` (string, required): Name of the service to get logs for.
255
+ - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60 minutes. Examples: 60, 30, 15.
256
+ - `limit` (integer, optional): Maximum number of log entries to return. Default: 20.
257
+ - `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
258
+ - `severity_filters` (array, optional): Array of severity patterns to filter logs (e.g., ["error", "warn"]). Uses OR logic.
259
+ - `body_filters` (array, optional): Array of message content patterns to filter logs (e.g., ["timeout", "failed"]). Uses OR logic.
260
+ - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - lookback_minutes.
261
+ - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
262
+
263
+ Filtering behavior:
264
+ - Multiple filter types are combined with AND logic (service AND severity AND body)
265
+ - Each filter array uses OR logic (matches any pattern in the array)
266
+
267
+ Examples:
268
+ - service_name="api" + severity_filters=["error"] + body_filters=["timeout"] → finds error logs containing "timeout"
269
+ - service_name="web" + body_filters=["timeout", "failed", "error 500"] → finds logs containing any of these patterns
270
+
271
+ ### get_service_traces
272
+
273
+ Query traces for a specific service with filtering options for span kinds, status codes, and other trace attributes. This tool retrieves distributed tracing data for debugging performance issues, understanding request flows, and analyzing service interactions.
274
+
275
+ Parameters:
276
+
277
+ - `service_name` (string, required): Name of the service to get traces for.
278
+ - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60 minutes. Examples: 60, 30, 15.
279
+ - `limit` (integer, optional): Maximum number of traces to return. Default: 10.
280
+ - `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
281
+ - `span_kind` (array, optional): Filter by span types (server, client, internal, consumer, producer).
282
+ - `span_name` (string, optional): Filter by specific span name.
283
+ - `status_code` (array, optional): Filter by trace status (ok, error, unset, success).
284
+ - `order` (string, optional): Field to order traces by. Default: "Duration". Options: Duration, Timestamp.
285
+ - `direction` (string, optional): Sort direction. Default: "backward". Options: forward, backward.
286
+ - `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - lookback_minutes.
287
+ - `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
288
+
289
+ Filtering options:
290
+ - Combine multiple filters to narrow down specific traces of interest
291
+ - Use time range filters with lookback_minutes or explicit start/end times
292
+
293
+ Examples:
294
+ - service_name="api" + span_kind=["server"] + status_code=["error"] → finds failed server-side traces
295
+ - service_name="payment" + span_name="process_payment" + lookback_minutes=30 → finds payment processing traces from last 30 minutes
296
+
240
297
  ## Installation
241
298
 
242
299
  You can install the Last9 Observability MCP server using either:
243
300
 
244
301
  ### Homebrew
245
302
 
246
- ```
303
+ ```bash
247
304
  # Add the Last9 tap
248
305
  brew tap last9/tap
249
306
 
@@ -285,6 +342,7 @@ Configure the Claude app to use the MCP server:
285
342
  4. Copy and paste the server config to your existing file, then save
286
343
  5. Restart Claude
287
344
 
345
+ ### If installed via Homebrew:
288
346
  ```json
289
347
  {
290
348
  "mcpServers": {
@@ -300,6 +358,23 @@ Configure the Claude app to use the MCP server:
300
358
  }
301
359
  ```
302
360
 
361
+ ### If installed via NPM:
362
+ ```json
363
+ {
364
+ "mcpServers": {
365
+ "last9": {
366
+ "command": "npx",
367
+ "args": ["-y", "@last9/mcp-server"],
368
+ "env": {
369
+ "LAST9_BASE_URL": "<last9_otlp_host>",
370
+ "LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
371
+ "LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
372
+ }
373
+ }
374
+ }
375
+ }
376
+ ```
377
+
303
378
  ## Usage with Cursor
304
379
 
305
380
  Configure Cursor to use the MCP server:
@@ -310,6 +385,7 @@ Configure Cursor to use the MCP server:
310
385
  4. Copy and paste the server config to your existing file, then save
311
386
  5. Restart Cursor
312
387
 
388
+ ### If installed via Homebrew:
313
389
  ```json
314
390
  {
315
391
  "mcpServers": {
@@ -325,6 +401,23 @@ Configure Cursor to use the MCP server:
325
401
  }
326
402
  ```
327
403
 
404
+ ### If installed via NPM:
405
+ ```json
406
+ {
407
+ "mcpServers": {
408
+ "last9": {
409
+ "command": "npx",
410
+ "args": ["-y", "@last9/mcp-server"],
411
+ "env": {
412
+ "LAST9_BASE_URL": "<last9_otlp_host>",
413
+ "LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
414
+ "LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
415
+ }
416
+ }
417
+ }
418
+ }
419
+ ```
420
+
328
421
  ## Usage with Windsurf
329
422
 
330
423
  Configure Windsurf to use the MCP server:
@@ -335,6 +428,7 @@ Configure Windsurf to use the MCP server:
335
428
  4. Copy and paste the server config to your existing file, then save
336
429
  5. Restart Windsurf
337
430
 
431
+ ### If installed via Homebrew:
338
432
  ```json
339
433
  {
340
434
  "mcpServers": {
@@ -350,17 +444,35 @@ Configure Windsurf to use the MCP server:
350
444
  }
351
445
  ```
352
446
 
447
+ ### If installed via NPM:
448
+ ```json
449
+ {
450
+ "mcpServers": {
451
+ "last9": {
452
+ "command": "npx",
453
+ "args": ["-y", "@last9/mcp-server"],
454
+ "env": {
455
+ "LAST9_BASE_URL": "<last9_otlp_host>",
456
+ "LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
457
+ "LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
458
+ }
459
+ }
460
+ }
461
+ }
462
+ ```
463
+
353
464
  ## Usage with VS Code
354
465
 
355
466
  > Note: MCP support in VS Code is available starting v1.99 and is currently in
356
467
  > preview. For advanced configuration options and alternative setup methods,
357
468
  > [view the VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).
358
469
 
359
- 1. Open VS Code, go to Settings, select the User tab, then Features, then Chat
360
- 2. Click "Edit settings.json"
361
- 3. Copy and paste the server config to your existing file, then save
362
- 4. Restart VS Code
470
+ 1. Open VS Code, go to Settings, select the User tab, then Features, then Chat
471
+ 2. Click "Edit settings.json"
472
+ 3. Copy and paste the server config to your existing file, then save
473
+ 4. Restart VS Code
363
474
 
475
+ ### If installed via Homebrew:
364
476
  ```json
365
477
  {
366
478
  "mcp": {
@@ -379,6 +491,114 @@ Configure Windsurf to use the MCP server:
379
491
  }
380
492
  ```
381
493
 
494
+ ### If installed via NPM:
495
+ ```json
496
+ {
497
+ "mcp": {
498
+ "servers": {
499
+ "last9": {
500
+ "type": "stdio",
501
+ "command": "npx",
502
+ "args": ["-y", "@last9/mcp-server"],
503
+ "env": {
504
+ "LAST9_BASE_URL": "<last9_otlp_host>",
505
+ "LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
506
+ "LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
507
+ }
508
+ }
509
+ }
510
+ }
511
+ }
512
+ ```
513
+
514
+ ## Development
515
+
516
+ For local development and testing, you can run the MCP server in HTTP mode which makes it easier to debug requests and responses.
517
+
518
+ ### Running in HTTP Mode
519
+
520
+ Set the `HTTP_MODE` environment variable to enable HTTP server mode:
521
+
522
+ ```bash
523
+ # Export required environment variables
524
+ export LAST9_API_TOKEN="your_api_token"
525
+ export LAST9_BASE_URL="https://your-last9-endpoint" # Your Last9 endpoint
526
+ export HTTP_MODE=true
527
+ export HTTP_PORT=8080 # Optional, defaults to 8080
528
+
529
+ # Run the server
530
+ ./last9-mcp-server
531
+ ```
532
+
533
+ The server will start on `http://localhost:8080/mcp` and you can test it with curl:
534
+
535
+ ### Testing with curl
536
+
537
+ ```bash
538
+ # Test get_service_logs
539
+ curl -X POST http://localhost:8080/mcp \
540
+ -H "Content-Type: application/json" \
541
+ -H "Mcp-Session-Id: session_$(date +%s)000000000" \
542
+ -d '{
543
+ "jsonrpc": "2.0",
544
+ "id": 1,
545
+ "method": "tools/call",
546
+ "params": {
547
+ "name": "get_service_logs",
548
+ "arguments": {
549
+ "service_name": "your-service-name",
550
+ "lookback_minutes": 30,
551
+ "limit": 10
552
+ }
553
+ }
554
+ }'
555
+
556
+ # Test get_service_traces
557
+ curl -X POST http://localhost:8080/mcp \
558
+ -H "Content-Type: application/json" \
559
+ -H "Mcp-Session-Id: session_$(date +%s)000000000" \
560
+ -d '{
561
+ "jsonrpc": "2.0",
562
+ "id": 2,
563
+ "method": "tools/call",
564
+ "params": {
565
+ "name": "get_service_traces",
566
+ "arguments": {
567
+ "service_name": "your-service-name",
568
+ "lookback_minutes": 60,
569
+ "limit": 5
570
+ }
571
+ }
572
+ }'
573
+
574
+ # List available tools
575
+ curl -X POST http://localhost:8080/mcp \
576
+ -H "Content-Type: application/json" \
577
+ -H "Mcp-Session-Id: session_$(date +%s)000000000" \
578
+ -d '{
579
+ "jsonrpc": "2.0",
580
+ "id": 3,
581
+ "method": "tools/list",
582
+ "params": {}
583
+ }'
584
+ ```
585
+
586
+ ### Building from Source
587
+
588
+ ```bash
589
+ # Clone the repository
590
+ git clone https://github.com/last9/last9-mcp-server.git
591
+ cd last9-mcp-server
592
+
593
+ # Build the binary
594
+ go build -o last9-mcp-server
595
+
596
+ # Run in development mode
597
+ HTTP_MODE=true ./last9-mcp-server
598
+ ```
599
+
600
+ **Note**: HTTP mode is for development and testing only. When integrating with Claude Desktop or other MCP clients, use the default STDIO mode (without `HTTP_MODE=true`).
601
+
382
602
  ## Badges
383
603
 
384
604
  [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/last9-last9-mcp-server-badge.png)](https://mseep.ai/app/last9-last9-mcp-server)
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@last9/mcp-server",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Last9 MCP Server - Model Context Protocol server implementation for Last9",
5
5
  "bin": {
6
6
  "last9-mcp": "./bin/cli.js"