Ask Mugi: request flow
Ask AI, labelled Ask Mugi in the web UI, lets a user question and operate Mugnsoft in plain language. This page follows one request from the browser to the final answer.
Three ways in
All three use the same MCP tools. They differ in where the MCP server runs and who calls the LLM.
| Entry point | User | MCP server runs | LLM called by | Changes |
|---|---|---|---|---|
| Ask Mugi panel (web UI) | Signed in and allowed | Inside the webserver process | The webserver | Confirmed in the panel, unless an admin skips confirmations |
Guest chat (/chat) |
Anonymous, off by default | Inside the webserver process | The webserver | None: read-only |
| External agent (Claude Code, Codex, Mistral Vibe) | Agent account | Separate mugnsoft-mcp program |
The agent | Approved in the agent |
For ports and firewall rules, see Ask Mugi: network flows and firewall rules.
Dependencies
| Dependency | Needed for | Mandatory |
|---|---|---|
| ADMIN webserver | The whole feature. Webserver-Front answers 404 on these routes | Yes |
| LLM provider: Anthropic, or an OpenAI-compatible server with tool calling and streaming | Answers and tool calls | Yes |
| Provider API key | Anthropic: always. OpenAI-compatible: only if the server asks for one | Depends on the provider |
| Embedded key-value store | Settings, users, application health | Yes (built in) |
| Probes | Monitor tools: list, read, test, change, run | For monitor questions |
| Integrators | Open events in a monitor’s incident history | No |
| Sentinel Agents reporting to the webserver | Process and system metrics tools | No |
Tools that run without confirmation
mugnsoft_test_monitor and mugnsoft_test_device are classed as read-only: they save nothing, so they run without confirmation. They still make a probe connect to the address given in the request. For test_monitor, this also applies to read-only users who have tags.
LLM provider APIs
An admin chooses the provider in the panel’s settings.
| Anthropic (default) | OpenAI-compatible | |
|---|---|---|
| Address | https://api.anthropic.com |
The base URL you enter, http or https |
| Check when saving | GET /v1/models/{model} |
GET {base}/models (a 404 or 405 is accepted) |
| Model call | POST /v1/messages, Beta Messages API, streamed |
POST {base}/chat/completions, "stream": true |
| Authentication | API key, sent by the official Go SDK | Authorization: Bearer <key>, omitted without a key |
| Models | claude-opus-5-5 (default), claude-sonnet-5-5 |
Any name the server accepts |
| Effort setting | low, medium (default), high |
Not sent |
Examples of base URLs: https://api.openai.com/v1, https://generativelanguage.googleapis.com/v1beta/openai, https://api.mistral.ai/v1, http://localhost:11434/v1 (Ollama on the webserver host).
For an OpenAI-compatible server, the webserver refuses loopback and private addresses unless the host is listed in AIInternalHosts, refuses link-local and cloud metadata addresses, and does not follow redirects. See Local LLM.
The Anthropic SDK honours the ANTHROPIC_BASE_URL environment variable: if it is set for the webserver service, the calls go to that address instead.
The key is stored encrypted in the embedded key-value store. A saved key is dropped when the provider or base URL changes, so it is never sent to another address.
What leaves the webserver
The provider receives the user’s messages, the system prompt, the tool definitions and the results of the tools: probe names, monitor names, targets, settings, check results, reports and downtimes with their recipients and, for admins who ask, devices, component settings, user accounts without passwords and the names of saved credential sets (with the SNMP version or the WMI user name). Temporary passwords are shown through a link and are not given to the model. With a local LLM this data stays on your network.
Authentication and authorization
| Leg | Credential |
|---|---|
Browser to /ai/* |
Session token: RS256 JWT in the jwt cookie (HttpOnly, SameSite=Lax, Secure in HTTPS), or Authorization: Bearer. It lasts 15 minutes and is renewable for 12 hours |
Browser to /chat/* |
None. The routes read no session |
| Webserver to LLM | The provider API key, if any |
| MCP client to MCP server | None: both are in the same process |
| Tools to API router | The user’s session token, or a tag-scoped agent token (below) |
| Webserver to probes and integrators | The component’s token (Authorization: Bearer). Its certificate is verified only with "VerifyComponentTLS": "true". A probe’s /api/metrics, read by the diagnosis, takes no token |
Signing in, with a local account or SSO, happens before any of this.
Authorization
An admin enables Use Ask Mugi and Write access per account in user management. The right is read from the account on every request.
| Account | Ask Mugi | Token used by the tools | Can change monitors |
|---|---|---|---|
admin |
Always | Own session | Yes, including the admin tools. Confirmation can be skipped |
user with tags and Write access |
If enabled | Tag-scoped agent token for monitor, probe and Sentinel routes. Own token elsewhere |
Monitors within the tags, and reports and downtimes within its rights, with confirmation |
user or viewer with tags |
If enabled | Same | No |
user or viewer without tags |
If enabled | Own session | No. Monitor list, definition and test tools are refused by the API. Health, timeline and troubleshooting reads stay within the account’s scope |
agent |
Never | Not applicable | Use an external agent |
If write access or admin status changes during a conversation, the next request answers 409 and a new conversation is needed.
Audit
log/api_audit.log marks calls made by the tools with "via":"ai-panel" or "via":"guest-chat". It records every change, every run, and every request made with an agent token, reads included. An admin’s plain reads are not recorded. On a panel change, "confirm" is "user" (confirmed) or "auto" (run without confirmation) and "tool" names the tool. webserver.log records each confirm, decline and unconfirmed run.
Guest chat
The guest chat is off until an admin enables it with at least one tag, at least one tool and a configured provider.
Three independent checks keep it read-only: the tool list given to the model, the in-memory transport (allowed GET routes only) and the API router. The offered tools are chosen among: list_apps, app_health, app_timeline, app_history, list_monitors, monitor_timeline, list_probes, list_sentinel_agents, sentinel_metrics, web_vitals, check_baseline and monitor_incidents. The first six are offered by default.
The webserver keeps no guest conversation. With Anthropic it uses low effort and at most 4,096 tokens per model call.
External agent
With Claude Code, Codex, Mistral Vibe or another MCP client, the webserver never contacts the LLM.
| Leg | Protocol and authentication |
|---|---|
Agent to mugnsoft-mcp (stdio, default) |
Child process, standard input and output. No port |
Agent to mugnsoft-mcp (shared server) |
MCP streamable HTTP on /mcp, default 127.0.0.1:8765. Bearer token per person. TLS 1.2 or later is required off loopback |
mugnsoft-mcp to webserver |
PortAPI (default 8050). POST /api/auth, then Authorization: Bearer. The token is renewed automatically. Five failed logins lock the address for 5 minutes |
The report, downtime, device, user, alerting, component and Sentinel settings tools exist only in the Ask Mugi panel. Confirmation is the agent’s job in this mode: see step 5 of the tutorial. The tool list differs with the server options.
Limits and state
| Limit | Panel | Guest chat |
|---|---|---|
| Message length | 20,000 characters | 2,000 characters |
| Model calls per request | 25 | 8 |
| One tool result | 60 KB | 60 KB |
| Tool results kept | 400 KB per conversation | 120 KB per message |
| Conversations | 10 per user, dropped after 2 h idle | Held by the browser: 20 earlier messages, 24,000 characters replayed |
| Changes | 50 per conversation | None |
| Waiting confirmation | Expires after 10 minutes | Not applicable |
| Rate | No dedicated limit | 20 per hour per address, 300 per day, 3 answers at once, 1 per address. Adjustable except the last |
Panel conversations live in memory only. A webserver restart, a cluster failover or a change of provider settings ends them.
Troubleshooting
| Symptom | Where it fails | Check |
|---|---|---|
| No Ask Mugi button | Access | Use Ask Mugi on the account, GET /ai/status |
| “not set up yet” (409) | Settings | An admin must configure the provider |
| “The AI service (host) failed” | Webserver to LLM | Key, model, base URL, network flows, webserver.log |
| “the AI server’s address … is an internal address: refused” | Outbound policy | Add the host to AIInternalHosts and restart |
| “no answer in time” when saving | Webserver to LLM | Firewall, DNS, HTTPS_PROXY |
| A tool line is red | API or component | Its message, log/api_audit.log, probe connectivity |
| “this conversation has ended” (404) | State | Idle expiry, restart or failover: start a new one |
See also
- Ask Mugi: network flows and firewall rules — ports, directions, cloud and local LLM
- Confirmations — how changes are approved and traced
- Claude Code, Codex and Mistral Vibe — set up an external agent
- User management — accounts, tags and Ask Mugi rights
- Security model — platform authentication and encryption