Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,43 @@ npx @zwave-js/log-analyzer /path/to/logfile.txt --question "Why is node 5 not re
> [!NOTE]
> AI-powered log analysis require very large context windows up to 1 million tokens. To be able to provide this service, we need you to bring your own Gemini API key. You can get one for free at https://aistudio.google.com/app/apikey

## MCP Server

This package includes an [MCP](https://modelcontextprotocol.io/) server that exposes the log query tools over stdio, allowing AI agents to analyze Z-Wave JS logs in a tool-driven fashion without loading the entire log into context.

### Usage

```bash
npx --package=@zwave-js/log-analyzer zwave-log-analyzer-mcp
```

Or configure it in an MCP client:

```json
{
"mcpServers": {
"zwave-log-analyzer": {
"command": "npx",
"args": [
"--package=@zwave-js/log-analyzer",
"zwave-log-analyzer-mcp"
]
}
}
}
```

### Tools

- `loadLogFile` — Load a Z-Wave JS log file for analysis (must be called first)
- `getLogSummary` — Overall statistics: entries, time range, nodes, network activity
- `getNodeSummary` — Traffic and signal quality summary for a specific node
- `getNodeCommunication` — Enumerate communication attempts with a node
- `getEventsAroundTimestamp` — Log entries around a specific timestamp
- `getBackgroundRSSIBefore` — Most recent background RSSI reading before a timestamp
- `searchLogEntries` — Search entries by text/regex with filters and pagination
- `getLogChunk` — Read specific ranges of log entries by index

## Library Usage

You can use this package as a library in your own Node.js applications.
Expand Down
7 changes: 6 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export default tseslint.config(
},
},
{
files: ["src/cli.ts", "src/index.ts", "src/lib/**/*.ts"],
files: [
"src/cli.ts",
"src/index.ts",
"src/mcp-server.ts",
"src/lib/**/*.ts",
],
languageOptions: {
globals: globals.node,
},
Expand Down
Loading
Loading