@loguro/mcp 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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/index.js +19776 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sebastian Pavel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @loguro/mcp
|
|
2
|
+
|
|
3
|
+
MCP server for querying [Loguro](https://logu.ro) logs directly from Claude Code.
|
|
4
|
+
|
|
5
|
+
## Auth
|
|
6
|
+
|
|
7
|
+
The MCP server uses a Loguro PAT (personal access token). Two ways to provide it:
|
|
8
|
+
|
|
9
|
+
**A) Reuse the token saved by the CLI (zero config):**
|
|
10
|
+
```bash
|
|
11
|
+
loguro login # saves to ~/.config/loguro/auth.json
|
|
12
|
+
```
|
|
13
|
+
The MCP server picks it up automatically.
|
|
14
|
+
|
|
15
|
+
**B) Explicit env var (Claude config / CI):**
|
|
16
|
+
```
|
|
17
|
+
LOGURO_TOKEN=pat_…
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Config
|
|
21
|
+
|
|
22
|
+
| Var | Required | Description |
|
|
23
|
+
|-----|----------|-------------|
|
|
24
|
+
| `LOGURO_TOKEN` | ✅ unless `auth.json` exists | Your Loguro PAT (`pat_…`) |
|
|
25
|
+
| `LOGURO_PROJECT` | optional | Default project slug (skip passing it each call) |
|
|
26
|
+
| `LOGURO_BASE_URL` | optional | Override base URL (default: `https://logu.ro`) |
|
|
27
|
+
|
|
28
|
+
## Claude Code setup
|
|
29
|
+
|
|
30
|
+
Add to `~/.claude/settings.json` (global) or `.claude/settings.json` (per project):
|
|
31
|
+
|
|
32
|
+
**With saved CLI auth (recommended):**
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"loguro": {
|
|
37
|
+
"command": "bunx",
|
|
38
|
+
"args": ["@loguro/mcp"],
|
|
39
|
+
"env": {
|
|
40
|
+
"LOGURO_PROJECT": "your-project-slug"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**With explicit token:**
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"mcpServers": {
|
|
51
|
+
"loguro": {
|
|
52
|
+
"command": "bunx",
|
|
53
|
+
"args": ["@loguro/mcp"],
|
|
54
|
+
"env": {
|
|
55
|
+
"LOGURO_TOKEN": "pat_…",
|
|
56
|
+
"LOGURO_PROJECT": "your-project-slug"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Tools
|
|
64
|
+
|
|
65
|
+
| Tool | Description |
|
|
66
|
+
|------|-------------|
|
|
67
|
+
| `query_logs` | Query logs with any filter: level, message, search, date range (incl. `notFrom`/`notTo`), trace, slow, rich context filters with operators (`>=`, `!=`, etc.) and negation, memory mode, cursor or offset pagination |
|
|
68
|
+
| `get_log_timeline` | Get logs around a specific log ID — context window for an error |
|
|
69
|
+
| `get_distinct_values` | List unique values for a field (e.g. all levels, all envs) |
|
|
70
|
+
| `group_logs` | Group logs by a field with explicit `groupValues` |
|
|
71
|
+
| `get_slow_logs` | Shortcut for slow requests above N ms |
|
|
72
|
+
| `sample_logs` | Random sample — useful for exploring an unfamiliar project |
|
|
73
|
+
|
|
74
|
+
## When to use the MCP vs CLI vs Web Console
|
|
75
|
+
|
|
76
|
+
The MCP server is one of three ways to interact with Loguro. Each fits a different moment in the workflow.
|
|
77
|
+
|
|
78
|
+
| Reach for **MCP** (this) when... | Reach for **CLI** when... | Reach for **Web Console** when... |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| Debugging in the IDE: ask Claude/Cursor about a failure and let it query logs iteratively | Reproducible scripts: cron jobs, CI alerts, `loguro logs --json \| jq` | Visual exploration: charts, timeline view, replay, saved view dashboards |
|
|
81
|
+
| Natural-language questions: "show me errors after the deploy at 14:00" | Direct queries you already know: `loguro logs -l error --from 1h` | Setting up integrations interactively (OAuth flows, Slack app install) |
|
|
82
|
+
| Multi-step investigation where Claude calls `get_log_timeline` then `group_logs` then `get_distinct_values` autonomously | One-shot ad-hoc queries from terminal, piping into other tools | First-time onboarding for someone new to your project |
|
|
83
|
+
| Sharing context with the AI without copy-pasting log dumps | Bulk operations: project + key + alert in one shell session | Issue creation with rich UI, log shares, embed widgets |
|
|
84
|
+
|
|
85
|
+
### Token footprint
|
|
86
|
+
|
|
87
|
+
This MCP exposes **6 focused tools** (`query_logs`, `get_log_timeline`, `get_distinct_values`, `group_logs`, `get_slow_logs`, `sample_logs`) — ~1k tokens of system prompt vs the 5–10k tokens of MCPs that ship 30+ generic tools. That overhead matters when you run smaller models or have a long debugging conversation.
|
|
88
|
+
|
|
89
|
+
### Zero-config setup
|
|
90
|
+
|
|
91
|
+
If you've already run `loguro login`, this MCP picks up the saved PAT from `~/.config/loguro/auth.json` automatically. No second login, no per-session credentials. The same token works across all your projects.
|
|
92
|
+
|
|
93
|
+
For CI or shared agents where the CLI isn't installed, set `LOGURO_TOKEN` in env (see [Config](#config) above).
|
|
94
|
+
|
|
95
|
+
### Latency
|
|
96
|
+
|
|
97
|
+
The MCP makes a single fetch per tool call (no SQL round-tripping through an interpreter). For interactive AI workflows this is fast enough that Claude can chain 3–5 tool calls in a single turn without lag.
|
|
98
|
+
|
|
99
|
+
For bulk fetches (10k+ rows, exports, scripted pipelines), the CLI streams JSON faster — use `loguro logs --json | jq` instead.
|
|
100
|
+
|
|
101
|
+
### Combine them
|
|
102
|
+
|
|
103
|
+
- **CLI** for setup and scripted workflows
|
|
104
|
+
- **MCP** for IDE-driven debugging and natural-language exploration
|
|
105
|
+
- **Web** for visual analysis and saved-view dashboards
|
|
106
|
+
|
|
107
|
+
All three share auth and read the same data — switch freely based on what's least friction in the moment.
|
|
108
|
+
|
|
109
|
+
### Context filters
|
|
110
|
+
|
|
111
|
+
`context` is an array of filter objects:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
[
|
|
115
|
+
{ "key": "user_id", "value": "42" },
|
|
116
|
+
{ "key": "duration", "value": 500, "op": ">=" },
|
|
117
|
+
{ "key": "env", "value": "staging", "negate": true }
|
|
118
|
+
]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Operators: `=` (default), `!=`, `>`, `<`, `>=`, `<=`. `negate: true` excludes (maps to `notContext_<key>`).
|