@fil-b/foc-storage-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +243 -0
- package/dist/mcp-server.d.ts +1 -0
- package/dist/mcp-server.js +1412 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Filecoin Onchain Cloud MCP
|
|
2
|
+
|
|
3
|
+
> MCP server for decentralized file storage on Filecoin Onchain Cloud
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@fil-b/foc-storage-mcp)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
**@fil-b/foc-storage-mcp** is a Model Context Protocol (MCP) server that provides AI agents with seamless access to Filecoin's decentralized storage network. Powered by the FOC-Synapse SDK, it enables intelligent applications to store files persistently on Filecoin with automatic payment handling, CDN support, and comprehensive dataset management.
|
|
12
|
+
|
|
13
|
+
Perfect for building AI applications that need persistent, censorship-resistant storage without managing blockchain complexity.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- 🛠️ **7 MCP Tools**: Complete file storage operations via Model Context Protocol
|
|
18
|
+
- 📁 **Dataset Organization**: Group and manage related files efficiently
|
|
19
|
+
- 💳 **Automatic Payment**: Built-in USDFC payment handling with EIP-2612 gasless permits
|
|
20
|
+
- ⚡ **CDN Support**: Optional fast retrieval for frequently accessed files
|
|
21
|
+
- 📊 **Balance Monitoring**: Comprehensive storage metrics and wallet tracking
|
|
22
|
+
- 🔧 **Provider Selection**: Choose from approved Filecoin storage providers
|
|
23
|
+
- 🤖 **AI-Ready**: Designed for AI agents and MCP clients
|
|
24
|
+
- 🔒 **Censorship-Resistant**: Leverage Filecoin's decentralized storage network
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Using with MCP Clients
|
|
29
|
+
|
|
30
|
+
Add the following configuration to your MCP client:
|
|
31
|
+
|
|
32
|
+
- **Claude Desktop**: `claude_desktop_config.json`
|
|
33
|
+
- **Cursor**: `mcp.json`
|
|
34
|
+
- **Claude Code**: `.mcp.json`
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"foc-storage": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["@fil-b/foc-storage-mcp"],
|
|
42
|
+
"env": {
|
|
43
|
+
"PRIVATE_KEY": "your_private_key_here"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Configuration
|
|
51
|
+
|
|
52
|
+
| Variable | Required | Default | Description |
|
|
53
|
+
| ------------------------------------ | -------- | ------------- | --------------------------------------------------------------- |
|
|
54
|
+
| `PRIVATE_KEY` | **Yes** | - | Wallet private key for transaction signing (must start with 0x) |
|
|
55
|
+
| `FILECOIN_NETWORK` | No | `calibration` | Network: `mainnet` for production, `calibration` for testing |
|
|
56
|
+
| `TOTAL_STORAGE_NEEDED_GiB` | No | `1024` | Storage capacity in GiB for balance calculations |
|
|
57
|
+
| `PERSISTENCE_PERIOD_DAYS` | No | `365` | Data retention duration in days |
|
|
58
|
+
| `RUNOUT_NOTIFICATION_THRESHOLD_DAYS` | No | `10` | Balance warning threshold in days |
|
|
59
|
+
|
|
60
|
+
## MCP Tools Reference
|
|
61
|
+
|
|
62
|
+
Seven tools to interact with Filecoin storage through your AI agent. Simply ask Claude, Cursor, or your MCP client naturally.
|
|
63
|
+
|
|
64
|
+
### `uploadFile`
|
|
65
|
+
|
|
66
|
+
Upload files to decentralized storage with automatic payment handling.
|
|
67
|
+
|
|
68
|
+
**Key inputs:** `filePath` (required), `withCDN`, `metadata`, `datasetId`
|
|
69
|
+
|
|
70
|
+
**How to use:**
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
"Upload my presentation.pdf to Filecoin with CDN enabled"
|
|
74
|
+
"Store /docs/report.pdf to dataset 123 with metadata category=financial"
|
|
75
|
+
"Upload this file to permanent storage"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `getDatasets`
|
|
79
|
+
|
|
80
|
+
List all your stored datasets with file information and retrieval URLs.
|
|
81
|
+
|
|
82
|
+
**Key inputs:** `includeAllDatasets`, `filterByCDN`
|
|
83
|
+
|
|
84
|
+
**How to use:**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
"Show me all my datasets"
|
|
88
|
+
"List my CDN-enabled datasets"
|
|
89
|
+
"What files have I stored on Filecoin?"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `getDataset`
|
|
93
|
+
|
|
94
|
+
Get detailed information about a specific dataset including all files.
|
|
95
|
+
|
|
96
|
+
**Key inputs:** `datasetId` (required)
|
|
97
|
+
|
|
98
|
+
**How to use:**
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
"Show me dataset 123"
|
|
102
|
+
"Get details for my Q4 reports dataset"
|
|
103
|
+
"What's in dataset abc123?"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `createDataset`
|
|
107
|
+
|
|
108
|
+
Create a new container to organize related files together.
|
|
109
|
+
|
|
110
|
+
**Key inputs:** `withCDN`, `providerId`, `metadata`
|
|
111
|
+
|
|
112
|
+
**How to use:**
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
"Create a new dataset with CDN for my project files"
|
|
116
|
+
"Make a dataset called 'Q4-Reports' with metadata project=quarterly"
|
|
117
|
+
"Create a storage dataset for organizing my documents"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### `getBalances`
|
|
121
|
+
|
|
122
|
+
Check your wallet balance and storage metrics.
|
|
123
|
+
|
|
124
|
+
**Key inputs:** `storageCapacityBytes`, `persistencePeriodDays`, `notificationThresholdDays`
|
|
125
|
+
|
|
126
|
+
**How to use:**
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
"Check my storage balance"
|
|
130
|
+
"How much USDFC do I have?"
|
|
131
|
+
"Show my wallet balance and storage status"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### `processPayment`
|
|
135
|
+
|
|
136
|
+
Deposit USDFC tokens to fund storage operations.
|
|
137
|
+
|
|
138
|
+
**Key inputs:** `depositAmount`
|
|
139
|
+
|
|
140
|
+
**How to use:**
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
"Deposit 100 USDFC for storage"
|
|
144
|
+
"Add funds to my storage wallet"
|
|
145
|
+
"Process payment of 50 USDFC"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### `getProviders`
|
|
149
|
+
|
|
150
|
+
List available Filecoin storage providers.
|
|
151
|
+
|
|
152
|
+
**Key inputs:** `onlyApproved`
|
|
153
|
+
|
|
154
|
+
**How to use:**
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
"Show me available storage providers"
|
|
158
|
+
"List approved Filecoin providers"
|
|
159
|
+
"What providers can I use?"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Common Workflows
|
|
163
|
+
|
|
164
|
+
### First-Time File Upload
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
You: "Check my storage balance"
|
|
168
|
+
Agent: Shows 0 USDFC available
|
|
169
|
+
|
|
170
|
+
You: "Deposit 100 USDFC for storage"
|
|
171
|
+
Agent: Processes payment, shows updated balance
|
|
172
|
+
|
|
173
|
+
You: "Upload /documents/report.pdf with CDN enabled"
|
|
174
|
+
Agent: Uploads file, returns retrieval URL
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Organized Storage with Datasets
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
You: "Create a dataset with CDN called Q4-Reports"
|
|
181
|
+
Agent: Creates dataset, returns ID: 123
|
|
182
|
+
|
|
183
|
+
You: "Upload /reports/q4-summary.pdf to dataset 123"
|
|
184
|
+
Agent: Uploads first file to dataset
|
|
185
|
+
|
|
186
|
+
You: "Upload /reports/q4-details.pdf to dataset 123"
|
|
187
|
+
Agent: Uploads second file to dataset
|
|
188
|
+
|
|
189
|
+
You: "Show me dataset 123"
|
|
190
|
+
Agent: Lists all files in the Q4-Reports dataset
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Monitoring Storage
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
You: "Check my storage balance and metrics"
|
|
197
|
+
Agent: Shows FIL/USDFC balances, storage days remaining
|
|
198
|
+
|
|
199
|
+
You: "List all my datasets"
|
|
200
|
+
Agent: Displays all stored datasets with file counts
|
|
201
|
+
|
|
202
|
+
You: "What's my storage status?"
|
|
203
|
+
Agent: Reports current usage and alerts if balance is low
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Security Notes
|
|
207
|
+
|
|
208
|
+
🔐 **Important Security Considerations:**
|
|
209
|
+
|
|
210
|
+
- **Never commit `.env` files** or expose private keys in code repositories
|
|
211
|
+
- **Use environment variables** for all sensitive configuration
|
|
212
|
+
- **Test on Calibration network** before mainnet deployment to avoid real funds loss
|
|
213
|
+
- **Validate file paths** before upload operations to prevent unauthorized access
|
|
214
|
+
- **Monitor balance regularly** to avoid service interruptions
|
|
215
|
+
- **Review transaction details** before confirming operations
|
|
216
|
+
- **Use hardware wallets** for production deployments with significant funds
|
|
217
|
+
- **Limit private key exposure** by using separate wallets for storage operations
|
|
218
|
+
|
|
219
|
+
## Contributing
|
|
220
|
+
|
|
221
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT © [@nijoe1](https://github.com/nijoe1)
|
|
226
|
+
|
|
227
|
+
## Links
|
|
228
|
+
|
|
229
|
+
- **GitHub Repository**: [FIL-Builders/foc-storage-mcp](https://github.com/FIL-Builders/foc-storage-mcp)
|
|
230
|
+
- **NPM Package**: [@fil-b/foc-storage-mcp](https://www.npmjs.com/package/@fil-b/foc-storage-mcp)
|
|
231
|
+
- **Filecoin Documentation**: [docs.filecoin.io](https://docs.filecoin.io/)
|
|
232
|
+
- **Synapse SDK**: [filecoin-project/synapse-sdk](https://github.com/FilOzone/synapse-sdk)
|
|
233
|
+
- **Model Context Protocol**: [modelcontextprotocol.io](https://modelcontextprotocol.io/)
|
|
234
|
+
- **Mastra Framework**: [mastra.ai](https://mastra.ai)
|
|
235
|
+
|
|
236
|
+
## Support
|
|
237
|
+
|
|
238
|
+
- **Issues**: [GitHub Issues](https://github.com/FIL-Builders/foc-storage-mcp/issues)
|
|
239
|
+
- **Discussions**: [GitHub Discussions](https://github.com/FIL-Builders/foc-storage-mcp/discussions)
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
Built with ❤️ from @FILBuilers for the Filecoin ecosystem
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|