LOGAN exposes a chat interface and a full log-analysis API that AI agents can use. There are three ways to integrate:
| Audience | How it works |
|---|---|
| MCP clients (Claude Code, Cursor, etc.) | Tools auto-discovered via .mcp.json — just open the project |
| Custom scripts (bash, Node, Python) | Hit the HTTP API directly or use the logan-listen CLI helper |
| Single-shot CLI | One-off commands via logan-listen.js --send |
- LOGAN is running with a file open
- LOGAN writes its port to
~/.logan/mcp-porton startup (default19532)
If you open the LOGAN project in an MCP-aware editor, the tools are automatically available via .mcp.json. No setup needed.
The key tools for interactive chat are:
| Tool | Purpose |
|---|---|
logan_send_message |
Send a message to the user (appears in LOGAN's Chat tab) |
logan_wait_for_message |
Block until the user replies (or timeout) |
A typical agent conversation looks like this:
1. logan_send_message("Hi! I can analyze this log. What would you like to know?")
2. logan_wait_for_message(timeout=120)
3. If response contains "stop"/"bye"/"exit"/"quit" → send goodbye, stop
4. Process the user's request using other logan_* tools
5. logan_send_message("Here's what I found: ...")
6. Go to step 2
Chat:
logan_send_message, logan_wait_for_message, logan_get_messages
Core:
logan_status, logan_open_file, logan_get_lines, logan_search, logan_navigate
Analysis:
logan_analyze, logan_triage, logan_investigate_crashes, logan_investigate_component, logan_investigate_timerange, logan_time_gaps
Annotations:
logan_add_bookmark, logan_bookmarks, logan_remove_bookmark, logan_update_bookmark, logan_clear_bookmarks,
logan_highlight, logan_highlights, logan_remove_highlight, logan_update_highlight, logan_clear_highlights
Notes:
logan_get_notes, logan_save_notes
Baselines:
logan_baseline_save, logan_baseline_list, logan_baseline_compare, logan_baseline_delete, logan_compare_baseline
Filter:
logan_filter, logan_clear_filter
For agents that aren't MCP clients, you can use the HTTP API directly or the logan-listen CLI helper.
Build first: npm run build (produces dist/mcp-server/logan-listen.js)
# Send a message to the user
node dist/mcp-server/logan-listen.js --send "Hello from my agent!"
# Wait for the user to reply (blocks up to 120s by default)
node dist/mcp-server/logan-listen.js
# Wait with custom timeout
node dist/mcp-server/logan-listen.js --timeout 300Output is always a single JSON line:
- Send:
{"success": true} - Listen:
{"message": "user's text", "timestamp": 1708900000000} - Timeout:
{"timeout": true}
All endpoints are on http://127.0.0.1:<port> where <port> is read from ~/.logan/mcp-port.
See ready-to-run examples:
- Bash:
examples/agent-bash.sh - Node.js:
examples/agent-node.mjs
| Endpoint | Method | Body | Description |
|---|---|---|---|
/api/agent-message |
POST | {"message": "..."} |
Send a message as the agent |
/api/events |
GET | — | SSE stream — receives event: message with {"from":"user","text":"..."} |
/api/messages |
GET | — | Chat history (optional ?since=<timestamp>) |
/api/user-message |
POST | {"message": "..."} |
Send a message as the user (for testing) |
/api/agent-status |
GET | — | {"connected": true/false, "count": N} |
| Endpoint | Method | Body | Description |
|---|---|---|---|
/api/status |
GET | — | Current file, line count, filter/bookmark state |
/api/open-file |
POST | {"filePath": "..."} |
Open a log file |
/api/get-lines |
POST | {"startLine": 0, "count": 100} |
Read lines from current file |
/api/search |
POST | {"pattern": "...", "isRegex": false, ...} |
Search current file |
/api/analyze |
POST | {"analyzerName": "..."} |
Run analysis |
/api/filter |
POST | {"levels": [...], "includePatterns": [...]} |
Apply filter |
/api/clear-filter |
POST | — | Remove filter |
/api/navigate |
POST | {"lineNumber": 0} |
Scroll LOGAN to a line |
/api/time-gaps |
POST | {"thresholdSeconds": 30} |
Find timestamp gaps |
/api/investigate-crashes |
POST | {"contextLines": 10, ...} |
Crash deep-dive |
/api/investigate-component |
POST | {"component": "..."} |
Component health |
/api/investigate-timerange |
POST | {"startTime": "...", "endTime": "..."} |
Time window analysis |
| Endpoint | Method | Body | Description |
|---|---|---|---|
/api/bookmark |
POST | {"lineNumber": 0, "label": "...", "color": "#ffff00"} |
Add bookmark |
/api/bookmarks |
GET | — | List bookmarks |
/api/bookmark-remove |
POST | {"id": "..."} |
Remove bookmark |
/api/bookmark-update |
POST | {"id": "...", "label": "...", "color": "..."} |
Update bookmark |
/api/bookmark-clear |
POST | — | Clear all bookmarks |
/api/highlight |
POST | {"pattern": "...", "backgroundColor": "#ffff00", ...} |
Add highlight |
/api/highlights |
GET | — | List highlights |
/api/highlight-remove |
POST | {"id": "..."} |
Remove highlight |
/api/highlight-update |
POST | {"id": "...", ...} |
Update highlight |
/api/highlight-clear |
POST | — | Clear all highlights |
| Endpoint | Method | Body | Description |
|---|---|---|---|
/api/notes |
GET | — | Read notes for current file |
/api/notes |
POST | {"content": "..."} |
Save notes for current file |
| Endpoint | Method | Body | Description |
|---|---|---|---|
/api/baselines |
GET | — | List saved baselines |
/api/baseline-save |
POST | {"name": "...", "description": "...", "tags": [...]} |
Save baseline |
/api/baseline-compare |
POST | {"baselineId": "..."} |
Compare against baseline |
/api/baseline-delete |
POST | {"baselineId": "..."} |
Delete baseline |
LOGAN includes a built-in agent that you can launch directly from the Chat tab — no terminal or API key needed.
- Open LOGAN with a log file
- Open the Agent Chat tab in the bottom panel
- Click "Launch Agent" in the status bar
- The agent connects automatically and greets you
- Type commands like
triage,search error,crashes,help - Type
stopor click "Stop Agent" to end the session
| Command | What it does |
|---|---|
triage / summary |
Quick severity assessment with error counts |
analyze / errors |
Level counts + top components |
crashes / fatal |
Find crash sites with surrounding context |
component X |
Investigate a specific component |
search X / find X |
Search for a pattern |
status / info |
File path, line count, filter state |
time gaps |
Find pauses in the log |
filter errors |
Show only error-level lines |
clear filter |
Show all lines again |
go to 500 |
Navigate to a line |
bookmark 42 |
Bookmark a line |
highlight X |
Highlight a pattern |
between T1 and T2 |
Analyze a time window |
notes |
View notes for this file |
help |
List all commands |
stop |
End the session |
To use a different agent script, create ~/.logan/agent-config.json:
{
"scriptPath": "/path/to/your/agent-script.mjs"
}The script must be a Node.js ESM module that connects to LOGAN's HTTP API (same pattern as examples/agent-node.mjs).
The built-in agent's command handling lives in examples/agent-intents.mjs. You can import it in your own scripts:
import { matchIntent, isStopWord, HELP_TEXT } from './agent-intents.mjs';
const response = await matchIntent(userMessage, apiCall);There is no forced kill mechanism. The convention is:
- The user types "stop", "bye", "exit", or "quit" in the Chat tab
- The agent checks the message and exits the loop gracefully
- LOGAN's Chat tab shows a hint: "Type 'stop' to end the session"
When an agent connects via SSE (/api/events?name=My%20Agent), LOGAN's Chat tab shows a green dot with the agent's name (e.g. "Claude Code connected"). When the agent disconnects, it returns to a grey dot.
Only one agent can be connected at a time. A second connection attempt gets a 409 Conflict response.
When using Claude Code as the agent, it will ask for permission on every tool call (curl, node, etc.). To avoid repeated prompts during a LOGAN session:
Type /permissions in the Claude Code prompt, then add rules to auto-approve. Or simply press a (Allow All) the first time a permission prompt appears — this grants all permissions for the current session only.
Use /allowed-tools to pre-approve only the tools Claude Code needs for LOGAN interaction:
/allowed-tools add Bash(npm run build)
/allowed-tools add Bash(curl *)
/allowed-tools add Bash(node -e *)
- Session-level permissions expire when you close the Claude Code session
- To revoke scoped tools:
/allowed-tools remove <pattern> - To reset everything: restart the Claude Code session