@frontmcp/skills 0.0.1 → 1.0.0-beta.9
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/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +140 -0
- package/catalog/frontmcp-config/references/configure-auth.md +238 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
- package/catalog/frontmcp-config/references/configure-http.md +205 -0
- package/catalog/frontmcp-config/references/configure-session.md +205 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
- package/catalog/frontmcp-config/references/configure-transport.md +195 -0
- package/catalog/frontmcp-config/references/setup-redis.md +4 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
- package/catalog/frontmcp-deployment/SKILL.md +124 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +73 -60
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +11 -2
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +65 -37
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
- package/catalog/frontmcp-development/SKILL.md +118 -0
- package/catalog/frontmcp-development/references/create-adapter.md +165 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
- package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +71 -20
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
- package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
- package/catalog/frontmcp-development/references/official-adapters.md +194 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +68 -22
- package/catalog/frontmcp-guides/SKILL.md +417 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
- package/catalog/frontmcp-setup/SKILL.md +127 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
- package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
- package/catalog/frontmcp-testing/SKILL.md +121 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
- package/catalog/skills-manifest.json +34 -383
- package/package.json +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +1 -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/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
- /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
- /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
- /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
- /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
- /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Standalone Project Structure
|
|
2
|
+
|
|
3
|
+
## When to Use This Skill
|
|
4
|
+
|
|
5
|
+
### Must Use
|
|
6
|
+
|
|
7
|
+
- Scaffolding a new FrontMCP project with `frontmcp create` and need to understand the generated layout
|
|
8
|
+
- Organizing tools, resources, prompts, and providers in a standalone (non-Nx) project
|
|
9
|
+
- Setting up the `main.ts` entry point with the `@FrontMcp` server default export
|
|
10
|
+
|
|
11
|
+
### Recommended
|
|
12
|
+
|
|
13
|
+
- Adopting consistent `<name>.<type>.ts` file naming conventions across the project
|
|
14
|
+
- Restructuring an existing standalone project to follow FrontMCP best practices
|
|
15
|
+
- Organizing a growing project into feature folders with grouped domain entities
|
|
16
|
+
|
|
17
|
+
### Skip When
|
|
18
|
+
|
|
19
|
+
- You are working in an Nx monorepo with multiple apps and shared libraries (see `project-structure-nx`)
|
|
20
|
+
- You need to compose multiple apps into a single server (see `multi-app-composition`)
|
|
21
|
+
- You are creating a specific entity (tool, resource, etc.) and need its decorator API (see `create-tool`, `create-resource`)
|
|
22
|
+
|
|
23
|
+
> **Decision:** Use this skill when scaffolding or organizing a standalone FrontMCP project and you need the canonical file layout, naming conventions, and development workflow.
|
|
24
|
+
|
|
25
|
+
When you run `frontmcp create`, the CLI scaffolds a standalone project with the following layout:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
my-project/
|
|
29
|
+
├── src/
|
|
30
|
+
│ ├── main.ts # @FrontMcp server entry (default export)
|
|
31
|
+
│ ├── my-app.app.ts # @App class
|
|
32
|
+
│ ├── tools/ # @Tool classes (*.tool.ts)
|
|
33
|
+
│ ├── resources/ # @Resource classes (*.resource.ts)
|
|
34
|
+
│ ├── prompts/ # @Prompt classes (*.prompt.ts)
|
|
35
|
+
│ ├── agents/ # @Agent classes (*.agent.ts)
|
|
36
|
+
│ ├── skills/ # @Skill classes or SKILL.md dirs
|
|
37
|
+
│ ├── providers/ # @Provider classes (*.provider.ts)
|
|
38
|
+
│ ├── plugins/ # @Plugin classes (*.plugin.ts)
|
|
39
|
+
│ └── jobs/ # @Job classes (*.job.ts)
|
|
40
|
+
├── e2e/ # E2E tests (*.e2e.spec.ts)
|
|
41
|
+
├── skills/ # Catalog skills (from --skills flag)
|
|
42
|
+
├── package.json
|
|
43
|
+
├── tsconfig.json
|
|
44
|
+
└── .env.example
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## File Naming Conventions
|
|
48
|
+
|
|
49
|
+
Every entity type uses a consistent `<name>.<type>.ts` pattern:
|
|
50
|
+
|
|
51
|
+
| Entity | File Pattern | Example |
|
|
52
|
+
| -------- | --------------- | ---------------------------- |
|
|
53
|
+
| Tool | `*.tool.ts` | `fetch-weather.tool.ts` |
|
|
54
|
+
| Resource | `*.resource.ts` | `user-profile.resource.ts` |
|
|
55
|
+
| Prompt | `*.prompt.ts` | `summarize.prompt.ts` |
|
|
56
|
+
| Agent | `*.agent.ts` | `research.agent.ts` |
|
|
57
|
+
| Skill | `*.skill.ts` | `calendar.skill.ts` |
|
|
58
|
+
| Provider | `*.provider.ts` | `database.provider.ts` |
|
|
59
|
+
| Plugin | `*.plugin.ts` | `logging.plugin.ts` |
|
|
60
|
+
| Job | `*.job.ts` | `cleanup.job.ts` |
|
|
61
|
+
| Test | `*.spec.ts` | `fetch-weather.tool.spec.ts` |
|
|
62
|
+
| E2E Test | `*.e2e.spec.ts` | `api.e2e.spec.ts` |
|
|
63
|
+
|
|
64
|
+
**One class per file.** Keep each tool, resource, prompt, etc. in its own file.
|
|
65
|
+
|
|
66
|
+
## Entry Point: main.ts
|
|
67
|
+
|
|
68
|
+
`main.ts` default-exports the `@FrontMcp` server class. This is the file FrontMCP loads at startup:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
72
|
+
import { MyApp } from './my-app.app';
|
|
73
|
+
|
|
74
|
+
@FrontMcp({
|
|
75
|
+
info: { name: 'my-project', version: '1.0.0' },
|
|
76
|
+
apps: [MyApp],
|
|
77
|
+
})
|
|
78
|
+
class MyServer {}
|
|
79
|
+
|
|
80
|
+
export default MyServer;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## App Class
|
|
84
|
+
|
|
85
|
+
The `@App` class groups tools, resources, prompts, plugins, and providers together:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { App } from '@frontmcp/sdk';
|
|
89
|
+
import { FetchWeatherTool } from './tools/fetch-weather.tool';
|
|
90
|
+
import { DatabaseProvider } from './providers/database.provider';
|
|
91
|
+
|
|
92
|
+
@App({
|
|
93
|
+
name: 'my-app',
|
|
94
|
+
tools: [FetchWeatherTool],
|
|
95
|
+
providers: [DatabaseProvider],
|
|
96
|
+
})
|
|
97
|
+
export class MyApp {}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Development Workflow
|
|
101
|
+
|
|
102
|
+
### Start development server
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
frontmcp dev
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Watches for file changes and restarts automatically.
|
|
109
|
+
|
|
110
|
+
### Build for production
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
frontmcp build --target node
|
|
114
|
+
frontmcp build --target cloudflare
|
|
115
|
+
frontmcp build --target vercel
|
|
116
|
+
frontmcp build --target lambda
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Valid targets: `cli`, `node`, `sdk`, `browser`, `cloudflare`, `vercel`, `lambda`. The `--target` flag determines the output format and runtime optimizations.
|
|
120
|
+
|
|
121
|
+
### Run tests
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Unit tests
|
|
125
|
+
jest
|
|
126
|
+
|
|
127
|
+
# E2E tests
|
|
128
|
+
jest --config e2e/jest.config.ts
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Organizing by Feature
|
|
132
|
+
|
|
133
|
+
For larger standalone projects, group related entities into feature folders:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
src/
|
|
137
|
+
├── main.ts
|
|
138
|
+
├── my-app.app.ts
|
|
139
|
+
├── billing/
|
|
140
|
+
│ ├── create-invoice.tool.ts
|
|
141
|
+
│ ├── invoice.resource.ts
|
|
142
|
+
│ └── billing.provider.ts
|
|
143
|
+
├── users/
|
|
144
|
+
│ ├── lookup-user.tool.ts
|
|
145
|
+
│ ├── user-profile.resource.ts
|
|
146
|
+
│ └── users.provider.ts
|
|
147
|
+
└── plugins/
|
|
148
|
+
└── logging.plugin.ts
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Feature folders work well when your project has multiple related tools and resources that share a domain.
|
|
152
|
+
|
|
153
|
+
## Skills Directory
|
|
154
|
+
|
|
155
|
+
The top-level `skills/` directory (outside `src/`) holds catalog skills added via the `--skills` flag during `frontmcp create`. Each skill is a folder containing a `SKILL.md` file:
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
skills/
|
|
159
|
+
├── create-tool/
|
|
160
|
+
│ └── SKILL.md
|
|
161
|
+
└── setup-project/
|
|
162
|
+
└── SKILL.md
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Skills inside `src/skills/` are `@Skill` classes that are part of your application code.
|
|
166
|
+
|
|
167
|
+
## Common Patterns
|
|
168
|
+
|
|
169
|
+
| Pattern | Correct | Incorrect | Why |
|
|
170
|
+
| ------------------ | --------------------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
171
|
+
| File naming | `fetch-weather.tool.ts` (kebab-case with type suffix) | `FetchWeather.ts` or `fetchWeatherTool.ts` | The `<name>.<type>.ts` convention enables tooling, generators, and consistent imports |
|
|
172
|
+
| Entry point | `main.ts` with `export default MyServer` | Named export or no default export in `main.ts` | FrontMCP loads the default export from the entry point at startup |
|
|
173
|
+
| One class per file | Each tool, resource, or provider in its own file | Multiple tool classes in a single file | Keeps files focused, simplifies imports, and aligns with generator output |
|
|
174
|
+
| Feature folders | Group related entities under `src/billing/`, `src/users/` | Flat structure with dozens of files in `src/tools/` | Feature folders scale better and make domain boundaries visible |
|
|
175
|
+
| Test files | `fetch-weather.tool.spec.ts` (`.spec.ts` extension) | `fetch-weather.tool.test.ts` (`.test.ts` extension) | FrontMCP convention requires `.spec.ts`; generators and CI expect this pattern |
|
|
176
|
+
|
|
177
|
+
## Verification Checklist
|
|
178
|
+
|
|
179
|
+
### Project Structure
|
|
180
|
+
|
|
181
|
+
- [ ] `src/main.ts` exists and default-exports the `@FrontMcp` server class
|
|
182
|
+
- [ ] At least one `@App` class exists (e.g., `src/my-app.app.ts`)
|
|
183
|
+
- [ ] Entity files follow the `<name>.<type>.ts` naming convention
|
|
184
|
+
- [ ] Test files use the `.spec.ts` extension
|
|
185
|
+
|
|
186
|
+
### Development Workflow
|
|
187
|
+
|
|
188
|
+
- [ ] `frontmcp dev` starts the development server with file watching
|
|
189
|
+
- [ ] `frontmcp build --target node` produces a valid production build
|
|
190
|
+
- [ ] Unit tests pass with `jest`
|
|
191
|
+
- [ ] E2E tests (if any) are in the `e2e/` directory with `*.e2e.spec.ts` naming
|
|
192
|
+
|
|
193
|
+
### Organization
|
|
194
|
+
|
|
195
|
+
- [ ] Each entity type has its own directory (`tools/`, `resources/`, etc.) or feature folder
|
|
196
|
+
- [ ] Catalog skills (from `--skills` flag) are in the top-level `skills/` directory
|
|
197
|
+
- [ ] Application `@Skill` classes are in `src/skills/`
|
|
198
|
+
|
|
199
|
+
## Troubleshooting
|
|
200
|
+
|
|
201
|
+
| Problem | Cause | Solution |
|
|
202
|
+
| ------------------------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
203
|
+
| `frontmcp dev` fails to start | `main.ts` does not default-export the `@FrontMcp` class | Add `export default MyServer` to `main.ts` |
|
|
204
|
+
| Tool not discovered at runtime | Tool class not added to the `tools` array in `@App` | Register the tool in the `@App` decorator's `tools` array |
|
|
205
|
+
| Tests not found by Jest | Test file uses `.test.ts` instead of `.spec.ts` | Rename to `.spec.ts` to match the FrontMCP test file convention |
|
|
206
|
+
| Build target error | Invalid `--target` flag value | Use `node`, `vercel`, `lambda`, or `cloudflare` as the target value |
|
|
207
|
+
| Catalog skills not loaded | Skills placed in `src/skills/` instead of top-level `skills/` | Move catalog `SKILL.md` directories to the top-level `skills/` directory |
|
|
208
|
+
|
|
209
|
+
## Reference
|
|
210
|
+
|
|
211
|
+
- [Quickstart Documentation](https://docs.agentfront.dev/frontmcp/getting-started/quickstart)
|
|
212
|
+
- Related skills: `project-structure-nx`, `multi-app-composition`, `setup-project`, `create-tool`
|
|
@@ -1,55 +1,26 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: setup-project
|
|
3
|
-
description: Scaffold and configure a new FrontMCP MCP server project. Use when creating a new project, setting up @FrontMcp and @App decorators, or choosing a deployment target.
|
|
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
|
|
46
|
-
---
|
|
47
|
-
|
|
48
1
|
# Scaffold and Configure a New FrontMCP Project
|
|
49
2
|
|
|
50
|
-
## When to
|
|
3
|
+
## When to Use This Skill
|
|
4
|
+
|
|
5
|
+
### Must Use
|
|
6
|
+
|
|
7
|
+
- Creating a brand-new FrontMCP MCP server project from scratch
|
|
8
|
+
- Setting up the `@FrontMcp` root decorator and `@App` structure for the first time
|
|
9
|
+
- Choosing and configuring a deployment target (Node, Vercel, Lambda, Cloudflare)
|
|
10
|
+
|
|
11
|
+
### Recommended
|
|
51
12
|
|
|
52
|
-
|
|
13
|
+
- Adding FrontMCP to an existing TypeScript codebase that has no MCP server yet
|
|
14
|
+
- Scaffolding a new app inside an Nx monorepo with `@frontmcp/nx` generators
|
|
15
|
+
- Setting up the dev-loop (`frontmcp dev`, build, env vars) for a fresh project
|
|
16
|
+
|
|
17
|
+
### Skip When
|
|
18
|
+
|
|
19
|
+
- The project already has a working `@FrontMcp`-decorated server -- use `create-tool`, `create-resource`, or `create-prompt` to add entries
|
|
20
|
+
- You only need to add Redis or SQLite storage to an existing server -- use `setup-redis` or `setup-sqlite`
|
|
21
|
+
- You need to configure deployment for an already-scaffolded project -- use `deploy-to-vercel`, `deploy-to-lambda`, or `deploy-to-cloudflare`
|
|
22
|
+
|
|
23
|
+
> **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
24
|
|
|
54
25
|
## Step 1 -- Use the CLI Scaffolder (Preferred)
|
|
55
26
|
|
|
@@ -180,7 +151,7 @@ import { FrontMcp } from '@frontmcp/sdk';
|
|
|
180
151
|
// http?: { port: number, host?: string, unixSocket?: string }
|
|
181
152
|
// redis?: { provider: 'redis', host: string, port?: number, ... } | { provider: 'vercel-kv', ... }
|
|
182
153
|
// sqlite?: { path: string, walMode?: boolean, encryption?: { secret: string } }
|
|
183
|
-
// transport?:
|
|
154
|
+
// transport?: 'modern' | 'legacy' | 'stateless-api' | 'full' | { protocol?: ProtocolPreset, ... }
|
|
184
155
|
// auth?: { mode: 'public' | 'transparent' | 'local' | 'remote', ... }
|
|
185
156
|
// logging?: { level?: string, transports?: [...] }
|
|
186
157
|
// plugins?: PluginType[]
|
|
@@ -220,19 +191,19 @@ export default class Server {}
|
|
|
220
191
|
@FrontMcp({
|
|
221
192
|
info: { name: '<projectName>', version: '0.1.0' },
|
|
222
193
|
apps: [],
|
|
223
|
-
transport: { protocol: '
|
|
194
|
+
transport: { protocol: 'modern' }, // 'modern' preset enables streamable HTTP + strict sessions
|
|
224
195
|
redis: { provider: 'vercel-kv' },
|
|
225
196
|
})
|
|
226
197
|
export default class Server {}
|
|
227
198
|
```
|
|
228
199
|
|
|
229
|
-
**Lambda / Cloudflare:** Use
|
|
200
|
+
**Lambda / Cloudflare:** Use the `modern` transport preset. Session storage must be external (Redis).
|
|
230
201
|
|
|
231
202
|
```typescript
|
|
232
203
|
@FrontMcp({
|
|
233
204
|
info: { name: '<projectName>', version: '0.1.0' },
|
|
234
205
|
apps: [],
|
|
235
|
-
transport: { protocol: '
|
|
206
|
+
transport: { protocol: 'modern' }, // 'modern' preset enables streamable HTTP + strict sessions
|
|
236
207
|
redis: {
|
|
237
208
|
provider: 'redis',
|
|
238
209
|
host: process.env['REDIS_HOST'] ?? 'localhost',
|
|
@@ -479,15 +450,44 @@ If manually configuring, add a `project.json`:
|
|
|
479
450
|
|
|
480
451
|
Run with: `nx serve <projectName>`.
|
|
481
452
|
|
|
453
|
+
## Common Patterns
|
|
454
|
+
|
|
455
|
+
| Pattern | Correct | Incorrect | Why |
|
|
456
|
+
| ------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
457
|
+
| 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` |
|
|
458
|
+
| Decorator prerequisites | `experimentalDecorators: true` and `emitDecoratorMetadata: true` in tsconfig | Omitting either flag | FrontMCP decorators (`@FrontMcp`, `@App`, `@Tool`) rely on both TypeScript compiler options |
|
|
459
|
+
| 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 |
|
|
460
|
+
| 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 |
|
|
461
|
+
| 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 |
|
|
462
|
+
|
|
482
463
|
## Verification Checklist
|
|
483
464
|
|
|
484
|
-
|
|
465
|
+
### Configuration
|
|
466
|
+
|
|
467
|
+
- [ ] `tsconfig.json` has `experimentalDecorators: true` and `emitDecoratorMetadata: true`
|
|
468
|
+
- [ ] `@frontmcp/sdk`, `zod`, and `reflect-metadata` are listed in `package.json` dependencies
|
|
469
|
+
- [ ] `package.json` scripts include `dev`, `build`, and `start` commands
|
|
470
|
+
- [ ] Deployment target in `@FrontMcp` metadata matches the intended runtime
|
|
471
|
+
|
|
472
|
+
### Runtime
|
|
473
|
+
|
|
474
|
+
- [ ] `src/main.ts` exists with a `@FrontMcp`-decorated default export
|
|
475
|
+
- [ ] `import 'reflect-metadata'` is the first import in `src/main.ts`
|
|
476
|
+
- [ ] At least one `@App` class is registered in the `apps` array
|
|
477
|
+
- [ ] `frontmcp dev` starts without errors and responds to MCP `initialize` requests
|
|
478
|
+
- [ ] `.env` file exists locally and is listed in `.gitignore`
|
|
479
|
+
|
|
480
|
+
## Troubleshooting
|
|
481
|
+
|
|
482
|
+
| Problem | Cause | Solution |
|
|
483
|
+
| ----------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
484
|
+
| `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` |
|
|
485
|
+
| 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 |
|
|
486
|
+
| `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 |
|
|
487
|
+
| 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 |
|
|
488
|
+
| 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 |
|
|
489
|
+
|
|
490
|
+
## Reference
|
|
485
491
|
|
|
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`
|
|
492
|
+
- [Getting Started Quickstart](https://docs.agentfront.dev/frontmcp/getting-started/quickstart)
|
|
493
|
+
- Related skills: `setup-redis`, `setup-sqlite`, `nx-workflow`, `deploy-to-vercel`, `deploy-to-node`, `create-tool`
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
314
|
+
## Common Patterns
|
|
365
315
|
|
|
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 |
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
357
|
+
- [Redis Setup Docs](https://docs.agentfront.dev/frontmcp/deployment/redis-setup)
|
|
358
|
+
- Related skills: `configure-session`, `setup-project`, `setup-sqlite`, `configure-transport`
|