Skip to content

MCP (Model Context Protocol)

Daemonitor includes a local, read-only Model Context Protocol (MCP) server inside the Desktop application binary (src/.../mcp/), providing an interface for querying locally collected process measurements, JVM and OS telemetry, and retained history without terminating processes or modifying state.

Supported transports

1. Stdio transport (--mcp)

Launch the Daemonitor binary with --mcp:

/Applications/Daemonitor.app/Contents/MacOS/Daemonitor --mcp
  • Speaks JSON-RPC 2.0 over stdin/stdout (accepts both Content-Length: N\r\n\r\n LSP-style framing and single-line JSON; writes Content-Length framed UTF-8 responses).
  • Supported JSON-RPC methods: initialize (default protocol version 2026-07-28), notifications/initialized, server/discover, tools/list, tools/call, and ping.

Example MCP client configuration (stdio):

{
  "mcpServers": {
    "daemonitor": {
      "command": "/Applications/Daemonitor.app/Contents/MacOS/Daemonitor",
      "args": ["--mcp"]
    }
  }
}

2. Optional local HTTP transport

Disabled by default (mcpEnabled = false). Enable it in Desktop → Settings → Enable MCP:

  • Binds strictly to 127.0.0.1 on mcpPort (default 17333): http://127.0.0.1:17333/mcp.
  • Accepts POST only (GET and other methods return 405; SSE streams are not supported).
  • Requires authentication via either:
  • Authorization: Bearer <token>
  • X-Daemonitor-MCP-Token: <token>
  • Copy both the endpoint URL and the auto-generated 32-byte Base64URL token directly from Settings.

Registered MCP tools

All registered tools carry readOnlyHint: true, destructiveHint: false, and additionalProperties: false (DaemonitorMcpServer.kt).

daemonitor_current_processes

Return currently visible build processes with defense-in-depth redacted command lines and build_system, runtime, and toolchain classification fields.

Parameter Type Required Allowed values Description
build_system string No gradle, bazel, xcode, amper, unknown Filter live processes by build system
runtime string No jvm, native, unknown Filter live processes by runtime
toolchain string No java, kotlin, swift, clang, cpp, go, rust, unknown Filter live processes by toolchain

Invalid filter values return JSON-RPC error -32602.

  • Returns: JSON { "processes": [...] }.

daemonitor_builds_for_process

Find retained builds executed by a daemon PID or matching process text.

Parameter Type Required Constraints Description
process string Yes — Numeric PID, daemon identity, project path, working directory, or command-line substring
limit integer No 1..200 (default 50) Maximum matched builds and process samples
include_metrics boolean No Requires limit <= 20 Attach persisted bazelDetails BEP telemetry on Bazel builds
  • Behavior: If process parses as a numeric PID, queries builds.findByDaemon(pid, limit) and samples.findByPid(pid, limit). Otherwise searches builds and scans the 200 most recent process samples for case-insensitive substring matches.
  • Returns: JSON { "process": "...", "matchedBuilds": [...], "matchedProcessSamples": [...] }.

daemonitor_search_history

Search retained build history by build ID, command, project, status, source, or coding agent.

Parameter Type Required Constraints Description
query string No Empty returns most recent builds Free-text search query
limit integer No 1..200 (default 50) Maximum builds returned
include_metrics boolean No Requires limit <= 20 Attach persisted bazelDetails BEP telemetry on Bazel builds
  • Returns: JSON { "query": "...", "builds": [...] }.

Security and privacy

  • Read-only: No process termination or mutation tools are exposed.
  • Localhost only: HTTP binds exclusively to 127.0.0.1.
  • Origin validation: If an Origin header is present on HTTP requests, only localhost, 127.0.0.1, ::1, or [::1] is allowed (otherwise 403 Forbidden).
  • Token auth: Requests without a valid per-install 32-byte random token receive 401 Unauthorized.
  • Redaction: daemonitor_current_processes applies Redactor.redactCommandLine before serializing process arguments.