s3db.js 11.3.1 → 11.3.2

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/mcp/NPX_SETUP.md DELETED
@@ -1,327 +0,0 @@
1
- # 🚀 NPX Setup - S3DB MCP Server
2
-
3
- Use o S3DB MCP Server diretamente com `npx` - sem precisar clonar o repositório!
4
-
5
- ## ⚡ Quick Start (30 segundos)
6
-
7
- ### Para Claude CLI
8
-
9
- ```bash
10
- # Adicionar o MCP server
11
- claude mcp add s3db \
12
- --transport stdio \
13
- -- npx -y s3db.js s3db-mcp --transport=stdio
14
- ```
15
-
16
- Pronto! Agora você pode usar todas as 39 tools do S3DB no Claude CLI.
17
-
18
- ### Para Claude Desktop
19
-
20
- Edite `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) ou equivalente:
21
-
22
- ```json
23
- {
24
- "mcpServers": {
25
- "s3db": {
26
- "command": "npx",
27
- "args": ["-y", "s3db.js", "s3db-mcp", "--transport=sse"],
28
- "env": {
29
- "S3DB_CONNECTION_STRING": "s3://ACCESS_KEY:SECRET_KEY@bucket/databases/myapp",
30
- "S3DB_CACHE_ENABLED": "true",
31
- "S3DB_CACHE_DRIVER": "memory",
32
- "S3DB_COSTS_ENABLED": "true"
33
- }
34
- }
35
- }
36
- }
37
- ```
38
-
39
- ## 🔧 Configurações Avançadas
40
-
41
- ### Com variáveis de ambiente
42
-
43
- ```bash
44
- claude mcp add s3db \
45
- --transport stdio \
46
- -- npx -y s3db.js s3db-mcp --transport=stdio
47
-
48
- # Depois edite para adicionar env vars
49
- claude mcp edit s3db
50
- ```
51
-
52
- Adicione:
53
- ```json
54
- {
55
- "s3db": {
56
- "transport": "stdio",
57
- "command": "npx",
58
- "args": ["-y", "s3db.js", "s3db-mcp", "--transport=stdio"],
59
- "env": {
60
- "S3DB_CONNECTION_STRING": "s3://minioadmin:minioadmin123@localhost:9000/dev-bucket?forcePathStyle=true",
61
- "S3DB_CACHE_ENABLED": "true",
62
- "S3DB_CACHE_DRIVER": "memory",
63
- "S3DB_CACHE_MAX_SIZE": "1000",
64
- "S3DB_CACHE_TTL": "300000",
65
- "S3DB_VERBOSE": "false",
66
- "S3DB_COSTS_ENABLED": "true"
67
- }
68
- }
69
- }
70
- ```
71
-
72
- ### Servidor HTTP (background)
73
-
74
- ```bash
75
- # Iniciar servidor em background
76
- npx s3db.js s3db-mcp --transport=sse &
77
-
78
- # Ou com PM2
79
- pm2 start "npx s3db.js s3db-mcp --transport=sse" --name s3db-mcp
80
-
81
- # Configurar Claude CLI para usar HTTP
82
- claude mcp add s3db --transport http http://localhost:17500/sse
83
- ```
84
-
85
- ### MCP Inspector (para testes)
86
-
87
- ```bash
88
- # Inicie o inspector
89
- npx @modelcontextprotocol/inspector
90
-
91
- # Configure o comando:
92
- npx -y s3db.js s3db-mcp --transport=stdio
93
- ```
94
-
95
- ## 🎯 Exemplos Práticos
96
-
97
- ### Exemplo 1: Development Local (MinIO)
98
-
99
- ```bash
100
- # 1. Configurar MCP
101
- claude mcp add s3db-dev \
102
- --transport stdio \
103
- -- npx -y s3db.js s3db-mcp --transport=stdio
104
-
105
- # 2. Editar para adicionar MinIO
106
- claude mcp edit s3db-dev
107
-
108
- # 3. Adicionar:
109
- {
110
- "env": {
111
- "S3DB_CONNECTION_STRING": "s3://minioadmin:minioadmin123@localhost:9000/dev-bucket?forcePathStyle=true"
112
- }
113
- }
114
-
115
- # 4. Testar
116
- claude
117
-
118
- # No chat:
119
- "Connect to the database and create a test resource"
120
- ```
121
-
122
- ### Exemplo 2: Production (AWS S3)
123
-
124
- ```bash
125
- # 1. Configurar MCP com credenciais AWS
126
- claude mcp add s3db-prod \
127
- --transport stdio \
128
- -- npx -y s3db.js s3db-mcp --transport=stdio
129
-
130
- # 2. Editar configuração
131
- claude mcp edit s3db-prod
132
-
133
- # 3. Adicionar credenciais seguras:
134
- {
135
- "env": {
136
- "S3DB_CONNECTION_STRING": "s3://prod-data-bucket/databases/main",
137
- "AWS_ACCESS_KEY_ID": "AKIA...",
138
- "AWS_SECRET_ACCESS_KEY": "...",
139
- "AWS_REGION": "us-east-1",
140
- "S3DB_CACHE_DRIVER": "filesystem",
141
- "S3DB_CACHE_DIRECTORY": "/tmp/s3db-cache"
142
- }
143
- }
144
- ```
145
-
146
- ### Exemplo 3: Múltiplos Ambientes
147
-
148
- ```bash
149
- # Development
150
- claude mcp add s3db-dev \
151
- --transport stdio \
152
- -- npx -y s3db.js s3db-mcp --transport=stdio
153
-
154
- # Staging
155
- claude mcp add s3db-staging \
156
- --transport stdio \
157
- -- npx -y s3db.js s3db-mcp --transport=stdio
158
-
159
- # Production
160
- claude mcp add s3db-prod \
161
- --transport stdio \
162
- -- npx -y s3db.js s3db-mcp --transport=stdio
163
-
164
- # Ver todos
165
- claude mcp list
166
- ```
167
-
168
- ## 🧪 Testando a Instalação
169
-
170
- ### 1. Verificar se o comando funciona
171
-
172
- ```bash
173
- # Testar diretamente
174
- npx -y s3db.js s3db-mcp --help
175
-
176
- # Deve mostrar informações do servidor
177
- ```
178
-
179
- ### 2. Verificar configuração MCP
180
-
181
- ```bash
182
- claude mcp list
183
- ```
184
-
185
- Deve mostrar:
186
- ```
187
- s3db - stdio://npx -y s3db.js s3db-mcp --transport=stdio
188
- ```
189
-
190
- ### 3. Testar no Claude
191
-
192
- ```bash
193
- claude
194
- ```
195
-
196
- No chat:
197
- ```
198
- "Can you show me the S3DB MCP server status and list available tools?"
199
- ```
200
-
201
- ## 🔍 Comandos Úteis
202
-
203
- ```bash
204
- # Ver servidores configurados
205
- claude mcp list
206
-
207
- # Ver detalhes de um servidor
208
- claude mcp show s3db
209
-
210
- # Remover servidor
211
- claude mcp remove s3db
212
-
213
- # Editar configuração
214
- claude mcp edit s3db
215
-
216
- # Testar servidor diretamente
217
- npx -y s3db.js s3db-mcp --transport=stdio
218
- ```
219
-
220
- ## 📊 Variáveis de Ambiente Disponíveis
221
-
222
- ### Connection
223
- ```bash
224
- S3DB_CONNECTION_STRING="s3://key:secret@bucket/path"
225
- AWS_ACCESS_KEY_ID="AKIA..."
226
- AWS_SECRET_ACCESS_KEY="..."
227
- AWS_REGION="us-east-1"
228
- ```
229
-
230
- ### Cache
231
- ```bash
232
- S3DB_CACHE_ENABLED="true"
233
- S3DB_CACHE_DRIVER="memory" # ou "filesystem"
234
- S3DB_CACHE_MAX_SIZE="1000" # apenas para memory
235
- S3DB_CACHE_TTL="300000" # 5 minutos em ms
236
- S3DB_CACHE_DIRECTORY="./cache" # apenas para filesystem
237
- S3DB_CACHE_PREFIX="s3db"
238
- ```
239
-
240
- ### Server
241
- ```bash
242
- MCP_TRANSPORT="sse" # ou "stdio"
243
- MCP_SERVER_HOST="0.0.0.0"
244
- MCP_SERVER_PORT="17500"
245
- NODE_ENV="production" # ou "development"
246
- ```
247
-
248
- ### S3DB Core
249
- ```bash
250
- S3DB_VERBOSE="false"
251
- S3DB_PARALLELISM="10"
252
- S3DB_PASSPHRASE="secret"
253
- S3DB_VERSIONING_ENABLED="false"
254
- S3DB_COSTS_ENABLED="true"
255
- ```
256
-
257
- ## 🐛 Troubleshooting
258
-
259
- ### Erro: "command not found: npx"
260
-
261
- ```bash
262
- # Instalar Node.js/npm primeiro
263
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
264
- nvm install --lts
265
- ```
266
-
267
- ### Erro: "package not found: s3db.js"
268
-
269
- ```bash
270
- # Verificar se o pacote existe
271
- npm view s3db.js
272
-
273
- # Usar versão específica
274
- npx s3db.js@latest s3db-mcp --transport=stdio
275
- ```
276
-
277
- ### Erro: "Database not connected"
278
-
279
- No chat do Claude, sempre conecte primeiro:
280
- ```
281
- "Please connect to the database using dbConnect with connection string: s3://..."
282
- ```
283
-
284
- ### Servidor não responde
285
-
286
- ```bash
287
- # Verificar se está rodando
288
- ps aux | grep s3db-mcp
289
-
290
- # Matar processos antigos
291
- pkill -f s3db-mcp
292
-
293
- # Reiniciar
294
- npx -y s3db.js s3db-mcp --transport=sse
295
- ```
296
-
297
- ### Ver logs detalhados
298
-
299
- ```bash
300
- # Ativar verbose mode
301
- S3DB_VERBOSE=true npx -y s3db.js s3db-mcp --transport=stdio
302
- ```
303
-
304
- ## 🎉 Vantagens do npx
305
-
306
- ✅ **Sem instalação** - não precisa clonar o repo
307
- ✅ **Sempre atualizado** - usa a última versão publicada
308
- ✅ **Fácil de compartilhar** - um comando funciona para todos
309
- ✅ **Zero configuração** - funciona out-of-the-box
310
- ✅ **Multi-ambiente** - configure dev/staging/prod facilmente
311
-
312
- ## 📚 Recursos
313
-
314
- - [MCP Documentation](https://modelcontextprotocol.io)
315
- - [S3DB Documentation](../README.md)
316
- - [Full MCP Guide](../docs/mcp.md)
317
- - [Claude CLI](https://docs.claude.com/en/docs/claude-code)
318
- - [NPM Package](https://www.npmjs.com/package/s3db.js)
319
-
320
- ## ⚡ One-Liner Setup
321
-
322
- ```bash
323
- # Tudo em um comando:
324
- claude mcp add s3db --transport stdio -- npx -y s3db.js s3db-mcp --transport=stdio && echo "✅ S3DB MCP Server configured! Type 'claude' to start."
325
- ```
326
-
327
- Pronto! Agora você pode usar `npx s3db.js s3db-mcp` de qualquer lugar! 🚀
package/mcp/PUBLISHING.md DELETED
@@ -1,281 +0,0 @@
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)