Skip to main content
Glama
Windows Intelligent Terminal MCP

Windows Intelligent Terminal MCP

by kucharskill
README.md
# Windows Intelligent Terminal MCP

Control Microsoft Intelligent Terminal from an MCP client. Inspect open windows and panes, send commands and key presses, read terminal output, and capture screenshots with colors and selections.

The server connects to the Release package of Microsoft Intelligent Terminal, a Windows Terminal fork with a terminal control API. Standard Windows Terminal does not provide this API.

## Setup

Requires Windows, Node.js 24 or later, and an installed Microsoft Intelligent Terminal Release package. Windows x64 with Node.js 24.22.0 and Intelligent Terminal 0.3.3083.0 has been tested. Screenshots require Windows 10 version 1903 or later.

```powershell
git clone https://github.com/kucharskill/windows-intelligent-terminal-mcp.git
cd windows-intelligent-terminal-mcp
npm ci
npm run doctor
npm run list
```

Open Intelligent Terminal before using its tools. Installation and API discovery happen automatically. Keep npm optional dependencies enabled so the prebuilt native binaries are installed. The included `.npmrc` disables installation scripts.

Configure your MCP client to run Node directly with an absolute path to `src/index.js`:

```json
{
  "mcpServers": {
    "windows-intelligent-terminal": {
      "command": "node",
      "args": ["C:\\tools\\windows-intelligent-terminal-mcp\\src\\index.js"]
    }
  }
}
```

Adapt the enclosing configuration format to your MCP client. The process communicates over stdio. Restart the connection after updating the checkout.

## Terminal tools

| Tools | Purpose |
| --- | --- |
| `doctor` | Check installation, API connectivity and privileges |
| `list_windows`, `list_tabs`, `list_panes`, `list_terminals` | Inspect the window, tab and pane tree |
| `list_profiles`, `active_pane`, `pane_status` | Inspect profiles and pane state |
| `send_text`, `send_keys`, `read_pane` | Interact with a shell or terminal application |
| `create_tab`, `split_pane`, `focus_pane`, `close_pane` | Manage tabs and panes |
| `list_native_windows`, `set_window_state` | Inspect, restore, maximize or minimize terminal windows |
| `list_capture_tabs`, `capture_tab` | Select a tab for a PNG screenshot |
| `set_project_context`, `list_history` | Identify the project and retrieve interaction history |

List panes first and use the returned session GUID for input and output operations. For example, these are arguments to `send_text`:

```json
{
  "session_id": "GUID-FROM-LIST-PANES",
  "text": "echo hello",
  "enter": true,
  "read_after_ms": 1000
}
```

`send_text` sends literal text. `enter: true` submits it. Optional `read_after_ms` waits 0 to 5000 milliseconds and captures up to 200 lines into `output`. Omitting it returns an acknowledgement. The delay does not detect command completion.

`read_pane` returns the last `max_lines` lines, with a default of 200 and a maximum of 2000. `line_count` counts returned lines, `buffer_line_count` counts the available buffer, and `truncated` indicates omitted earlier lines. If the CLI response exceeds 8 MiB, the server reads the requested tail instead and reports a null total when it cannot determine the buffer size. `last_prompt: true` reads the last completed command when OSC 133 shell integration is available and omits the total buffer count.

Use `send_keys` for key presses:

```json
{
  "session_id": "GUID-FROM-LIST-PANES",
  "keys": ["ArrowDown", "Shift+Tab", "Ctrl+c", "F3"]
}
```

Keys execute in array order. Names follow W3C KeyboardEvent.key, with API-specific `Ctrl+`, `Alt+` and `Shift+` combinations. See the [keyboard reference](docs/keyboard.md) for supported names and application keymaps.

## Administrator sessions

User and administrator connections have separate terminal lists and identifiers. Add `--admin` to the MCP launch arguments to control elevated terminals. Approve UAC once when the connection starts. Allow at least 130 seconds for client startup if it includes an interactive UAC prompt.

The elevated connection closes with its client. A new connection may require UAC again. `doctor` and `list_windows` report when a separate administrator connection is needed.

## Interaction history

History is stored in `%LOCALAPPDATA%\windows-intelligent-terminal-mcp\history\interactions.sqlite`. It records commands sent through MCP and the output returned by terminal reads. History queries are excluded from logging. Screenshots are excluded from the database.

On first startup after upgrading, an existing `runtime/interactions.sqlite` in the checkout is copied through SQLite to the new location. The original is retained. Restart older MCP connections so subsequent calls use the new database. An existing destination database is preserved.

Call `set_project_context` with an absolute Windows `project_cwd` to label subsequent calls. This metadata identifies the project without changing the terminal's working directory. The returned `context_id` identifies this MCP connection.

`list_history` combines optional time, project, connection, session, window, tab, title, tool and status filters. It returns the newest 10 entries by default, with a `last` limit of 50. Times use ISO 8601 with an explicit offset. `start_at` is inclusive and `end_at` is exclusive.

```json
{"project_cwd":"C:\\projects\\example","tool":"send_text","last":10}
{"id":42,"include_output":true,"output_max_chars":10000}
```

Lists show a command preview and `has_output`. Looking up an `id` returns the full command. `include_output` adds the last 2000 characters of saved output. For a single entry, `output_max_chars` can increase that limit to 20,000. `output_truncated` reports whether earlier saved text was omitted. Successful input delivery does not establish a shell command's exit status.

Terminal text can contain credentials or other sensitive information. The database retains the text returned by reads. A missing database is created automatically. A corrupt database detected at startup is archived and replaced where possible. History storage failure is reported on stderr while terminal tools remain available.

## Window screenshots

Get a `native_id` from `list_native_windows`, then use `list_capture_tabs` to find a `capture_tab_id`. These identifiers belong to Windows accessibility and are separate from the terminal API's window and tab IDs.

`capture_tab` returns a PNG image directly. Omitting `capture_tab_id` captures the current tab, including when other windows cover it. Selecting another tab temporarily switches tabs and restores the previous selection afterward. Switching may bring the terminal to the foreground. The result reports `foreground_changed` and `previous_tab_restored`.

Minimized windows must be restored explicitly with `set_window_state`. Screenshots cover the window's visible panes, excluding scrollback. Windows may display a capture border. Captures have a five-second frame timeout and limits of 24 megapixels and 8 MiB.

## Troubleshooting

- Run `npm run doctor` to inspect the installed package and API connection. The server supports the Release package. Preview, Dev and portable installations are currently unsupported.
- Use explicit session IDs from the current privilege level. Closed sessions return an error.
- Input is limited to 12,000 characters per call. CLI calls time out after 15 seconds. After an input timeout, inspect the pane before retrying because the input may already have arrived.
- Match key presses to the active program. Full-screen applications can require the `application` keymap.

If Windows opens a plain console when Intelligent Terminal is selected as its default terminal, see the standalone [Intelligent Terminal default console fix](fixes/intelligent-terminal-default-console/README.md). It has its own PowerShell installer and removal instructions and works independently of this MCP server.

## License

[MIT](LICENSE).