mcp-logs 0.1.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,10 @@ curl -fsSL https://bun.sh/install | bash
18
18
 
19
19
  - Receive logs from CLI agent via Unix socket
20
20
  - In-memory log storage (10,000 logs max, FIFO)
21
- - 6 MCP tools for querying and analyzing logs
21
+ - **8 MCP tools** for querying and analyzing logs
22
+ - **Advanced Analytics** - Comprehensive log insights with distributions, timelines, and error rates
23
+ - **Temporal Filtering** - Filter logs by time range with flexible formats (ISO 8601, Unix timestamps, relative times)
24
+ - **Regex Search** - Powerful pattern matching for complex log queries
22
25
  - Real-time log streaming
23
26
  - Multi-project support
24
27
  - Automatic log level inference
@@ -199,32 +202,54 @@ Show me the last 100 logs
199
202
 
200
203
  ### 2. get_logs
201
204
 
202
- Advanced filtering with multiple criteria.
205
+ Advanced filtering with multiple criteria, including time range filtering.
203
206
 
204
207
  **Parameters:**
205
208
  - `project` (optional): Filter by project name
206
209
  - `level` (optional): `info`, `warn`, `error`, `debug`
207
210
  - `source` (optional): `stdout`, `stderr`
208
211
  - `search` (optional): Text search in messages
212
+ - `startTime` (optional): Start of time range (ISO 8601, Unix timestamp, or relative like "last 1h")
213
+ - `endTime` (optional): End of time range
209
214
  - `limit` (optional): Max results (default: 100)
210
215
 
211
- **Example:**
216
+ **Time Format Examples:**
217
+ ```
218
+ # ISO 8601
219
+ startTime: "2026-01-18T10:00:00Z"
220
+
221
+ # Unix timestamp
222
+ startTime: 1737201600000
223
+
224
+ # Relative times
225
+ startTime: "last 1h" - Last hour
226
+ startTime: "last 30m" - Last 30 minutes
227
+ startTime: "last 2d" - Last 2 days
228
+ startTime: "last 1w" - Last week
229
+ ```
230
+
231
+ **Examples:**
212
232
  ```
213
233
  Show me error logs from project "my-app"
234
+ Get logs from the last hour
235
+ Show me logs between 10:00 and 11:00
214
236
  ```
215
237
 
216
238
  ### 3. search_logs
217
239
 
218
- Search logs by text content.
240
+ Search logs by text content with optional regex support.
219
241
 
220
242
  **Parameters:**
221
- - `query` (required): Search text
243
+ - `query` (required): Search text or regex pattern
244
+ - `regex` (optional): Enable regex matching (default: false)
222
245
  - `project` (optional): Filter by project
223
246
  - `limit` (optional): Max results (default: 50)
224
247
 
225
- **Example:**
248
+ **Examples:**
226
249
  ```
227
250
  Search for "database connection" in the logs
251
+ Find logs matching pattern "error.*timeout"
252
+ Search for regex "user_\d+" in project "api"
228
253
  ```
229
254
 
230
255
  ### 4. get_errors
@@ -249,7 +274,50 @@ Get global statistics about captured logs.
249
274
  Show log statistics
250
275
  ```
251
276
 
252
- ### 6. clear_logs
277
+ ### 6. get_analytics
278
+
279
+ **NEW in v1.0.0** - Get advanced analytics and insights on your logs.
280
+
281
+ **Parameters:**
282
+ - `timeRange` (optional): Predefined range - "1h", "6h", "24h", "7d", "30d"
283
+ - `project` (optional): Filter by specific project
284
+ - `groupBy` (optional): Group data by - "minute", "hour", "day", "project", "level"
285
+ - `startTime` (optional): Custom start time (same formats as get_logs)
286
+ - `endTime` (optional): Custom end time
287
+
288
+ **Returns:**
289
+ - **Summary**: Total logs, time period covered, active projects
290
+ - **Distribution by Level**: Count of errors, warnings, info, debug logs
291
+ - **Distribution by Project**: Logs per project
292
+ - **Timeline**: Logs grouped by time intervals (minute/hour/day)
293
+ - **Top Messages**: Most frequent log messages (top 10)
294
+ - **Error Rate**: Percentage of error logs vs total
295
+
296
+ **Examples:**
297
+ ```
298
+ Analyze logs from the last hour
299
+ Get analytics for project "frontend" over last 24 hours
300
+ Show me log distribution by level for the last week
301
+ What are the most common error messages?
302
+ ```
303
+
304
+ **Use Cases:**
305
+ - Identify error spikes in timelines
306
+ - Compare log volumes across projects
307
+ - Find most frequent error messages
308
+ - Calculate error rates for SLA monitoring
309
+ - Analyze log patterns over time
310
+
311
+ ### 7. list_projects
312
+
313
+ List all connected log agents and projects.
314
+
315
+ **Example:**
316
+ ```
317
+ Which projects are connected?
318
+ ```
319
+
320
+ ### 8. clear_logs
253
321
 
254
322
  Clear all logs from memory.
255
323
 
@@ -503,6 +571,49 @@ Yacine Yaici - yaiciy01@gmail.com
503
571
 
504
572
  ## Changelog
505
573
 
574
+ ### 1.0.0 (2026-01-18)
575
+
576
+ **Major Release - Advanced Features**
577
+
578
+ - **NEW: get_analytics Tool** - Comprehensive log analysis and insights
579
+ - Summary statistics (total logs, time range, active projects)
580
+ - Distribution by log level (error, warn, info, debug counts)
581
+ - Distribution by project (logs per project)
582
+ - Timeline analysis (grouped by minute/hour/day)
583
+ - Top 10 most frequent messages
584
+ - Error rate calculation (percentage of errors vs total logs)
585
+ - Flexible time ranges: "1h", "6h", "24h", "7d", "30d"
586
+ - Custom time ranges with startTime/endTime
587
+ - Group by options: minute, hour, day, project, level
588
+ - **Temporal Filtering** - Filter logs by time range in get_logs tool
589
+ - Multiple time format support:
590
+ - ISO 8601: `"2026-01-18T10:00:00Z"`
591
+ - Unix timestamps: `1737201600000`
592
+ - Relative times: `"last 1h"`, `"last 30m"`, `"last 2d"`, `"last 1w"`
593
+ - `startTime` and `endTime` parameters for custom ranges
594
+ - Utility functions for time parsing and validation
595
+ - **Regex Search** - Advanced pattern matching in search_logs tool
596
+ - New `regex` boolean parameter (default: false)
597
+ - Full regex syntax support for complex queries
598
+ - Backwards compatible (simple text search by default)
599
+ - **Time Utilities Module** - New src/utils/time.ts
600
+ - `parseTimeInput()` - Parse ISO 8601, timestamps, relative times
601
+ - `isInTimeRange()` - Check if timestamp in range
602
+ - `formatDuration()` - Human-readable duration formatting
603
+ - `groupByTimeInterval()` - Group logs by time buckets
604
+ - **Enhanced Types** - Extended TypeScript interfaces
605
+ - `AnalyticsOptions` - Options for analytics queries
606
+ - `Analytics` - Complete analytics data structure
607
+ - `LogFilter` - Added startTime/endTime/regex support
608
+ - **Documentation** - Updated README with detailed examples
609
+ - Complete get_analytics documentation with use cases
610
+ - Time format examples for temporal filtering
611
+ - Regex search patterns and examples
612
+ - Tool count updated: 6 → 8 tools
613
+ - **Version Bump**: 0.1.2 → 1.0.0
614
+ - **Testing**: Added test-features.ts for validating new functionality
615
+ - **Stability**: All TypeScript type checks pass, production-ready
616
+
506
617
  ### 0.1.2 (2026-01-07)
507
618
 
508
619
  - **Enhanced Config CLI**: Integrated config management into main binary