@frontmcp/skills 0.0.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +143 -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 +127 -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} +76 -63
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
- 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 +121 -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} +96 -22
- 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} +96 -31
- package/catalog/frontmcp-guides/SKILL.md +420 -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-production-readiness/SKILL.md +253 -0
- package/catalog/frontmcp-setup/SKILL.md +130 -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 +127 -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 +39 -378
- package/package.json +2 -2
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +2 -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,246 @@
|
|
|
1
|
+
# Nx Monorepo Project Structure
|
|
2
|
+
|
|
3
|
+
## When to Use This Skill
|
|
4
|
+
|
|
5
|
+
### Must Use
|
|
6
|
+
|
|
7
|
+
- Scaffolding a new FrontMCP project with `frontmcp create --nx` or adding FrontMCP to an existing Nx workspace
|
|
8
|
+
- Organizing multiple `@App` modules, shared libraries, and `@FrontMcp` server entry points in a monorepo
|
|
9
|
+
- Understanding the `apps/`, `libs/`, `servers/` directory hierarchy and Nx dependency rules
|
|
10
|
+
|
|
11
|
+
### Recommended
|
|
12
|
+
|
|
13
|
+
- Setting up Nx generators to scaffold tools, resources, providers, and other entities within apps
|
|
14
|
+
- Configuring multiple servers that compose different combinations of apps (e.g., public gateway and internal admin)
|
|
15
|
+
- Leveraging Nx caching, dependency graph, and `run-many` commands for efficient builds and tests
|
|
16
|
+
|
|
17
|
+
### Skip When
|
|
18
|
+
|
|
19
|
+
- You are building a single standalone project without Nx (see `project-structure-standalone`)
|
|
20
|
+
- You need to compose multiple apps within a single server and already have the Nx structure (see `multi-app-composition`)
|
|
21
|
+
- You are looking for a specific Nx build or CI workflow (see `nx-workflow`)
|
|
22
|
+
|
|
23
|
+
> **Decision:** Use this skill when setting up or organizing a FrontMCP Nx monorepo and you need the canonical directory layout, generator commands, and dependency rules.
|
|
24
|
+
|
|
25
|
+
When you scaffold with `frontmcp create --nx` or add FrontMCP to an existing Nx workspace, the recommended layout separates apps, shared libraries, and server entry points:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
my-workspace/
|
|
29
|
+
├── apps/ # @App classes (one app per directory)
|
|
30
|
+
│ ├── billing/
|
|
31
|
+
│ │ ├── src/
|
|
32
|
+
│ │ │ ├── billing.app.ts
|
|
33
|
+
│ │ │ ├── tools/
|
|
34
|
+
│ │ │ ├── resources/
|
|
35
|
+
│ │ │ └── providers/
|
|
36
|
+
│ │ ├── project.json
|
|
37
|
+
│ │ └── tsconfig.json
|
|
38
|
+
│ └── crm/
|
|
39
|
+
│ ├── src/
|
|
40
|
+
│ │ ├── crm.app.ts
|
|
41
|
+
│ │ ├── tools/
|
|
42
|
+
│ │ └── resources/
|
|
43
|
+
│ ├── project.json
|
|
44
|
+
│ └── tsconfig.json
|
|
45
|
+
├── libs/ # Shared libraries
|
|
46
|
+
│ └── shared-utils/
|
|
47
|
+
│ ├── src/
|
|
48
|
+
│ │ └── index.ts
|
|
49
|
+
│ ├── project.json
|
|
50
|
+
│ └── tsconfig.json
|
|
51
|
+
├── servers/ # @FrontMcp servers composing apps
|
|
52
|
+
│ └── gateway/
|
|
53
|
+
│ ├── src/
|
|
54
|
+
│ │ └── main.ts # @FrontMcp default export
|
|
55
|
+
│ ├── project.json
|
|
56
|
+
│ └── tsconfig.json
|
|
57
|
+
├── nx.json
|
|
58
|
+
├── tsconfig.base.json
|
|
59
|
+
├── CLAUDE.md # AI config (auto-generated)
|
|
60
|
+
├── AGENTS.md
|
|
61
|
+
├── .mcp.json
|
|
62
|
+
└── .cursorrules
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Directory Roles
|
|
66
|
+
|
|
67
|
+
### apps/ -- Application Modules
|
|
68
|
+
|
|
69
|
+
Each directory under `apps/` contains a single `@App` class with its tools, resources, prompts, providers, and plugins:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// apps/billing/src/billing.app.ts
|
|
73
|
+
import { App } from '@frontmcp/sdk';
|
|
74
|
+
import { CreateInvoiceTool } from './tools/create-invoice.tool';
|
|
75
|
+
import { InvoiceResource } from './resources/invoice.resource';
|
|
76
|
+
import { StripeProvider } from './providers/stripe.provider';
|
|
77
|
+
|
|
78
|
+
@App({
|
|
79
|
+
name: 'billing',
|
|
80
|
+
tools: [CreateInvoiceTool],
|
|
81
|
+
resources: [InvoiceResource],
|
|
82
|
+
providers: [StripeProvider],
|
|
83
|
+
})
|
|
84
|
+
export class BillingApp {}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Apps are self-contained and independently testable. They do not import from other apps -- shared code goes in `libs/`.
|
|
88
|
+
|
|
89
|
+
### libs/ -- Shared Libraries
|
|
90
|
+
|
|
91
|
+
Shared providers, utilities, types, and common logic live under `libs/`:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// libs/shared-utils/src/index.ts
|
|
95
|
+
export { formatCurrency } from './format-currency';
|
|
96
|
+
export { DatabaseProvider } from './database.provider';
|
|
97
|
+
export type { AppConfig } from './app-config.interface';
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Apps and servers import from libs using Nx path aliases configured in `tsconfig.base.json`:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { DatabaseProvider } from '@my-workspace/shared-utils';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### servers/ -- FrontMcp Entry Points
|
|
107
|
+
|
|
108
|
+
A server composes multiple apps into a single `@FrontMcp` entry point:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// servers/gateway/src/main.ts
|
|
112
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
113
|
+
import { BillingApp } from '@my-workspace/billing';
|
|
114
|
+
import { CrmApp } from '@my-workspace/crm';
|
|
115
|
+
|
|
116
|
+
@FrontMcp({
|
|
117
|
+
info: { name: 'gateway', version: '1.0.0' },
|
|
118
|
+
apps: [BillingApp, CrmApp],
|
|
119
|
+
})
|
|
120
|
+
class GatewayServer {}
|
|
121
|
+
|
|
122
|
+
export default GatewayServer;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can have multiple servers composing different combinations of apps (e.g., a public-facing server and an internal admin server).
|
|
126
|
+
|
|
127
|
+
## Nx Generators
|
|
128
|
+
|
|
129
|
+
The `@frontmcp/nx` package provides generators for common entity types:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Generate a new app
|
|
133
|
+
nx g @frontmcp/nx:app crm
|
|
134
|
+
|
|
135
|
+
# Generate entities within an app
|
|
136
|
+
nx g @frontmcp/nx:tool lookup-user --project=crm
|
|
137
|
+
nx g @frontmcp/nx:resource user-profile --project=crm
|
|
138
|
+
nx g @frontmcp/nx:prompt summarize --project=crm
|
|
139
|
+
nx g @frontmcp/nx:provider database --project=crm
|
|
140
|
+
nx g @frontmcp/nx:plugin logging --project=crm
|
|
141
|
+
nx g @frontmcp/nx:agent research --project=crm
|
|
142
|
+
nx g @frontmcp/nx:job cleanup --project=crm
|
|
143
|
+
nx g @frontmcp/nx:skill my-skill --project=crm
|
|
144
|
+
nx g @frontmcp/nx:skill-dir my-skill-dir --project=crm
|
|
145
|
+
|
|
146
|
+
# Generate a new server
|
|
147
|
+
nx g @frontmcp/nx:server gateway
|
|
148
|
+
|
|
149
|
+
# Generate a shared library
|
|
150
|
+
nx g @frontmcp/nx:lib shared-utils
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Build and Test Commands
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Build a specific server
|
|
157
|
+
nx build gateway
|
|
158
|
+
|
|
159
|
+
# Test a specific app
|
|
160
|
+
nx test billing
|
|
161
|
+
|
|
162
|
+
# Run all tests
|
|
163
|
+
nx run-many -t test
|
|
164
|
+
|
|
165
|
+
# Build all projects
|
|
166
|
+
nx run-many -t build
|
|
167
|
+
|
|
168
|
+
# Lint everything
|
|
169
|
+
nx run-many -t lint
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Nx caches build and test results. Subsequent runs for unchanged projects are instant.
|
|
173
|
+
|
|
174
|
+
## AI Configuration Files
|
|
175
|
+
|
|
176
|
+
FrontMCP auto-generates AI configuration files at the workspace root:
|
|
177
|
+
|
|
178
|
+
| File | Purpose |
|
|
179
|
+
| -------------- | ---------------------------------------- |
|
|
180
|
+
| `CLAUDE.md` | Instructions for Claude Code / Claude AI |
|
|
181
|
+
| `AGENTS.md` | Instructions for agent-based AI tools |
|
|
182
|
+
| `.mcp.json` | MCP server configuration for AI IDEs |
|
|
183
|
+
| `.cursorrules` | Rules for Cursor AI editor |
|
|
184
|
+
|
|
185
|
+
These files are regenerated when you run generators or modify your workspace structure. They help AI tools understand your project layout and coding conventions.
|
|
186
|
+
|
|
187
|
+
## Dependency Graph
|
|
188
|
+
|
|
189
|
+
Nx enforces a clear dependency hierarchy:
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
servers/ --> apps/ --> libs/
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
- **servers** can import from **apps** and **libs**
|
|
196
|
+
- **apps** can import from **libs** only (never from other apps or servers)
|
|
197
|
+
- **libs** can import from other **libs** only
|
|
198
|
+
|
|
199
|
+
Use `nx graph` to visualize the dependency graph and ensure no circular imports exist.
|
|
200
|
+
|
|
201
|
+
## Common Patterns
|
|
202
|
+
|
|
203
|
+
| Pattern | Correct | Incorrect | Why |
|
|
204
|
+
| ------------------ | ---------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
205
|
+
| App isolation | Apps import from `libs/` only, never from other apps | `apps/billing` imports from `apps/crm` directly | Cross-app imports create circular dependencies; shared code belongs in `libs/` |
|
|
206
|
+
| Server composition | `servers/gateway/src/main.ts` imports apps via Nx path aliases | Server file inlines tool classes instead of importing from apps | Servers compose `@App` classes; inlining defeats the monorepo separation |
|
|
207
|
+
| Path aliases | `import { BillingApp } from '@my-workspace/billing'` | `import { BillingApp } from '../../apps/billing/src/billing.app'` | Nx path aliases in `tsconfig.base.json` keep imports clean and refactorable |
|
|
208
|
+
| Generator usage | `nx g @frontmcp/nx:tool lookup-user --project=crm` | Manually creating tool files without updating barrel exports | Generators handle file creation, spec scaffolding, and barrel export updates |
|
|
209
|
+
| AI config files | Let FrontMCP auto-generate `CLAUDE.md`, `AGENTS.md`, `.mcp.json` | Hand-editing auto-generated AI config files | These files are regenerated by generators; manual edits will be overwritten |
|
|
210
|
+
|
|
211
|
+
## Verification Checklist
|
|
212
|
+
|
|
213
|
+
### Workspace Structure
|
|
214
|
+
|
|
215
|
+
- [ ] `nx.json` and `tsconfig.base.json` exist at the workspace root
|
|
216
|
+
- [ ] Each app under `apps/` has its own `project.json` and `tsconfig.json`
|
|
217
|
+
- [ ] Shared libraries under `libs/` have `project.json` and barrel `index.ts`
|
|
218
|
+
- [ ] Server entry points under `servers/` default-export the `@FrontMcp` class
|
|
219
|
+
|
|
220
|
+
### Build and Test
|
|
221
|
+
|
|
222
|
+
- [ ] `nx build gateway` (or server name) succeeds without errors
|
|
223
|
+
- [ ] `nx test billing` (or app name) passes all tests
|
|
224
|
+
- [ ] `nx run-many -t test` runs all tests across the workspace
|
|
225
|
+
- [ ] `nx graph` shows no circular dependencies between apps
|
|
226
|
+
|
|
227
|
+
### Generators
|
|
228
|
+
|
|
229
|
+
- [ ] `nx g @frontmcp/nx:app <name>` creates a valid app scaffold
|
|
230
|
+
- [ ] `nx g @frontmcp/nx:tool <name> --project=<app>` creates tool with spec and barrel update
|
|
231
|
+
- [ ] `nx g @frontmcp/nx:server <name>` creates a server entry point
|
|
232
|
+
|
|
233
|
+
## Troubleshooting
|
|
234
|
+
|
|
235
|
+
| Problem | Cause | Solution |
|
|
236
|
+
| ---------------------------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
237
|
+
| Import path not resolving | Missing or incorrect path alias in `tsconfig.base.json` | Add the correct `@my-workspace/<lib>` path mapping to `tsconfig.base.json` |
|
|
238
|
+
| `nx graph` shows circular dependency | App imports from another app instead of a shared lib | Move shared code to `libs/` and import from there in both apps |
|
|
239
|
+
| Generator fails with "project not found" | Incorrect `--project` name passed to the generator | Use the project name from `project.json`, not the directory name |
|
|
240
|
+
| Nx cache returns stale results | Source files changed but Nx hash did not detect it | Run `nx reset` to clear the cache, then rebuild |
|
|
241
|
+
| Server cannot find app export | App barrel `index.ts` does not export the `@App` class | Add the app class to the barrel export in `apps/<name>/src/index.ts` |
|
|
242
|
+
|
|
243
|
+
## Reference
|
|
244
|
+
|
|
245
|
+
- [Nx Plugin Documentation](https://docs.agentfront.dev/frontmcp/nx-plugin/overview)
|
|
246
|
+
- Related skills: `project-structure-standalone`, `multi-app-composition`, `nx-workflow`, `setup-project`
|
|
@@ -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`
|