@frontmcp/skills 0.0.1 → 1.0.0-beta.10

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.
Files changed (88) hide show
  1. package/README.md +2 -2
  2. package/catalog/TEMPLATE.md +58 -13
  3. package/catalog/frontmcp-config/SKILL.md +143 -0
  4. package/catalog/frontmcp-config/references/configure-auth.md +238 -0
  5. package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
  6. package/catalog/frontmcp-config/references/configure-http.md +205 -0
  7. package/catalog/frontmcp-config/references/configure-session.md +205 -0
  8. package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
  9. package/catalog/frontmcp-config/references/configure-transport.md +195 -0
  10. package/catalog/frontmcp-config/references/setup-redis.md +4 -0
  11. package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
  12. package/catalog/frontmcp-deployment/SKILL.md +127 -0
  13. package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
  14. package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
  15. package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
  16. package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
  17. package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +76 -63
  18. package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
  19. package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
  20. package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
  21. package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
  22. package/catalog/frontmcp-development/SKILL.md +121 -0
  23. package/catalog/frontmcp-development/references/create-adapter.md +165 -0
  24. package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
  25. package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
  26. package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
  27. package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
  28. package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
  29. package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
  30. package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
  31. package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
  32. package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
  33. package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +96 -22
  34. package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
  35. package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
  36. package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
  37. package/catalog/frontmcp-development/references/official-adapters.md +194 -0
  38. package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +96 -31
  39. package/catalog/frontmcp-guides/SKILL.md +420 -0
  40. package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
  41. package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
  42. package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
  43. package/catalog/frontmcp-production-readiness/SKILL.md +253 -0
  44. package/catalog/frontmcp-setup/SKILL.md +130 -0
  45. package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
  46. package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
  47. package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
  48. package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
  49. package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
  50. package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
  51. package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
  52. package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
  53. package/catalog/frontmcp-testing/SKILL.md +127 -0
  54. package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
  55. package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
  56. package/catalog/skills-manifest.json +39 -378
  57. package/package.json +2 -2
  58. package/src/loader.js +0 -1
  59. package/src/loader.js.map +1 -1
  60. package/src/manifest.d.ts +3 -3
  61. package/src/manifest.js +2 -3
  62. package/src/manifest.js.map +1 -1
  63. package/catalog/adapters/create-adapter/SKILL.md +0 -127
  64. package/catalog/adapters/official-adapters/SKILL.md +0 -136
  65. package/catalog/auth/configure-auth/SKILL.md +0 -250
  66. package/catalog/auth/configure-session/SKILL.md +0 -201
  67. package/catalog/config/configure-elicitation/SKILL.md +0 -136
  68. package/catalog/config/configure-http/SKILL.md +0 -167
  69. package/catalog/config/configure-throttle/SKILL.md +0 -189
  70. package/catalog/config/configure-transport/SKILL.md +0 -151
  71. package/catalog/deployment/build-for-browser/SKILL.md +0 -95
  72. package/catalog/deployment/build-for-cli/SKILL.md +0 -100
  73. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
  74. package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
  75. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
  76. package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
  77. package/catalog/setup/project-structure-nx/SKILL.md +0 -186
  78. package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
  79. /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
  80. /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
  81. /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
  82. /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
  83. /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
  84. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
  85. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
  86. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
  87. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
  88. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
@@ -1,76 +1,26 @@
1
- ---
2
- name: setup-redis
3
- description: Configure Redis for session storage and distributed state management. Use when adding Redis, Docker Redis, Vercel KV, or setting up pub/sub for resource subscriptions.
4
- category: setup
5
- tags: [setup, redis, storage, session]
6
- targets: [node, vercel]
7
- bundle: [recommended, full]
8
- hasResources: false
9
- storageDefault:
10
- node: redis-docker
11
- vercel: vercel-kv
12
- allowed-tools: Bash Write Edit Read Grep
13
- parameters:
14
- - name: provider
15
- type: string
16
- description: How to provision Redis
17
- enum: [docker, existing, vercel-kv]
18
- default: docker
19
- - name: target
20
- type: string
21
- description: Deployment target that determines the provider strategy
22
- enum: [node, vercel, lambda, cloudflare]
23
- default: node
24
- - name: host
25
- type: string
26
- description: Redis host when using an existing instance
27
- default: localhost
28
- - name: port
29
- type: number
30
- description: Redis port when using an existing instance
31
- default: 6379
32
- - name: keyPrefix
33
- type: string
34
- description: Key prefix for all FrontMCP keys in Redis
35
- default: 'mcp:'
36
- examples:
37
- - scenario: Set up Redis for local development with Docker
38
- parameters:
39
- provider: docker
40
- target: node
41
- - scenario: Configure Vercel KV for my Vercel-deployed MCP server
42
- parameters:
43
- provider: vercel-kv
44
- target: vercel
45
- - scenario: Connect to an existing Redis instance at redis.internal:6380
46
- parameters:
47
- provider: existing
48
- target: node
49
- host: redis.internal
50
- port: 6380
51
- compatibility: 'Redis 6+. Docker Engine 20+ for local container. Vercel KV requires a Vercel project with KV store enabled.'
52
- install:
53
- destinations: [project-local]
54
- mergeStrategy: overwrite
55
- dependencies: [setup-project]
56
- metadata:
57
- docs: https://docs.agentfront.dev/frontmcp/deployment/redis-setup
58
- ---
59
-
60
1
  # Configure Redis for Session Storage and Distributed State
61
2
 
62
- ## When to use this skill
3
+ ## When to Use This Skill
4
+
5
+ ### Must Use
6
+
7
+ - The server uses Streamable HTTP transport and sessions must survive reconnects
8
+ - Multiple server instances run behind a load balancer and need shared state (sessions, rate limits)
9
+ - Deploying to serverless (Vercel, Lambda, Cloudflare) where no local filesystem or in-process storage exists
10
+
11
+ ### Recommended
63
12
 
64
- Use this skill when your FrontMCP server needs persistent session storage, distributed state, or pub/sub for resource subscriptions. Redis is required when any of the following apply:
13
+ - Resource subscriptions with `subscribe: true` are enabled and need pub/sub
14
+ - Auth sessions or elicitation state must persist across server restarts
15
+ - Distributed rate limiting is configured in the throttle guard
65
16
 
66
- - The server uses Streamable HTTP transport (sessions must survive reconnects)
67
- - Multiple server instances run behind a load balancer
68
- - Resource subscriptions with `subscribe: true` are enabled
69
- - Auth sessions need to persist across restarts
70
- - Elicitation state must be shared across instances
71
- - Deploying to serverless (Vercel, Lambda, Cloudflare) where no local filesystem exists
17
+ ### Skip When
72
18
 
73
- For single-instance stdio-only servers or local development, SQLite or in-memory stores may be sufficient. See the `setup-sqlite` skill for that use case.
19
+ - Running a single-instance stdio-only server for local development -- use `setup-sqlite` or in-memory stores
20
+ - Only need to configure session TTL and key prefix on an already-provisioned Redis -- use `configure-session`
21
+ - Deploying a read-only MCP server with no sessions, subscriptions, or stateful tools
22
+
23
+ > **Decision:** Use this skill to provision and connect Redis (Docker, existing instance, or Vercel KV); use `configure-session` to tune session-specific options after Redis is available.
74
24
 
75
25
  ## Step 1 -- Provision Redis
76
26
 
@@ -336,7 +286,7 @@ frontmcp dev
336
286
 
337
287
  Look for log lines like:
338
288
 
339
- ```
289
+ ```text
340
290
  [SessionStoreFactory] Creating Redis session store
341
291
  [RedisStorageAdapter] Connected to Redis at localhost:6379
342
292
  ```
@@ -361,25 +311,48 @@ redis-cli -h localhost -p 6379 keys "mcp:*"
361
311
 
362
312
  You should see session keys like `mcp:session:<session-id>`.
363
313
 
364
- ## Troubleshooting
314
+ ## Common Patterns
365
315
 
366
- | Symptom | Likely Cause | Fix |
367
- | ----------------------------------- | ------------------------------------------ | ------------------------------------------------------------------------ |
368
- | `ECONNREFUSED 127.0.0.1:6379` | Redis is not running | Start Docker container or check the Redis service |
369
- | `NOAUTH Authentication required` | Password is set on Redis but not in config | Add `password` to the `redis` config or set `REDIS_PASSWORD` |
370
- | `ERR max number of clients reached` | Too many connections | Set `maxRetriesPerRequest` or use connection pooling |
371
- | Vercel KV `401 Unauthorized` | Missing or wrong KV tokens | Check `KV_REST_API_URL` and `KV_REST_API_TOKEN` in Vercel dashboard |
372
- | Sessions lost after restart | Redis persistence disabled | Use `--appendonly yes` in Redis config or managed Redis with persistence |
373
- | Pub/sub not working with Vercel KV | Vercel KV does not support pub/sub | Add a separate `pubsub` config pointing to a real Redis instance |
316
+ | Pattern | Correct | Incorrect | Why |
317
+ | ---------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
318
+ | Redis provider field | `redis: { provider: 'redis', host: '...', port: 6379 }` | `redis: { host: '...', port: 6379 }` without `provider` | Both forms are type-safe (the SDK's `RedisOptions` union accepts both shapes), but explicit `provider: 'redis'` improves clarity and intent |
319
+ | Environment variables | `host: process.env['REDIS_HOST'] ?? 'localhost'` | Hardcoding `host: 'redis.internal'` in source | Hardcoded values break across environments (dev, staging, prod); always read from env with a sensible fallback |
320
+ | Vercel KV credentials | Let Vercel auto-inject `KV_REST_API_URL` and `KV_REST_API_TOKEN` | Manually setting KV tokens in the `redis` config object | Auto-injection is safer and ensures tokens rotate correctly; manual values risk stale or committed secrets |
321
+ | Docker persistence | `command: redis-server --appendonly yes` in docker-compose | Running Redis without `--appendonly` in development | Without AOF persistence, data is lost on container restart; `--appendonly yes` preserves data across restarts |
322
+ | Pub/sub with Vercel KV | Separate `pubsub: { provider: 'redis', ... }` alongside `redis: { provider: 'vercel-kv' }` | Expecting Vercel KV to handle pub/sub | Vercel KV does not support pub/sub; a real Redis instance is required for resource subscriptions |
374
323
 
375
324
  ## Verification Checklist
376
325
 
377
- Before reporting completion, verify:
326
+ ### Provisioning
327
+
328
+ - [ ] Redis is reachable (`redis-cli ping` returns `PONG`, or Vercel KV dashboard shows the store is active)
329
+ - [ ] Docker container is running and healthy (`docker compose ps` shows `healthy` status)
330
+ - [ ] For existing instances: host, port, password, and TLS settings are correct
331
+
332
+ ### Configuration
333
+
334
+ - [ ] The `redis` block is present in the `@FrontMcp` decorator with a valid `provider` field (`'redis'` or `'vercel-kv'`)
335
+ - [ ] Environment variables (`REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD`) are set in `.env`
336
+ - [ ] `.env` file is listed in `.gitignore` -- credentials are never committed
337
+ - [ ] For Vercel KV: `provider: 'vercel-kv'` is set and KV environment variables are present
338
+
339
+ ### Runtime
340
+
341
+ - [ ] The server starts without Redis connection errors in the logs
342
+ - [ ] `redis-cli keys "mcp:*"` shows keys after at least one MCP request through HTTP transport
343
+ - [ ] For pub/sub: a separate `pubsub` config pointing to real Redis is provided when using Vercel KV for sessions
344
+
345
+ ## Troubleshooting
346
+
347
+ | Problem | Cause | Solution |
348
+ | ------------------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
349
+ | `ECONNREFUSED 127.0.0.1:6379` | Redis is not running or Docker container is stopped | Start the container with `docker compose up -d redis` or check the Redis service status |
350
+ | `NOAUTH Authentication required` | Password is set on Redis but not provided in config | Add `password` to the `redis` config or set `REDIS_PASSWORD` environment variable |
351
+ | `ERR max number of clients reached` | Too many open connections from the application | Set `maxRetriesPerRequest` or use connection pooling; check for connection leaks |
352
+ | Vercel KV `401 Unauthorized` | Missing or invalid KV tokens in the environment | Verify `KV_REST_API_URL` and `KV_REST_API_TOKEN` in the Vercel dashboard and redeploy |
353
+ | Sessions lost after container restart | Redis running without append-only persistence | Add `--appendonly yes` to the Redis command in docker-compose or use a managed Redis with persistence enabled |
354
+
355
+ ## Reference
378
356
 
379
- 1. Redis is reachable (`redis-cli ping` returns `PONG`, or Vercel KV dashboard shows the store is active)
380
- 2. The `redis` block is present in the `@FrontMcp` decorator config with a valid `provider` field
381
- 3. The `provider` value is either `'redis'` or `'vercel-kv'` (not a custom string)
382
- 4. Environment variables are set in `.env` and `.env` is gitignored
383
- 5. The server starts without Redis connection errors
384
- 6. For Vercel KV: `provider: 'vercel-kv'` is set and KV environment variables are present
385
- 7. For pub/sub: a separate `pubsub` config pointing to real Redis is provided when using Vercel KV for sessions
357
+ - [Redis Setup Docs](https://docs.agentfront.dev/frontmcp/deployment/redis-setup)
358
+ - Related skills: `configure-session`, `setup-project`, `setup-sqlite`, `configure-transport`
@@ -1,66 +1,26 @@
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
1
  # Configure SQLite for Local and Single-Instance Deployments
46
2
 
47
- ## When to use this skill
3
+ ## When to Use This Skill
4
+
5
+ ### Must Use
6
+
7
+ - Your FrontMCP server runs as a single instance with local persistent storage (CLI tools, unix-socket daemons)
8
+ - You need session or key-value storage for local development without running external services
9
+ - Your deployment target is a single-process Node.js server on a machine with a local filesystem
48
10
 
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:
11
+ ### Recommended
50
12
 
51
- - CLI tools and local-only MCP servers
52
- - Single-instance daemons communicating over stdio or unix socket
13
+ - You are building a CLI tool or local-only MCP server that will never be horizontally scaled
53
14
  - Local development when running a Redis container is unnecessary overhead
54
- - Projects that will never run multiple instances behind a load balancer
15
+ - Projects that store session data, credentials, or counters on a single host
55
16
 
56
- Do NOT use SQLite when:
17
+ ### Skip When
57
18
 
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
19
+ - Deploying to serverless (Vercel, Lambda, Cloudflare) where there is no persistent local filesystem -- use `setup-redis` instead
20
+ - Running multiple server instances behind a load balancer -- use `setup-redis` instead
21
+ - You need pub/sub for resource subscriptions or real-time event distribution -- use `setup-redis` instead
62
22
 
63
- For multi-instance or serverless deployments, use the `setup-redis` skill instead.
23
+ > **Decision:** Use SQLite for single-instance local storage; switch to `setup-redis` for multi-instance or serverless deployments.
64
24
 
65
25
  ## Step 1 -- Install the Native Dependency
66
26
 
@@ -175,7 +135,7 @@ The encryption uses HKDF-SHA256 for key derivation and AES-256-GCM for value enc
175
135
  walMode: true,
176
136
  },
177
137
  transport: {
178
- protocol: 'streamable-http',
138
+ protocol: 'modern', // 'modern' preset enables streamable HTTP + strict sessions
179
139
  },
180
140
  http: {
181
141
  unixSocket: '/tmp/frontmcp.sock',
@@ -206,7 +166,7 @@ WAL (Write-Ahead Logging) mode is enabled by default (`walMode: true`) and is st
206
166
 
207
167
  WAL mode creates two additional files alongside the database:
208
168
 
209
- ```
169
+ ```text
210
170
  sessions.sqlite # main database
211
171
  sessions.sqlite-wal # write-ahead log
212
172
  sessions.sqlite-shm # shared memory index
@@ -275,7 +235,7 @@ frontmcp dev
275
235
 
276
236
  Check the logs for SQLite initialization:
277
237
 
278
- ```
238
+ ```text
279
239
  [SessionStoreFactory] Creating SQLite session store
280
240
  ```
281
241
 
@@ -334,26 +294,54 @@ The change in `src/main.ts`:
334
294
  })
335
295
  ```
336
296
 
337
- ## Troubleshooting
297
+ ## Common Patterns
338
298
 
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 |
299
+ | Pattern | Correct | Incorrect | Why |
300
+ | ------------------------------ | -------------------------------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
301
+ | Database path | `path: '~/.frontmcp/data/sessions.sqlite'` | `path: './sessions.sqlite'` | Tilde-prefixed or absolute paths are stable across working directories; relative paths break when CWD changes |
302
+ | Encryption secret source | `secret: process.env['SQLITE_ENCRYPTION_SECRET']!` | `secret: 'hardcoded-secret-value'` | Secrets must come from environment variables, never committed to source code |
303
+ | WAL mode default | `walMode: true` (or omit, defaults to `true`) | `walMode: false` without a specific reason | WAL provides better read concurrency with no downside on local filesystems |
304
+ | Native dependency installation | `yarn add @frontmcp/storage-sqlite better-sqlite3` | `yarn add better-sqlite3` alone | Both packages are required; the storage package wraps the native bindings with FrontMCP session store logic |
305
+ | TTL cleanup interval | `ttlCleanupIntervalMs: 60000` (default) | `ttlCleanupIntervalMs: 500` | Overly aggressive cleanup wastes CPU; the default 60s is appropriate for most workloads |
347
306
 
348
307
  ## Verification Checklist
349
308
 
350
- Before reporting completion, verify:
309
+ ### Dependencies
310
+
311
+ - [ ] `@frontmcp/storage-sqlite` and `better-sqlite3` are in `dependencies`
312
+ - [ ] `@types/better-sqlite3` is in `devDependencies`
313
+ - [ ] `node -e "require('better-sqlite3')"` runs without errors
314
+
315
+ ### Configuration
316
+
317
+ - [ ] The `sqlite` block is present in the `@FrontMcp` decorator config with a valid `path` string
318
+ - [ ] The database path parent directory exists and is writable
319
+ - [ ] WAL mode is enabled (default) unless there is a specific filesystem limitation
320
+
321
+ ### Environment and Security
322
+
323
+ - [ ] Environment variables are in `.env` and `.env` is gitignored
324
+ - [ ] If encryption is enabled: `SQLITE_ENCRYPTION_SECRET` is set and is at least 32 characters
325
+ - [ ] No secrets are hardcoded in source files
326
+
327
+ ### Runtime
328
+
329
+ - [ ] The server starts without SQLite errors (`frontmcp dev`)
330
+ - [ ] The database file is created at the configured path
331
+ - [ ] If WAL mode is enabled: `.sqlite-wal` and `.sqlite-shm` files appear alongside the database
332
+
333
+ ## Troubleshooting
334
+
335
+ | Problem | Cause | Solution |
336
+ | --------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
337
+ | `Cannot find module 'better-sqlite3'` | Native module not installed | Run `yarn add @frontmcp/storage-sqlite better-sqlite3` |
338
+ | `Could not locate the bindings file` | Native compilation failed | Ensure build tools are installed (Xcode CLI on macOS, `build-essential` on Linux), delete `node_modules` and reinstall |
339
+ | `SQLITE_BUSY` errors | Multiple processes accessing the same database file | Enable WAL mode (`walMode: true`) or ensure only one process writes to the database |
340
+ | `SQLITE_READONLY` | Insufficient file permissions | Check write permissions on the database file and its parent directory |
341
+ | WAL errors on network mount | WAL mode requires a local filesystem with shared-memory support | Move the database to a local disk or set `walMode: false` |
342
+ | Encrypted data unreadable after restart | Encryption secret changed or missing | The secret must be identical across restarts; if the original secret is lost, delete the database and let it be recreated |
343
+
344
+ ## Reference
351
345
 
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
346
+ - **Docs:** [SQLite Setup Guide](https://docs.agentfront.dev/frontmcp/deployment/sqlite-setup)
347
+ - **Related skills:** `setup-redis`, `setup-project`, `nx-workflow`
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: frontmcp-testing
3
+ description: 'Use when you want to write tests, run tests, add e2e tests, improve test coverage, test a tool, test a resource, or learn how to test any FrontMCP component. The skill for ALL testing needs.'
4
+ tags: [router, testing, jest, e2e, coverage, quality, guide]
5
+ category: testing
6
+ targets: [all]
7
+ bundle: [recommended, full]
8
+ priority: 10
9
+ visibility: both
10
+ license: Apache-2.0
11
+ metadata:
12
+ docs: https://docs.agentfront.dev/frontmcp/testing/overview
13
+ ---
14
+
15
+ # FrontMCP Testing Router
16
+
17
+ Entry point for testing FrontMCP applications. This skill helps you navigate testing strategies across component types and find the right patterns for unit, integration, and E2E tests.
18
+
19
+ ## When to Use This Skill
20
+
21
+ ### Must Use
22
+
23
+ - Setting up testing infrastructure for a new FrontMCP project
24
+ - Deciding how to test a specific component type (tool, resource, prompt, agent)
25
+ - Planning a testing strategy that covers unit, E2E, and coverage requirements
26
+
27
+ ### Recommended
28
+
29
+ - Looking up testing patterns for a component type you haven't tested before
30
+ - Understanding the relationship between unit tests, E2E tests, and coverage thresholds
31
+ - Troubleshooting test failures or coverage gaps
32
+
33
+ ### Skip When
34
+
35
+ - You need detailed Jest configuration and test harness setup (go directly to `setup-testing`)
36
+ - You need to build components, not test them (see `frontmcp-development`)
37
+ - You need to deploy, not test (see `frontmcp-deployment`)
38
+
39
+ > **Decision:** Use this skill for testing strategy and routing. Use `setup-testing` for hands-on Jest configuration and test writing.
40
+
41
+ ## Scenario Routing Table
42
+
43
+ | Scenario | Skill / Section | Description |
44
+ | --------------------------------------- | ---------------------------------- | --------------------------------------------------------- |
45
+ | Set up Jest, coverage, and test harness | `setup-testing` | Full Jest config, test utilities, and coverage thresholds |
46
+ | Write unit tests for a tool | `setup-testing` (Unit Testing) | Mock DI, validate input/output, test error paths |
47
+ | Write unit tests for a resource | `setup-testing` (Unit Testing) | Test URI resolution, template params, read results |
48
+ | Write unit tests for a prompt | `setup-testing` (Unit Testing) | Test argument handling, message generation |
49
+ | Write E2E protocol-level tests | `setup-testing` (E2E Testing) | Real MCP client/server, full protocol flow |
50
+ | Test authenticated endpoints | `setup-testing` + `configure-auth` | E2E with OAuth tokens, session validation |
51
+ | Test deployment builds | `setup-testing` + `deploy-to-*` | Smoke tests against built output |
52
+
53
+ ## Testing Strategy by Component Type
54
+
55
+ | Component | Unit Test Focus | E2E Test Focus | Key Assertions |
56
+ | --------- | -------------------------------------------------------- | ---------------------------------- | ---------------------------------------------- |
57
+ | Tool | Input validation, execute logic, error paths, DI mocking | `tools/call` via MCP client | Output matches schema, errors return MCP codes |
58
+ | Resource | URI resolution, read content, template param handling | `resources/read` via MCP client | Content type correct, URI patterns resolve |
59
+ | Prompt | Argument validation, message generation, multi-turn | `prompts/get` via MCP client | Messages match expected structure |
60
+ | Agent | LLM config, tool selection, handoff logic | Agent loop via MCP client | Tools called in order, result synthesized |
61
+ | Provider | Lifecycle hooks, factory output, singleton behavior | Indirectly via tool/resource tests | Instance reuse, cleanup on scope disposal |
62
+ | Job | Progress tracking, retry logic, attempt counting | Job execution via test harness | Progress events emitted, retries respected |
63
+
64
+ ## Cross-Cutting Testing Patterns
65
+
66
+ | Pattern | Rule |
67
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
68
+ | File naming | Always `.spec.ts` (not `.test.ts`); E2E uses `.e2e.spec.ts` |
69
+ | File organization | Split E2E tests by app/feature: `e2e/calc.e2e.spec.ts`, `e2e/ecommerce.e2e.spec.ts`. Never put all tests in a single `server.e2e.spec.ts` |
70
+ | Test runner | Use `frontmcp test` (not `jest --config ...`). It auto-generates the correct Jest/SWC config |
71
+ | Coverage threshold | 95%+ across statements, branches, functions, lines |
72
+ | Test descriptions | Plain English, no prefixes like "PT-001"; describe behavior not implementation |
73
+ | Mocking | Mock providers via DI token replacement, never mock the framework |
74
+ | httpMock scope | `httpMock` intercepts HTTP in the **test process** only, NOT in the MCP server subprocess. Do not use httpMock to intercept server-to-API calls — those happen in the child process. Use httpMock for verifying client-to-server request shapes or mocking external APIs called from the test itself |
75
+ | Error testing | Assert `instanceof` specific error class AND MCP error code |
76
+ | Async | Always `await` async operations; use `expect(...).rejects.toThrow()` for async errors |
77
+
78
+ ## Common Patterns
79
+
80
+ | Pattern | Correct | Incorrect | Why |
81
+ | ------------------ | ------------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------- |
82
+ | Test file location | `fetch-weather.tool.spec.ts` next to source | `__tests__/fetch-weather.test.ts` | Co-location with `.spec.ts` extension matches FrontMCP conventions |
83
+ | DI mocking | Replace token with mock via `scope.register(TOKEN, mockImpl)` | `jest.mock('../provider')` module mock | DI mocking is cleaner, type-safe, and tests the real integration path |
84
+ | Error assertions | `expect(err).toBeInstanceOf(ResourceNotFoundError)` | `expect(err.message).toContain('not found')` | Class checks are stable; message strings are fragile |
85
+ | E2E transport | Use `@frontmcp/testing` MCP client with real server | HTTP requests with `fetch` | The test client handles protocol details (session, framing) |
86
+ | Coverage gaps | Investigate uncovered branches, add targeted tests | Add `istanbul ignore` comments | Coverage gaps often hide real bugs; ignoring them defeats the purpose |
87
+
88
+ ## Verification Checklist
89
+
90
+ ### Infrastructure
91
+
92
+ - [ ] Jest configured with `@frontmcp/testing` preset
93
+ - [ ] Coverage thresholds set to 95% in jest.config
94
+ - [ ] Test files use `.spec.ts` extension throughout
95
+
96
+ ### Unit Tests
97
+
98
+ - [ ] Each tool has unit tests covering happy path, validation errors, and DI failures
99
+ - [ ] Each resource has unit tests covering URI resolution and read content
100
+ - [ ] Provider lifecycle (init, dispose) tested where applicable
101
+
102
+ ### E2E Tests
103
+
104
+ - [ ] At least one E2E test exercises full MCP protocol flow (connect, list, call, disconnect)
105
+ - [ ] Authenticated E2E tests use proper test tokens (not mocked auth)
106
+ - [ ] E2E tests clean up state after execution
107
+
108
+ ### CI Integration
109
+
110
+ - [ ] Tests run in CI pipeline on every PR
111
+ - [ ] Coverage report published and enforced
112
+ - [ ] Failing tests block merge
113
+
114
+ ## Troubleshooting
115
+
116
+ | Problem | Cause | Solution |
117
+ | ---------------------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------- |
118
+ | Jest not finding test files | Wrong file extension (`.test.ts` instead of `.spec.ts`) | Rename to `.spec.ts`; check `testMatch` in jest.config |
119
+ | Coverage below 95% | Untested error paths or conditional branches | Run `frontmcp test --coverage` and inspect uncovered lines in the report |
120
+ | E2E test timeout | Server startup too slow or port conflict | Increase Jest timeout; use random port allocation |
121
+ | DI resolution fails in tests | Provider not registered in test scope | Register mock providers before creating the test context |
122
+ | Istanbul shows 0% on async methods | TypeScript source-map mismatch with Istanbul | Known issue with some TS compilation settings; verify coverage with actual test output |
123
+
124
+ ## Reference
125
+
126
+ - [Testing Documentation](https://docs.agentfront.dev/frontmcp/testing/overview)
127
+ - Related skills: `setup-testing`, `create-tool`, `create-resource`, `create-prompt`, `configure-auth`