mpx-db 1.1.2 โ 1.2.0
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/LICENSE +19 -9
- package/README.md +119 -342
- package/package.json +19 -15
- package/src/cli.js +20 -11
- package/src/commands/connections.js +2 -0
- package/src/commands/data.js +4 -2
- package/src/commands/migrate.js +42 -10
- package/src/commands/query.js +10 -5
- package/src/commands/schema.js +25 -5
- package/src/db/base-adapter.js +17 -1
- package/src/db/mysql-adapter.js +6 -1
- package/src/db/postgres-adapter.js +12 -1
- package/src/db/sqlite-adapter.js +5 -5
- package/src/mcp.js +1 -1
- package/src/reporters/pdf.js +286 -0
- package/src/schema.js +39 -2
package/LICENSE
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
Mesaplex Dual License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 Mesaplex
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
This software is available under two licensing options:
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
1. FREE TIER (Personal Use)
|
|
8
|
+
- Limited daily usage
|
|
9
|
+
- Basic features only
|
|
10
|
+
- Personal and non-commercial use only
|
|
11
|
+
|
|
12
|
+
Permission is granted to use this software for personal, non-commercial
|
|
13
|
+
purposes subject to the usage limits described in the documentation.
|
|
14
|
+
|
|
15
|
+
2. PRO LICENSE (Commercial Use)
|
|
16
|
+
- Unlimited usage
|
|
17
|
+
- All features unlocked
|
|
18
|
+
- JSON/CSV export
|
|
19
|
+
- CI/CD integration
|
|
20
|
+
- Commercial use allowed
|
|
21
|
+
- Priority support
|
|
22
|
+
|
|
23
|
+
To obtain a Pro license, visit: https://mesaplex.com
|
|
14
24
|
|
|
15
25
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
26
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
package/README.md
CHANGED
|
@@ -1,293 +1,167 @@
|
|
|
1
|
-
# mpx-db
|
|
1
|
+
# mpx-db ๐๏ธ
|
|
2
2
|
|
|
3
|
-
**Database management CLI
|
|
3
|
+
**Database management CLI โ connect, query, migrate, and manage databases from the terminal.**
|
|
4
4
|
|
|
5
|
-
Stop juggling multiple database tools.
|
|
5
|
+
Stop juggling multiple database tools. One clean interface for SQLite, PostgreSQL, and MySQL.
|
|
6
|
+
|
|
7
|
+
Part of the [Mesaplex](https://mesaplex.com) developer toolchain.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/mpx-db)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
6
12
|
|
|
7
13
|
## Features
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
- **Multi-database support** โ SQLite, PostgreSQL, MySQL
|
|
16
|
+
- **Beautiful output** โ Colored tables, not raw dumps
|
|
17
|
+
- **Connection management** โ Save connections, no more copy-pasting URLs
|
|
18
|
+
- **Migration system** โ Git-friendly SQL migration files
|
|
19
|
+
- **Schema operations** โ Dump, describe, visualize database structure
|
|
20
|
+
- **Data export** โ Export to JSON/CSV with one command
|
|
21
|
+
- **Secure** โ Encrypted credential storage (AES-256-GCM)
|
|
22
|
+
- **MCP server** โ Integrates with any MCP-compatible AI agent
|
|
23
|
+
- **Self-documenting** โ `--schema` returns machine-readable tool description
|
|
17
24
|
|
|
18
25
|
## Installation
|
|
19
26
|
|
|
20
27
|
```bash
|
|
21
28
|
npm install -g mpx-db
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Install database drivers you need (optional peer dependencies):
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
```bash
|
|
24
34
|
npm install -g better-sqlite3 # For SQLite
|
|
25
35
|
npm install -g pg # For PostgreSQL
|
|
26
36
|
npm install -g mysql2 # For MySQL
|
|
27
37
|
```
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
Or run directly with npx:
|
|
30
40
|
|
|
31
41
|
```bash
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# Save a connection for reuse
|
|
36
|
-
mpx-db connect --save dev sqlite://./dev.db
|
|
37
|
-
mpx-db connect --save prod postgres://user:pass@localhost:5432/mydb
|
|
42
|
+
npx mpx-db --help
|
|
43
|
+
```
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
mpx-db connections list
|
|
45
|
+
**Requirements:** Node.js 18+ ยท macOS, Linux, Windows
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
mpx-db query dev "SELECT * FROM users LIMIT 10"
|
|
47
|
+
## Quick Start
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
```bash
|
|
50
|
+
# Connect and save
|
|
51
|
+
mpx-db connect --save dev sqlite://./dev.db
|
|
47
52
|
|
|
48
|
-
# List
|
|
53
|
+
# List tables
|
|
49
54
|
mpx-db tables dev
|
|
50
55
|
|
|
56
|
+
# Run a query
|
|
57
|
+
mpx-db query dev "SELECT * FROM users LIMIT 10"
|
|
58
|
+
|
|
51
59
|
# Describe a table
|
|
52
60
|
mpx-db describe dev users
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Connection Strings
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
# SQLite (file-based)
|
|
59
|
-
sqlite://./database.db
|
|
60
|
-
sqlite:///absolute/path/to/db.sqlite
|
|
61
|
-
|
|
62
|
-
# PostgreSQL
|
|
63
|
-
postgres://user:password@localhost:5432/database
|
|
64
|
-
postgresql://user:password@host:5432/db
|
|
65
61
|
|
|
66
|
-
#
|
|
67
|
-
|
|
62
|
+
# Export data
|
|
63
|
+
mpx-db export dev users --format json
|
|
68
64
|
```
|
|
69
65
|
|
|
70
|
-
##
|
|
66
|
+
## Usage
|
|
71
67
|
|
|
72
68
|
### Connection Management
|
|
73
69
|
|
|
74
70
|
```bash
|
|
75
|
-
|
|
76
|
-
mpx-db
|
|
71
|
+
mpx-db connect --save <name> <url> # Save a connection
|
|
72
|
+
mpx-db connections list # List saved connections
|
|
73
|
+
mpx-db connections remove <name> # Remove a connection
|
|
74
|
+
```
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
mpx-db connections list
|
|
76
|
+
Connection string formats:
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
```
|
|
79
|
+
sqlite://./database.db
|
|
80
|
+
postgres://user:password@localhost:5432/database
|
|
81
|
+
mysql://user:password@localhost:3306/database
|
|
83
82
|
```
|
|
84
83
|
|
|
85
84
|
### Querying
|
|
86
85
|
|
|
87
86
|
```bash
|
|
88
|
-
# Run a query
|
|
89
87
|
mpx-db query <connection> "SELECT * FROM users WHERE active = 1"
|
|
90
|
-
|
|
91
|
-
# Query with saved connection
|
|
92
|
-
mpx-db query dev "SELECT COUNT(*) FROM orders"
|
|
93
88
|
```
|
|
94
89
|
|
|
95
90
|
### Schema Operations
|
|
96
91
|
|
|
97
92
|
```bash
|
|
98
|
-
#
|
|
99
|
-
mpx-db
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
mpx-db tables <connection>
|
|
103
|
-
|
|
104
|
-
# Describe table structure
|
|
105
|
-
mpx-db describe <connection> <table>
|
|
106
|
-
|
|
107
|
-
# Dump entire schema as SQL
|
|
108
|
-
mpx-db schema dump <connection>
|
|
93
|
+
mpx-db info <connection> # Database information
|
|
94
|
+
mpx-db tables <connection> # List tables with row counts
|
|
95
|
+
mpx-db describe <connection> <table> # Table structure
|
|
96
|
+
mpx-db schema dump <connection> # Dump schema as SQL
|
|
109
97
|
```
|
|
110
98
|
|
|
111
99
|
### Migrations
|
|
112
100
|
|
|
113
101
|
```bash
|
|
114
|
-
# Initialize migrations directory
|
|
115
|
-
mpx-db migrate
|
|
116
|
-
|
|
117
|
-
#
|
|
118
|
-
mpx-db migrate
|
|
119
|
-
|
|
120
|
-
# Show migration status
|
|
121
|
-
mpx-db migrate status <connection>
|
|
122
|
-
|
|
123
|
-
# Run pending migrations
|
|
124
|
-
mpx-db migrate up <connection>
|
|
125
|
-
|
|
126
|
-
# Rollback last migration
|
|
127
|
-
mpx-db migrate down <connection>
|
|
102
|
+
mpx-db migrate init # Initialize migrations directory
|
|
103
|
+
mpx-db migrate create <name> # Create a new migration
|
|
104
|
+
mpx-db migrate status <connection> # Show migration status
|
|
105
|
+
mpx-db migrate up <connection> # Run pending migrations
|
|
106
|
+
mpx-db migrate down <connection> # Rollback last migration
|
|
128
107
|
```
|
|
129
108
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Migrations are SQL files in `./migrations/` directory:
|
|
109
|
+
Migration file format (`./migrations/`):
|
|
133
110
|
|
|
134
111
|
```sql
|
|
135
|
-
-- Migration: add_users_table
|
|
136
|
-
-- Created: 2026-02-15T10:30:00.000Z
|
|
137
|
-
|
|
138
112
|
-- Up migration
|
|
139
113
|
CREATE TABLE users (
|
|
140
114
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
141
115
|
email TEXT UNIQUE NOT NULL,
|
|
142
|
-
name TEXT NOT NULL
|
|
143
|
-
created_at TEXT DEFAULT CURRENT_TIMESTAMP
|
|
116
|
+
name TEXT NOT NULL
|
|
144
117
|
);
|
|
145
118
|
|
|
146
|
-
CREATE INDEX idx_users_email ON users(email);
|
|
147
|
-
|
|
148
|
-
-- Down migration (rollback)
|
|
149
119
|
-- DOWN
|
|
150
|
-
DROP INDEX idx_users_email;
|
|
151
120
|
DROP TABLE users;
|
|
152
121
|
```
|
|
153
122
|
|
|
154
|
-
### Data
|
|
123
|
+
### Data Export
|
|
155
124
|
|
|
156
125
|
```bash
|
|
157
|
-
|
|
158
|
-
mpx-db export
|
|
159
|
-
|
|
160
|
-
# Export to CSV
|
|
161
|
-
mpx-db export dev users --format csv --output data.csv
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
## Examples
|
|
165
|
-
|
|
166
|
-
### Setting Up a New Project
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# Initialize migrations
|
|
170
|
-
mpx-db migrate init
|
|
171
|
-
|
|
172
|
-
# Create your first migration
|
|
173
|
-
mpx-db migrate create create_initial_schema
|
|
174
|
-
|
|
175
|
-
# Edit migrations/YYYYMMDD_HHMMSS_create_initial_schema.sql
|
|
176
|
-
# Add your CREATE TABLE statements
|
|
177
|
-
|
|
178
|
-
# Connect to database
|
|
179
|
-
mpx-db connect --save dev sqlite://./dev.db
|
|
180
|
-
|
|
181
|
-
# Run migrations
|
|
182
|
-
mpx-db migrate up dev
|
|
183
|
-
|
|
184
|
-
# Verify
|
|
185
|
-
mpx-db tables dev
|
|
186
|
-
mpx-db info dev
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Managing Multiple Environments
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
# Save connections for each environment
|
|
193
|
-
mpx-db connect --save dev sqlite://./dev.db
|
|
194
|
-
mpx-db connect --save staging postgres://user:pass@staging-host/mydb
|
|
195
|
-
mpx-db connect --save prod postgres://user:pass@prod-host/mydb
|
|
196
|
-
|
|
197
|
-
# Run migrations on each
|
|
198
|
-
mpx-db migrate up dev
|
|
199
|
-
mpx-db migrate up staging
|
|
200
|
-
mpx-db migrate up prod
|
|
201
|
-
|
|
202
|
-
# Compare schemas (visual inspection)
|
|
203
|
-
mpx-db schema dump dev > dev-schema.sql
|
|
204
|
-
mpx-db schema dump prod > prod-schema.sql
|
|
205
|
-
diff dev-schema.sql prod-schema.sql
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Daily Workflow
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
# Check database status
|
|
212
|
-
mpx-db info dev
|
|
213
|
-
mpx-db tables dev
|
|
214
|
-
|
|
215
|
-
# Run a quick query
|
|
216
|
-
mpx-db query dev "SELECT COUNT(*) FROM orders WHERE created_at > date('now', '-1 day')"
|
|
217
|
-
|
|
218
|
-
# Describe a table before modifying it
|
|
219
|
-
mpx-db describe dev orders
|
|
220
|
-
|
|
221
|
-
# Create a migration for changes
|
|
222
|
-
mpx-db migrate create add_order_status_field
|
|
223
|
-
|
|
224
|
-
# Export data for backup/analysis
|
|
225
|
-
mpx-db export dev orders --format csv --output orders-backup.csv
|
|
126
|
+
mpx-db export <connection> <table> --format json
|
|
127
|
+
mpx-db export <connection> <table> --format csv --output data.csv
|
|
226
128
|
```
|
|
227
129
|
|
|
228
130
|
## AI Agent Usage
|
|
229
131
|
|
|
230
|
-
|
|
132
|
+
mpx-db is designed to be used by AI agents as well as humans.
|
|
231
133
|
|
|
232
134
|
### JSON Output
|
|
233
135
|
|
|
234
|
-
Add `--json` to any command for structured output:
|
|
136
|
+
Add `--json` to any command for structured, machine-readable output:
|
|
235
137
|
|
|
236
138
|
```bash
|
|
237
|
-
# Query with JSON output
|
|
238
139
|
mpx-db query dev "SELECT * FROM users LIMIT 3" --json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```json
|
|
239
143
|
{
|
|
240
144
|
"success": true,
|
|
241
145
|
"type": "query",
|
|
242
146
|
"rows": [
|
|
243
|
-
{ "id": 1, "name": "Alice", "email": "alice@example.com" }
|
|
244
|
-
{ "id": 2, "name": "Bob", "email": "bob@example.com" },
|
|
245
|
-
{ "id": 3, "name": "Charlie", "email": "charlie@example.com" }
|
|
147
|
+
{ "id": 1, "name": "Alice", "email": "alice@example.com" }
|
|
246
148
|
],
|
|
247
|
-
"rowCount":
|
|
149
|
+
"rowCount": 1,
|
|
248
150
|
"duration": 12
|
|
249
151
|
}
|
|
250
|
-
|
|
251
|
-
# List tables with JSON
|
|
252
|
-
mpx-db tables dev --json
|
|
253
|
-
{
|
|
254
|
-
"tables": [
|
|
255
|
-
{ "name": "users", "type": "table", "rowCount": 150 },
|
|
256
|
-
{ "name": "orders", "type": "table", "rowCount": 892 }
|
|
257
|
-
]
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
# Migration status
|
|
261
|
-
mpx-db migrate status dev --json
|
|
262
|
-
{
|
|
263
|
-
"migrations": [
|
|
264
|
-
{ "name": "20260215_100000_create_users", "status": "applied", "appliedAt": "2026-02-15T10:05:00.000Z" },
|
|
265
|
-
{ "name": "20260216_120000_add_orders", "status": "pending", "appliedAt": null }
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
152
|
```
|
|
269
153
|
|
|
270
154
|
### Schema Discovery
|
|
271
155
|
|
|
272
|
-
Get the full command schema for AI agent integration:
|
|
273
|
-
|
|
274
156
|
```bash
|
|
275
157
|
mpx-db --schema
|
|
276
158
|
```
|
|
277
159
|
|
|
278
|
-
Returns a
|
|
279
|
-
|
|
280
|
-
### MCP (Model Context Protocol) Server
|
|
281
|
-
|
|
282
|
-
Run `mpx-db` as an MCP server for seamless AI agent integration:
|
|
160
|
+
Returns a complete JSON schema describing all commands, flags, inputs, outputs, and examples.
|
|
283
161
|
|
|
284
|
-
|
|
285
|
-
mpx-db mcp
|
|
286
|
-
```
|
|
162
|
+
### MCP Integration
|
|
287
163
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
164
|
+
Add to your MCP client configuration (Claude Desktop, Cursor, Windsurf, etc.):
|
|
291
165
|
|
|
292
166
|
```json
|
|
293
167
|
{
|
|
@@ -300,181 +174,84 @@ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_
|
|
|
300
174
|
}
|
|
301
175
|
```
|
|
302
176
|
|
|
303
|
-
|
|
177
|
+
The MCP server exposes these tools:
|
|
178
|
+
- **`query`** โ Execute SQL queries
|
|
179
|
+
- **`list_tables`** โ Get all tables with row counts
|
|
180
|
+
- **`describe_table`** โ Show table schema
|
|
181
|
+
- **`get_info`** โ Database information
|
|
182
|
+
- **`export_table`** โ Export table data as JSON
|
|
183
|
+
- **`get_schema`** โ Get full command schema
|
|
304
184
|
|
|
305
|
-
|
|
185
|
+
### Exit Codes
|
|
306
186
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
- `export_table` โ Export table data as JSON
|
|
312
|
-
- `get_schema` โ Get full command schema
|
|
187
|
+
| Code | Meaning |
|
|
188
|
+
|------|---------|
|
|
189
|
+
| 0 | Success |
|
|
190
|
+
| 1 | Error (connection failed, query failed, etc.) |
|
|
313
191
|
|
|
314
|
-
###
|
|
192
|
+
### PDF Reports
|
|
315
193
|
|
|
316
|
-
|
|
194
|
+
Generate professional PDF reports from queries and schema dumps:
|
|
317
195
|
|
|
318
196
|
```bash
|
|
319
|
-
#
|
|
320
|
-
mpx-db
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Exit Codes
|
|
324
|
-
|
|
325
|
-
Predictable exit codes for CI/CD and scripting:
|
|
197
|
+
# Schema report โ full database structure as PDF
|
|
198
|
+
mpx-db schema dump <connection> --pdf schema-report.pdf
|
|
326
199
|
|
|
327
|
-
|
|
328
|
-
-
|
|
329
|
-
|
|
330
|
-
```bash
|
|
331
|
-
#!/bin/bash
|
|
332
|
-
if mpx-db query dev "SELECT 1" --quiet; then
|
|
333
|
-
echo "Database is up"
|
|
334
|
-
else
|
|
335
|
-
echo "Database is down"
|
|
336
|
-
exit 1
|
|
337
|
-
fi
|
|
200
|
+
# Query results as PDF
|
|
201
|
+
mpx-db query <connection> "SELECT * FROM users" --pdf results.pdf
|
|
338
202
|
```
|
|
339
203
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
```javascript
|
|
343
|
-
// AI agent discovers available commands
|
|
344
|
-
const schema = await exec('mpx-db --schema');
|
|
204
|
+
PDFs include formatted tables, database metadata, and Mesaplex branding. Great for sharing with teammates or archiving.
|
|
345
205
|
|
|
346
|
-
|
|
347
|
-
const result = await exec('mpx-db query dev "SELECT * FROM orders WHERE status = \'pending\'" --json');
|
|
348
|
-
const orders = JSON.parse(result.stdout);
|
|
206
|
+
### Automation Tips
|
|
349
207
|
|
|
350
|
-
|
|
351
|
-
|
|
208
|
+
- Use `--json` for machine-parseable output
|
|
209
|
+
- Use `--pdf <file>` for formatted reports
|
|
210
|
+
- Use `--quiet` to suppress banners and progress info
|
|
211
|
+
- Pipe output to `jq` for filtering
|
|
212
|
+
- Check exit codes for pass/fail in CI/CD
|
|
352
213
|
|
|
353
|
-
|
|
354
|
-
await exec('mpx-db migrate up dev --json --quiet');
|
|
355
|
-
```
|
|
214
|
+
## Database Support
|
|
356
215
|
|
|
357
|
-
|
|
216
|
+
| Database | Driver Package | Notes |
|
|
217
|
+
|------------|-------------------|--------------------------|
|
|
218
|
+
| SQLite | better-sqlite3 | File-based, great for dev|
|
|
219
|
+
| PostgreSQL | pg | Full support |
|
|
220
|
+
| MySQL | mysql2 | Full support |
|
|
358
221
|
|
|
359
|
-
|
|
360
|
-
mpx-db/
|
|
361
|
-
โโโ bin/
|
|
362
|
-
โ โโโ mpx-db.js # CLI entry point
|
|
363
|
-
โโโ src/
|
|
364
|
-
โ โโโ cli.js # Command definitions
|
|
365
|
-
โ โโโ commands/ # Command implementations
|
|
366
|
-
โ โ โโโ connections.js
|
|
367
|
-
โ โ โโโ query.js
|
|
368
|
-
โ โ โโโ schema.js
|
|
369
|
-
โ โ โโโ migrate.js
|
|
370
|
-
โ โ โโโ data.js
|
|
371
|
-
โ โโโ db/ # Database adapters
|
|
372
|
-
โ โ โโโ base-adapter.js
|
|
373
|
-
โ โ โโโ sqlite-adapter.js
|
|
374
|
-
โ โ โโโ postgres-adapter.js
|
|
375
|
-
โ โ โโโ mysql-adapter.js
|
|
376
|
-
โ โ โโโ connection.js
|
|
377
|
-
โ โโโ utils/ # Utilities
|
|
378
|
-
โ โโโ crypto.js # Credential encryption
|
|
379
|
-
โ โโโ config.js # Config management
|
|
380
|
-
โโโ test/ # Test suite
|
|
381
|
-
```
|
|
222
|
+
Drivers are optional peer dependencies โ install only what you need. If a driver is missing, you'll get a helpful error message.
|
|
382
223
|
|
|
383
224
|
## Security
|
|
384
225
|
|
|
385
226
|
- **Encrypted credentials** โ Connection strings with passwords are encrypted using AES-256-GCM
|
|
386
227
|
- **Local storage** โ Credentials stored in `~/.mpx-db/connections.json` with 600 permissions
|
|
387
|
-
- **Key management** โ Encryption key
|
|
388
|
-
|
|
389
|
-
โ ๏ธ **Note:** While credentials are encrypted at rest, this is not a substitute for proper secrets management in production. For production deployments, use environment variables or a secrets manager.
|
|
390
|
-
|
|
391
|
-
## Database Support
|
|
392
|
-
|
|
393
|
-
| Database | Status | Driver Package | Notes |
|
|
394
|
-
|------------|--------|-------------------|--------------------------|
|
|
395
|
-
| SQLite | โ
| better-sqlite3 | File-based, great for dev|
|
|
396
|
-
| PostgreSQL | โ
| pg | Full support |
|
|
397
|
-
| MySQL | โ
| mysql2 | Full support |
|
|
398
|
-
|
|
399
|
-
**Note:** Database drivers are optional peer dependencies. Install only what you need:
|
|
400
|
-
|
|
401
|
-
```bash
|
|
402
|
-
npm install -g better-sqlite3 # For SQLite
|
|
403
|
-
npm install -g pg # For PostgreSQL
|
|
404
|
-
npm install -g mysql2 # For MySQL
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
If you try to connect without the required driver, you'll get a helpful error message:
|
|
228
|
+
- **Key management** โ Encryption key in `~/.mpx-db/.key` (auto-generated)
|
|
408
229
|
|
|
409
|
-
|
|
410
|
-
โ SQLite driver not found. Install it with:
|
|
411
|
-
npm install better-sqlite3
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
## Testing
|
|
415
|
-
|
|
416
|
-
```bash
|
|
417
|
-
# Run all tests
|
|
418
|
-
npm test
|
|
419
|
-
|
|
420
|
-
# Run tests in watch mode
|
|
421
|
-
npm run test:watch
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
Test suite includes:
|
|
425
|
-
- Connection management (4 tests)
|
|
426
|
-
- Schema operations (4 tests)
|
|
427
|
-
- Query operations (5 tests)
|
|
428
|
-
- Migrations (4 tests)
|
|
429
|
-
- Data export (3 tests)
|
|
230
|
+
โ ๏ธ For production, use environment variables or a secrets manager rather than saved connections.
|
|
430
231
|
|
|
431
|
-
|
|
232
|
+
## Free vs Pro
|
|
432
233
|
|
|
433
|
-
|
|
234
|
+
All features are currently available in the free tier.
|
|
434
235
|
|
|
435
|
-
**
|
|
236
|
+
**Upgrade to Pro:** [https://mesaplex.com/mpx-db](https://mesaplex.com/mpx-db)
|
|
436
237
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
**Inspiration:** Tools like [Skeema](https://www.skeema.io/) prove this model works. But Skeema is MySQL-only and expensive for small teams. `mpx-db` is open source, multi-database, and focused on developer ergonomics.
|
|
440
|
-
|
|
441
|
-
## Roadmap
|
|
442
|
-
|
|
443
|
-
**v1.1 (Current)** โ
|
|
444
|
-
- SQLite, PostgreSQL, MySQL support
|
|
445
|
-
- Connection management
|
|
446
|
-
- Query execution with beautiful output
|
|
447
|
-
- Schema inspection (dump, describe, tables, info)
|
|
448
|
-
- Migration system (create, up, down, status)
|
|
449
|
-
- Data export (JSON, CSV)
|
|
450
|
-
- **AI-native features:** JSON output (`--json`), schema discovery (`--schema`), MCP server mode
|
|
451
|
-
- **Quiet mode** (`--quiet`) for scripting
|
|
452
|
-
- Predictable exit codes
|
|
453
|
-
|
|
454
|
-
**v1.2 (Planned)**
|
|
455
|
-
- Interactive query REPL mode
|
|
456
|
-
- Query history and favorites
|
|
457
|
-
- Auto-complete for table/column names
|
|
458
|
-
- Migration templates (create table, add column, etc.)
|
|
238
|
+
## License
|
|
459
239
|
|
|
460
|
-
|
|
461
|
-
- Schema diff between environments
|
|
462
|
-
- Auto-generate migrations from schema changes
|
|
463
|
-
- Visual schema diagrams (ASCII art)
|
|
464
|
-
- Data seeding from JSON/CSV
|
|
465
|
-
- Database backup & restore
|
|
466
|
-
- Support for MongoDB, Redis
|
|
240
|
+
Dual License โ Free tier for personal use, Pro license for commercial use and advanced features. See [LICENSE](LICENSE) for full terms.
|
|
467
241
|
|
|
468
|
-
##
|
|
242
|
+
## Links
|
|
469
243
|
|
|
470
|
-
|
|
244
|
+
- **Website:** [https://mesaplex.com](https://mesaplex.com)
|
|
245
|
+
- **npm:** [https://www.npmjs.com/package/mpx-db](https://www.npmjs.com/package/mpx-db)
|
|
246
|
+
- **GitHub:** [https://github.com/mesaplexdev/mpx-db](https://github.com/mesaplexdev/mpx-db)
|
|
247
|
+
- **Support:** support@mesaplex.com
|
|
471
248
|
|
|
472
|
-
|
|
249
|
+
### Related Tools
|
|
473
250
|
|
|
474
|
-
|
|
251
|
+
- **[mpx-scan](https://www.npmjs.com/package/mpx-scan)** โ Website security scanner
|
|
252
|
+
- **[mpx-api](https://www.npmjs.com/package/mpx-api)** โ API testing, mocking, and documentation
|
|
253
|
+
- **[mpx-secrets-audit](https://www.npmjs.com/package/mpx-secrets-audit)** โ Secret lifecycle tracking and audit
|
|
475
254
|
|
|
476
255
|
---
|
|
477
256
|
|
|
478
|
-
**
|
|
479
|
-
|
|
480
|
-
**Made by Mesaplex** โ Build tools that actually work.
|
|
257
|
+
**Made with โค๏ธ by [Mesaplex](https://mesaplex.com)**
|