@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
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: multi-app-composition
|
|
3
|
-
description: Compose multiple apps in a single server with shared tools, scoped auth, and external app loading. Use when building multi-app servers, sharing tools between apps, loading ESM or remote apps, or configuring per-app auth.
|
|
4
|
-
tags: [multi-app, composition, architecture, scope, shared-tools]
|
|
5
|
-
priority: 9
|
|
6
|
-
visibility: both
|
|
7
|
-
license: Apache-2.0
|
|
8
|
-
metadata:
|
|
9
|
-
docs: https://docs.agentfront.dev/frontmcp/features/multi-app-composition
|
|
10
|
-
---
|
|
11
|
-
|
|
12
1
|
# Multi-App Composition
|
|
13
2
|
|
|
14
3
|
Compose multiple `@App` classes into a single `@FrontMcp` server. Each app contributes its own tools, resources, prompts, skills, and plugins. Apps can be local classes, npm packages loaded at runtime, or remote MCP servers proxied through your gateway.
|
|
15
4
|
|
|
16
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
17
6
|
|
|
18
|
-
|
|
7
|
+
### Must Use
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
- Composing multiple `@App` classes with separate domains into a single `@FrontMcp` server
|
|
10
|
+
- Aggregating external MCP servers via `app.remote()` or npm packages via `app.esm()` into a unified gateway
|
|
11
|
+
- Configuring per-app authentication modes (e.g., one app public, another requiring OAuth)
|
|
23
12
|
|
|
24
|
-
|
|
25
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
26
|
-
apps: [CalcApp],
|
|
27
|
-
})
|
|
28
|
-
export default class Server {}
|
|
29
|
-
```
|
|
13
|
+
### Recommended
|
|
30
14
|
|
|
31
|
-
|
|
15
|
+
- Setting up shared tools, resources, or plugins that span all apps in the server
|
|
16
|
+
- Isolating apps with `standalone: true` or `standalone: 'includeInParent'` for scoped auth or session separation
|
|
17
|
+
- Namespacing tools from multiple apps or remote servers to prevent naming collisions
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- Your server has a single logical domain with one `@App` class (see `project-structure-standalone`)
|
|
22
|
+
- You are scaffolding an Nx monorepo workspace and need generator commands (see `project-structure-nx`)
|
|
23
|
+
- You need to create individual tools, resources, or prompts rather than compose apps (see `create-tool`)
|
|
24
|
+
|
|
25
|
+
> **Decision:** Use this skill when you need to compose two or more apps -- local, ESM, or remote -- into a single FrontMCP server with shared or scoped capabilities.
|
|
32
26
|
|
|
33
27
|
## Local Apps
|
|
34
28
|
|
|
@@ -356,3 +350,51 @@ class AdminApp {}
|
|
|
356
350
|
})
|
|
357
351
|
export default class Server {}
|
|
358
352
|
```
|
|
353
|
+
|
|
354
|
+
## Common Patterns
|
|
355
|
+
|
|
356
|
+
| Pattern | Correct | Incorrect | Why |
|
|
357
|
+
| -------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
358
|
+
| Shared tools | `@FrontMcp({ tools: [HealthCheckTool] })` (server-level) | Duplicating the tool class in every `@App` `tools` array | Server-level tools are automatically shared across all apps without duplication |
|
|
359
|
+
| App namespacing | `@App({ id: 'billing', name: 'Billing', tools: [ChargeTool] })` | Omitting `id` when multiple apps have tools with the same name | The `id` field controls the namespace prefix (`billing:charge_card`); without it collisions occur |
|
|
360
|
+
| Remote auth | `remoteAuth: { mode: 'static', credentials: { type: 'bearer', value: token } }` | Passing the token directly as a string to `remoteAuth` | `remoteAuth` expects a structured object with `mode` and `credentials` fields |
|
|
361
|
+
| Standalone isolation | `standalone: true` for fully isolated apps | `standalone: true` when you still want tools visible in the parent server | Use `standalone: 'includeInParent'` to get scope isolation with parent visibility |
|
|
362
|
+
| Per-app auth | `auth: { mode: 'remote', idpProviderUrl: '...' }` on `@App` | Configuring auth only at the `@FrontMcp` level when apps need different modes | Apps without their own `auth` inherit server-level config; set per-app `auth` for mixed modes |
|
|
363
|
+
|
|
364
|
+
## Verification Checklist
|
|
365
|
+
|
|
366
|
+
### Configuration
|
|
367
|
+
|
|
368
|
+
- [ ] `@FrontMcp` `apps` array includes all local, ESM, and remote apps
|
|
369
|
+
- [ ] Each `@App` has a unique `id` (or unique `name` if `id` is omitted)
|
|
370
|
+
- [ ] `namespace` is set on ESM and remote apps to prevent tool name collisions
|
|
371
|
+
- [ ] Server-level `tools`, `plugins`, and `providers` are declared for shared capabilities
|
|
372
|
+
|
|
373
|
+
### Runtime
|
|
374
|
+
|
|
375
|
+
- [ ] All app tools appear in `tools/list` with correct namespace prefixes
|
|
376
|
+
- [ ] Shared tools appear without a namespace prefix
|
|
377
|
+
- [ ] `standalone: true` apps are isolated and do not appear in parent tool listing
|
|
378
|
+
- [ ] `standalone: 'includeInParent'` apps have isolated scope but visible tools
|
|
379
|
+
- [ ] Per-app auth modes are enforced independently per app
|
|
380
|
+
|
|
381
|
+
### Remote Apps
|
|
382
|
+
|
|
383
|
+
- [ ] `app.remote()` URL is reachable and returns valid MCP capabilities
|
|
384
|
+
- [ ] `remoteAuth` credentials are correct and not expired
|
|
385
|
+
- [ ] `fallbackToSSE` is enabled if the remote server does not support Streamable HTTP
|
|
386
|
+
|
|
387
|
+
## Troubleshooting
|
|
388
|
+
|
|
389
|
+
| Problem | Cause | Solution |
|
|
390
|
+
| ---------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
391
|
+
| Tool name collision between apps | Multiple apps register tools with the same name and no `id` | Set unique `id` on each `@App` or use `namespace` on ESM/remote apps |
|
|
392
|
+
| Remote app tools not appearing | Remote server is unreachable or returns empty capabilities | Verify the URL, check `transportOptions.timeout`, and ensure `remoteAuth` is correct |
|
|
393
|
+
| Shared plugin not applied to an app | Plugin declared on `@App` instead of `@FrontMcp` | Move the plugin to the `@FrontMcp` `plugins` array for server-wide application |
|
|
394
|
+
| `standalone: true` app tools not visible | Standalone apps are fully isolated by design | Use `standalone: 'includeInParent'` to expose tools in the parent server while keeping scope isolation |
|
|
395
|
+
| Per-app auth not working | App does not declare its own `auth` field | Add `auth` configuration directly on the `@App` decorator; omitted `auth` inherits server-level defaults |
|
|
396
|
+
|
|
397
|
+
## Reference
|
|
398
|
+
|
|
399
|
+
- [Multi-App Composition Documentation](https://docs.agentfront.dev/frontmcp/features/multi-app-composition)
|
|
400
|
+
- Related skills: `project-structure-standalone`, `project-structure-nx`, `configure-auth`, `create-tool`
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: nx-workflow
|
|
3
|
-
description: Complete Nx monorepo workflow for FrontMCP with all generators, build, test, and deployment commands. Use when working in an Nx workspace, running generators, or managing monorepo builds.
|
|
4
|
-
tags: [nx, monorepo, generators, workflow, scaffold]
|
|
5
|
-
priority: 8
|
|
6
|
-
visibility: both
|
|
7
|
-
license: Apache-2.0
|
|
8
|
-
metadata:
|
|
9
|
-
docs: https://docs.agentfront.dev/frontmcp/nx-plugin/overview
|
|
10
|
-
---
|
|
11
|
-
|
|
12
1
|
# Nx Monorepo Workflow for FrontMCP
|
|
13
2
|
|
|
14
3
|
Use the `@frontmcp/nx` plugin to scaffold, build, test, and deploy FrontMCP projects in an Nx monorepo. The plugin provides generators for every FrontMCP primitive (tools, resources, prompts, skills, agents, plugins, adapters, providers, flows, jobs, workflows) and deployment shells for multiple targets.
|
|
15
4
|
|
|
16
|
-
## When to Use
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Your project contains multiple apps or shared libraries in a monorepo structure
|
|
10
|
+
- You need fine-grained build caching and affected-only testing in CI
|
|
11
|
+
- You are scaffolding a new FrontMCP workspace with multiple deployment targets
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- You want generator-based scaffolding for every FrontMCP primitive (tools, resources, prompts, skills, etc.)
|
|
16
|
+
- You need to visualize and manage complex dependency graphs across projects
|
|
17
|
+
- Your team benefits from parallelized builds and consistent project structure
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
- Your project is a single standalone MCP server with no shared libraries -- use `frontmcp create` instead
|
|
22
|
+
- You are adding FrontMCP to an existing non-Nx build system (Turborepo, Lerna) -- use `setup-project` instead
|
|
23
|
+
- You only need to configure storage or auth without workspace scaffolding -- use `setup-sqlite` or `setup-redis` instead
|
|
24
|
+
|
|
25
|
+
> **Decision:** Use this skill when managing a multi-project FrontMCP monorepo; skip it for single-server projects.
|
|
19
26
|
|
|
20
27
|
## Step 1 -- Initialize the Workspace
|
|
21
28
|
|
|
@@ -43,13 +50,13 @@ nx g @frontmcp/nx:workspace my-workspace
|
|
|
43
50
|
|
|
44
51
|
The workspace generator creates the directory structure (`apps/`, `libs/`, `servers/`) and base configuration. It accepts these options:
|
|
45
52
|
|
|
46
|
-
| Option | Type
|
|
47
|
-
| ----------------- |
|
|
48
|
-
| `name` | `string`
|
|
49
|
-
| `packageManager` | `'npm' \| 'yarn' \| 'pnpm'
|
|
50
|
-
| `skipInstall` | `boolean`
|
|
51
|
-
| `skipGit` | `boolean`
|
|
52
|
-
| `createSampleApp` | `boolean`
|
|
53
|
+
| Option | Type | Default | Description |
|
|
54
|
+
| ----------------- | --------------------------- | ---------- | -------------------------------- |
|
|
55
|
+
| `name` | `string` | (required) | Workspace name |
|
|
56
|
+
| `packageManager` | `'npm' \| 'yarn' \| 'pnpm'` | `'npm'` | Package manager to use |
|
|
57
|
+
| `skipInstall` | `boolean` | `false` | Skip package installation |
|
|
58
|
+
| `skipGit` | `boolean` | `false` | Skip git initialization |
|
|
59
|
+
| `createSampleApp` | `boolean` | `true` | Create a sample demo application |
|
|
53
60
|
|
|
54
61
|
## Step 2 -- Generate Apps and Libraries
|
|
55
62
|
|
|
@@ -252,7 +259,7 @@ nx run-many -t build,test,lint
|
|
|
252
259
|
|
|
253
260
|
After scaffolding, the workspace follows this directory layout:
|
|
254
261
|
|
|
255
|
-
```
|
|
262
|
+
```text
|
|
256
263
|
my-project/
|
|
257
264
|
apps/
|
|
258
265
|
my-app/
|
|
@@ -355,3 +362,53 @@ Complete list of all `@frontmcp/nx` generators from `generators.json`:
|
|
|
355
362
|
| `job` | `nx g @frontmcp/nx:job <name> --project=<app>` | Generate a @Job class |
|
|
356
363
|
| `workflow` | `nx g @frontmcp/nx:workflow <name> --project=<app>` | Generate a @Workflow class |
|
|
357
364
|
| `auth-provider` | `nx g @frontmcp/nx:auth-provider <name> --project=<app>` | Generate an @AuthProvider class |
|
|
365
|
+
|
|
366
|
+
## Common Patterns
|
|
367
|
+
|
|
368
|
+
| Pattern | Correct | Incorrect | Why |
|
|
369
|
+
| -------------------------- | ------------------------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
370
|
+
| Primitive generator target | `nx g @frontmcp/nx:tool my-tool --project=my-app` | `nx g @frontmcp/nx:tool my-tool` | All primitive generators require `--project` to specify which app receives the file |
|
|
371
|
+
| Test file naming | `my-tool.tool.spec.ts` | `my-tool.tool.test.ts` | FrontMCP enforces `.spec.ts` extension; `.test.ts` files are not picked up by Jest config |
|
|
372
|
+
| Affected-only CI testing | `nx affected -t test` | `nx run-many -t test` | `affected` only runs tests for changed projects, saving CI time and compute |
|
|
373
|
+
| Server composition | `nx g @frontmcp/nx:server my-server --apps=app-a,app-b` | Manually importing apps in `main.ts` | The server generator wires app composition and deployment config automatically |
|
|
374
|
+
| Build before deploy | `nx build my-server` (builds server + all deps) | Building each lib and app individually | Nx resolves the dependency graph and builds in the correct order with caching |
|
|
375
|
+
|
|
376
|
+
## Verification Checklist
|
|
377
|
+
|
|
378
|
+
### Workspace Setup
|
|
379
|
+
|
|
380
|
+
- [ ] `@frontmcp/nx` is listed in `devDependencies`
|
|
381
|
+
- [ ] `nx.json` exists at workspace root with valid configuration
|
|
382
|
+
- [ ] `apps/`, `libs/`, and `servers/` directories exist
|
|
383
|
+
|
|
384
|
+
### Generation
|
|
385
|
+
|
|
386
|
+
- [ ] Generated files are placed in the correct directory (`apps/<app>/src/<type>/`)
|
|
387
|
+
- [ ] Barrel exports (`index.ts`) are updated after each generator run
|
|
388
|
+
- [ ] `.spec.ts` test file is created alongside each generated class
|
|
389
|
+
|
|
390
|
+
### Build and Test
|
|
391
|
+
|
|
392
|
+
- [ ] `nx build <server>` completes without TypeScript errors or warnings
|
|
393
|
+
- [ ] `nx test <app>` passes with 95%+ coverage
|
|
394
|
+
- [ ] `nx affected -t test` correctly identifies changed projects
|
|
395
|
+
|
|
396
|
+
### Development Workflow
|
|
397
|
+
|
|
398
|
+
- [ ] `nx serve <server>` or `nx dev <server>` starts the server successfully
|
|
399
|
+
- [ ] `nx graph` renders the project dependency graph in the browser
|
|
400
|
+
|
|
401
|
+
## Troubleshooting
|
|
402
|
+
|
|
403
|
+
| Problem | Cause | Solution |
|
|
404
|
+
| ---------------------------------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
405
|
+
| `Cannot find module '@frontmcp/nx'` | Plugin not installed | Run `yarn add -D @frontmcp/nx` and ensure it appears in `devDependencies` |
|
|
406
|
+
| Generator creates files in the wrong directory | Missing or incorrect `--project` flag | Always pass `--project=<app-name>` for primitive generators; verify the app exists in `apps/` |
|
|
407
|
+
| `nx affected` runs nothing despite changes | Base branch not configured or no dependency link | Check `nx.json` for `defaultBase` setting; verify the changed file belongs to a project in the graph |
|
|
408
|
+
| Build fails with circular dependency error | Library A imports from Library B and vice versa | Use `nx graph` to visualize the cycle; extract shared code into a new library |
|
|
409
|
+
| Cache not working (full rebuild every time) | Missing or misconfigured `cacheableOperations` in `nx.json` | Ensure `build`, `test`, and `lint` are listed in `targetDefaults` with `cache: true` |
|
|
410
|
+
|
|
411
|
+
## Reference
|
|
412
|
+
|
|
413
|
+
- **Docs:** [Nx Plugin Overview](https://docs.agentfront.dev/frontmcp/nx-plugin/overview)
|
|
414
|
+
- **Related skills:** `setup-project`, `setup-sqlite`, `setup-redis`
|
|
@@ -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`
|