# What Is the Default Timeout for Process Execution in Desktop Commander MCP?

> Discover the default 10-second timeout for process execution in Desktop Commander MCP using the built-in exec helper. Learn how it impacts your workflows.

- Repository: [Eduard Ruzga/DesktopCommanderMCP](https://github.com/wonderwhy-er/DesktopCommanderMCP)
- Tags: api-reference
- Published: 2026-08-02

---

**Desktop Commander MCP enforces a 10‑second timeout (10,000 ms) for all subprocess execution via the built‑in `exec` helper.**

This timeout is hard‑coded as `{ timeout: 10000 }` in the central execution path defined in [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js). When a command exceeds this window, Node.js terminates the child process and rejects the promise with an `ETIMEDOUT` error. Understanding this limit helps you diagnose hung commands and decide when to override the default for long‑running operations.

---

## Where the 10‑Second Timeout Is Defined

The canonical source of the timeout is **line 422** of [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js). According to the DesktopCommanderMCP source code, the `exec` call from Node's `child_process` module receives an explicit options object:

```javascript
exec(actualCommand, { timeout: 10000 }, (error, stdout, stderr) => {
  // callback handling
});

```

- **File:** [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js)
- **Line:** 422
- **GitHub link:** [uninstall-claude-server.js#L422](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js#L422)

No other production file overrides this value. All standard command execution in Desktop Commander MCP flows through this helper, making **10 seconds the universal default** for process execution timeout.

---

## How the Timeout Behaves in Practice

When you invoke a command through the framework, Node.js starts a timer alongside the subprocess. Two outcomes are possible:

1. **Success:** The process exits before 10,000 ms. The callback receives `error === null` and the captured `stdout` and `stderr`.
2. **Timeout:** The process is still running after 10,000 ms. Node.js sends `SIGTERM`, then the callback receives an `Error` object with `code === 'ETIMEDOUT'`.

The timeout includes process startup, execution, and cleanup. Heavy I/O, network delays, or computationally expensive tasks can trigger it unexpectedly.

---

## Detecting and Handling Timeout Errors

Production code should explicitly check for timeout conditions to distinguish them from command failures. The `error.code` property reveals the cause:

```javascript
import { exec } from "node:child_process";

function runCommand(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, { timeout: 10000 }, (error, stdout, stderr) => {
      if (error) {
        // Distinguish timeout from other failures
        if (error.code === "ETIMEDOUT") {
          return reject(new Error(`Command timed out after 10s: ${cmd}`));
        }
        return reject(error);
      }
      resolve(stdout);
    });
  });
}

runCommand("sleep 20")
  .then(out => console.log("Result:", out))
  .catch(err => {
    if (err.message.includes("timed out")) {
      console.warn("Process execution timeout:", err.message);
    } else {
      console.error("Execution failed:", err);
    }
  });

```

This pattern appears throughout the codebase wherever robust error handling is required.

---

## Customizing the Timeout for Specific Calls

While [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js) hard‑codes 10 seconds, individual callers can override the timeout by passing a different value in the options object. This is useful for known long‑running operations like large package installations or database migrations.

```javascript
exec("npm install --legacy-peer-deps", { timeout: 120000 }, (err, out) => {
  if (err?.code === "ETIMEDOUT") {
    console.error("Install exceeded 2 minute window");
  } else if (err) {
    console.error("Install failed:", err);
  } else {
    console.log("Dependencies installed successfully");
  }
});

```

Key considerations when overriding:

- **Memory pressure:** Longer timeouts increase resource contention.
- **User experience:** MCP tools should remain responsive; consider streaming progress instead of blocking indefinitely.
- **Signal handling:** Node sends `SIGTERM` on timeout, then `SIGKILL` if the process ignores termination.

---

## Test Utilities vs. Production Timeout

Several test files in Desktop Commander MCP use shorter timeouts to keep test suites fast:

| File | Timeout | Purpose |
|------|---------|---------|
| [`test/test-default-shell.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/test/test-default-shell.js) | 2,000 ms | Fast validation of shell detection |
| [`test/test-blocked-commands.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/test/test-blocked-commands.js) | 2,000 ms | Quick command blocking checks |
| [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js) | **10,000 ms** | Production execution standard |

Test utilities are not exported for general use. Production code should rely on the 10‑second default or explicitly configure per‑call overrides.

---

## Summary

- **Default timeout:** 10,000 ms (10 seconds) for all process execution in Desktop Commander MCP.
- **Source location:** [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js), line 422, passed to Node.js `exec()`.
- **Timeout error:** `error.code === 'ETIMEDOUT'` when the limit is exceeded.
- **Override method:** Pass `{ timeout: <ms> }` in the options object for specific calls.
- **Test exception:** Unit tests use 2‑second timeouts for speed; do not rely on these for production.

---

## Frequently Asked Questions

### How do I know if a command failed due to timeout or an actual error?

Check `error.code`. A timeout produces `ETIMEDOUT`, while command failure produces `ENONET`, a non‑zero exit code, or another error code. Always inspect this property before parsing `stderr` or `stdout`.

### Can I disable the timeout entirely?

Node.js `exec()` requires a finite timeout; passing `0` or `undefined` falls back to platform defaults or may hang indefinitely. Desktop Commander MCP does not expose a "no timeout" mode. For truly long‑running tasks, consider using `spawn()` with manual lifecycle management instead of the built‑in `exec` helper.

### Does the timeout include the time to spawn the process?

Yes. The 10,000‑ms countdown begins immediately when `exec()` is called, covering shell startup, command parsing, and execution. Slow system load or antivirus scanning can consume significant time before your actual command runs, making timeouts more likely on constrained systems.

### Is the 10‑second timeout configurable globally?

No global configuration exists in the current codebase. The value is a literal in [`uninstall-claude-server.js`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/uninstall-claude-server.js). To change it universally, you must fork or patch that file. Per‑call overrides remain the supported extension mechanism.