explaingit

daizisheng/cc-paste

0JavaScriptAudience · developerComplexity · 3/5ActiveSetup · moderate

TLDR

Bridges your Mac clipboard into a Claude Code session running on a remote Linux server over SSH, so Ctrl+V pastes images, not just text.

Mindmap

mindmap
  root((cc-paste))
    Inputs
      Mac clipboard
      Claude Code xclip calls
      SSH reverse tunnel
    Outputs
      Image bytes to server
      Pasted screenshots
    Use Cases
      Paste screenshots into remote CC
      Share clipboard over SSH
      Avoid scp for quick images
    Tech Stack
      Node.js
      Bash
      SSH
      pbpaste

Things people build with this

USE CASE 1

Paste Mac screenshots straight into Claude Code running on a remote Linux box

USE CASE 2

Forward your local clipboard to a dev server through an SSH reverse tunnel

USE CASE 3

Shim a fake xclip on a headless server so tools that probe X11 keep working

Tech stack

Node.jsJavaScriptBashSSHcurl

Getting it running

Difficulty · moderate Time to first run · 30min

Needs an SSH reverse tunnel on port 9999 plus a PATH shim and DISPLAY=:0 on the server before Claude Code will find the fake xclip.

In plain English

cc-paste is a small bridge that lets you paste images from your Mac clipboard into a Claude Code session that is actually running on a remote server over SSH. The problem it solves is specific. When you press Ctrl+V inside Claude Code on a Linux box, the tool tries to read the clipboard by calling xclip. In an SSH session there is no X server, so that call fails, and only plain text gets through via the terminal's bracketed-paste mode. Images never make it. The fix has two parts. On the Mac side, a tiny Node.js daemon called clipd.js listens on 127.0.0.1 port 9999 and serves whatever is on the local clipboard over HTTP, using pbpaste and osascript to fetch text and image bytes. On the server side, you drop a fake xclip script onto your PATH. When Claude Code calls xclip to ask what types are on the clipboard or to read an image, the fake script answers by curling the Mac daemon through an SSH reverse tunnel. Setup is three steps. First, clone the repo on your Mac and run node clipd.js, leaving it open. Second, open the SSH connection with reverse port forwarding so the server can reach the Mac daemon: ssh -R 9999:127.0.0.1:9999 user@server, which the README suggests pinning into ~/.ssh/config as a RemoteForward entry. Third, on the server, curl the fake xclip into ~/fake-bin, mark it executable, put that folder at the front of PATH, and set DISPLAY=:0 so callers think an X server is around. After that, Ctrl+V inside Claude Code pastes the same thing it would on your Mac, images included. The README is honest about the limits. The daemon is macOS only because it relies on pbpaste and osascript; a Linux or Windows port would need different commands. Text paste is unaffected because it never went through xclip in the first place. The fake xclip implements only the read paths Claude Code uses, with writes left as no-ops. The reverse tunnel binds to localhost on the server, so other users on the same machine cannot reach your clipboard. Logs are written to /tmp/clip.log on the server and to clipd.js stdout on the Mac.

Copy-paste prompts

Prompt 1
Walk me through setting up cc-paste on my Mac and a remote Ubuntu server so Ctrl+V works in Claude Code over SSH
Prompt 2
Port the cc-paste clipd.js daemon from macOS pbpaste to Linux using wl-paste or xclip as the source
Prompt 3
Add image write support to the fake xclip in cc-paste so I can copy from remote CC back to my Mac clipboard
Prompt 4
Harden the cc-paste SSH reverse tunnel so only my user on the server can hit port 9999
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.