Skip to main content
Glama
clipboard-mcp

clipboard-mcp

by Olivia-y-l

📋 clipboard-mcp

Your agent can't see what you just copied. This fixes that.

An MCP server that gives any local agent five tools: read the clipboard, write to it, search a bounded clipboard history, clear it deliberately, and check its own status. Everything stays on your machine over stdio — no cloud, no API key, no telemetry.

clipboard-mcp overview

Why

The clipboard is where the interesting context lives: the stack trace you copied, the URL from a ticket, a JSON payload, a SQL query. You paste it into the chat anyway — but often you say "look at what I copied" and the agent has nothing.

clipboard-mcp adds that missing sense. It also keeps a small searchable history, so "the URL from earlier" becomes answerable without scrolling through chat.

Related MCP server: mindmap-mcp-server

Install

git clone https://github.com/Olivia-y-l/clipboard-mcp.git
cd clipboard-mcp
npm install

Requires Node 20+ (the MCP SDK's HTTP transport pulls a Hono server that needs Node 20). On Linux, clipboardy uses xsel (a bundled fallback is included, but installing xsel is the reliable path); X11 is expected.

You do not run this in a terminal — your MCP client spawns it. For a manual check:

node bin/clipboard-mcp.js    # speak JSON-RPC on stdio; Ctrl+C to stop

Configure your client

Claude Desktop (claude_desktop_config.json), Cursor (.cursor/mcp.json) and most MCP clients use the same shape:

{
  "mcpServers": {
    "clipboard": {
      "command": "node",
      "args": ["/absolute/path/to/clipboard-mcp/bin/clipboard-mcp.js"]
    }
  }
}

Windows: use forward slashes in the path and make sure node is on PATH:

"args": ["C:/Users/you/clipboard-mcp/bin/clipboard-mcp.js"]

Restart the client and the tools appear as read_clipboard, write_clipboard, clipboard_history, clear_clipboard_history, clipboard_stats.

Tools

Tool

Arguments

What it does

read_clipboard

–

Returns the current clipboard text and records it. Truncates at 20k chars.

write_clipboard

text

Replaces the clipboard, so the user can paste elsewhere.

clipboard_history

limit (1–100, default 10), query, since, full

Searches entries captured while the server runs. since takes ISO or 30m / 6h / 2d / 1w.

clear_clipboard_history

confirm

Deletes stored history. Refuses unless confirm: true; current clipboard is untouched.

clipboard_stats

–

Entry count, storage path, poll interval, platform.

Example prompts that now work:

  • "Read the error I just copied and explain it."

  • "Find the API URL I copied this morning." → clipboard_history({ query: "api", since: "12h" })

  • "Put this migration SQL on my clipboard." → write_clipboard

  • "Why isn't the clipboard tool working?" → clipboard_stats

History and privacy

History is on by default and captures text copies every 1.5 seconds while the server is running. Treat this as a real privacy decision.

  • Stored at ~/.clipboard-mcp/history.json (override with CLIPBOARD_MCP_DIR).

  • Plain text JSON. Mode 0600 on POSIX; Windows ACLs are best effort.

  • 500 entries, 20,000 characters each, consecutive duplicates collapsed.

  • The current clipboard is captured when the server starts.

  • Passwords, tokens and one-time codes can end up in this file. If you use a password manager, consider running the server only when needed, or disabling history.

Disable history entirely:

"env": { "CLIPBOARD_MCP_HISTORY": "off" }

With history off, no file is created and nothing is captured in the background. The tools still work; clipboard_history only sees what those tools touched in the current session.

Other settings:

Variable

Default

Meaning

CLIPBOARD_MCP_DIR

~/.clipboard-mcp

data directory

CLIPBOARD_MCP_POLL_MS

1500

poll interval, minimum 250

CLIPBOARD_MCP_LIMIT

500

max stored entries

CLIPBOARD_MCP_MAX_CHARS

20000

per-entry cap

CLIPBOARD_MCP_HISTORY

on

set to off to disable capture and persistence

clear_clipboard_history only clears this server's file. Your OS clipboard and any clipboard manager you already use are separate.

How it works

OS clipboard ──poll 1.5s──▶ ClipboardStore (JSON, bounded)
                                  â–²
agent ◀──stdio JSON-RPC──▶ MCP server ──read/write──▶ clipboardy
  • src/server.js — tool registration and text formatting.

  • src/store.js — dedupe, truncation, atomic writes, search.

  • src/watcher.js — polling loop that survives clipboard errors and never writes to stdout.

  • bin/clipboard-mcp.js — wiring, env config, graceful shutdown.

Polling is a deliberate trade-off: no native dependencies or platform-specific event APIs, at the cost of missing two copies that happen within the same interval. stdout is reserved for the protocol; all logs go to stderr.

Tests

npm test

22 tests cover storage (persistence, dedupe, caps, corrupt files, private permissions), the watcher (errors, repeats, timer lifecycle), and every tool over a real in-memory MCP client/server pair.

Limitations

  • Text only. Images and files are not captured.

  • History is not encrypted at rest; it relies on OS file permissions.

  • Polling can miss very fast consecutive copies.

  • Password managers that mark clipboard data as secret are not detected; their copies may still be recorded as text.

License

MIT.

Available Tools

5 tools
clear_clipboard_historyClear clipboard historyA
Destructive

Delete all stored clipboard history. Requires confirm=true. This does not change the current clipboard contents. Destructive and irreversible.

Inputs: confirm.

clipboard_historySearch clipboard historyA
Read-only

List or search clipboard entries captured while this server was running, newest first. Use when the user refers to something copied earlier ("the URL from before", "that JSON I copied") without pasting it.

Inputs: full, limit, query, since.

clipboard_statsClipboard server statusA
Read-only

Show clipboard history size, storage path and polling configuration. Use for troubleshooting an MCP setup.

Inputs: no named parameters.

read_clipboardRead clipboardA

Read the current text on the system clipboard. Use this when the user says "look at what I copied", "the error I just copied", or pastes something without including it. The read is also recorded in local history.

Inputs: no named parameters.

write_clipboardWrite clipboardA

Replace the system clipboard with text, so the user can paste it elsewhere. Use for code snippets, commands or links the user explicitly wants copied.

Inputs: text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 5 tools

    Disambiguation4/5

    read_clipboard vs write_clipboard vs clipboard_history are clearly separable by action and target, and clear_clipboard_history is explicitly distinguished from modifying the live clipboard. The only mild overlap is clipboard_history vs clipboard_stats, since both inspect stored history, but their descriptions (entries vs size/path/config) differentiate them adequately.

    Naming Consistency4/5

    Three tools follow a verb_noun pattern (read_clipboard, write_clipboard, clear_clipboard_history) while two use a bare noun prefix (clipboard_history, clipboard_stats). It's readable and clearly domain-scoped, but the verb-first vs noun-first split is a minor deviation rather than a single convention.

    Tool Count5/5

    Five tools map cleanly onto the clipboard domain: read, write, browse history, purge history, and diagnose. Nothing feels redundant or padded, and no obvious operation was merged into an overloaded tool.

    Completeness4/5

    The surface covers the full lifecycle for a clipboard helper: capture, read, review, delete and inspect. Minor gaps exist—no way to delete a single history entry, and no explicit clear_clipboard for the live clipboard (as opposed to history)—but agents can work around both.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A local-first MCP server that provides AI agents with safe codebase access through file discovery, hybrid lexical-semantic search, and project introspection. It features durable local memory and semantic indexing while keeping all data and processing entirely on your local machine.
      74
      44 npm
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A lightweight, stdio-based MCP server enabling AI assistants to perform local file system operations like reading, writing, searching, and executing commands.
      5,198 npm
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Local MCP server that lets your AI coding agent query its own cross-tool project history - file/command freshness, past test failures, cost & token spend, cache status, and session handoff - over stdio, 100% local, no telemetry.
      66
      -