qnx-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| QNX_MCP_SDP_ENV | No | The SDP environment script. | ~/qnx800/qnxsdp-env.sh |
| QNX_MCP_SSH_KEY | No | Key installed into images by `target_create`. | ~/.ssh/id_ed25519 |
| QNX_MCP_STATE_DIR | No | Locks, pinned host keys, run records, binary snapshots, cores (mode 0700). | ~/.qnx-mcp/state |
| QNX_MCP_WORKSPACE | No | Colon-separated host directories; when set, every host path argument must resolve inside them. Default: not set. | |
| QNX_MCP_DHCP_LEASES | No | Lease file used to find target addresses. | /var/lib/libvirt/dnsmasq/virbr0.status |
| QNX_MCP_TARGETS_DIR | No | One mkqnximage directory per target. | ~/.qnx-mcp/targets |
| QNX_MCP_ALLOW_TARGETS | No | Comma-separated globs of target names this server may touch, e.g. `dev*`; `*` must be explicit. Default: none (refuses every target). | |
| QNX_MCP_TRUST_FIRST_USE | No | Set to `1` to accept targets without pre-generated host keys by pinning the first key seen (weaker). Default: not set. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
qnx-mcp gives you structured, bounded access to QNX OS 8.0 targets (QEMU virtual machines built with mkqnximage, reachable over SSH) and to the QNX SDP 8.0 toolchain on the build host.
Typical loop:
target_list -> target_start (or target_create for a new VM) -> target_status.
build (qcc/make/cmake) -> read diagnostics[] (file, line, column, severity, message), fix, rebuild.
deploy_and_run with args and a timeout -> outcome is exited | crashed | killed | timeout | stopped | exec_failed.
outcome == crashed -> get_crash(run_id) -> source-level backtrace of every thread, with locals and source lines.
Services and long programs: run_start -> run_poll (pass back stdout_next/stderr_next) -> run_stop.
processes (pidin as JSON) and logs (slog2info, filtered) inspect the system, also while a run is active.
file_put / file_get move fixtures and results (sizes and SHA-256 are verified); file_list lists a target directory.
Programs already installed on the target: deploy_and_run / run_start with remote_binary and no binary; process_stop ends a process qnx-mcp did not start (only executables below /tmp or /data, never system processes). Every tool returns JSON with ok=true, or ok=false plus error {code, message, hint}; follow the hint. Paths in build/deploy/get_crash/file_* arguments marked "host" are paths on the build host. Never assume a target is yours unless target_list shows it; the server refuses names outside its allowlist.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| target_listA | List the QEMU QNX targets this server may manage (directories under the targets dir that match the allowlist), with state running/stopped from the QEMU pid. Cheap, no SSH. Call first to discover target names. |
| target_createA | Build a new QNX OS 8.0 QEMU image with mkqnximage in its own directory and boot it headless (KVM when available), then wait until root SSH works. Takes 20 s to 3 minutes. Fails with target_exists if the name is taken; a failed build or boot is cleaned up (QEMU stopped, directory removed, mkqnximage log kept). The SSH host keys mkqnximage generates are pinned. Extra mkqnximage options are restricted to: --aslr, --boot-size, --data-inodes, --data-size, --hostname, --perl, --python, --secpol, --secure-procfs, --sys-inodes, --sys-size, --time-servers, --tz, --valgrind (form --opt=value). The image runs dumper with sequential core names (unless --secpol is set), so crashing programs leave distinct core files. |
| target_startA | Boot an existing target (no rebuild) and wait until root SSH answers with the target's pinned host key. Idempotent: if it is already running it only waits for SSH. |
| target_stopA | Power off the target's QEMU (mkqnximage --stop, then SIGTERM/SIGKILL through a pidfd of the verified QEMU process). Waits for runs in progress (they hold a shared lock). Background runs are lost; files on the target disk persist. |
| target_destroyA | Stop and permanently delete a target this server manages: its mkqnximage directory under the targets dir and its server state. Refuses names outside the allowlist, symlinks and anything that is not an mkqnximage directory directly inside the targets dir. confirm must repeat the target name. |
| target_statusA | State of one target: running/stopped/booting, IP, arch, RAM, CPUs, host key policy and, when running, an SSH probe with uname, the target clock, whether dumper is running and with which core naming. Use it before deploy_and_run and after target_down or ssh_failed errors. |
| buildA | Compile on the build host with the QNX SDP 8.0 toolchain. system=auto picks cmake (CMakeLists.txt), make (Makefile) or qcc (plain sources). make and cmake run the project's own build files, which can execute any command: only build trees you trust. qcc mode builds the given sources (default: every .c/.cpp in path) with -g -O0 -Wall unless cflags is set. Returns diagnostics[] with file, line, column, severity, message (gcc JSON diagnostics in qcc mode, parsed text for make/cmake), linker errors, and artifacts[] with path, arch, build_id and debug_info for deploy_and_run. ok=false with error.code build_failed when compilation fails. |
| deploy_and_runA | Snapshot a host-built QNX executable, copy it to the target (content-addressed under /tmp/qnx-mcp/apps, SHA-256 verified on the target) and run it once via the qnx-mcp-run helper: own process group, stdin /dev/null, stdout and stderr captured separately (capped, truncation reported), wall-clock timeout; when the program ends the rest of its process group is killed too. Returns outcome (exited | crashed | killed | timeout | stopped | exec_failed), exit_code or signal_name, and for crashes the exact core_path obtained from dumper (DCMD_DUMPER_NOTIFYEVENT pulse, then DCMD_DUMPER_GETPATH), moved into the run's own directory. Checks the ELF arch and loader first. Arguments are an array, never interpreted by a shell. For long-running programs use run_start. To run a program that is already installed on the target, pass remote_binary (a target path) and no binary: an executable regular file below /tmp or /data (QNX_MCP_REMOTE_BINARY_ROOTS) and outside /tmp/qnx-mcp, never a shell or anything in /proc/boot, /bin, /sbin, /usr or /system (checked by real path on the target). get_crash then needs binary= to symbolise a crash. |
| run_startA | Like deploy_and_run, but the program runs in the background (its own session on the target) so the call returns at once. Output goes to files on the target (capped per stream); read it with run_poll using offsets, end it with run_stop. timeout_s is a hard limit on its lifetime. processes and logs keep working while it runs. Crashes leave a core for get_crash(run_id). remote_binary (a target path, with no binary) starts a program that is installed on the target, for example to restart a service (same rules as deploy_and_run: below /tmp or /data, never a shell or a system program). |
| run_pollA | Read new output of a run_start run from byte offsets (pass back stdout_next and stderr_next) and its state: running, finished (with outcome and the final result) or lost (target rebooted). wait_s waits up to that long for new output or the end. Only runs started by this server are accessible. |
| run_stopA | Stop a run_start run: the request goes through the run's control FIFO to the runner that owns it, which kills the program's process group and writes the final status. acknowledged=false means it did not finish within grace_s (its deadline still applies). |
| get_crashA | Fetch the core file of a crashed run (size and SHA-256 verified), check that it belongs to the exact binary that was deployed (GNU build ID or the content-addressed path in the core's notes; error core_mismatch otherwise), open it with the SDP's gdb in MI mode and return a structured backtrace: faulting_frame (where the signal happened) and user_frame (innermost frame in your sources), frames with function, file, line, address, library, locals and source lines, every thread's stack, signal, si_code, fault address (0x0 = NULL dereference), the faulting instruction and a one-line summary. Default: the newest crashed run on the target; or pass run_id, or core_path plus binary for any other core. For a run of a program that was already on the target (remote_binary), pass run_id plus binary, the host path of its unstripped build (accepted when its build ID matches the core's, or when it is the same file). |
| file_putA | Copy one host file to the target (below /tmp or /data, never into qnx-mcp's own directory) through a temporary name, verify size, mode and SHA-256 on the target, then install it atomically. Destinations that are directories or symlinks, and parent directories that are symlinks, are refused. Never replaces an existing file unless overwrite=true. |
| file_getA | Copy one regular file from the target to the build host, verifying size and SHA-256. Without local_path it lands in the server's state directory (path returned); with local_path it never follows or replaces a symlink and replaces a file only with overwrite=true. UTF-8 files up to 64 KiB are also returned inline as text. |
| file_listA | List one directory on the target, read-only: name, type (file, dir, symlink, char, block, fifo, socket, other), size, mode, mtime and, for symlinks, where they point (links are described, never followed; the directory itself may be reached through a link, real_path says where it is). Entries are sorted by name; at most max_entries are returned, total_entries counts all of them and truncated says whether some were left out. path must be absolute and normalised (no '.', '..', '//' or trailing '/'); '/' lists the root. |
| process_stopA | Stop a process that qnx-mcp did not start (for runs use run_stop), for example a hung program or a service you want to restart. Allowed only when its executable lives below /tmp or /data, checked on the target at call time: the executable in /proc//exefile (which also covers services started with a relative path such as ./statusd) and the same path with symlinks resolved. The process is identified by pid and start time; the start time, critical flag and executable are checked again right before each signal, and nothing is sent if they changed. Never pid 1, procnto, a critical process, qnx-mcp's runner, or anything in /proc/boot, /bin, /sbin, /usr or /system; refusals are process_not_allowed errors that name the rule. Sends signal (default TERM), waits up to grace_s for the process to exit and, with kill_after_grace, then sends SIGKILL. The result says what was stopped and whether it exited. |
| processesA | Run pidin with fixed -F format strings and return processes as JSON: pid, ppid, uid, name, path, args, code/data size, thread count and thread states (READY, RECEIVE, REPLY, SEND, MUTEX, ...). include_threads adds per-thread priority, policy, state and what it is blocked on. |
| logsA | Read the system log (slog2info -f -s -t) and filter it: buffer (buffer or buffer-set name), process (name substring or pid), since_s (relative to the target clock), min_severity (keep this level and more severe), contains (substring). Returns the newest |
| environment_checkA | Prerequisite checks with fixes: QNX SDP environment, qcc, mkqnximage, gdb, KVM access, QEMU, ssh/scp, SSH key, DHCP lease file, target allowlist, targets directory, workspace confinement. Run it first on a new machine. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 19 tools
The three 'stop' tools (target_stop, run_stop, process_stop) and the two run tools (deploy_and_run vs run_start) could easily blur, but each description explicitly draws the boundary and cross-references the correct alternative. deploy_and_run vs run_start, target_status vs target_list, and processes vs process_stop are all cleanly differentiated. Every tool targets a distinct resource+action.
The dominant convention is resource_action (target_*, run_*, file_*, process_stop, environment_check), applied consistently across 14 tools. A few outliers break pattern: get_crash reverses to verb_noun, and build/processes/logs are bare names. The deviations are still readable and unambiguous, so it's mostly consistent with minor exceptions.
19 tools is slightly above the ideal range, but the domain (target lifecycle, build, sync/async run, crash analysis, file transfer, process control, logs, environment) genuinely needs this breadth. Each tool has a clear, non-redundant role, so the count is justified rather than padded.
Coverage is strong: full target lifecycle (list/create/start/stop/destroy/status), build, deploy/run, async run control, crash post-mortem, bidirectional file transfer with listing, process inspection/stopping, logs, and environment checks. Minor gaps remain—no file delete or directory-create operation on the target, and no arbitrary exec/shell tool—which are either deliberate safety choices or small workaround-able omissions.