db-mcp 1.0.2 → 1.1.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/.gitattributes +2 -0
- package/LICENSE +1 -1
- package/README.md +244 -518
- package/dist/chunk-4IA3DB5C.js +135 -0
- package/dist/chunk-AOUL5SHS.js +930 -0
- package/dist/chunk-DWJXQEFA.js +13759 -0
- package/dist/chunk-DZQLDEQS.js +879 -0
- package/dist/chunk-S5IDDSSB.js +74 -0
- package/dist/chunk-Z2GFQU3G.js +363 -0
- package/dist/cli.d.ts +0 -7
- package/dist/cli.js +227 -183
- package/dist/http-VSB7DBJR.js +1541 -0
- package/dist/index.d.ts +842 -10
- package/dist/index.js +5 -17
- package/dist/sqlite-VHBA4ABV.js +600 -0
- package/dist/sqlite-native-D2LH5ZT7.js +2498 -0
- package/dist/worker-script.d.ts +2 -0
- package/dist/worker-script.js +126 -0
- package/package.json +26 -16
- package/playwright.config.ts +101 -0
- package/scripts/generate-server-instructions.ts +111 -0
- package/server.json +5 -6
- package/test-server/README.md +118 -0
- package/test-server/code-map.md +409 -0
- package/test-server/fixtures/sample.csv +6 -0
- package/test-server/reset-database.ps1 +373 -0
- package/test-server/sample.csv +11 -0
- package/test-server/test-agent-experience.md +243 -0
- package/test-server/test-database.sql +388 -0
- package/test-server/test-group-tools.md +861 -0
- package/test-server/test-help-resources.mjs +238 -0
- package/test-server/test-preflight.md +53 -0
- package/test-server/test-prompts.md +354 -0
- package/test-server/test-resources.md +245 -0
- package/test-server/test-tool-annotations.mjs +157 -0
- package/test-server/test-tools-advanced-1.md +517 -0
- package/test-server/test-tools-advanced-2.md +487 -0
- package/test-server/test-tools-codemode.md +629 -0
- package/test-server/test-tools.md +176 -0
- package/test-server/tool-reference.md +236 -0
- package/tsconfig.test.json +9 -0
- package/dist/adapters/DatabaseAdapter.d.ts +0 -141
- package/dist/adapters/DatabaseAdapter.d.ts.map +0 -1
- package/dist/adapters/DatabaseAdapter.js +0 -131
- package/dist/adapters/DatabaseAdapter.js.map +0 -1
- package/dist/adapters/sqlite/SchemaManager.d.ts +0 -58
- package/dist/adapters/sqlite/SchemaManager.d.ts.map +0 -1
- package/dist/adapters/sqlite/SchemaManager.js +0 -187
- package/dist/adapters/sqlite/SchemaManager.js.map +0 -1
- package/dist/adapters/sqlite/SqliteAdapter.d.ts +0 -161
- package/dist/adapters/sqlite/SqliteAdapter.d.ts.map +0 -1
- package/dist/adapters/sqlite/SqliteAdapter.js +0 -741
- package/dist/adapters/sqlite/SqliteAdapter.js.map +0 -1
- package/dist/adapters/sqlite/index.d.ts +0 -9
- package/dist/adapters/sqlite/index.d.ts.map +0 -1
- package/dist/adapters/sqlite/index.js +0 -8
- package/dist/adapters/sqlite/index.js.map +0 -1
- package/dist/adapters/sqlite/json-utils.d.ts +0 -100
- package/dist/adapters/sqlite/json-utils.d.ts.map +0 -1
- package/dist/adapters/sqlite/json-utils.js +0 -274
- package/dist/adapters/sqlite/json-utils.js.map +0 -1
- package/dist/adapters/sqlite/output-schemas.d.ts +0 -1187
- package/dist/adapters/sqlite/output-schemas.d.ts.map +0 -1
- package/dist/adapters/sqlite/output-schemas.js +0 -1337
- package/dist/adapters/sqlite/output-schemas.js.map +0 -1
- package/dist/adapters/sqlite/prompts.d.ts +0 -13
- package/dist/adapters/sqlite/prompts.d.ts.map +0 -1
- package/dist/adapters/sqlite/prompts.js +0 -605
- package/dist/adapters/sqlite/prompts.js.map +0 -1
- package/dist/adapters/sqlite/resources.d.ts +0 -13
- package/dist/adapters/sqlite/resources.d.ts.map +0 -1
- package/dist/adapters/sqlite/resources.js +0 -251
- package/dist/adapters/sqlite/resources.js.map +0 -1
- package/dist/adapters/sqlite/tools/admin.d.ts +0 -14
- package/dist/adapters/sqlite/tools/admin.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/admin.js +0 -788
- package/dist/adapters/sqlite/tools/admin.js.map +0 -1
- package/dist/adapters/sqlite/tools/core.d.ts +0 -25
- package/dist/adapters/sqlite/tools/core.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/core.js +0 -359
- package/dist/adapters/sqlite/tools/core.js.map +0 -1
- package/dist/adapters/sqlite/tools/fts.d.ts +0 -13
- package/dist/adapters/sqlite/tools/fts.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/fts.js +0 -347
- package/dist/adapters/sqlite/tools/fts.js.map +0 -1
- package/dist/adapters/sqlite/tools/geo.d.ts +0 -14
- package/dist/adapters/sqlite/tools/geo.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/geo.js +0 -252
- package/dist/adapters/sqlite/tools/geo.js.map +0 -1
- package/dist/adapters/sqlite/tools/index.d.ts +0 -30
- package/dist/adapters/sqlite/tools/index.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/index.js +0 -61
- package/dist/adapters/sqlite/tools/index.js.map +0 -1
- package/dist/adapters/sqlite/tools/json-helpers.d.ts +0 -14
- package/dist/adapters/sqlite/tools/json-helpers.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/json-helpers.js +0 -477
- package/dist/adapters/sqlite/tools/json-helpers.js.map +0 -1
- package/dist/adapters/sqlite/tools/json-operations.d.ts +0 -14
- package/dist/adapters/sqlite/tools/json-operations.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/json-operations.js +0 -839
- package/dist/adapters/sqlite/tools/json-operations.js.map +0 -1
- package/dist/adapters/sqlite/tools/stats.d.ts +0 -15
- package/dist/adapters/sqlite/tools/stats.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/stats.js +0 -1219
- package/dist/adapters/sqlite/tools/stats.js.map +0 -1
- package/dist/adapters/sqlite/tools/text.d.ts +0 -14
- package/dist/adapters/sqlite/tools/text.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/text.js +0 -1141
- package/dist/adapters/sqlite/tools/text.js.map +0 -1
- package/dist/adapters/sqlite/tools/vector.d.ts +0 -14
- package/dist/adapters/sqlite/tools/vector.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/vector.js +0 -613
- package/dist/adapters/sqlite/tools/vector.js.map +0 -1
- package/dist/adapters/sqlite/tools/virtual.d.ts +0 -13
- package/dist/adapters/sqlite/tools/virtual.d.ts.map +0 -1
- package/dist/adapters/sqlite/tools/virtual.js +0 -930
- package/dist/adapters/sqlite/tools/virtual.js.map +0 -1
- package/dist/adapters/sqlite/types.d.ts +0 -207
- package/dist/adapters/sqlite/types.d.ts.map +0 -1
- package/dist/adapters/sqlite/types.js +0 -186
- package/dist/adapters/sqlite/types.js.map +0 -1
- package/dist/adapters/sqlite-native/NativeSqliteAdapter.d.ts +0 -163
- package/dist/adapters/sqlite-native/NativeSqliteAdapter.d.ts.map +0 -1
- package/dist/adapters/sqlite-native/NativeSqliteAdapter.js +0 -748
- package/dist/adapters/sqlite-native/NativeSqliteAdapter.js.map +0 -1
- package/dist/adapters/sqlite-native/index.d.ts +0 -11
- package/dist/adapters/sqlite-native/index.d.ts.map +0 -1
- package/dist/adapters/sqlite-native/index.js +0 -11
- package/dist/adapters/sqlite-native/index.js.map +0 -1
- package/dist/adapters/sqlite-native/tools/spatialite.d.ts +0 -19
- package/dist/adapters/sqlite-native/tools/spatialite.d.ts.map +0 -1
- package/dist/adapters/sqlite-native/tools/spatialite.js +0 -628
- package/dist/adapters/sqlite-native/tools/spatialite.js.map +0 -1
- package/dist/adapters/sqlite-native/tools/transactions.d.ts +0 -12
- package/dist/adapters/sqlite-native/tools/transactions.d.ts.map +0 -1
- package/dist/adapters/sqlite-native/tools/transactions.js +0 -255
- package/dist/adapters/sqlite-native/tools/transactions.js.map +0 -1
- package/dist/adapters/sqlite-native/tools/window.d.ts +0 -12
- package/dist/adapters/sqlite-native/tools/window.d.ts.map +0 -1
- package/dist/adapters/sqlite-native/tools/window.js +0 -370
- package/dist/adapters/sqlite-native/tools/window.js.map +0 -1
- package/dist/auth/AuthorizationServerDiscovery.d.ts +0 -90
- package/dist/auth/AuthorizationServerDiscovery.d.ts.map +0 -1
- package/dist/auth/AuthorizationServerDiscovery.js +0 -204
- package/dist/auth/AuthorizationServerDiscovery.js.map +0 -1
- package/dist/auth/OAuthResourceServer.d.ts +0 -65
- package/dist/auth/OAuthResourceServer.d.ts.map +0 -1
- package/dist/auth/OAuthResourceServer.js +0 -121
- package/dist/auth/OAuthResourceServer.js.map +0 -1
- package/dist/auth/TokenValidator.d.ts +0 -60
- package/dist/auth/TokenValidator.d.ts.map +0 -1
- package/dist/auth/TokenValidator.js +0 -235
- package/dist/auth/TokenValidator.js.map +0 -1
- package/dist/auth/errors.d.ts +0 -74
- package/dist/auth/errors.d.ts.map +0 -1
- package/dist/auth/errors.js +0 -133
- package/dist/auth/errors.js.map +0 -1
- package/dist/auth/index.d.ts +0 -13
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -15
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/middleware.d.ts +0 -81
- package/dist/auth/middleware.d.ts.map +0 -1
- package/dist/auth/middleware.js +0 -291
- package/dist/auth/middleware.js.map +0 -1
- package/dist/auth/scopes.d.ts +0 -136
- package/dist/auth/scopes.d.ts.map +0 -1
- package/dist/auth/scopes.js +0 -349
- package/dist/auth/scopes.js.map +0 -1
- package/dist/auth/types.d.ts +0 -257
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -8
- package/dist/auth/types.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/constants/ServerInstructions.d.ts +0 -45
- package/dist/constants/ServerInstructions.d.ts.map +0 -1
- package/dist/constants/ServerInstructions.js +0 -356
- package/dist/constants/ServerInstructions.js.map +0 -1
- package/dist/filtering/ToolConstants.d.ts +0 -34
- package/dist/filtering/ToolConstants.d.ts.map +0 -1
- package/dist/filtering/ToolConstants.js +0 -174
- package/dist/filtering/ToolConstants.js.map +0 -1
- package/dist/filtering/ToolFilter.d.ts +0 -82
- package/dist/filtering/ToolFilter.d.ts.map +0 -1
- package/dist/filtering/ToolFilter.js +0 -296
- package/dist/filtering/ToolFilter.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/server/McpServer.d.ts +0 -61
- package/dist/server/McpServer.d.ts.map +0 -1
- package/dist/server/McpServer.js +0 -270
- package/dist/server/McpServer.js.map +0 -1
- package/dist/transports/http.d.ts +0 -134
- package/dist/transports/http.d.ts.map +0 -1
- package/dist/transports/http.js +0 -516
- package/dist/transports/http.js.map +0 -1
- package/dist/transports/index.d.ts +0 -5
- package/dist/transports/index.d.ts.map +0 -1
- package/dist/transports/index.js +0 -5
- package/dist/transports/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -380
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -68
- package/dist/types/index.js.map +0 -1
- package/dist/utils/annotations.d.ts +0 -44
- package/dist/utils/annotations.d.ts.map +0 -1
- package/dist/utils/annotations.js +0 -77
- package/dist/utils/annotations.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -155
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -329
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/identifiers.d.ts +0 -121
- package/dist/utils/identifiers.d.ts.map +0 -1
- package/dist/utils/identifiers.js +0 -319
- package/dist/utils/identifiers.js.map +0 -1
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -7
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/insightsManager.d.ts +0 -39
- package/dist/utils/insightsManager.d.ts.map +0 -1
- package/dist/utils/insightsManager.js +0 -63
- package/dist/utils/insightsManager.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -189
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -394
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/progress-utils.d.ts +0 -54
- package/dist/utils/progress-utils.d.ts.map +0 -1
- package/dist/utils/progress-utils.js +0 -74
- package/dist/utils/progress-utils.js.map +0 -1
- package/dist/utils/resourceAnnotations.d.ts +0 -36
- package/dist/utils/resourceAnnotations.d.ts.map +0 -1
- package/dist/utils/resourceAnnotations.js +0 -57
- package/dist/utils/resourceAnnotations.js.map +0 -1
- package/dist/utils/where-clause.d.ts +0 -41
- package/dist/utils/where-clause.d.ts.map +0 -1
- package/dist/utils/where-clause.js +0 -116
- package/dist/utils/where-clause.js.map +0 -1
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
-- =============================================================================
|
|
2
|
+
-- DB-MCP Test Database - Seed Data
|
|
3
|
+
-- =============================================================================
|
|
4
|
+
-- This file creates all test tables needed for comprehensive testing of
|
|
5
|
+
-- the db-mcp SQLite MCP server's 9 tool groups.
|
|
6
|
+
--
|
|
7
|
+
-- Usage: sqlite3 test.db < test-database.sql
|
|
8
|
+
-- =============================================================================
|
|
9
|
+
|
|
10
|
+
-- =============================================================================
|
|
11
|
+
-- CORE + STATS: Products and Orders
|
|
12
|
+
-- =============================================================================
|
|
13
|
+
|
|
14
|
+
DROP TABLE IF EXISTS test_products;
|
|
15
|
+
CREATE TABLE IF NOT EXISTS test_products (
|
|
16
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
17
|
+
name TEXT NOT NULL,
|
|
18
|
+
description TEXT,
|
|
19
|
+
price REAL,
|
|
20
|
+
category TEXT,
|
|
21
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
INSERT INTO test_products (name, description, price, category) VALUES
|
|
25
|
+
('Laptop Pro 15', 'High-performance laptop with 15-inch display', 1299.99, 'electronics'),
|
|
26
|
+
('Wireless Mouse', 'Ergonomic wireless mouse with precision tracking', 49.99, 'electronics'),
|
|
27
|
+
('USB-C Hub', 'Multi-port USB-C hub with HDMI and USB 3.0', 79.99, 'electronics'),
|
|
28
|
+
('Mechanical Keyboard', 'RGB mechanical keyboard with Cherry MX switches', 149.99, 'electronics'),
|
|
29
|
+
('Monitor Stand', 'Adjustable aluminum monitor stand', 89.99, 'accessories'),
|
|
30
|
+
('Webcam HD', '1080p HD webcam with autofocus', 69.99, 'electronics'),
|
|
31
|
+
('Desk Lamp', 'LED desk lamp with adjustable brightness', 45.99, 'accessories'),
|
|
32
|
+
('Notebook Pack', 'Pack of 3 lined notebooks', 12.99, 'office'),
|
|
33
|
+
('Pen Set', 'Premium ballpoint pen set', 24.99, 'office'),
|
|
34
|
+
('Cable Organizer', 'Silicone cable management clips', 9.99, 'accessories'),
|
|
35
|
+
('Headphones Pro', 'Noise-cancelling over-ear headphones', 299.99, 'electronics'),
|
|
36
|
+
('Mouse Pad XL', 'Extra large gaming mouse pad', 29.99, 'accessories'),
|
|
37
|
+
('Phone Stand', 'Aluminum phone and tablet stand', 34.99, 'accessories'),
|
|
38
|
+
('Desk Mat', 'Leather desk mat 80x40cm', 59.99, 'accessories'),
|
|
39
|
+
('Power Strip', 'Surge protector with 6 outlets and USB', 39.99, 'electronics'),
|
|
40
|
+
('Café Décor Light', 'Elegant café-style accent lamp with résumé holder', 89.99, 'accessories');
|
|
41
|
+
|
|
42
|
+
DROP TABLE IF EXISTS test_orders;
|
|
43
|
+
CREATE TABLE IF NOT EXISTS test_orders (
|
|
44
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
45
|
+
product_id INTEGER REFERENCES test_products(id),
|
|
46
|
+
customer_name TEXT,
|
|
47
|
+
quantity INTEGER,
|
|
48
|
+
total_price REAL,
|
|
49
|
+
order_date TEXT DEFAULT (datetime('now')),
|
|
50
|
+
status TEXT DEFAULT 'pending'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
INSERT INTO test_orders (product_id, customer_name, quantity, total_price, status, order_date) VALUES
|
|
54
|
+
(1, 'Alice Johnson', 1, 1299.99, 'completed', '2026-01-15 10:30:00'),
|
|
55
|
+
(2, 'Bob Smith', 2, 99.98, 'completed', '2026-01-15 11:45:00'),
|
|
56
|
+
(3, 'Carol White', 1, 79.99, 'shipped', '2026-01-16 09:15:00'),
|
|
57
|
+
(4, 'David Brown', 1, 149.99, 'pending', '2026-01-17 14:20:00'),
|
|
58
|
+
(11, 'Eve Davis', 1, 299.99, 'completed', '2026-01-17 16:00:00'),
|
|
59
|
+
(5, 'Frank Miller', 2, 179.98, 'shipped', '2026-01-18 08:30:00'),
|
|
60
|
+
(6, 'Grace Wilson', 1, 69.99, 'pending', '2026-01-19 13:45:00'),
|
|
61
|
+
(1, 'Henry Taylor', 1, 1299.99, 'completed', '2026-01-20 10:00:00'),
|
|
62
|
+
(7, 'Ivy Anderson', 3, 137.97, 'completed', '2026-01-20 15:30:00'),
|
|
63
|
+
(2, 'Jack Thomas', 1, 49.99, 'shipped', '2026-01-21 09:00:00'),
|
|
64
|
+
(8, 'Karen Martinez', 5, 64.95, 'pending', '2026-01-22 11:20:00'),
|
|
65
|
+
(9, 'Leo Garcia', 2, 49.98, 'completed', '2026-01-22 14:10:00'),
|
|
66
|
+
(10, 'Mia Robinson', 10, 99.90, 'shipped', '2026-01-23 08:45:00'),
|
|
67
|
+
(12, 'Noah Clark', 1, 29.99, 'pending', '2026-01-24 10:30:00'),
|
|
68
|
+
(13, 'Olivia Lewis', 1, 34.99, 'completed', '2026-01-24 16:15:00'),
|
|
69
|
+
(14, 'Peter Hall', 1, 59.99, 'shipped', '2026-01-25 09:30:00'),
|
|
70
|
+
(15, 'Quinn Young', 2, 79.98, 'pending', '2026-01-26 11:00:00'),
|
|
71
|
+
(4, 'Rachel King', 1, 149.99, 'completed', '2026-01-27 13:20:00'),
|
|
72
|
+
(11, 'Sam Wright', 1, 299.99, 'shipped', '2026-01-28 15:45:00'),
|
|
73
|
+
(3, 'Tina Scott', 2, 159.98, 'pending', '2026-01-29 10:15:00');
|
|
74
|
+
|
|
75
|
+
CREATE INDEX IF NOT EXISTS idx_orders_status ON test_orders(status);
|
|
76
|
+
CREATE INDEX IF NOT EXISTS idx_orders_date ON test_orders(order_date);
|
|
77
|
+
CREATE INDEX IF NOT EXISTS idx_products_category ON test_products(category);
|
|
78
|
+
|
|
79
|
+
-- INTROSPECTION: Redundant index for sqlite_index_audit testing.
|
|
80
|
+
-- idx_orders_status covers (status); this covers (status, order_date).
|
|
81
|
+
-- The audit tool should flag idx_orders_status as a prefix-duplicate.
|
|
82
|
+
CREATE INDEX IF NOT EXISTS idx_orders_status_date ON test_orders(status, order_date);
|
|
83
|
+
|
|
84
|
+
-- =============================================================================
|
|
85
|
+
-- JSON: Document Storage with JSON
|
|
86
|
+
-- =============================================================================
|
|
87
|
+
|
|
88
|
+
DROP TABLE IF EXISTS test_jsonb_docs;
|
|
89
|
+
CREATE TABLE IF NOT EXISTS test_jsonb_docs (
|
|
90
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
91
|
+
doc TEXT NOT NULL, -- JSON document
|
|
92
|
+
metadata TEXT, -- JSON metadata
|
|
93
|
+
tags TEXT DEFAULT '[]', -- JSON array of tags
|
|
94
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
INSERT INTO test_jsonb_docs (doc, metadata, tags) VALUES
|
|
98
|
+
('{"type": "article", "title": "Getting Started with SQLite", "author": "Alice", "views": 1250, "rating": 4.5}',
|
|
99
|
+
'{"source": "blog", "language": "en", "version": 1}',
|
|
100
|
+
'["database", "tutorial", "beginner"]'),
|
|
101
|
+
('{"type": "article", "title": "Advanced JSON Operations", "author": "Bob", "views": 890, "rating": 4.8}',
|
|
102
|
+
'{"source": "docs", "language": "en", "version": 2}',
|
|
103
|
+
'["json", "advanced", "sqlite"]'),
|
|
104
|
+
('{"type": "video", "title": "MCP Protocol Deep Dive", "author": "Carol", "duration": 3600, "views": 5400}',
|
|
105
|
+
'{"source": "youtube", "language": "en", "quality": "1080p"}',
|
|
106
|
+
'["mcp", "protocol", "ai"]'),
|
|
107
|
+
('{"type": "article", "title": "FTS5 Full-Text Search", "author": "David", "views": 670, "rating": 4.2, "nested": {"level1": {"level2": "deep value"}}}',
|
|
108
|
+
'{"source": "wiki", "language": "en", "version": 1}',
|
|
109
|
+
'["fts5", "search", "indexing"]'),
|
|
110
|
+
('{"type": "podcast", "title": "Database Performance Tips", "author": "Eve", "duration": 2700, "episodes": 12}',
|
|
111
|
+
'{"source": "spotify", "language": "en", "subscribers": 15000}',
|
|
112
|
+
'["performance", "tips", "podcast"]'),
|
|
113
|
+
('{"type": "article", "title": "Vector Search Fundamentals", "author": "Frank", "views": 2100, "rating": 4.7}',
|
|
114
|
+
'{"source": "medium", "language": "en", "version": 3}',
|
|
115
|
+
'["vector", "embeddings", "similarity"]');
|
|
116
|
+
|
|
117
|
+
-- =============================================================================
|
|
118
|
+
-- TEXT + FTS5: Article Content
|
|
119
|
+
-- =============================================================================
|
|
120
|
+
|
|
121
|
+
DROP TABLE IF EXISTS test_articles_fts;
|
|
122
|
+
DROP TABLE IF EXISTS test_articles;
|
|
123
|
+
CREATE TABLE IF NOT EXISTS test_articles (
|
|
124
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
125
|
+
title TEXT NOT NULL,
|
|
126
|
+
body TEXT NOT NULL,
|
|
127
|
+
author TEXT,
|
|
128
|
+
category TEXT,
|
|
129
|
+
published_at TEXT DEFAULT (datetime('now'))
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
INSERT INTO test_articles (title, body, author, category) VALUES
|
|
133
|
+
('Introduction to SQLite',
|
|
134
|
+
'SQLite is a self-contained, serverless, zero-configuration database engine. It is the most widely deployed database in the world, found in countless applications from mobile apps to web browsers. SQLite reads and writes directly to ordinary disk files, making it incredibly portable and easy to use.',
|
|
135
|
+
'Alice Johnson', 'database'),
|
|
136
|
+
('Understanding Full-Text Search',
|
|
137
|
+
'Full-text search (FTS) enables searching for words and phrases within text content. SQLite provides FTS5, a powerful full-text search extension that supports phrase queries, boolean operators, and ranked results using BM25 algorithm. FTS5 is essential for applications requiring fast text search capabilities.',
|
|
138
|
+
'Bob Smith', 'search'),
|
|
139
|
+
('The Model Context Protocol Explained',
|
|
140
|
+
'The Model Context Protocol (MCP) is an open standard that enables AI assistants to interact with external data sources and tools. MCP provides a standardized way for AI models to access databases, APIs, and other services while maintaining security and privacy.',
|
|
141
|
+
'Carol White', 'ai'),
|
|
142
|
+
('JSON in Modern Databases',
|
|
143
|
+
'Modern databases increasingly support JSON as a first-class data type. JSON enables flexible schema design and is perfect for storing semi-structured data. SQLite provides comprehensive JSON functions including extraction, modification, and validation capabilities.',
|
|
144
|
+
'David Brown', 'database'),
|
|
145
|
+
('Vector Embeddings for Similarity Search',
|
|
146
|
+
'Vector embeddings represent data as numerical arrays, enabling semantic similarity search. By comparing the distance between vectors using cosine similarity or Euclidean distance, applications can find semantically similar content regardless of exact keyword matches.',
|
|
147
|
+
'Eve Davis', 'ai'),
|
|
148
|
+
('Database Performance Optimization',
|
|
149
|
+
'Optimizing database performance requires understanding query execution plans, proper indexing strategies, and efficient schema design. Key techniques include using appropriate indexes, avoiding unnecessary joins, and leveraging query caching.',
|
|
150
|
+
'Frank Miller', 'performance'),
|
|
151
|
+
('Building RESTful APIs with SQLite',
|
|
152
|
+
'SQLite is an excellent choice for small to medium-sized API backends. Its serverless nature simplifies deployment, while its robust ACID compliance ensures data integrity. Combined with modern frameworks, SQLite enables rapid API development.',
|
|
153
|
+
'Grace Wilson', 'development'),
|
|
154
|
+
('Data Analysis with Statistical Functions',
|
|
155
|
+
'Statistical analysis of database content reveals patterns and insights. Common operations include calculating averages, standard deviations, percentiles, and correlations. These metrics help understand data distributions and identify outliers.',
|
|
156
|
+
'Henry Taylor', 'analytics');
|
|
157
|
+
|
|
158
|
+
-- Create FTS5 virtual table for full-text search testing
|
|
159
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS test_articles_fts USING fts5(
|
|
160
|
+
title,
|
|
161
|
+
body,
|
|
162
|
+
content='test_articles',
|
|
163
|
+
content_rowid='id',
|
|
164
|
+
tokenize="unicode61"
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
-- Populate FTS index from test_articles
|
|
168
|
+
INSERT INTO test_articles_fts(rowid, title, body)
|
|
169
|
+
SELECT id, title, body FROM test_articles;
|
|
170
|
+
|
|
171
|
+
-- =============================================================================
|
|
172
|
+
-- TEXT: User Data with Various Patterns
|
|
173
|
+
-- =============================================================================
|
|
174
|
+
|
|
175
|
+
DROP TABLE IF EXISTS test_users;
|
|
176
|
+
CREATE TABLE IF NOT EXISTS test_users (
|
|
177
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
178
|
+
username TEXT NOT NULL UNIQUE,
|
|
179
|
+
email TEXT NOT NULL,
|
|
180
|
+
phone TEXT,
|
|
181
|
+
bio TEXT,
|
|
182
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
INSERT INTO test_users (username, email, phone, bio) VALUES
|
|
186
|
+
('johndoe', 'john.doe@example.com', '+1-555-0101', 'Software developer passionate about databases and AI.'),
|
|
187
|
+
('janesmith', 'jane.smith@company.org', '+1-555-0102', 'Data scientist specializing in machine learning.'),
|
|
188
|
+
('bobwilson', 'bob.wilson@startup.io', '+44-20-7123-4567', 'Full-stack developer and open source contributor.'),
|
|
189
|
+
('alicechen', 'alice.chen@university.edu', '+1-555-0104', 'PhD researcher in natural language processing.'),
|
|
190
|
+
('mikebrown', 'mike.brown@tech.co', NULL, 'DevOps engineer focused on infrastructure automation.'),
|
|
191
|
+
('sarahlee', 'sarah.lee@design.studio', '+1-555-0106', 'UX designer creating intuitive user experiences.'),
|
|
192
|
+
('davidkim', 'david.kim@finance.com', '+82-2-1234-5678', 'Quantitative analyst building trading algorithms.'),
|
|
193
|
+
('emmagarcia', 'emma.garcia@healthcare.org', '+1-555-0108', 'Health informatics specialist improving patient care.'),
|
|
194
|
+
('testuser', 'test.user@gmail.com', '+1-555-0109', 'QA engineer testing regex patterns and text tools.');
|
|
195
|
+
|
|
196
|
+
-- =============================================================================
|
|
197
|
+
-- STATS: Sensor Measurements (Large dataset for statistical operations)
|
|
198
|
+
-- =============================================================================
|
|
199
|
+
|
|
200
|
+
DROP TABLE IF EXISTS test_measurements;
|
|
201
|
+
CREATE TABLE IF NOT EXISTS test_measurements (
|
|
202
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
203
|
+
sensor_id INTEGER,
|
|
204
|
+
temperature REAL,
|
|
205
|
+
humidity REAL,
|
|
206
|
+
pressure REAL,
|
|
207
|
+
measured_at TEXT
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
-- Generate 200 measurement records with realistic sensor data
|
|
211
|
+
-- Using multiple inserts for SQLite compatibility
|
|
212
|
+
INSERT INTO test_measurements (sensor_id, temperature, humidity, pressure, measured_at)
|
|
213
|
+
SELECT
|
|
214
|
+
1 + (value % 5),
|
|
215
|
+
20.0 + (value * 0.731 % 15) + (value * 0.113 % 3),
|
|
216
|
+
40.0 + (value * 0.919 % 40),
|
|
217
|
+
1000.0 + (value * 0.557 % 50),
|
|
218
|
+
datetime('2026-01-01', '+' || value || ' hours')
|
|
219
|
+
FROM (
|
|
220
|
+
WITH RECURSIVE cnt(value) AS (
|
|
221
|
+
SELECT 0
|
|
222
|
+
UNION ALL
|
|
223
|
+
SELECT value + 1 FROM cnt WHERE value < 199
|
|
224
|
+
)
|
|
225
|
+
SELECT value FROM cnt
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
-- =============================================================================
|
|
229
|
+
-- VECTOR: Embedding Storage
|
|
230
|
+
-- =============================================================================
|
|
231
|
+
|
|
232
|
+
DROP TABLE IF EXISTS test_embeddings;
|
|
233
|
+
CREATE TABLE IF NOT EXISTS test_embeddings (
|
|
234
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
235
|
+
content TEXT,
|
|
236
|
+
category TEXT,
|
|
237
|
+
embedding TEXT -- JSON array representing vector
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
-- Insert sample embeddings (8-dimensional vectors for simplicity)
|
|
241
|
+
INSERT INTO test_embeddings (content, category, embedding) VALUES
|
|
242
|
+
('Machine learning fundamentals', 'tech', '[0.12, 0.45, -0.23, 0.78, 0.34, -0.56, 0.89, 0.01]'),
|
|
243
|
+
('Deep learning neural networks', 'tech', '[0.15, 0.42, -0.21, 0.75, 0.38, -0.52, 0.85, 0.05]'),
|
|
244
|
+
('Natural language processing', 'tech', '[0.18, 0.48, -0.25, 0.72, 0.31, -0.58, 0.82, -0.02]'),
|
|
245
|
+
('Database optimization techniques', 'database', '[-0.34, 0.22, 0.67, -0.11, 0.55, 0.43, -0.28, 0.91]'),
|
|
246
|
+
('SQL query performance tuning', 'database', '[-0.31, 0.25, 0.64, -0.08, 0.52, 0.46, -0.25, 0.88]'),
|
|
247
|
+
('Index design strategies', 'database', '[-0.28, 0.28, 0.61, -0.14, 0.58, 0.40, -0.31, 0.85]'),
|
|
248
|
+
('Cooking Italian pasta dishes', 'food', '[0.67, -0.45, 0.12, 0.33, -0.78, 0.21, 0.54, -0.39]'),
|
|
249
|
+
('French cuisine techniques', 'food', '[0.64, -0.42, 0.15, 0.36, -0.75, 0.24, 0.51, -0.36]'),
|
|
250
|
+
('Healthy meal preparation', 'food', '[0.61, -0.48, 0.09, 0.30, -0.81, 0.18, 0.57, -0.42]'),
|
|
251
|
+
('Morning workout routines', 'fitness', '[-0.56, -0.23, -0.45, 0.89, 0.12, -0.67, 0.34, 0.78]'),
|
|
252
|
+
('Strength training basics', 'fitness', '[-0.53, -0.26, -0.42, 0.86, 0.15, -0.64, 0.37, 0.75]'),
|
|
253
|
+
('Cardio exercise benefits', 'fitness', '[-0.59, -0.20, -0.48, 0.92, 0.09, -0.70, 0.31, 0.81]'),
|
|
254
|
+
('Travel tips for Europe', 'travel', '[0.23, 0.78, 0.45, -0.34, -0.12, 0.89, -0.56, 0.01]'),
|
|
255
|
+
('Budget backpacking guide', 'travel', '[0.26, 0.75, 0.48, -0.31, -0.15, 0.86, -0.53, 0.04]'),
|
|
256
|
+
('Photography during trips', 'travel', '[0.20, 0.81, 0.42, -0.37, -0.09, 0.92, -0.59, -0.02]'),
|
|
257
|
+
('Transformer architecture explained', 'tech', '[0.14, 0.44, -0.22, 0.76, 0.35, -0.54, 0.87, 0.03]'),
|
|
258
|
+
('Vector databases overview', 'database', '[-0.32, 0.24, 0.65, -0.10, 0.54, 0.44, -0.27, 0.89]'),
|
|
259
|
+
('Asian cooking techniques', 'food', '[0.65, -0.44, 0.13, 0.34, -0.76, 0.22, 0.52, -0.37]'),
|
|
260
|
+
('Yoga and flexibility', 'fitness', '[-0.55, -0.24, -0.44, 0.88, 0.13, -0.66, 0.35, 0.76]'),
|
|
261
|
+
('Solo travel adventures', 'travel', '[0.24, 0.77, 0.46, -0.33, -0.13, 0.88, -0.55, 0.02]');
|
|
262
|
+
|
|
263
|
+
-- =============================================================================
|
|
264
|
+
-- GEO: Location Points
|
|
265
|
+
-- =============================================================================
|
|
266
|
+
|
|
267
|
+
DROP TABLE IF EXISTS test_locations;
|
|
268
|
+
CREATE TABLE IF NOT EXISTS test_locations (
|
|
269
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
270
|
+
name TEXT NOT NULL,
|
|
271
|
+
city TEXT,
|
|
272
|
+
latitude REAL NOT NULL,
|
|
273
|
+
longitude REAL NOT NULL,
|
|
274
|
+
type TEXT
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
INSERT INTO test_locations (name, city, latitude, longitude, type) VALUES
|
|
278
|
+
('Central Park', 'New York', 40.7829, -73.9654, 'park'),
|
|
279
|
+
('Empire State Building', 'New York', 40.7484, -73.9857, 'landmark'),
|
|
280
|
+
('Times Square', 'New York', 40.7580, -73.9855, 'attraction'),
|
|
281
|
+
('Eiffel Tower', 'Paris', 48.8584, 2.2945, 'landmark'),
|
|
282
|
+
('Louvre Museum', 'Paris', 48.8606, 2.3376, 'museum'),
|
|
283
|
+
('Notre-Dame', 'Paris', 48.8530, 2.3499, 'landmark'),
|
|
284
|
+
('Big Ben', 'London', 51.5007, -0.1246, 'landmark'),
|
|
285
|
+
('Tower Bridge', 'London', 51.5055, -0.0754, 'landmark'),
|
|
286
|
+
('Buckingham Palace', 'London', 51.5014, -0.1419, 'landmark'),
|
|
287
|
+
('Tokyo Tower', 'Tokyo', 35.6586, 139.7454, 'landmark'),
|
|
288
|
+
('Shibuya Crossing', 'Tokyo', 35.6595, 139.7004, 'attraction'),
|
|
289
|
+
('Senso-ji Temple', 'Tokyo', 35.7148, 139.7967, 'temple'),
|
|
290
|
+
('Sydney Opera House', 'Sydney', -33.8568, 151.2153, 'landmark'),
|
|
291
|
+
('Harbour Bridge', 'Sydney', -33.8523, 151.2108, 'landmark'),
|
|
292
|
+
('Golden Gate Bridge', 'San Francisco', 37.8199, -122.4783, 'landmark');
|
|
293
|
+
|
|
294
|
+
-- =============================================================================
|
|
295
|
+
-- TEXT: Hierarchical Categories (for path-based queries)
|
|
296
|
+
-- =============================================================================
|
|
297
|
+
|
|
298
|
+
DROP TABLE IF EXISTS test_categories;
|
|
299
|
+
CREATE TABLE IF NOT EXISTS test_categories (
|
|
300
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
301
|
+
name TEXT NOT NULL,
|
|
302
|
+
path TEXT NOT NULL, -- Dot-separated path like 'electronics.computers.laptops'
|
|
303
|
+
level INTEGER
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
INSERT INTO test_categories (name, path, level) VALUES
|
|
307
|
+
('Electronics', 'electronics', 1),
|
|
308
|
+
('Computers', 'electronics.computers', 2),
|
|
309
|
+
('Laptops', 'electronics.computers.laptops', 3),
|
|
310
|
+
('Desktops', 'electronics.computers.desktops', 3),
|
|
311
|
+
('Phones', 'electronics.phones', 2),
|
|
312
|
+
('Smartphones', 'electronics.phones.smartphones', 3),
|
|
313
|
+
('Feature Phones', 'electronics.phones.feature', 3),
|
|
314
|
+
('Accessories', 'electronics.accessories', 2),
|
|
315
|
+
('Clothing', 'clothing', 1),
|
|
316
|
+
('Mens', 'clothing.mens', 2),
|
|
317
|
+
('Shirts', 'clothing.mens.shirts', 3),
|
|
318
|
+
('Pants', 'clothing.mens.pants', 3),
|
|
319
|
+
('Womens', 'clothing.womens', 2),
|
|
320
|
+
('Dresses', 'clothing.womens.dresses', 3),
|
|
321
|
+
('Home', 'home', 1),
|
|
322
|
+
('Kitchen', 'home.kitchen', 2),
|
|
323
|
+
('Appliances', 'home.kitchen.appliances', 3);
|
|
324
|
+
|
|
325
|
+
-- =============================================================================
|
|
326
|
+
-- STATS + ADMIN: Event Logs
|
|
327
|
+
-- =============================================================================
|
|
328
|
+
|
|
329
|
+
DROP TABLE IF EXISTS test_events;
|
|
330
|
+
CREATE TABLE IF NOT EXISTS test_events (
|
|
331
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
332
|
+
event_type TEXT NOT NULL,
|
|
333
|
+
user_id INTEGER,
|
|
334
|
+
payload TEXT, -- JSON payload
|
|
335
|
+
event_date TEXT NOT NULL
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
-- Generate event log data
|
|
339
|
+
INSERT INTO test_events (event_type, user_id, payload, event_date)
|
|
340
|
+
SELECT
|
|
341
|
+
CASE value % 5
|
|
342
|
+
WHEN 0 THEN 'page_view'
|
|
343
|
+
WHEN 1 THEN 'click'
|
|
344
|
+
WHEN 2 THEN 'purchase'
|
|
345
|
+
WHEN 3 THEN 'login'
|
|
346
|
+
WHEN 4 THEN 'search'
|
|
347
|
+
END,
|
|
348
|
+
1 + (value % 8),
|
|
349
|
+
'{"page": "' || CASE value % 4
|
|
350
|
+
WHEN 0 THEN 'home'
|
|
351
|
+
WHEN 1 THEN 'products'
|
|
352
|
+
WHEN 2 THEN 'cart'
|
|
353
|
+
WHEN 3 THEN 'checkout'
|
|
354
|
+
END || '", "session": "sess_' || (1000 + value) || '"}',
|
|
355
|
+
datetime('2026-01-01', '+' || (value * 2) || ' hours')
|
|
356
|
+
FROM (
|
|
357
|
+
WITH RECURSIVE cnt(value) AS (
|
|
358
|
+
SELECT 0
|
|
359
|
+
UNION ALL
|
|
360
|
+
SELECT value + 1 FROM cnt WHERE value < 99
|
|
361
|
+
)
|
|
362
|
+
SELECT value FROM cnt
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
-- =============================================================================
|
|
366
|
+
-- Cleanup: Drop orphan tables from prior test runs
|
|
367
|
+
-- =============================================================================
|
|
368
|
+
-- When the MCP server holds the DB open, the reset script overwrites in-place.
|
|
369
|
+
-- Non-test tables from prior runs survive because only test_* tables are re-created.
|
|
370
|
+
|
|
371
|
+
DROP TABLE IF EXISTS temp_text_test;
|
|
372
|
+
DROP TABLE IF EXISTS "";
|
|
373
|
+
|
|
374
|
+
-- =============================================================================
|
|
375
|
+
-- Summary: Test Tables Created
|
|
376
|
+
-- =============================================================================
|
|
377
|
+
-- test_products - 16 rows (Core, Stats)
|
|
378
|
+
-- test_orders - 20 rows (Core, Stats)
|
|
379
|
+
-- test_jsonb_docs - 6 rows (JSON)
|
|
380
|
+
-- test_articles - 8 rows (Text, FTS)
|
|
381
|
+
-- test_articles_fts - FTS5 virtual table (Text, FTS)
|
|
382
|
+
-- test_users - 9 rows (Text, Core)
|
|
383
|
+
-- test_measurements - 200 rows (Stats)
|
|
384
|
+
-- test_embeddings - 20 rows (Vector)
|
|
385
|
+
-- test_locations - 15 rows (Geo)
|
|
386
|
+
-- test_categories - 17 rows (Text)
|
|
387
|
+
-- test_events - 100 rows (Stats, Admin)
|
|
388
|
+
-- =============================================================================
|