@frontmcp/skills 0.0.1
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 +201 -0
- package/README.md +135 -0
- package/catalog/TEMPLATE.md +49 -0
- package/catalog/adapters/create-adapter/SKILL.md +127 -0
- package/catalog/adapters/official-adapters/SKILL.md +136 -0
- package/catalog/auth/configure-auth/SKILL.md +250 -0
- package/catalog/auth/configure-auth/references/auth-modes.md +77 -0
- package/catalog/auth/configure-session/SKILL.md +201 -0
- package/catalog/config/configure-elicitation/SKILL.md +136 -0
- package/catalog/config/configure-http/SKILL.md +167 -0
- package/catalog/config/configure-throttle/SKILL.md +189 -0
- package/catalog/config/configure-throttle/references/guard-config.md +68 -0
- package/catalog/config/configure-transport/SKILL.md +151 -0
- package/catalog/config/configure-transport/references/protocol-presets.md +57 -0
- package/catalog/deployment/build-for-browser/SKILL.md +95 -0
- package/catalog/deployment/build-for-cli/SKILL.md +100 -0
- package/catalog/deployment/build-for-sdk/SKILL.md +218 -0
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +192 -0
- package/catalog/deployment/deploy-to-lambda/SKILL.md +304 -0
- package/catalog/deployment/deploy-to-node/SKILL.md +229 -0
- package/catalog/deployment/deploy-to-node/references/Dockerfile.example +45 -0
- package/catalog/deployment/deploy-to-vercel/SKILL.md +196 -0
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +60 -0
- package/catalog/development/create-agent/SKILL.md +563 -0
- package/catalog/development/create-agent/references/llm-config.md +46 -0
- package/catalog/development/create-job/SKILL.md +566 -0
- package/catalog/development/create-prompt/SKILL.md +400 -0
- package/catalog/development/create-provider/SKILL.md +233 -0
- package/catalog/development/create-resource/SKILL.md +437 -0
- package/catalog/development/create-skill/SKILL.md +526 -0
- package/catalog/development/create-skill-with-tools/SKILL.md +579 -0
- package/catalog/development/create-tool/SKILL.md +418 -0
- package/catalog/development/create-tool/references/output-schema-types.md +56 -0
- package/catalog/development/create-tool/references/tool-annotations.md +34 -0
- package/catalog/development/create-workflow/SKILL.md +709 -0
- package/catalog/development/decorators-guide/SKILL.md +598 -0
- package/catalog/plugins/create-plugin/SKILL.md +336 -0
- package/catalog/plugins/create-plugin-hooks/SKILL.md +282 -0
- package/catalog/plugins/official-plugins/SKILL.md +667 -0
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +200 -0
- package/catalog/setup/multi-app-composition/SKILL.md +358 -0
- package/catalog/setup/nx-workflow/SKILL.md +357 -0
- package/catalog/setup/project-structure-nx/SKILL.md +186 -0
- package/catalog/setup/project-structure-standalone/SKILL.md +153 -0
- package/catalog/setup/setup-project/SKILL.md +493 -0
- package/catalog/setup/setup-redis/SKILL.md +385 -0
- package/catalog/setup/setup-sqlite/SKILL.md +359 -0
- package/catalog/skills-manifest.json +414 -0
- package/catalog/testing/setup-testing/SKILL.md +539 -0
- package/catalog/testing/setup-testing/references/test-auth.md +88 -0
- package/catalog/testing/setup-testing/references/test-browser-build.md +57 -0
- package/catalog/testing/setup-testing/references/test-cli-binary.md +48 -0
- package/catalog/testing/setup-testing/references/test-direct-client.md +62 -0
- package/catalog/testing/setup-testing/references/test-e2e-handler.md +51 -0
- package/catalog/testing/setup-testing/references/test-tool-unit.md +41 -0
- package/package.json +34 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +16 -0
- package/src/index.js.map +1 -0
- package/src/loader.d.ts +46 -0
- package/src/loader.js +75 -0
- package/src/loader.js.map +1 -0
- package/src/manifest.d.ts +81 -0
- package/src/manifest.js +26 -0
- package/src/manifest.js.map +1 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-sqlite
|
|
3
|
+
description: Configure SQLite for local development and single-instance deployments. Use when setting up local storage, CLI tools, unix-socket daemons, or WAL mode.
|
|
4
|
+
category: setup
|
|
5
|
+
tags: [setup, sqlite, storage, local]
|
|
6
|
+
targets: [node]
|
|
7
|
+
bundle: [minimal, full]
|
|
8
|
+
hasResources: false
|
|
9
|
+
storageDefault:
|
|
10
|
+
node: sqlite
|
|
11
|
+
allowed-tools: Bash Write Edit Read Grep
|
|
12
|
+
parameters:
|
|
13
|
+
- name: walMode
|
|
14
|
+
type: boolean
|
|
15
|
+
description: Enable WAL (Write-Ahead Logging) mode for better read concurrency
|
|
16
|
+
default: true
|
|
17
|
+
- name: dbPath
|
|
18
|
+
type: string
|
|
19
|
+
description: File path for the SQLite database
|
|
20
|
+
default: '~/.frontmcp/data/sessions.sqlite'
|
|
21
|
+
- name: encryption
|
|
22
|
+
type: boolean
|
|
23
|
+
description: Enable AES-256-GCM at-rest encryption for stored values
|
|
24
|
+
default: false
|
|
25
|
+
examples:
|
|
26
|
+
- scenario: Set up SQLite storage for a CLI tool
|
|
27
|
+
parameters:
|
|
28
|
+
walMode: true
|
|
29
|
+
dbPath: '~/.frontmcp/data/sessions.sqlite'
|
|
30
|
+
encryption: false
|
|
31
|
+
- scenario: Configure SQLite for a unix-socket daemon with encryption
|
|
32
|
+
parameters:
|
|
33
|
+
walMode: true
|
|
34
|
+
dbPath: '/var/lib/frontmcp/daemon.sqlite'
|
|
35
|
+
encryption: true
|
|
36
|
+
compatibility: 'Node.js 18+. Requires better-sqlite3 native bindings (build tools needed). Linux, macOS, Windows (x64/arm64). Not recommended for multi-instance, serverless, or horizontally scaled deployments.'
|
|
37
|
+
install:
|
|
38
|
+
destinations: [project-local]
|
|
39
|
+
mergeStrategy: overwrite
|
|
40
|
+
dependencies: [setup-project]
|
|
41
|
+
metadata:
|
|
42
|
+
docs: https://docs.agentfront.dev/frontmcp/deployment/sqlite-setup
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
# Configure SQLite for Local and Single-Instance Deployments
|
|
46
|
+
|
|
47
|
+
## When to use this skill
|
|
48
|
+
|
|
49
|
+
Use this skill when your FrontMCP server runs as a single instance and does not need distributed storage. SQLite is the right choice for:
|
|
50
|
+
|
|
51
|
+
- CLI tools and local-only MCP servers
|
|
52
|
+
- Single-instance daemons communicating over stdio or unix socket
|
|
53
|
+
- Local development when running a Redis container is unnecessary overhead
|
|
54
|
+
- Projects that will never run multiple instances behind a load balancer
|
|
55
|
+
|
|
56
|
+
Do NOT use SQLite when:
|
|
57
|
+
|
|
58
|
+
- Deploying to serverless (Vercel, Lambda, Cloudflare) -- there is no persistent local filesystem
|
|
59
|
+
- Running multiple server instances (SQLite does not support distributed access)
|
|
60
|
+
- You need pub/sub for resource subscriptions (use Redis instead)
|
|
61
|
+
- Horizontal scaling is required now or in the near future
|
|
62
|
+
|
|
63
|
+
For multi-instance or serverless deployments, use the `setup-redis` skill instead.
|
|
64
|
+
|
|
65
|
+
## Step 1 -- Install the Native Dependency
|
|
66
|
+
|
|
67
|
+
The `@frontmcp/storage-sqlite` package depends on `better-sqlite3`, which compiles a native C module during installation. Build tools must be available on the system.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
yarn add @frontmcp/storage-sqlite better-sqlite3
|
|
71
|
+
yarn add -D @types/better-sqlite3
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If the install fails with compilation errors:
|
|
75
|
+
|
|
76
|
+
- **macOS**: Install Xcode Command Line Tools: `xcode-select --install`
|
|
77
|
+
- **Linux (Debian/Ubuntu)**: `sudo apt-get install build-essential python3`
|
|
78
|
+
- **Linux (Alpine)**: `apk add build-base python3`
|
|
79
|
+
- **Windows**: Install Visual Studio Build Tools with the "Desktop development with C++" workload
|
|
80
|
+
|
|
81
|
+
Verify the native module loads:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
node -e "require('better-sqlite3')"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
No output means success. An error means the native bindings did not compile correctly.
|
|
88
|
+
|
|
89
|
+
## Step 2 -- Configure the FrontMCP Server
|
|
90
|
+
|
|
91
|
+
The `sqlite` field in the `@FrontMcp` decorator accepts a `SqliteOptionsInput` object with the following shape:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
interface SqliteOptionsInput {
|
|
95
|
+
/** Path to the .sqlite database file (required) */
|
|
96
|
+
path: string;
|
|
97
|
+
|
|
98
|
+
/** Enable WAL mode for better read concurrency (default: true) */
|
|
99
|
+
walMode?: boolean;
|
|
100
|
+
|
|
101
|
+
/** Encryption config for at-rest encryption of values (optional) */
|
|
102
|
+
encryption?: {
|
|
103
|
+
/** Secret key material for AES-256-GCM encryption via HKDF-SHA256 */
|
|
104
|
+
secret: string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** Interval in ms for purging expired keys (default: 60000) */
|
|
108
|
+
ttlCleanupIntervalMs?: number;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Basic SQLite setup
|
|
113
|
+
|
|
114
|
+
Update the `@FrontMcp` decorator in `src/main.ts`:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import 'reflect-metadata';
|
|
118
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
119
|
+
|
|
120
|
+
@FrontMcp({
|
|
121
|
+
info: { name: 'my-cli-server', version: '0.1.0' },
|
|
122
|
+
apps: [
|
|
123
|
+
/* ... */
|
|
124
|
+
],
|
|
125
|
+
sqlite: {
|
|
126
|
+
path: '~/.frontmcp/data/sessions.sqlite',
|
|
127
|
+
walMode: true,
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
export default class Server {}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Configuration reference:
|
|
134
|
+
|
|
135
|
+
| Option | Type | Default | Description |
|
|
136
|
+
| ---------------------- | -------------------- | ----------- | --------------------------------------------------- |
|
|
137
|
+
| `path` | `string` | (required) | Absolute or `~`-prefixed path to the `.sqlite` file |
|
|
138
|
+
| `walMode` | `boolean` | `true` | Enable WAL mode for better read concurrency |
|
|
139
|
+
| `encryption` | `{ secret: string }` | `undefined` | AES-256-GCM encryption for values at rest |
|
|
140
|
+
| `ttlCleanupIntervalMs` | `number` | `60000` | Interval for purging expired keys (milliseconds) |
|
|
141
|
+
|
|
142
|
+
### With at-rest encryption
|
|
143
|
+
|
|
144
|
+
If the database stores sensitive session data (tokens, credentials), enable encryption:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
@FrontMcp({
|
|
148
|
+
info: { name: 'my-server', version: '0.1.0' },
|
|
149
|
+
apps: [
|
|
150
|
+
/* ... */
|
|
151
|
+
],
|
|
152
|
+
sqlite: {
|
|
153
|
+
path: '~/.frontmcp/data/sessions.sqlite',
|
|
154
|
+
walMode: true,
|
|
155
|
+
encryption: {
|
|
156
|
+
secret: process.env['SQLITE_ENCRYPTION_SECRET']!,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
})
|
|
160
|
+
export default class Server {}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The encryption uses HKDF-SHA256 for key derivation and AES-256-GCM for value encryption. The secret should be at least 32 characters. Store it in environment variables, never in source code.
|
|
164
|
+
|
|
165
|
+
### For a unix-socket daemon
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
@FrontMcp({
|
|
169
|
+
info: { name: 'frontmcp-daemon', version: '0.1.0' },
|
|
170
|
+
apps: [
|
|
171
|
+
/* ... */
|
|
172
|
+
],
|
|
173
|
+
sqlite: {
|
|
174
|
+
path: '/var/lib/frontmcp/daemon.sqlite',
|
|
175
|
+
walMode: true,
|
|
176
|
+
},
|
|
177
|
+
transport: {
|
|
178
|
+
protocol: 'streamable-http',
|
|
179
|
+
},
|
|
180
|
+
http: {
|
|
181
|
+
unixSocket: '/tmp/frontmcp.sock',
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
export default class Server {}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### With custom TTL cleanup interval
|
|
188
|
+
|
|
189
|
+
For high-throughput servers with many short-lived sessions, reduce the cleanup interval:
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
sqlite: {
|
|
193
|
+
path: '~/.frontmcp/data/sessions.sqlite',
|
|
194
|
+
walMode: true,
|
|
195
|
+
ttlCleanupIntervalMs: 15000, // purge expired keys every 15 seconds
|
|
196
|
+
},
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Step 3 -- WAL Mode Configuration
|
|
200
|
+
|
|
201
|
+
WAL (Write-Ahead Logging) mode is enabled by default (`walMode: true`) and is strongly recommended. It provides:
|
|
202
|
+
|
|
203
|
+
- Concurrent readers do not block writers
|
|
204
|
+
- Writers do not block readers
|
|
205
|
+
- Better performance for read-heavy workloads (typical for MCP session lookups)
|
|
206
|
+
|
|
207
|
+
WAL mode creates two additional files alongside the database:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
sessions.sqlite # main database
|
|
211
|
+
sessions.sqlite-wal # write-ahead log
|
|
212
|
+
sessions.sqlite-shm # shared memory index
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
All three files must be on the same filesystem. Do not place the database on a network mount (NFS, SMB) when using WAL mode.
|
|
216
|
+
|
|
217
|
+
To disable WAL mode (only if you have a specific reason, such as a filesystem that does not support shared memory):
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
sqlite: {
|
|
221
|
+
path: '~/.frontmcp/data/sessions.sqlite',
|
|
222
|
+
walMode: false,
|
|
223
|
+
},
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Step 4 -- Session Store Factory (Advanced)
|
|
227
|
+
|
|
228
|
+
The SDK creates the SQLite session store automatically from the `sqlite` config in the `@FrontMcp` decorator. For advanced scenarios where you need direct access to the factory function:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { createSqliteSessionStore } from '@frontmcp/sdk';
|
|
232
|
+
|
|
233
|
+
const sessionStore = createSqliteSessionStore({
|
|
234
|
+
path: '~/.frontmcp/data/sessions.sqlite',
|
|
235
|
+
walMode: true,
|
|
236
|
+
encryption: { secret: process.env['SQLITE_ENCRYPTION_SECRET']! },
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
The `createSqliteSessionStore()` function signature:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
function createSqliteSessionStore(options: SqliteOptionsInput, logger?: FrontMcpLogger): SessionStore;
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
The factory function:
|
|
247
|
+
|
|
248
|
+
- Lazy-loads `@frontmcp/storage-sqlite` to avoid bundling native modules when not used
|
|
249
|
+
- Handles WAL mode pragma configuration internally
|
|
250
|
+
- Sets up the TTL cleanup interval for automatic key expiration
|
|
251
|
+
- Creates the database file and parent directories if they do not exist
|
|
252
|
+
- Returns synchronously (unlike the Redis `createSessionStore` which is async)
|
|
253
|
+
|
|
254
|
+
## Step 5 -- Environment Variables
|
|
255
|
+
|
|
256
|
+
Add to your `.env` file:
|
|
257
|
+
|
|
258
|
+
```env
|
|
259
|
+
# SQLite storage
|
|
260
|
+
SQLITE_DB_PATH=~/.frontmcp/data/sessions.sqlite
|
|
261
|
+
|
|
262
|
+
# Encryption (optional, at least 32 characters)
|
|
263
|
+
# SQLITE_ENCRYPTION_SECRET=your-secret-key-at-least-32-chars-long
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Confirm `.env` is in `.gitignore`. Never commit credentials.
|
|
267
|
+
|
|
268
|
+
## Step 6 -- Verify the Setup
|
|
269
|
+
|
|
270
|
+
Start the server:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
frontmcp dev
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Check the logs for SQLite initialization:
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
[SessionStoreFactory] Creating SQLite session store
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Verify the database file was created:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
ls -la ~/.frontmcp/data/sessions.sqlite
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
If WAL mode is enabled, you should also see:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
ls -la ~/.frontmcp/data/sessions.sqlite-wal
|
|
292
|
+
ls -la ~/.frontmcp/data/sessions.sqlite-shm
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Inspect the database contents (after at least one session is created):
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
sqlite3 ~/.frontmcp/data/sessions.sqlite ".tables"
|
|
299
|
+
sqlite3 ~/.frontmcp/data/sessions.sqlite "SELECT key FROM kv_store LIMIT 5;"
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Migrating from SQLite to Redis
|
|
303
|
+
|
|
304
|
+
When your project outgrows single-instance deployment, migrate to Redis:
|
|
305
|
+
|
|
306
|
+
1. Run the `setup-redis` skill to configure Redis.
|
|
307
|
+
2. Replace the `sqlite` block with a `redis` block in the `@FrontMcp` decorator.
|
|
308
|
+
3. Remove `@frontmcp/storage-sqlite` and `better-sqlite3` from dependencies.
|
|
309
|
+
4. Active sessions will not transfer -- users will need to re-authenticate.
|
|
310
|
+
|
|
311
|
+
The change in `src/main.ts`:
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
// Before (SQLite)
|
|
315
|
+
@FrontMcp({
|
|
316
|
+
info: { name: 'my-server', version: '0.1.0' },
|
|
317
|
+
apps: [/* ... */],
|
|
318
|
+
sqlite: {
|
|
319
|
+
path: '~/.frontmcp/data/sessions.sqlite',
|
|
320
|
+
walMode: true,
|
|
321
|
+
},
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
// After (Redis)
|
|
325
|
+
@FrontMcp({
|
|
326
|
+
info: { name: 'my-server', version: '0.1.0' },
|
|
327
|
+
apps: [/* ... */],
|
|
328
|
+
redis: {
|
|
329
|
+
provider: 'redis',
|
|
330
|
+
host: 'localhost',
|
|
331
|
+
port: 6379,
|
|
332
|
+
keyPrefix: 'mcp:',
|
|
333
|
+
},
|
|
334
|
+
})
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Troubleshooting
|
|
338
|
+
|
|
339
|
+
| Symptom | Likely Cause | Fix |
|
|
340
|
+
| ------------------------------------- | ------------------------------------------ | -------------------------------------------------------------------------- |
|
|
341
|
+
| `Cannot find module 'better-sqlite3'` | Native module not installed | Run `yarn add @frontmcp/storage-sqlite better-sqlite3` |
|
|
342
|
+
| `Could not locate the bindings file` | Native compilation failed | Ensure build tools are installed, delete `node_modules` and reinstall |
|
|
343
|
+
| `SQLITE_BUSY` errors | Multiple processes accessing the same file | Use WAL mode or ensure only one process writes to the database |
|
|
344
|
+
| `SQLITE_READONLY` | File permissions | Check write permissions on the database file and its parent directory |
|
|
345
|
+
| Database file on NFS with WAL errors | WAL requires local filesystem | Move the database to a local disk or disable WAL mode |
|
|
346
|
+
| Encrypted data unreadable | Wrong or missing encryption secret | The secret must be identical across restarts; if lost, delete the database |
|
|
347
|
+
|
|
348
|
+
## Verification Checklist
|
|
349
|
+
|
|
350
|
+
Before reporting completion, verify:
|
|
351
|
+
|
|
352
|
+
1. `@frontmcp/storage-sqlite` and `better-sqlite3` are in `dependencies`
|
|
353
|
+
2. `@types/better-sqlite3` is in `devDependencies`
|
|
354
|
+
3. `node -e "require('better-sqlite3')"` runs without errors
|
|
355
|
+
4. The `sqlite` block is present in the `@FrontMcp` decorator config with a valid `path` string
|
|
356
|
+
5. The database path parent directory exists and is writable
|
|
357
|
+
6. Environment variables are in `.env` and `.env` is gitignored
|
|
358
|
+
7. The server starts without SQLite errors (`frontmcp dev`)
|
|
359
|
+
8. If encryption is enabled: `SQLITE_ENCRYPTION_SECRET` is set and is at least 32 characters
|