clipboard-mcp
This server provides full read/write access to the system clipboard, enabling AI models to interact directly with clipboard content of any type.
Read clipboard content (
clipboard_paste): Retrieves and intelligently formats clipboard data — spreadsheet tables (Excel/Google Sheets), plain text, code snippets, JSON, URLs, rich HTML, and imagesWrite to clipboard (
clipboard_copy): Writes text content to the system clipboard, useful for copying Claude-generated output (SQL, JSON, tables, code) for use elsewhereList clipboard formats (
clipboard_list_formats): Lists all MIME types currently on the clipboard to identify what data is presentRead raw clipboard data (
clipboard_read_raw): Retrieves raw, unparsed content for a specific MIME type (e.g.text/html,image/svg+xml) — primarily a diagnostic toolTable formatting options: Tabular data can be output as Markdown (default), JSON, CSV, Slack, Jira, Confluence, HTML, or Notion-compatible formats
Schema inference: Optionally appends inferred column types (integer, float, currency, percentage, date, boolean, text) via
include_schema=trueImage support: Returns clipboard images as base64-encoded content that vision-capable models can analyze
Smart content classification: Auto-detects and formats JSON (pretty-printed), code (fenced blocks), URLs, and plain text; truncates large text to 50KB
Cross-platform: Works on Linux (Wayland/X11), macOS, and Windows using native clipboard tools
Preserves the rows and columns of data copied from Google Sheets, allowing for structured tabular data to be processed correctly.
Formats tabular clipboard content into Markdown tables for clear presentation within a chat interface.
Allows for the retrieval of SVG content from the clipboard as either an image or raw text.
Provides access to raw XML content stored on the system clipboard.
mcp-clipboard
An MCP server that gives your AI assistant direct access to your system clipboard: read what you copied, or write clean text straight to it. Works with any MCP-compatible client, including Claude Code, Claude Desktop, Cursor, Windsurf, and others.
Why This Exists
Pasting loses structure
When you copy cells from Google Sheets or Excel and paste into a chat input, the tabular structure (rows and columns) is destroyed. It arrives as a flat string with no delimiters. The model has to guess where one cell ends and the next begins, and it often guesses wrong.
mcp-clipboard preserves it. Instead of pasting, tell your assistant to "read my clipboard." The server reads the clipboard directly, detects tabular data from the HTML that spreadsheet apps put on the clipboard, and returns it as a properly formatted Markdown table, JSON, or CSV. No structure lost, no guessing.
Bonus: it also fixes copying from Claude Code
Claude Code's terminal renderer adds 2-character padding, hard line breaks at ~80 columns, and trailing whitespace to all output. When you select and copy text from the terminal, those artifacts come along for the ride:
echo "this is a long command that wraps and
breaks when you paste it because of the hard
newlines and leading spaces"This has been reported repeatedly on the claude-code repo (issues #4686, #6827, #7670, #13378, #15199, #25040, #25427, #26016) with dozens of upvotes and no fix shipped.
mcp-clipboard sidesteps the problem entirely. Instead of copying text from the terminal, ask Claude Code to put it on your clipboard:
"Copy that command to my clipboard"
Claude Code calls clipboard_copy, writes the clean text directly to your system clipboard, and you paste it wherever you need it. No padding, no hard wraps, no cleanup.
Tip: To make this automatic, add a line to your project or global CLAUDE.md:
When you produce a shell command for the user to run, also copy it to the clipboard using clipboard_copy.Claude Code will then copy every command it suggests without you having to ask.
Tools
Tool | Description |
| Primary tool. Read any clipboard content: tables, text, code, JSON, URLs, images. Tables are formatted as Markdown/JSON/CSV; pass |
| Write content to the system clipboard. Accepts an optional |
| List what MIME types are currently on the clipboard. |
| Return raw clipboard content for a given MIME type — supports text formats plus |
Setup
Prerequisites
Python 3.11+ and one of: uv (recommended), pipx, or pip.
You also need a platform-specific clipboard tool:
Platform | Tool | Install |
Fedora / RHEL (Wayland) |
|
|
Ubuntu / Debian (Wayland) |
|
|
Linux (X11) |
|
|
macOS | Built-in | No install needed ( |
Windows | Built-in | No install needed (PowerShell) |
Platform status: Linux with Wayland is tested and actively used. X11, macOS, and Windows implementations are complete but untested on real hardware. Bug reports and PRs are welcome.
Claude Code
claude mcp add clipboard --scope user -- uvx mcp-clipboardClaude Desktop
Add to your Claude Desktop config:
Linux:
~/.config/Claude/claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"clipboard": {
"command": "uvx",
"args": ["mcp-clipboard"]
}
}
}Other MCP clients
Any client that supports MCP stdio servers can use mcp-clipboard. The simplest approach is uvx mcp-clipboard. Consult your client's documentation for how to register MCP servers.
Installing from source
If you prefer a local clone instead of installing from PyPI:
git clone https://github.com/cmeans/mcp-clipboard.git
cd mcp-clipboard
uv syncThen point your client at the local install:
{
"mcpServers": {
"clipboard": {
"command": "uv",
"args": [
"run",
"--directory", "/path/to/mcp-clipboard",
"mcp-clipboard"
]
}
}
}Environment variables
Environment variables can be passed via the "env" key in the config.
Variable | Platform | Purpose | Default |
| All | Enable debug logging ( | Off |
| Linux (Wayland) | Compositor socket name or absolute path | Auto-detected |
| Linux (Wayland) | Directory containing the Wayland socket |
|
| Linux | Session type hint ( | Auto-detected via socket scan |
Most Linux users won't need to set any of these. Override if auto-detection fails (multiple compositors, non-standard socket path, or containerized environments).
Usage
Reading your clipboard
Copy anything (spreadsheet cells, code, text, a URL, JSON, an image), then:
"Paste my clipboard"
"Read my clipboard"
"What's on my clipboard?"
"I copied some data, take a look"
Your assistant calls clipboard_paste and returns the content with structure preserved.
Writing to your clipboard
When your agent generates a command, code block, or any text you need to use elsewhere:
"Copy that to my clipboard"
"Put that command on my clipboard"
"Copy that as HTML" (writes
text/htmlso rich-text apps paste with formatting)
The agent calls clipboard_copy and the clean text goes straight to your system clipboard. No terminal rendering artifacts, just clean text. This is especially useful with Claude Code (see above).
Tip: auto-copy behavior. By default the agent only copies to the clipboard when you ask. If you want commands and code blocks copied automatically, add this to your system prompt (e.g. in a Claude Desktop project or Claude Code's CLAUDE.md):
When you output a command or code block that the user is likely to paste elsewhere, proactively copy it to the clipboard using clipboard_copy.
Table output formats
When the clipboard contains tabular data, output_format controls the format:
Format | Destination | What you get |
| Claude, GitHub, most tools | GFM pipe table (default) |
| Notion | GFM pipe table (Notion renders these natively) |
| Slack |
|
| Jira |
|
| Confluence | same as |
| Email, web, rich-text editors |
|
| APIs, code | Array of objects keyed by header row |
| Excel, data tools | Comma-separated values |
Examples:
"Read my clipboard as Slack" →
output_format=slack"Convert my clipboard to Jira table" →
output_format=jira"Give me that as HTML" →
output_format=html
Table schema inference
Add include_schema=true to get a column-type summary alongside the table:
"Read my clipboard with schema"
Inferred types: integer, float, currency, percentage, date, boolean, text. Uses majority-wins per column — if no type accounts for more than half the non-empty cells, the column is typed as text. Empty cells are skipped; the header row is excluded from inference.
This is useful when handing tabular data to Claude for SQL CREATE TABLE statements, Pandas dtype mappings, or validation rules — Claude gets the types upfront instead of guessing from the data.
Tips for reliable triggering
The server includes MCP instructions that tell the client when to use the clipboard tools, but results vary by model and client. If the agent doesn't pick up on your intent, be explicit: "copy that to my clipboard" or "read what I copied" work most reliably.
If you have access to a custom system prompt (e.g. in a Claude Desktop project or a custom agent), you can reinforce the behavior:
When the user asks to copy output, use clipboard_copy to write it to the system clipboard. When the user references data not in the conversation, check the clipboard using clipboard_paste.
Content handling
Content type | What happens |
Spreadsheet table | Parsed from HTML/TSV, returned in your choice of format (Markdown, JSON, CSV, Slack, Jira, HTML, Notion) |
JSON | Pretty-printed in a JSON code block |
Code | Returned in a fenced code block |
URL | Returned cleanly as a URL |
Rich HTML (no table) | HTML tags stripped, readable text returned |
RTF | Returned in a fenced code block (macOS, Windows, and Wayland/X11 via pass-through) |
Plain text | Returned as-is |
Images (PNG, etc.) | Returned as an MCP image content block the model can see and analyze |
SVG | Readable as text via |
Audio / video | Not supported; returns a message identifying the format |
How It Works
Platform detection: At startup, the server detects your clipboard backend (Wayland, X11, macOS, or Windows) and selects the appropriate system commands.
Reading (
clipboard_paste): Calls the platform's clipboard read command. Triestext/htmlfirst (Google Sheets and Excel put<table>markup on the clipboard), parses with Python's built-inhtml.parser. Falls back totext/plaintab-separated values, thentext/rtf, then checks for images.Writing (
clipboard_copy): Pipes text to the platform's clipboard write command (wl-copy,xclip -selection clipboard,pbcopy, or PowerShellSet-Clipboard). Supports amime_typeparameter for writing typed content (e.g.text/html,text/rtf).Image passthrough: If the clipboard contains an image (PNG, etc.), it's returned as a base64-encoded MCP image content block that the model can see and analyze.
Content classification: Non-tabular text content is classified as JSON, URL, code, or plain text and returned with appropriate formatting (pretty-printed JSON, fenced code blocks, etc.).
Limitations
Audio and video are not supported. If the clipboard contains audio or video, the server reports the format but cannot return the content.
Clipboard write supports text MIME types only.
clipboard_copycan writetext/plain,text/html, andtext/rtf. Writing images or other binary data is not supported.Writing multiple MIME types atomically is not supported on Wayland/X11. For example, writing both
text/htmlandtext/plainin a single clipboard operation requires owning the clipboard selection across calls.Text content is truncated at 50KB to avoid overwhelming the model's context window.
X11, macOS, and Windows are untested on real hardware. Implementations are complete and should work, but edge cases are possible. Bug reports and PRs are welcome.
Development
# Install with dev dependencies
uv sync --extra dev
# Run tests
uv run pytest
# Run the server directly (stdio mode)
uv run mcp-clipboard
# Run with debug logging
uv run mcp-clipboard --debug
# Test with MCP Inspector
uv run mcp dev src/mcp_clipboard/server.pyDebug logging can also be enabled via MCP_CLIPBOARD_DEBUG=1, which is useful when the server is launched by Claude Desktop or Claude Code.
Project structure
mcp-clipboard/
├── src/mcp_clipboard/
│ ├── __init__.py # Package version
│ ├── server.py # MCP server, tool definitions, debug logging
│ ├── clipboard.py # Platform-agnostic clipboard backend
│ ├── parser.py # HTML table parser, formatters, content detection
│ ├── instructions/ # Tool and server descriptions (loaded at startup)
│ │ ├── server.md
│ │ ├── clipboard_copy.md
│ │ ├── clipboard_paste.md
│ │ ├── clipboard_read_raw.md
│ │ └── clipboard_list_formats.md
│ └── icons/ # SVG icons for MCP client display (light/dark)
│ ├── mcp-clipboard-logo-light.svg
│ └── mcp-clipboard-logo-dark.svg
├── tests/
│ ├── test_parser.py # Parser and formatter tests
│ └── test_server.py # Server, backend, and Wayland detection tests
├── .github/
│ ├── workflows/
│ │ ├── publish.yml # PyPI publish on v* tags (OIDC trusted publisher)
│ │ └── test-publish.yml # TestPyPI publish on test-v* tags
│ └── ISSUE_TEMPLATE/ # Bug report, feature request, platform test forms
├── pyproject.toml
├── CHANGELOG.md
├── CLAUDE.md # Claude Code project guidance
├── glama.json # Glama MCP registry metadata
├── LICENSE # Apache 2.0
└── README.mdAcknowledgments
This project was designed and built in collaboration with Claude Code (Anthropic's CLI for Claude). Architecture, design decisions, and release management were driven by the human; implementation, testing, code review, and documentation were delegated conversationally, with Claude writing code, catching stale docs, and filling test coverage gaps across every commit.
License
Apache 2.0. See LICENSE.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cmeans/clipboard-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server