@fil-b/foc-storage-mcp 0.3.0 → 0.4.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 +193 -82
- package/dist/stdio.js +60266 -44058
- package/package.json +13 -18
package/README.md
CHANGED
|
@@ -1,32 +1,52 @@
|
|
|
1
1
|
# Filecoin Onchain Cloud MCP
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
>
|
|
7
|
-
> `foc-cli` is the official successor. It includes everything this MCP server did, plus a full CLI, AI agent skills, and richer tooling for Filecoin Onchain Cloud.
|
|
8
|
-
|
|
9
|
-
[](https://github.com/FIL-Builders/foc-cli)
|
|
10
|
-
[](https://github.com/FIL-Builders/foc-cli)
|
|
3
|
+
> MCP server for decentralized file storage on Filecoin Onchain Cloud
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@fil-b/foc-storage-mcp)
|
|
11
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org)
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
**@fil-b/foc-storage-mcp** lets AI agents store and retrieve files on Filecoin's decentralized network through the Model Context Protocol (MCP), with automatic payment handling, CDN support, and dataset management.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- 🛠️ **11 MCP Tools** - Upload, manage, price, and pay for storage operations
|
|
14
|
+
- 📁 **Dataset Organization** - Group related files efficiently
|
|
15
|
+
- 💳 **Automatic Payments** - Built-in USDFC handling with gasless permits
|
|
16
|
+
- ⚡ **CDN Support** - Fast retrieval for frequently accessed files
|
|
17
|
+
- 💰 **Cost Estimation** - Calculate costs, explain pricing, convert units
|
|
18
|
+
- 🤖 **AI-Ready** - Designed for Claude, Cursor, and MCP clients
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
**Requirements:**
|
|
23
|
+
|
|
24
|
+
- Node.js >= 20.10.0 ([Check version](https://nodejs.org/): `node --version`)
|
|
25
|
+
- `PRIVATE_KEY` - Your Filecoin wallet private key (0x...)
|
|
26
|
+
|
|
27
|
+
**Optional:**
|
|
28
|
+
|
|
29
|
+
- `FILECOIN_NETWORK` - `mainnet` (production) or `calibration` (testing, default)
|
|
30
|
+
- `TOTAL_STORAGE_NEEDED_GiB` - Default storage capacity for calculations (default: 150 GiB)
|
|
31
|
+
- `PERSISTENCE_PERIOD_DAYS` - Data retention duration (default: 365 days)
|
|
32
|
+
- `RUNOUT_NOTIFICATION_THRESHOLD_DAYS` - Balance warning threshold (default: 45 days, **recommended >30**)
|
|
33
|
+
- `SYNAPSE_SOURCE` - Source tag identifying this client to Synapse (default: `foc-storage-mcp`)
|
|
14
34
|
|
|
15
|
-
|
|
35
|
+
> **Note:** Filecoin warm storage requires 30 days paid upfront. Keep balance above 30 days to maintain service.
|
|
16
36
|
|
|
17
|
-
|
|
37
|
+
## Installation
|
|
18
38
|
|
|
19
|
-
|
|
20
|
-
- ✅ **CLI** — direct terminal access (`npx foc-cli upload ./file.pdf`)
|
|
21
|
-
- ✅ **AI agent skills** via [skills.sh](https://skills.sh) — works with Claude Code, Cursor, Copilot, Codex, Windsurf, and 20+ AI tools
|
|
22
|
-
- ✅ **Active maintenance** — built on the latest [Synapse SDK](https://github.com/FilOzone/synapse-sdk)
|
|
23
|
-
- ✅ **Expanded features** — multi-upload, redundant copies, structured output (`--json`, `--format yaml`), schema introspection, and more
|
|
39
|
+
**Jump to:** [Cursor](#cursor) | [Claude Code](#claude-code) | [Claude Desktop](#claude-desktop) | [VS Code](#vs-code) | [Windsurf](#windsurf) | [Codex](#openai-codex) | [Other](#other-tools)
|
|
24
40
|
|
|
25
|
-
|
|
41
|
+
### Cursor
|
|
26
42
|
|
|
27
|
-
|
|
43
|
+
[](https://cursor.com/en-US/install-mcp?name=foc-storage&config=eyJlbnYiOnsiUFJJVkFURV9LRVkiOiJ5b3VyX3ByaXZhdGVfa2V5X2hlcmUiLCJGSUxFQ09JTl9ORVRXT1JLIjoiY2FsaWJyYXRpb24ifSwiY29tbWFuZCI6Im5weCAteSBAZmlsLWIvZm9jLXN0b3JhZ2UtbWNwIn0%3D)
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
After installation, update `PRIVATE_KEY` in your config. [Learn more](https://cursor.com/de/docs/context/mcp)
|
|
46
|
+
|
|
47
|
+
### Claude Code
|
|
48
|
+
|
|
49
|
+
Add to `.mcp.json`:
|
|
30
50
|
|
|
31
51
|
```json
|
|
32
52
|
{
|
|
@@ -34,109 +54,200 @@ If you were using this MCP server, switching takes one command.
|
|
|
34
54
|
"foc-storage": {
|
|
35
55
|
"command": "npx",
|
|
36
56
|
"args": ["-y", "@fil-b/foc-storage-mcp"],
|
|
37
|
-
"env": {
|
|
57
|
+
"env": {
|
|
58
|
+
"PRIVATE_KEY": "your_private_key_here",
|
|
59
|
+
"FILECOIN_NETWORK": "calibration"
|
|
60
|
+
}
|
|
38
61
|
}
|
|
39
62
|
}
|
|
40
63
|
}
|
|
41
64
|
```
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
[Learn more](https://docs.claude.com/en/docs/claude-code/mcp)
|
|
44
67
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
### Claude Desktop
|
|
69
|
+
|
|
70
|
+
Add to `claude_desktop_config.json`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"foc-storage": {
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": ["-y", "@fil-b/foc-storage-mcp"],
|
|
78
|
+
"env": {
|
|
79
|
+
"PRIVATE_KEY": "your_private_key_here",
|
|
80
|
+
"FILECOIN_NETWORK": "calibration"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
[Learn more](https://modelcontextprotocol.io/quickstart/user)
|
|
88
|
+
|
|
89
|
+
### VS Code
|
|
90
|
+
|
|
91
|
+
Create `.vscode/mcp.json`:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"servers": {
|
|
96
|
+
"foc-storage": {
|
|
97
|
+
"type": "stdio",
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": ["-y", "@fil-b/foc-storage-mcp"],
|
|
100
|
+
"env": {
|
|
101
|
+
"PRIVATE_KEY": "your_private_key_here",
|
|
102
|
+
"FILECOIN_NETWORK": "calibration"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Enable: Settings → Chat → MCP. Click "start" in `mcp.json` (Agent mode only). [Learn more](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)
|
|
110
|
+
|
|
111
|
+
### Windsurf
|
|
112
|
+
|
|
113
|
+
Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
48
114
|
|
|
49
|
-
|
|
50
|
-
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"mcpServers": {
|
|
118
|
+
"foc-storage": {
|
|
119
|
+
"command": "npx",
|
|
120
|
+
"args": ["-y", "@fil-b/foc-storage-mcp"],
|
|
121
|
+
"env": {
|
|
122
|
+
"PRIVATE_KEY": "your_private_key_here",
|
|
123
|
+
"FILECOIN_NETWORK": "calibration"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
51
128
|
```
|
|
52
129
|
|
|
53
|
-
|
|
130
|
+
Restart Windsurf. [Learn more](https://docs.windsurf.com/windsurf/cascade/mcp)
|
|
131
|
+
|
|
132
|
+
### OpenAI Codex
|
|
54
133
|
|
|
55
134
|
```bash
|
|
56
|
-
|
|
135
|
+
codex mcp add foc-storage -- npx -y @fil-b/foc-storage-mcp
|
|
57
136
|
```
|
|
58
137
|
|
|
59
|
-
|
|
138
|
+
Edit config to add environment variables. Verify: `codex mcp list`. [Learn more](https://developers.openai.com/codex/mcp)
|
|
60
139
|
|
|
61
|
-
###
|
|
140
|
+
### Other Tools
|
|
62
141
|
|
|
63
|
-
|
|
142
|
+
Most MCP tools support this format:
|
|
64
143
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"foc-storage": {
|
|
148
|
+
"type": "stdio",
|
|
149
|
+
"command": "npx",
|
|
150
|
+
"args": ["-y", "@fil-b/foc-storage-mcp"],
|
|
151
|
+
"env": {
|
|
152
|
+
"PRIVATE_KEY": "your_private_key_here",
|
|
153
|
+
"FILECOIN_NETWORK": "calibration"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
77
159
|
|
|
78
|
-
|
|
160
|
+
## Pricing
|
|
79
161
|
|
|
80
|
-
|
|
162
|
+
Pricing is read from the live Synapse v1 price list. Storage is billed per epoch
|
|
163
|
+
(30 seconds) using the per-TiB monthly rate plus a recurring per-dataset service
|
|
164
|
+
fee for non-empty datasets. Uploads can also include one-time create-dataset and
|
|
165
|
+
add-pieces fees, and CDN egress is usage-based.
|
|
81
166
|
|
|
82
|
-
|
|
167
|
+
💡 Ask your agent: _"How much to store 500 GiB for 6 months?"_
|
|
83
168
|
|
|
84
|
-
|
|
85
|
-
<summary><strong>Click to expand original README</strong></summary>
|
|
169
|
+
## Validation
|
|
86
170
|
|
|
87
|
-
|
|
171
|
+
```bash
|
|
172
|
+
npm test
|
|
173
|
+
npx tsc --noEmit
|
|
174
|
+
npm run build:mcp
|
|
175
|
+
npm run smoke:mcp:readonly
|
|
176
|
+
npm run build
|
|
177
|
+
```
|
|
88
178
|
|
|
89
|
-
|
|
179
|
+
`smoke:mcp:readonly` starts the built stdio server and exercises read-only MCP
|
|
180
|
+
tools for pricing, providers, balances, and datasets. It deliberately skips
|
|
181
|
+
upload, payment, withdrawal, and dataset-creation transactions; run those only
|
|
182
|
+
with an intentionally funded Calibration wallet.
|
|
90
183
|
|
|
91
|
-
|
|
184
|
+
## Tools
|
|
92
185
|
|
|
93
|
-
|
|
186
|
+
Ask naturally in Claude, Cursor, or any MCP client:
|
|
94
187
|
|
|
95
|
-
|
|
96
|
-
- `getDatasets` — List all stored datasets
|
|
97
|
-
- `getDataset` — Get dataset details
|
|
98
|
-
- `createDataset` — Create new dataset container
|
|
188
|
+
**File Operations**
|
|
99
189
|
|
|
100
|
-
|
|
190
|
+
- `uploadFile` - Upload files with auto-payment
|
|
191
|
+
- `getDatasets` - List all stored datasets
|
|
192
|
+
- `getDataset` - Get dataset details
|
|
193
|
+
- `createDataset` - Create new dataset container
|
|
101
194
|
|
|
102
|
-
|
|
103
|
-
- `processPayment` — Deposit USDFC tokens
|
|
195
|
+
**Balance & Payments**
|
|
104
196
|
|
|
105
|
-
|
|
197
|
+
- `getBalances` - Check wallet and storage metrics
|
|
198
|
+
- `processPayment` - Deposit USDFC tokens
|
|
199
|
+
- `processWithdrawal` - Withdraw a specified USDFC amount to your wallet
|
|
106
200
|
|
|
107
|
-
|
|
108
|
-
- `estimateStoragePricing` — Calculate costs
|
|
109
|
-
- `getStoragePricingInfo` — Explain pricing models
|
|
110
|
-
- `convertStorageSize` — Convert units
|
|
201
|
+
**Providers & Pricing**
|
|
111
202
|
|
|
112
|
-
|
|
203
|
+
- `getProviders` - List storage providers
|
|
204
|
+
- `estimateStoragePricing` - Calculate costs
|
|
205
|
+
- `getStoragePricingInfo` - Explain pricing models
|
|
206
|
+
- `convertStorageSize` - Convert units
|
|
113
207
|
|
|
114
|
-
|
|
208
|
+
## Usage Examples
|
|
115
209
|
|
|
116
|
-
|
|
210
|
+
```
|
|
211
|
+
"Check my storage balance"
|
|
212
|
+
"Upload presentation.pdf with CDN enabled"
|
|
213
|
+
"How much to store 2 TB for 1 year?"
|
|
214
|
+
"Create a dataset for Q4 reports"
|
|
215
|
+
"Show all my datasets"
|
|
216
|
+
```
|
|
117
217
|
|
|
118
|
-
|
|
119
|
-
- `TOTAL_STORAGE_NEEDED_GiB` — default 150
|
|
120
|
-
- `PERSISTENCE_PERIOD_DAYS` — default 365
|
|
121
|
-
- `RUNOUT_NOTIFICATION_THRESHOLD_DAYS` — default 45 (recommended >30; Filecoin warm storage requires 30 days paid upfront)
|
|
218
|
+
## Troubleshooting
|
|
122
219
|
|
|
123
|
-
|
|
220
|
+
**Server not found:** Verify `npx --version`, check JSON syntax, restart IDE
|
|
124
221
|
|
|
125
|
-
|
|
222
|
+
**"PRIVATE_KEY is required":** Add to `env` section, must start with `0x`
|
|
126
223
|
|
|
127
|
-
|
|
224
|
+
**Transaction fails:** Check FIL for gas, verify network setting, confirm USDFC balance
|
|
128
225
|
|
|
129
|
-
|
|
226
|
+
**"Invalid Version" or npm dependency errors:**
|
|
130
227
|
|
|
131
|
-
|
|
228
|
+
1. Clear npm cache: `npm cache clean --force`
|
|
229
|
+
2. Clear npx cache: `npx clear-npx-cache`
|
|
230
|
+
3. Update npm: `npm install -g npm@latest`
|
|
231
|
+
4. As last resort, use older npm: `npm install -g npm@10`
|
|
232
|
+
|
|
233
|
+
## Security
|
|
234
|
+
|
|
235
|
+
- Never commit private keys or `.env` files
|
|
236
|
+
- Test on Calibration network before mainnet
|
|
237
|
+
- Keep balance >30 days (Filecoin warm storage requirement)
|
|
238
|
+
- Monitor balance regularly with `getBalances`
|
|
239
|
+
- Use hardware wallets for production
|
|
132
240
|
|
|
133
241
|
## Links
|
|
134
242
|
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
|
|
243
|
+
- [GitHub](https://github.com/FIL-Builders/foc-storage-mcp)
|
|
244
|
+
- [NPM](https://www.npmjs.com/package/@fil-b/foc-storage-mcp)
|
|
245
|
+
- [Filecoin Docs](https://docs.filecoin.io/)
|
|
246
|
+
- [MCP Protocol](https://modelcontextprotocol.io/)
|
|
247
|
+
|
|
248
|
+
## Contributing
|
|
249
|
+
|
|
250
|
+
Contributions welcome! Open an issue for major changes.
|
|
140
251
|
|
|
141
252
|
## License
|
|
142
253
|
|
|
@@ -144,4 +255,4 @@ MIT © [@nijoe1](https://github.com/nijoe1)
|
|
|
144
255
|
|
|
145
256
|
---
|
|
146
257
|
|
|
147
|
-
Built with ❤️ by
|
|
258
|
+
Built with ❤️ by @FILBuilders for the Filecoin ecosystem
|