Skip to main content
Glama

mcp-pinterest

Pinterest MCP 服务器

用于 Pinterest 图像搜索和信息检索的模型上下文协议 (MCP) 服务器。

特征

  • 通过关键词在 Pinterest 上搜索图片
  • 检索有关 Pinterest 图片的详细信息
  • 通过 MCP 与 Cursor IDE 无缝集成
  • 支持无头浏览器模式
  • 搜索结果的限制控制
  • 从 Pinterest 搜索和下载图片

先决条件

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 mcp-pinterest:

npx -y @smithery/cli install mcp-pinterest --client claude

手动的

  1. 克隆此存储库:
    git clone https://github.com/terryso/mcp-pinterest.git pinterest-mcp-server cd pinterest-mcp-server
  2. 安装依赖项:
    npm install

用法

命令模式(推荐)

构建服务器:

npm run build

您现在可以将此服务器用作 Cursor 中的 MCP 服务器。

在 Cursor 中配置为 MCP 服务器

  1. 打开游标IDE
  2. 前往“设置”(⚙️) > 扩展程序 > MCP
  3. 点击“添加服务器”
  4. 输入以下详细信息:
    • 名称:Pinterest MCP
    • 类型:命令
    • 命令: node
    • 参数: ["/path/to/mcp-pinterest/dist/pinterest-mcp-server.js"]

    或者直接编辑Cursor的MCP配置文件(通常位于~/.cursor/mcp.json ),添加以下内容:

    "pinterest": { "command": "node", "args": ["/path/to/mcp-pinterest/dist/pinterest-mcp-server.js"] }
  5. 点击“保存”

可用的 MCP 功能

服务器公开以下 MCP 功能:

  • pinterest_search :按关键字在 Pinterest 上搜索图片
    • 参数:
      • keyword :搜索词(必填)
      • limit :返回的图像数量(默认值:10)
      • headless :是否使用无头浏览器模式(默认值:true)
  • pinterest_get_image_info :获取有关 Pinterest 图像的详细信息
    • 参数:
      • image_url :Pinterest 图片的 URL(必需)
  • pinterest_search_and_download :从 Pinterest 搜索并下载图片
    • 参数:
      • keyword :搜索词(必填)
      • limit :返回的图像数量(默认值:10)
      • headless :是否使用无头浏览器模式(默认值:true)

游标中的使用示例

配置完成后,您可以直接在 Cursor 的 AI 聊天中使用 Pinterest MCP 功能:

Search for robot images on Pinterest

AI 将使用 MCP 服务器搜索 Pinterest 并显示结果。

示例截图

Pinterest 搜索示例

屏幕截图显示搜索了 20 张《三上悠亚》的图片,并且所有图片均已成功下载。

发展

项目结构

  • pinterest-mcp-server.ts :主服务器文件
  • dist/pinterest-mcp-server.js :为生产环境构建的 JavaScript 文件
  • package.json :项目配置和依赖项

添加新功能

要添加新的 MCP 功能:

  1. 修改pinterest-mcp-server.ts
  2. 使用 MCP SDK 注册新功能
  3. 实现函数逻辑
  4. 使用npm run build重建

故障排除

  • 如果服务器启动失败,请检查端口是否已被使用
  • 确保使用npm install正确安装了所有依赖项
  • 确保使用tsconfig.json文件正确配置了 TypeScript
  • 如果遇到构建错误,请尝试运行npm install -D typescript @types/node
  • 验证 Pinterest 访问的网络连接

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

配置选项

环境变量

服务器支持以下环境变量进行配置:

  • MCP_PINTEREST_DOWNLOAD_DIR :指定下载图片的根目录。如果未设置,则默认为相对于服务器脚本的../downloads目录。
  • MCP_PINTEREST_FILENAME_TEMPLATE :指定下载图片的文件名模板。如果未设置,则默认为pinterest_{imageId}.{fileExtension}
  • MCP_PINTEREST_PROXY_SERVER :指定用于连接 Pinterest 的代理服务器。格式应为protocol://host:port ,例如http://127.0.0.1:7890socks5://127.0.0.1:1080

用法

设置下载目录
  1. 使用环境变量设置下载目录(推荐方法):
# Linux/macOS export MCP_PINTEREST_DOWNLOAD_DIR=/path/to/your/download/directory # Then start the server node pinterest-mcp-server.js # Windows (CMD) set MCP_PINTEREST_DOWNLOAD_DIR=C:\path\to\your\download\directory # Then start the server node pinterest-mcp-server.js # Windows (PowerShell) $env:MCP_PINTEREST_DOWNLOAD_DIR="C:\path\to\your\download\directory" # Then start the server node pinterest-mcp-server.js
  1. 如果未设置环境变量,服务器将使用默认下载目录(相对于服务器脚本的../downloads )。
设置文件名模板

您可以使用MCP_PINTEREST_FILENAME_TEMPLATE环境变量自定义下载图像的文件名模式:

# Linux/macOS export MCP_PINTEREST_FILENAME_TEMPLATE="pin_{imageId}_{timestamp}.{fileExtension}" # Then start the server node pinterest-mcp-server.js # Windows (CMD) set MCP_PINTEREST_FILENAME_TEMPLATE="pin_{imageId}_{timestamp}.{fileExtension}" # Then start the server node pinterest-mcp-server.js # Windows (PowerShell) $env:MCP_PINTEREST_FILENAME_TEMPLATE="pin_{imageId}_{timestamp}.{fileExtension}" # Then start the server node pinterest-mcp-server.js

该模板支持以下变量:

  • {imageId} :Pinterest 图片的唯一 ID
  • {fileExtension} :文件扩展名(例如 jpg、png)
  • {timestamp} :当前 UTC 时间戳,格式为 YYYYMMDDHHMMSS
  • {index} :下载多张图片时的索引号(从1开始)

示例模板:

  • pinterest_{imageId}.{fileExtension} (默认)
  • pin_{timestamp}_{imageId}.{fileExtension}
  • pinterest_image_{index}_{imageId}.{fileExtension}
  • {timestamp}_pinterest.{fileExtension}

如果模板无效(例如,包含不受支持的变量或括号不匹配),服务器将记录警告并使用默认模板。

设置代理服务器

如果您需要使用代理访问 Pinterest(尤其是在 Pinterest 可能受到限制的地区),您可以设置代理配置:

# Linux/macOS export MCP_PINTEREST_PROXY_SERVER="http://127.0.0.1:7890" # Then start the server node pinterest-mcp-server.js # Windows (CMD) set MCP_PINTEREST_PROXY_SERVER=http://127.0.0.1:7890 # Then start the server node pinterest-mcp-server.js # Windows (PowerShell) $env:MCP_PINTEREST_PROXY_SERVER="http://127.0.0.1:7890" # Then start the server node pinterest-mcp-server.js

支持的代理协议:

  • HTTP: http://host:port
  • HTTPS: https://host:port
  • SOCKS4: socks4://host:port
  • SOCKS5: socks5://host:port

代理配置既影响用于搜索的浏览器,也影响图像下载过程。

笔记
  • 服务器启动时会验证下载目录的存在及可写性。如果目录不存在,则会尝试创建;如果无法创建或写入,服务器将退出。
  • 客户端在调用下载相关工具时不应该通过参数指定下载路径或文件名模板,因为所有下载都会使用服务器的环境变量配置或默认值。
  • 服务器会自动清理文件名,用下划线替换非法字符(例如/\:*?"<>| )。
接口说明

该服务器提供以下 MCP 工具:

  1. pinterest_search :按关键字搜索 Pinterest 图片
  2. pinterest_get_image_info :获取有关 Pinterest 图像的详细信息
  3. pinterest_search_and_download :搜索并下载 Pinterest 图片

详细的接口参数参考请参考MCP工具定义。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

用于图像搜索和信息检索的 Pinterest 模型上下文协议 (MCP) 服务器

  1. 特征
    1. 先决条件
      1. 安装
        1. 通过 Smithery 安装
        2. 手动的
      2. 用法
        1. 命令模式(推荐)
      3. 在 Cursor 中配置为 MCP 服务器
        1. 可用的 MCP 功能
          1. 游标中的使用示例
            1. 示例截图
          2. 发展
            1. 项目结构
            2. 添加新功能
          3. 故障排除
            1. 执照
              1. 配置选项
                1. 环境变量
                2. 用法

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                Model Context Protocol server for fetching web content and processing images. This allows Claude Desktop (or any MCP client) to fetch web content and handle images appropriately.
                Last updated -
                1
                278
                15
                JavaScript
                MIT License
                • Apple
              • A
                security
                A
                license
                A
                quality
                This MCP server aids users in searching and analyzing their photo library by location, labels, and people, offering functionalities like photo analysis and fuzzy matching for enhanced photo management.
                Last updated -
                14
                Python
                MIT License
                • Apple
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.
                Last updated -
                2
                26
                Python
                MIT License
                • Apple
              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol (MCP) server that enables Claude or other LLMs to fetch content from URLs, supporting HTML, JSON, text, and images with configurable request parameters.
                Last updated -
                Python
                MIT License

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/terryso/mcp-pinterest'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server