s3db.js 11.2.6 → 11.3.1

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.
@@ -0,0 +1,281 @@
1
+ # 📦 Publishing S3DB MCP Server to NPM
2
+
3
+ Este guia garante que o MCP server funcione perfeitamente com `npx` após publicação no NPM.
4
+
5
+ ## ✅ Checklist Pré-Publicação
6
+
7
+ ### 1. Build & Tests
8
+ ```bash
9
+ # Build do projeto
10
+ pnpm run build
11
+
12
+ # Rodar testes rápidos
13
+ pnpm run test:quick
14
+
15
+ # Testar MCP server localmente
16
+ pnpm run test:mcp
17
+ ```
18
+
19
+ ### 2. Verificar Arquivos que Serão Publicados
20
+ ```bash
21
+ # Simular publicação (dry-run)
22
+ npm pack --dry-run
23
+
24
+ # Ver exatamente o que será publicado
25
+ npm pack
26
+ tar -tzf s3db.js-*.tgz | less
27
+
28
+ # Limpar arquivo gerado
29
+ rm s3db.js-*.tgz
30
+ ```
31
+
32
+ ### 3. Verificar Binary Entry Point
33
+ ```bash
34
+ # Conferir que o entrypoint está executável
35
+ ls -la mcp/entrypoint.js
36
+
37
+ # Deve mostrar: -rwxrwxr-x (permissões de execução)
38
+ # Se não tiver, executar: chmod +x mcp/entrypoint.js
39
+
40
+ # Testar shebang
41
+ head -1 mcp/entrypoint.js
42
+ # Deve mostrar: #!/usr/bin/env node
43
+ ```
44
+
45
+ ### 4. Testar Localmente com NPX
46
+ ```bash
47
+ # Simular o que o usuário vai fazer
48
+ npx -y ./
49
+
50
+ # Ou instalar localmente e testar
51
+ npm link
52
+ npx s3db.js s3db-mcp --transport=stdio
53
+ npm unlink
54
+ ```
55
+
56
+ ## 📋 O Que Será Publicado
57
+
58
+ O NPM irá incluir apenas:
59
+
60
+ ```
61
+ s3db.js/
62
+ ├── dist/ # Código compilado
63
+ │ ├── s3db.cjs.js # CommonJS
64
+ │ ├── s3db.es.js # ES Modules
65
+ │ └── s3db.d.ts # TypeScript definitions
66
+ ├── src/ # Código fonte (para debugging)
67
+ ├── bin/
68
+ │ └── cli.js # CLI principal
69
+ ├── mcp/ # MCP Server (completo!)
70
+ │ ├── entrypoint.js # 🎯 Entry point para npx
71
+ │ ├── tools/ # Todas as tools
72
+ │ ├── README.md # Quick reference
73
+ │ ├── NPX_SETUP.md # Guia de setup
74
+ │ └── CLAUDE_CLI_SETUP.md # Guia Claude CLI
75
+ ├── docs/
76
+ │ └── mcp.md # Documentação completa
77
+ ├── package.json
78
+ ├── README.md
79
+ ├── PLUGINS.md
80
+ ├── SECURITY.md
81
+ └── UNLICENSE
82
+ ```
83
+
84
+ **Tamanho estimado**: ~2-3 MB (sem tests, examples, binários)
85
+
86
+ ## 🚀 Publicar no NPM
87
+
88
+ ### Primeira Vez
89
+ ```bash
90
+ # Login no NPM
91
+ npm login
92
+
93
+ # Publicar (com prepublishOnly automático)
94
+ npm publish
95
+
96
+ # Ou publicar como beta
97
+ npm publish --tag beta
98
+ ```
99
+
100
+ ### Atualizações
101
+ ```bash
102
+ # Bump version (patch/minor/major)
103
+ npm version patch -m "fix: improve MCP server performance"
104
+ npm version minor -m "feat: add new MCP tools"
105
+ npm version major -m "BREAKING CHANGE: new MCP API"
106
+
107
+ # Publicar
108
+ npm publish
109
+ ```
110
+
111
+ ## 🧪 Validar Após Publicação
112
+
113
+ ### 1. Testar NPX Imediatamente
114
+ ```bash
115
+ # Aguardar 1-2 minutos para propagar no NPM CDN
116
+
117
+ # Testar comando direto
118
+ npx -y s3db.js@latest s3db-mcp --help
119
+
120
+ # Testar com Claude CLI
121
+ claude mcp add s3db-test \
122
+ --transport stdio \
123
+ -- npx -y s3db.js@latest s3db-mcp --transport=stdio
124
+
125
+ # Verificar se foi adicionado
126
+ claude mcp list
127
+
128
+ # Testar no chat
129
+ claude
130
+ # Digitar: "Show me S3DB MCP server status"
131
+
132
+ # Remover teste
133
+ claude mcp remove s3db-test
134
+ ```
135
+
136
+ ### 2. Verificar Página NPM
137
+ - Acesse: https://www.npmjs.com/package/s3db.js
138
+ - ✅ README renderizado corretamente
139
+ - ✅ Keywords incluem "mcp", "model-context-protocol"
140
+ - ✅ Binaries listados: `s3db-mcp`
141
+ - ✅ Files incluem `mcp/`
142
+
143
+ ### 3. Verificar Tamanho do Pacote
144
+ ```bash
145
+ # Ver tamanho do pacote publicado
146
+ npm view s3db.js dist.unpackedSize
147
+
148
+ # Deve ser < 5MB (ideal: 2-3MB)
149
+ ```
150
+
151
+ ## ❌ Troubleshooting
152
+
153
+ ### Erro: "command not found: s3db-mcp"
154
+ **Causa**: Shebang faltando ou permissões incorretas
155
+ **Solução**:
156
+ ```bash
157
+ # Adicionar shebang no início do arquivo
158
+ echo '#!/usr/bin/env node' | cat - mcp/entrypoint.js > temp && mv temp mcp/entrypoint.js
159
+
160
+ # Dar permissões de execução
161
+ chmod +x mcp/entrypoint.js
162
+
163
+ # Republicar
164
+ npm version patch -m "fix: add executable permissions to mcp entrypoint"
165
+ npm publish
166
+ ```
167
+
168
+ ### Erro: "Cannot find module '@modelcontextprotocol/sdk'"
169
+ **Causa**: Dependência não está em `dependencies`
170
+ **Solução**:
171
+ ```bash
172
+ # Mover de devDependencies para dependencies
173
+ npm install --save @modelcontextprotocol/sdk
174
+
175
+ # Republicar
176
+ npm version patch -m "fix: move MCP SDK to dependencies"
177
+ npm publish
178
+ ```
179
+
180
+ ### Erro: "mcp/ directory not found"
181
+ **Causa**: `.npmignore` bloqueando `mcp/` ou faltando em `files`
182
+ **Solução**:
183
+ ```bash
184
+ # Verificar package.json
185
+ cat package.json | jq '.files'
186
+ # Deve incluir "mcp/"
187
+
188
+ # Verificar .npmignore
189
+ cat .npmignore | grep "mcp/"
190
+ # Não deve ter "mcp/" listado
191
+
192
+ # Republicar
193
+ npm version patch -m "fix: include mcp directory in package"
194
+ npm publish
195
+ ```
196
+
197
+ ## 🎯 Comandos Úteis
198
+
199
+ ```bash
200
+ # Ver informações do pacote publicado
201
+ npm view s3db.js
202
+
203
+ # Ver versões publicadas
204
+ npm view s3db.js versions
205
+
206
+ # Verificar quem tem acesso
207
+ npm access list packages
208
+
209
+ # Deprecate uma versão (se necessário)
210
+ npm deprecate s3db.js@11.2.5 "Use version 11.2.6 or higher"
211
+
212
+ # Unpublish (CUIDADO! Só nas primeiras 72h)
213
+ npm unpublish s3db.js@11.2.6
214
+ ```
215
+
216
+ ## 📊 Monitoramento Pós-Publicação
217
+
218
+ ### Downloads
219
+ ```bash
220
+ # Ver estatísticas de download
221
+ npm view s3db.js
222
+
223
+ # Ver downloads semanais
224
+ open "https://www.npmjs.com/package/s3db.js"
225
+ ```
226
+
227
+ ### Issues
228
+ - Monitor: https://github.com/forattini-dev/s3db.js/issues
229
+ - Filtrar por label: `mcp`, `npx`
230
+
231
+ ## 🔄 Workflow Completo
232
+
233
+ ```bash
234
+ # 1. Fazer mudanças no código
235
+ vim mcp/entrypoint.js
236
+
237
+ # 2. Testar localmente
238
+ pnpm run test:mcp
239
+
240
+ # 3. Commit
241
+ git add .
242
+ git commit -m "feat: improve MCP server"
243
+
244
+ # 4. Bump version (roda prepublishOnly automaticamente)
245
+ npm version patch -m "feat: improve MCP server"
246
+
247
+ # 5. Push (com tag)
248
+ git push && git push --tags
249
+
250
+ # 6. Publicar
251
+ npm publish
252
+
253
+ # 7. Validar
254
+ npx -y s3db.js@latest s3db-mcp --help
255
+
256
+ # 8. Celebrar! 🎉
257
+ ```
258
+
259
+ ## 🎉 Checklist Final
260
+
261
+ Antes de publicar, confirme:
262
+
263
+ - [ ] ✅ `pnpm run build` - Build funcionando
264
+ - [ ] ✅ `pnpm run test:quick` - Tests passando
265
+ - [ ] ✅ `pnpm run test:mcp` - MCP server iniciando
266
+ - [ ] ✅ `npm pack --dry-run` - Arquivos corretos
267
+ - [ ] ✅ `ls -la mcp/entrypoint.js` - Permissões de execução
268
+ - [ ] ✅ `head -1 mcp/entrypoint.js` - Shebang presente
269
+ - [ ] ✅ `cat package.json | jq '.files'` - Inclui `mcp/`
270
+ - [ ] ✅ `cat package.json | jq '.bin'` - Inclui `s3db-mcp`
271
+ - [ ] ✅ `cat package.json | jq '.dependencies'` - MCP SDK incluído
272
+ - [ ] ✅ Version bumped
273
+ - [ ] ✅ Git committed e pushed
274
+ - [ ] ✅ Ready to publish! 🚀
275
+
276
+ ## 📚 Recursos
277
+
278
+ - [NPM Publishing Guide](https://docs.npmjs.com/cli/v9/commands/npm-publish)
279
+ - [NPM Pack Documentation](https://docs.npmjs.com/cli/v9/commands/npm-pack)
280
+ - [Semantic Versioning](https://semver.org/)
281
+ - [MCP Documentation](https://modelcontextprotocol.io)
package/mcp/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # S3DB MCP Server
2
+
3
+ > **Complete documentation has been moved to [`docs/mcp.md`](../docs/mcp.md)**
4
+
5
+ ## ⚡ Quick Start with npx (Recommended)
6
+
7
+ ### For Claude CLI
8
+ ```bash
9
+ # One command setup - no installation needed!
10
+ claude mcp add s3db \
11
+ --transport stdio \
12
+ -- npx -y s3db.js s3db-mcp --transport=stdio
13
+ ```
14
+
15
+ ### For Claude Desktop
16
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "s3db": {
21
+ "command": "npx",
22
+ "args": ["-y", "s3db.js", "s3db-mcp", "--transport=sse"],
23
+ "env": {
24
+ "S3DB_CONNECTION_STRING": "s3://ACCESS_KEY:SECRET_KEY@bucket/path"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ ### Standalone Server
32
+ ```bash
33
+ # Start HTTP server in background
34
+ npx s3db.js s3db-mcp --transport=sse
35
+ ```
36
+
37
+ 📖 **See [NPX_SETUP.md](./NPX_SETUP.md) for complete npx guide**
38
+
39
+ ## Claude Desktop Configuration
40
+
41
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
42
+
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "s3db": {
47
+ "command": "npx",
48
+ "args": ["s3db-mcp-server", "--transport=sse"],
49
+ "env": {
50
+ "S3DB_CONNECTION_STRING": "s3://ACCESS_KEY:SECRET_KEY@bucket/databases/myapp",
51
+ "S3DB_CACHE_ENABLED": "true",
52
+ "S3DB_COSTS_ENABLED": "true"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Available Tools (28 total)
60
+
61
+ ### 🔌 Connection Management
62
+ - `dbConnect`, `dbDisconnect`, `dbStatus`
63
+
64
+ ### 📦 Resource Management
65
+ - `dbCreateResource`, `dbListResources`, `dbInspectResource`
66
+
67
+ ### 🔍 Debugging Tools
68
+ - `dbGetMetadata`, `resourceValidate`, `dbHealthCheck`, `resourceGetRaw`
69
+
70
+ ### 📊 Query & Filtering
71
+ - `resourceQuery`, `resourceSearch`, `resourceList`, `resourceCount`
72
+
73
+ ### 🔧 Partition Management
74
+ - `resourceListPartitions`, `resourceListPartitionValues`
75
+ - `dbFindOrphanedPartitions`, `dbRemoveOrphanedPartitions`
76
+
77
+ ### ✏️ CRUD Operations
78
+ - `resourceInsert`, `resourceInsertMany`, `resourceGet`, `resourceGetMany`
79
+ - `resourceUpdate`, `resourceUpsert`, `resourceDelete`, `resourceDeleteMany`
80
+
81
+ ### 🚀 Bulk Operations
82
+ - `resourceUpdateMany`, `resourceBulkUpsert`, `resourceDeleteAll`
83
+
84
+ ### 💾 Export/Import
85
+ - `resourceExport`, `resourceImport`, `dbBackupMetadata`
86
+
87
+ ### 📈 Monitoring
88
+ - `dbGetStats`, `resourceGetStats`, `cacheGetStats`, `dbClearCache`
89
+
90
+ ## Full Documentation
91
+
92
+ For complete documentation including:
93
+ - Detailed tool descriptions and parameters
94
+ - Configuration examples for AWS, MinIO, DigitalOcean
95
+ - Docker deployment guides
96
+ - Performance optimization tips
97
+ - Troubleshooting guides
98
+ - Security best practices
99
+
100
+ **See [`docs/mcp.md`](../docs/mcp.md)**
101
+
102
+ ## Environment Variables
103
+
104
+ ```bash
105
+ # Connection
106
+ S3DB_CONNECTION_STRING=s3://key:secret@bucket/prefix
107
+
108
+ # Cache
109
+ S3DB_CACHE_ENABLED=true
110
+ S3DB_CACHE_DRIVER=memory # or 'filesystem'
111
+ S3DB_CACHE_MAX_SIZE=1000
112
+ S3DB_CACHE_TTL=300000
113
+
114
+ # Server
115
+ MCP_TRANSPORT=sse
116
+ MCP_SERVER_HOST=0.0.0.0
117
+ MCP_SERVER_PORT=17500
118
+ ```
119
+
120
+ ## Resources
121
+
122
+ - [Full MCP Documentation](../docs/mcp.md)
123
+ - [S3DB Documentation](../README.md)
124
+ - [GitHub Repository](https://github.com/forattini-dev/s3db.js)
125
+ - [NPM Package](https://www.npmjs.com/package/s3db.js)
@@ -0,0 +1,120 @@
1
+ services:
2
+ s3db-mcp-server:
3
+ build:
4
+ context: .
5
+ dockerfile: Dockerfile
6
+ image: s3db-mcp-server:latest
7
+ container_name: s3db-mcp-server
8
+ restart: unless-stopped
9
+ env_file:
10
+ - path: .env
11
+ required: false # Makes the file optional
12
+ environment:
13
+ # Server configuration
14
+ - NODE_ENV=${NODE_ENV:-production}
15
+ - MCP_SERVER_HOST=${MCP_SERVER_HOST:-0.0.0.0}
16
+ - MCP_SERVER_PORT=${MCP_SERVER_PORT:-17500}
17
+ - MCP_TRANSPORT=${MCP_TRANSPORT:-sse}
18
+
19
+ # S3DB configuration
20
+ - S3DB_CONNECTION_STRING=${S3DB_CONNECTION_STRING}
21
+ - S3DB_VERBOSE=${S3DB_VERBOSE:-false}
22
+ - S3DB_PARALLELISM=${S3DB_PARALLELISM:-10}
23
+ - S3DB_PASSPHRASE=${S3DB_PASSPHRASE:-secret}
24
+ - S3DB_VERSIONING_ENABLED=${S3DB_VERSIONING_ENABLED:-false}
25
+
26
+ # Plugin configuration
27
+ - S3DB_COSTS_ENABLED=${S3DB_COSTS_ENABLED:-true}
28
+ - S3DB_CACHE_ENABLED=${S3DB_CACHE_ENABLED:-true}
29
+ - S3DB_CACHE_DRIVER=${S3DB_CACHE_DRIVER:-memory}
30
+ - S3DB_CACHE_MAX_SIZE=${S3DB_CACHE_MAX_SIZE:-1000}
31
+ - S3DB_CACHE_TTL=${S3DB_CACHE_TTL:-300000}
32
+ - S3DB_CACHE_DIRECTORY=${S3DB_CACHE_DIRECTORY:-./cache}
33
+ - S3DB_CACHE_PREFIX=${S3DB_CACHE_PREFIX:-s3db}
34
+
35
+ # AWS credentials (optional if using IAM roles)
36
+ - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
37
+ - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
38
+ - AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}
39
+ - AWS_REGION=${AWS_REGION:-us-east-1}
40
+
41
+ # S3-compatible endpoints (MinIO, DigitalOcean, etc.)
42
+ - S3_ENDPOINT=${S3_ENDPOINT}
43
+ - S3_FORCE_PATH_STYLE=${S3_FORCE_PATH_STYLE:-false}
44
+ ports:
45
+ - "${MCP_SERVER_PORT:-17500}:8000"
46
+ volumes:
47
+ # Mount for configuration files if needed
48
+ - type: bind
49
+ source: ./config
50
+ target: /app/config
51
+ # Mount cache directory for filesystem cache persistence
52
+ - type: bind
53
+ source: ./cache-data
54
+ target: /app/cache
55
+ bind:
56
+ create_host_path: true
57
+ networks:
58
+ - s3db-mcp-network
59
+ healthcheck:
60
+ test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
61
+ interval: 30s
62
+ timeout: 10s
63
+ retries: 3
64
+ start_period: 40s
65
+ logging:
66
+ driver: "json-file"
67
+ options:
68
+ max-size: "10m"
69
+ max-file: "3"
70
+
71
+ # Optional: LocalStack for local S3 testing
72
+ localstack:
73
+ image: localstack/localstack:3.8
74
+ container_name: s3db-localstack
75
+ restart: unless-stopped
76
+ environment:
77
+ - SERVICES=s3
78
+ - DEBUG=1
79
+ - DATA_DIR=/tmp/localstack/data
80
+ - DOCKER_HOST=unix:///var/run/docker.sock
81
+ - DEFAULT_REGION=us-east-1
82
+ ports:
83
+ - "17566:4566"
84
+ - "17510-17559:4510-4559"
85
+ volumes:
86
+ - "localstack-data:/tmp/localstack"
87
+ - "/var/run/docker.sock:/var/run/docker.sock"
88
+ networks:
89
+ - s3db-mcp-network
90
+ profiles:
91
+ - local-testing
92
+
93
+ # Optional: MinIO for local S3-compatible testing
94
+ minio:
95
+ image: minio/minio:latest
96
+ container_name: s3db-minio
97
+ restart: unless-stopped
98
+ environment:
99
+ - MINIO_ROOT_USER=${MINIO_ROOT_USER:-minioadmin}
100
+ - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-minioadmin}
101
+ command: server /data --console-address ":9001"
102
+ ports:
103
+ - "17998:9000"
104
+ - "17999:9001"
105
+ volumes:
106
+ - "minio-data:/data"
107
+ networks:
108
+ - s3db-mcp-network
109
+ profiles:
110
+ - local-testing
111
+
112
+ networks:
113
+ s3db-mcp-network:
114
+ driver: bridge
115
+
116
+ volumes:
117
+ localstack-data:
118
+ driver: local
119
+ minio-data:
120
+ driver: local