MCP server to write to the clipboard via wl-copy
Documentation
mcp-wayland-clipboard
MCP server to write to the Wayland clipboard via wl-copy.
This Model Context Protocol (MCP) server allows AI models to copy text directly to your Wayland clipboard using the wl-copy command-line tool.
Prerequisites
- Node.js (v18 or higher)
wl-copyinstalled and available in PATH (usually provided by thewl-clipboardpackage)
Installing wl-clipboard
On Arch Linux:
sudo pacman -S wl-clipboardOn Ubuntu/Debian:
sudo apt install wl-clipboardInstallation
npm installBuilding
npm run buildThis compiles the TypeScript source to JavaScript in the dist/ directory.
Usage
Starting the server
After building, you can start the server using:
npx mcp-wayland-clipboardOr directly with Node:
node dist/index.jsTool: copy_to_clipboard
The server provides a single tool called copy_to_clipboard that accepts a text parameter and copies it to your Wayland clipboard.
Parameters:
text(string, required): The text to copy to the clipboard
Returns:
- Success:
{ success: true, message: "Text copied to clipboard" } - Error:
{ success: false, error: "error message" }
Example Use Case
A common use case is asking an AI to generate formulas or code snippets and have them automatically copied to your clipboard. For example:
"Generate an Excel formula to sum cells A1 to A5 and copy it to my clipboard"
The AI can then call the copy_to_clipboard tool with the formula, and you can paste it directly into Excel.
Configuration for MCP Clients
Claude Desktop
Add the following to your Claude Desktop configuration file (typically located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or ~/.config/Claude/claude_desktop_config.json on Linux):
{
"mcpServers": {
"wayland-clipboard": {
"command": "npx",
"args": ["-y", "mcp-wayland-clipboard"]
}
}
}Or if you have the project installed locally:
{
"mcpServers": {
"wayland-clipboard": {
"command": "node",
"args": ["/path/to/mcp-wayland-clipboard/dist/index.js"]
}
}
}Other MCP Clients
For other MCP clients, configure them to start the server using:
- Command:
npx(ornodeif using local installation) - Args:
["-y", "mcp-wayland-clipboard"](or["/path/to/dist/index.js"]for local)
Error Handling
The server will exit with an error code if wl-copy is not found in your PATH during startup. Make sure wl-clipboard is installed before running the server.
License
MIT
Similar MCP
Based on tags & features
Trending MCP
Most active this week