# CLI Reference

> Every command line tool and option, generated from the MTConnect.NET source.

URL: https://www.trakhound.com/docs/mtconnect-net/reference/cli

> This page is generated from the MTConnect.NET source, so it lists everything the code defines, and is checked against the code by the MTConnect.NET tests.

Every command-line tool the repository exposes — including the shipped `mtconnect.net-agent` + `mtconnect.net-adapter` binaries and the contributor scripts under `tools/` plus the .NET tools under `build/`. The list is built by walking the source tree at docs-build time, so a new flag added to any tool surfaces here on the next regeneration.

## Shipped CLIs

### `mtconnect.net-adapter`

- **Source**: [`adapter/MTConnect.NET-Applications-Adapter/MTConnectAdapterApplication.cs`](https://github.com/TrakHound/MTConnect.NET/blob/master/adapter/MTConnect.NET-Applications-Adapter/MTConnectAdapterApplication.cs)

Standalone adapter host. Pumps observations from a data source (SHDR socket, MQTT topic, or a custom `DataSource` implementation) into a downstream agent. Reads `adapter.config.yaml` at startup. The CLI surface is defined by `MTConnectAdapterApplication.Run(args)`.

**Commands**

| Command | Description |
| --- | --- |
| `help` | Prints usage information |
| `install` | Install as a Service |
| `install-start` | Install as a Service and Start the Service |
| `start` | Start the Service |
| `stop` | Stop the Service |
| `remove` | Remove the Service |
| `debug` | Runs the Agent in the terminal (with verbose logging) |
| `run` | Runs the Agent in the terminal |
| `run-service` | Runs the Agent as a Service |

**Positional arguments**

| Name | Description |
| --- | --- |
| `configuration_file` | Path to the adapter configuration file. Defaults to `adapter.config.yaml` next to the executable when omitted. |

### `mtconnect.net-agent`

- **Source**: [`agent/MTConnect.NET-Applications-Agents/MTConnectAgentApplication.cs`](https://github.com/TrakHound/MTConnect.NET/blob/master/agent/MTConnect.NET-Applications-Agents/MTConnectAgentApplication.cs)

Standalone HTTP agent host. Loads `agent.config.yaml` (or `agent.config.json`), builds an `MTConnectAgentBroker`, instantiates every configured agent module, and runs them inside a single process. The CLI surface is defined by `MTConnectAgentApplication.Run(args)`.

**Commands**

| Command | Description |
| --- | --- |
| `help` | Prints usage information |
| `install` | Install as a Service |
| `install-start` | Install as a Service and Start the Service |
| `start` | Start the Service |
| `stop` | Stop the Service |
| `remove` | Remove the Service |
| `debug` | Runs the Agent in the terminal (with verbose logging) |
| `run` | Runs the Agent in the terminal |
| `run-service` | Runs the Agent as a Service |

**Positional arguments**

| Name | Description |
| --- | --- |
| `configuration_file` | Path to the agent configuration file. Absolute or relative to the executable's directory. If omitted, the agent looks for `agent.config.json`, then `agent.config.yaml`, and copies `agent.config.default.yaml` into place if neither exists. |

## Contributor CLIs

### `MTConnect.NET-DocsGen`

- **Source**: [`build/MTConnect.NET-DocsGen/Program.cs`](https://github.com/TrakHound/MTConnect.NET/blob/master/build/MTConnect.NET-DocsGen/Program.cs)

Walks the repository source tree with Roslyn and emits the auto-generated VitePress reference pages under `docs/reference/`. The same inventory routines are exposed as public static methods so the validation test can re-run them independently.

**Flags**

| Flag | Short | Argument | Description |
| --- | --- | --- | --- |
| `--check` |  |  | Verify pages are in sync; exit 1 on drift |
| `--help` |  |  |  |
| `--out` |  | `<value>` | Docs root (defaults to <repo>/docs) |
| `--repo` |  | `<value>` | Repository root (required) |

### `MTConnect.NET-SysML-Import`

- **Source**: [`build/MTConnect.NET-SysML-Import/Program.cs`](https://github.com/TrakHound/MTConnect.NET/blob/master/build/MTConnect.NET-SysML-Import/Program.cs)

Parses an `MTConnectSysMLModel.xml` (the XMI export of the standard's SysML model) and regenerates the `*.g.cs` source files under `libraries/MTConnect.NET-Common/`, `libraries/MTConnect.NET-XML/`, and `libraries/MTConnect.NET-JSON-cppagent/`. Run by maintainers when a new spec version lands.

**Flags**

| Flag | Short | Argument | Description |
| --- | --- | --- | --- |
| `--help` |  |  |  |
| `--json-dump` |  | `<value>` | Optional. Writes the parsed MTConnectModel as JSON for debugging. |
| `--output` |  | `<value>` | Repository root. Each subgenerator writes into its own libraries/<LibraryName>/ subtree under this root. Required. |
| `--xmi` |  | `<value>` | SysML XMI file to consume. Required. |

### `dotnet.sh`

- **Source**: [`tools/dotnet.sh`](https://github.com/TrakHound/MTConnect.NET/blob/master/tools/dotnet.sh)

Wrapper around `dotnet` that runs either against the dotnet on PATH (default) or inside an official Microsoft .NET SDK container when `--docker` (or `MTCONNECT_DOTNET_USE_DOCKER=1`) is set. Lets a contributor without a local SDK install build and test the repo, and pins the SDK version so two contributors don't drif...

**Flags**

| Flag | Short | Argument | Description |
| --- | --- | --- | --- |
| `--docker` | `-d` |  | Run dotnet inside a pinned mcr.microsoft.com/dotnet/sdk container (also honored via MTCONNECT\_DOTNET\_USE\_DOCKER=1). Everything after the flag is forwarded to the `dotnet` CLI verbatim. |

### `test.sh`

- **Source**: [`tools/test.sh`](https://github.com/TrakHound/MTConnect.NET/blob/master/tools/test.sh)

Local test + coverage entry point for MTConnect.NET. Discovers every test project under tests/**/\*.csproj — adding a new test project requires no edits to this script. The compliance harness under tests/Compliance/** and the Docker-gated end-to-end suites are skipped by default so the common loop stays fast; flags b...

**Flags**

| Flag | Short | Argument | Description |
| --- | --- | --- | --- |
| `--docker` | `-d` |  | Run every dotnet invocation through tools/dotnet.sh --docker (also honored via MTCONNECT\_DOTNET\_USE\_DOCKER=1). |
| `--compliance` | `-c` |  | Include the MTConnect compliance harness under tests/Compliance/\*\* (XSD validation, OCL checks, cppagent parity). Skipped by default because it is the slowest tier and many of its tests are gated behind Docker / [Category] tags. NOTE: runs every test in the project including `XsdLoadStrict`, expected to surface ~54 failures until the XSD-1.1 validator lands. |
| `--e2e` | `-e` |  | Force the Docker-gated end-to-end suites (implies MTCONNECT\_E2E\_DOCKER=true; Testcontainers spins up mosquitto + cppagent containers per test class). |
| `--only` | `-o` | `PATTERN` | Run only the test projects whose path matches PATTERN (grep -E). Example: --only 'XML\|SHDR' runs only those two projects. |
| `--help` | `-h` |  | Print this help and exit. |
