@frontmcp/skills 0.0.1 → 1.0.0-beta.11
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 +2 -2
- package/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +156 -0
- package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +5 -0
- package/catalog/frontmcp-config/references/configure-auth.md +243 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +183 -0
- package/catalog/frontmcp-config/references/configure-http.md +210 -0
- package/catalog/frontmcp-config/references/configure-session.md +210 -0
- package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +5 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +234 -0
- package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +5 -0
- package/catalog/frontmcp-config/references/configure-transport.md +200 -0
- package/catalog/frontmcp-config/references/setup-redis.md +9 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +9 -0
- package/catalog/frontmcp-deployment/SKILL.md +152 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +143 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +191 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +66 -20
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +218 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +77 -59
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +18 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +69 -36
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +65 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +229 -0
- package/catalog/frontmcp-development/SKILL.md +126 -0
- package/catalog/frontmcp-development/references/create-adapter.md +170 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +10 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +83 -40
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +62 -15
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +100 -7
- package/catalog/frontmcp-development/references/create-plugin.md +506 -0
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +65 -22
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +63 -23
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +148 -26
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +174 -20
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +114 -28
- package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +5 -0
- package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +5 -0
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +172 -23
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +61 -14
- package/catalog/frontmcp-development/references/decorators-guide.md +754 -0
- package/catalog/frontmcp-development/references/official-adapters.md +199 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +97 -27
- package/catalog/frontmcp-extensibility/SKILL.md +103 -0
- package/catalog/frontmcp-extensibility/references/vectoriadb.md +289 -0
- package/catalog/frontmcp-guides/SKILL.md +420 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +641 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +517 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +297 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +98 -0
- package/catalog/frontmcp-production-readiness/references/common-checklist.md +156 -0
- package/catalog/frontmcp-production-readiness/references/production-browser.md +46 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-binary.md +62 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-daemon.md +61 -0
- package/catalog/frontmcp-production-readiness/references/production-cloudflare.md +52 -0
- package/catalog/frontmcp-production-readiness/references/production-lambda.md +53 -0
- package/catalog/frontmcp-production-readiness/references/production-node-sdk.md +66 -0
- package/catalog/frontmcp-production-readiness/references/production-node-server.md +61 -0
- package/catalog/frontmcp-production-readiness/references/production-vercel.md +52 -0
- package/catalog/frontmcp-setup/SKILL.md +132 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +280 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +66 -19
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +79 -17
- package/catalog/frontmcp-setup/references/project-structure-nx.md +251 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +217 -0
- package/catalog/frontmcp-setup/references/readme-guide.md +226 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +63 -58
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +60 -82
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +65 -72
- package/catalog/frontmcp-testing/SKILL.md +135 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +79 -63
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +5 -0
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +6 -0
- package/catalog/skills-manifest.json +337 -382
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js.map +1 -1
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +15 -3
- package/src/manifest.js +3 -3
- package/src/manifest.js.map +1 -1
- package/catalog/adapters/create-adapter/SKILL.md +0 -127
- package/catalog/adapters/official-adapters/SKILL.md +0 -136
- package/catalog/auth/configure-auth/SKILL.md +0 -250
- package/catalog/auth/configure-session/SKILL.md +0 -201
- package/catalog/config/configure-elicitation/SKILL.md +0 -136
- package/catalog/config/configure-http/SKILL.md +0 -167
- package/catalog/config/configure-throttle/SKILL.md +0 -189
- package/catalog/config/configure-transport/SKILL.md +0 -151
- package/catalog/deployment/build-for-browser/SKILL.md +0 -95
- package/catalog/deployment/build-for-cli/SKILL.md +0 -100
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
- package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
- package/catalog/development/decorators-guide/SKILL.md +0 -598
- package/catalog/plugins/create-plugin/SKILL.md +0 -336
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
- package/catalog/setup/project-structure-nx/SKILL.md +0 -186
- package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
|
@@ -1,55 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: setup-project
|
|
3
|
-
description: Scaffold
|
|
4
|
-
category: setup
|
|
5
|
-
tags: [setup, project, scaffold, getting-started]
|
|
6
|
-
targets: [all]
|
|
7
|
-
bundle: [recommended, minimal, full]
|
|
8
|
-
hasResources: false
|
|
9
|
-
allowed-tools: Bash Write Edit Read Grep Glob
|
|
10
|
-
parameters:
|
|
11
|
-
- name: target
|
|
12
|
-
type: string
|
|
13
|
-
description: Deployment target for the project
|
|
14
|
-
enum: [node, vercel, lambda, cloudflare]
|
|
15
|
-
default: node
|
|
16
|
-
- name: packageManager
|
|
17
|
-
type: string
|
|
18
|
-
description: Package manager to use
|
|
19
|
-
enum: [npm, yarn, pnpm]
|
|
20
|
-
default: yarn
|
|
21
|
-
- name: projectName
|
|
22
|
-
type: string
|
|
23
|
-
description: Name for the new project directory and package.json
|
|
24
|
-
required: true
|
|
25
|
-
examples:
|
|
26
|
-
- scenario: Create a new FrontMCP project called my-mcp-server targeting Node.js
|
|
27
|
-
parameters:
|
|
28
|
-
projectName: my-mcp-server
|
|
29
|
-
target: node
|
|
30
|
-
packageManager: yarn
|
|
31
|
-
- scenario: Scaffold a serverless MCP project for Vercel
|
|
32
|
-
parameters:
|
|
33
|
-
projectName: my-vercel-mcp
|
|
34
|
-
target: vercel
|
|
35
|
-
packageManager: npm
|
|
36
|
-
- scenario: Set up a minimal MCP server inside an existing Nx workspace
|
|
37
|
-
parameters:
|
|
38
|
-
projectName: api-mcp
|
|
39
|
-
target: node
|
|
40
|
-
packageManager: yarn
|
|
41
|
-
install:
|
|
42
|
-
destinations: [project-local]
|
|
43
|
-
mergeStrategy: skip-existing
|
|
44
|
-
metadata:
|
|
45
|
-
docs: https://docs.agentfront.dev/frontmcp/getting-started/quickstart
|
|
3
|
+
description: Scaffold a new FrontMCP project with CLI or manual setup, decorators, apps, and deployment config
|
|
46
4
|
---
|
|
47
5
|
|
|
48
6
|
# Scaffold and Configure a New FrontMCP Project
|
|
49
7
|
|
|
50
|
-
## When to
|
|
8
|
+
## When to Use This Skill
|
|
51
9
|
|
|
52
|
-
|
|
10
|
+
### Must Use
|
|
11
|
+
|
|
12
|
+
- Creating a brand-new FrontMCP MCP server project from scratch
|
|
13
|
+
- Setting up the `@FrontMcp` root decorator and `@App` structure for the first time
|
|
14
|
+
- Choosing and configuring a deployment target (Node, Vercel, Lambda, Cloudflare)
|
|
15
|
+
|
|
16
|
+
### Recommended
|
|
17
|
+
|
|
18
|
+
- Adding FrontMCP to an existing TypeScript codebase that has no MCP server yet
|
|
19
|
+
- Scaffolding a new app inside an Nx monorepo with `@frontmcp/nx` generators
|
|
20
|
+
- Setting up the dev-loop (`frontmcp dev`, build, env vars) for a fresh project
|
|
21
|
+
|
|
22
|
+
### Skip When
|
|
23
|
+
|
|
24
|
+
- The project already has a working `@FrontMcp`-decorated server -- use `create-tool`, `create-resource`, or `create-prompt` to add entries
|
|
25
|
+
- You only need to add Redis or SQLite storage to an existing server -- use `setup-redis` or `setup-sqlite`
|
|
26
|
+
- You need to configure deployment for an already-scaffolded project -- use `deploy-to-vercel`, `deploy-to-lambda`, or `deploy-to-cloudflare`
|
|
27
|
+
|
|
28
|
+
> **Decision:** Use this skill when no FrontMCP server exists yet and you need to scaffold the project structure, dependencies, and entry point from scratch.
|
|
53
29
|
|
|
54
30
|
## Step 1 -- Use the CLI Scaffolder (Preferred)
|
|
55
31
|
|
|
@@ -180,7 +156,7 @@ import { FrontMcp } from '@frontmcp/sdk';
|
|
|
180
156
|
// http?: { port: number, host?: string, unixSocket?: string }
|
|
181
157
|
// redis?: { provider: 'redis', host: string, port?: number, ... } | { provider: 'vercel-kv', ... }
|
|
182
158
|
// sqlite?: { path: string, walMode?: boolean, encryption?: { secret: string } }
|
|
183
|
-
// transport?:
|
|
159
|
+
// transport?: 'modern' | 'legacy' | 'stateless-api' | 'full' | { protocol?: ProtocolPreset, ... }
|
|
184
160
|
// auth?: { mode: 'public' | 'transparent' | 'local' | 'remote', ... }
|
|
185
161
|
// logging?: { level?: string, transports?: [...] }
|
|
186
162
|
// plugins?: PluginType[]
|
|
@@ -220,19 +196,19 @@ export default class Server {}
|
|
|
220
196
|
@FrontMcp({
|
|
221
197
|
info: { name: '<projectName>', version: '0.1.0' },
|
|
222
198
|
apps: [],
|
|
223
|
-
transport: { protocol: '
|
|
199
|
+
transport: { protocol: 'modern' }, // 'modern' preset enables streamable HTTP + strict sessions
|
|
224
200
|
redis: { provider: 'vercel-kv' },
|
|
225
201
|
})
|
|
226
202
|
export default class Server {}
|
|
227
203
|
```
|
|
228
204
|
|
|
229
|
-
**Lambda / Cloudflare:** Use
|
|
205
|
+
**Lambda / Cloudflare:** Use the `modern` transport preset. Session storage must be external (Redis).
|
|
230
206
|
|
|
231
207
|
```typescript
|
|
232
208
|
@FrontMcp({
|
|
233
209
|
info: { name: '<projectName>', version: '0.1.0' },
|
|
234
210
|
apps: [],
|
|
235
|
-
transport: { protocol: '
|
|
211
|
+
transport: { protocol: 'modern' }, // 'modern' preset enables streamable HTTP + strict sessions
|
|
236
212
|
redis: {
|
|
237
213
|
provider: 'redis',
|
|
238
214
|
host: process.env['REDIS_HOST'] ?? 'localhost',
|
|
@@ -479,15 +455,44 @@ If manually configuring, add a `project.json`:
|
|
|
479
455
|
|
|
480
456
|
Run with: `nx serve <projectName>`.
|
|
481
457
|
|
|
458
|
+
## Common Patterns
|
|
459
|
+
|
|
460
|
+
| Pattern | Correct | Incorrect | Why |
|
|
461
|
+
| ------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
462
|
+
| Server class export | `export default class Server {}` with `@FrontMcp` decorator | Named export or no decorator | The SDK bootstrap expects a default-exported class decorated with `@FrontMcp` |
|
|
463
|
+
| Decorator prerequisites | `experimentalDecorators: true` and `emitDecoratorMetadata: true` in tsconfig | Omitting either flag | FrontMCP decorators (`@FrontMcp`, `@App`, `@Tool`) rely on both TypeScript compiler options |
|
|
464
|
+
| Reflect metadata import | `import 'reflect-metadata'` at the top of `src/main.ts` | Importing it in individual tool/resource files | The polyfill must load once before any decorator runs; the entry point is the correct place |
|
|
465
|
+
| Deployment target storage | External Redis/Vercel KV for serverless targets (Vercel, Lambda, Cloudflare) | In-memory or SQLite storage on serverless | Serverless functions are stateless; persistent storage requires an external provider |
|
|
466
|
+
| Environment secrets | `.env` file excluded via `.gitignore`, values read with `process.env` | Hardcoded secrets in source or committed `.env` | Secrets must never be committed to version control |
|
|
467
|
+
|
|
482
468
|
## Verification Checklist
|
|
483
469
|
|
|
484
|
-
|
|
470
|
+
### Configuration
|
|
471
|
+
|
|
472
|
+
- [ ] `tsconfig.json` has `experimentalDecorators: true` and `emitDecoratorMetadata: true`
|
|
473
|
+
- [ ] `@frontmcp/sdk`, `zod`, and `reflect-metadata` are listed in `package.json` dependencies
|
|
474
|
+
- [ ] `package.json` scripts include `dev`, `build`, and `start` commands
|
|
475
|
+
- [ ] Deployment target in `@FrontMcp` metadata matches the intended runtime
|
|
476
|
+
|
|
477
|
+
### Runtime
|
|
478
|
+
|
|
479
|
+
- [ ] `src/main.ts` exists with a `@FrontMcp`-decorated default export
|
|
480
|
+
- [ ] `import 'reflect-metadata'` is the first import in `src/main.ts`
|
|
481
|
+
- [ ] At least one `@App` class is registered in the `apps` array
|
|
482
|
+
- [ ] `frontmcp dev` starts without errors and responds to MCP `initialize` requests
|
|
483
|
+
- [ ] `.env` file exists locally and is listed in `.gitignore`
|
|
484
|
+
|
|
485
|
+
## Troubleshooting
|
|
486
|
+
|
|
487
|
+
| Problem | Cause | Solution |
|
|
488
|
+
| ----------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
489
|
+
| `TypeError: Reflect.getMetadata is not a function` | `reflect-metadata` is not imported before decorators execute | Add `import 'reflect-metadata'` as the first line in `src/main.ts` |
|
|
490
|
+
| Decorators are silently ignored (no tools registered) | `experimentalDecorators` or `emitDecoratorMetadata` is `false` or missing in tsconfig | Set both to `true` in `compilerOptions` and restart the TypeScript compiler |
|
|
491
|
+
| `frontmcp dev` exits with "No apps registered" | The `apps` array in `@FrontMcp` metadata is empty or the `@App` class was not imported | Import your `@App` class and add it to the `apps` array |
|
|
492
|
+
| Build fails with "Cannot find module '@frontmcp/sdk'" | Dependencies were not installed after scaffolding | Run `yarn install` (or `npm install` / `pnpm install`) in the project root |
|
|
493
|
+
| Vercel deploy returns 500 on `/mcp` endpoint | Transport not set to `modern` or storage not configured for Vercel KV | Set `transport: { protocol: 'modern' }` and `redis: { provider: 'vercel-kv' }` in `@FrontMcp` metadata |
|
|
494
|
+
|
|
495
|
+
## Reference
|
|
485
496
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
3. `zod` is listed in dependencies (required for input schemas)
|
|
489
|
-
4. `reflect-metadata` is listed in dependencies and imported at the top of `src/main.ts`
|
|
490
|
-
5. `src/main.ts` exists with a `@FrontMcp` decorated class as the default export
|
|
491
|
-
6. At least one `@App` class is registered in the `apps` array
|
|
492
|
-
7. The dev command (`frontmcp dev` or `yarn dev`) starts without errors
|
|
493
|
-
8. `.env` file exists and is listed in `.gitignore`
|
|
497
|
+
- [Getting Started Quickstart](https://docs.agentfront.dev/frontmcp/getting-started/quickstart)
|
|
498
|
+
- Related skills: `setup-redis`, `setup-sqlite`, `nx-workflow`, `deploy-to-vercel`, `deploy-to-node`, `create-tool`
|
|
@@ -1,76 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: setup-redis
|
|
3
|
-
description:
|
|
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
|
|
3
|
+
description: Provision and configure Redis or Vercel KV for session storage and distributed state
|
|
58
4
|
---
|
|
59
5
|
|
|
60
6
|
# Configure Redis for Session Storage and Distributed State
|
|
61
7
|
|
|
62
|
-
## When to
|
|
8
|
+
## When to Use This Skill
|
|
63
9
|
|
|
64
|
-
|
|
10
|
+
### Must Use
|
|
65
11
|
|
|
66
|
-
- The server uses Streamable HTTP transport
|
|
67
|
-
- Multiple server instances run behind a load balancer
|
|
68
|
-
-
|
|
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
|
|
12
|
+
- The server uses Streamable HTTP transport and sessions must survive reconnects
|
|
13
|
+
- Multiple server instances run behind a load balancer and need shared state (sessions, rate limits)
|
|
14
|
+
- Deploying to serverless (Vercel, Lambda, Cloudflare) where no local filesystem or in-process storage exists
|
|
72
15
|
|
|
73
|
-
|
|
16
|
+
### Recommended
|
|
17
|
+
|
|
18
|
+
- Resource subscriptions with `subscribe: true` are enabled and need pub/sub
|
|
19
|
+
- Auth sessions or elicitation state must persist across server restarts
|
|
20
|
+
- Distributed rate limiting is configured in the throttle guard
|
|
21
|
+
|
|
22
|
+
### Skip When
|
|
23
|
+
|
|
24
|
+
- Running a single-instance stdio-only server for local development -- use `setup-sqlite` or in-memory stores
|
|
25
|
+
- Only need to configure session TTL and key prefix on an already-provisioned Redis -- use `configure-session`
|
|
26
|
+
- Deploying a read-only MCP server with no sessions, subscriptions, or stateful tools
|
|
27
|
+
|
|
28
|
+
> **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
29
|
|
|
75
30
|
## Step 1 -- Provision Redis
|
|
76
31
|
|
|
@@ -336,7 +291,7 @@ frontmcp dev
|
|
|
336
291
|
|
|
337
292
|
Look for log lines like:
|
|
338
293
|
|
|
339
|
-
```
|
|
294
|
+
```text
|
|
340
295
|
[SessionStoreFactory] Creating Redis session store
|
|
341
296
|
[RedisStorageAdapter] Connected to Redis at localhost:6379
|
|
342
297
|
```
|
|
@@ -361,25 +316,48 @@ redis-cli -h localhost -p 6379 keys "mcp:*"
|
|
|
361
316
|
|
|
362
317
|
You should see session keys like `mcp:session:<session-id>`.
|
|
363
318
|
|
|
364
|
-
##
|
|
319
|
+
## Common Patterns
|
|
365
320
|
|
|
366
|
-
|
|
|
367
|
-
|
|
|
368
|
-
| `
|
|
369
|
-
| `
|
|
370
|
-
|
|
|
371
|
-
|
|
|
372
|
-
|
|
|
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 |
|
|
321
|
+
| Pattern | Correct | Incorrect | Why |
|
|
322
|
+
| ---------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
323
|
+
| 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 |
|
|
324
|
+
| 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 |
|
|
325
|
+
| 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 |
|
|
326
|
+
| 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 |
|
|
327
|
+
| 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
328
|
|
|
375
329
|
## Verification Checklist
|
|
376
330
|
|
|
377
|
-
|
|
331
|
+
### Provisioning
|
|
332
|
+
|
|
333
|
+
- [ ] Redis is reachable (`redis-cli ping` returns `PONG`, or Vercel KV dashboard shows the store is active)
|
|
334
|
+
- [ ] Docker container is running and healthy (`docker compose ps` shows `healthy` status)
|
|
335
|
+
- [ ] For existing instances: host, port, password, and TLS settings are correct
|
|
336
|
+
|
|
337
|
+
### Configuration
|
|
338
|
+
|
|
339
|
+
- [ ] The `redis` block is present in the `@FrontMcp` decorator with a valid `provider` field (`'redis'` or `'vercel-kv'`)
|
|
340
|
+
- [ ] Environment variables (`REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD`) are set in `.env`
|
|
341
|
+
- [ ] `.env` file is listed in `.gitignore` -- credentials are never committed
|
|
342
|
+
- [ ] For Vercel KV: `provider: 'vercel-kv'` is set and KV environment variables are present
|
|
343
|
+
|
|
344
|
+
### Runtime
|
|
345
|
+
|
|
346
|
+
- [ ] The server starts without Redis connection errors in the logs
|
|
347
|
+
- [ ] `redis-cli keys "mcp:*"` shows keys after at least one MCP request through HTTP transport
|
|
348
|
+
- [ ] For pub/sub: a separate `pubsub` config pointing to real Redis is provided when using Vercel KV for sessions
|
|
349
|
+
|
|
350
|
+
## Troubleshooting
|
|
351
|
+
|
|
352
|
+
| Problem | Cause | Solution |
|
|
353
|
+
| ------------------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
354
|
+
| `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 |
|
|
355
|
+
| `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 |
|
|
356
|
+
| `ERR max number of clients reached` | Too many open connections from the application | Set `maxRetriesPerRequest` or use connection pooling; check for connection leaks |
|
|
357
|
+
| 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 |
|
|
358
|
+
| 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 |
|
|
359
|
+
|
|
360
|
+
## Reference
|
|
378
361
|
|
|
379
|
-
|
|
380
|
-
|
|
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
|
|
362
|
+
- [Redis Setup Docs](https://docs.agentfront.dev/frontmcp/deployment/redis-setup)
|
|
363
|
+
- Related skills: `configure-session`, `setup-project`, `setup-sqlite`, `configure-transport`
|
|
@@ -1,66 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: setup-sqlite
|
|
3
|
-
description: Configure SQLite
|
|
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
|
|
3
|
+
description: Configure SQLite with WAL mode and optional encryption for local single-instance deployments
|
|
43
4
|
---
|
|
44
5
|
|
|
45
6
|
# Configure SQLite for Local and Single-Instance Deployments
|
|
46
7
|
|
|
47
|
-
## When to
|
|
8
|
+
## When to Use This Skill
|
|
48
9
|
|
|
49
|
-
|
|
10
|
+
### Must Use
|
|
50
11
|
|
|
51
|
-
- CLI tools
|
|
52
|
-
-
|
|
12
|
+
- Your FrontMCP server runs as a single instance with local persistent storage (CLI tools, unix-socket daemons)
|
|
13
|
+
- You need session or key-value storage for local development without running external services
|
|
14
|
+
- Your deployment target is a single-process Node.js server on a machine with a local filesystem
|
|
15
|
+
|
|
16
|
+
### Recommended
|
|
17
|
+
|
|
18
|
+
- You are building a CLI tool or local-only MCP server that will never be horizontally scaled
|
|
53
19
|
- Local development when running a Redis container is unnecessary overhead
|
|
54
|
-
- Projects that
|
|
20
|
+
- Projects that store session data, credentials, or counters on a single host
|
|
55
21
|
|
|
56
|
-
|
|
22
|
+
### Skip When
|
|
57
23
|
|
|
58
|
-
- Deploying to serverless (Vercel, Lambda, Cloudflare)
|
|
59
|
-
- Running multiple server instances
|
|
60
|
-
- You need pub/sub for resource subscriptions
|
|
61
|
-
- Horizontal scaling is required now or in the near future
|
|
24
|
+
- Deploying to serverless (Vercel, Lambda, Cloudflare) where there is no persistent local filesystem -- use `setup-redis` instead
|
|
25
|
+
- Running multiple server instances behind a load balancer -- use `setup-redis` instead
|
|
26
|
+
- You need pub/sub for resource subscriptions or real-time event distribution -- use `setup-redis` instead
|
|
62
27
|
|
|
63
|
-
|
|
28
|
+
> **Decision:** Use SQLite for single-instance local storage; switch to `setup-redis` for multi-instance or serverless deployments.
|
|
64
29
|
|
|
65
30
|
## Step 1 -- Install the Native Dependency
|
|
66
31
|
|
|
@@ -175,7 +140,7 @@ The encryption uses HKDF-SHA256 for key derivation and AES-256-GCM for value enc
|
|
|
175
140
|
walMode: true,
|
|
176
141
|
},
|
|
177
142
|
transport: {
|
|
178
|
-
protocol: '
|
|
143
|
+
protocol: 'modern', // 'modern' preset enables streamable HTTP + strict sessions
|
|
179
144
|
},
|
|
180
145
|
http: {
|
|
181
146
|
unixSocket: '/tmp/frontmcp.sock',
|
|
@@ -206,7 +171,7 @@ WAL (Write-Ahead Logging) mode is enabled by default (`walMode: true`) and is st
|
|
|
206
171
|
|
|
207
172
|
WAL mode creates two additional files alongside the database:
|
|
208
173
|
|
|
209
|
-
```
|
|
174
|
+
```text
|
|
210
175
|
sessions.sqlite # main database
|
|
211
176
|
sessions.sqlite-wal # write-ahead log
|
|
212
177
|
sessions.sqlite-shm # shared memory index
|
|
@@ -275,7 +240,7 @@ frontmcp dev
|
|
|
275
240
|
|
|
276
241
|
Check the logs for SQLite initialization:
|
|
277
242
|
|
|
278
|
-
```
|
|
243
|
+
```text
|
|
279
244
|
[SessionStoreFactory] Creating SQLite session store
|
|
280
245
|
```
|
|
281
246
|
|
|
@@ -334,26 +299,54 @@ The change in `src/main.ts`:
|
|
|
334
299
|
})
|
|
335
300
|
```
|
|
336
301
|
|
|
337
|
-
##
|
|
302
|
+
## Common Patterns
|
|
338
303
|
|
|
339
|
-
|
|
|
340
|
-
|
|
|
341
|
-
| `
|
|
342
|
-
|
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
345
|
-
|
|
|
346
|
-
| Encrypted data unreadable | Wrong or missing encryption secret | The secret must be identical across restarts; if lost, delete the database |
|
|
304
|
+
| Pattern | Correct | Incorrect | Why |
|
|
305
|
+
| ------------------------------ | -------------------------------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
306
|
+
| 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 |
|
|
307
|
+
| Encryption secret source | `secret: process.env['SQLITE_ENCRYPTION_SECRET']!` | `secret: 'hardcoded-secret-value'` | Secrets must come from environment variables, never committed to source code |
|
|
308
|
+
| 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 |
|
|
309
|
+
| 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 |
|
|
310
|
+
| TTL cleanup interval | `ttlCleanupIntervalMs: 60000` (default) | `ttlCleanupIntervalMs: 500` | Overly aggressive cleanup wastes CPU; the default 60s is appropriate for most workloads |
|
|
347
311
|
|
|
348
312
|
## Verification Checklist
|
|
349
313
|
|
|
350
|
-
|
|
314
|
+
### Dependencies
|
|
315
|
+
|
|
316
|
+
- [ ] `@frontmcp/storage-sqlite` and `better-sqlite3` are in `dependencies`
|
|
317
|
+
- [ ] `@types/better-sqlite3` is in `devDependencies`
|
|
318
|
+
- [ ] `node -e "require('better-sqlite3')"` runs without errors
|
|
319
|
+
|
|
320
|
+
### Configuration
|
|
321
|
+
|
|
322
|
+
- [ ] The `sqlite` block is present in the `@FrontMcp` decorator config with a valid `path` string
|
|
323
|
+
- [ ] The database path parent directory exists and is writable
|
|
324
|
+
- [ ] WAL mode is enabled (default) unless there is a specific filesystem limitation
|
|
325
|
+
|
|
326
|
+
### Environment and Security
|
|
327
|
+
|
|
328
|
+
- [ ] Environment variables are in `.env` and `.env` is gitignored
|
|
329
|
+
- [ ] If encryption is enabled: `SQLITE_ENCRYPTION_SECRET` is set and is at least 32 characters
|
|
330
|
+
- [ ] No secrets are hardcoded in source files
|
|
331
|
+
|
|
332
|
+
### Runtime
|
|
333
|
+
|
|
334
|
+
- [ ] The server starts without SQLite errors (`frontmcp dev`)
|
|
335
|
+
- [ ] The database file is created at the configured path
|
|
336
|
+
- [ ] If WAL mode is enabled: `.sqlite-wal` and `.sqlite-shm` files appear alongside the database
|
|
337
|
+
|
|
338
|
+
## Troubleshooting
|
|
339
|
+
|
|
340
|
+
| Problem | Cause | Solution |
|
|
341
|
+
| --------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
342
|
+
| `Cannot find module 'better-sqlite3'` | Native module not installed | Run `yarn add @frontmcp/storage-sqlite better-sqlite3` |
|
|
343
|
+
| `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 |
|
|
344
|
+
| `SQLITE_BUSY` errors | Multiple processes accessing the same database file | Enable WAL mode (`walMode: true`) or ensure only one process writes to the database |
|
|
345
|
+
| `SQLITE_READONLY` | Insufficient file permissions | Check write permissions on the database file and its parent directory |
|
|
346
|
+
| 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` |
|
|
347
|
+
| 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 |
|
|
348
|
+
|
|
349
|
+
## Reference
|
|
351
350
|
|
|
352
|
-
|
|
353
|
-
|
|
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
|
|
351
|
+
- **Docs:** [SQLite Setup Guide](https://docs.agentfront.dev/frontmcp/deployment/sqlite-setup)
|
|
352
|
+
- **Related skills:** `setup-redis`, `setup-project`, `nx-workflow`
|