clipboard-mcp-server
Enables reading, writing, and inspecting the system clipboard on Linux, with support for X11 via xclip and Wayland via wl-clipboard, including semantic format mapping and size limits.
Enables reading, writing, and inspecting the system clipboard on macOS, supporting text, HTML, RTF, and PNG image formats via native clipboard utilities.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Overview
The system clipboard across macOS, Linux (X11/Wayland), and Windows. Read, write, and inspect text, HTML, RTF, and image content.
Tools
Tool | Description |
| Read clipboard contents in a specified format (text, HTML, RTF, image, or auto-select richest) |
| Write plain text or HTML to the clipboard, replacing current contents, or clear it outright |
| List available clipboard formats and byte sizes without reading full content |
Related MCP server: mcp-clipboard
Capability reference
clipboard_read tool
Read
text,html,rtf, orimage;autoselects the richest present format (image > html > rtf > text). Whole-read limits: 512 KB text/HTML/RTF, 5 MB imageReturns
format,content, byte sizes,complete, andrepresentationId; images are base64 PNG with optionalwidth/height. Failures carryformat_unavailable,content_too_large,representation_changed,clipboard_unavailable, orinspect_unreadableFor larger values, use byte
offset/limit(minimum limit 4, capped per format), then pass eachnextOffsetasoffsetalong withrepresentationIduntil complete. Image slices are byte chunks: decode each separately and concatenate in order; only a whole image attaches an image block
clipboard_write tool
Supply non-empty
contentorclear: true, exclusively;formatacceptstextorhtml, with a 1 MB write limit. HTML gets a stripped plain-text fallback on macOS/Windows; Linux plain-text pastes can receive markupReturns
format/byteSize, orcleared: truewith zero bytes; optionalpreviousContentholds prior plain text within the 512 KB read limit. Failures carrycontent_too_largeorclipboard_unavailable; X11 clear requiresxselCLIPBOARD_READ_ONLYdisables both writes and clears by removing the tool fromtools/list
clipboard_inspect tool
Returns
primaryFormat(image > html > rtf > text, orempty) andavailableFormatsfor choosing a read formatrawTypeslists platform identifiers with measuredbytes, ormeasurementFailedwhen unreadable. Failures carryinspect_unreadableorclipboard_unavailable
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Clipboard-specific:
Cross-platform backend detection at startup — macOS (osascript/JXA), Linux X11 (xclip), Linux Wayland (wl-clipboard), Windows (PowerShell 5.1+)
Semantic format mapping — platform-native type identifiers (UTIs, TARGETS, Windows format names) mapped to
text,html,rtf,imageacross all backendsPlatform-aware HTML writes — macOS and Windows publish HTML plus a stripped plain-text fallback; on Linux the HTML is the only payload, which plain-text paste targets can also receive
Image support — every backend returns PNG as base64, with width/height when the returned bytes carry a readable PNG header (Linux backends read them from that header, so only a whole image or a slice starting at offset 0 has them)
Agent-friendly output:
Size-guarded I/O — reads and writes over the format limit fail with a typed
content_too_largeerror carrying byte/limit metadata, rather than truncating silentlyBounded continuation —
clipboard_readslices oversized content withoffset/limitandnextOffsetinstead of forcing a single all-or-nothing read, andrepresentationIdmakes a clipboard change between slices fail loudly instead of splicing two values togetherUndo support —
clipboard_writereturnspreviousContentso an unintended overwrite can be revertedDiscriminated failure —
format_unavailable,content_too_large,representation_changed,inspect_unreadable, andclipboard_unavailableare typed reasons with recovery hints, not generic errors; each backend classifies its helper's outcomes itself (across wl-clipboard and xclip release spellings), so an empty clipboard, an absent format, and an unreachable helper never blur together
Getting started
Add it to Claude Code:
claude mcp add clipboard-mcp-server -- npx -y @cyanheads/clipboard-mcp-serverFor other clients, add this to the MCP config file:
{
"mcpServers": {
"clipboard-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/clipboard-mcp-server"]
}
}
}Linux needs a clipboard helper installed first — see Prerequisites. For a source build or Streamable HTTP, see Running the server.
Configuration
Variable | Description | Default |
| Transport: |
|
| Port for HTTP server. |
|
| Hostname for HTTP server. |
|
| Endpoint path for the HTTP server. |
|
| Max inbound JSON-RPC request body, in bytes. Raised above the framework's 1 MiB default so a full-size |
|
| HTTP session mode: |
|
| Auth mode: |
|
| Log level ( |
|
| Log failed tool arguments/results, capped at |
|
| Enable OpenTelemetry instrumentation. |
|
| Serve the clipboard read-only. When |
|
See .env.example for the full list of optional overrides.
Running the server
Prerequisites
Requires Bun v1.4.0 or higher (or Node.js v24+), plus the platform's clipboard helper:
macOS: No additional tools required — osascript is built in.
Linux X11: xclip must be installed. xsel is additionally required for clipboard_write's clear mode — it is the only one of the two that can hand the selection back rather than owning an empty one.
apt install xclip xsel # Debian/Ubuntu
pacman -S xclip xsel # ArchLinux Wayland: wl-clipboard must be installed.
apt install wl-clipboard # Debian/Ubuntu
pacman -S wl-clipboard # ArchWindows: PowerShell 5.1+ (built-in on Windows 10 and later).
Local development
Clone and install:
git clone https://github.com/cyanheads/clipboard-mcp-server.git cd clipboard-mcp-server && bun installBuild and run:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:http # listens at http://127.0.0.1:3010/mcpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Project structure
Path | Purpose |
| Entry point — registers tools via |
| Tool definitions: |
| Platform backends (macOS, Linux X11, Wayland, Windows) and service facade |
| Vitest tests for tools and backends |
| Agent workflow skills (add-tool, field-test, polish-docs-meta, etc.) |
Development guide
See CLAUDE.md for the full developer protocol — tool patterns, service patterns, error handling, logging conventions, and the checklist for shipping changes. The short version:
Handlers throw, framework catches — tool logic catches only to act on a backend's typed outcome: map it to a declared error reason, or move
autoon to the next formatUse
ctx.logfor request-scoped loggingNo Docker — this server needs direct host OS access (JXA/NSPasteboard, xclip, wl-clipboard, PowerShell), none of which work inside a container
Contributing
Issues welcome at github.com/cyanheads/clipboard-mcp-server. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache 2.0 — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Read and write shared BitsWeave context, projects, tasks, and work sessions through MCP.
Shared memory and actions for Claude, Kiro, OpenAI, Cursor, and other MCP-compatible AI clients.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Related MCP Servers
- AlicenseAqualityFmaintenanceProvides tools for reading and writing system clipboard data across Linux, macOS, Windows, and WSL platforms.2AGPL 3.0
- AlicenseAqualityAmaintenanceMCP server that reads and writes the system clipboard — tables, text, code, JSON, URLs, images, and more. Preserves spreadsheet structure (rows/columns) that is lost when pasting into Claude directly.782 PyPI4Apache 2.0
- FlicenseBqualityDmaintenanceProvides MCP tools to copy text to and paste text or images from the macOS clipboard using AppleScript.31-
- AlicenseNot gradedqualityDmaintenanceMCP server that gives AI agents access to your Maus clipboard on macOS, enabling them to write clean text into history, search, and manage clipboard items locally.4 npmMIT