Lightweight MCP server enabling natural language control of Hyprland Wayland compositor functionalities
The Hyprland MCP Server is a lightweight, unofficial Model Context Protocol (MCP) server that exposes all functionalities of hyprctl
—the command-line interface for the Hyprland Wayland compositor—to language models and AI applications. This server enables natural language interfaces to query and control Hyprland's advanced window management, layouts, inputs, and more, making it an invaluable tool for developers building AI applications that require a deep level of interaction with desktop environments.
The Hyprland MCP Server leverages the Model Context Protocol (MCP) to provide a standardized interface for AI applications. By exposing various operations through this protocol, it supports seamless integration of sophisticated desktop features like window management, layout switching, and input control into AI-driven workflows.
hyprctl
commands to perform common operations.The MCP protocol is implemented within the server using Python 3.10+, ensuring compatibility and performance. The server architecture involves several key components:
hyprctl
to interact directly with Hyprland, ensuring real-time and accurate state updates.hyprctl
session.hyprctl
, and results are returned to the client.This flow is illustrated in the following Mermaid diagram:
graph TB
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
Getting started with the Hyprland MCP Server involves a few straightforward steps:
Clone the Repository:
git clone https://github.com/stefanoamorelli/hyprmcp.git
cd hyprmcp
Obtain HYPRLAND_INSTANCE_SIGNATURE: Run echo $HYPRLAND_INSTANCE_SIGNATURE
to retrieve this important variable.
Install the Server in Your MCP Client:
For example, if you are using Claude Desktop, modify the ~/.config/Claude/claude_desktop_config.json
file as follows:
"Hyperland MCP Server": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with",
"subprocess",
"mcp",
"run",
"<global path of the repo>/hyprmcp/hyprmcp/server.py"
],
"env": {
"PYTHONPATH": "<global path of the repo>/hyprmcp",
"HYPRLAND_INSTANCE_SIGNATURE": "<your-hyprland-instance-signature>"
}
},
This setup allows your AI application to communicate with Hyprland effectively.
Imagine a scenario where a virtual assistant is used to manage a user's workspace. With the Hyprland MCP Server, users can simply ask their virtual assistant to perform actions such as "Switch to the development workspace" or "Close all non-essential windows." These commands are then dispatched directly to Hyprland via hyprctl
.
In a more advanced use case, AI applications can dynamically adjust workspaces based on user behavior. For example, if an email is detected as unread, the MCP server can automatically switch to the workspace dedicated for email handling and bring it to the forefront.
The Hyprland MCP Server supports integration with several MCP clients:
A detailed compatibility matrix is provided below to assist developers in choosing the right client and server setup.
MCP Client | HYPRLAND INSTANCE | SUPPORTED TOOLS | PROMPT EXECUTION | STATUS |
---|---|---|---|---|
Claude Desktop | Full support | ✅ | ✅ | Full Support |
Continue | Basic command execution | ✅ | ❌ | Tools Only |
Cursor | Tool commands only | ✅ | ❌ | Not Available |
The Hyprland MCP Server is designed to offer robust performance and compatibility, supporting a wide range of devices and configurations. The server has been tested against various Hyprland instances and hardware setups to ensure seamless operation.
For advanced users, the Hyprland MCP Server offers several configuration options and security measures:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
PYTHONPATH
and HYPRLAND_INSTANCE_SIGNATURE
, for correctness.dispatch_command
method to execute arbitrary hyprctl commands.Contributors are encouraged to report issues, suggest improvements, and submit pull requests. The repository contains a CONTRIBUTING.md
file with detailed guidelines on how to set up the project for development, run tests, and contribute code changes.
For more information on Model Context Protocol (MCP), visit:
Join the community for support and collaboration:
This documentation aims to provide a comprehensive overview of the Hyprland MCP Server, guiding developers in its implementation and utilization within AI-driven workflows.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Python MCP client for testing servers avoid message limits and customize with API key
Discover easy deployment and management of MCP servers with Glutamate platform for Windows Linux Mac
Explore community contributions to MCP including clients, servers, and projects for seamless integration
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions