@frontmcp/skills 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +135 -0
- package/catalog/TEMPLATE.md +49 -0
- package/catalog/adapters/create-adapter/SKILL.md +127 -0
- package/catalog/adapters/official-adapters/SKILL.md +136 -0
- package/catalog/auth/configure-auth/SKILL.md +250 -0
- package/catalog/auth/configure-auth/references/auth-modes.md +77 -0
- package/catalog/auth/configure-session/SKILL.md +201 -0
- package/catalog/config/configure-elicitation/SKILL.md +136 -0
- package/catalog/config/configure-http/SKILL.md +167 -0
- package/catalog/config/configure-throttle/SKILL.md +189 -0
- package/catalog/config/configure-throttle/references/guard-config.md +68 -0
- package/catalog/config/configure-transport/SKILL.md +151 -0
- package/catalog/config/configure-transport/references/protocol-presets.md +57 -0
- package/catalog/deployment/build-for-browser/SKILL.md +95 -0
- package/catalog/deployment/build-for-cli/SKILL.md +100 -0
- package/catalog/deployment/build-for-sdk/SKILL.md +218 -0
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +192 -0
- package/catalog/deployment/deploy-to-lambda/SKILL.md +304 -0
- package/catalog/deployment/deploy-to-node/SKILL.md +229 -0
- package/catalog/deployment/deploy-to-node/references/Dockerfile.example +45 -0
- package/catalog/deployment/deploy-to-vercel/SKILL.md +196 -0
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +60 -0
- package/catalog/development/create-agent/SKILL.md +563 -0
- package/catalog/development/create-agent/references/llm-config.md +46 -0
- package/catalog/development/create-job/SKILL.md +566 -0
- package/catalog/development/create-prompt/SKILL.md +400 -0
- package/catalog/development/create-provider/SKILL.md +233 -0
- package/catalog/development/create-resource/SKILL.md +437 -0
- package/catalog/development/create-skill/SKILL.md +526 -0
- package/catalog/development/create-skill-with-tools/SKILL.md +579 -0
- package/catalog/development/create-tool/SKILL.md +418 -0
- package/catalog/development/create-tool/references/output-schema-types.md +56 -0
- package/catalog/development/create-tool/references/tool-annotations.md +34 -0
- package/catalog/development/create-workflow/SKILL.md +709 -0
- package/catalog/development/decorators-guide/SKILL.md +598 -0
- package/catalog/plugins/create-plugin/SKILL.md +336 -0
- package/catalog/plugins/create-plugin-hooks/SKILL.md +282 -0
- package/catalog/plugins/official-plugins/SKILL.md +667 -0
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +200 -0
- package/catalog/setup/multi-app-composition/SKILL.md +358 -0
- package/catalog/setup/nx-workflow/SKILL.md +357 -0
- package/catalog/setup/project-structure-nx/SKILL.md +186 -0
- package/catalog/setup/project-structure-standalone/SKILL.md +153 -0
- package/catalog/setup/setup-project/SKILL.md +493 -0
- package/catalog/setup/setup-redis/SKILL.md +385 -0
- package/catalog/setup/setup-sqlite/SKILL.md +359 -0
- package/catalog/skills-manifest.json +414 -0
- package/catalog/testing/setup-testing/SKILL.md +539 -0
- package/catalog/testing/setup-testing/references/test-auth.md +88 -0
- package/catalog/testing/setup-testing/references/test-browser-build.md +57 -0
- package/catalog/testing/setup-testing/references/test-cli-binary.md +48 -0
- package/catalog/testing/setup-testing/references/test-direct-client.md +62 -0
- package/catalog/testing/setup-testing/references/test-e2e-handler.md +51 -0
- package/catalog/testing/setup-testing/references/test-tool-unit.md +41 -0
- package/package.json +34 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +16 -0
- package/src/index.js.map +1 -0
- package/src/loader.d.ts +46 -0
- package/src/loader.js +75 -0
- package/src/loader.js.map +1 -0
- package/src/manifest.d.ts +81 -0
- package/src/manifest.js +26 -0
- package/src/manifest.js.map +1 -0
|
@@ -0,0 +1,493 @@
|
|
|
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
|
+
# Scaffold and Configure a New FrontMCP Project
|
|
49
|
+
|
|
50
|
+
## When to use this skill
|
|
51
|
+
|
|
52
|
+
Use this skill when you need to create a new FrontMCP MCP server from scratch. This covers both the CLI scaffolding approach (preferred) and manual setup for existing codebases or Nx monorepos. Follow every step in order. Do not skip steps or assume defaults that are not listed here.
|
|
53
|
+
|
|
54
|
+
## Step 1 -- Use the CLI Scaffolder (Preferred)
|
|
55
|
+
|
|
56
|
+
The `frontmcp` CLI generates a complete project structure. Run it with `npx`:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx frontmcp create <projectName>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The CLI will interactively prompt for deployment target, Redis setup, package manager, CI/CD, and skills bundle. To skip prompts, pass flags directly:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx frontmcp create <projectName> \
|
|
66
|
+
--target <node|vercel|lambda|cloudflare> \
|
|
67
|
+
--redis <docker|existing|none> \
|
|
68
|
+
--pm <npm|yarn|pnpm> \
|
|
69
|
+
--skills <recommended|minimal|full|none> \
|
|
70
|
+
--cicd
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
All available flags:
|
|
74
|
+
|
|
75
|
+
| Flag | Values | Default | Description |
|
|
76
|
+
| ---------------------- | ---------------------------------------- | ------------- | --------------------------------------------- |
|
|
77
|
+
| `--target` | `node`, `vercel`, `lambda`, `cloudflare` | `node` | Deployment target |
|
|
78
|
+
| `--redis` | `docker`, `existing`, `none` | prompted | Redis provisioning strategy |
|
|
79
|
+
| `--pm` | `npm`, `yarn`, `pnpm` | prompted | Package manager |
|
|
80
|
+
| `--skills` | `recommended`, `minimal`, `full`, `none` | `recommended` | Skills bundle to install |
|
|
81
|
+
| `--cicd` / `--no-cicd` | boolean | prompted | Enable GitHub Actions CI/CD |
|
|
82
|
+
| `--nx` | boolean | `false` | Scaffold an Nx monorepo instead of standalone |
|
|
83
|
+
| `-y, --yes` | boolean | `false` | Accept all defaults non-interactively |
|
|
84
|
+
|
|
85
|
+
Add `--yes` to accept all defaults non-interactively:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx frontmcp create my-server --yes
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If the CLI scaffold succeeds, skip to Step 5 (environment variables). The CLI generates the full file tree including the server class, sample tools, Dockerfile, tsconfig, and build scripts.
|
|
92
|
+
|
|
93
|
+
## Step 2 -- Manual Setup (if CLI is not available or adding to an existing codebase)
|
|
94
|
+
|
|
95
|
+
If the CLI is not available or the project already exists, set up manually.
|
|
96
|
+
|
|
97
|
+
### 2a. Initialize the package
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
mkdir -p <projectName>/src
|
|
101
|
+
cd <projectName>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Create `package.json`:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"name": "<projectName>",
|
|
109
|
+
"version": "0.1.0",
|
|
110
|
+
"private": true,
|
|
111
|
+
"scripts": {
|
|
112
|
+
"dev": "frontmcp dev",
|
|
113
|
+
"build": "frontmcp build",
|
|
114
|
+
"start": "node dist/main.js"
|
|
115
|
+
},
|
|
116
|
+
"dependencies": {
|
|
117
|
+
"frontmcp": "latest",
|
|
118
|
+
"@frontmcp/sdk": "latest",
|
|
119
|
+
"reflect-metadata": "^0.2.0",
|
|
120
|
+
"zod": "^3.23.0"
|
|
121
|
+
},
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"typescript": "^5.4.0",
|
|
124
|
+
"@types/node": "^22.0.0"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 2b. Create tsconfig.json
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"compilerOptions": {
|
|
134
|
+
"target": "ES2022",
|
|
135
|
+
"module": "commonjs",
|
|
136
|
+
"lib": ["ES2022"],
|
|
137
|
+
"outDir": "./dist",
|
|
138
|
+
"rootDir": "./src",
|
|
139
|
+
"strict": true,
|
|
140
|
+
"esModuleInterop": true,
|
|
141
|
+
"experimentalDecorators": true,
|
|
142
|
+
"emitDecoratorMetadata": true,
|
|
143
|
+
"declaration": true,
|
|
144
|
+
"resolveJsonModule": true,
|
|
145
|
+
"skipLibCheck": true
|
|
146
|
+
},
|
|
147
|
+
"include": ["src/**/*"],
|
|
148
|
+
"exclude": ["node_modules", "dist"]
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Critical: `experimentalDecorators` and `emitDecoratorMetadata` must both be `true`. FrontMCP uses TypeScript decorators (`@FrontMcp`, `@App`, `@Tool`, `@Resource`, `@Prompt`, `@Skill`).
|
|
153
|
+
|
|
154
|
+
### 2c. Install dependencies
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
yarn install # or npm install / pnpm install
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Step 3 -- Create the Server Entry Point
|
|
161
|
+
|
|
162
|
+
Create `src/main.ts` with the `@FrontMcp` decorator. This is the root of every FrontMCP server.
|
|
163
|
+
|
|
164
|
+
The `@FrontMcp` decorator accepts a `FrontMcpMetadata` object with these fields:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import 'reflect-metadata';
|
|
168
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
169
|
+
|
|
170
|
+
@FrontMcp({
|
|
171
|
+
// Required fields
|
|
172
|
+
info: {
|
|
173
|
+
name: '<projectName>', // string (required) - server name in MCP initialize response
|
|
174
|
+
version: '0.1.0', // string (required) - server version
|
|
175
|
+
title: 'My Server', // string (optional) - display title
|
|
176
|
+
},
|
|
177
|
+
apps: [], // AppType[] (required) - array of @App classes or remote apps
|
|
178
|
+
|
|
179
|
+
// Optional fields - include only what you need
|
|
180
|
+
// http?: { port: number, host?: string, unixSocket?: string }
|
|
181
|
+
// redis?: { provider: 'redis', host: string, port?: number, ... } | { provider: 'vercel-kv', ... }
|
|
182
|
+
// sqlite?: { path: string, walMode?: boolean, encryption?: { secret: string } }
|
|
183
|
+
// transport?: { protocol?: 'streamable-http' | 'stdio' | ... }
|
|
184
|
+
// auth?: { mode: 'public' | 'transparent' | 'local' | 'remote', ... }
|
|
185
|
+
// logging?: { level?: string, transports?: [...] }
|
|
186
|
+
// plugins?: PluginType[]
|
|
187
|
+
// providers?: ProviderType[]
|
|
188
|
+
// tools?: ToolType[] - shared tools available to all apps
|
|
189
|
+
// resources?: ResourceType[] - shared resources available to all apps
|
|
190
|
+
// skills?: SkillType[] - shared skills available to all apps
|
|
191
|
+
// skillsConfig?: { enabled: boolean, mcpTools?: boolean, cache?: {...}, auth?: 'api-key' | 'bearer' }
|
|
192
|
+
// elicitation?: { enabled: boolean }
|
|
193
|
+
// pubsub?: { provider: 'redis', host: string, ... }
|
|
194
|
+
// pagination?: { ... }
|
|
195
|
+
// jobs?: { enabled: boolean, store?: { redis?: {...} } }
|
|
196
|
+
// throttle?: { enabled: boolean, global?: {...}, ... }
|
|
197
|
+
})
|
|
198
|
+
export default class Server {}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Deployment-target-specific configuration
|
|
202
|
+
|
|
203
|
+
**Node (default):** No extra transport config needed. The SDK defaults to stdio + Streamable HTTP on port 3000.
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import 'reflect-metadata';
|
|
207
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
208
|
+
|
|
209
|
+
@FrontMcp({
|
|
210
|
+
info: { name: '<projectName>', version: '0.1.0' },
|
|
211
|
+
apps: [],
|
|
212
|
+
http: { port: 3000 },
|
|
213
|
+
})
|
|
214
|
+
export default class Server {}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Vercel:** Set transport protocol and use Vercel KV for storage:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
@FrontMcp({
|
|
221
|
+
info: { name: '<projectName>', version: '0.1.0' },
|
|
222
|
+
apps: [],
|
|
223
|
+
transport: { protocol: 'streamable-http' },
|
|
224
|
+
redis: { provider: 'vercel-kv' },
|
|
225
|
+
})
|
|
226
|
+
export default class Server {}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Lambda / Cloudflare:** Use streamable-http transport. Session storage must be external (Redis).
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
@FrontMcp({
|
|
233
|
+
info: { name: '<projectName>', version: '0.1.0' },
|
|
234
|
+
apps: [],
|
|
235
|
+
transport: { protocol: 'streamable-http' },
|
|
236
|
+
redis: {
|
|
237
|
+
provider: 'redis',
|
|
238
|
+
host: process.env['REDIS_HOST'] ?? 'localhost',
|
|
239
|
+
port: parseInt(process.env['REDIS_PORT'] ?? '6379', 10),
|
|
240
|
+
},
|
|
241
|
+
})
|
|
242
|
+
export default class Server {}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Step 4 -- Add an App with Tools, Resources, and Prompts
|
|
246
|
+
|
|
247
|
+
### 4a. Create a Tool
|
|
248
|
+
|
|
249
|
+
Create `src/tools/add.tool.ts`:
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
253
|
+
import { z } from 'zod';
|
|
254
|
+
|
|
255
|
+
@Tool({
|
|
256
|
+
name: 'add',
|
|
257
|
+
description: 'Add two numbers',
|
|
258
|
+
inputSchema: { a: z.number(), b: z.number() },
|
|
259
|
+
outputSchema: { result: z.number() },
|
|
260
|
+
})
|
|
261
|
+
export default class AddTool extends ToolContext {
|
|
262
|
+
async execute(input: { a: number; b: number }) {
|
|
263
|
+
return {
|
|
264
|
+
result: input.a + input.b,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### 4b. Create an App to group entries
|
|
271
|
+
|
|
272
|
+
Create `src/apps/calc.app.ts`:
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
import { App } from '@frontmcp/sdk';
|
|
276
|
+
import AddTool from '../tools/add.tool';
|
|
277
|
+
|
|
278
|
+
@App({
|
|
279
|
+
id: 'calc', // string (optional) - unique identifier
|
|
280
|
+
name: 'Calculator', // string (required) - display name
|
|
281
|
+
tools: [AddTool], // ToolType[] (optional)
|
|
282
|
+
// resources?: ResourceType[] // optional
|
|
283
|
+
// prompts?: PromptType[] // optional
|
|
284
|
+
// agents?: AgentType[] // optional
|
|
285
|
+
// skills?: SkillType[] // optional
|
|
286
|
+
// plugins?: PluginType[] // optional
|
|
287
|
+
// providers?: ProviderType[] // optional
|
|
288
|
+
// adapters?: AdapterType[] // optional
|
|
289
|
+
// auth?: AuthOptionsInput // optional - per-app auth override
|
|
290
|
+
// standalone?: boolean | 'includeInParent' // optional - default false
|
|
291
|
+
// jobs?: JobType[] // optional
|
|
292
|
+
// workflows?: WorkflowType[] // optional
|
|
293
|
+
})
|
|
294
|
+
export class CalcApp {}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### 4c. Register the App in the server
|
|
298
|
+
|
|
299
|
+
Update `src/main.ts`:
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
import 'reflect-metadata';
|
|
303
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
304
|
+
import { CalcApp } from './apps/calc.app';
|
|
305
|
+
|
|
306
|
+
@FrontMcp({
|
|
307
|
+
info: { name: '<projectName>', version: '0.1.0' },
|
|
308
|
+
apps: [CalcApp],
|
|
309
|
+
})
|
|
310
|
+
export default class Server {}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 4d. Additional entry types
|
|
314
|
+
|
|
315
|
+
Resources, Prompts, and Skills follow the same decorator pattern:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// Resource - returns MCP ReadResourceResult
|
|
319
|
+
import { Resource, ResourceContext } from '@frontmcp/sdk';
|
|
320
|
+
|
|
321
|
+
@Resource({ uri: 'config://app', name: 'App Config', mimeType: 'application/json' })
|
|
322
|
+
export default class AppConfigResource extends ResourceContext {
|
|
323
|
+
/* ... */
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Prompt - returns MCP GetPromptResult
|
|
327
|
+
import { Prompt, PromptContext } from '@frontmcp/sdk';
|
|
328
|
+
|
|
329
|
+
@Prompt({ name: 'summarize', description: 'Summarize a document' })
|
|
330
|
+
export default class SummarizePrompt extends PromptContext {
|
|
331
|
+
/* ... */
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Skill - compound capability with tools + instructions
|
|
335
|
+
import { Skill, SkillContext } from '@frontmcp/sdk';
|
|
336
|
+
|
|
337
|
+
@Skill({ name: 'data-analysis', description: 'Analyze datasets' })
|
|
338
|
+
export default class DataAnalysisSkill extends SkillContext {
|
|
339
|
+
/* ... */
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Register them in the `@App` decorator arrays: `tools`, `resources`, `prompts`, `skills`.
|
|
344
|
+
|
|
345
|
+
## Step 5 -- Environment Variables
|
|
346
|
+
|
|
347
|
+
Create a `.env` file (never commit this file):
|
|
348
|
+
|
|
349
|
+
```env
|
|
350
|
+
# Server
|
|
351
|
+
PORT=3000
|
|
352
|
+
LOG_LEVEL=verbose
|
|
353
|
+
|
|
354
|
+
# Redis (if using Redis storage)
|
|
355
|
+
REDIS_HOST=localhost
|
|
356
|
+
REDIS_PORT=6379
|
|
357
|
+
|
|
358
|
+
# Auth (if using authentication)
|
|
359
|
+
# IDP_PROVIDER_URL=https://your-idp.example.com
|
|
360
|
+
# IDP_EXPECTED_AUDIENCE=https://your-idp.example.com
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
For Vercel deployments, set these in the Vercel dashboard or `.env.local`.
|
|
364
|
+
|
|
365
|
+
Confirm `.env` is in `.gitignore`:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
echo ".env" >> .gitignore
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Step 6 -- Run in Development Mode
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
# Start the dev server with hot reload
|
|
375
|
+
frontmcp dev
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Or if using package.json scripts:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
yarn dev
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
The server starts in stdio mode by default. To test with HTTP transport, set the PORT:
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
PORT=3000 frontmcp dev
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Test with curl:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
curl -X POST http://localhost:3000/mcp \
|
|
394
|
+
-H "Content-Type: application/json" \
|
|
395
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}'
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Build for production:
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
frontmcp build --target node # Node.js server bundle
|
|
402
|
+
frontmcp build --target vercel # Vercel serverless
|
|
403
|
+
frontmcp build --target lambda # AWS Lambda
|
|
404
|
+
frontmcp build --target cloudflare # Cloudflare Workers
|
|
405
|
+
frontmcp build --target cli # CLI with SEA binary
|
|
406
|
+
frontmcp build --target cli --js # CLI without SEA
|
|
407
|
+
frontmcp build --target sdk # Library (CJS+ESM+types)
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Step 7 -- Nx Workspace Setup (optional)
|
|
411
|
+
|
|
412
|
+
FrontMCP supports Nx monorepos for larger projects with multiple apps and shared libraries.
|
|
413
|
+
|
|
414
|
+
### 7a. Scaffold a new Nx workspace
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
npx frontmcp create <projectName> --nx
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
This creates a full Nx workspace with the `@frontmcp/nx` plugin pre-installed. After scaffolding:
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
cd <projectName>
|
|
424
|
+
nx g @frontmcp/nx:app my-app # Add an app
|
|
425
|
+
nx g @frontmcp/nx:lib my-lib # Add a library
|
|
426
|
+
nx g @frontmcp/nx:tool my-tool # Add a tool to an app
|
|
427
|
+
nx g @frontmcp/nx:resource my-res # Add a resource
|
|
428
|
+
nx g @frontmcp/nx:prompt my-prompt # Add a prompt
|
|
429
|
+
nx g @frontmcp/nx:skill my-skill # Add a skill
|
|
430
|
+
nx g @frontmcp/nx:agent my-agent # Add an agent
|
|
431
|
+
nx g @frontmcp/nx:provider my-prov # Add a provider
|
|
432
|
+
nx g @frontmcp/nx:server my-server # Add a deployment shell
|
|
433
|
+
nx dev <serverName> # Start dev server
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### 7b. Adding FrontMCP to an existing Nx workspace
|
|
437
|
+
|
|
438
|
+
Install the Nx plugin:
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
yarn add -D @frontmcp/nx
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Then generate components:
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
nx g @frontmcp/nx:app my-app --directory apps/my-app
|
|
448
|
+
nx g @frontmcp/nx:server my-server --directory servers/my-server
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### 7c. Nx project.json example
|
|
452
|
+
|
|
453
|
+
If manually configuring, add a `project.json`:
|
|
454
|
+
|
|
455
|
+
```json
|
|
456
|
+
{
|
|
457
|
+
"name": "<projectName>",
|
|
458
|
+
"root": "apps/<projectName>",
|
|
459
|
+
"targets": {
|
|
460
|
+
"build": {
|
|
461
|
+
"executor": "@nx/js:tsc",
|
|
462
|
+
"options": {
|
|
463
|
+
"outputPath": "dist/apps/<projectName>",
|
|
464
|
+
"main": "apps/<projectName>/src/main.ts",
|
|
465
|
+
"tsConfig": "apps/<projectName>/tsconfig.json"
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"serve": {
|
|
469
|
+
"executor": "@nx/js:node",
|
|
470
|
+
"options": { "buildTarget": "<projectName>:build" }
|
|
471
|
+
},
|
|
472
|
+
"test": {
|
|
473
|
+
"executor": "@nx/jest:jest",
|
|
474
|
+
"options": { "jestConfig": "apps/<projectName>/jest.config.ts" }
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Run with: `nx serve <projectName>`.
|
|
481
|
+
|
|
482
|
+
## Verification Checklist
|
|
483
|
+
|
|
484
|
+
Before reporting completion, verify all of the following:
|
|
485
|
+
|
|
486
|
+
1. `tsconfig.json` has `experimentalDecorators: true` and `emitDecoratorMetadata: true`
|
|
487
|
+
2. `@frontmcp/sdk` is listed in dependencies
|
|
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`
|