Skip to main content

MCP Server for system clipboard integration

Project description

Clipboard MCP Server

A Model Context Protocol (MCP) server that provides system clipboard read and write capabilities for AI assistants like Claude.

Features

  • read_clipboard: Read text content from the system clipboard
  • write_clipboard: Write text content to the system clipboard
  • Cross-platform support (Linux, macOS, Windows, WSL)
  • Lightweight with minimal dependencies

Installation

Option 1: pip (Recommended)

pip install clipboard-mcp

Consider using a virtual environment to avoid dependency conflicts:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install clipboard-mcp

Option 2: uv (Lightweight, for trying it out)

Run directly with uv (no pip installation required):

# One-time execution
uv run --from clipboard-mcp clipboard-mcp

# Or clone and run from source
git clone https://github.com/gabiteodoru/clipboard-mcp.git
cd clipboard-mcp
uv run clipboard-mcp

Option 3: From Source

git clone https://github.com/gabiteodoru/clipboard-mcp.git
cd clipboard-mcp
pip install -e .

Platform-Specific Setup

The installation will display instructions for your platform. Here's what you need:

Linux (X11)

Install clipboard utilities:

sudo apt install xclip xsel

For other distributions:

# Fedora/RHEL
sudo dnf install xclip xsel

# Arch Linux
sudo pacman -S xclip xsel

Linux (Wayland)

sudo apt install wl-clipboard

macOS

No additional dependencies needed - uses built-in pbcopy/pbpaste.

Windows/WSL

No additional dependencies needed - uses built-in clip.exe and PowerShell.

Usage

With Claude CLI

After pip installation:

claude mcp add --scope user clipboard-mcp clipboard-mcp

With uv (no installation):

claude mcp add --scope user clipboard-mcp "uv run --from clipboard-mcp clipboard-mcp"

Or from source directory:

claude mcp add --scope user clipboard-mcp "uv run /path/to/clipboard-mcp"

With Claude Desktop

Add to your Claude Desktop configuration file.

Configuration file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

After pip installation:

{
  "mcpServers": {
    "clipboard": {
      "command": "clipboard-mcp"
    }
  }
}

With uv (no installation):

{
  "mcpServers": {
    "clipboard": {
      "command": "uv",
      "args": [
        "run",
        "--from",
        "clipboard-mcp",
        "clipboard-mcp"
      ]
    }
  }
}

From source directory:

{
  "mcpServers": {
    "clipboard": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/clipboard-mcp",
        "run",
        "clipboard-mcp"
      ]
    }
  }
}

Available Tools

Once configured, Claude will have access to these tools:

  • read_clipboard() - Reads the current clipboard content
  • write_clipboard(text) - Writes text to the clipboard

Example Interactions

With this MCP server running, you can ask Claude to:

  • "Read what's in my clipboard"
  • "Copy this code snippet to my clipboard"
  • "Save this output to my clipboard so I can paste it elsewhere"

How It Works

This MCP server uses the pyperclip library to interact with your system clipboard. It provides a secure bridge between Claude and your clipboard through the Model Context Protocol.

Troubleshooting

Linux: "Failed to read clipboard" errors

Problem: Missing system clipboard utilities

Solution: Install the required tools:

# For X11
sudo apt install xclip xsel

# For Wayland
sudo apt install wl-clipboard

# Or use PyQt5 as fallback (larger dependency)
pip install PyQt5

Linux: Running in a headless environment

Problem: No display server available (e.g., SSH session, Docker)

Solution: Clipboard operations require a display server. For headless environments, consider:

  • Using X11 forwarding: ssh -X user@host
  • Running a virtual display with Xvfb
  • Using alternative data transfer methods

Verification

Test the installation manually:

# Test reading clipboard (copy something first)
python -c "import pyperclip; print(pyperclip.paste())"

# Test writing to clipboard
python -c "import pyperclip; pyperclip.copy('Hello from Python')"

Getting Help

If you encounter issues:

  1. Check that dependencies are installed for your platform
  2. Verify pyperclip works independently (see verification above)
  3. Open an issue with details about your platform and error messages

Requirements

  • Python 3.8 or higher
  • mcp - Model Context Protocol SDK
  • pyperclip - Cross-platform clipboard library

Platform-Specific Requirements

Platform Requirements Status
macOS Built-in (pbcopy/pbpaste) ✅ No setup needed
Windows Built-in (clip.exe, PowerShell) ✅ No setup needed
Linux X11 xclip or xsel ⚠️ Manual install required
Linux Wayland wl-clipboard ⚠️ Manual install required
WSL Windows clipboard tools ✅ Usually pre-installed

Security & Privacy

  • This server only accesses clipboard content when explicitly requested by Claude
  • No clipboard data is stored or transmitted except when you ask Claude to read/write
  • All operations are local to your machine

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clipboard_mcp-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipboard_mcp-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file clipboard_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: clipboard_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for clipboard_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a65ce56042331d5f3fd4c1dfab92f139f32244af11af097e3419fa274efb2563
MD5 8f880bbf821a43352ff06677fef46b27
BLAKE2b-256 0e992f71bf5be3bfd33bd56ac6b574536a967470e8441d291f43ea915941b24e

See more details on using hashes here.

File details

Details for the file clipboard_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: clipboard_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for clipboard_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f845d41438523871d384b32a069fd1638724b06187ea399df95ef993c4f971f
MD5 fbf2f8531378aae3acb4a29242d8a343
BLAKE2b-256 f467c33baafa7b67249f4a495972b65999b73e4ce6bf912ca2173b3cd323b2e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page