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

](https://github.com/alexbakers/mcp-ipfs/actions/workflows/publish-docker.yml) ](https://github.com/alexbakers/mcp-ipfs/actions/workflows/publish-npm.yml) ](https://badge.fury.io/js/mcp-ipfs) ](https://smithery.ai/server/@alexbakers/mcp-ipfs)
此服务器支持语言模型🤖 以及其他MCP客户端,通过无缝封装来管理storach.network空间、上传/下载数据、管理委托和执行各种其他任务 w3 命令。
✨ 特性
- 包裹
w3CLI用于与storacha.network进行本机集成。 - 提供涵盖广泛领域的MCP工具
w3功能:
- 🔑 身份验证和代理: w3_login, w3_reset, w3_account_ls (用于检查授权) - 📦 空间管理: w3_space_ls, w3_space_use, w3_space_info, w3_space_add, w3_space_provision (注: w3_space_create 由于交互式提示,必须手动运行) - 💾 数据管理: w3_up, w3_ls, w3_rm - 🔗 共享: w3_open (生成w3s.link URL) - 🤝 代表团和证明: w3_delegation_create, w3_delegation_ls, w3_delegation_revoke, w3_proof_add, w3_proof_ls - 🔐 密钥和令牌: w3_key_create, w3_bridge_generate_tokens - ⚙️ 高级存储(w3 can ...): Blob、CAR、上传、索引、访问声明、Filecoin信息管理 - 💳 帐户和账单: w3_plan_get, w3_coupon_create, w3_usage_report
🛠️ 先决条件
- Node.js: 版本22.0.0或更高(
node -v). w3CLI: 服务器执行w3命令直接。确保@web3-storage/w3cli全局安装并配置:
npm install -g @web3-storage/w3cli
w3 login
# 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_up, w3_delegation_create --output, w3_proof_add, w3_can_blob_add, w3_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许可证获得许可。请参阅 许可证 文件以获取详细信息。
