Storacha MCP Storage Server
The Model Context Protocol (MCP) server implementation for Storacha provides a standardized interface for AI applications to store and retrieve files. It enables trustless, decentralized data exchange using IPFS and Content Identifiers (CIDs), ensuring data sovereignty and verifiability.
Free Storage Options
Start using Storacha with these generous free storage options:
- GitHub Users: Get 100MB free storage instantly when signing up with GitHub - no credit card required
- Email Users: Receive 5GB free storage when registering with email and adding a credit card
Setting Up the MCP Server
Installation
Clone the repository and install dependencies:
# Clone the repository
git clone https://github.com/storacha/mcp-storage-server.git
cd mcp-storage-server
# Install dependencies
pnpm install
Generate Keys & Create Delegation
First, install the CLI tool:
npm install -g @web3-storage/w3cli
Then login to Storacha:
w3 login
Select Via GitHub (or Email) and follow returned steps to authenticate.
Create a space for your data:
w3 space create your-space-name
Save the recovery key to access your space from other devices.
Generate a private key:
w3 key create
This outputs an AgentId and PrivateKey that you'll need in the next step.
Create a delegation with proper permissions:
w3 delegation create your-agent-id \
--can 'filecoin/offer' \
--can 'upload/add' \
--can 'space/blob/add' \
--can 'space/index/add' --base64
Replace your-agent-id
with the AgentId from the previous step.
Configure Your MCP Client
Set up your MCP client to use the Storacha server by adding this configuration:
{
"mcpServers": {
"storacha-storage-server": {
"command": "node",
"args": ["./dist/index.js"],
"env": {
"MCP_TRANSPORT_MODE": "stdio",
"PRIVATE_KEY": "your-agent-private-key",
"DELEGATION": "your-base64-delegation"
},
"shell": true,
"cwd": "./"
}
}
}
Replace the placeholder values with your actual PrivateKey and base64 delegation.
Using the MCP Tools
Storacha MCP Server provides the following tools for interacting with decentralized storage.
Upload Tool
Upload files to the Storacha Network:
// Example usage in an AI application
const result = await uploadFile({
file: base64EncodedContent,
name: "document.pdf",
publishToFilecoin: true
});
Parameters:
file
: Base64 encoded file contentname
: Filename with extensionpublishToFilecoin
: (Optional) Whether to publish to Filecoindelegation
: (Optional) Custom delegation proofgatewayUrl
: (Optional) Custom gateway URL
Retrieve Tool
Retrieve files from the Storacha Network:
// Example retrieval by CID
const document = await retrieveFile({
filepath: "bafybei...gq5a/document.pdf"
});
Parameters:
filepath
: CID path in format:CID/filename
,/ipfs/CID/filename
, oripfs://CID/filename
useMultiformatBase64
: (Optional) Whether to use multiformat base64 encoding
Identity Tool
Retrieve the DIDKey of the Storacha Agent:
const identity = await getIdentity({});
Use Cases
- Document Storage & Analysis: Store and retrieve documents for AI processing
- Structured Data Storage: Maintain data optimized for longevity and accessibility
- Cross-Agent Data Sharing: Share data between AI agents using CIDs
- AI Model Development: Support AI models with reliable access to datasets
- LLM Integration: Connect LLMs directly with Storacha for data access
Advanced Integration
For more detailed integration patterns including SDK usage and Docker deployment, refer to the integrations guide (opens in a new tab).
Support
For support, join our Storacha Discord sever (opens in a new tab) or open an issue in the GitHub repository.