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 +1 -1
- package/dist/s3db.es.js +1 -1
- package/package.json +1 -1
- package/mcp/CLAUDE_CLI_SETUP.md +0 -302
- package/mcp/Dockerfile +0 -45
- package/mcp/Makefile +0 -162
- package/mcp/NPX_SETUP.md +0 -327
- package/mcp/PUBLISHING.md +0 -281
- package/mcp/README.md +0 -125
- package/mcp/docker-compose.yml +0 -120
- package/mcp/examples/test-filesystem-cache.js +0 -147
- package/mcp/examples/test-mcp.js +0 -433
- package/mcp/package.json +0 -66
package/mcp/README.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
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)
|
package/mcp/docker-compose.yml
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Test script to demonstrate FilesystemCache functionality
|
|
5
|
-
* This tests the cache directly without the full MCP server
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { FilesystemCache } from '../src/plugins/cache/filesystem-cache.class.js';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
|
|
15
|
-
async function testFilesystemCache() {
|
|
16
|
-
console.log('๐งช Testing FilesystemCache Implementation');
|
|
17
|
-
console.log('=========================================\n');
|
|
18
|
-
|
|
19
|
-
const cacheDir = path.join(__dirname, '../test-cache-demo');
|
|
20
|
-
|
|
21
|
-
// Create cache instance
|
|
22
|
-
const cache = new FilesystemCache({
|
|
23
|
-
directory: cacheDir,
|
|
24
|
-
prefix: 'demo',
|
|
25
|
-
ttl: 10000, // 10 seconds for quick testing
|
|
26
|
-
enableCompression: true,
|
|
27
|
-
enableStats: true,
|
|
28
|
-
enableCleanup: true,
|
|
29
|
-
cleanupInterval: 5000, // 5 seconds for quick testing
|
|
30
|
-
createDirectory: true
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
console.log('๐ Cache directory:', cacheDir);
|
|
34
|
-
console.log('โ๏ธ Configuration:', {
|
|
35
|
-
ttl: '10 seconds',
|
|
36
|
-
compression: 'enabled',
|
|
37
|
-
cleanup: 'enabled (5s interval)'
|
|
38
|
-
});
|
|
39
|
-
console.log();
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
// Test 1: Set some cache data
|
|
43
|
-
console.log('๐ Test 1: Setting cache data');
|
|
44
|
-
await cache.set('user:123', {
|
|
45
|
-
id: 123,
|
|
46
|
-
name: 'John Doe',
|
|
47
|
-
email: 'john@example.com',
|
|
48
|
-
profile: { bio: 'Software developer', avatar: 'https://example.com/avatar.jpg' }
|
|
49
|
-
});
|
|
50
|
-
await cache.set('user:456', {
|
|
51
|
-
id: 456,
|
|
52
|
-
name: 'Jane Smith',
|
|
53
|
-
email: 'jane@example.com'
|
|
54
|
-
});
|
|
55
|
-
await cache.set('config:app', {
|
|
56
|
-
theme: 'dark',
|
|
57
|
-
language: 'en',
|
|
58
|
-
notifications: true
|
|
59
|
-
});
|
|
60
|
-
console.log('โ
Set 3 cache entries');
|
|
61
|
-
console.log();
|
|
62
|
-
|
|
63
|
-
// Test 2: Get cache data
|
|
64
|
-
console.log('๐ Test 2: Getting cache data');
|
|
65
|
-
const user123 = await cache.get('user:123');
|
|
66
|
-
const user456 = await cache.get('user:456');
|
|
67
|
-
const config = await cache.get('config:app');
|
|
68
|
-
console.log('โ
User 123:', user123?.name);
|
|
69
|
-
console.log('โ
User 456:', user456?.name);
|
|
70
|
-
console.log('โ
Config theme:', config?.theme);
|
|
71
|
-
console.log();
|
|
72
|
-
|
|
73
|
-
// Test 3: Cache size and keys
|
|
74
|
-
console.log('๐ Test 3: Cache statistics');
|
|
75
|
-
const size = await cache.size();
|
|
76
|
-
const keys = await cache.keys();
|
|
77
|
-
console.log('โ
Cache size:', size);
|
|
78
|
-
console.log('โ
Cache keys:', keys);
|
|
79
|
-
console.log();
|
|
80
|
-
|
|
81
|
-
// Test 4: Cache stats
|
|
82
|
-
console.log('๐ Test 4: Cache performance stats');
|
|
83
|
-
const stats = cache.getStats();
|
|
84
|
-
console.log('โ
Statistics:', {
|
|
85
|
-
hits: stats.hits,
|
|
86
|
-
misses: stats.misses,
|
|
87
|
-
sets: stats.sets,
|
|
88
|
-
directory: stats.directory,
|
|
89
|
-
compression: stats.compression
|
|
90
|
-
});
|
|
91
|
-
console.log();
|
|
92
|
-
|
|
93
|
-
// Test 5: Non-existent key
|
|
94
|
-
console.log('โ Test 5: Getting non-existent key');
|
|
95
|
-
const notFound = await cache.get('user:999');
|
|
96
|
-
console.log('โ
Non-existent key result:', notFound);
|
|
97
|
-
console.log();
|
|
98
|
-
|
|
99
|
-
// Test 6: Clear specific key
|
|
100
|
-
console.log('๐๏ธ Test 6: Deleting specific key');
|
|
101
|
-
await cache.del('user:456');
|
|
102
|
-
const deletedUser = await cache.get('user:456');
|
|
103
|
-
console.log('โ
Deleted user result:', deletedUser);
|
|
104
|
-
console.log();
|
|
105
|
-
|
|
106
|
-
// Test 7: Wait for TTL expiration
|
|
107
|
-
console.log('โฑ๏ธ Test 7: Waiting for TTL expiration (10 seconds)...');
|
|
108
|
-
console.log(' This demonstrates automatic cleanup of expired files');
|
|
109
|
-
|
|
110
|
-
// Wait 12 seconds to ensure TTL expiration
|
|
111
|
-
await new Promise(resolve => setTimeout(resolve, 12000));
|
|
112
|
-
|
|
113
|
-
const expiredUser = await cache.get('user:123');
|
|
114
|
-
const expiredConfig = await cache.get('config:app');
|
|
115
|
-
console.log('โ
Expired user (should be null):', expiredUser);
|
|
116
|
-
console.log('โ
Expired config (should be null):', expiredConfig);
|
|
117
|
-
console.log();
|
|
118
|
-
|
|
119
|
-
// Test 8: Final cache state
|
|
120
|
-
console.log('๐ Test 8: Final cache state');
|
|
121
|
-
const finalSize = await cache.size();
|
|
122
|
-
const finalKeys = await cache.keys();
|
|
123
|
-
console.log('โ
Final cache size:', finalSize);
|
|
124
|
-
console.log('โ
Final cache keys:', finalKeys);
|
|
125
|
-
console.log();
|
|
126
|
-
|
|
127
|
-
// Test 9: Clear all cache
|
|
128
|
-
console.log('๐งน Test 9: Clearing all cache');
|
|
129
|
-
await cache.clear();
|
|
130
|
-
const clearedSize = await cache.size();
|
|
131
|
-
console.log('โ
Cache size after clear:', clearedSize);
|
|
132
|
-
console.log();
|
|
133
|
-
|
|
134
|
-
// Cleanup
|
|
135
|
-
cache.destroy();
|
|
136
|
-
console.log('โ
All FilesystemCache tests completed successfully!');
|
|
137
|
-
console.log('๐๏ธ Check the cache directory for any remaining files:', cacheDir);
|
|
138
|
-
|
|
139
|
-
} catch (error) {
|
|
140
|
-
console.error('โ Test failed:', error.message);
|
|
141
|
-
console.error(error.stack);
|
|
142
|
-
process.exit(1);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Run the test
|
|
147
|
-
testFilesystemCache().catch(console.error);
|