-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Linux-first runtime and systemd deployment support #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
edmen12
wants to merge
3
commits into
wonderwhy-er:main
Choose a base branch
from
edmen12:feat/linux-first-runtime
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| *.sh text eol=lf | ||
| *.service text eol=lf | ||
| *.service.template text eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Linux CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, "feat/**"] | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| DESKTOP_COMMANDER_DISABLE_TELEMETRY: "true" | ||
| DESKTOP_COMMANDER_HEADLESS: "true" | ||
|
|
||
| jobs: | ||
| ubuntu-matrix: | ||
| name: Ubuntu ${{ matrix.os }} / Node ${{ matrix.node }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-22.04, ubuntu-24.04] | ||
| node: [20, 22] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| cache: npm | ||
| - name: Install system dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y procps ripgrep | ||
| - run: npm ci --ignore-scripts --no-audit --no-fund | ||
| - run: npm run build | ||
| - run: node dist/npm-scripts/verify-ripgrep.js | ||
| - run: node test/test-linux-platform.js | ||
| - run: node test/test-linux-service-installer.js | ||
|
|
||
| debian-12: | ||
| name: Debian 12 / Node 20 | ||
| runs-on: ubuntu-24.04 | ||
| container: node:20-bookworm | ||
|
|
||
| steps: | ||
| - name: Install system dependencies | ||
| run: apt-get update && apt-get install -y --no-install-recommends git procps ripgrep bash ca-certificates systemd | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - run: npm ci --ignore-scripts --no-audit --no-fund | ||
| - run: npm run build | ||
| - run: node dist/npm-scripts/verify-ripgrep.js | ||
| - run: node test/test-linux-platform.js | ||
| - run: node test/test-linux-service-installer.js | ||
| - name: Validate systemd installer syntax | ||
| run: bash -n scripts/install-linux-service.sh | ||
|
|
||
| full-linux-suite: | ||
| name: Full Linux test suite | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
| - name: Install system dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y python3 procps ripgrep | ||
| - run: npm ci --ignore-scripts --no-audit --no-fund | ||
| - run: npm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Desktop Commander on Linux | ||
|
|
||
| Desktop Commander supports desktop Linux and headless Ubuntu/Debian servers. | ||
| The Linux runtime uses native shells, `ps`, filesystem permissions, signals, | ||
| and systemd rather than Windows-specific process APIs. | ||
|
|
||
| ## Supported baseline | ||
|
|
||
| - Ubuntu 22.04 and 24.04 | ||
| - Debian 12 | ||
| - Node.js 20 and 22 | ||
| - Bash, POSIX `sh`, Zsh, and Fish | ||
| - Desktop sessions using X11 or Wayland | ||
| - Headless VPS and server environments | ||
|
|
||
| ## Local development | ||
|
|
||
| ```bash | ||
| git clone https://github.com/wonderwhy-er/DesktopCommanderMCP.git | ||
| cd DesktopCommanderMCP | ||
| npm ci | ||
| npm run build | ||
| node test/test-linux-platform.js | ||
| ``` | ||
|
|
||
| Run the MCP server directly: | ||
|
|
||
| ```bash | ||
| node dist/index.js | ||
| ``` | ||
|
|
||
| ## Headless remote device | ||
|
|
||
| A Linux host without `DISPLAY`, `WAYLAND_DISPLAY`, or `MIR_SOCKET` is detected | ||
| as headless. Browser launch is skipped and the device authorization URL and code | ||
| remain visible in the terminal or systemd journal. | ||
|
|
||
| You can force the runtime mode: | ||
|
|
||
| ```bash | ||
| export DESKTOP_COMMANDER_HEADLESS=true | ||
| ``` | ||
|
|
||
| Start a remote device manually: | ||
|
|
||
| ```bash | ||
| desktop-commander remote --persist-session --disable-no-sleep | ||
| ``` | ||
|
|
||
| The persisted device session is stored under: | ||
|
|
||
| ```text | ||
| ~/.desktop-commander-device/device.json | ||
| ``` | ||
|
|
||
| The file is created with mode `0600`. | ||
|
|
||
| ## systemd installation | ||
|
|
||
| Install the package globally first, then run: | ||
|
|
||
| ```bash | ||
| sudo desktop-commander linux-service --user "$USER" | ||
| ``` | ||
|
|
||
| The installer refuses to create a root-owned remote agent by default. A root | ||
| service requires the explicit `--allow-root` flag and grants the connected AI | ||
| full root-level host access, so it is not recommended. | ||
|
|
||
| For a non-standard executable path: | ||
|
|
||
| ```bash | ||
| sudo desktop-commander linux-service \ | ||
| --user "$USER" \ | ||
| --bin "$HOME/.npm-global/bin/desktop-commander" | ||
| ``` | ||
|
|
||
| From a source checkout, the equivalent installer is | ||
| `sudo ./scripts/install-linux-service.sh --user "$USER"`. | ||
|
|
||
| The installer enables the service but does not start it by default. Start it and | ||
| watch the first authorization flow with: | ||
|
|
||
| ```bash | ||
| sudo systemctl start desktop-commander-device | ||
| sudo journalctl -u desktop-commander-device -f | ||
| ``` | ||
|
|
||
| Use `--start` to start it immediately during installation. | ||
|
|
||
| ## Service management | ||
|
|
||
| ```bash | ||
| systemctl status desktop-commander-device | ||
| sudo systemctl restart desktop-commander-device | ||
| sudo systemctl stop desktop-commander-device | ||
| sudo journalctl -u desktop-commander-device --since today | ||
| ``` | ||
|
|
||
| The unit uses `KillMode=control-group`, so child shells and long-running commands | ||
| are stopped with the service. It also enables `NoNewPrivileges`, `PrivateTmp`, | ||
| and read-only protection for system directories. | ||
|
|
||
| ## Security boundary | ||
|
|
||
| Run the service as a dedicated non-root user. Desktop Commander can execute | ||
| arbitrary commands with that user's permissions. Directory allowlists and the | ||
| command blocklist reduce mistakes but do not provide sandbox isolation. Use a | ||
| container or VM when the connected AI must not reach the wider host. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [Unit] | ||
| Description=Desktop Commander Remote Device | ||
| Documentation=https://github.com/wonderwhy-er/DesktopCommanderMCP | ||
| Wants=network-online.target | ||
| After=network-online.target | ||
|
|
||
| [Service] | ||
| Type=simple | ||
| User=__USER__ | ||
| Group=__GROUP__ | ||
| WorkingDirectory=__HOME__ | ||
| Environment="HOME=__HOME__" | ||
| Environment=NODE_ENV=production | ||
| Environment=DESKTOP_COMMANDER_HEADLESS=true | ||
| Environment="PATH=__PATH__" | ||
| ExecStart="__BINARY__" remote --persist-session --disable-no-sleep | ||
| Restart=on-failure | ||
| RestartSec=5 | ||
| TimeoutStopSec=15 | ||
| KillMode=control-group | ||
| UMask=0077 | ||
| NoNewPrivileges=true | ||
| PrivateTmp=true | ||
| ProtectSystem=full | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.