Skip to main content
Glama
README.md
# deskmate

**Control your Windows PC by talking to an AI.** "Make the screen brighter", "turn the music down", "play Bajaga on YouTube on the big monitor", "add the English keyboard": deskmate gives an AI assistant a small, safe set of tools for your PC and runs them for real.

It is an [MCP](https://modelcontextprotocol.io) server, so it works with Claude Desktop, Claude Code and any other MCP client. It runs on Windows, or in WSL, where it reaches Windows through `powershell.exe`, so you do not need a second Python install.

```text
You:     pojačaj osvjetljenje i pusti Bajagu na YouTube-u na monitoru
Claude:  → change_brightness(by=20)
         → play_youtube(query="Bajaga", screen="external")
         Pojačao sam osvjetljenje i pustio "Bajaga - Moji drugovi" na monitoru.
```

## What it can do

| Area | Tools | Say things like |
|---|---|---|
| Brightness | `set_brightness`, `change_brightness` | "brighter", "dim the monitor to 30%" |
| Sound | `set_volume`, `change_volume`, `set_mute` | "turn the music down", "volume 20", "mute" |
| Media | `media_control` | "pause", "next song" |
| Web | `play_youtube`, `search_google`, `open_website` | "play lofi on YouTube", "google the weather in Banja Luka on the monitor" |
| Apps | `open_app`, `list_apps` | "open Spotify", "open the calculator" |
| Keyboard | `add_keyboard_language`, `switch_keyboard_language`, `remove_keyboard_language` | "add the English keyboard", "switch to Serbian" |
| System | `get_status`, `set_dark_mode`, `lock_screen` | "dark mode on", "how much battery is left?", "lock the PC" |

Brightness works for the laptop panel and for external monitors. YouTube, Google and websites take a `screen` argument (`laptop` or `external`); deskmate then moves the browser window to that screen and maximizes it.

The model understands any language it speaks. Tool arguments are numbers, tags and names, so "pojačaj zvuk" and "louder" end up as the same call.

## How it works

```text
 Claude Desktop / Claude Code / any MCP client
        │  MCP over stdio
        ▼
 deskmate (Python, in WSL or on Windows)
   tools.py       checks every argument; a fixed list of actions, no shell
   powershell.py  builds one script, pipes it to powershell.exe, reads one JSON line
        │
        ▼
 powershell.exe on the Windows host
   ps/*.ps1       WMI (laptop brightness, battery) · DDC/CI (monitor brightness)
                  Core Audio (volume) · user32 (media keys, keyboard, windows)
```

All Windows-specific code lives in [`src/deskmate/ps/`](src/deskmate/ps/). The small C# helpers inside those scripts are compiled once and cached in `%LOCALAPPDATA%\deskmate`, so a typical action takes 1–2 seconds.

## Install

You need Windows 10 or 11 and Python 3.10+, either in WSL (with Windows interop, which is on by default) or on Windows itself.

```bash
git clone https://github.com/Aleksandar1567/deskmate.git
cd deskmate
python3 -m venv .venv
.venv/bin/pip install -e .          # on Windows: .venv\Scripts\pip install -e .
```

Try it from the command line before connecting an AI:

```bash
.venv/bin/deskmate status                  # brightness, volume, battery, keyboard, ...
.venv/bin/deskmate tools                   # every tool and its arguments
.venv/bin/deskmate call change_volume by=-10
.venv/bin/deskmate call search_google query="weather Banja Luka" screen=external
```

## Connect it to an AI

**Claude Desktop** (Windows): open *Settings → Developer → Edit config*, add deskmate to `claude_desktop_config.json`, and restart Claude Desktop.

If deskmate is installed in WSL:

```json
{
  "mcpServers": {
    "deskmate": {
      "command": "wsl.exe",
      "args": ["-e", "/home/YOU/deskmate/.venv/bin/deskmate", "mcp"]
    }
  }
}
```

If it is installed on Windows:

```json
{
  "mcpServers": {
    "deskmate": {
      "command": "C:\\Users\\YOU\\deskmate\\.venv\\Scripts\\deskmate.exe",
      "args": ["mcp"]
    }
  }
}
```

**Claude Code:**

```bash
claude mcp add --scope user deskmate -- /home/YOU/deskmate/.venv/bin/deskmate mcp
```

Any other MCP client works the same way: it runs `deskmate mcp` and talks to it over stdio.

## Good to know

- **External monitor brightness** uses DDC/CI. Most monitors support it, but some ship with it turned off in their on-screen menu.
- **Safety:** the model can only call the tools above, never a shell. Links must be `http`/`https`, apps must come from the Start menu, and `remove_keyboard_language` is marked destructive so clients can ask before running it.
- **Speed:** listing Start menu apps takes a few seconds, so the list is cached for 10 minutes.

## Development

```bash
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest
```

Most tests replace PowerShell with a fake and run anywhere. `tests/test_windows.py` talks to the real Windows host, only reads, and is skipped where there is no Windows. CI runs the suite on Ubuntu and on a Windows runner.

To add a tool, write a PowerShell function in `src/deskmate/ps/`, then a Python function with a docstring in `src/deskmate/tools.py` decorated with `@tool()`. The MCP server and the CLI pick it up automatically.

## Roadmap

- **Voice:** push-to-talk with local speech recognition (Whisper, which understands Serbian and many other languages) and spoken replies.
- **Standalone agent:** a `deskmate agent` command with a pluggable model: the Claude API, or any OpenAI-compatible endpoint (DeepSeek, local models) configured in `.env`.
- **More tools:** per-app volume, night light, Wi-Fi and Bluetooth, window management.

## License

[MIT](LICENSE)