Skip to content

About

MCP server for the KDE Plasma workspace

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

kde-workspace-mcp

MCP server for the KDE Plasma workspace. It lets an MCP client (for example an LLM assistant) query and change the workspace through KWin, the Plasma shell and other Plasma D-Bus services.

The server uses the Streamable HTTP transport provided by the KTextAddons MCP protocol library.

Tools

Tools are grouped by category. Tools marked "read-only" never change the workspace; the others ask for confirmation (see below).

Virtual desktops (KWin)

  • virtual_desktop_get_count (read-only): return the number of virtual desktops, their names and the current one.
  • virtual_desktop_set_count (destructive): change the number of virtual desktops (count, from 1 to 25). Desktops are added or removed at the end; windows on removed desktops are moved to the remaining ones.
  • virtual_desktop_switch: make a virtual desktop the current one (desktop, numbered from 1 as listed by virtual_desktop_get_count).
  • virtual_desktop_next / virtual_desktop_previous: switch to the next or previous virtual desktop (wraps around if enabled in KWin).
  • virtual_desktop_set_name: rename a virtual desktop (desktop, numbered from 1, and name, at most 100 characters).
  • virtual_desktop_create: create a virtual desktop (optional name and position, numbered from 1; by default it is added after the last one).
  • virtual_desktop_remove (destructive): remove a virtual desktop (desktop, numbered from 1). Windows on it are moved to the remaining desktops; the last desktop cannot be removed.

Activities

  • activities_list (read-only): return the activities with their ids, names, descriptions, states and the current one.
  • activities_switch: make an activity the current one (activity, id or name).
  • activities_next / activities_previous: switch to the next or previous activity.
  • activities_create: create an activity (name) and return its id.
  • activities_set_name: rename an activity (activity, name).
  • activities_set_description: set the description of an activity (activity, description; an empty string clears it).
  • activities_remove: remove an activity (activity); the last one cannot be removed.

Screen saver

  • screen_saver_get_active (read-only): return whether the screen saver is active.
  • screen_saver_set_active: activate the screen saver, which locks the screen (active; deactivation is not supported).
  • screen_saver_lock_screen: lock the screen of the current session.

Notifications ("Do not disturb")

  • notifications_get_inhibited (read-only): return whether notifications are inhibited ("Do not disturb" mode).
  • notifications_inhibit: enable "Do not disturb" (optional reason) and return a cookie. The inhibition lasts until it is released or until the server exits.
  • notifications_uninhibit: release an inhibition (cookie, as returned by notifications_inhibit).

Window manager

  • show_desktop: show the desktop by minimizing all windows, or restore them (show).

KWin effects

Effects are loaded or unloaded for the current session only: the KWin configuration is not changed. effect is the id of the effect (for example zoom or wobblywindows) as listed by kwin_effects_list.

  • kwin_effects_list (read-only): return the ids of the available effects, and which ones are loaded and currently active.
  • kwin_effects_is_loaded (read-only): return whether an effect is loaded (effect).
  • kwin_effects_is_supported (read-only): return whether an effect is supported by the current compositing backend (effect).
  • kwin_effects_load / kwin_effects_unload: load or unload an effect (effect).
  • kwin_effects_toggle: load the effect if it is not loaded, unload it otherwise (effect).

Plasma shell

  • plasma_get_edit_mode (read-only): return whether the Plasma shell is in edit mode.
  • plasma_get_immutable (read-only): return whether the Plasma shell is immutable (widgets locked).
  • plasma_toggle_widget_explorer: open or close the widget explorer.
  • plasma_toggle_activity_manager: open or close the activity manager.
  • plasma_toggle_dashboard: show or hide the dashboard (desktop widgets shown above all windows).
  • plasma_widget_list (read-only): return the installed Plasma widgets (applets) with their plugin id and name.
  • plasma_desktop_widget_add: add a widget to the desktop of a screen (plugin, a plugin id as listed by plasma_widget_list, and optional screen). Fails when the widget is not installed or when Plasma is immutable (widgets locked).

Wallpaper

  • plasma_wallpaper_get (read-only): return the wallpaper plugin and its configuration for a screen, as a JSON object (optional screen, numbered from 0; the first screen by default).
  • plasma_wallpaper_set: set the image used as wallpaper (image, an absolute path or a URL such as file:///…, and optional screen).
  • plasma_wallpaper_list (read-only): return the installed wallpapers (packages and images) with their name and path; the path can be passed as image to plasma_wallpaper_set.

Plasma appearance

  • plasma_color_scheme_list (read-only) / plasma_color_scheme_set: list the installed color schemes, or apply one (name).
  • plasma_desktop_theme_list (read-only) / plasma_desktop_theme_set: list the installed desktop themes, or apply one (name).
  • plasma_cursor_theme_list (read-only) / plasma_cursor_theme_set: list the installed cursor themes as "Display Name [id]", or apply one (name, the id between brackets).

Clipboard (Klipper)

  • plasma_clipboard_get_contents (read-only): return the current text contents of the clipboard.
  • plasma_clipboard_set_contents: replace the clipboard contents with text.
  • plasma_clipboard_get_history (read-only): return the clipboard history as a JSON array of strings, most recent first.
  • plasma_clipboard_clear_history: clear the whole clipboard history.

Power management

  • power_management_get_battery_remaining_time (read-only): return the estimated time left before the battery is empty (no estimate on AC power or without a battery).
  • power_management_get_charge_thresholds (read-only): return the battery charge start and stop thresholds, in percent (0 and 100 mean no limit), and whether battery conservation mode is enabled.
  • power_management_get_lid_state (read-only): return whether the computer has a lid and whether it is closed.

Confirmation

Tools that modify the workspace ask for confirmation through a persistent notification showing the tool name and its arguments. The call is refused when the user rejects or dismisses the notification, or after 60 seconds without an answer. Only one notification is shown at a time: other calls wait their turn. The notification event is provided by KTextAddons (textautogeneratetextmcpprotocol.notifyrc).

Read-only tools never ask for confirmation. Confirmation can be disabled with AskModify=false in the [General] group of kdeworkspacemcprc.

Running

The server is started at login (autostart) when it is enabled. Enable it and configure its URL in System Settings, module "KDE Workspace MCP Server". Settings are stored in kdeworkspacemcprc; saving them in the module reloads the running server.

It can also be started manually on a given URL, ignoring the configuration file:

kdeworkspacemcp --url http://127.0.0.1:8080/mcp

kdeworkspacemcp --list-tools prints the supported tools and exits.

Only one instance runs per session (org.kde.kdeworkspacemcp on D-Bus).

Debug output uses the org.kde.kdeworkspacemcp logging category.

Requirements

  • Linux or FreeBSD
  • Qt >= 6.10 (Core, DBus, Widgets)
  • KDE Frameworks >= 6.30 (I18n, CoreAddons, Config, Crash, DBusAddons, KCMUtils, Package)
  • KTextAddons >= 2.3.46 (TextAutoGenerateTextMcpProtocolCore and TextAutoGenerateTextMcpProtocolWidgets)
  • At runtime, the Plasma services used by the tools: KWin (virtual desktops, show desktop, effects), the Plasma shell (plasmashell: edit mode, widget explorer, dashboard, wallpaper), the activity manager (kactivitymanagerd), the screen locker, the notification server (Do not disturb), Klipper (clipboard), PowerDevil (power management) and the plasma-apply-colorscheme, plasma-apply-desktoptheme and plasma-apply-cursortheme commands

Build

cmake --preset dev
cmake --build --preset dev
ctest --preset dev

Other presets are available in CMakePresets.json (release, asan, unity, clazy, …). The mold or wild linker is used when available; pass -DUSE_FASTER_LINKER=OFF to disable it.

Pre-commit

Configuring the project installs the git hook automatically when prek or pre-commit is available. To run all hooks manually:

prek run --all-files

About

MCP server for the KDE Plasma workspace

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages