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,409 @@
|
|
|
1
|
+
# db-mcp Code Map
|
|
2
|
+
|
|
3
|
+
> **Agent-optimized navigation reference.** Read this before searching the codebase. Covers directory layout, handler→tool mapping, type/schema locations, error hierarchy, and key constants.
|
|
4
|
+
>
|
|
5
|
+
> Last updated: March 18, 2026
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Directory Tree
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/
|
|
13
|
+
├── cli.ts # CLI entry point (arg parsing, transport selection)
|
|
14
|
+
├── index.ts # Barrel re-export for library consumers
|
|
15
|
+
├── version.ts # SSoT version constant (reads package.json)
|
|
16
|
+
│
|
|
17
|
+
├── server/
|
|
18
|
+
│ └── mcp-server.ts # McpServer setup, adapter registration, tool/resource/prompt wiring
|
|
19
|
+
│
|
|
20
|
+
├── types/ # Core TypeScript types (barrel: types/index.ts)
|
|
21
|
+
│ ├── adapter.ts # ToolDefinition, ResourceDefinition, PromptDefinition, AdapterCapabilities
|
|
22
|
+
│ ├── auth.ts # OAuthConfig, OAuthScope, TokenClaims, RequestContext
|
|
23
|
+
│ ├── database.ts # DatabaseConfig, QueryResult, ColumnInfo, TableInfo, SchemaInfo, IndexInfo
|
|
24
|
+
│ ├── filtering.ts # ToolGroup, MetaGroup, ToolFilterRule, ToolFilterConfig
|
|
25
|
+
│ ├── server.ts # TransportType, McpServerConfig (incl. authToken, oauth)
|
|
26
|
+
│ └── index.ts # Barrel — also re-exports error classes from utils/errors
|
|
27
|
+
│
|
|
28
|
+
├── constants/
|
|
29
|
+
│ ├── server-instructions.ts # Generated: slim INSTRUCTIONS constant (~680 chars) + HELP_CONTENT map (per-group help)
|
|
30
|
+
│ └── server-instructions/ # Source .md files for each help resource
|
|
31
|
+
│ ├── overview.md # Root help content (sqlite://help)
|
|
32
|
+
│ ├── gotchas.md # Common gotchas and critical usage patterns
|
|
33
|
+
│ ├── admin.md # Admin group help
|
|
34
|
+
│ ├── geo.md # Geo group help
|
|
35
|
+
│ ├── introspection.md # Introspection group help
|
|
36
|
+
│ ├── json.md # JSON group help
|
|
37
|
+
│ ├── migration.md # Migration group help
|
|
38
|
+
│ ├── stats.md # Stats group help
|
|
39
|
+
│ ├── text.md # Text group help
|
|
40
|
+
│ └── vector.md # Vector group help
|
|
41
|
+
│
|
|
42
|
+
├── filtering/
|
|
43
|
+
│ ├── tool-constants.ts # TOOL_GROUPS arrays, META_GROUPS shortcuts, group→tools map
|
|
44
|
+
│ └── tool-filter.ts # ToolFilter class — parse/apply --tool-filter expressions
|
|
45
|
+
│
|
|
46
|
+
├── utils/
|
|
47
|
+
│ ├── annotations.ts # MCP tool annotation helpers (readOnly, destructive hints)
|
|
48
|
+
│ ├── icons.ts # MCP icon definitions per tool group
|
|
49
|
+
│ ├── identifiers.ts # SQL identifier validation/sanitization (table names, columns)
|
|
50
|
+
│ ├── insights-manager.ts # memo://insights resource accumulator
|
|
51
|
+
│ ├── progress-utils.ts # MCP progress notification helpers
|
|
52
|
+
│ ├── resource-annotations.ts # MCP resource annotation helpers
|
|
53
|
+
│ ├── where-clause.ts # WHERE clause builder/validator
|
|
54
|
+
│ ├── index.ts # Barrel re-export
|
|
55
|
+
│ ├── errors/ # Error class hierarchy (see § Error Classes below)
|
|
56
|
+
│ │ ├── base.ts # DbMcpError (abstract base) — auto-refines generic codes via suggestions
|
|
57
|
+
│ │ ├── categories.ts # ErrorCategory enum + ErrorResponse interface
|
|
58
|
+
│ │ ├── classes.ts # 8 concrete error subclasses
|
|
59
|
+
│ │ ├── error-response-fields.ts # ErrorResponseFields mixin (SSoT, re-exported from format.ts)
|
|
60
|
+
│ │ ├── format.ts # formatHandlerError() — structured {success:false} builder
|
|
61
|
+
│ │ ├── suggestions.ts # Error suggestion helpers (typo hints, table/column suggestions)
|
|
62
|
+
│ │ └── index.ts # Barrel
|
|
63
|
+
│ └── logger/
|
|
64
|
+
│ ├── logger.ts # Logger class (structured JSON, severity filtering)
|
|
65
|
+
│ ├── module-logger.ts # createModuleLogger() factory
|
|
66
|
+
│ ├── error-codes.ts # Module-prefixed error code constants
|
|
67
|
+
│ ├── types.ts # LogLevel, LogEntry types
|
|
68
|
+
│ └── index.ts # Barrel
|
|
69
|
+
│
|
|
70
|
+
├── auth/ # OAuth 2.1 implementation
|
|
71
|
+
│ ├── auth-context.ts # Auth context utilities
|
|
72
|
+
│ ├── middleware/ # Express-style OAuth middleware (split from middleware.ts)
|
|
73
|
+
│ │ └── index.ts
|
|
74
|
+
│ ├── token-validator.ts # JWT/JWKS token validation
|
|
75
|
+
│ ├── scopes/ # Scope parsing, enforcement (split from scopes.ts)
|
|
76
|
+
│ │ └── index.ts
|
|
77
|
+
│ ├── scope-map.ts # Tool→scope mapping
|
|
78
|
+
│ ├── oauth-resource-server.ts # RFC 9728 /.well-known/oauth-protected-resource
|
|
79
|
+
│ ├── authorization-server-discovery.ts # RFC 8414 auth server metadata discovery
|
|
80
|
+
│ ├── transport-agnostic.ts # Non-Express auth re-exports for transport portability
|
|
81
|
+
│ ├── errors.ts # OAuth-specific error classes
|
|
82
|
+
│ └── types.ts # OAuth TypeScript types
|
|
83
|
+
│
|
|
84
|
+
├── transports/
|
|
85
|
+
│ └── http/
|
|
86
|
+
│ ├── transport.ts # HTTP/SSE transport (Streamable HTTP + legacy SSE)
|
|
87
|
+
│ ├── session.ts # Session management (stateful + stateless modes)
|
|
88
|
+
│ ├── middleware.ts # Security headers, rate limiting, CORS, body parsing, DNS rebinding guard
|
|
89
|
+
│ ├── oauth.ts # OAuth 2.1 integration + simple bearer auth middleware
|
|
90
|
+
│ ├── type-adapters.ts # Hono→Express type bridges
|
|
91
|
+
│ ├── types.ts # HTTP transport types
|
|
92
|
+
│ └── index.ts # Barrel
|
|
93
|
+
│
|
|
94
|
+
├── codemode/ # Code Mode sandbox (secure JS execution)
|
|
95
|
+
│ ├── sandbox.ts # SandboxPool lifecycle manager
|
|
96
|
+
│ ├── sandbox-factory.ts # Sandbox creation factory
|
|
97
|
+
│ ├── worker-sandbox.ts # Worker thread sandbox (MessagePort RPC bridge)
|
|
98
|
+
│ ├── worker-script.ts # Worker thread entry point (runs inside vm)
|
|
99
|
+
│ ├── api.ts # sqlite.* API bridge (exposes tools to sandbox)
|
|
100
|
+
│ ├── api-constants.ts # API bridge constants and JSON-RPC codes
|
|
101
|
+
│ ├── security.ts # Code validation (blocked patterns, injection prevention)
|
|
102
|
+
│ ├── types.ts # Sandbox TypeScript types
|
|
103
|
+
│ └── index.ts # Barrel
|
|
104
|
+
│
|
|
105
|
+
├── adapters/
|
|
106
|
+
│ ├── database-adapter.ts # Abstract DatabaseAdapter base class
|
|
107
|
+
│ ├── query-validation.ts # Shared query validation (SELECT vs write detection)
|
|
108
|
+
│ ├── sqlite-helpers.ts # Shared SQLite helper utilities
|
|
109
|
+
│ │
|
|
110
|
+
│ ├── sqlite/ # ── WASM adapter (sql.js) ──
|
|
111
|
+
│ │ ├── sqlite-adapter.ts # SqliteAdapter class (extends DatabaseAdapter)
|
|
112
|
+
│ │ ├── query-executor.ts # WASM query execution
|
|
113
|
+
│ │ ├── schema-manager.ts # Schema cache + metadata (TTL-based)
|
|
114
|
+
│ │ ├── json-utils.ts # JSON column detection and normalization
|
|
115
|
+
│ │ ├── types.ts # WASM-specific Zod schemas + TS types
|
|
116
|
+
│ │ ├── resources.ts # 8 data MCP resources (schema, tables, indexes, etc.)
|
|
117
|
+
│ │ ├── index.ts # Barrel
|
|
118
|
+
│ │ ├── output-schemas/ # Zod outputSchema definitions per group (see § below)
|
|
119
|
+
│ │ ├── prompts/ # 10 MCP prompts (see § below)
|
|
120
|
+
│ │ └── tools/ # Tool handler files (see § Handler Map below)
|
|
121
|
+
│ │ ├── column-validation.ts # validateColumnExists() + validateTableExists() — used by geo, stats, text, FTS, window
|
|
122
|
+
│ │ └── ... # Group subdirectories below
|
|
123
|
+
│ │
|
|
124
|
+
│ └── sqlite-native/ # ── Native adapter (better-sqlite3) ──
|
|
125
|
+
│ ├── native-sqlite-adapter.ts # NativeSqliteAdapter class (extends DatabaseAdapter)
|
|
126
|
+
│ ├── native-query-executor.ts # Native query execution
|
|
127
|
+
│ ├── extensions.ts # Extension loader (CSV, SpatiaLite) — uses findProjectRoot()
|
|
128
|
+
│ ├── transaction-methods.ts # Transaction state management
|
|
129
|
+
│ ├── registration/ # Extracted tool/resource registration logic
|
|
130
|
+
│ │ └── index.ts
|
|
131
|
+
│ ├── index.ts # Barrel
|
|
132
|
+
│ └── tools/ # Native-only tool handlers (see § below)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Handler → Tool Mapping
|
|
138
|
+
|
|
139
|
+
Each file below registers tools with `group` labels. Native-only tools are marked.
|
|
140
|
+
|
|
141
|
+
### WASM Handlers (`src/adapters/sqlite/tools/`)
|
|
142
|
+
|
|
143
|
+
| Group | Handler File(s) | Tools | Key Exports |
|
|
144
|
+
| ----------------- | ----------------------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| **codemode** | `codemode.ts` | 1 | `sqlite_execute_code` |
|
|
146
|
+
| **core** | `core/queries.ts` | 2 | `sqlite_read_query`, `sqlite_write_query` |
|
|
147
|
+
| | `core/tables.ts` | 4 | `create_table`, `list_tables`, `describe_table`, `drop_table` |
|
|
148
|
+
| | `core/indexes.ts` | 3 | `get_indexes`, `create_index`, `drop_index` |
|
|
149
|
+
| **json** | `json-operations/crud.ts` | 3 | `json_insert`, `json_update`, `json_select` |
|
|
150
|
+
| | `json-operations/query.ts` | 4 | `json_query`, `json_validate_path`, `json_merge`, `json_analyze_schema` |
|
|
151
|
+
| | `json-operations/transform.ts` | 4 | `json_valid`, `json_extract`, `json_set`, `json_remove` |
|
|
152
|
+
| | `json-helpers/read.ts` | 7 | `json_type`, `json_array_length`, `json_keys`, `json_each`, `json_pretty`, `json_storage_info`, `json_group_array` |
|
|
153
|
+
| | `json-helpers/write.ts` | 5 | `json_array_append`, `json_group_object`, `jsonb_convert`, `json_normalize_column`, `create_json_collection` |
|
|
154
|
+
| **text** | `text/regex.ts` | 2 | `regex_extract`, `regex_match` |
|
|
155
|
+
| | `text/formatting.ts` | 6 | `text_split`, `text_concat`, `text_replace`, `text_trim`, `text_case`, `text_substring` |
|
|
156
|
+
| | `text/search.ts` | 3 | `fuzzy_match`, `phonetic_match`, `advanced_search` |
|
|
157
|
+
| | `text/validate.ts` | 2 | `text_normalize`, `text_validate` |
|
|
158
|
+
| **text** (FTS5) | `fts.ts` | 4 | `fts_create`, `fts_search`, `fts_rebuild`, `fts_match_info` |
|
|
159
|
+
| **stats** | `stats/basic.ts` | 7 | `stats_basic`, `stats_count`, `stats_group_by`, `stats_histogram`, `stats_percentile`, `stats_correlation`, `stats_top_n` |
|
|
160
|
+
| | `stats/advanced.ts` | 6 | `stats_distinct`, `stats_summary`, `stats_frequency`, `stats_outliers`, `stats_regression`, `stats_hypothesis` |
|
|
161
|
+
| **vector** | `vector/storage.ts` | 4 | `vector_create_table`, `vector_store`, `vector_batch_store`, `vector_delete` |
|
|
162
|
+
| | `vector/search.ts` | 2 | `vector_search`, `vector_get` |
|
|
163
|
+
| | `vector/metadata.ts` | 5 | `vector_count`, `vector_stats`, `vector_dimensions`, `vector_normalize`, `vector_distance` |
|
|
164
|
+
| **geo** | `geo.ts` | 4 | `geo_distance`, `geo_nearby`, `geo_bounding_box`, `geo_cluster` |
|
|
165
|
+
| **admin** | `admin/backup/create.ts` | 1 | `backup` |
|
|
166
|
+
| | `admin/backup/restore.ts` | 1 | `restore` |
|
|
167
|
+
| | `admin/backup/analyze.ts` | 1 | `analyze` |
|
|
168
|
+
| | `admin/backup/integrity.ts` | 1 | `integrity_check` |
|
|
169
|
+
| | `admin/backup/optimize.ts` | 1 | `optimize` |
|
|
170
|
+
| | `admin/verify.ts` | 2 | `verify_backup`, `index_stats` |
|
|
171
|
+
| | `admin/pragma.ts` | 6 | `pragma_compile_options`, `pragma_database_list`, `pragma_optimize`, `pragma_settings`, `pragma_table_info`, `append_insight` |
|
|
172
|
+
| | `virtual/views.ts` | 3 | `create_view`, `list_views`, `drop_view` |
|
|
173
|
+
| | `virtual/vtable.ts` | 5 | `list_virtual_tables`, `virtual_table_info`, `drop_virtual_table`, `create_csv_table`, `analyze_csv_schema` |
|
|
174
|
+
| | `virtual/extensions.ts` | 2 | `create_rtree_table`, `create_series_table` |
|
|
175
|
+
| | `virtual/analysis.ts` | 3 | `generate_series`, `dbstat`, `vacuum` |
|
|
176
|
+
| **introspection** | `introspection/graph/tools.ts` | 3 | `dependency_graph`, `topological_sort`, `cascade_simulator` |
|
|
177
|
+
| | `introspection/analysis/constraints.ts` | 1 | `constraint_analysis` |
|
|
178
|
+
| | `introspection/analysis/risks.ts` | 1 | `migration_risks` |
|
|
179
|
+
| | `introspection/analysis/snapshot.ts` | 1 | `schema_snapshot` |
|
|
180
|
+
| | `introspection/diagnostics/storage.ts` | 1 | `storage_analysis` |
|
|
181
|
+
| | `introspection/diagnostics/indexes.ts` | 1 | `index_audit` |
|
|
182
|
+
| | `introspection/diagnostics/query-plan.ts` | 1 | `query_plan` |
|
|
183
|
+
| **migration** | `migration/tracking/init.ts` | 1 | `migration_init` |
|
|
184
|
+
| | `migration/tracking/record.ts` | 1 | `migration_record` |
|
|
185
|
+
| | `migration/tracking/apply.ts` | 1 | `migration_apply` |
|
|
186
|
+
| | `migration/tracking/rollback.ts` | 1 | `migration_rollback` |
|
|
187
|
+
| | `migration/tracking/history.ts` | 1 | `migration_history` |
|
|
188
|
+
| | `migration/tracking/status.ts` | 1 | `migration_status` |
|
|
189
|
+
|
|
190
|
+
### Native-Only Handlers (`src/adapters/sqlite-native/tools/`)
|
|
191
|
+
|
|
192
|
+
| Group | Handler File | Tools | Notes |
|
|
193
|
+
| ------------------------ | ------------------------ | ----- | ------------------------------------------------------------------------------------------------------------------ |
|
|
194
|
+
| **stats** (window) | `window.ts` | 6 | `window_row_number`, `window_rank`, `window_lag_lead`, `window_running_total`, `window_moving_avg`, `window_ntile` |
|
|
195
|
+
| **admin** (transactions) | `transactions.ts` | 7 | `transaction_begin/commit/rollback/savepoint/release/rollback_to/execute` |
|
|
196
|
+
| **geo** (SpatiaLite) | `spatialite/tools.ts` | 4 | `spatialite_load/create_table/query/index` |
|
|
197
|
+
| | `spatialite/analysis.ts` | 3 | `spatialite_analyze/transform/import` |
|
|
198
|
+
|
|
199
|
+
### Utility Files (no tools, shared helpers)
|
|
200
|
+
|
|
201
|
+
Files that provide shared logic but do **not** register tools:
|
|
202
|
+
|
|
203
|
+
| File | Purpose |
|
|
204
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
205
|
+
| `core/tables.ts` | Also exports `isSpatialiteSystemTable()`, `isSpatialiteSystemView()`, `isSpatialiteSystemIndex()` — used by core + introspection tools for `excludeSystemTables` filtering |
|
|
206
|
+
| `column-validation.ts` | `validateColumnExists()`, `validateTableExists()` — used by geo, stats, text, FTS, window |
|
|
207
|
+
| `json-operations/helpers.ts` | JSON path/value normalization |
|
|
208
|
+
| `json-helpers/helpers.ts` | JSON helper utilities |
|
|
209
|
+
| `text/helpers.ts` | Text processing shared logic |
|
|
210
|
+
| `stats/helpers.ts` | Stats calculation utilities |
|
|
211
|
+
| `stats/inference.ts` | Statistical type inference engine |
|
|
212
|
+
| `stats/math-helpers.ts` | Math utility functions (median, std dev) |
|
|
213
|
+
| `vector/helpers.ts` | Vector math utilities |
|
|
214
|
+
| `vector/schemas.ts` | Zod schemas for vector tools |
|
|
215
|
+
| `vector/tools.ts` | Vector tool registration barrel |
|
|
216
|
+
| `admin/helpers.ts` | Admin tool shared utilities |
|
|
217
|
+
| `migration/schemas.ts` | Zod input schemas for migration tools (re-exports output schemas from `output-schemas/migration.ts`) |
|
|
218
|
+
| `virtual/helpers.ts` | Virtual table helper utilities |
|
|
219
|
+
| `introspection/graph/helpers.ts` | FK graph traversal helpers |
|
|
220
|
+
| `spatialite/schemas.ts` (native) | Zod schemas for SpatiaLite tools |
|
|
221
|
+
| `spatialite/loader.ts` (native) | SpatiaLite extension loader + path resolution |
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Output Schemas (`src/adapters/sqlite/output-schemas/`)
|
|
226
|
+
|
|
227
|
+
Zod schemas that define the `outputSchema` for MCP tool responses. All output schemas are centralized here with named exports — **zero inline definitions** remain across all tool groups.
|
|
228
|
+
|
|
229
|
+
| File | Groups Covered |
|
|
230
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
231
|
+
| `common.ts` | Shared base schemas (e.g., success/error shape) |
|
|
232
|
+
| `error-mixin.ts` | `ErrorFieldsMixin` — 6 optional error fields merged into all output schemas |
|
|
233
|
+
| `core.ts` | Core group output schemas |
|
|
234
|
+
| `json.ts` | JSON group output schemas |
|
|
235
|
+
| `text.ts` | Text group output schemas (incl. `TextConcatOutputSchema`, `TextTrimOutputSchema`, `TextCaseOutputSchema`, `TextSubstringOutputSchema`, `AdvancedSearchOutputSchema`) |
|
|
236
|
+
| `fts.ts` | FTS5 output schemas |
|
|
237
|
+
| `stats.ts` | Stats group output schemas (incl. `StatsHypothesisOutputSchema`) |
|
|
238
|
+
| `vector.ts` | Vector group output schemas |
|
|
239
|
+
| `admin.ts` | Admin group output schemas (incl. `AppendInsightOutputSchema`, `DbstatOutputSchema`) |
|
|
240
|
+
| `geo.ts` | Geo group output schemas |
|
|
241
|
+
| `introspection.ts` | Introspection group output schemas (9 schemas: DependencyGraph, TopologicalSort, CascadeSimulator, SchemaSnapshot, ConstraintAnalysis, MigrationRisks, StorageAnalysis, IndexAudit, QueryPlan) |
|
|
242
|
+
| `migration.ts` | Migration group output schemas (7 schemas: MigrationInit, MigrationRecord, MigrationApply, MigrationRollback, MigrationHistory, MigrationStatus + MigrationRecordEntry) |
|
|
243
|
+
| `virtual.ts` | Virtual table output schemas (7 schemas: ListVirtualTables, VirtualTableInfo, DropVirtualTable, CreateCsvTable, AnalyzeCsvSchema, CreateRtreeTable, CreateSeriesTable) |
|
|
244
|
+
| `native.ts` | Native-only output schemas (transactions — 7 schemas, window functions — 6 schemas) |
|
|
245
|
+
| `spatialite.ts` | SpatiaLite output schemas (7 tools — native only) |
|
|
246
|
+
| `server.ts` | Type aliases for core output schemas (built-in tools use `content` pattern, not `structuredContent`) |
|
|
247
|
+
| `index.ts` | Barrel re-export |
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Prompts (`src/adapters/sqlite/prompts/`)
|
|
252
|
+
|
|
253
|
+
| File | Prompts |
|
|
254
|
+
| ------------- | ----------------------------------------------------------------------------- |
|
|
255
|
+
| `analysis.ts` | `sqlite_data_analysis`, `sqlite_summarize_table`, `sqlite_demo` |
|
|
256
|
+
| `query.ts` | `sqlite_query_builder`, `sqlite_debug_query`, `sqlite_hybrid_search_workflow` |
|
|
257
|
+
| `schema.ts` | `sqlite_explain_schema`, `sqlite_documentation`, `sqlite_migration` |
|
|
258
|
+
| `index.ts` | Barrel + `sqlite_optimization` |
|
|
259
|
+
|
|
260
|
+
Prompts with required arguments expose typed `argsSchema` via `prompts/list`. All-optional and zero-arg prompts correctly omit `argsSchema`.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Error Class Hierarchy
|
|
265
|
+
|
|
266
|
+
All errors extend `DbMcpError` (defined in `src/utils/errors/base.ts`). Every tool returns structured `{success: false, error, code, category, suggestion, recoverable}` via `formatHandlerError()` — never raw MCP exceptions.
|
|
267
|
+
|
|
268
|
+
The `DbMcpError` constructor auto-refines generic codes (`DB_QUERY_FAILED`, `DB_WRITE_FAILED`, `QUERY_ERROR`, `RESOURCE_ERROR`, `UNKNOWN_ERROR`) to more specific codes (e.g., `TABLE_NOT_FOUND`, `COLUMN_NOT_FOUND`, `VIEW_NOT_FOUND`, `FILE_NOT_FOUND`, `MALFORMED_JSON`, `TRANSACTION_CONFLICT`) when the error message matches a suggestion pattern.
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
DbMcpError (base.ts)
|
|
272
|
+
├── ValidationError code: VALIDATION_ERROR category: validation
|
|
273
|
+
├── ConnectionError code: CONNECTION_ERROR category: connection recoverable: true
|
|
274
|
+
├── QueryError code: QUERY_ERROR category: query accepts: sql option
|
|
275
|
+
├── PermissionError code: PERMISSION_ERROR category: permission
|
|
276
|
+
├── ResourceNotFoundError code: RESOURCE_NOT_FOUND category: resource accepts: resourceType, resourceName
|
|
277
|
+
├── ConfigurationError code: CONFIG_ERROR category: config
|
|
278
|
+
├── InternalError code: INTERNAL_ERROR category: internal
|
|
279
|
+
├── AuthenticationError code: AUTHENTICATION_ERROR category: authentication
|
|
280
|
+
└── AuthorizationError code: AUTHORIZATION_ERROR category: authorization
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Usage pattern** — all tool handlers:
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
import { ValidationError } from "../../utils/errors/index.js";
|
|
287
|
+
import { formatHandlerError } from "../../utils/errors/index.js";
|
|
288
|
+
|
|
289
|
+
// Throw typed errors:
|
|
290
|
+
throw new ValidationError("Table name required", "TABLE_NAME_REQUIRED", {
|
|
291
|
+
suggestion: "Provide a valid table name",
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// Catch at handler boundary:
|
|
295
|
+
catch (error) {
|
|
296
|
+
return formatHandlerError(error);
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Error suggestions** — `src/utils/errors/suggestions.ts` provides:
|
|
301
|
+
|
|
302
|
+
- `suggestTableName(input, existingTables)` — fuzzy-matches typos
|
|
303
|
+
- `suggestColumnName(input, existingColumns)` — fuzzy-matches columns
|
|
304
|
+
- `suggestToolName(input)` — suggests similar tool names
|
|
305
|
+
- Pattern-based refinement: `TABLE_NOT_FOUND`, `COLUMN_NOT_FOUND`, `VIEW_NOT_FOUND`, `FILE_NOT_FOUND`, `MALFORMED_JSON`, `TRANSACTION_CONFLICT`, `DUPLICATE_MIGRATION`, `DUPLICATE_VERSION`, `ALREADY_ROLLED_BACK`, `DIMENSION_MISMATCH`, `VECTOR_NOT_FOUND`
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Key Constants & Config
|
|
310
|
+
|
|
311
|
+
| What | Where | Notes |
|
|
312
|
+
| ---------------------------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
313
|
+
| Server instructions (agent prompt) | `src/constants/server-instructions.ts` | Generated: slim `INSTRUCTIONS` (~680 chars) + `HELP_CONTENT` map. Source: `server-instructions/*.md` |
|
|
314
|
+
| Tool group arrays | `src/filtering/tool-constants.ts` | `TOOL_GROUPS` map, `META_GROUPS` shortcuts |
|
|
315
|
+
| Tool filter logic | `src/filtering/tool-filter.ts` | `ToolFilter` class |
|
|
316
|
+
| JSON-RPC constants | `src/codemode/api-constants.ts` | Error codes, method names for sandbox RPC |
|
|
317
|
+
| Logger error codes | `src/utils/logger/error-codes.ts` | Module-prefixed codes (`DB_`, `AUTH_`, etc.) |
|
|
318
|
+
| Version SSoT | `src/version.ts` | Reads from `package.json` at build time |
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Architecture Patterns (Quick Reference)
|
|
323
|
+
|
|
324
|
+
| Pattern | Description |
|
|
325
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
326
|
+
| **Structured Errors** | Every tool returns `{success: false, error, code, category, suggestion, recoverable}` — never raw exceptions. Uses `formatHandlerError()`. |
|
|
327
|
+
| **Adapter Pattern** | `DatabaseAdapter` (abstract) → `SqliteAdapter` (WASM) / `NativeSqliteAdapter` (Native). Both share tool handler files from `sqlite/tools/`. |
|
|
328
|
+
| **Schema Cache** | `SchemaManager` caches table/column metadata with configurable TTL. Auto-invalidates on DDL ops. |
|
|
329
|
+
| **Code Mode Bridge** | `sqlite.*` API in worker thread communicates via MessagePort RPC to main thread tool handlers. All 9 groups exposed (`core`, `json`, `text`, `stats`, `vector`, `geo`, `admin`, `introspection`, `migration`). |
|
|
330
|
+
| **Tool Filtering** | `ToolFilter` parses `--tool-filter` string → whitelist/blacklist of tool names. `codemode` auto-injected unless excluded. Help resources filtered to match enabled groups. |
|
|
331
|
+
| **Output Schemas** | All Zod output schemas live in `output-schemas/` with named exports — **never inline** in handler files. Handlers import from `../../output-schemas/index.js`. All schemas extend `ErrorFieldsMixin.shape`. Domain-specific fields are optional so error responses pass validation. |
|
|
332
|
+
| **Input Coercion** | All numeric params use `z.preprocess(coerceNumber, ...)` so wrong-type strings fall to defaults. Required enums use `z.string()` + handler validation. Optional enums use `coerceEnumValues()` factory. Array params coerce non-arrays to empty arrays for SDK `.partial()` compatibility. |
|
|
333
|
+
| **Readonly Guard** | Code mode `isWriteTool()` uses fail-closed logic (`readOnlyHint === true`) — tools without annotations are blocked in readonly mode. |
|
|
334
|
+
| **Parameter Aliases** | Core tools support backward-compatible aliases (`tableName`→`table`, `sql`→`query`, `name`→`indexName`) via `resolveAliases()` in handlers. Canonical names take precedence. |
|
|
335
|
+
| **Barrel Re-exports** | Every directory has `index.ts` barrel. Import from `./module/index.js` (with `.js` extension for ESM). |
|
|
336
|
+
| **Module Logger** | `createModuleLogger("moduleName")` → structured logs with `[module]` prefix. |
|
|
337
|
+
| **Help Resources** | Pull-based `sqlite://help` + `sqlite://help/{group}` replace the old push-based `--instruction-level` flag. Per-group `.md` sources in `server-instructions/`. |
|
|
338
|
+
| **DNS Rebinding Guard** | `localhostHostValidation()` middleware from MCP SDK on HTTP transport. |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Import Path Conventions
|
|
343
|
+
|
|
344
|
+
- All imports use **`.js` extension** (ESM requirement): `import { x } from "./foo/index.js"`
|
|
345
|
+
- After splitting `foo.ts` → `foo/` directory: update imports from `./foo.js` → `./foo/index.js`
|
|
346
|
+
- Error classes can be imported from either:
|
|
347
|
+
- `../../utils/errors/index.js` (direct)
|
|
348
|
+
- `../../types/index.js` (re-exported subset: `DbMcpError`, `ValidationError`, `ConnectionError`, `QueryError`, `AuthenticationError`, `AuthorizationError`)
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Test Infrastructure
|
|
353
|
+
|
|
354
|
+
| File / Directory | Purpose |
|
|
355
|
+
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
356
|
+
| `test-server/README.md` | Agent testing orchestration doc |
|
|
357
|
+
| `test-server/test-database.sql` | Seed DDL+DML (10 tables, ~400 rows) |
|
|
358
|
+
| `test-server/reset-database.ps1` | Reset script — drops + re-seeds `test.db` |
|
|
359
|
+
| `test-server/tool-reference.md` | Complete 139/115 tool inventory with descriptions |
|
|
360
|
+
| `test-server/test-preflight.md` | Pre-test verification checklist |
|
|
361
|
+
| `test-server/test-tools.md` | Entry-point protocol (schema ref, reporting format) |
|
|
362
|
+
| `test-server/test-group-tools.md` | Per-group deterministic checklists |
|
|
363
|
+
| `test-server/test-tools-advanced-1.md` | Advanced stress test prompts (part 1) |
|
|
364
|
+
| `test-server/test-tools-advanced-2.md` | Advanced stress test prompts (part 2) |
|
|
365
|
+
| `test-server/test-tools-codemode.md` | Code mode specific test prompts |
|
|
366
|
+
| `test-server/test-resources.md` | MCP resource verification prompts |
|
|
367
|
+
| `test-server/test-prompts.md` | MCP prompt verification prompts |
|
|
368
|
+
| `test-server/test-agent-experience.md` | 20 open-ended scenarios — validates help resource sufficiency |
|
|
369
|
+
| `test-server/test-help-resources.mjs` | Integration test — slim instructions + help resource filtering |
|
|
370
|
+
| `test-server/test-tool-annotations.mjs` | Integration test — openWorldHint annotation verification |
|
|
371
|
+
| `test-server/fixtures/` | Test fixture files (e.g., `sample.csv`) |
|
|
372
|
+
| `tests/adapters/tool-annotations.test.ts` | Vitest invariant — every tool has `annotations` with explicit `readOnlyHint`, per-group checks, title validation |
|
|
373
|
+
| `tests/adapters/tool-output-schemas.test.ts` | Vitest invariant — every tool has `outputSchema`, error response acceptance, centralized schema wiring, no orphans |
|
|
374
|
+
| `tests/` | Vitest unit tests (per-module) |
|
|
375
|
+
| `tests/e2e/` | Playwright E2E tests (~50 spec files, ~300+ tests) — HTTP/SSE transport parity |
|
|
376
|
+
| `benchmarks/` | Vitest bench performance benchmarks |
|
|
377
|
+
|
|
378
|
+
### E2E Spec Files (`tests/e2e/`)
|
|
379
|
+
|
|
380
|
+
| Spec File | Coverage |
|
|
381
|
+
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
382
|
+
| `zod-sweep.spec.ts` | Zod validation sweep — every WASM tool called with `{}` |
|
|
383
|
+
| `zod-sweep-native.spec.ts` | Zod validation sweep — 20 native-only tools (FTS5, window, transactions, SpatiaLite) |
|
|
384
|
+
| `errors.spec.ts` | Basic error path tests |
|
|
385
|
+
| `errors-extended.spec.ts` | Per-group domain error paths |
|
|
386
|
+
| `errors-native.spec.ts` | Native-only error paths (20 tests) |
|
|
387
|
+
| `codemode.spec.ts` | Sandbox lifecycle, security, readonly, workflows, window function smoke tests, API discoverability |
|
|
388
|
+
| `codemode-groups.spec.ts` | All 9 groups via `sqlite.*` API |
|
|
389
|
+
| `codemode-introspection.spec.ts` | Introspection code-mode-only params (~16 tests) |
|
|
390
|
+
| `numeric-coercion.spec.ts` | String-typed numeric param coercion |
|
|
391
|
+
| `numeric-coercion-native.spec.ts` | Native-only numeric coercion (8 tests) |
|
|
392
|
+
| `boundary.spec.ts` | Empty tables, NULLs, idempotency, edge cases, vector empty table edges |
|
|
393
|
+
| `help-resources.spec.ts` | Root + 8 group help resources listed, readable, non-empty |
|
|
394
|
+
| `aliases.spec.ts` | Backward-compatible parameter aliases (14 tests) |
|
|
395
|
+
| `resources.spec.ts` | MCP resource verification (schema, tables, indexes, health, meta, insights, help) |
|
|
396
|
+
| `prompts.spec.ts` | MCP prompt verification (argsSchema, required args, content assertions) |
|
|
397
|
+
| `transactions-nested.spec.ts` | Nested savepoint data correctness (~4 tests) |
|
|
398
|
+
| `integration-workflows.spec.ts` | Cross-group pipelines (~8 tests) |
|
|
399
|
+
| `payloads-*.spec.ts` | Per-group payload correctness (core, json, text, fts, stats, vector, geo, admin, introspection, migration, spatialite, transactions, window, virtual, csv) |
|
|
400
|
+
| `auth.spec.ts`, `oauth-discovery.spec.ts` | OAuth 2.1 and RFC 9728 metadata |
|
|
401
|
+
| `health.spec.ts` | Health endpoint verification |
|
|
402
|
+
| `security.spec.ts` | Security header assertions, HSTS |
|
|
403
|
+
| `sessions.spec.ts`, `session-advanced.spec.ts` | Session management (cross-protocol, sequential isolation, post-DELETE) |
|
|
404
|
+
| `streaming.spec.ts`, `streamable-http.spec.ts` | Raw SSE streaming verification |
|
|
405
|
+
| `rate-limiting.spec.ts` | 429 burst, Retry-After header, health exemption |
|
|
406
|
+
| `protocols.spec.ts` | Transport protocol tests |
|
|
407
|
+
| `stateless.spec.ts` | Stateless mode tests |
|
|
408
|
+
| `tools.spec.ts` | Core tool listing and invocation |
|
|
409
|
+
| `native.spec.ts`, `wasm.spec.ts` | Backend-specific tests |
|