@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.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +135 -0
  3. package/catalog/TEMPLATE.md +49 -0
  4. package/catalog/adapters/create-adapter/SKILL.md +127 -0
  5. package/catalog/adapters/official-adapters/SKILL.md +136 -0
  6. package/catalog/auth/configure-auth/SKILL.md +250 -0
  7. package/catalog/auth/configure-auth/references/auth-modes.md +77 -0
  8. package/catalog/auth/configure-session/SKILL.md +201 -0
  9. package/catalog/config/configure-elicitation/SKILL.md +136 -0
  10. package/catalog/config/configure-http/SKILL.md +167 -0
  11. package/catalog/config/configure-throttle/SKILL.md +189 -0
  12. package/catalog/config/configure-throttle/references/guard-config.md +68 -0
  13. package/catalog/config/configure-transport/SKILL.md +151 -0
  14. package/catalog/config/configure-transport/references/protocol-presets.md +57 -0
  15. package/catalog/deployment/build-for-browser/SKILL.md +95 -0
  16. package/catalog/deployment/build-for-cli/SKILL.md +100 -0
  17. package/catalog/deployment/build-for-sdk/SKILL.md +218 -0
  18. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +192 -0
  19. package/catalog/deployment/deploy-to-lambda/SKILL.md +304 -0
  20. package/catalog/deployment/deploy-to-node/SKILL.md +229 -0
  21. package/catalog/deployment/deploy-to-node/references/Dockerfile.example +45 -0
  22. package/catalog/deployment/deploy-to-vercel/SKILL.md +196 -0
  23. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +60 -0
  24. package/catalog/development/create-agent/SKILL.md +563 -0
  25. package/catalog/development/create-agent/references/llm-config.md +46 -0
  26. package/catalog/development/create-job/SKILL.md +566 -0
  27. package/catalog/development/create-prompt/SKILL.md +400 -0
  28. package/catalog/development/create-provider/SKILL.md +233 -0
  29. package/catalog/development/create-resource/SKILL.md +437 -0
  30. package/catalog/development/create-skill/SKILL.md +526 -0
  31. package/catalog/development/create-skill-with-tools/SKILL.md +579 -0
  32. package/catalog/development/create-tool/SKILL.md +418 -0
  33. package/catalog/development/create-tool/references/output-schema-types.md +56 -0
  34. package/catalog/development/create-tool/references/tool-annotations.md +34 -0
  35. package/catalog/development/create-workflow/SKILL.md +709 -0
  36. package/catalog/development/decorators-guide/SKILL.md +598 -0
  37. package/catalog/plugins/create-plugin/SKILL.md +336 -0
  38. package/catalog/plugins/create-plugin-hooks/SKILL.md +282 -0
  39. package/catalog/plugins/official-plugins/SKILL.md +667 -0
  40. package/catalog/setup/frontmcp-skills-usage/SKILL.md +200 -0
  41. package/catalog/setup/multi-app-composition/SKILL.md +358 -0
  42. package/catalog/setup/nx-workflow/SKILL.md +357 -0
  43. package/catalog/setup/project-structure-nx/SKILL.md +186 -0
  44. package/catalog/setup/project-structure-standalone/SKILL.md +153 -0
  45. package/catalog/setup/setup-project/SKILL.md +493 -0
  46. package/catalog/setup/setup-redis/SKILL.md +385 -0
  47. package/catalog/setup/setup-sqlite/SKILL.md +359 -0
  48. package/catalog/skills-manifest.json +414 -0
  49. package/catalog/testing/setup-testing/SKILL.md +539 -0
  50. package/catalog/testing/setup-testing/references/test-auth.md +88 -0
  51. package/catalog/testing/setup-testing/references/test-browser-build.md +57 -0
  52. package/catalog/testing/setup-testing/references/test-cli-binary.md +48 -0
  53. package/catalog/testing/setup-testing/references/test-direct-client.md +62 -0
  54. package/catalog/testing/setup-testing/references/test-e2e-handler.md +51 -0
  55. package/catalog/testing/setup-testing/references/test-tool-unit.md +41 -0
  56. package/package.json +34 -0
  57. package/src/index.d.ts +3 -0
  58. package/src/index.js +16 -0
  59. package/src/index.js.map +1 -0
  60. package/src/loader.d.ts +46 -0
  61. package/src/loader.js +75 -0
  62. package/src/loader.js.map +1 -0
  63. package/src/manifest.d.ts +81 -0
  64. package/src/manifest.js +26 -0
  65. package/src/manifest.js.map +1 -0
@@ -0,0 +1,385 @@
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
+ # Configure Redis for Session Storage and Distributed State
61
+
62
+ ## When to use this skill
63
+
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:
65
+
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
72
+
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.
74
+
75
+ ## Step 1 -- Provision Redis
76
+
77
+ ### Option A: Docker (local development)
78
+
79
+ Create `docker-compose.yml` in the project root:
80
+
81
+ ```yaml
82
+ services:
83
+ redis:
84
+ image: redis:7-alpine
85
+ ports:
86
+ - '6379:6379'
87
+ volumes:
88
+ - redis_data:/data
89
+ command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
90
+ healthcheck:
91
+ test: ['CMD', 'redis-cli', 'ping']
92
+ interval: 10s
93
+ timeout: 3s
94
+ retries: 3
95
+
96
+ volumes:
97
+ redis_data:
98
+ ```
99
+
100
+ Start the container:
101
+
102
+ ```bash
103
+ docker compose up -d redis
104
+ ```
105
+
106
+ Verify the connection:
107
+
108
+ ```bash
109
+ docker compose exec redis redis-cli ping
110
+ # Expected output: PONG
111
+ ```
112
+
113
+ ### Option B: Vercel KV (Vercel deployments)
114
+
115
+ Vercel KV is a managed Redis-compatible store. No Docker or external Redis is needed.
116
+
117
+ 1. Enable KV in the Vercel dashboard: Project Settings > Storage > Create KV Database.
118
+ 2. Vercel automatically injects `KV_REST_API_URL` and `KV_REST_API_TOKEN` environment variables.
119
+ 3. No manual connection string is needed -- the SDK detects Vercel KV environment variables automatically when `provider: 'vercel-kv'` is set.
120
+
121
+ ### Option C: Existing Redis Instance
122
+
123
+ If you already have a Redis server (managed cloud, self-hosted, or shared dev instance), collect:
124
+
125
+ - **Host**: the hostname or IP (e.g., `redis.internal`, `10.0.0.5`)
126
+ - **Port**: default `6379`
127
+ - **Password**: if auth is enabled
128
+ - **TLS**: whether the connection requires TLS (most cloud providers require it)
129
+ - **DB index**: default `0`
130
+
131
+ ## Step 2 -- Configure the FrontMCP Server
132
+
133
+ The `redis` field in the `@FrontMcp` decorator accepts a `RedisOptionsInput` union type. There are three valid shapes:
134
+
135
+ ### For Redis (Docker or existing instance)
136
+
137
+ Update the `@FrontMcp` decorator in `src/main.ts`:
138
+
139
+ ```typescript
140
+ import 'reflect-metadata';
141
+ import { FrontMcp } from '@frontmcp/sdk';
142
+
143
+ @FrontMcp({
144
+ info: { name: 'my-server', version: '0.1.0' },
145
+ apps: [
146
+ /* ... */
147
+ ],
148
+ redis: {
149
+ provider: 'redis', // 'redis' literal (required)
150
+ host: process.env['REDIS_HOST'] ?? 'localhost', // string (required)
151
+ port: parseInt(process.env['REDIS_PORT'] ?? '6379', 10), // number (default: 6379)
152
+ password: process.env['REDIS_PASSWORD'], // string (optional)
153
+ db: 0, // number (default: 0)
154
+ tls: false, // boolean (default: false)
155
+ keyPrefix: 'mcp:', // string (default: 'mcp:')
156
+ defaultTtlMs: 3600000, // number (default: 3600000 = 1 hour)
157
+ },
158
+ })
159
+ export default class Server {}
160
+ ```
161
+
162
+ For TLS connections (cloud-hosted Redis):
163
+
164
+ ```typescript
165
+ redis: {
166
+ provider: 'redis',
167
+ host: process.env['REDIS_HOST'] ?? 'redis.example.com',
168
+ port: parseInt(process.env['REDIS_PORT'] ?? '6380', 10),
169
+ password: process.env['REDIS_PASSWORD'],
170
+ tls: true,
171
+ keyPrefix: 'mcp:',
172
+ },
173
+ ```
174
+
175
+ Legacy format (without `provider` field) is also supported and auto-transforms to `provider: 'redis'`:
176
+
177
+ ```typescript
178
+ redis: {
179
+ host: 'localhost',
180
+ port: 6379,
181
+ },
182
+ ```
183
+
184
+ ### For Vercel KV
185
+
186
+ ```typescript
187
+ import 'reflect-metadata';
188
+ import { FrontMcp } from '@frontmcp/sdk';
189
+
190
+ @FrontMcp({
191
+ info: { name: 'my-server', version: '0.1.0' },
192
+ apps: [
193
+ /* ... */
194
+ ],
195
+ redis: {
196
+ provider: 'vercel-kv', // 'vercel-kv' literal (required)
197
+ // url and token are auto-detected from KV_REST_API_URL / KV_REST_API_TOKEN env vars
198
+ keyPrefix: 'mcp:', // string (default: 'mcp:')
199
+ defaultTtlMs: 3600000, // number (default: 3600000)
200
+ },
201
+ })
202
+ export default class Server {}
203
+ ```
204
+
205
+ If you need to pass explicit credentials (e.g., in testing or non-Vercel environments):
206
+
207
+ ```typescript
208
+ redis: {
209
+ provider: 'vercel-kv',
210
+ url: process.env['KV_REST_API_URL'], // string (optional, default from env)
211
+ token: process.env['KV_REST_API_TOKEN'], // string (optional, default from env)
212
+ keyPrefix: 'mcp:',
213
+ },
214
+ ```
215
+
216
+ ## Step 3 -- Session Store Factory (Advanced)
217
+
218
+ The SDK creates the session store automatically from the `redis` config. For advanced scenarios where you need direct access to the session store factory:
219
+
220
+ ```typescript
221
+ import { createSessionStore } from '@frontmcp/sdk';
222
+
223
+ // Redis provider
224
+ const sessionStore = await createSessionStore({
225
+ provider: 'redis',
226
+ host: 'localhost',
227
+ port: 6379,
228
+ keyPrefix: 'mcp:',
229
+ });
230
+
231
+ // Vercel KV provider (requires await for pre-connection)
232
+ const sessionStore = await createSessionStore({
233
+ provider: 'vercel-kv',
234
+ keyPrefix: 'mcp:',
235
+ });
236
+ ```
237
+
238
+ The `createSessionStore()` function signature:
239
+
240
+ ```typescript
241
+ async function createSessionStore(
242
+ options: RedisOptions, // RedisProviderOptions | VercelKvProviderOptions | legacy format
243
+ logger?: FrontMcpLogger,
244
+ ): Promise<SessionStore>;
245
+ ```
246
+
247
+ The factory function handles:
248
+
249
+ - Lazy-loading `ioredis` or `@vercel/kv` to avoid bundling unused dependencies
250
+ - Automatic key prefix namespacing (appends `session:` to the base prefix)
251
+ - Pre-connection for Vercel KV (the `await` is required)
252
+
253
+ There is also a synchronous variant for Redis-only (does not support Vercel KV):
254
+
255
+ ```typescript
256
+ import { createSessionStoreSync } from '@frontmcp/sdk';
257
+
258
+ const sessionStore = createSessionStoreSync({
259
+ provider: 'redis',
260
+ host: 'localhost',
261
+ port: 6379,
262
+ });
263
+ ```
264
+
265
+ ## Step 4 -- Pub/Sub for Resource Subscriptions
266
+
267
+ If your server exposes resources with `subscribe: true`, you need pub/sub. Pub/sub requires a real Redis instance -- Vercel KV does not support pub/sub operations.
268
+
269
+ For a hybrid setup (Vercel KV for sessions, Redis for pub/sub):
270
+
271
+ ```typescript
272
+ @FrontMcp({
273
+ info: { name: 'my-server', version: '0.1.0' },
274
+ apps: [
275
+ /* ... */
276
+ ],
277
+ redis: {
278
+ provider: 'vercel-kv',
279
+ keyPrefix: 'mcp:',
280
+ },
281
+ pubsub: {
282
+ provider: 'redis',
283
+ host: process.env['REDIS_PUBSUB_HOST'] ?? 'localhost',
284
+ port: parseInt(process.env['REDIS_PUBSUB_PORT'] ?? '6379', 10),
285
+ password: process.env['REDIS_PUBSUB_PASSWORD'],
286
+ },
287
+ })
288
+ export default class Server {}
289
+ ```
290
+
291
+ The `pubsub` field accepts the same shape as `redis` but only supports `provider: 'redis'` or the legacy format (no Vercel KV support for pub/sub).
292
+
293
+ If only a Redis provider is configured (no Vercel KV), the SDK falls back to using the `redis` config for both sessions and pub/sub automatically. A separate `pubsub` config is only needed when using Vercel KV for sessions.
294
+
295
+ ## Step 5 -- Transport Persistence Auto-Configuration
296
+
297
+ When `redis` is configured, the SDK automatically enables transport session persistence. The auto-configuration logic works as follows:
298
+
299
+ 1. If `redis` is set and `transport.persistence` is not configured, persistence is auto-enabled with the global redis config.
300
+ 2. If `transport.persistence` is explicitly `false`, persistence is disabled.
301
+ 3. If `transport.persistence.redis` is explicitly set, that config is used instead.
302
+ 4. If `transport.persistence` is an object without `redis`, the global redis config is injected.
303
+
304
+ This means you do not need to configure `transport.persistence` separately when using the top-level `redis` field.
305
+
306
+ ## Step 6 -- Environment Variables
307
+
308
+ Add to your `.env` file:
309
+
310
+ ```env
311
+ # Redis connection
312
+ REDIS_HOST=localhost
313
+ REDIS_PORT=6379
314
+ REDIS_PASSWORD=
315
+
316
+ # Vercel KV (auto-injected on Vercel, manual for local testing)
317
+ # KV_REST_API_URL=https://your-kv.kv.vercel-storage.com
318
+ # KV_REST_API_TOKEN=your-token
319
+
320
+ # Pub/Sub (only if different from main Redis)
321
+ # REDIS_PUBSUB_HOST=localhost
322
+ # REDIS_PUBSUB_PORT=6379
323
+ ```
324
+
325
+ Confirm `.env` is in `.gitignore`. Never commit credentials.
326
+
327
+ ## Step 7 -- Test the Connection
328
+
329
+ ### Verify from the application
330
+
331
+ Start the server and check the logs for successful Redis connection:
332
+
333
+ ```bash
334
+ frontmcp dev
335
+ ```
336
+
337
+ Look for log lines like:
338
+
339
+ ```
340
+ [SessionStoreFactory] Creating Redis session store
341
+ [RedisStorageAdapter] Connected to Redis at localhost:6379
342
+ ```
343
+
344
+ ### Verify from the command line
345
+
346
+ ```bash
347
+ # Docker
348
+ docker compose exec redis redis-cli -h localhost -p 6379 ping
349
+
350
+ # Existing instance
351
+ redis-cli -h <host> -p <port> -a <password> ping
352
+ ```
353
+
354
+ ### Verify keys are being written
355
+
356
+ After making at least one MCP request through HTTP transport:
357
+
358
+ ```bash
359
+ redis-cli -h localhost -p 6379 keys "mcp:*"
360
+ ```
361
+
362
+ You should see session keys like `mcp:session:<session-id>`.
363
+
364
+ ## Troubleshooting
365
+
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 |
374
+
375
+ ## Verification Checklist
376
+
377
+ Before reporting completion, verify:
378
+
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