@last9/mcp-server 0.2.0 → 0.5.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 +357 -253
- package/package.json +1 -1
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -604
- package/dist/last9-mcp-server +0 -0
package/dist/README.md
DELETED
|
@@ -1,604 +0,0 @@
|
|
|
1
|
-
# Last9 MCP Server
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
A [Model Context Protocol](https://modelcontextprotocol.io/) server
|
|
6
|
-
implementation for [Last9](https://last9.io/mcp/) that enables AI agents to
|
|
7
|
-
seamlessly bring real-time production context — logs, metrics, and traces — into
|
|
8
|
-
your local environment to auto-fix code faster.
|
|
9
|
-
|
|
10
|
-
- [View demo](https://www.youtube.com/watch?v=AQH5xq6qzjI)
|
|
11
|
-
- Read our
|
|
12
|
-
[announcement blog post](https://last9.io/blog/launching-last9-mcp-server/)
|
|
13
|
-
|
|
14
|
-
## Status
|
|
15
|
-
|
|
16
|
-
Works with Claude desktop app, or Cursor, Windsurf, and VSCode (Github Copilot)
|
|
17
|
-
IDEs. Implements the following MCP
|
|
18
|
-
[tools](https://modelcontextprotocol.io/docs/concepts/tools):
|
|
19
|
-
|
|
20
|
-
**Observability & APM Tools:**
|
|
21
|
-
|
|
22
|
-
- `get_exceptions`: Get the list of exceptions.
|
|
23
|
-
- `get_service_summary`: Get service summary with throughput, error rate, and response time.
|
|
24
|
-
- `get_service_environments`: Get available environments for services.
|
|
25
|
-
- `get_service_performance_details`: Get detailed performance metrics for a service.
|
|
26
|
-
- `get_service_operations_summary`: Get operations summary for a service.
|
|
27
|
-
- `get_service_dependency_graph`: Get service dependency graph showing incoming/outgoing dependencies.
|
|
28
|
-
|
|
29
|
-
**Prometheus/PromQL Tools:**
|
|
30
|
-
|
|
31
|
-
- `promptheus_range_query`: Execute PromQL range queries for metrics data.
|
|
32
|
-
- `prometheus_instant_query`: Execute PromQL instant queries for metrics data.
|
|
33
|
-
- `prometheus_label_values`: Get label values for PromQL queries.
|
|
34
|
-
- `prometheus_labels`: Get available labels for PromQL queries.
|
|
35
|
-
|
|
36
|
-
**Logs Management:**
|
|
37
|
-
|
|
38
|
-
- `get_logs`: Get logs filtered by service name and/or severity level.
|
|
39
|
-
- `get_drop_rules`: Get drop rules for logs that determine what logs get
|
|
40
|
-
filtered out at [Last9 Control Plane](https://last9.io/control-plane)
|
|
41
|
-
- `add_drop_rule`: Create a drop rule for logs at
|
|
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.
|
|
48
|
-
|
|
49
|
-
**Alert Management:**
|
|
50
|
-
|
|
51
|
-
- `get_alert_config`: Get alert configurations (alert rules) from Last9.
|
|
52
|
-
- `get_alerts`: Get currently active alerts from Last9 monitoring system.
|
|
53
|
-
|
|
54
|
-
## Tools Documentation
|
|
55
|
-
|
|
56
|
-
### get_exceptions
|
|
57
|
-
|
|
58
|
-
Retrieves server-side exceptions over a specified time range.
|
|
59
|
-
|
|
60
|
-
Parameters:
|
|
61
|
-
|
|
62
|
-
- `limit` (integer, optional): Maximum number of exceptions to return.
|
|
63
|
-
Default: 20.
|
|
64
|
-
- `lookback_minutes` (integer, recommended): Number of minutes to look back from
|
|
65
|
-
now. Default: 60. Examples: 60, 30, 15.
|
|
66
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD
|
|
67
|
-
HH:MM:SS). Leave empty to use lookback_minutes.
|
|
68
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD
|
|
69
|
-
HH:MM:SS). Leave empty to default to current time.
|
|
70
|
-
- `span_name` (string, optional): Name of the span to filter by.
|
|
71
|
-
|
|
72
|
-
### get_service_summary
|
|
73
|
-
|
|
74
|
-
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.
|
|
75
|
-
|
|
76
|
-
Parameters:
|
|
77
|
-
|
|
78
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to end_time_iso - 1 hour.
|
|
79
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
80
|
-
- `env` (string, optional): Environment to filter by. Defaults to 'prod'.
|
|
81
|
-
|
|
82
|
-
### get_service_environments
|
|
83
|
-
|
|
84
|
-
Get available environments for services. Returns an array of environments that can be used with other APM tools.
|
|
85
|
-
|
|
86
|
-
Parameters:
|
|
87
|
-
|
|
88
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to end_time_iso - 1 hour.
|
|
89
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
90
|
-
|
|
91
|
-
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.
|
|
92
|
-
|
|
93
|
-
### get_service_performance_details
|
|
94
|
-
|
|
95
|
-
Get detailed performance metrics for a specific service over a given time range.
|
|
96
|
-
|
|
97
|
-
Parameters:
|
|
98
|
-
|
|
99
|
-
- `service_name` (string, required): Name of the service to get performance details for.
|
|
100
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - 60 minutes.
|
|
101
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
102
|
-
- `env` (string, optional): Environment to filter by. Defaults to 'prod'.
|
|
103
|
-
|
|
104
|
-
### get_service_operations_summary
|
|
105
|
-
|
|
106
|
-
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.
|
|
107
|
-
|
|
108
|
-
Parameters:
|
|
109
|
-
|
|
110
|
-
- `service_name` (string, required): Name of the service to get operations summary for.
|
|
111
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - 60 minutes.
|
|
112
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
113
|
-
- `env` (string, optional): Environment to filter by. Defaults to 'prod'.
|
|
114
|
-
|
|
115
|
-
### get_service_dependency_graph
|
|
116
|
-
|
|
117
|
-
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.
|
|
118
|
-
|
|
119
|
-
Parameters:
|
|
120
|
-
|
|
121
|
-
- `service_name` (string, optional): Name of the service to get the dependency graph for.
|
|
122
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - 60 minutes.
|
|
123
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
124
|
-
- `env` (string, optional): Environment to filter by. Defaults to 'prod'.
|
|
125
|
-
|
|
126
|
-
### promptheus_range_query
|
|
127
|
-
|
|
128
|
-
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
|
-
|
|
130
|
-
Parameters:
|
|
131
|
-
|
|
132
|
-
- `query` (string, required): The range query to execute.
|
|
133
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - 60 minutes.
|
|
134
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
135
|
-
|
|
136
|
-
### prometheus_instant_query
|
|
137
|
-
|
|
138
|
-
Perform a Prometheus instant query to get metrics data at a specific point in time. Typically should use rollup functions like sum_over_time, avg_over_time, quantile_over_time over a time window.
|
|
139
|
-
|
|
140
|
-
Parameters:
|
|
141
|
-
|
|
142
|
-
- `query` (string, required): The instant query to execute.
|
|
143
|
-
- `time_iso` (string, optional): Time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
144
|
-
|
|
145
|
-
### prometheus_label_values
|
|
146
|
-
|
|
147
|
-
Return the label values for a particular label and PromQL filter query. Similar to Prometheus /label_values call.
|
|
148
|
-
|
|
149
|
-
Parameters:
|
|
150
|
-
|
|
151
|
-
- `match_query` (string, required): A valid PromQL filter query.
|
|
152
|
-
- `label` (string, required): The label to get values for.
|
|
153
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - 60 minutes.
|
|
154
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
155
|
-
|
|
156
|
-
### prometheus_labels
|
|
157
|
-
|
|
158
|
-
Return the labels for a given PromQL match query. Similar to Prometheus /labels call.
|
|
159
|
-
|
|
160
|
-
Parameters:
|
|
161
|
-
|
|
162
|
-
- `match_query` (string, required): A valid PromQL filter query.
|
|
163
|
-
- `start_time_iso` (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to now - 60 minutes.
|
|
164
|
-
- `end_time_iso` (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time.
|
|
165
|
-
|
|
166
|
-
### get_logs
|
|
167
|
-
|
|
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`.
|
|
171
|
-
|
|
172
|
-
Parameters:
|
|
173
|
-
|
|
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.
|
|
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.
|
|
181
|
-
|
|
182
|
-
### get_drop_rules
|
|
183
|
-
|
|
184
|
-
Gets drop rules for logs, which determine what logs get filtered out from
|
|
185
|
-
reaching Last9.
|
|
186
|
-
|
|
187
|
-
### add_drop_rule
|
|
188
|
-
|
|
189
|
-
Adds a new drop rule to filter out specific logs at
|
|
190
|
-
[Last9 Control Plane](https://last9.io/control-plane)
|
|
191
|
-
|
|
192
|
-
Parameters:
|
|
193
|
-
|
|
194
|
-
- `name` (string, required): Name of the drop rule.
|
|
195
|
-
- `filters` (array, required): List of filter conditions to apply. Each filter
|
|
196
|
-
has:
|
|
197
|
-
- `key` (string, required): The key to filter on. Only attributes and
|
|
198
|
-
resource.attributes keys are supported. For resource attributes, use format:
|
|
199
|
-
resource.attributes[key_name] and for log attributes, use format:
|
|
200
|
-
attributes[key_name] Double quotes in key names must be escaped.
|
|
201
|
-
- `value` (string, required): The value to filter against.
|
|
202
|
-
- `operator` (string, required): The operator used for filtering. Valid
|
|
203
|
-
values:
|
|
204
|
-
- "equals"
|
|
205
|
-
- "not_equals"
|
|
206
|
-
- `conjunction` (string, required): The logical conjunction between filters.
|
|
207
|
-
Valid values:
|
|
208
|
-
- "and"
|
|
209
|
-
|
|
210
|
-
### get_alert_config
|
|
211
|
-
|
|
212
|
-
Get alert configurations (alert rules) from Last9. Returns all configured alert rules including their conditions, labels, and annotations.
|
|
213
|
-
|
|
214
|
-
Parameters:
|
|
215
|
-
|
|
216
|
-
None - This tool retrieves all available alert configurations.
|
|
217
|
-
|
|
218
|
-
Returns information about:
|
|
219
|
-
|
|
220
|
-
- Alert rule ID and name
|
|
221
|
-
- Primary indicator being monitored
|
|
222
|
-
- Current state and severity
|
|
223
|
-
- Algorithm used for alerting
|
|
224
|
-
- Entity ID and organization details
|
|
225
|
-
- Properties and configuration
|
|
226
|
-
- Creation and update timestamps
|
|
227
|
-
- Group timeseries notification settings
|
|
228
|
-
|
|
229
|
-
### get_alerts
|
|
230
|
-
|
|
231
|
-
Get currently active alerts from Last9 monitoring system. Returns all alerts that are currently firing or have fired recently within the specified time window.
|
|
232
|
-
|
|
233
|
-
Parameters:
|
|
234
|
-
|
|
235
|
-
- `timestamp` (integer, optional): Unix timestamp for the query time. Leave empty to default to current time.
|
|
236
|
-
- `window` (integer, optional): Time window in seconds to look back for alerts. Defaults to 900 seconds (15 minutes). Range: 60-86400 seconds.
|
|
237
|
-
|
|
238
|
-
Returns information about:
|
|
239
|
-
|
|
240
|
-
- Alert rule details (ID, name, group, type)
|
|
241
|
-
- Current state and severity
|
|
242
|
-
- Last fired timestamp and duration
|
|
243
|
-
- Rule properties and configuration
|
|
244
|
-
- Alert instances with current values
|
|
245
|
-
- Metric degradation information
|
|
246
|
-
- Group labels and annotations for each instance
|
|
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
|
-
|
|
297
|
-
## Installation
|
|
298
|
-
|
|
299
|
-
You can install the Last9 Observability MCP server using either:
|
|
300
|
-
|
|
301
|
-
### Homebrew
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
# Add the Last9 tap
|
|
305
|
-
brew tap last9/tap
|
|
306
|
-
|
|
307
|
-
# Install the Last9 MCP CLI
|
|
308
|
-
brew install last9-mcp
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### NPM
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
# Install globally
|
|
315
|
-
npm install -g @last9/mcp-server
|
|
316
|
-
|
|
317
|
-
# Or run directly with npx
|
|
318
|
-
npx @last9/mcp-server
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
## Configuration
|
|
322
|
-
|
|
323
|
-
### Environment Variables
|
|
324
|
-
|
|
325
|
-
The Last9 MCP server requires the following environment variables:
|
|
326
|
-
|
|
327
|
-
- `LAST9_BASE_URL`: (required) Last9 API URL from
|
|
328
|
-
[OTel integration](https://app.last9.io/integrations?integration=OpenTelemetry)
|
|
329
|
-
- `LAST9_AUTH_TOKEN`: (required) Authentication token for Last9 MCP server from
|
|
330
|
-
[OTel integration](https://app.last9.io/integrations?integration=OpenTelemetry)
|
|
331
|
-
- `LAST9_REFRESH_TOKEN`: (required) Refresh Token with Write permissions, needed
|
|
332
|
-
for accessing control plane APIs from
|
|
333
|
-
[API Access](https://app.last9.io/settings/api-access)
|
|
334
|
-
|
|
335
|
-
## Usage with Claude Desktop
|
|
336
|
-
|
|
337
|
-
Configure the Claude app to use the MCP server:
|
|
338
|
-
|
|
339
|
-
1. Open the Claude Desktop app, go to Settings, then Developer
|
|
340
|
-
2. Click Edit Config
|
|
341
|
-
3. Open the `claude_desktop_config.json` file
|
|
342
|
-
4. Copy and paste the server config to your existing file, then save
|
|
343
|
-
5. Restart Claude
|
|
344
|
-
|
|
345
|
-
### If installed via Homebrew:
|
|
346
|
-
```json
|
|
347
|
-
{
|
|
348
|
-
"mcpServers": {
|
|
349
|
-
"last9": {
|
|
350
|
-
"command": "/opt/homebrew/bin/last9-mcp",
|
|
351
|
-
"env": {
|
|
352
|
-
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
353
|
-
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
354
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
```
|
|
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
|
-
|
|
378
|
-
## Usage with Cursor
|
|
379
|
-
|
|
380
|
-
Configure Cursor to use the MCP server:
|
|
381
|
-
|
|
382
|
-
1. Open Cursor, go to Settings, then Cursor Settings
|
|
383
|
-
2. Select MCP on the left
|
|
384
|
-
3. Click Add "New Global MCP Server" at the top right
|
|
385
|
-
4. Copy and paste the server config to your existing file, then save
|
|
386
|
-
5. Restart Cursor
|
|
387
|
-
|
|
388
|
-
### If installed via Homebrew:
|
|
389
|
-
```json
|
|
390
|
-
{
|
|
391
|
-
"mcpServers": {
|
|
392
|
-
"last9": {
|
|
393
|
-
"command": "/opt/homebrew/bin/last9-mcp",
|
|
394
|
-
"env": {
|
|
395
|
-
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
396
|
-
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
397
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
```
|
|
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
|
-
|
|
421
|
-
## Usage with Windsurf
|
|
422
|
-
|
|
423
|
-
Configure Windsurf to use the MCP server:
|
|
424
|
-
|
|
425
|
-
1. Open Windsurf, go to Settings, then Developer
|
|
426
|
-
2. Click Edit Config
|
|
427
|
-
3. Open the `windsurf_config.json` file
|
|
428
|
-
4. Copy and paste the server config to your existing file, then save
|
|
429
|
-
5. Restart Windsurf
|
|
430
|
-
|
|
431
|
-
### If installed via Homebrew:
|
|
432
|
-
```json
|
|
433
|
-
{
|
|
434
|
-
"mcpServers": {
|
|
435
|
-
"last9": {
|
|
436
|
-
"command": "/opt/homebrew/bin/last9-mcp",
|
|
437
|
-
"env": {
|
|
438
|
-
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
439
|
-
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
440
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
```
|
|
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
|
-
|
|
464
|
-
## Usage with VS Code
|
|
465
|
-
|
|
466
|
-
> Note: MCP support in VS Code is available starting v1.99 and is currently in
|
|
467
|
-
> preview. For advanced configuration options and alternative setup methods,
|
|
468
|
-
> [view the VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).
|
|
469
|
-
|
|
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
|
|
474
|
-
|
|
475
|
-
### If installed via Homebrew:
|
|
476
|
-
```json
|
|
477
|
-
{
|
|
478
|
-
"mcp": {
|
|
479
|
-
"servers": {
|
|
480
|
-
"last9": {
|
|
481
|
-
"type": "stdio",
|
|
482
|
-
"command": "/opt/homebrew/bin/last9-mcp",
|
|
483
|
-
"env": {
|
|
484
|
-
"LAST9_BASE_URL": "<last9_otlp_host>",
|
|
485
|
-
"LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>",
|
|
486
|
-
"LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
```
|
|
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
|
-
|
|
602
|
-
## Badges
|
|
603
|
-
|
|
604
|
-
[](https://mseep.ai/app/last9-last9-mcp-server)
|
package/dist/last9-mcp-server
DELETED
|
Binary file
|