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/dist/s3db.cjs.js CHANGED
@@ -15283,7 +15283,7 @@ class Database extends EventEmitter {
15283
15283
  this.id = idGenerator(7);
15284
15284
  this.version = "1";
15285
15285
  this.s3dbVersion = (() => {
15286
- const [ok, err, version] = tryFn(() => true ? "11.3.1" : "latest");
15286
+ const [ok, err, version] = tryFn(() => true ? "11.3.2" : "latest");
15287
15287
  return ok ? version : "latest";
15288
15288
  })();
15289
15289
  this.resources = {};
package/dist/s3db.es.js CHANGED
@@ -15279,7 +15279,7 @@ class Database extends EventEmitter {
15279
15279
  this.id = idGenerator(7);
15280
15280
  this.version = "1";
15281
15281
  this.s3dbVersion = (() => {
15282
- const [ok, err, version] = tryFn(() => true ? "11.3.1" : "latest");
15282
+ const [ok, err, version] = tryFn(() => true ? "11.3.2" : "latest");
15283
15283
  return ok ? version : "latest";
15284
15284
  })();
15285
15285
  this.resources = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s3db.js",
3
- "version": "11.3.1",
3
+ "version": "11.3.2",
4
4
  "description": "Use AWS S3, the world's most reliable document storage, as a database with this ORM.",
5
5
  "main": "dist/s3db.cjs.js",
6
6
  "module": "dist/s3db.es.js",
@@ -1,302 +0,0 @@
1
- # 🚀 Claude CLI Setup Guide
2
-
3
- Este guia mostra como configurar o S3DB MCP Server para usar com o Claude CLI.
4
-
5
- ## 📋 Pré-requisitos
6
-
7
- ```bash
8
- # Verificar se Claude CLI está instalado
9
- claude --version
10
-
11
- # Verificar se o projeto está instalado
12
- cd /home/ff/work/martech/s3db.js
13
- pnpm install
14
-
15
- # Instalar dependências do MCP (se ainda não estiver)
16
- pnpm add zod@3 express
17
- ```
18
-
19
- ## 🔌 Métodos de Configuração
20
-
21
- ### Método 1: Stdio Transport (Recomendado para desenvolvimento)
22
-
23
- O Claude CLI vai spawnar o servidor automaticamente quando necessário.
24
-
25
- ```bash
26
- claude mcp add s3db \
27
- --transport stdio \
28
- -- node /home/ff/work/martech/s3db.js/mcp/entrypoint.js --transport=stdio
29
- ```
30
-
31
- **Variáveis de ambiente** (opcional):
32
- ```bash
33
- # Editar configuração para adicionar env vars
34
- claude mcp edit s3db
35
-
36
- # Adicionar na seção env:
37
- {
38
- "s3db": {
39
- "transport": "stdio",
40
- "command": "node",
41
- "args": ["/home/ff/work/martech/s3db.js/mcp/entrypoint.js", "--transport=stdio"],
42
- "env": {
43
- "S3DB_CONNECTION_STRING": "s3://minioadmin:minioadmin123@localhost:9000/dev-bucket?forcePathStyle=true",
44
- "S3DB_CACHE_ENABLED": "true",
45
- "S3DB_CACHE_DRIVER": "memory",
46
- "S3DB_VERBOSE": "false"
47
- }
48
- }
49
- }
50
- ```
51
-
52
- ### Método 2: HTTP Transport (Recomendado para produção)
53
-
54
- Primeiro, inicie o servidor em background:
55
-
56
- ```bash
57
- # Inicie o servidor HTTP
58
- cd /home/ff/work/martech/s3db.js
59
- node mcp/entrypoint.js --transport=sse &
60
-
61
- # Ou com PM2 para auto-restart
62
- pm2 start mcp/entrypoint.js --name s3db-mcp -- --transport=sse
63
- pm2 save
64
- ```
65
-
66
- Depois configure o Claude CLI:
67
-
68
- ```bash
69
- claude mcp add s3db --transport http http://localhost:17500/sse
70
- ```
71
-
72
- ## 🧪 Testando a Configuração
73
-
74
- ### 1. Verificar servidores configurados
75
-
76
- ```bash
77
- claude mcp list
78
- ```
79
-
80
- Você deve ver:
81
- ```
82
- s3db - stdio://node /home/ff/work/martech/s3db.js/mcp/entrypoint.js --transport=stdio
83
- ```
84
-
85
- ### 2. Testar conexão
86
-
87
- ```bash
88
- # Iniciar sessão do Claude
89
- claude
90
-
91
- # No chat, testar as tools:
92
- # "Can you connect to the S3DB database and list available resources?"
93
- ```
94
-
95
- ### 3. Comandos de teste no Claude Chat
96
-
97
- ```
98
- 1. Conectar ao banco:
99
- "Connect to the S3DB database using dbConnect"
100
-
101
- 2. Listar recursos:
102
- "List all resources in the database using dbListResources"
103
-
104
- 3. Criar um recurso de teste:
105
- "Create a resource called 'test_users' with fields: name (string, required), email (string, required), age (number)"
106
-
107
- 4. Inserir dados:
108
- "Insert a test user with name 'John Doe', email 'john@example.com', age 30"
109
-
110
- 5. Ver estatísticas:
111
- "Show me database statistics including cache and costs"
112
- ```
113
-
114
- ## 🔧 Configurações Avançadas
115
-
116
- ### Configurar para múltiplos ambientes
117
-
118
- ```bash
119
- # Development (local MinIO)
120
- claude mcp add s3db-dev \
121
- --transport stdio \
122
- -- node /home/ff/work/martech/s3db.js/mcp/entrypoint.js --transport=stdio
123
-
124
- # Production (AWS S3)
125
- claude mcp add s3db-prod \
126
- --transport http \
127
- http://production-server:17500/sse
128
- ```
129
-
130
- ### Editar configuração existente
131
-
132
- ```bash
133
- # Ver configuração atual
134
- claude mcp show s3db
135
-
136
- # Editar configuração
137
- claude mcp edit s3db
138
-
139
- # Remover servidor
140
- claude mcp remove s3db
141
- ```
142
-
143
- ## 📊 Tools Disponíveis (39 total)
144
-
145
- ### 🔌 Connection Management (3)
146
- - `dbConnect` - Connect to S3DB database
147
- - `dbDisconnect` - Disconnect from database
148
- - `dbStatus` - Get connection status
149
-
150
- ### 📦 Resource Management (2)
151
- - `dbCreateResource` - Create new resource/collection
152
- - `dbListResources` - List all resources
153
-
154
- ### 🔍 Debugging Tools (5)
155
- - `dbInspectResource` - Detailed resource inspection
156
- - `dbGetMetadata` - Get raw metadata.json
157
- - `resourceValidate` - Validate data against schema
158
- - `dbHealthCheck` - Comprehensive health check
159
- - `resourceGetRaw` - Get raw S3 object data
160
-
161
- ### 📊 Query & Filtering (2)
162
- - `resourceQuery` - Complex queries with filters
163
- - `resourceSearch` - Text search in fields
164
-
165
- ### 🔧 Partition Management (4)
166
- - `resourceListPartitions` - List all partitions
167
- - `resourceListPartitionValues` - List partition values
168
- - `dbFindOrphanedPartitions` - Find orphaned partitions
169
- - `dbRemoveOrphanedPartitions` - Remove orphaned partitions
170
-
171
- ### ✏️ CRUD Operations (14)
172
- - `resourceInsert` - Insert single document
173
- - `resourceInsertMany` - Insert multiple documents
174
- - `resourceGet` - Get document by ID
175
- - `resourceGetMany` - Get multiple documents
176
- - `resourceUpdate` - Update document
177
- - `resourceUpsert` - Insert or update
178
- - `resourceDelete` - Delete document
179
- - `resourceDeleteMany` - Delete multiple documents
180
- - `resourceExists` - Check if document exists
181
- - `resourceList` - List with pagination
182
- - `resourceListIds` - List document IDs
183
- - `resourceCount` - Count documents
184
- - `resourceGetAll` - Get all documents
185
- - `resourceDeleteAll` - Delete all documents
186
-
187
- ### 🚀 Bulk Operations (2)
188
- - `resourceUpdateMany` - Update multiple documents
189
- - `resourceBulkUpsert` - Bulk upsert operation
190
-
191
- ### 💾 Export/Import (3)
192
- - `resourceExport` - Export to JSON/CSV/NDJSON
193
- - `resourceImport` - Import from JSON/NDJSON
194
- - `dbBackupMetadata` - Backup metadata.json
195
-
196
- ### 📈 Monitoring (4)
197
- - `dbGetStats` - Database statistics
198
- - `dbClearCache` - Clear cache
199
- - `resourceGetStats` - Resource statistics
200
- - `cacheGetStats` - Cache statistics
201
-
202
- ## 🐛 Troubleshooting
203
-
204
- ### Erro: "Command not found"
205
-
206
- ```bash
207
- # Usar caminho absoluto completo
208
- claude mcp add s3db \
209
- --transport stdio \
210
- -- /home/ff/.nvm/versions/node/v22.6.0/bin/node \
211
- /home/ff/work/martech/s3db.js/mcp/entrypoint.js --transport=stdio
212
- ```
213
-
214
- ### Erro: "Connection refused" (HTTP)
215
-
216
- ```bash
217
- # Verificar se o servidor está rodando
218
- curl http://localhost:17500/health
219
-
220
- # Se não estiver, inicie:
221
- cd /home/ff/work/martech/s3db.js
222
- node mcp/entrypoint.js --transport=sse
223
- ```
224
-
225
- ### Erro: "Database not connected"
226
-
227
- No chat do Claude, sempre conecte primeiro:
228
- ```
229
- "Please connect to the database first using dbConnect with connection string: s3://minioadmin:minioadmin123@localhost:9000/dev-bucket"
230
- ```
231
-
232
- ### Ver logs do servidor
233
-
234
- ```bash
235
- # Se usando PM2
236
- pm2 logs s3db-mcp
237
-
238
- # Se rodando diretamente
239
- # Os logs aparecem no terminal onde iniciou o servidor
240
- ```
241
-
242
- ## 📚 Recursos Adicionais
243
-
244
- - [MCP Documentation](https://modelcontextprotocol.io)
245
- - [S3DB Documentation](../README.md)
246
- - [Full MCP Documentation](../docs/mcp.md)
247
- - [Claude CLI Documentation](https://docs.claude.com/en/docs/claude-code)
248
-
249
- ## 🎯 Exemplos de Uso
250
-
251
- ### Exemplo 1: CRUD Básico
252
-
253
- ```
254
- User: Connect to local MinIO and create a users resource
255
-
256
- Claude will:
257
- 1. Use dbConnect with MinIO connection string
258
- 2. Use dbCreateResource to create 'users' resource
259
- 3. Confirm creation with dbListResources
260
-
261
- User: Insert 5 test users
262
-
263
- Claude will:
264
- 1. Use resourceInsertMany with test data
265
- 2. Confirm with resourceCount
266
- ```
267
-
268
- ### Exemplo 2: Análise de Performance
269
-
270
- ```
271
- User: Analyze database performance and suggest optimizations
272
-
273
- Claude will:
274
- 1. Use dbGetStats to get overall statistics
275
- 2. Use cacheGetStats to check cache performance
276
- 3. Use dbHealthCheck to find issues
277
- 4. Provide optimization suggestions
278
- ```
279
-
280
- ### Exemplo 3: Partition Recovery
281
-
282
- ```
283
- User: Check for orphaned partitions and fix them
284
-
285
- Claude will:
286
- 1. Use dbFindOrphanedPartitions to detect issues
287
- 2. Use dbRemoveOrphanedPartitions with dryRun:true to preview
288
- 3. Execute removal with dryRun:false
289
- 4. Verify with dbHealthCheck
290
- ```
291
-
292
- ## ✅ Checklist de Configuração
293
-
294
- - [ ] Claude CLI instalado e funcionando
295
- - [ ] S3DB.js projeto instalado (pnpm install)
296
- - [ ] Servidor MCP configurado (claude mcp add)
297
- - [ ] Conexão testada (claude mcp list)
298
- - [ ] Tools testadas no chat do Claude
299
- - [ ] Environment variables configuradas (se necessário)
300
- - [ ] Backup da configuração (claude mcp show s3db > backup.json)
301
-
302
- Pronto! Agora você pode usar todas as 39 tools do S3DB diretamente no Claude CLI! 🎉
package/mcp/Dockerfile DELETED
@@ -1,45 +0,0 @@
1
- # syntax=docker/dockerfile:1.9
2
- FROM node:20-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- curl \
10
- ca-certificates \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Copy package files first for better caching
14
- COPY package*.json ./
15
-
16
- # Install dependencies
17
- RUN npm ci --only=production && npm cache clean --force
18
-
19
- # Copy application code
20
- COPY s3db_mcp_server.js ./
21
-
22
- # Create non-root user
23
- RUN groupadd -r s3dbmcp && useradd -r -d /app -g s3dbmcp s3dbmcp
24
-
25
- # Change ownership to app user
26
- RUN chown -Rv s3dbmcp:s3dbmcp /app
27
-
28
- # Switch to non-root user
29
- USER s3dbmcp
30
-
31
- # Set environment variables
32
- ENV NODE_ENV=production \
33
- MCP_SERVER_HOST=0.0.0.0 \
34
- MCP_SERVER_PORT=8000 \
35
- MCP_TRANSPORT=sse
36
-
37
- # Expose port
38
- EXPOSE 8000
39
-
40
- # Health check
41
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
42
- CMD curl -f http://localhost:8001/health || exit 1
43
-
44
- # Default command
45
- CMD ["node", "s3db_mcp_server.js", "--transport=sse"]
package/mcp/Makefile DELETED
@@ -1,162 +0,0 @@
1
- # S3DB MCP Server Makefile
2
-
3
- .PHONY: help server server-v2 test test-simple test-interactive health tools minio clean
4
-
5
- # Default target
6
- help:
7
- @echo "S3DB MCP Server Commands"
8
- @echo "========================"
9
- @echo ""
10
- @echo "Server Commands:"
11
- @echo " make server - Start original MCP server (SSE)"
12
- @echo " make server-v2 - Start refactored MCP server v2 (SSE)"
13
- @echo " make server-stdio - Start server with stdio transport"
14
- @echo ""
15
- @echo "Test Commands:"
16
- @echo " make test - Run automated tests"
17
- @echo " make test-simple - Run simple HTTP tests"
18
- @echo " make test-mock - Run tests with mock client"
19
- @echo " make test-interactive - Interactive test client"
20
- @echo ""
21
- @echo "Utility Commands:"
22
- @echo " make health - Check server health"
23
- @echo " make tools - List available tools"
24
- @echo " make minio - Start MinIO for local testing"
25
- @echo " make clean - Clean cache and temp files"
26
- @echo ""
27
- @echo "Docker Commands:"
28
- @echo " make docker-build - Build Docker image"
29
- @echo " make docker-run - Run in Docker container"
30
- @echo " make docker-compose - Start with docker-compose"
31
-
32
- # Server targets
33
- server:
34
- @echo "Starting MCP Server (original)..."
35
- @node server.js --transport=sse
36
-
37
- server-v2:
38
- @echo "Starting MCP Server v2..."
39
- @node server-v2.js --transport=sse
40
-
41
- server-stdio:
42
- @echo "Starting MCP Server (stdio)..."
43
- @node server-v2.js --transport=stdio
44
-
45
- # Test targets
46
- test:
47
- @echo "Running automated tests..."
48
- @node test-mcp-v2.js
49
-
50
- test-simple:
51
- @echo "Running simple tests..."
52
- @node test-simple.js
53
-
54
- test-mock:
55
- @echo "Running tests with mock client..."
56
- @node test-mcp-v2.js --mock
57
-
58
- test-interactive:
59
- @echo "Starting interactive test client..."
60
- @node test-mcp-v2.js --interactive
61
-
62
- # Utility targets
63
- health:
64
- @echo "Checking server health..."
65
- @curl -s http://localhost:8001/health | jq '.' || echo "Server not running"
66
-
67
- tools:
68
- @echo "Listing available tools..."
69
- @curl -s http://localhost:8001/tools | jq '.' || echo "Server not running"
70
-
71
- minio:
72
- @echo "Starting MinIO..."
73
- @docker run -d \
74
- --name minio-s3db \
75
- -p 9000:9000 \
76
- -p 9001:9001 \
77
- -e MINIO_ROOT_USER=minioadmin \
78
- -e MINIO_ROOT_PASSWORD=minioadmin \
79
- -v minio-data:/data \
80
- minio/minio server /data --console-address ":9001"
81
- @echo "MinIO started at http://localhost:9000 (console: http://localhost:9001)"
82
- @echo "Credentials: minioadmin/minioadmin"
83
-
84
- minio-stop:
85
- @echo "Stopping MinIO..."
86
- @docker stop minio-s3db && docker rm minio-s3db
87
-
88
- # Docker targets
89
- docker-build:
90
- @echo "Building Docker image..."
91
- @docker build -t s3db-mcp-server .
92
-
93
- docker-run:
94
- @echo "Running in Docker..."
95
- @docker run -it --rm \
96
- -p 8000:8000 \
97
- -p 8001:8001 \
98
- -e S3DB_CONNECTION=$${S3DB_CONNECTION} \
99
- s3db-mcp-server
100
-
101
- docker-compose:
102
- @echo "Starting with docker-compose..."
103
- @docker-compose up -d
104
-
105
- docker-compose-down:
106
- @echo "Stopping docker-compose..."
107
- @docker-compose down
108
-
109
- # Clean target
110
- clean:
111
- @echo "Cleaning cache and temp files..."
112
- @rm -rf cache/
113
- @rm -rf ./test-cache/
114
- @rm -f *.log
115
- @echo "Cleaned!"
116
-
117
- # Development targets
118
- dev:
119
- @echo "Starting development environment..."
120
- @make minio
121
- @sleep 2
122
- @make server-v2 &
123
- @sleep 2
124
- @make test-simple
125
-
126
- dev-stop:
127
- @echo "Stopping development environment..."
128
- @pkill -f "node server" || true
129
- @make minio-stop
130
-
131
- # Watch for changes
132
- watch:
133
- @echo "Watching for changes..."
134
- @nodemon --watch lib --watch server-v2.js --exec "make server-v2"
135
-
136
- # Benchmark
137
- benchmark:
138
- @echo "Running benchmarks..."
139
- @node test-mcp-v2.js --benchmark
140
-
141
- # Installation
142
- install:
143
- @echo "Installing dependencies..."
144
- @pnpm install
145
- @pnpm install -D @modelcontextprotocol/sdk nodemon
146
-
147
- # Environment setup
148
- setup:
149
- @echo "Setting up environment..."
150
- @cp .env.example .env 2>/dev/null || echo "No .env.example found"
151
- @echo "S3DB_CONNECTION=s3://minioadmin:minioadmin@test-bucket?endpoint=http://localhost:9000&forcePathStyle=true" >> .env
152
- @echo "MCP_TRANSPORT=sse" >> .env
153
- @echo "MCP_SERVER_HOST=0.0.0.0" >> .env
154
- @echo "MCP_SERVER_PORT=8000" >> .env
155
- @echo "Environment setup complete!"
156
-
157
- # Combined targets
158
- all: install setup minio server-v2
159
-
160
- test-all: test-simple test-mock
161
-
162
- .DEFAULT_GOAL := help