Skip to main content
Glama
Clipboard to Supabase MCP Helper

Clipboard to Supabase MCP Helper

剪贴板到 Supabase MCP 助手

监视系统剪贴板的本地代理,将任何复制的图像上传到 Supabase Storage,然后将公共(或签名)URL 写回剪贴板。

特征

  • 零点击图片托管:复制图片,立即获取 URL

  • 低延迟:从复制到 URL 不到 800 毫秒

  • 跨平台:适用于 macOS、Windows 和 Linux

  • MCP 集成:将剪贴板图像上传公开为 MCP 端点

  • 自动启动:配置为在系统启动时运行

  • 高效检测:基于哈希的重复数据删除,CPU 使用率低

Related MCP server: openai-gpt-image-1-mcp

先决条件

  • Node.js 18+

  • 已启用存储的 Supabase 帐户

  • 特定于平台的依赖项:

    • macOS: pngpaste ( brew install pngpaste )

    • Windows/Linux:本机操作系统剪贴板访问

安装

  1. 克隆存储库:

git clone https://github.com/martinbowling/clipboard-to-supabase-mcp-helper.git
cd clipboard-to-supabase-mcp-helper
  1. 安装依赖项:

npm install
  1. 根据.env.example创建.env文件:

SUPABASE_URL=https://<project>.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
BUCKET=media
MCP_PORT=3333
  1. 测试您的 Supabase 连接:

npm run test:supabase
  1. 构建项目:

npm run build
  1. 安装为系统服务:

对于 macOS:

npm run install:macos

对于 Linux:

npm run install:linux

对于 Windows:

npm run install:windows

用法

一旦安装并运行,该助手将:

  1. 监视剪贴板上的图像变化(每 300 毫秒轮询一次)

  2. 将任何复制的图像上传到您的 Supabase 存储桶

  3. 将公共 URL 放回剪贴板,准备粘贴

运行服务

剪贴板助手可以以两种模式运行:

标准输入输出模式(默认)

npm start

这将使用 StdioServerTransport 运行 MCP 服务器,非常适合命令行使用。

HTTP 模式

npm run start:http

这将在端口 3333(可配置)上运行一个 Express HTTP 服务器,并具有适当的 REST API 端点。

MCP 集成

该助手公开以下 MCP 端点:

上传剪贴板图像

使用 HTTP 服务器模式:

POST http://localhost:3333/mcp

请求正文:

{
  "id": "1",
  "jsonrpc": "2.0",
  "method": "tool",
  "params": {
    "name": "upload_clipboard_image",
    "input": {}
  }
}

回复:

{
  "id": "1",
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "https://your-project.supabase.co/storage/v1/object/public/media/clips/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.png"
      }
    ]
  }
}

清理旧文件

该助手还提供一个 MCP 端点来手动触发旧文件的清理。

请求正文:

{
  "id": "1",
  "jsonrpc": "2.0",
  "method": "tool",
  "params": {
    "name": "cleanup_old_files",
    "input": {
      "days": 30
    }
  }
}

回复:

{
  "id": "1",
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Cleanup completed: Deleted 5 files older than 30 days. Failed: 0."
      }
    ]
  }
}

days参数是可选的。如果未提供,则将使用RETENTION_DAYS环境变量中的值。

工作原理

  1. 变化检测:每 300 毫秒轮询剪贴板并计算图像数据的 SHA-1 哈希值

  2. 重复数据删除:仅根据哈希比较处理新的或更改的图像

  3. 平台适配:使用特定于平台的方法来捕获剪贴板图像

  4. Supabase 集成:使用唯一的 UUID 将图像上传到您的 Supabase 存储桶

  5. MCP 端点:通过模型上下文协议向 AI 代理公开功能

  6. 自动清理:定期删除超过配置的保留期(默认值:30 天)的图像

特定平台的说明

macOS

  • 需要pngpaste :使用brew install pngpaste安装

  • 使用 LaunchAgents 实现自动启动

视窗

  • 使用 PowerShell 的 System.Windows.Forms.Clipboard 进行图像捕获

  • 使用 Windows 注册表实现自动启动

Linux

  • 使用 xclip (X11) 或 wl-paste (Wayland) 进行剪贴板访问

  • 使用 systemd 进行自动启动

发展

# Run with live reload (stdio mode)
npm run dev

# Run with live reload (HTTP mode)
npm run dev:http

# Build for production
npm run build

# Run stdio version
npm start

# Run HTTP version
npm run start:http

执照

麻省理工学院

Available Tools

2 tools
cleanup_old_filesD

Inputs: no named parameters.

upload_clipboard_imageD

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    D1.8/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: cleanup_old_files handles file management, while upload_clipboard_image handles image uploads. There is no overlap in functionality, making them easy to distinguish.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern with snake_case naming: cleanup_old_files and upload_clipboard_image. The naming is predictable and uniform across the set.

    Tool Count2/5

    With only 2 tools, the server feels thin for a 'Clipboard to Supabase MCP Helper' that might imply broader clipboard or Supabase integration. This minimal set likely leaves gaps in functionality.

    Completeness2/5

    Inferred domain includes clipboard operations and Supabase integration, but the tools only cover image uploads and file cleanup. Missing obvious functions like handling text/data from clipboard or other Supabase CRUD operations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers