Give coding agents direct access to local server logs.
When your coding agent tries to test your server live, you end up scrolling through your terminal, copying log lines, and pasting them into the chat.
Use logbox to pipe your dev server logs through it and query them directly via MCP.
It manages log storage and search so it works across multiple services, previous dev sessions, and different branches.
npx @struct-ai/logbox collectAdd it to your dev scripts:
{
"scripts": {
"dev": "npm run dev 2>&1 | npx @struct-ai/logbox collect"
}
}Logs pass through to your terminal as normal, but are also saved to ~/.logbox/logs.db.
Claude Code:
claude mcp add logbox -- npx @struct-ai/logbox serveCursor:
Add to your MCP config:
{
"mcpServers": {
"logbox": {
"command": "npx",
"args": ["@struct-ai/logbox", "serve"]
}
}
}❯ The test request failed, check the logs.
No install required — npx @struct-ai/logbox works out of the box.
Or, install globally:
npm install -g @struct-ai/logboxOr with cargo:
cargo install logboxAnd then invoke with logbox:
logbox collect# Pipe dev server output (logs pass through to terminal)
npm run dev 2>&1 | logbox collect
# Silent mode (store only, no terminal output)
npm run dev 2>&1 | logbox collect --quietView recent log lines, newest first:
logbox logs
logbox logs --since 1h
logbox logs --since 2h --until 1h
logbox logs --session <session-id> --limit 100
logbox logs --offset 50 # paginateFind log lines matching a keyword (case-insensitive):
logbox search "error"
logbox search "connection refused" --last 1h
logbox search "404" --branch mainTip: Use search to find a specific event, then logs --since/--until around that timestamp to see surrounding context.
Each logbox collect invocation creates a session tagged with git repo, branch, and commit SHA:
logbox sessions
logbox sessions --branch feature/auth --since 2d
logbox sessions --commit e30d239logbox stats # latest session
logbox stats <session-id>logbox serve # start MCP server on stdioTools:
- list_logs — browse consecutive log lines in a time range, or from the end
- search_logs — find lines matching a keyword
- list_sessions — list recorded dev server runs
- session_stats — get summary stats for a session
- Logs are stored in
~/.logbox/logs.db(SQLite with WAL mode) - Each
logbox collectcreates a session tagged with git repo, branch, and commit SHA - The collector batches writes (every 100 lines or 500ms) for efficiency
- All query commands support
--jsonfor structured output
See CONTRIBUTING.md for development setup, testing, and PR guidelines.
MIT