@last9/mcp-server 0.5.0 → 0.6.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.
Files changed (2) hide show
  1. package/README.md +398 -628
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,503 +1,132 @@
1
1
  # Last9 MCP Server
2
2
 
3
3
  ![last9 mcp demo](mcp-demo.gif)
4
- A [Model Context Protocol](https://modelcontextprotocol.io/) server
5
- implementation for [Last9](https://last9.io/mcp/) that enables AI agents to
6
- seamlessly bring real-time production context — logs, metrics, and traces — into
7
- your local environment to auto-fix code faster.
8
4
 
9
- - [View demo](https://www.youtube.com/watch?v=AQH5xq6qzjI)
10
- - Read our
11
- [announcement blog post](https://last9.io/blog/launching-last9-mcp-server/)
5
+ Your AI agent doesn't know what's broken in production. This fixes that.
12
6
 
13
- ## Quick Links
7
+ [Last9 MCP Server](https://last9.io/mcp/) connects Claude, Cursor, Windsurf, and any other MCP-capable AI assistant directly to your production observability data — logs, metrics, traces, exceptions, database queries, alerts, and deployments. The agent stops guessing and starts reading the actual signal.
14
8
 
15
- - [Status](#status)
16
- - [Installation](#installation)
17
- - [Configuration](#configuration)
18
- - [Usage](#usage)
19
- - [Tools Documentation](#tools-documentation)
20
- - [Development](#development)
21
- - [Testing](#testing)
22
- - [Badges](#badges)
9
+ - [Watch the demo](https://www.youtube.com/watch?v=AQH5xq6qzjI)
10
+ - [Announcement post](https://last9.io/blog/launching-last9-mcp-server/)
23
11
 
24
- ## Installation
12
+ ---
25
13
 
26
- You can connect to Last9 MCP in two ways:
14
+ ## Start in 30 seconds (Hosted)
27
15
 
28
- ### Recommended: Managed MCP over HTTP
16
+ No binary to install. No tokens to manage. One URL, OAuth in your browser, done.
29
17
 
30
- This is the easiest and cleanest setup. You do not need to run a local binary.
31
- You'll need a **Client Token** (MCP type) — see [Getting your credentials](#getting-your-credentials) below. Your org slug is in your Last9 URL: `app.last9.io/<org_slug>/...`
18
+ Find your org slug in your Last9 URL: `app.last9.io/<org_slug>/...`
19
+
20
+ ### Claude Code
32
21
 
33
22
  ```bash
34
- claude mcp add --transport http last9 https://app.last9.io/api/v4/organizations/<organization_slug>/mcp \
35
- --header "X-LAST9-API-TOKEN: Bearer <last9_api_token>"
23
+ claude mcp add --transport http last9 https://app.last9.io/api/v4/organizations/<org_slug>/mcp
36
24
  ```
37
25
 
38
- Or add it directly to your MCP client config:
26
+ Type `/mcp`, select last9, authenticate. That's it.
27
+
28
+ ### Cursor
29
+
30
+ **Settings > MCP > Add New MCP Server:**
39
31
 
40
32
  ```json
41
33
  {
42
34
  "mcpServers": {
43
35
  "last9": {
44
36
  "type": "http",
45
- "url": "https://app.last9.io/api/v4/organizations/<organization_slug>/mcp",
46
- "headers": {
47
- "X-LAST9-API-TOKEN": "Bearer <last9_api_token>"
48
- }
37
+ "url": "https://app.last9.io/api/v4/organizations/<org_slug>/mcp"
49
38
  }
50
39
  }
51
40
  }
52
41
  ```
53
42
 
54
- ### Local Installation (STDIO fallback)
43
+ Click **Connect**, complete OAuth.
55
44
 
56
- Use this only if your client needs a local STDIO server process.
45
+ ### VS Code
57
46
 
58
- #### Homebrew
47
+ Requires v1.99+. Open Command Palette → **MCP: Add Server**, paste the URL, authenticate.
59
48
 
60
- ```bash
61
- brew update
62
- brew install last9/tap/last9-mcp
63
- brew upgrade last9/tap/last9-mcp
64
- last9-mcp --version
65
- ```
66
-
67
- #### NPM
49
+ Or directly in `settings.json`:
68
50
 
69
- ```bash
70
- # Install globally
71
- npm install -g @last9/mcp-server@latest
72
- # Or run directly with npx
73
- npx -y @last9/mcp-server@latest
51
+ ```json
52
+ {
53
+ "mcp": {
54
+ "servers": {
55
+ "last9": {
56
+ "type": "http",
57
+ "url": "https://app.last9.io/api/v4/organizations/<org_slug>/mcp"
58
+ }
59
+ }
60
+ }
61
+ }
74
62
  ```
75
63
 
76
- #### GitHub Releases (Windows / manual install)
77
-
78
- Download the binary for your platform from [GitHub Releases](https://github.com/last9/last9-mcp-server/releases/latest):
79
-
80
- | Platform | Archive |
81
- |----------|---------|
82
- | Windows (x64) | `last9-mcp-server_Windows_x86_64.zip` |
83
- | Windows (ARM64) | `last9-mcp-server_Windows_arm64.zip` |
84
- | Linux (x64) | `last9-mcp-server_Linux_x86_64.tar.gz` |
85
- | Linux (ARM64) | `last9-mcp-server_Linux_arm64.tar.gz` |
86
- | macOS (x64) | `last9-mcp-server_Darwin_x86_64.tar.gz` |
87
- | macOS (ARM64) | `last9-mcp-server_Darwin_arm64.tar.gz` |
88
-
89
- Extract the archive. On Windows the binary is `last9-mcp-server.exe`. Use the full path to the binary in your MCP client config (see [Windows example](#windows-example-claude-desktop) below).
90
-
91
- > On Windows, [NPM](#npm) is easier to set up (no path management needed), or use the [hosted HTTP transport](#recommended-managed-mcp-over-http) to skip local installation entirely.
92
-
93
- ## Getting Your Credentials
94
-
95
- ### For hosted MCP (recommended)
96
-
97
- You need a **Client Token** with MCP type. Only **admins** can create tokens. If you're not an admin, ask your admin to create one or grant you admin access via [User Access settings](https://app.last9.io/settings/user-access).
98
-
99
- 1. Go to [Ingestion Tokens](https://app.last9.io/control-plane/ingestion-tokens)
100
- 2. Click **New Ingestion Token**
101
- 3. Set **Token Type** to **Client**
102
- 4. Set **Client Type** to **MCP**
103
- 5. Enter a name (e.g., `claude-desktop`, `cursor`)
104
- 6. Click **Create** — copy the token immediately (shown only once)
105
-
106
- Your **organization slug** is in your Last9 URL: `https://app.last9.io/<org_slug>/...`
107
-
108
- ### For local binary (STDIO mode)
109
-
110
- You need a **Refresh Token** with Write permissions. Only **admins** can create them.
111
-
112
- 1. Go to [API Access](https://app.last9.io/settings/api-access)
113
- 2. Click **Generate Token** with Write permissions
114
- 3. Copy the token
115
-
116
- ## Status
117
-
118
- Works with Claude desktop app, or Cursor, Windsurf, and VSCode (Github Copilot)
119
- IDEs. Implements the following MCP
120
- [tools](https://modelcontextprotocol.io/docs/concepts/tools):
121
- **Observability & APM Tools:**
122
-
123
- - `get_exceptions`: Get the list of exceptions.
124
- - `get_service_summary`: Get service summary with throughput, error rate, and response time.
125
- - `get_service_environments`: Get available environments for services.
126
- - `get_service_performance_details`: Get detailed performance metrics for a service.
127
- - `get_service_operations_summary`: Get operations summary for a service.
128
- - `get_service_dependency_graph`: Get service dependency graph showing incoming/outgoing dependencies.
129
- **Prometheus/PromQL Tools:**
130
- - `prometheus_range_query`: Execute PromQL range queries for metrics data.
131
- - `prometheus_instant_query`: Execute PromQL instant queries for metrics data.
132
- - `prometheus_label_values`: Get label values for PromQL queries.
133
- - `prometheus_labels`: Get available labels for PromQL queries.
134
- **Logs Management:**
135
- - `get_logs`: Get logs filtered by service name and/or severity level.
136
- - `get_drop_rules`: Get drop rules for logs that determine what logs get
137
- filtered out at [Last9 Control Plane](https://last9.io/control-plane)
138
- - `add_drop_rule`: Create a drop rule for logs at
139
- [Last9 Control Plane](https://last9.io/control-plane)
140
- - `get_service_logs`: Get raw log entries for a specific service over a time range. Can apply filters on severity and body.
141
- - `get_log_attributes`: Get available log attributes (labels) for a specified time window.
142
- **Traces Management:**
143
- - `get_traces`: Retrieve traces using JSON pipeline queries for advanced filtering.
144
- - `get_service_traces`: Retrieve traces by trace ID or service name with time range filtering.
145
- - `get_trace_attributes`: Get available trace attributes (series) for a specified time window.
146
- **Change Events:**
147
- - `get_change_events`: Get change events from the last9_change_events prometheus metric over a given time range.
148
- **Alert Management:**
149
- - `get_alert_config`: Get alert configurations (alert rules) from Last9.
150
- - `get_alerts`: Get currently active alerts from Last9 monitoring system.
151
-
152
- ## Tools Documentation
153
-
154
- ### Time Input Standard
155
-
156
- - For relative windows, prefer `lookback_minutes` (up to 20160 minutes = 14 days).
157
- - For absolute windows, use `start_time_iso`, `end_time_iso`, or `time_iso` in RFC3339/ISO8601 (for example, `2026-02-09T15:04:05Z`).
158
- - If both relative and absolute inputs are provided, absolute time inputs take precedence.
159
- - Legacy `YYYY-MM-DD HH:MM:SS` is accepted only for compatibility.
160
- - If a lookback limit error occurs, retry using explicit `start_time_iso`/`end_time_iso` timestamps.
161
-
162
- ### Deep Links
163
-
164
- Most tools return a `deep_link` field in the response metadata. This is a direct URL to the relevant Last9 dashboard view for the queried data — click it to open the corresponding alerts, logs, traces, or APM dashboard page.
165
-
166
- ### Attribute Caching
167
-
168
- The server automatically fetches and caches available log and trace attribute names at startup (with a 10-second timeout) and refreshes the cache every 2 hours in the background. These dynamic attributes are embedded into the `get_logs`, `get_traces`, and `prometheus_range_query` tool descriptions, so AI assistants always see up-to-date field names when constructing queries.
169
-
170
- ### get_exceptions
171
-
172
- Retrieves server-side exceptions over a specified time range.
173
- Parameters:
174
-
175
- - `limit` (integer, optional): Maximum number of exceptions to return.
176
- Default: 20.
177
- - `lookback_minutes` (integer, recommended): Number of minutes to look back from
178
- now. Default: 60. Range: 1–20160 (14 days). Examples: 60, 30, 15.
179
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
180
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
181
- - `service_name` (string, optional): Filter exceptions by service name (e.g., api-service).
182
- - `span_name` (string, optional): Name of the span to filter by.
183
- - `deployment_environment` (string, optional): Filter exceptions by deployment environment from resource attributes (e.g., production, staging).
184
-
185
- ### get_service_summary
186
-
187
- Get service summary over a given time range. Includes service name, environment, throughput, error rate, and response time. All values are p95 quantiles over the time range.
188
- Parameters:
189
-
190
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to end_time_iso - 1 hour.
191
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
192
- - `env` (string, optional): Environment to filter by. Defaults to 'prod'.
193
-
194
- ### get_service_environments
195
-
196
- Get available environments for services. Returns an array of environments that can be used with other APM tools.
197
- Parameters:
198
-
199
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to end_time_iso - 1 hour.
200
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
201
- Note: All other APM tools that retrieve service information (like `get_service_performance_details`, `get_service_dependency_graph`, `get_service_operations_summary`, `get_service_summary`) require an `env` parameter. This parameter must be one of the environments returned by this tool. If this tool returns an empty array, use an empty string `""` for the env parameter.
202
-
203
- ### get_service_performance_details
204
-
205
- Get detailed performance metrics for a specific service over a given time range.
206
- Parameters:
207
-
208
- - `service_name` (string, required): Name of the service to get performance details for.
209
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days).
210
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
211
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
212
- - `env` (string, optional): Environment to filter by. Defaults to 'prod'.
213
- Returns: throughput, error rate, p50/p90/p95/avg/max response times, apdex score, availability, top operations, and top errors.
214
-
215
- ### get_service_operations_summary
216
-
217
- Get a summary of operations inside a service over a given time range. Returns operations like HTTP endpoints, database queries, messaging producer and HTTP client calls.
218
- Parameters:
219
-
220
- - `service_name` (string, required): Name of the service to get operations summary for.
221
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days).
222
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
223
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
224
- - `env` (string, optional): Environment to filter by. Defaults to 'prod'.
225
- Each operation includes: throughput (rpm), error rate (rpm), error percentage, and p50/p90/p95/avg/max response times (ms).
226
-
227
- ### get_service_dependency_graph
228
-
229
- Get details of the throughput, response times and error rates of incoming, outgoing and infrastructure components of a service. Useful for analyzing cascading effects of errors and performance issues.
230
- Parameters:
231
-
232
- - `service_name` (string, optional): Name of the service to get the dependency graph for.
233
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days).
234
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
235
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
236
- - `env` (string, optional): Environment to filter by. Defaults to 'prod'.
237
- Each node includes: throughput (rpm), error rate (rpm), error percentage, and p50/p90/p95/avg/max response times (ms).
238
-
239
- ### prometheus_range_query
240
-
241
- Perform a Prometheus range query to get metrics data over a specified time range. Recommended to check available labels first using `prometheus_labels` tool.
242
- Parameters:
243
-
244
- - `query` (string, required): The range query to execute.
245
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to now - 60 minutes.
246
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
247
-
248
- ### prometheus_instant_query
249
-
250
- Perform a Prometheus instant query to get metrics data at a specific time. Typically should use rollup functions like sum_over_time, avg_over_time, quantile_over_time over a time window.
251
- Parameters:
252
-
253
- - `query` (string, required): The instant query to execute.
254
- - `time_iso` (string, optional): Time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to current time.
255
-
256
- ### prometheus_label_values
257
-
258
- Return the label values for a particular label and PromQL filter query. Similar to Prometheus /label_values call.
259
- Parameters:
260
-
261
- - `match_query` (string, required): A valid PromQL filter query.
262
- - `label` (string, required): The label to get values for.
263
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to now - 60 minutes.
264
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
265
-
266
- ### prometheus_labels
267
-
268
- Return the labels for a given PromQL match query. Similar to Prometheus /labels call.
269
- Parameters:
270
-
271
- - `match_query` (string, required): A valid PromQL filter query.
272
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to now - 60 minutes.
273
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
274
-
275
- ### get_logs
276
-
277
- 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.
278
- **Note**: This tool now requires a `service_name` parameter and internally uses the same advanced infrastructure as `get_service_logs`.
279
- Parameters:
280
-
281
- - `service_name` (string, required): Name of the service to get logs for.
282
- - `severity` (string, optional): Severity of the logs to get (automatically converted to severity_filters format).
283
- - `lookback_minutes` (integer, recommended): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days). Examples: 60, 30, 15.
284
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
285
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
286
- - `limit` (integer, optional): Maximum number of logs to return. Default: 20.
287
- - `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
288
-
289
- ### get_drop_rules
290
-
291
- Gets drop rules for logs, which determine what logs get filtered out from
292
- reaching Last9.
293
-
294
- ### add_drop_rule
295
-
296
- Adds a new drop rule to filter out specific logs at
297
- [Last9 Control Plane](https://last9.io/control-plane)
298
- Parameters:
299
-
300
- - `name` (string, required): Name of the drop rule.
301
- - `filters` (array, required): List of filter conditions to apply. Each filter
302
- has:
303
- - `key` (string, required): The key to filter on. Only attributes and
304
- resource.attributes keys are supported. For resource attributes, use format:
305
- resource.attributes[key_name] and for log attributes, use format:
306
- attributes[key_name] Double quotes in key names must be escaped.
307
- - `value` (string, required): The value to filter against.
308
- - `operator` (string, required): The operator used for filtering. Valid
309
- values:
310
- - "equals"
311
- - "not_equals"
312
- - `conjunction` (string, required): The logical conjunction between filters.
313
- Valid values:
314
- - "and"
315
-
316
- ### get_alert_config
317
-
318
- Get alert configurations (alert rules) from Last9. Returns all configured alert rules including their conditions, labels, and annotations.
319
- Parameters:
320
- None - This tool retrieves all available alert configurations.
321
- Returns information about:
322
-
323
- - Alert rule ID and name
324
- - Primary indicator being monitored
325
- - Current state and severity
326
- - Algorithm used for alerting
327
- - Entity ID and organization details
328
- - Properties and configuration
329
- - Creation and update timestamps
330
- - Group timeseries notification settings
331
-
332
- ### get_alerts
333
-
334
- Get currently active alerts from Last9 monitoring system. Returns all alerts that are currently firing or have fired recently within the specified time window.
335
- Parameters:
336
-
337
- - `time_iso` (string, optional): Evaluation time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Preferred.
338
- - `timestamp` (integer, optional): Unix timestamp for the query time. Deprecated alias.
339
- - `window` (integer, optional): Time window in seconds to look back for alerts. Defaults to 900 seconds (15 minutes). Range: 60-86400 seconds.
340
- - `lookback_minutes` (integer, optional): Relative time window in minutes. Used only when `window` is not provided. Range: 1-1440.
341
- Returns information about:
342
- - Alert rule details (ID, name, group, type)
343
- - Current state and severity
344
- - Last fired timestamp and duration
345
- - Rule properties and configuration
346
- - Alert instances with current values
347
- - Metric degradation information
348
- - Group labels and annotations for each instance
349
-
350
- ### get_service_logs
351
-
352
- 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.
353
- Parameters:
354
-
355
- - `service_name` (string, required): Name of the service to get logs for.
356
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days). Examples: 60, 30, 15.
357
- - `limit` (integer, optional): Maximum number of log entries to return. Default: 20.
358
- - `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
359
- - `severity_filters` (array, optional): Array of severity patterns to filter logs (e.g., ["error", "warn"]). Uses OR logic.
360
- - `body_filters` (array, optional): Array of message content patterns to filter logs (e.g., ["timeout", "failed"]). Uses OR logic.
361
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to now - lookback_minutes.
362
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
363
- Filtering behavior:
364
- - Multiple filter types are combined with AND logic (service AND severity AND body)
365
- - Each filter array uses OR logic (matches any pattern in the array)
366
- Examples:
367
- - service_name="api" + severity_filters=["error"] + body_filters=["timeout"] → finds error logs containing "timeout"
368
- - service_name="web" + body_filters=["timeout", "failed", "error 500"] → finds logs containing any of these patterns
369
-
370
- ### get_log_attributes
371
-
372
- 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.
373
- Parameters:
374
-
375
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now for the time window. Default: 15. Examples: 15, 30, 60.
376
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
377
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
378
- - `region` (string, optional): AWS region to query. Leave empty to use default from configuration. Examples: ap-south-1, us-east-1, eu-west-1.
379
- Returns:
380
- - List of log attributes grouped into two categories:
381
- - Log Attributes: Standard log fields like service, severity, body, level, etc.
382
- - Resource Attributes: Resource-related fields prefixed with "resource\_" like resource_k8s.pod.name, resource_service.name, etc.
383
-
384
- ### get_traces
385
-
386
- Execute advanced trace queries using JSON pipeline syntax for complex filtering and aggregation. This tool provides powerful querying capabilities for traces using a pipeline-based approach with filters, aggregations, and transformations.
387
- Parameters:
388
-
389
- - `tracejson_query` (array, required): JSON pipeline query for traces. Use the tracejson_query_builder prompt to generate JSON pipeline queries from natural language.
390
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z).
391
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z).
392
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days).
393
- - `limit` (integer, optional): Maximum number of traces to return. Default: 20. Range: 1-100.
394
- This tool supports complex queries with multiple filter conditions, aggregations, and custom processing pipelines for advanced trace analysis.
395
-
396
- ### get_service_traces
397
-
398
- 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.
399
- Parameters:
400
-
401
- - `trace_id` (string, optional): Specific trace ID to retrieve. Cannot be used with service_name.
402
- - `service_name` (string, optional): Name of service to get traces for. Cannot be used with trace_id.
403
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days). Examples: 60, 30, 15.
404
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
405
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
406
- - `limit` (integer, optional): Maximum number of traces to return. Default: 10. Range: 1-100.
407
- - `env` (string, optional): Environment to filter by. Use "get_service_environments" tool to get available environments.
408
- Usage rules:
409
- - Exactly one of `trace_id` or `service_name` must be provided (not both, not neither)
410
- - Time range filtering only applies when using `service_name`
411
- Examples:
412
- - trace_id="abc123def456" - retrieves the specific trace
413
- - service_name="payment-service" + lookback_minutes=30 - gets all payment service traces from last 30 minutes
414
- Returns trace data including trace IDs, spans, duration, timestamps, and status information.
415
-
416
- ### get_trace_attributes
417
-
418
- 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.
419
- Parameters:
64
+ ### Windsurf
420
65
 
421
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now for the time window. Default: 15. Examples: 15, 30, 60.
422
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to use lookback_minutes.
423
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
424
- - `region` (string, optional): AWS region to query. Leave empty to use default from configuration. Examples: ap-south-1, us-east-1, eu-west-1.
425
- Returns:
426
- - An alphabetically sorted list of all available trace attributes (e.g., http.method, http.status_code, db.name, resource_service.name, duration, etc.)
66
+ **Settings > Cascade > Open MCP Marketplace > gear icon (`mcp_config.json`):**
427
67
 
428
- ### get_change_events
429
-
430
- 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.
431
- Parameters:
432
-
433
- - `start_time_iso` (string, optional): Start time in RFC3339/ISO8601 format (e.g. 2026-02-09T15:04:05Z). Leave empty to default to now - lookback_minutes.
434
- - `end_time_iso` (string, optional): End time in RFC3339/ISO8601 format (e.g. 2026-02-09T16:04:05Z). Leave empty to default to current time.
435
- - `lookback_minutes` (integer, optional): Number of minutes to look back from now. Default: 60. Range: 1–20160 (14 days). Examples: 60, 30, 15.
436
- - `service` (string, optional): Name of the service to filter change events for.
437
- - `environment` (string, optional): Environment to filter by.
438
- - `event_name` (string, optional): Name of the change event to filter by (use available_event_names to see valid values).
439
- Returns:
440
- - `available_event_names`: List of all available event types that can be used for filtering
441
- - `change_events`: Array of timeseries data with metric labels and timestamp-value pairs
442
- - `count`: Total number of change events returned
443
- - `time_range`: Start and end time of the query window
444
- Each change event includes:
445
- - `metric`: Map of metric labels (service_name, env, event_type, message, etc.)
446
- - `values`: Array of timestamp-value pairs representing the timeseries data
447
- Common event types include: deployment, config_change, rollback, scale_up/scale_down, restart, upgrade/downgrade, maintenance, backup/restore, health_check, certificate, database.
448
- Best practices:
449
-
450
- 1. First call without event_name to get available_event_names
451
- 2. Use exact event name from available_event_names for the event_name parameter
452
- 3. Combine with other filters (service, environment, time) for precise results
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "last9": {
72
+ "serverUrl": "https://app.last9.io/api/v4/organizations/<org_slug>/mcp"
73
+ }
74
+ }
75
+ }
76
+ ```
453
77
 
454
- ## Configuration
78
+ ### Claude Web/Desktop
455
79
 
456
- ### Managed HTTP transport (recommended)
80
+ **Settings > Connectors > Add custom connector.** Name it `last9`, paste the URL, authenticate.
457
81
 
458
- Set this header in your MCP client config:
82
+ > Requires admin access to your Claude organization.
459
83
 
460
- - `X-LAST9-API-TOKEN`: Bearer token for Last9 API access.
84
+ ---
461
85
 
462
- ### Local STDIO server environment variables
86
+ ## Self-Hosted (STDIO)
463
87
 
464
- If you run the server locally (`last9-mcp`), use these environment variables:
88
+ Use this when your MCP client doesn't support HTTP transport, or when you need the server running locally.
465
89
 
466
- - `LAST9_REFRESH_TOKEN`: (required) Refresh Token with Write permissions from
467
- [API Access](https://app.last9.io/settings/api-access). Only admins can create
468
- refresh tokens.
90
+ ### Install
469
91
 
470
- Optional environment variables:
92
+ **Homebrew:**
471
93
 
472
- - `LAST9_DISABLE_TELEMETRY`: Defaults to `true` (telemetry is disabled by default). Set to `false` to enable OpenTelemetry tracing if you have an OTLP collector configured.
473
- - `OTEL_EXPORTER_OTLP_ENDPOINT`: OpenTelemetry collector endpoint URL. Only needed if `LAST9_DISABLE_TELEMETRY=false`.
474
- - `OTEL_EXPORTER_OTLP_HEADERS`: Headers for OTLP exporter authentication. Only needed if `LAST9_DISABLE_TELEMETRY=false`.
475
- - `LAST9_DATASOURCE`: Name of the datasource/cluster to use. If not specified, the default datasource configured in your Last9 organization will be used.
476
- - `LAST9_API_HOST`: API host to connect to. Defaults to `app.last9.io`. Use this if you need to connect to a different Last9 endpoint (e.g., regional or self-hosted instances).
94
+ ```bash
95
+ brew install last9/tap/last9-mcp
96
+ ```
477
97
 
478
- ## Usage
98
+ **NPM:**
479
99
 
480
- Use the managed HTTP transport config from [Installation](#installation) whenever possible. The examples below are for local STDIO setup via Homebrew or NPM.
100
+ ```bash
101
+ npm install -g @last9/mcp-server@latest
102
+ # or directly:
103
+ npx -y @last9/mcp-server@latest
104
+ ```
481
105
 
482
- ## Usage with Claude Desktop
106
+ **Binary releases** (Windows / manual):
483
107
 
484
- Configure the Claude app to use the MCP server:
108
+ Download from [GitHub Releases](https://github.com/last9/last9-mcp-server/releases/latest):
485
109
 
486
- 1. Open the Claude Desktop app, go to Settings, then Developer
487
- 2. Click Edit Config
488
- 3. Open the `claude_desktop_config.json` file
489
- 4. Copy and paste the server config to your existing file, then save
490
- 5. Restart Claude
110
+ | Platform | Archive |
111
+ | --------------- | --------------------------------------- |
112
+ | Windows (x64) | `last9-mcp-server_Windows_x86_64.zip` |
113
+ | Windows (ARM64) | `last9-mcp-server_Windows_arm64.zip` |
114
+ | Linux (x64) | `last9-mcp-server_Linux_x86_64.tar.gz` |
115
+ | Linux (ARM64) | `last9-mcp-server_Linux_arm64.tar.gz` |
116
+ | macOS (x64) | `last9-mcp-server_Darwin_x86_64.tar.gz` |
117
+ | macOS (ARM64) | `last9-mcp-server_Darwin_arm64.tar.gz` |
491
118
 
492
- ### Local STDIO
119
+ ### Get a Refresh Token
493
120
 
494
- > **Note:** Claude Desktop currently supports local STDIO-based MCP servers only. Hosted HTTP transport is not yet supported in Claude Desktop.
121
+ Only **admins** can create tokens.
495
122
 
496
- Use a [Refresh Token](#getting-your-credentials).
123
+ 1. Go to [API Access](https://app.last9.io/settings/api-access)
124
+ 2. Click **Generate Token** with Write permissions
125
+ 3. Copy it
497
126
 
498
- Install via [Homebrew](#homebrew) or [NPM](#npm) first, then use a [Refresh Token](#getting-your-credentials).
127
+ ### Client Configuration
499
128
 
500
- ### If installed via Homebrew:
129
+ **Homebrew:**
501
130
 
502
131
  ```json
503
132
  {
@@ -505,14 +134,14 @@ Install via [Homebrew](#homebrew) or [NPM](#npm) first, then use a [Refresh Toke
505
134
  "last9": {
506
135
  "command": "/opt/homebrew/bin/last9-mcp",
507
136
  "env": {
508
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
137
+ "LAST9_REFRESH_TOKEN": "<your_refresh_token>"
509
138
  }
510
139
  }
511
140
  }
512
141
  }
513
142
  ```
514
143
 
515
- ### If installed via NPM:
144
+ **NPM:**
516
145
 
517
146
  ```json
518
147
  {
@@ -521,244 +150,173 @@ Install via [Homebrew](#homebrew) or [NPM](#npm) first, then use a [Refresh Toke
521
150
  "command": "npx",
522
151
  "args": ["-y", "@last9/mcp-server@latest"],
523
152
  "env": {
524
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
153
+ "LAST9_REFRESH_TOKEN": "<your_refresh_token>"
525
154
  }
526
155
  }
527
156
  }
528
157
  }
529
158
  ```
530
159
 
531
- ## Usage with Cursor
532
-
533
- Configure Cursor to use the MCP server:
160
+ **Where to paste this:**
534
161
 
535
- 1. Open Cursor, go to Settings, then Cursor Settings
536
- 2. Select MCP on the left
537
- 3. Click Add "New Global MCP Server" at the top right
538
- 4. Copy and paste the server config to your existing file, then save
539
- 5. Restart Cursor
162
+ | Client | Location |
163
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
164
+ | Claude Web/Desktop | Settings > Developer > Edit Config (`claude_desktop_config.json`) |
165
+ | Cursor | Settings > Cursor Settings > MCP > Add New Global MCP Server |
166
+ | Windsurf | Settings > Cascade > MCP Marketplace > gear icon (`mcp_config.json`) |
167
+ | VS Code | Wrap in `{ "mcp": { "servers": { ... } } }` in `settings.json` — [details](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) |
540
168
 
541
- ### Hosted MCP over HTTP (recommended)
169
+ <details>
170
+ <summary>VS Code STDIO config</summary>
542
171
 
543
172
  ```json
544
173
  {
545
- "mcpServers": {
546
- "last9": {
547
- "type": "http",
548
- "url": "https://app.last9.io/api/v4/organizations/<org_slug>/mcp",
549
- "headers": {
550
- "X-LAST9-API-TOKEN": "Bearer <mcp_client_token>"
174
+ "mcp": {
175
+ "servers": {
176
+ "last9": {
177
+ "type": "stdio",
178
+ "command": "/opt/homebrew/bin/last9-mcp",
179
+ "env": {
180
+ "LAST9_REFRESH_TOKEN": "<your_refresh_token>"
181
+ }
551
182
  }
552
183
  }
553
184
  }
554
185
  }
555
186
  ```
556
187
 
557
- ### Local STDIO (alternative)
188
+ For NPM: use `"command": "npx"` and add `"args": ["-y", "@last9/mcp-server@latest"]`.
558
189
 
559
- ### If installed via Homebrew:
190
+ </details>
560
191
 
561
- ```json
562
- {
563
- "mcpServers": {
564
- "last9": {
565
- "command": "/opt/homebrew/bin/last9-mcp",
566
- "env": {
567
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
568
- }
569
- }
570
- }
571
- }
572
- ```
192
+ <details>
193
+ <summary>Windows</summary>
573
194
 
574
- ### If installed via NPM:
195
+ After downloading from [GitHub Releases](https://github.com/last9/last9-mcp-server/releases/latest), extract and point to the full path:
575
196
 
576
197
  ```json
577
198
  {
578
199
  "mcpServers": {
579
200
  "last9": {
580
- "command": "npx",
581
- "args": ["-y", "@last9/mcp-server@latest"],
201
+ "command": "C:\\Users\\<user>\\AppData\\Local\\Programs\\last9-mcp-server.exe",
582
202
  "env": {
583
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
203
+ "LAST9_REFRESH_TOKEN": "<your_refresh_token>"
584
204
  }
585
205
  }
586
206
  }
587
207
  }
588
208
  ```
589
209
 
590
- ## Usage with Windsurf
210
+ The NPM route is easier on Windows — no path management.
591
211
 
592
- Configure Windsurf to use the MCP server:
212
+ </details>
593
213
 
594
- 1. Open Windsurf, go to Settings, then Developer
595
- 2. Click Edit Config
596
- 3. Open the `windsurf_config.json` file
597
- 4. Copy and paste the server config to your existing file, then save
598
- 5. Restart Windsurf
214
+ ### Environment Variables
599
215
 
600
- ### Hosted MCP over HTTP (recommended)
216
+ | Variable | Default | Description |
217
+ | ---------------------------- | -------------------- | ----------- |
218
+ | `LAST9_REFRESH_TOKEN` | *(required)* | Refresh token from [API Access](https://app.last9.io/settings/api-access) |
219
+ | `LAST9_DATASOURCE` | org default | Datasource/cluster name — useful when you have multiple Levitate clusters |
220
+ | `LAST9_API_HOST` | `app.last9.io` | Override the API host |
221
+ | `LAST9_MAX_GET_LOGS_ENTRIES` | `5000` | Max entries for chunked `get_logs` requests |
222
+ | `LAST9_DEBUG_CHUNKING` | `false` | Set `true` to log chunk-planning details for `get_logs`, `get_service_logs`, `get_traces` |
223
+ | `LAST9_DISABLE_TELEMETRY` | `true` | Set `false` to enable internal OTel tracing |
224
+ | `OTEL_SDK_DISABLED` | — | Standard OTel env var. Overrides `LAST9_DISABLE_TELEMETRY` |
225
+ | `OTEL_EXPORTER_OTLP_ENDPOINT`| — | OTLP collector endpoint (only when telemetry is enabled) |
226
+ | `OTEL_EXPORTER_OTLP_HEADERS` | — | OTLP auth headers (only when telemetry is enabled) |
601
227
 
602
- ```json
603
- {
604
- "mcpServers": {
605
- "last9": {
606
- "type": "http",
607
- "url": "https://app.last9.io/api/v4/organizations/<org_slug>/mcp",
608
- "headers": {
609
- "X-LAST9-API-TOKEN": "Bearer <mcp_client_token>"
610
- }
611
- }
612
- }
613
- }
614
- ```
228
+ ---
615
229
 
616
- ### Local STDIO (alternative)
230
+ ## What It Can Do
617
231
 
618
- ### If installed via Homebrew:
232
+ ### Service Health
619
233
 
620
- ```json
621
- {
622
- "mcpServers": {
623
- "last9": {
624
- "command": "/opt/homebrew/bin/last9-mcp",
625
- "env": {
626
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
627
- }
628
- }
629
- }
630
- }
631
- ```
234
+ - **`get_service_summary`** — Throughput, error rate, p95 response time across all services
235
+ - **`get_service_environments`** — Available environments for your services. Run this first — other APM tools need `env` from here
236
+ - **`get_service_performance_details`** — Full breakdown: throughput, error rate, p50/p90/p95/avg/max, apdex, availability
237
+ - **`get_service_operations_summary`** — Operations grouped by HTTP endpoints, DB calls, messaging, HTTP clients
238
+ - **`get_service_dependency_graph`** — Dependency map with throughput, latency, and error rates for upstream/downstream/infra
239
+ - **`get_exceptions`** — Server-side exceptions with service and span filters
632
240
 
633
- ### If installed via NPM:
241
+ ### Database Observability
634
242
 
635
- ```json
636
- {
637
- "mcpServers": {
638
- "last9": {
639
- "command": "npx",
640
- "args": ["-y", "@last9/mcp-server@latest"],
641
- "env": {
642
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
643
- }
644
- }
645
- }
646
- }
647
- ```
243
+ Four tools that go directly at your database performance, derived from OpenTelemetry trace spans. No extra instrumentation needed if you're already using OTel.
648
244
 
649
- ## Usage with VS Code
245
+ - **`get_databases`** Discover all databases across your infrastructure: DB type, host, throughput (queries/min), p95 latency, error rate, number of dependent services
246
+ - **`get_database_slow_queries`** — The actual slowest query executions, ordered by duration, with trace IDs for drilling into full traces
247
+ - **`get_database_queries`** — Query patterns and aggregates: how often a query runs, average/p95 duration, error rate
248
+ - **`get_database_server_metrics`** — Server-side metrics from the DB host itself (CPU, connections, buffer hit rates — depends on your DB system)
650
249
 
651
- > Note: MCP support in VS Code is available starting v1.99 and is currently in
652
- > preview. For advanced configuration options and alternative setup methods,
653
- > [view the VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).
250
+ Supports PostgreSQL, MySQL, MongoDB, Redis, Aerospike, and anything else OTel traces with a `db_system` attribute.
654
251
 
655
- 1. Open VS Code, go to Settings, select the User tab, then Features, then Chat
656
- 2. Click "Edit settings.json"
657
- 3. Copy and paste the server config to your existing file, then save
658
- 4. Restart VS Code
252
+ ### Prometheus / PromQL
659
253
 
660
- ### Hosted MCP over HTTP (recommended)
254
+ - **`prometheus_range_query`** PromQL range queries over any metric
255
+ - **`prometheus_instant_query`** — Instant queries; use rollup functions like `avg_over_time`, `sum_over_time`
256
+ - **`prometheus_label_values`** — Label values for a given series
257
+ - **`prometheus_labels`** — All labels available for a series
661
258
 
662
- ```json
663
- {
664
- "mcp": {
665
- "servers": {
666
- "last9": {
667
- "type": "http",
668
- "url": "https://app.last9.io/api/v4/organizations/<org_slug>/mcp",
669
- "headers": {
670
- "X-LAST9-API-TOKEN": "Bearer <mcp_client_token>"
671
- }
672
- }
673
- }
674
- }
675
- }
676
- ```
259
+ Point these at a different datasource/cluster than the default by setting `LAST9_DATASOURCE`.
677
260
 
678
- ### Local STDIO (alternative)
261
+ ### Logs
679
262
 
680
- ### If installed via Homebrew:
263
+ - **`get_logs`** Full JSON pipeline log queries (aggregations, filters, field extraction)
264
+ - **`get_service_logs`** — Raw log lines for a service, filterable by severity and body content
265
+ - **`get_log_attributes`** — Available attributes in the log schema for a time window
266
+ - **`get_drop_rules`** — Log drop rules from [Last9 Control Plane](https://last9.io/control-plane)
267
+ - **`add_drop_rule`** — Create a new drop rule to cut log volume at the source
681
268
 
682
- ```json
683
- {
684
- "mcp": {
685
- "servers": {
686
- "last9": {
687
- "type": "stdio",
688
- "command": "/opt/homebrew/bin/last9-mcp",
689
- "env": {
690
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
691
- }
692
- }
693
- }
694
- }
695
- }
696
- ```
269
+ ### Traces
697
270
 
698
- ### If installed via NPM:
271
+ - **`get_traces`** JSON pipeline trace queries for broad searches and aggregations
272
+ - **`get_service_traces`** — Traces by exact trace ID or service name. Use this when you have a trace ID — it's faster
273
+ - **`get_trace_attributes`** — Available attributes in the trace schema
699
274
 
700
- ```json
701
- {
702
- "mcp": {
703
- "servers": {
704
- "last9": {
705
- "type": "stdio",
706
- "command": "npx",
707
- "args": ["-y", "@last9/mcp-server@latest"],
708
- "env": {
709
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
710
- }
711
- }
712
- }
713
- }
714
- }
715
- ```
275
+ ### Change Events & Alerts
716
276
 
717
- ## Windows Example (Claude Desktop)
277
+ - **`get_change_events`** Deployments, config changes, rollbacks. Correlate incidents with what changed
278
+ - **`get_alert_config`** — Alert rule configurations — searchable by name, severity, type, tags
279
+ - **`get_alerts`** — Currently firing alerts within a time window
280
+ - **`get_notification_channels`** — Configured notification channels (Slack, PagerDuty, email, etc.)
718
281
 
719
- After downloading `last9-mcp-server_Windows_x86_64.zip` from [GitHub Releases](https://github.com/last9/last9-mcp-server/releases/latest), extract to get `last9-mcp-server.exe` and use its full path:
282
+ ### Fuzzy Name Resolution
720
283
 
721
- ```json
722
- {
723
- "mcpServers": {
724
- "last9": {
725
- "command": "C:\\Users\\<user>\\AppData\\Local\\Programs\\last9-mcp-server.exe",
726
- "env": {
727
- "LAST9_REFRESH_TOKEN": "<last9_refresh_token>"
728
- }
729
- }
730
- }
731
- }
732
- ```
284
+ - **`did_you_mean`** — When the agent isn't sure about an entity name, this returns the closest matches from your catalog (services, environments, hosts, databases, K8s deployments/namespaces, jobs). Up to 3 suggestions with similarity scores. The server calls this automatically before most tools when a name lookup returns empty.
733
285
 
734
- The same pattern applies for Cursor and Windsurf on Windows. For VS Code, use the `"mcp": { "servers": { ... } }` wrapper. On Windows, prefer [NPM](#npm) to avoid path management, or use the [hosted HTTP transport](#recommended-managed-mcp-over-http) to skip local installation entirely.
286
+ ---
735
287
 
736
- ## Development
288
+ ## How It Works
737
289
 
738
- For local development and testing, you can run the MCP server in HTTP mode which makes it easier to debug requests and responses.
290
+ **Deep links on every response.** Every tool returns a `deep_link` field a direct URL into the Last9 dashboard for that exact query and time range. The agent can hand you the link; you click it; you're there.
739
291
 
740
- ### Running in HTTP Mode
292
+ **Live attribute caching.** At startup, the server fetches the actual log and trace attribute names from your data and embeds them into tool descriptions. This means the AI assistant knows what fields exist in your schema, not just a generic list. The cache refreshes every 2 hours.
741
293
 
742
- Set the `LAST9_HTTP` environment variable to enable HTTP server mode:
294
+ **Chunked large results.** `get_logs` and `get_traces` handle large result sets through chunking rather than truncating. The default limit is 5000 entries for logs; configurable via `LAST9_MAX_GET_LOGS_ENTRIES`.
295
+
296
+ ---
297
+
298
+ ## Development
299
+
300
+ <details>
301
+ <summary>HTTP mode, curl testing, building from source</summary>
302
+
303
+ ### Run in HTTP Mode
743
304
 
744
305
  ```bash
745
- # Export required environment variables
746
306
  export LAST9_REFRESH_TOKEN="your_refresh_token"
747
307
  export LAST9_HTTP=true
748
- export LAST9_PORT=8080 # Optional, defaults to 8080
749
- # Run the server
308
+ export LAST9_PORT=8080
750
309
  ./last9-mcp-server
751
310
  ```
752
311
 
753
- The server will start on `http://localhost:8080/mcp` and you can test it with curl:
312
+ Server starts at `http://localhost:8080/mcp`.
754
313
 
755
- ### Testing with curl
314
+ ### Test with curl
756
315
 
757
- The MCP Streamable HTTP protocol requires an initialize handshake first. The server creates and returns a session ID in the response — do **not** set `Mcp-Session-Id` on the first request.
316
+ MCP Streamable HTTP requires an initialize handshake first. Don't set `Mcp-Session-Id` on the first request.
758
317
 
759
318
  ```bash
760
- # Step 1: Initialize — omit Mcp-Session-Id so the server creates the session.
761
- # Extract the returned Mcp-Session-Id from the response headers.
319
+ # Step 1: Initialize
762
320
  SESSION_ID=$(curl -si -X POST http://localhost:8080/mcp \
763
321
  -H "Content-Type: application/json" \
764
322
  -d '{
@@ -773,13 +331,13 @@ SESSION_ID=$(curl -si -X POST http://localhost:8080/mcp \
773
331
  }' | grep -i "^Mcp-Session-Id:" | awk '{print $2}' | tr -d '\r')
774
332
  echo "Session: $SESSION_ID"
775
333
 
776
- # Step 2: Send the initialized notification
334
+ # Step 2: Send initialized notification
777
335
  curl -s -X POST http://localhost:8080/mcp \
778
336
  -H "Content-Type: application/json" \
779
337
  -H "Mcp-Session-Id: $SESSION_ID" \
780
338
  -d '{"jsonrpc": "2.0", "method": "notifications/initialized", "params": {}}'
781
339
 
782
- # Step 3: List available tools
340
+ # Step 3: List tools
783
341
  curl -s -X POST http://localhost:8080/mcp \
784
342
  -H "Content-Type: application/json" \
785
343
  -H "Mcp-Session-Id: $SESSION_ID" \
@@ -796,7 +354,7 @@ curl -s -X POST http://localhost:8080/mcp \
796
354
  "params": {
797
355
  "name": "get_service_logs",
798
356
  "arguments": {
799
- "service_name": "your-service-name",
357
+ "service": "your-service-name",
800
358
  "lookback_minutes": 30,
801
359
  "limit": 10
802
360
  }
@@ -804,24 +362,236 @@ curl -s -X POST http://localhost:8080/mcp \
804
362
  }'
805
363
  ```
806
364
 
807
- ### Building from Source
365
+ ### Build from Source
808
366
 
809
367
  ```bash
810
- # Clone the repository
811
368
  git clone https://github.com/last9/last9-mcp-server.git
812
369
  cd last9-mcp-server
813
- # Build the binary
814
370
  go build -o last9-mcp-server
815
- # Run in development mode
816
371
  LAST9_HTTP=true ./last9-mcp-server
817
372
  ```
818
373
 
819
- **Note**: `LAST9_HTTP=true` is for local development and debugging of your own server process. For normal client integration, prefer the managed HTTP endpoint from [Installation](#installation).
374
+ `LAST9_HTTP=true` is for local development. For actual usage, the [hosted HTTP endpoint](#start-in-30-seconds-hosted) is easier.
375
+
376
+ </details>
377
+
378
+ ---
379
+
380
+ ## Tool Reference
381
+
382
+ <details>
383
+ <summary>All parameters, time input standards, and details</summary>
384
+
385
+ ### Time Input
386
+
387
+ - Absolute times (`start_time_iso`/`end_time_iso`, or `time_iso`) take precedence over `lookback_minutes`.
388
+ - For relative windows: use `lookback_minutes`.
389
+ - For absolute windows: use RFC3339/ISO8601 — `2026-02-09T15:04:05Z`.
390
+ - Legacy `YYYY-MM-DD HH:MM:SS` is accepted for compatibility only.
391
+
392
+ ### get_exceptions
393
+
394
+ - `limit` (integer, optional): Max exceptions. Default: 20.
395
+ - `lookback_minutes` (integer, optional): Default: 60.
396
+ - `start_time_iso` / `end_time_iso` (string, optional): Absolute time range.
397
+ - `service_name` (string, optional): Filter by service.
398
+ - `span_name` (string, optional): Filter by span name.
399
+ - `deployment_environment` (string, optional): Filter by environment.
400
+
401
+ ### get_service_summary
402
+
403
+ - `start_time_iso` / `end_time_iso` (string, optional)
404
+ - `env` (string, optional): Defaults to `prod`.
405
+
406
+ ### get_service_environments
407
+
408
+ - `start_time_iso` / `end_time_iso` (string, optional)
409
+
410
+ > All other APM tools require an `env` value. Use `""` if this returns empty.
411
+
412
+ ### get_service_performance_details
413
+
414
+ - `service_name` (string, required)
415
+ - `lookback_minutes` (integer, optional): Default: 60.
416
+ - `start_time_iso` / `end_time_iso` (string, optional)
417
+ - `env` (string, optional): Defaults to `prod`.
418
+
419
+ ### get_service_operations_summary
420
+
421
+ - `service_name` (string, required)
422
+ - `lookback_minutes` (integer, optional): Default: 60.
423
+ - `start_time_iso` / `end_time_iso` (string, optional)
424
+ - `env` (string, optional): Defaults to `prod`.
425
+
426
+ ### get_service_dependency_graph
427
+
428
+ - `service_name` (string, optional)
429
+ - `lookback_minutes` (integer, optional): Default: 60.
430
+ - `start_time_iso` / `end_time_iso` (string, optional)
431
+ - `env` (string, optional): Defaults to `prod`.
432
+
433
+ ### get_databases
434
+
435
+ - `env` (string, optional): Filter by environment. Default: all.
436
+ - `lookback_minutes` (integer, optional): Default: 60.
437
+ - `start_time_iso` / `end_time_iso` (string, optional)
438
+
439
+ ### get_database_slow_queries
440
+
441
+ - `db_system` (string, optional): e.g. `postgresql`, `mysql`, `mongodb`, `redis`.
442
+ - `host` (string, optional): Database host (`net_peer_name`).
443
+ - `service_name` (string, optional): Calling service name.
444
+ - `env` (string, optional)
445
+ - `min_duration_ms` (float, optional): Minimum query duration in ms.
446
+ - `lookback_minutes` (integer, optional): Default: 60.
447
+ - `start_time_iso` / `end_time_iso` (string, optional)
448
+ - `limit` (integer, optional): Default: 20.
449
+
450
+ ### get_database_queries
451
+
452
+ - `db_system` (string, optional)
453
+ - `host` (string, optional)
454
+ - `service_name` (string, optional)
455
+ - `env` (string, optional)
456
+ - `lookback_minutes` (integer, optional): Default: 60.
457
+ - `start_time_iso` / `end_time_iso` (string, optional)
458
+ - `limit` (integer, optional): Default: 20.
459
+
460
+ ### get_database_server_metrics
461
+
462
+ - `db_system` (string, required): e.g. `postgresql`, `mysql`, `mongodb`, `redis`, `aerospike`.
463
+ - `host` (string, optional)
464
+ - `lookback_minutes` (integer, optional): Default: 60.
465
+ - `start_time_iso` / `end_time_iso` (string, optional)
466
+
467
+ ### prometheus_range_query
468
+
469
+ - `query` (string, required): The PromQL query.
470
+ - `start_time_iso` / `end_time_iso` (string, optional): Defaults to last 60 min.
471
+ - `lookback_minutes` (float, optional): Default: 60.
472
+
473
+ ### prometheus_instant_query
474
+
475
+ - `query` (string, required)
476
+ - `time_iso` (string, optional): Defaults to now.
477
+ - `lookback_minutes` (float, optional)
478
+
479
+ ### prometheus_label_values
480
+
481
+ - `match_query` (string, optional): PromQL filter.
482
+ - `label` (string, required): Label name.
483
+ - `start_time_iso` / `end_time_iso` (string, optional)
484
+
485
+ ### prometheus_labels
486
+
487
+ - `match_query` (string, optional): PromQL filter.
488
+ - `start_time_iso` / `end_time_iso` (string, optional)
489
+
490
+ ### get_logs
491
+
492
+ - `logjson_query` (array, required): JSON pipeline query.
493
+ - `lookback_minutes` (integer, optional): Default: 5.
494
+ - `start_time_iso` / `end_time_iso` (string, optional)
495
+ - `limit` (integer, optional): Server default: 5000.
496
+ - `index` (string, optional): `physical_index:<name>` or `rehydration_index:<block_name>`.
497
+
498
+ ### get_service_logs
499
+
500
+ - `service` (string, required)
501
+ - `lookback_minutes` (integer, optional): Default: 60.
502
+ - `limit` (integer, optional): Default: 20.
503
+ - `env` (string, optional)
504
+ - `severity_filters` (array, optional): e.g. `["error", "warn"]`. OR logic.
505
+ - `body_filters` (array, optional): e.g. `["timeout", "failed"]`. OR logic.
506
+ - `start_time_iso` / `end_time_iso` (string, optional)
507
+ - `index` (string, optional)
508
+
509
+ Multiple filter types combine with AND. Each array uses OR internally.
510
+
511
+ ### get_log_attributes
512
+
513
+ - `lookback_minutes` (integer, optional): Default: 15.
514
+ - `start_time_iso` / `end_time_iso` (string, optional)
515
+ - `region` (string, optional)
516
+ - `index` (string, optional)
517
+
518
+ ### get_drop_rules
519
+
520
+ No parameters.
521
+
522
+ ### add_drop_rule
523
+
524
+ - `name` (string, required)
525
+ - `filters` (array, required): Each filter: `key`, `value`, `operator` (`equals`/`not_equals`), `conjunction` (`and`).
526
+
527
+ ### get_traces
528
+
529
+ Use for broad searches and aggregations. For exact trace ID lookup, use `get_service_traces`.
530
+
531
+ - `tracejson_query` (array, required)
532
+ - `start_time_iso` / `end_time_iso` (string, optional)
533
+ - `lookback_minutes` (integer, optional): Default: 60.
534
+ - `limit` (integer, optional): Default: 5000.
535
+
536
+ ### get_service_traces
537
+
538
+ Exactly one of `trace_id` or `service_name` is required.
539
+
540
+ - `trace_id` (string, optional): Default lookback: 72 hours.
541
+ - `service_name` (string, optional): Default lookback: 60 min.
542
+ - `lookback_minutes` (integer, optional)
543
+ - `start_time_iso` / `end_time_iso` (string, optional)
544
+ - `limit` (integer, optional): Default: 10.
545
+ - `env` (string, optional)
546
+
547
+ ### get_trace_attributes
548
+
549
+ - `lookback_minutes` (integer, optional): Default: 15.
550
+ - `start_time_iso` / `end_time_iso` (string, optional)
551
+ - `region` (string, optional)
552
+
553
+ ### get_change_events
554
+
555
+ - `start_time_iso` / `end_time_iso` (string, optional)
556
+ - `lookback_minutes` (integer, optional): Default: 60.
557
+ - `service` (string, optional)
558
+ - `environment` (string, optional)
559
+ - `event_name` (string, optional): Call without this first to get `available_event_names`.
560
+
561
+ ### get_alert_config
562
+
563
+ - `search_term` (string, optional): Free-text search across name, group, data source, tags.
564
+ - `rule_name` (string, optional)
565
+ - `severity` (string, optional)
566
+ - `rule_type` (string, optional): `static` or `anomaly`.
567
+ - `alert_group_name` / `alert_group_type` / `data_source_name` (string, optional)
568
+ - `tags` (array, optional): All must match (AND logic).
569
+
570
+ ### get_alerts
571
+
572
+ - `time_iso` (string, optional): Evaluation time in RFC3339.
573
+ - `window` (integer, optional): Lookback in seconds. Default: 900. Range: 60–86400.
574
+ - `lookback_minutes` (integer, optional): Range: 1–1440.
575
+
576
+ ### get_notification_channels
577
+
578
+ No parameters. Returns all configured notification channels (Slack, PagerDuty, email, webhooks, etc.).
579
+
580
+ ### did_you_mean
581
+
582
+ - `query` (string, required): The name to search for — partial, misspelled, or abbreviated.
583
+ - `type` (string, optional): Restrict to entity type: `service`, `environment`, `host`, `database`, `k8s_deployment`, `k8s_namespace`, `job`.
584
+
585
+ Returns up to 3 closest matches with similarity scores. Use this before any tool call where the entity name is uncertain. If a previous call returned empty results, try this before retrying.
586
+
587
+ </details>
588
+
589
+ ---
820
590
 
821
591
  ## Testing
822
592
 
823
- See [TESTING.md](TESTING.md) for detailed testing instructions.
593
+ See [TESTING.md](TESTING.md) for integration test setup and instructions.
824
594
 
825
- ## Badges
595
+ ---
826
596
 
827
597
  [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/last9-last9-mcp-server-badge.png)](https://mseep.ai/app/last9-last9-mcp-server)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@last9/mcp-server",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Last9 MCP Server - Model Context Protocol server implementation for Last9",
5
5
  "bin": {
6
6
  "last9-mcp": "./bin/cli.js"