@last9/mcp-server 0.1.13 → 0.2.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 +132 -13
- package/dist/LICENSE +1 -1
- package/dist/README.md +235 -15
- package/dist/last9-mcp-server +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ IDEs. Implements the following MCP
|
|
|
28
28
|
|
|
29
29
|
**Prometheus/PromQL Tools:**
|
|
30
30
|
|
|
31
|
-
- `
|
|
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,17 @@ 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
|
|
|
48
|
+
- `get_traces`: Retrieve traces by trace ID or service name with time range filtering.
|
|
47
49
|
- `get_service_traces`: Query traces for a specific service with filtering options for span kinds, status codes, and other trace attributes.
|
|
50
|
+
- `get_trace_attributes`: Get available trace attributes (series) for a specified time window.
|
|
51
|
+
|
|
52
|
+
**Change Events:**
|
|
53
|
+
|
|
54
|
+
- `get_change_events`: Get change events from the last9_change_events prometheus metric over a given time range.
|
|
48
55
|
|
|
49
56
|
**Alert Management:**
|
|
50
57
|
|
|
@@ -67,7 +74,9 @@ Parameters:
|
|
|
67
74
|
HH:MM:SS). Leave empty to use lookback_minutes.
|
|
68
75
|
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD
|
|
69
76
|
HH:MM:SS). Leave empty to default to current time.
|
|
77
|
+
- `service_name` (string, optional): Filter exceptions by service name (e.g., api-service).
|
|
70
78
|
- `span_name` (string, optional): Name of the span to filter by.
|
|
79
|
+
- `deployment_environment` (string, optional): Filter exceptions by deployment environment from resource attributes (e.g., production, staging).
|
|
71
80
|
|
|
72
81
|
### get_service_summary
|
|
73
82
|
|
|
@@ -123,7 +132,7 @@ Parameters:
|
|
|
123
132
|
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
124
133
|
- `env` (string, optional): Environment to filter by. Defaults to 'prod'.
|
|
125
134
|
|
|
126
|
-
###
|
|
135
|
+
### prometheus_range_query
|
|
127
136
|
|
|
128
137
|
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
138
|
|
|
@@ -268,6 +277,46 @@ Examples:
|
|
|
268
277
|
- service_name="api" + severity_filters=["error"] + body_filters=["timeout"] → finds error logs containing "timeout"
|
|
269
278
|
- service_name="web" + body_filters=["timeout", "failed", "error 500"] → finds logs containing any of these patterns
|
|
270
279
|
|
|
280
|
+
### get_log_attributes
|
|
281
|
+
|
|
282
|
+
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.
|
|
283
|
+
|
|
284
|
+
Parameters:
|
|
285
|
+
|
|
286
|
+
- `lookback_minutes` (integer, optional): Number of minutes to look back from now for the time window. Default: 15. Examples: 15, 30, 60.
|
|
287
|
+
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes.
|
|
288
|
+
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
289
|
+
- `region` (string, optional): AWS region to query. Leave empty to use default from configuration. Examples: ap-south-1, us-east-1, eu-west-1.
|
|
290
|
+
|
|
291
|
+
Returns:
|
|
292
|
+
- List of log attributes grouped into two categories:
|
|
293
|
+
- Log Attributes: Standard log fields like service, severity, body, level, etc.
|
|
294
|
+
- Resource Attributes: Resource-related fields prefixed with "resource_" like resource_k8s.pod.name, resource_service.name, etc.
|
|
295
|
+
|
|
296
|
+
### get_traces
|
|
297
|
+
|
|
298
|
+
Retrieve traces from Last9 by trace ID or service name. This tool allows you to get specific traces either by providing a trace ID for a single trace, or by providing a service name to get all traces for that service within a time range.
|
|
299
|
+
|
|
300
|
+
Parameters:
|
|
301
|
+
|
|
302
|
+
- `trace_id` (string, optional): Specific trace ID to retrieve. Cannot be used with service_name.
|
|
303
|
+
- `service_name` (string, optional): Name of service to get traces for. Cannot be used with trace_id.
|
|
304
|
+
- `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60 minutes. Examples: 60, 30, 15.
|
|
305
|
+
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - lookback_minutes.
|
|
306
|
+
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
307
|
+
- `limit` (integer, optional): Maximum number of traces to return. Default: 10. Range: 1-100.
|
|
308
|
+
- `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
|
|
309
|
+
|
|
310
|
+
Usage rules:
|
|
311
|
+
- Exactly one of `trace_id` or `service_name` must be provided (not both, not neither)
|
|
312
|
+
- Time range filtering only applies when using `service_name`
|
|
313
|
+
|
|
314
|
+
Examples:
|
|
315
|
+
- trace_id="abc123def456" - retrieves the specific trace
|
|
316
|
+
- service_name="payment-service" + lookback_minutes=30 - gets all payment service traces from last 30 minutes
|
|
317
|
+
|
|
318
|
+
Returns trace data including trace IDs, spans, duration, timestamps, and status information.
|
|
319
|
+
|
|
271
320
|
### get_service_traces
|
|
272
321
|
|
|
273
322
|
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 +343,59 @@ Examples:
|
|
|
294
343
|
- service_name="api" + span_kind=["server"] + status_code=["error"] → finds failed server-side traces
|
|
295
344
|
- service_name="payment" + span_name="process_payment" + lookback_minutes=30 → finds payment processing traces from last 30 minutes
|
|
296
345
|
|
|
346
|
+
### get_trace_attributes
|
|
347
|
+
|
|
348
|
+
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.
|
|
349
|
+
|
|
350
|
+
Parameters:
|
|
351
|
+
|
|
352
|
+
- `lookback_minutes` (integer, optional): Number of minutes to look back from now for the time window. Default: 15. Examples: 15, 30, 60.
|
|
353
|
+
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes.
|
|
354
|
+
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
355
|
+
- `region` (string, optional): AWS region to query. Leave empty to use default from configuration. Examples: ap-south-1, us-east-1, eu-west-1.
|
|
356
|
+
|
|
357
|
+
Returns:
|
|
358
|
+
- An alphabetically sorted list of all available trace attributes (e.g., http.method, http.status_code, db.name, resource_service.name, duration, etc.)
|
|
359
|
+
|
|
360
|
+
### get_change_events
|
|
361
|
+
|
|
362
|
+
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.
|
|
363
|
+
|
|
364
|
+
Parameters:
|
|
365
|
+
|
|
366
|
+
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - lookback_minutes.
|
|
367
|
+
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
368
|
+
- `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60 minutes. Examples: 60, 30, 15.
|
|
369
|
+
- `service` (string, optional): Name of the service to filter change events for.
|
|
370
|
+
- `environment` (string, optional): Environment to filter by.
|
|
371
|
+
- `event_name` (string, optional): Name of the change event to filter by (use available_event_names to see valid values).
|
|
372
|
+
|
|
373
|
+
Returns:
|
|
374
|
+
- `available_event_names`: List of all available event types that can be used for filtering
|
|
375
|
+
- `change_events`: Array of timeseries data with metric labels and timestamp-value pairs
|
|
376
|
+
- `count`: Total number of change events returned
|
|
377
|
+
- `time_range`: Start and end time of the query window
|
|
378
|
+
|
|
379
|
+
Each change event includes:
|
|
380
|
+
- `metric`: Map of metric labels (service_name, env, event_type, message, etc.)
|
|
381
|
+
- `values`: Array of timestamp-value pairs representing the timeseries data
|
|
382
|
+
|
|
383
|
+
Common event types include: deployment, config_change, rollback, scale_up/scale_down, restart, upgrade/downgrade, maintenance, backup/restore, health_check, certificate, database.
|
|
384
|
+
|
|
385
|
+
Best practices:
|
|
386
|
+
1. First call without event_name to get available_event_names
|
|
387
|
+
2. Use exact event name from available_event_names for the event_name parameter
|
|
388
|
+
3. Combine with other filters (service, environment, time) for precise results
|
|
389
|
+
|
|
297
390
|
## Installation
|
|
298
391
|
|
|
299
|
-
You can install the Last9 Observability MCP server
|
|
392
|
+
You can install and run the Last9 Observability MCP server in several ways:
|
|
393
|
+
|
|
394
|
+
### Local Installation
|
|
300
395
|
|
|
301
|
-
|
|
396
|
+
For local development and traditional STDIO usage:
|
|
397
|
+
|
|
398
|
+
#### Homebrew
|
|
302
399
|
|
|
303
400
|
```bash
|
|
304
401
|
# Add the Last9 tap
|
|
@@ -308,7 +405,7 @@ brew tap last9/tap
|
|
|
308
405
|
brew install last9-mcp
|
|
309
406
|
```
|
|
310
407
|
|
|
311
|
-
|
|
408
|
+
#### NPM
|
|
312
409
|
|
|
313
410
|
```bash
|
|
314
411
|
# Install globally
|
|
@@ -331,6 +428,10 @@ The Last9 MCP server requires the following environment variables:
|
|
|
331
428
|
- `LAST9_REFRESH_TOKEN`: (required) Refresh Token with Write permissions, needed
|
|
332
429
|
for accessing control plane APIs from
|
|
333
430
|
[API Access](https://app.last9.io/settings/api-access)
|
|
431
|
+
- `OTEL_EXPORTER_OTLP_ENDPOINT`: (required) OpenTelemetry collector endpoint URL
|
|
432
|
+
- `OTEL_EXPORTER_OTLP_HEADERS`: (required) Headers for OTLP exporter authentication
|
|
433
|
+
|
|
434
|
+
## Usage
|
|
334
435
|
|
|
335
436
|
## Usage with Claude Desktop
|
|
336
437
|
|
|
@@ -351,7 +452,9 @@ Configure the Claude app to use the MCP server:
|
|
|
351
452
|
"env": {
|
|
352
453
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
353
454
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
354
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
455
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
456
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
457
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
355
458
|
}
|
|
356
459
|
}
|
|
357
460
|
}
|
|
@@ -368,7 +471,9 @@ Configure the Claude app to use the MCP server:
|
|
|
368
471
|
"env": {
|
|
369
472
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
370
473
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
371
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
474
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
475
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
476
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
372
477
|
}
|
|
373
478
|
}
|
|
374
479
|
}
|
|
@@ -394,7 +499,9 @@ Configure Cursor to use the MCP server:
|
|
|
394
499
|
"env": {
|
|
395
500
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
396
501
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
397
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
502
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
503
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
504
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
398
505
|
}
|
|
399
506
|
}
|
|
400
507
|
}
|
|
@@ -411,7 +518,9 @@ Configure Cursor to use the MCP server:
|
|
|
411
518
|
"env": {
|
|
412
519
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
413
520
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
414
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
521
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
522
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
523
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
415
524
|
}
|
|
416
525
|
}
|
|
417
526
|
}
|
|
@@ -437,7 +546,9 @@ Configure Windsurf to use the MCP server:
|
|
|
437
546
|
"env": {
|
|
438
547
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
439
548
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
440
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
549
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
550
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
551
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
441
552
|
}
|
|
442
553
|
}
|
|
443
554
|
}
|
|
@@ -454,7 +565,9 @@ Configure Windsurf to use the MCP server:
|
|
|
454
565
|
"env": {
|
|
455
566
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
456
567
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
457
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
568
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
569
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
570
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
458
571
|
}
|
|
459
572
|
}
|
|
460
573
|
}
|
|
@@ -483,7 +596,9 @@ Configure Windsurf to use the MCP server:
|
|
|
483
596
|
"env": {
|
|
484
597
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
485
598
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
486
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
599
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
600
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
601
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
487
602
|
}
|
|
488
603
|
}
|
|
489
604
|
}
|
|
@@ -503,7 +618,9 @@ Configure Windsurf to use the MCP server:
|
|
|
503
618
|
"env": {
|
|
504
619
|
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
505
620
|
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
506
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
621
|
+
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>",
|
|
622
|
+
"OTEL_EXPORTER_OTLP_ENDPOINT": "<otel_endpoint_url>",
|
|
623
|
+
"OTEL_EXPORTER_OTLP_HEADERS": "<otel_headers>"
|
|
507
624
|
}
|
|
508
625
|
}
|
|
509
626
|
}
|
|
@@ -523,6 +640,8 @@ Set the `HTTP_MODE` environment variable to enable HTTP server mode:
|
|
|
523
640
|
# Export required environment variables
|
|
524
641
|
export LAST9_API_TOKEN="your_api_token"
|
|
525
642
|
export LAST9_BASE_URL="https://your-last9-endpoint" # Your Last9 endpoint
|
|
643
|
+
export OTEL_EXPORTER_OTLP_ENDPOINT="<otel_endpoint_url>"
|
|
644
|
+
export OTEL_EXPORTER_OTLP_HEADERS="<otel_headers>"
|
|
526
645
|
export HTTP_MODE=true
|
|
527
646
|
export HTTP_PORT=8080 # Optional, defaults to 8080
|
|
528
647
|
|
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
|
|
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
|
|
160
|
-
|
|
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
|
-
- `
|
|
165
|
-
- `severity` (string, optional): Severity of the logs to get.
|
|
166
|
-
- `lookback_minutes` (integer, recommended): Number of minutes to look back from
|
|
167
|
-
|
|
168
|
-
- `
|
|
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.
|
|
360
|
-
2.
|
|
361
|
-
3.
|
|
362
|
-
4.
|
|
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
|
[](https://mseep.ai/app/last9-last9-mcp-server)
|
package/dist/last9-mcp-server
CHANGED
|
Binary file
|