@frontmcp/storage-sqlite 1.5.6 → 1.6.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/README.md +91 -0
- package/esm/package.json +3 -3
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @frontmcp/storage-sqlite
|
|
2
|
+
|
|
3
|
+
SQLite storage backend for FrontMCP — session, task, elicitation, and event
|
|
4
|
+
persistence without running Redis.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@frontmcp/storage-sqlite)
|
|
7
|
+
|
|
8
|
+
## When to use it
|
|
9
|
+
|
|
10
|
+
Reach for SQLite when you need state to survive a restart but do not want a
|
|
11
|
+
network dependency:
|
|
12
|
+
|
|
13
|
+
- **Local development** — restart `frontmcp dev` without losing sessions.
|
|
14
|
+
- **Single-node deployments** — a VPS or container with a mounted volume.
|
|
15
|
+
- **CLI / desktop distributions** — a single binary with embedded storage.
|
|
16
|
+
- **Background tasks** — the CLI task runner spawns detached workers that need a
|
|
17
|
+
shared store the parent process can also read.
|
|
18
|
+
|
|
19
|
+
Use Redis instead when more than one node has to see the same state — SQLite is
|
|
20
|
+
a local file, so it cannot coordinate across machines.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @frontmcp/storage-sqlite
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`better-sqlite3` is a native module and is loaded lazily, so importing
|
|
29
|
+
`@frontmcp/sdk` never pulls it in unless you actually enable SQLite. It does not
|
|
30
|
+
work on Edge/V8-isolate runtimes (Cloudflare Workers) — use Redis or Upstash
|
|
31
|
+
there.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
Most servers never import this package directly. Point a store at SQLite in
|
|
36
|
+
config and the SDK wires it up:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
@FrontMcp({
|
|
40
|
+
info: { name: 'my-server', version: '1.0.0' },
|
|
41
|
+
apps: [MyApp],
|
|
42
|
+
// Persist sessions across restarts.
|
|
43
|
+
transport: { persistence: { sqlite: { path: './data/frontmcp.sqlite' } } },
|
|
44
|
+
// Persist background tasks (required for the `cli` task runner).
|
|
45
|
+
tasks: { enabled: true, sqlite: { path: './data/tasks.sqlite', walMode: true } },
|
|
46
|
+
})
|
|
47
|
+
class Server {}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Direct use
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { openDatabase, SqliteSessionStore } from '@frontmcp/storage-sqlite';
|
|
54
|
+
|
|
55
|
+
const store = new SqliteSessionStore({ path: './data/sessions.sqlite', walMode: true });
|
|
56
|
+
await store.set('session-id', { userId: 'u1' }, { ttlSeconds: 3600 });
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Stores
|
|
60
|
+
|
|
61
|
+
| Export | Backs |
|
|
62
|
+
| ------------------------ | ----------------------------------------------------- |
|
|
63
|
+
| `SqliteSessionStore` | MCP transport sessions |
|
|
64
|
+
| `SqliteTaskStore` | Background tasks (status, outcome, cancel signalling) |
|
|
65
|
+
| `SqliteElicitationStore` | Pending elicitation round trips |
|
|
66
|
+
| `SqliteEventStore` | Streamable-HTTP event replay |
|
|
67
|
+
| `SqliteKvStore` | Generic key/value with TTL |
|
|
68
|
+
| `SqliteStorageAdapter` | The `StorageAdapter` the SDK's factories accept |
|
|
69
|
+
|
|
70
|
+
## Options
|
|
71
|
+
|
|
72
|
+
| Option | Default | Notes |
|
|
73
|
+
| ---------------------- | ------- | ------------------------------------------------------ |
|
|
74
|
+
| `path` | — | Database file. Parent directories are created for you. |
|
|
75
|
+
| `walMode` | `true` | Write-ahead logging. Leave on for concurrent readers. |
|
|
76
|
+
| `ttlCleanupIntervalMs` | `60000` | How often expired rows are swept. |
|
|
77
|
+
| `encryption` | — | Encrypt values at rest; pass a key to enable. |
|
|
78
|
+
|
|
79
|
+
## Operational notes
|
|
80
|
+
|
|
81
|
+
- **Back up the file.** It is ordinary SQLite — copy it, or use `sqlite3 .backup`.
|
|
82
|
+
- **WAL creates sidecar files** (`-wal`, `-shm`). Ship the whole set, or check
|
|
83
|
+
point before copying.
|
|
84
|
+
- **One writer.** Multiple processes can read; concurrent writers serialize. The
|
|
85
|
+
CLI task runner relies on WAL for exactly this.
|
|
86
|
+
|
|
87
|
+
Full guide: [SQLite Setup](https://docs.agentfront.dev/frontmcp/deployment/sqlite-setup)
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
Apache-2.0
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/storage-sqlite",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "SQLite storage backend for FrontMCP - local session, elicitation, and event persistence without Redis",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"node": ">=24.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@frontmcp/utils": "1.
|
|
47
|
+
"@frontmcp/utils": "1.6.0",
|
|
48
48
|
"better-sqlite3": "^12.6.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@frontmcp/lazy-zod": "1.
|
|
51
|
+
"@frontmcp/lazy-zod": "1.6.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/better-sqlite3": "^7.6.13",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/storage-sqlite",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "SQLite storage backend for FrontMCP - local session, elicitation, and event persistence without Redis",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"node": ">=24.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@frontmcp/utils": "1.
|
|
47
|
+
"@frontmcp/utils": "1.6.0",
|
|
48
48
|
"better-sqlite3": "^12.6.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@frontmcp/lazy-zod": "1.
|
|
51
|
+
"@frontmcp/lazy-zod": "1.6.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/better-sqlite3": "^7.6.13",
|