Feature Request: REST API / MCP server for programmatic log access (AI agent integration) #4604
Replies: 8 comments 14 replies
|
Thanks for converting this to a discussion. For now, we solved it this way — sharing the approach in case it helps others, and to flag a few things that would Our use case We wanted an AI coding assistant to read our production container logs directly so it can investigate issues without Our approach A small zero-dependency Node.js CLI wrapping the Dozzle HTTP API, exposing two commands: dozzle-cli containers [--server=ProjectA|ProjectB] Auth is cached in-memory, container lookup supports partial name matching across servers, and filtering is done API endpoints we use Gotchas we hit A few things cost us real time and might save others some pain:
What would make this much easier natively
Items 2 and 5 especially would make building tooling on top of Dozzle dramatically smoother. |
|
Hey, thanks for writing this up — and honestly, great minds think alike. This is basically the problem I spent a chunk of the last few months building against, so let me share what I learned, because I think it's useful context. My first instinct was exactly yours: expose Dozzle through MCP so Claude Code / Cursor / Copilot could hit it directly. I actually tried it. The problem isn't the MCP protocol itself, it's the surrounding ecosystem:
So you end up in a place where "Dozzle has an MCP server" is technically true but the config surface to actually use it across tools is huge and brittle. I didn't want every Dozzle user to have to become an MCP sysadmin. That's when I pivoted and started building Dozzle Cloud (https://cloud.dozzle.dev). The idea is: your self-hosted Dozzle instances connect out to the cloud over gRPC (so no inbound ports, no cert gymnastics, works behind NAT), and the cloud side runs an AI agent that can query all your instances. You can ask things like:
…and it'll actually go look at your live logs and answer. There's also Telegram/Discord integration so you can do it from your phone, plus email digests and alerts on top. The cloud route also dodges the single-tool-lock-in problem: instead of having to configure MCP in every AI client you use, you just talk to the agent from wherever (web UI, Telegram, Discord), and it has the full tool set. A remote-log-viewer UI (stream logs from local Dozzle via the cloud, exactly like the local UI but accessible anywhere) is also landing very soon — that's the piece that closes the loop for folks who want the "I'm debugging on my laptop, show me prod logs" workflow without leaving their tool of choice. Not trying to hijack the issue — a native MCP server in self-hosted Dozzle is still a reasonable ask and I'm not ruling it out. I just wanted to share why I went the direction I did, because I hit every wall you're about to hit if you try to wire this up yourself. If you want to try the cloud version, I'd genuinely love your feedback. Feedback very welcome — and if you want to try Cloud Pro for a month on me in exchange for honest thoughts, just say the word and I'll hook you up. Or ping me at findamir@gmail.com if you'd rather take it off-thread. |
|
Thanks for the extra context, that actually helps. Good to know the REST API is UI-coupled and not really meant as a stable external contract. That reframes things. We'll treat what's there as "works today, may change tomorrow" and keep our CLI thin rather than building anything deeper on it. On the use case since you asked: we use Claude Code, the AI coding assistant, to debug production issues, and wanted it to read container logs from our Dozzle instances without us copy-pasting into the chat. The ad-hoc flow is "check the last hour of logs on service X and tell me what you see". Claude calls our CLI wrapper, gets the output, and points at actual errors. Works well already, the only friction is that we download the full log history every time because filtering is client-side. Livable. The direction we want to push this next is proactive monitoring. Run Claude on a schedule, say every 30 minutes, have it scan logs across all our services, flag anything unusual, and either suggest fixes or open issues before a human notices something is broken. Basically an on-call engineer that reads every log line and knows the codebase well enough to catch things early. Not there yet but that's where we're heading. We'll take a look at Cloud when things calm down here. Thanks for the back-and-forth on this. |
|
Quick correction on my earlier posts. I want to leave this thread with something actually useful for the next person doing the same thing, instead of a complaint that turned out to be wrong. I was wrong about the API being missing features. The I missed it because I hit two silent traps stacked on top of each other, and together they make the endpoint look broken when it isn't. Writing them up so nobody else loses a day to this. Trap 1:
|
|
Strong +1 on MCP/REST log access for agent debugging. Adjacent problem we hit: once the agent has logs, it still needs a safe shell to act on them. We built WinkTerm as a self-hosted AI terminal where AI and user share the same PTY — agent pre-fills commands, you press Enter. https://github.com/Cznorth/winkterm Could pair nicely with Dozzle: agent reads logs via API, investigates/fixes in a shared terminal session with human approval. |
|
I am very glad we have MCP setup on this project, and thanks to everyone involved. I spend some time today figuring out how to connect the MCP with my n8n workflows. I found this documentation to be a little inadequate. After going through the implementation PR and manually checking about what happens when simple auth logs in the user, I ended up creating a small cURL script. Just dropping it here for anyone in future trying to connect the MCP with an simple auth Dozzle instance. Run the following in terminal after replacing DOZZLE_IP_ADDRESS, DOZZLE_USERNAME and DOZZLE_PASSWORD, it will output the JWT for your use. curl -c - --request POST \
--url DOZZLE_IP_ADDRESS/api/token \
--header 'content-type: multipart/form-data' \
--form username=DOZZLE_USERNAME \
--form password=DOZZLE_PASSWORDAlso I feel this should be a part of the UI itself, maybe it can live somewhere in settings 🤔 ? |
Uh oh!
There was an error while loading. Please reload this page.
Describe the feature you would like to see
Documented, authenticated API endpoints that allow programmatic access to container logs — either as a REST API or as an MCP Model Context Protocol) server.
The primary use case is enabling AI coding agents (Claude Code, Cursor, GitHub Copilot, etc.) to read production logs during debugging sessions without the developer having to manually copy-paste from the web UI.
Example workflow:
Developer: "The upload endpoint returns 500 in production. Check app-backend logs."
AI Agent: [calls Dozzle API → get_logs("app-backend", last 5 min, search="upload")]
AI Agent: "I see the error — the file path resolution fails because..."
Currently, debugging production issues with AI assistants requires switching to the Dozzle web UI, copying log output, and pasting it into the conversation. This breaks flow significantly when iterating on fixes.
Describe how you would like to see this feature implemented
Option A — REST API endpoints:
GET /api/v1/containers → list containers
GET /api/v1/containers/{id}/logs?since=&until=&limit=&search= → fetch logs
GET /api/v1/containers/{id}/logs/stream → SSE stream (real-time)
Reusing existing authentication (basic auth / forward proxy).
Option B — MCP (Model Context Protocol) server:
https://modelcontextprotocol.io/ is becoming the standard for connecting AI assistants to external tools. An MCP server could expose:
This would allow any MCP-compatible AI tool to directly query production logs. Dozzle would be one of the first DevOps tools with native MCP support.
Dozzle already has internal API endpoints (/api/logs?id=, /api/events/stream) used by its web UI, so much of the plumbing already exists.
Describe any alternatives you've considered
All reactions