未处理的标签
一种模型上下文协议(MCP)服务器,为Claude提供对Pinata的访问。这种集成允许Claude通过Pinata的API与公共和私有IPFS进行交互。
设置
先决条件
- 已安装Node.js 18+
- 具有API密钥(JWT)的Pinata帐户
- Pinata网关URL
安装
安装将取决于您使用的是Claude Code还是Claude Desktop。
克劳德代码
跑 claude mcp add 并按照提示提供以下信息:
Server Name: pinata
Server Scope: Project or Global
Server Command: npx
Command Arguments: pinata-mcp /path/to/allowed/directory
Environment Variables: PINATA_JWT=,GATEWAY_URL=example.mypinata.cloud克劳德桌面版
将以下配置添加到 claude_desktop_config.json:
{
"mcpServers": {
"pinata": {
"command": "npx",
"args": [
"pinata-mcp",
"/path/to/allowed/directory",
"/another/allowed/directory"
],
"env": {
"PINATA_JWT": "",
"GATEWAY_URL": "example.mypinata.cloud"
}
}
}
}注: 目录参数是可选的。如果没有提供,服务器将只允许访问当前工作目录。您可以指定多个目录以允许从多个位置访问文件。
可用工具
认证
| 工具 | 说明 |
|---|---|
testAuthentication | 验证您的Pinata JWT是否有效且正常工作 |
文件操作
| 工具 | 说明 |
|---|---|
uploadFile | 将文件上传到Pinata(公共或私有IPFS) |
searchFiles | 按名称、CID或MIME类型搜索文件 |
getFileById | 按ID获取详细的文件信息 |
updateFile | 更新文件元数据(名称、键值) |
deleteFile | 从Pinata中删除文件 |
内容访问
| 工具 | 说明 |
|---|---|
createLink | 为公共或私人文件创建网关链接 |
createPrivateDownloadLink | 为私人文件生成临时下载链接 |
fetchFromGateway | 通过Pinata网关从IPFS获取内容 |
集团运营
| 工具 | 说明 |
|---|---|
listGroups | 列出具有可选筛选功能的组 |
createGroup | 创建用于组织文件的新组 |
getGroup | 按ID获取组详细信息 |
updateGroup | 更新组信息 |
deleteGroup | 删除组 |
addFileToGroup | 将文件添加到组 |
removeFileFromGroup | 从组中删除文件 |
x402付款说明
使用x402协议实现内容货币化的工具:
| 工具 | 说明 |
|---|---|
createPaymentInstruction | 为门控内容创建付款要求 |
listPaymentInstructions | 列出/过滤现有付款指令 |
getPaymentInstruction | 获取特定付款指令的详细信息 |
updatePaymentInstruction | 修改付款指令设置 |
deletePaymentInstruction | 删除付款指令 |
listPaymentInstructionCids | 列出与付款指令关联的CID |
addCidToPaymentInstruction | 将CID与付款指令关联 |
removeCidFromPaymentInstruction | 删除CID关联 |
CID签名
使用EIP-712签名进行加密内容验证的工具:
| 工具 | 说明 |
|---|---|
addSignature | 向CID添加加密签名 |
getSignature | 通过CID获取签名详细信息 |
deleteSignature | 删除签名 |
已签名的上传URL
| 工具 | 说明 |
|---|---|
createSignedUploadUrl | 为客户端上传创建预签名URL |
CID引脚
| 工具 | 说明 |
|---|---|
pinByCid | 从IPFS网络固定现有CID |
queryPinRequests | 查询pin请求的状态 |
cancelPinRequest | 取消待定的pin请求 |
矢量化(AI/语义搜索)
| 工具 | 说明 |
|---|---|
vectorizeFile | 将文件矢量化以进行语义搜索 |
deleteFileVectors | 删除文件的向量 |
queryVectors | 使用语义搜索查询矢量化文件 |
公用事业
| 工具 | 说明 |
|---|---|
listAllowedDirectories | 列出服务器可以访问以进行文件操作的目录 |
本地开发
在开发过程中本地测试MCP服务器:
1.克隆并安装依赖项
git clone https://github.com/PinataCloud/pinata-mcp.git
cd pinata-mcp
npm install2.建设项目
npm run build3.设置环境变量
创建一个 .env 项目根目录中的文件(可选,您也可以在MCP配置中传递这些文件):
PINATA_JWT=your_pinata_jwt_here
GATEWAY_URL=your-gateway.mypinata.cloud4.配置Claude以使用本地构建
克劳德代码
跑 claude mcp add 使用本地路径:
Server Name: pinata-dev
Server Scope: Project
Server Command: node
Command Arguments: /path/to/pinata-mcp/dist/index.js /path/to/allowed/directory
Environment Variables: PINATA_JWT=,GATEWAY_URL=example.mypinata.cloud克劳德桌面版
更新 claude_desktop_config.json 指向您的本地版本:
{
"mcpServers": {
"pinata-dev": {
"command": "node",
"args": [
"/path/to/pinata-mcp/dist/index.js",
"/path/to/allowed/directory"
],
"env": {
"PINATA_JWT": "",
"GATEWAY_URL": "example.mypinata.cloud"
}
}
}
}5.测试变更
更改代码后:
- 重建:
npm run build - 重新启动Claude Code或Claude Desktop以获取更改
MCP检验员测试
使用 MCP检查员 要测试服务器,请执行以下操作:
Web UI(交互式调试)
npx @modelcontextprotocol/inspector \
-e PINATA_JWT=your_jwt \
-e GATEWAY_URL=your-gateway.mypinata.cloud \
-- node dist/index.js这将打开一个浏览器UI,您可以在其中交互式地列出工具,使用参数调用它们,并检查响应。
CLI模式(用于脚本/CI)
# List all available tools
npx @modelcontextprotocol/inspector --cli --method tools/list \
-e PINATA_JWT=your_jwt \
-e GATEWAY_URL=your-gateway.mypinata.cloud \
-- node dist/index.js
# Call a specific tool
npx @modelcontextprotocol/inspector --cli --method tools/call \
--tool-name testAuthentication \
-e PINATA_JWT=your_jwt \
-e GATEWAY_URL=your-gateway.mypinata.cloud \
-- node dist/index.js克劳德提示示例
Test my Pinata connection:
"Test my Pinata authentication to make sure everything is working"
Upload an image to Pinata:
"Upload this image to my Pinata account as a private file named 'My Example Image'"
Search for files:
"Search my Pinata account for all PNG files"
Create a group and add files:
"Create a new group called 'Project Assets' on Pinata, then find all my JSON files and add them to this group"
Fetch content from IPFS:
"Fetch the content with CID QmX... from IPFS"
Create a payment instruction for content monetization:
"Create a payment instruction called 'Premium Content' that requires 0.01 USDC on Base to access"
Pin an existing CID:
"Pin the CID bafkreih5aznjvttude6c3wbvqeebb6rlx5wkbzyppv7garjiubll2ceym4 to my account"
Vectorize files for AI search:
"Vectorize the file with ID abc123 so I can search it semantically"
Query vectorized content:
"Search my vectorized files in group xyz for 'machine learning concepts'"