
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 分