mcp-ipfs

by alexbakers
Verified

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.

Integrations

  • Provides a Docker deployment option with path mapping capabilities to enable file operations between the host and container when using storage-related commands.

  • Integrates with storacha.network (powered by IPFS technology) to manage spaces, upload/download data, share content via w3s.link URLs, manage delegations, create proofs, handle authentication, and access usage/billing information.

  • Implemented as a Node.js server that wraps the w3 command-line interface, enabling language models to interact with storacha.network functionality through structured API calls.

🪐 MCP IPFS 服务器(storacha.network)🛰️

一个实现模型上下文协议 (MCP) 的Node.js 服务器,用于通过w3命令行界面 ( @web3-storage/w3cli ) 与storacha.network平台进行交互。

该服务器通过无缝包装w3命令,使语言模型🤖和其他 MCP 客户端能够管理 storacha.network 空间、上传/下载数据、管理委托以及执行各种其他任务。

✨ 特点

  • 包装w3 CLI 以实现与 storacha.network 的本地集成。
  • 提供涵盖广泛w3功能的 MCP 工具:
    • 🔑身份验证和代理: w3_loginw3_resetw3_account_ls (用于检查授权)
    • 📦空间管理: w3_space_lsw3_space_usew3_space_infow3_space_addw3_space_provision (注意:由于交互式提示,必须手动运行w3_space_create
    • 💾数据管理: w3_upw3_lsw3_rm
    • 🔗分享: w3_open (生成 w3s.link URL)
    • 🤝委托与证明: w3_delegation_createw3_delegation_lsw3_delegation_revokew3_proof_addw3_proof_ls
    • 🔐密钥和令牌: w3_key_createw3_bridge_generate_tokens
    • ⚙️高级存储( w3 can ... ): Blob、CAR、上传、索引、访问声明、Filecoin 信息管理
    • 💳账户和账单: w3_plan_getw3_coupon_createw3_usage_report

🛠️ 先决条件

  • **Node.js:**版本 22.0.0 或更高版本( node -v )。
  • **w3 CLI:**服务器直接执行w3命令。确保已全局安装@web3-storage/w3cli并配置:
    npm install -g @web3-storage/w3cli w3 login <your-email@example.com> # Follow email verification steps
  • 环境变量: w3_login工具需要将W3_LOGIN_EMAIL环境变量设置为与w3 login使用的相同的电子邮件。

🏗️ 项目结构

代码库组织如下:

src/ ├── index.ts # Main server entry point, MCP setup, request routing ├── schemas.ts # Zod schemas defining input arguments for each tool ├── tool_handlers.ts # Implementation logic for each MCP tool ├── utils.ts # Helper functions (e.g., running w3 commands, parsing JSON) └── utils/ └── logger.ts # Basic logger configuration

🚀 与 MCP 客户端一起使用

此服务器可与任何兼容 MCP 的客户端一起使用。您需要配置客户端才能连接到此服务器。

例如:NPX(建议本地简单使用)

这假设npm和先决条件都已满足。

{ "mcpServers": { "ipfs": { "command": "npx", "args": ["-y", "mcp-ipfs"], "env": { "W3_LOGIN_EMAIL": "your-email@example.com" } } } }

示例:Docker

首先构建图像(参见构建部分)或使用预先构建的图像alexbakers/mcp-ipfs

{ "mcpServers": { "mcp-ipfs": { "command": "docker", "args": [ "run", "-i", "--rm", "-v", "/path/to/your/project:/path/to/your/project", "-e", "W3_LOGIN_EMAIL", "alexbakers/mcp-ipfs" ], "env": { "W3_LOGIN_EMAIL": "your-email@example.com" } } } }

📝 关于路径的注意事项:

一些w3命令需要绝对文件系统路径(例如, w3_upw3_delegation_create --outputw3_proof_addw3_can_blob_addw3_can_store_add )。

  • **NPX:**提供主机的绝对路径。
  • Docker: 在容器内提供绝对路径。如果需要与主机上的文件进行交互(例如上传),则必须使用-v标志(例如-v /Users/me/project:/Users/me/project )将相关的主机目录挂载到容器中,然后在工具参数中使用容器路径(例如/Users/me/project/my_file.txt )。

📦构建

克隆存储库并安装依赖项:

git clone https://github.com/alexbakers/mcp-ipfs.git cd mcp-ipfs npm install

构建 TypeScript 代码:

npm run build

然后您可以直接运行服务器:

# Ensure W3_LOGIN_EMAIL is set in your environment export W3_LOGIN_EMAIL="your-email@example.com" node dist/index.js

或者发布它(如果您有权利):

npm publish

🐳 Docker 构建

构建 Docker 镜像:

# Build locally (replace with your username/repo and desired tag) docker build -t alexbakers/mcp-ipfs .

📜 许可证

此 MCP 服务器采用 MIT 许可证。详情请参阅许可证文件。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

🪐 MCP IPFS 服务器

该服务器通过无缝包装 w3 命令,使语言模型🤖和其他 MCP 客户端能够管理 storacha.network 空间、上传/下载数据、管理委托以及执行各种其他任务。

  1. ✨ Features
    1. 🛠️ Prerequisites
      1. 🏗️ Project Structure
        1. 🚀 Usage with MCP Clients
          1. Example: NPX (Recommended for simple local use)
          2. Example: Docker
        2. 📦 Build
          1. 🐳 Docker Build
        3. 📜 License
          ID: 1kj9uihg56