QNX Host MCP
# QNX Host MCP
An embedded developer asking an AI assistant for QNX code needs to know whether it compiles for QNX and runs on a QNX target. This server returns the compiler result and the compiled artifact's SHA-256. When the operator enables execution, it also returns the guest program's exit status and console output from QEMU.
MCP server over stdio for inspecting a configured QNX compiler and compiling workspace C sources with fixed arguments. Operations return an ID for status polling and cancellation.
Real compilation and execution of the unchanged artifact inside QNX 8.0.0 x86_64 in QEMU 8.2.2 were completed on the project host. [Guest execution evidence](evidence/qemu-run-20261103/README.md) records the expected message and exit status 0.
A second example, [native QNX message passing](examples/msgpass/README.md), uses `ChannelCreate`, `ConnectAttach`, `MsgSend`, `MsgReceive` and `MsgReply` between two threads. It was compiled through MCP with `node scripts/compile-example.mjs examples/msgpass src/msgpass.c` and run on QNX 8.0 in QEMU with the expected output and exit status 0 ([evidence](evidence/qemu-run-msgpass-20261104/README.md)).
A third example, a [QNX resource manager](examples/resmgr/README.md), registers `/dev/automata-echo` with `resmgr_attach` and a custom `io_read` handler, and the same process reads it back through `open` and `read`. It was compiled through MCP with `node scripts/compile-example.mjs examples/resmgr src/resmgr.c` and run on QNX 8.0 in QEMU with the expected output and exit status 0 ([evidence](evidence/qemu-run-resmgr-20261106/README.md)).
A fourth example, [native QNX pulses and timers](examples/pulses/README.md), arms a `CLOCK_MONOTONIC` timer whose event is a pulse (`SIGEV_PULSE_INIT`) on the process's own channel and receives five pulses with `MsgReceivePulse`. It was compiled through MCP with `node scripts/compile-example.mjs examples/pulses src/pulses.c` and run on QNX 8.0 in QEMU with the expected output and exit status 0 ([evidence](evidence/qemu-run-pulses-20261106/README.md)).
A fifth example, [native QNX registered events](examples/events/README.md), shows the "reply now, notify later" pattern: a client registers a pulse event with `MsgRegisterEvent`, the server replies at once, checks it with `MsgVerifyEvent` and later delivers it with `MsgDeliverEvent`. It was compiled through MCP with `node scripts/compile-example.mjs examples/events src/events.c` and run on QNX 8.0 in QEMU with the expected output and exit status 0 ([evidence](evidence/qemu-run-events-20261106/README.md)).
A sixth example, [native QNX message priority inheritance](examples/prioinherit/README.md), shows that a server thread receiving a message runs at the priority of the sending client, and that a channel created with `_NTO_CHF_FIXED_PRIORITY` keeps the server at its own priority. It was compiled through MCP with `node scripts/compile-example.mjs examples/prioinherit src/prioinherit.c` and run on QNX 8.0 in QEMU with the expected output and exit status 0 ([evidence](evidence/qemu-run-prio-20261108/README.md)).
A seventh example, [a client in another process that finds the server by name](examples/nameservice/README.md), registers a server with `name_attach` and has a forked child open it with `name_open` and exchange three messages; the server checks that each request comes from another process. It was compiled through MCP with `node scripts/compile-example.mjs examples/nameservice src/nameservice.c` and run on QNX 8.0 in QEMU with the expected output and exit status 0 ([evidence](evidence/qemu-run-name-20261109/README.md)).
## How it differs
Other public QNX MCP servers connect to a target that is already running: over SSH to deploy and run a binary, over qconn for introspection and debugging, or over SSH/SFTP for read-only diagnostics. QNX Host MCP needs no login or network access to the guest. It compiles with the configured QNX SDK through fixed MCP tools and, when the operator enables `qnx_run_artifact` (disabled by default), builds a private image for each run, boots it in QEMU without networking and returns the captured console output and the guest program's exit status. QNX's own tools (Momentics IDE, the QNX Toolkit for VS Code and `qcc`) remain the place for interactive development and debugging.
## Start here
QNX Host MCP is a stdio MCP server for inspecting a configured QNX compiler and compiling workspace C sources with fixed arguments, and, when the operator enables it, running a compiled artifact in QEMU with no network adapter.
| Resource | What it shows | Evidence |
| --- | --- | --- |
| [Demo video](https://youtu.be/HCGnTK6H6iI) | An AI client compiles and runs QNX programs through MCP with `qnx_run_artifact`, plus all seven examples checked with `tutorial/check-run.sh` (2:11) | [Run output](evidence/run-artifact-20261109/run-output.txt) · [Verification log](tutorial/verification-all-2026-11-09.txt) |
| [Compile and run through MCP](evidence/run-artifact-20261109/README.md) | `qnx_compile_c`, then `qnx_run_artifact`: an AI client compiles a C file and runs it in QEMU with no network adapter (`node scripts/run-example.mjs examples/hello src/hello.c`) | [Run output](evidence/run-artifact-20261109/run-output.txt) |
| [Tutorial: Part 1](tutorial/README.md) | Compile a QNX C program, build an image and run it in QEMU | [Verification log](tutorial/verification-2026-11-06.txt) |
| [Tutorial: Part 2](tutorial/part2-message-passing.md) | Native synchronous message passing | [Verification log](tutorial/verification-part2-2026-11-06.txt) |
| [Tutorial: Part 3](tutorial/part3-resource-manager.md) | A resource manager accessed with ordinary file operations | [Recorded run](evidence/qemu-run-resmgr-20261106/) |
| [Tutorial: Part 4](tutorial/part4-pulses-timers.md) | A periodic timer that delivers pulses to a channel | [Recorded run](evidence/qemu-run-pulses-20261106/) |
| [Tutorial: Part 5](tutorial/part5-registered-events.md) | A server that replies at once and notifies the client later with a registered event | [Recorded run](evidence/qemu-run-events-20261106/) |
| [Tutorial: Part 6](tutorial/part6-priority-inheritance.md) | A server thread that runs at the priority of the client it is serving | [Recorded run](evidence/qemu-run-prio-20261108/) |
| [Tutorial: Part 7](tutorial/part7-name-service.md) | A client in another process that finds the server by name (`name_attach`, `name_open`) | [Recorded run](evidence/qemu-run-name-20261109/) |
| [Tutorial: Part 8](tutorial/part8-run-through-mcp.md) | Compile and run a program through MCP with `qnx_run_artifact` | [Run output](evidence/run-artifact-20261109/run-output.txt) |
| [Hello example](examples/hello/) | QNX-target C compilation and guest execution | [Recorded run](evidence/qemu-run-20261103/) |
| [Message-passing example](examples/msgpass/) | `ChannelCreate`, `ConnectAttach`, `MsgSend`, `MsgReceive`, `MsgReply` | [Recorded run](evidence/qemu-run-msgpass-20261104/) |
| [Resource-manager example](examples/resmgr/) | `resmgr_attach`, custom `io_read`, ordinary `open` and `read` | [Recorded run](evidence/qemu-run-resmgr-20261106/) |
| [Pulses and timers example](examples/pulses/) | `SIGEV_PULSE_INIT`, `timer_create`, `timer_settime`, `MsgReceivePulse` | [Recorded run](evidence/qemu-run-pulses-20261106/) |
| [Registered events example](examples/events/) | `MsgRegisterEvent`, `MsgVerifyEvent`, `MsgDeliverEvent`, `MsgUnregisterEvent` | [Recorded run](evidence/qemu-run-events-20261106/) |
| [Priority inheritance example](examples/prioinherit/) | `SchedGet`, `sched_curpriority`, `_NTO_CHF_FIXED_PRIORITY`, `SCHED_RR` threads | [Recorded run](evidence/qemu-run-prio-20261108/) |
| [Name service example](examples/nameservice/) | `name_attach`, `name_open`, `_IO_CONNECT`, `_PULSE_CODE_DISCONNECT`, two processes | [Recorded run](evidence/qemu-run-name-20261109/) |
### Try it
1. Prepare Node.js 22 or later and the existing project dependencies; load the licensed QNX SDK environment for real compilation.
2. Follow [Configuration](#configuration): set an absolute `QNX_MCP_WORKSPACE` containing `src/hello.c`, provide a trusted compiler `PATH`, and configure the stdio MCP client.
3. From the repository root, run `npm run smoke:fake` for simulated validation or `npm run smoke` with the SDK environment loaded for real compilation and artifact verification.
4. Follow [Tutorial Part 1](tutorial/README.md) for the separate SDK image and QEMU workflow, then continue with Parts 2 to 6 above.
The compilation smoke does not execute the artifact; MCP image lifecycle tools remain blocked with `UNSAFE_CONFIGURATION`.
## Configuration
Requires Node.js 22 or later and the existing project dependencies. Configure an absolute QNX_MCP_WORKSPACE directory containing src/hello.c and a trusted PATH containing the QNX executables. The server resolves executables from absolute PATH entries and invokes them without a shell. It forwards selected host and QNX environment variables only.
Example Claude Code configuration:
```json
{
"mcpServers": {
"qnx-host": {
"command": "node",
"args": ["/absolute/path/qnx-mcp/src/server.mjs"],
"env": {
"QNX_MCP_WORKSPACE": "/absolute/path/qnx-workspace",
"PATH": "/absolute/path/to/qnx/compiler/bin:/usr/bin:/bin"
}
}
}
}
```
The project environment uses QNX SDP 8.0 on Ubuntu 24.04 under WSL2. Compiler evidence identifies GCC 12.2.0 and the QNX x86_64 target. SDK installation and licensing were not audited by this documentation update.
## Compilation smoke and evidence
Run from the repository root after loading the licensed SDK environment:
```bash
npm run smoke
```
For validation without the SDK:
```bash
npm run smoke:fake
```
The smoke uses the installed MCP Client and StdioClientTransport to launch src/server.mjs, list tools, inspect the compiler, compile examples/hello/src/hello.c and poll operation status with bounded waits. It writes report.json and report.md under evidence/<timestamp>-<unique-suffix>/. Use --evidence-root DIRECTORY to select another report destination.
Reports include compiler version and target output, operation exit codes, reconstructed compiler arguments, artifact size and SHA-256. Arguments come from the fixed executor contract, not a server-provided execution trace. The smoke independently verifies artifact size and hash. Fake mode additionally checks arguments recorded by the simulated compiler.
Fake reports identify simulated evidence and do not demonstrate QNX compatibility. Real mode uses the operator's PATH; inspect compiler output alongside environment details. The compilation smoke does not execute artifacts or call image tools.
### Retained real compilation — 2026-11-03
Evidence: [report.json](evidence/2026-11-03T20-25-05.120Z-q4xWZQ/report.json), [report.md](evidence/2026-11-03T20-25-05.120Z-q4xWZQ/report.md) and [host-facts.txt](evidence/host-facts.txt). JSON and Markdown describe one run.
| Field | Recorded value |
| --- | --- |
| Start | 2026-11-03T20:25:05.120Z |
| Finish | 2026-11-03T20:25:05.431Z |
| Result | mode=real; simulated=false; success=true |
| Compiler inspection | succeeded; exitCode=0 |
| Compiler | GCC 12.2.0 |
| Default target | 12.2.0,gcc_ntox86_64 |
| Target configuration directory | /root/qnx800/host/linux/x86_64/etc/qcc |
| Compilation | succeeded; exitCode=0 |
| Compile operation | 0279c855d511a150ba531331739c259b |
| Workspace-relative artifact | build/0279c855d511a150ba531331739c259b/program |
| Size | 9208 bytes |
| SHA-256 | e5596d9e949d480cf1c129c6dbcd98adec84661edad263e40af204991dc6e798 |
| ELF identification | x86-64; interpreter /usr/lib/ldqnx-64.so.2 |
| Execution by compilation smoke | Not performed; subsequent guest execution is recorded separately below |
The report represents the source as `/path/to/qnx-mcp/examples/hello/src/hello.c` and output as `/path/to/qnx-mcp/examples/hello/build/0279c855d511a150ba531331739c259b/program`. These are recorded project-host paths. The fixed target argument is `-Vgcc_ntox86_64`.
The report records `independentlyVerified: true` and `retained: true`. This documentation update inspected records without rehashing binaries or checking current retention. The output does not identify an additional SDK patch version. Exact compiled source-commit provenance remains unestablished. See [REAL-QNX.md](docs/REAL-QNX.md) for compiler reproduction guidance.
For the separate SDK image and QEMU reproduction procedure, see [Real QNX compilation and guest execution](docs/REAL-QNX.md). Retained evidence files preserve original host paths; adapt working copies for a new run.
## Successful QNX guest execution — 2026-11-03
Evidence: [execution README](evidence/qemu-run-20261103/README.md), [serial console](evidence/qemu-run-20261103/qemu-serial-console.txt) and [hash records](evidence/qemu-run-20261103/sha256.txt). The separate SDK/QEMU workflow ran on the project host: Ubuntu 24.04 on WSL2, kernel `6.6.87.2-microsoft-standard-WSL2`, QEMU 8.2.2 from the Ubuntu archive. It used TCG with `-cpu max`; no KVM device was available.
```text
QNX_MCP_RUN_BEGIN
QNX noname 8.0.0 2026/06/05-16:26:03EDT x86pc x86_64
Hello from QNX MCP smoke.
QNX_MCP_RUN_EXIT=0
```
The unchanged 9208-byte program has the same SHA-256 recorded by the compiler smoke. `sha256.txt` matches the original program and `automata-hello`; the recorded `output/ifs.bin` SHA-256 is `e606657ba117cbdb05ddea7385e92f5493e0b7712c82ce368fa15285be72f8fe`. The execution README reports three independent compilations with the same program hash; additional compilation reports were not inspected here.
The SDK's `mkqnximage --type=qemu --arch=x86_64 --graphics=no`, using `/root/qnx800/target/qnx`, built the image. As described in the evidence README, `ifs_files.custom` places the unchanged artifact at `/proc/boot/automata-hello`; `post_start.custom` runs it during startup and prints its exit status. No login was performed. The retained `run-qemu.sh` is described as waiting for the marker and stopping QEMU with SIGTERM. This update did not run these files.
The guest had no network interface. Its unedited console reports `no valid interfaces found` and an sshd startup failure, `Memory fault (core dumped)`, before the successful program output. Networking and SSH operation were not validated. The SDK image tools placed the artifact; the MCP server did not transfer it. All four MCP image lifecycle tools remain blocked with UNSAFE_CONFIGURATION.
## MCP tools
- qnx_toolchain_info: fixed qcc --version and qcc -V commands; 30-second deadline.
- qnx_compile_c: accepts src/name.c, compiles for QNX x86_64 and checks build/<operationId>/program; 120-second deadline. Returns artifact path, size and SHA-256.
- qnx_operation_status and qnx_operation_cancel: supervise operation IDs created by this executor. Cancellation acceptance precedes confirmed termination.
- qnx_image_build, qnx_image_start, qnx_image_ip and qnx_image_stop: remain blocked with UNSAFE_CONFIGURATION.
Output is capped at 32 KiB per stream. Excess output is drained and reported as OUTPUT_LIMIT. Process cancellation targets the operation's Linux process group and escalates after the configured grace period. Native Windows process execution remains disabled.
### qnx_run_artifact (disabled by default)
Accepts only `{ "compileOperationId": "<successful compilation operation ID>" }` from this server. Poll `qnx_operation_status` for completion or request cancellation with `qnx_operation_cancel`.
To enable it, the operator supplies an absolute `QNX_MCP_RUN_CONFIG` path to a JSON file containing exactly:
```json
{ "version": 1, "enabled": true, "templateDir": "/absolute/path/to/prepared-template" }
```
The server requires the SDK environment to be loaded beforehand. Each run copies the template without `output/`, verifies the compiled artifact, builds a private image and launches QEMU with no emulated network adapter. Guest console retention is limited to 32 KiB. Preparation, build, guest execution and cleanup have deadlines of 30, 120, 60 and 30 seconds, respectively. The result separates guest, builder and QEMU exit codes.
Absent configuration or `enabled: false` returns `UNSAFE_CONFIGURATION` without creating an operation. Regression tests use synthetic executables. On 9 November 2026 the tool also ran with the real QNX SDP 8.0 SDK and QEMU: `examples/hello` and `examples/nameservice` each exited with status 0, leaving no QEMU process or run directory ([evidence](evidence/run-artifact-20261109/README.md)). To try it: `node scripts/run-example.mjs examples/hello src/hello.c`.
## Image configuration
QNX_MCP_IMAGE_CONFIG optionally names an absolute operator-controlled JSON file containing exactly:
```json
{
"version": 1,
"enabled": false
}
```
Absent configuration defaults to disabled. Invalid configuration prevents startup. enabled=true does not activate the MCP image tools. The separate SDK/QEMU execution evidence does not change this gate.
## Internal image lifecycle
Executor.imageOperation(action, imageName) is an internal interface for direct tests; the MCP dispatcher does not invoke it. Actions are build, start, ip and stop. Names contain 1–32 lowercase ASCII letters, digits or hyphens. Image directories reside under workspace/images/<name>.
Commands use fixed arguments: --type=qemu --arch=x86_64 followed by --build, --run, --getip or --stop. Deadlines are respectively 900, 60, 20 and 30 seconds. An internal image operation starts only when no operation is active. Images must have been built by the same executor before start; IP lookup and stop require a recorded instance.
Internal startup retains a persistent launcher, reads output/qemu.pid and checks captured Linux process identities and ancestry. Socket observation uses Linux procfs unless a test observer is injected. The unsafeListeningPorts function checks owned TCP listeners against exact 127.0.0.1 and ::1. This point-in-time observation does not establish network isolation or guest readiness.
Stop checks ownership before invoking the fixed --stop command. Cleanup observes removal of the captured target and launcher and may fall back to signalling the captured launcher group after identity checks. Unconfirmed cleanup returns CANCEL_FAILED. Controlled-process tests and the separate SDK/QEMU guest run do not establish the real mkqnximage ownership and stop behavior of this internal executor.
See [Image notes](docs/IMAGE-NOTES.md), [Launcher validation](docs/LAUNCHER-VALIDATION.md) and [Demo plan](docs/DEMO.md). All four MCP image tools remain blocked pending verified host controls.
## Tests
```bash
npm test
```
Reported results on the project host comprise six consecutive complete WSL runs, each passing 60/60, and an integrated-project run passing 60/60. Their underlying suite logs were not inspected for this update. Separately, the isolated Linux candidate previously produced an observed result of 60 passed, zero failed, zero cancelled and zero skipped. With `qnx_run_artifact` and its three new test files, the suite passed 85/85 on Linux with Node 22 on 9 November 2026.
Regression tests use fake executables, controlled Linux processes and supplied socket tables. Guest execution is supported by the separate retained console evidence, rather than those regression tests. No tests were repeated for this documentation update.
The CI workflow runs on Ubuntu with Node 22 on every push. It runs `npm test`, the tutorial checker's self-test on synthetic logs (`bash tutorial/test-check-run.sh`, six cases) and the checker against the console retained from the 9 November 2026 boot (`evidence/qemu-run-name-20261109/qemu-serial-console.txt`, seven examples). That step re-reads stored evidence. A further step runs `npm run smoke:fake` with its report directory outside the repository: a real MCP client starts `src/server.mjs` over stdio, lists the nine tools, inspects the compiler and compiles `examples/hello/src/hello.c` through a FAKE compiler, and the resulting report is shown in the run summary, marked SIMULATED. CI has no QNX SDK and does not boot QNX: a green run shows the client-server conversation and the stored evidence, not a new QNX compilation or guest execution.
## Scope and limitations
Real compilation and subsequent guest execution are supported by separate retained evidence. The compilation smoke does not run artifacts. The SDK/QEMU workflow records QNX 8.0.0 x86_64, expected program output and exit status 0. It does not establish networking, SSH, MCP image lifecycle operation or host isolation. The guest had no network interface and sshd startup failed with a memory fault. No login was performed.
Canonical path checks do not provide operating-system isolation. Persisted image configuration, actual stop scope, descendant ownership and live networking require verification before enabling MCP image execution. Use trusted source files and an operator-controlled workspace.
The retained evidence was produced from a working copy of this source before publication; the exact source revision it was compiled from is not recorded in the reports. On 21 November 2026 the seven examples were rebuilt and run again from a fresh clone of this public repository at revision `f9b3260`, and the checker passed 7 of 7: see [evidence/repro-f9b3260-20261121](evidence/repro-f9b3260-20261121/README.md). That run was done once, on the same host.
## QNX Global Hackathon
This project is an entry for the QNX Global Hackathon, Developer Tooling and Host Tools category. The evidence is summarized in [EVIDENCE.md](docs/EVIDENCE.md) and the demonstration plan is in [DEMO.md](docs/DEMO.md). The simulated demonstration remains a labeled rehearsal.
Publication note: project and validation paths in this document use neutral placeholders. Consult the unchanged evidence files for original recorded paths.
## Tutorial
Step by step, verified on 6 November 2026: [Run a QNX 8.0 C program in QEMU from Windows](tutorial/README.md) (WSL2 and Ubuntu 24.04, qcc, a custom mkqnximage image and a captured serial console, without hardware or a guest login), [Part 2: native QNX message passing](tutorial/part2-message-passing.md), [Part 3: a resource manager](tutorial/part3-resource-manager.md), [Part 4: pulses and timers](tutorial/part4-pulses-timers.md), [Part 5: registered events](tutorial/part5-registered-events.md), [Part 6: message priority inheritance](tutorial/part6-priority-inheritance.md) (verified on 8 November 2026), [Part 7: a server found by name from another process](tutorial/part7-name-service.md) and [Part 8: compile and run through MCP](tutorial/part8-run-through-mcp.md) (both verified on 9 November 2026) in the same image.
TDQS
Scored across 8 tools
Each tool targets a distinct resource+action pair: toolchain inspection, single-file compilation, image build/start/stop/IP, and operation status/cancel. The only near-neighbors (start vs. status, stop vs. cancel) are explicitly separated in their descriptions, which clarify that launch success ≠ guest readiness and cancel acceptance ≠ termination.
All names use a consistent snake_case qnx_ prefix and follow a predictable resource_action pattern (qnx_image_build, qnx_image_start, qnx_operation_status). The deviation is qnx_compile_c and qnx_toolchain_info, which don't fit the resource_action template cleanly (verb-first / noun_noun), though they remain readable and unambiguous.
Eight tools is well-scoped for a narrow QNX host workflow, with no obvious redundancy. Each tool earns its place across the toolchain, compile, image lifecycle, and long-running operation phases.
The compile-and-run-image lifecycle is covered end to end, but there are notable gaps: no way to list or delete existing images, no mechanism to transfer the compiled binary into an image, and no access to guest console/logs after start. Agents can partially work around these via operation_status, but guest-level verification and cleanup are dead ends.