
Clipboard Mcp Server
io.github.cyanheads由 GitHub 账号 cyanheads 发布v0.3.0更新于 Oct 29, 2026
Read, write, and inspect the system clipboard on macOS, Linux (X11/Wayland), and Windows via MCP.
概览
本地 MCP 服务器,让助手在 macOS、Linux 和 Windows 上读取、写入和查看系统剪贴板。
- 可以做什么
- 以文本、HTML、RTF 或图片格式读取剪贴板内容,可自动选择最丰富的格式,并对大内容按 offset/limit 分段读取
- 向剪贴板写入纯文本或 HTML 以替换当前内容,或直接清空
- 查看当前可用的剪贴板格式及各自字节大小,而无需读取完整内容
- 写入后返回此前的纯文本,便于撤销意外的覆盖
- 适用场景
- 适合在自己的桌面上让助手在剪贴板与对话之间搬运内容,例如把复制的文本或图片交给助手处理,或把生成的文本、HTML 放到剪贴板以便粘贴到别处。
- 运行要求
- 通过 npx 作为本地进程运行(需 Bun 1.4.0+ 或 Node.js 24+)。需要平台剪贴板工具:macOS 自带 osascript;Linux X11 需 xclip(清空还需 xsel);Linux Wayland 需 wl-clipboard;Windows 需 PowerShell 5.1+。可选变量涉及传输方式、HTTP 主机/端口/路径、认证模式、日志级别和只读模式。
安装
在 SourceWeft 中
- 打开 控制台中的 Clipboard Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@cyanheads/clipboard-mcp-server
Read, write, and inspect the system clipboard across macOS, Linux (X11/Wayland), and Windows via MCP. STDIO or Streamable HTTP.
Overview
The system clipboard across macOS, Linux (X11/Wayland), and Windows. Read, write, and inspect text, HTML, RTF, and image content.
Tools
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 image - Returns
format,content, byte sizes,complete, andrepresentationId; images are base64 PNG with optionalwidth/height. Failures carryformat_unavailable,content_too_large,representation_changed,clipboard_unavailable, orinspect_unreadable - For 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 markup - Returns
format/byteSize, orcleared: truewith zero bytes; optionalpreviousContentholds prior plain text within the 512 KB read limit. Failures carrycontent_too_largeorclipboard_unavailable; X11 clear requiresxsel CLIPBOARD_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 format rawTypeslists 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 backends - Platform-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 silently - Bounded 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 together - Undo support —
clipboard_writereturnspreviousContentso an unintended overwrite can be reverted - Discriminated 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:
For other clients, add this to the MCP config file:
Linux needs a clipboard helper installed first — see Prerequisites. For a source build or Streamable HTTP, see Running the server.
Configuration
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.
Linux Wayland: wl-clipboard must be installed.
Windows: PowerShell 5.1+ (built-in on Windows 10 and later).
Local development
-
Clone and install:
-
Build and run:
-
Run checks and tests:
Project structure
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 format - Use
ctx.logfor request-scoped logging - No 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:
License
Apache 2.0 — see LICENSE.
来源:README.md,提交 047799a
工具
0版本历史
5- v0.3.0最新Oct 29, 2026
- v0.2.6Oct 7, 2026
- v0.2.5Sep 25, 2026
- v0.2.2Sep 20, 2026
- v0.2.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分