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.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@clipboard-mcp-serverread the clipboard contents"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tools
3 tools for reading, writing, and inspecting the system clipboard:
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 |
clipboard_read
Read the current clipboard contents in a requested format.
automode returns the richest format explicitly present — priority: image > html > rtf > textimagereturns base64-encoded PNG data, with pixel dimensions on every platform whenever the capture carries a readable PNG headerhtmlreturns raw HTML source as copied from a browserrtfreturns raw RTF markuptextreturns plain textSize limits: 512 KB for text/HTML/RTF, 5 MB for images (raw bytes before base64 expansion)
Content above the size limit is retrieved in slices with
offset/limitinstead of erroring outright: pass both to read a bounded window (limitis at least 4 and clamped to the format's size limit) and follow the returnednextOffsetuntilcompleteistrue. Every response carriestotalByteSizeandcomplete; text/HTML/RTF slices never split a multi-byte UTF-8 sequence. Omitting both reads the whole payload as before, still bounded by the size limitReturns a typed
format_unavailableerror when the requested format is not on the clipboard — useclipboard_inspectfirst to check availabilityReturns a typed
content_too_largeerror only when nooffset/limitwas given and the content exceeds the size limit; the recovery hint points at the slicing parameters above
clipboard_write
Write content to the clipboard, replacing current contents — or clear it.
textwrites plain texthtmlwrites HTML; macOS and Windows also publish an auto-generated, tag-stripped plain-text fallback, while Linux X11 and Wayland publish onlytext/htmlclear: trueremoves every representation instead of writing, so a followingclipboard_inspectreportsprimaryFormat: "empty". It returnscleared: true,byteSize: 0, and noformat. On Linux X11 this needsxselalongsidexclip— see PrerequisitesSupply exactly one of
contentorclear: true. Omitting both, sending an emptycontent, or combining the two is rejected as invalid arguments rather than silently writing a zero-byte representationReturns
previousContent— the plain text that was on the clipboard immediately before the write or clear, so an unintended overwrite can be undone by writing it back. Absent when the clipboard was empty, held no text representation, or its text exceeded the 512 KB read limitSize limit: 1 MB
destructiveHint: true— replaces or removes whatever is currently on the clipboardNot registered when
CLIPBOARD_READ_ONLYis set, which gates clearing along with writing — see Configuration
clipboard_inspect
List the formats and byte sizes of what is currently on the clipboard without reading the full content.
Returns
primaryFormat— the richest format present (image > html > rtf > text), oremptyReturns
availableFormats— all semantic formats present, for deciding which format to pass toclipboard_readReturns
rawTypes— all raw platform type identifiers with byte sizes (UTIs on macOS, TARGETS on X11/Wayland, format names on Windows). An entry whose size could not be measured carriesmeasurementFailed: trueand nobytes, so a failed measurement is never reported as a zero-byte representationReturns a typed
inspect_unreadableerror when the platform helper's output cannot be read, instead of reporting an empty clipboardUse this before
clipboard_readto avoidformat_unavailableerrors and to check content size before reading
Related MCP server: mcp-clipboard
Features
Built on @cyanheads/mcp-ts-core:
Declarative tool definitions — single file per tool, framework handles registration and validation
Unified error handling across all tools
Pluggable auth (
none,jwt,oauth)Structured logging with optional OpenTelemetry tracing
Runs locally via stdio or HTTP from the same codebase
Clipboard-specific:
Cross-platform backend detection at startup — macOS (pbcopy/pbpaste + osascript), 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 backendsSize-guarded reads and writes — typed
ContentTooLargeErrorwith byte/limit metadata before content returnsPlatform-aware HTML writes — macOS and Windows publish HTML plus a stripped plain-text fallback; Linux X11 and Wayland publish
text/htmlImage support — macOS and Windows backends decode PNG bytes and return width/height alongside base64 content
Getting started
Add the following to your MCP client configuration file.
{
"mcpServers": {
"clipboard-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/clipboard-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"clipboard-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/clipboard-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
macOS: No additional tools required — pbcopy, pbpaste, and osascript are 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).
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 ( |
|
| Enable OpenTelemetry instrumentation. |
|
| Serve the clipboard read-only. When |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
# One-time build
bun run rebuild
# Run the built server
bun run start:stdio
# or
bun run start:httpChecks and tests
bun run devcheck # Lint, format, typecheck, security
bun run test # Vitest test suiteProject 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.
Contributing
Issues and pull requests welcome at github.com/cyanheads/clipboard-mcp-server.
License
Apache 2.0 — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared memory and actions for Claude, Kiro, OpenAI, Cursor, and other MCP-compatible AI clients.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Read and write Mission Control state via MCP — projects, tasks, subtasks, templates, status updates.
- mcpOAuthai.butlerbrain
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Related MCP Servers
- AlicenseAqualityFmaintenanceProvides tools for reading and writing system clipboard data across Linux, macOS, Windows, and WSL platforms.2AGPL 3.0
- AlicenseAqualityBmaintenanceMCP 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.424 PyPI5Apache 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.6 npmMIT