Claude-Utils π
Cross-platform clipboard bridge for Claude Code CLI, enabling seamless image and text pasting in terminals.
Author: josharsh
License: MIT
The Problem
Claude Code users cannot paste screenshots or images directly into the terminal using standard keyboard shortcuts (βV/Ctrl+V). Current workarounds require saving files and drag-dropping, breaking the keyboard-centric workflow.
The Solution
Claude-Utils provides a transparent clipboard bridge that:
- π― Just Worksβ’: Press βV/Ctrl+V to paste anything into Claude Code
- πΌοΈ Image Support: Automatically stages images and provides file paths
- π Text Support: Handles text up to 64KB inline
- π Secure: Local-only with token authentication
- π Cross-Platform: macOS, Linux, and Windows support
- β¨ Watch Mode: Automatically converts copied images to paths for seamless pasting
Quick Start
Installation
# macOS (coming soon)
# Install from crates.io
# Build from source
Basic Usage
Standard Mode
- Start the daemon:
- Configure Claude Code and set token as shown
- In Claude Code: "Analyze the image in my clipboard"
Watch Mode (Recommended) π―
- Start with watch mode:
- Copy any image (screenshot, etc.)
- Image automatically saved to
~/Desktop/claude-paste.png - Press βV in terminal β path appears!
- Original image still available for other apps
The magic: When you copy an image, claude-utils:
- Saves it to a timestamped file
- Creates a symlink on your Desktop
- Sets clipboard to the file path (for terminal)
- Preserves original image (for other apps)
Features
Clipboard Bridge
- Automatic Detection: Detects content type (text/image)
- Smart Staging: Large content automatically saved to temp files
- Deduplication: Same content won't be staged twice
- Auto-Cleanup: Old files cleaned up after 15 minutes
MCP Server
- Full Model Context Protocol implementation
- JSON-RPC 2.0 compliant
- Server-Sent Events (SSE) support for real-time updates
- Tools:
clipboard.get,clipboard.set
Security
- Runs on localhost only (127.0.0.1:3830)
- Token-based authentication
- Read-only by default (use
--writeflag for clipboard writes) - Secure file permissions (0600 for tokens)
Advanced Usage
CLI Commands
# Start with watch mode (recommended!)
# Watch mode with custom options
# Start with custom port
# Disable authentication (development only)
# Enable clipboard write operations
# Custom staging directory
# Show authentication token
# Quick clipboard operations
Watch Mode Options
MCP Integration
The server exposes these tools for Claude Code:
Architecture
Claude Code <---> MCP Client <---> claude-utils-clipd <---> System Clipboard
| |
JSON-RPC File Staging
+ SSE |
/tmp/claude-utils/
Platform Notes
macOS
- Full support for text and images
- Uses native NSPasteboard API
Linux
- X11 and Wayland support (via arboard)
- May require
xcliporwl-clipboardpackages
Windows
- Native Win32 clipboard API
- WSL2 users: Bridges Windows clipboard to WSL
Building from Source
# Prerequisites
|
# Clone and build
# Binary will be at ./target/release/claude-utils
Troubleshooting
"Authentication required" error
- Ensure
CLAUDE_UTILS_TOKENenvironment variable is set - Check token with:
claude-utils token
Images not pasting
- Check if daemon is running:
curl http://localhost:3830/health - Verify clipboard has image content:
claude-utils clip get
Permission denied errors
- Ensure staging directory is writable
- Check file permissions on
~/.claude-utils/auth.token
Future Roadmap
- Terminal paste interception (the "magic" experience)
- Screenshot capture endpoint
- OCR capabilities
- Clipboard history
- Multi-agent orchestration support
Contributing
Contributions welcome! Please read our Contributing Guide.
License
MIT License - see LICENSE file.
Acknowledgments
Built with:
- arboard - Cross-platform clipboard
- axum - Web framework
- Model Context Protocol - MCP specification
Made with β€οΈ for the Claude Code community