s3db.js 11.2.5 → 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.
- package/README.md +138 -0
- package/dist/s3db.cjs.js +67 -2
- package/dist/s3db.cjs.js.map +1 -1
- package/dist/s3db.d.ts +3 -1
- package/dist/s3db.es.js +67 -2
- package/dist/s3db.es.js.map +1 -1
- package/mcp/.env.example +117 -0
- package/mcp/CLAUDE_CLI_SETUP.md +302 -0
- package/mcp/Dockerfile +45 -0
- package/mcp/Makefile +162 -0
- package/mcp/NPX_SETUP.md +327 -0
- package/mcp/PUBLISHING.md +281 -0
- package/mcp/README.md +125 -0
- package/mcp/docker-compose.yml +120 -0
- package/mcp/{server.js → entrypoint.js} +1941 -683
- package/mcp/examples/test-filesystem-cache.js +147 -0
- package/mcp/examples/test-mcp.js +433 -0
- package/mcp/package.json +66 -0
- package/mcp/tools/bulk.js +112 -0
- package/mcp/tools/connection.js +228 -0
- package/mcp/tools/crud.js +579 -0
- package/mcp/tools/debugging.js +299 -0
- package/mcp/tools/export-import.js +281 -0
- package/mcp/tools/index.js +67 -0
- package/mcp/tools/partitions.js +223 -0
- package/mcp/tools/query.js +150 -0
- package/mcp/tools/resources.js +96 -0
- package/mcp/tools/stats.js +281 -0
- package/package.json +17 -7
- package/src/database.class.js +1 -1
- package/src/resource.class.js +79 -0
- package/src/s3db.d.ts +3 -1
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
|