Skip to main content

plasma-mcp

An MCP server that lets AI agents (Claude Code, Codex, Cursor and other MCP clients) see and control a KDE Plasma 6 desktop. It works through KDE's own interfaces (D-Bus, KWin scripting and KConfig) instead of screenshots and simulated clicks.

Every write can be previewed and undone. Ask your agent to "tile my editor next to the browser", "switch to a dark theme" or "tell me when the build notification arrives".

Contents

Requirements

  • KDE Plasma 6 (tested on Plasma 6.8, Wayland, CachyOS)
  • Python 3.12+ and uv
  • kreadconfig6 / kwriteconfig6 and the plasma-apply-* tools, which ship with Plasma
  • Optional: KDE Customizer (kdec on your PATH), required only for the theme tools

Install

From a release

Install the MCP server as a user tool:

uv tool install plasma-mcp

The executable will be available as plasma-mcp.

Register it with Claude Code:

claude mcp add --scope user plasma -- plasma-mcp

For another MCP client, configure it to run plasma-mcp over stdio.

From source

git clone https://github.com/RJCogburn/plasma-mcp.git
cd plasma-mcp
uv sync

Register it with Claude Code for all your projects:

claude mcp add --scope user plasma -- uv --directory /path/to/plasma-mcp run plasma-mcp

Start a new Claude Code session; the tools appear as mcp__plasma__*.

For other MCP clients, run the stdio command uv --directory /path/to/plasma-mcp run plasma-mcp.

Theme tools (optional)

Either install method needs KDE Customizer for the theme tools:

uv tool install git+https://github.com/RJCogburn/kde-customizer

Upgrading

uv tool upgrade plasma-mcp

Tools

The tier column refers to the permission tiers described below.

Settings

Tool Tier What it does
get_setting read Read a KConfig value, e.g. kwinrc / Windows / FocusPolicy. Nested groups use /.
set_setting write Write a KConfig value. Dry run by default.
undo_last write Restore the most recent snapshot (settings or theme).

Windows

Tool Tier What it does
list_windows read Each window's id, app, title, desktops, geometry and active/minimized state, plus the virtual desktops.
focus_window write Activate a window. It un-minimizes it and switches to its desktop.
move_to_desktop write Move a window to a virtual desktop, by name or 1-based number.
tile_window write Tile it to the left / right / top / bottom half, maximize or unmaximize.

Theming (needs KDE Customizer)

Tool Tier What it does
current_theme read The global theme, color scheme, Plasma style, icons and cursor in use.
theme_guide read The theme spec format. Agents read this before writing a theme.
check_theme read Validate a .toml theme spec (contrast, missing installed themes).
apply_theme write Build and apply a spec. Dry run by default. It shows the exact install script. layout=true also replaces panels and needs the dangerous tier.

Notifications

Tool Tier What it does
notify write Show a notification (low / normal / critical). Returns its id.
close_notification write Close a notification by id.
notification_status read Server info and whether Do Not Disturb is on.
watch_notifications private Collect notifications from any app for up to 120 s.

Media

Tool Tier What it does
media_status read MPRIS players with playback status and the current track.
media_play_pause write Toggle play/pause on a player.

Permissions

Tools are grouped into tiers. You choose which tiers are enabled in ~/.config/plasma-mcp.toml:

[tiers]
read = true        # default: on
write = true       # default: on  (every write is previewable and undoable)
dangerous = false  # default: off (e.g. replacing your panel layout)
private = false    # default: off (reading other apps' notifications, e.g. chat messages)

When a tool's tier is off, the call fails with an error that names the tier and this file.

Undo and snapshots

Every real write first copies the config files it can touch to ~/.local/state/plasma-mcp/snapshots/. undo_last restores the newest snapshot and deletes it, so repeated calls step further back.

Restoring files alone doesn't change a desktop that's already running, so theme snapshots also record what was active: global theme, color scheme, Plasma style, cursor and icons. On undo, plasma-mcp re-applies those first, then copies the files back. A theme change and its undo leave your config byte-for-byte as it was. This was verified on a live desktop.

Two KDE details matter here:

  • A global theme's values live in ~/.config/kdedefaults/, not in the files you would expect. Snapshots include that folder.
  • Undoing apply_theme(layout=true) also restarts plasmashell to bring back your panels.

How it works

  • Settings: kreadconfig6 / kwriteconfig6.
  • Windows: a KWin script can't return a value to whoever loaded it. So for each call, plasma-mcp exports a small D-Bus object, loads a one-shot script that calls back to it with JSON (callDBus), then unloads the script. See plasma_mcp/kwin.py; new KWin features can reuse kwin.run(js).
  • Theming: shells out to KDE Customizer's kdec (check, apply, ai-guide) rather than importing it, so the theme format and its install script stay in one place.
  • Notifications: org.freedesktop.Notifications. Watching uses a D-Bus monitor connection (BecomeMonitor) that only matches Notify calls.
  • Media: MPRIS over the session bus.

Limitations

  • Plasma 6 only. The KWin scripting API changed between Plasma versions; no GNOME backend yet.
  • No synthetic keyboard or mouse input. On Wayland that needs ydotool, libei or the RemoteDesktop portal, and it is out of scope for now.
  • No screenshots yet. When they come, they will go through xdg-desktop-portal so you approve each one.
  • Window geometry updates asynchronously. After tile_window, call list_windows again about half a second later to see the new size.
  • Fixed-size dialogs ignore tile and maximize.
  • Do Not Disturb. While it is on, only critical notifications pop up. plasma-mcp never changes your Do Not Disturb setting.

Development

uv sync --extra dev
uv run pytest
  • Project notes and conventions for coding agents: CLAUDE.md.
  • Every new tool must call policy.require(<tier>), and every config write must go through snapshots.take before changing anything.
  • Test write tools on throwaway windows (a Tk or kdialog window you open yourself), never on the user's own windows.

License

MIT, see LICENSE.

Metadata

Release files for plasma-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plasma-mcp 0.1.0
File Size Uploaded Provenance Actions
plasma_mcp-0.1.0.tar.gz 18.4 kB With provenance Details for plasma_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plasma-mcp 0.1.0
File Interpreter ABI Platform Actions
plasma_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for plasma_mcp-0.1.0-py3-none-any.whl

Total release size: 36.5 kB

Release files / plasma_mcp-0.1.0.tar.gz

Download URL plasma_mcp-0.1.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c939b2367441943a470d1f003382ebe228518e3fc160423474f51d1f7f74a14e
BLAKE2b-256 checksum
How to use checksums
fe4d12dd83d1c44f013b34853a52e5c87df92d0c6d6ef2d8d2f2891e363cebe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / plasma_mcp-0.1.0-py3-none-any.whl

Download URL plasma_mcp-0.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ffbb523128ab7c4885366d513a39e16d02c76bd2dc90b2af9e0fc20c3ca446e
BLAKE2b-256 checksum
How to use checksums
6c344e34f37d8d1844506d80e6e046d1f218579c77c851271a1c4c4406c7369e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for plasma-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for plasma_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page