@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.
Files changed (88) hide show
  1. package/README.md +2 -2
  2. package/catalog/TEMPLATE.md +58 -13
  3. package/catalog/frontmcp-config/SKILL.md +143 -0
  4. package/catalog/frontmcp-config/references/configure-auth.md +238 -0
  5. package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
  6. package/catalog/frontmcp-config/references/configure-http.md +205 -0
  7. package/catalog/frontmcp-config/references/configure-session.md +205 -0
  8. package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
  9. package/catalog/frontmcp-config/references/configure-transport.md +195 -0
  10. package/catalog/frontmcp-config/references/setup-redis.md +4 -0
  11. package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
  12. package/catalog/frontmcp-deployment/SKILL.md +127 -0
  13. package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
  14. package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
  15. package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
  16. package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
  17. package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +76 -63
  18. package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
  19. package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
  20. package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
  21. package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
  22. package/catalog/frontmcp-development/SKILL.md +121 -0
  23. package/catalog/frontmcp-development/references/create-adapter.md +165 -0
  24. package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
  25. package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
  26. package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
  27. package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
  28. package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
  29. package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
  30. package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
  31. package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
  32. package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
  33. package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +96 -22
  34. package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
  35. package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
  36. package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
  37. package/catalog/frontmcp-development/references/official-adapters.md +194 -0
  38. package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +96 -31
  39. package/catalog/frontmcp-guides/SKILL.md +420 -0
  40. package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
  41. package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
  42. package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
  43. package/catalog/frontmcp-production-readiness/SKILL.md +253 -0
  44. package/catalog/frontmcp-setup/SKILL.md +130 -0
  45. package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
  46. package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
  47. package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
  48. package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
  49. package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
  50. package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
  51. package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
  52. package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
  53. package/catalog/frontmcp-testing/SKILL.md +127 -0
  54. package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
  55. package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
  56. package/catalog/skills-manifest.json +39 -378
  57. package/package.json +2 -2
  58. package/src/loader.js +0 -1
  59. package/src/loader.js.map +1 -1
  60. package/src/manifest.d.ts +3 -3
  61. package/src/manifest.js +2 -3
  62. package/src/manifest.js.map +1 -1
  63. package/catalog/adapters/create-adapter/SKILL.md +0 -127
  64. package/catalog/adapters/official-adapters/SKILL.md +0 -136
  65. package/catalog/auth/configure-auth/SKILL.md +0 -250
  66. package/catalog/auth/configure-session/SKILL.md +0 -201
  67. package/catalog/config/configure-elicitation/SKILL.md +0 -136
  68. package/catalog/config/configure-http/SKILL.md +0 -167
  69. package/catalog/config/configure-throttle/SKILL.md +0 -189
  70. package/catalog/config/configure-transport/SKILL.md +0 -151
  71. package/catalog/deployment/build-for-browser/SKILL.md +0 -95
  72. package/catalog/deployment/build-for-cli/SKILL.md +0 -100
  73. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
  74. package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
  75. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
  76. package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
  77. package/catalog/setup/project-structure-nx/SKILL.md +0 -186
  78. package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
  79. /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
  80. /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
  81. /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
  82. /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
  83. /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
  84. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
  85. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
  86. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
  87. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
  88. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
@@ -1,196 +0,0 @@
1
- ---
2
- name: deploy-to-vercel
3
- description: Deploy a FrontMCP server to Vercel serverless functions. Use when deploying to Vercel, configuring Vercel KV, or setting up serverless MCP.
4
- tags:
5
- - deployment
6
- - vercel
7
- - serverless
8
- - edge
9
- parameters:
10
- - name: region
11
- description: Vercel deployment region
12
- type: string
13
- required: false
14
- default: iad1
15
- - name: kv-store
16
- description: Name of the Vercel KV store to use for session and skill storage
17
- type: string
18
- required: false
19
- examples:
20
- - scenario: Deploy to Vercel with Vercel KV
21
- parameters:
22
- kv-store: frontmcp-kv
23
- expected-outcome: A FrontMCP server running as Vercel serverless functions with Vercel KV providing persistent storage for sessions and skill state.
24
- - scenario: Deploy with custom domain
25
- parameters:
26
- region: cdg1
27
- expected-outcome: A FrontMCP server accessible via a custom domain with automatic TLS, deployed to the Paris region.
28
- compatibility: Vercel CLI required
29
- license: Apache-2.0
30
- visibility: both
31
- priority: 10
32
- metadata:
33
- category: deployment
34
- difficulty: intermediate
35
- platform: vercel
36
- docs: https://docs.agentfront.dev/frontmcp/deployment/serverless
37
- ---
38
-
39
- # Deploy a FrontMCP Server to Vercel
40
-
41
- This skill guides you through deploying a FrontMCP server to Vercel serverless functions with Vercel KV for persistent storage.
42
-
43
- ## Prerequisites
44
-
45
- - A Vercel account (https://vercel.com)
46
- - Vercel CLI installed: `npm install -g vercel`
47
- - A built FrontMCP project
48
-
49
- ## Step 1: Build for Vercel
50
-
51
- ```bash
52
- frontmcp build --target vercel
53
- ```
54
-
55
- This produces a Vercel-compatible output structure with an `api/` directory containing the serverless function entry points, optimized bundles for cold-start performance, and a `vercel.json` configuration file.
56
-
57
- ## Step 2: Configure vercel.json
58
-
59
- Create or update `vercel.json` in your project root:
60
-
61
- ```json
62
- {
63
- "rewrites": [{ "source": "/(.*)", "destination": "/api/frontmcp" }],
64
- "functions": {
65
- "api/frontmcp.ts": {
66
- "memory": 1024,
67
- "maxDuration": 60
68
- }
69
- },
70
- "regions": ["iad1"],
71
- "headers": [
72
- {
73
- "source": "/(.*)",
74
- "headers": [
75
- { "key": "X-Content-Type-Options", "value": "nosniff" },
76
- { "key": "X-Frame-Options", "value": "DENY" }
77
- ]
78
- }
79
- ]
80
- }
81
- ```
82
-
83
- The rewrite rule sends all requests to the single FrontMCP API handler, which internally routes MCP and HTTP requests.
84
-
85
- ## Step 3: Configure Vercel KV Storage
86
-
87
- Use the `vercel-kv` provider so FrontMCP stores sessions, skill cache, and plugin state in Vercel KV (powered by Upstash Redis):
88
-
89
- ```typescript
90
- import { FrontMcp, App } from '@frontmcp/sdk';
91
-
92
- @App()
93
- class MyApp {}
94
-
95
- @FrontMcp({
96
- info: { name: 'my-server', version: '1.0.0' },
97
- apps: [MyApp],
98
- redis: { provider: 'vercel-kv' },
99
- skillsConfig: {
100
- enabled: true,
101
- cache: {
102
- enabled: true,
103
- redis: { provider: 'vercel-kv' },
104
- ttlMs: 60000,
105
- },
106
- },
107
- })
108
- class MyServer {}
109
- ```
110
-
111
- Provision the KV store in the Vercel dashboard under **Storage > Create Database > KV (Redis)**, then link it to your project. Vercel automatically injects the required environment variables.
112
-
113
- ## Step 4: Environment Variables
114
-
115
- Vercel KV variables are injected automatically when the store is linked. For manual setup or additional configuration, set them in the Vercel dashboard (**Settings > Environment Variables**) or via the CLI:
116
-
117
- ```bash
118
- vercel env add KV_REST_API_URL "https://your-kv-store.kv.vercel-storage.com"
119
- vercel env add KV_REST_API_TOKEN "your-token"
120
- vercel env add NODE_ENV production
121
- vercel env add LOG_LEVEL info
122
- ```
123
-
124
- | Variable | Description | Required |
125
- | ------------------- | ------------------------------ | ----------- |
126
- | `KV_REST_API_URL` | Vercel KV REST endpoint | If using KV |
127
- | `KV_REST_API_TOKEN` | Vercel KV authentication token | If using KV |
128
- | `NODE_ENV` | Runtime environment | Yes |
129
- | `LOG_LEVEL` | Logging verbosity | No |
130
-
131
- ## Step 5: Deploy
132
-
133
- ### Preview Deployment
134
-
135
- ```bash
136
- vercel
137
- ```
138
-
139
- Creates a preview deployment with a unique URL for validation.
140
-
141
- ### Production Deployment
142
-
143
- ```bash
144
- vercel --prod
145
- ```
146
-
147
- Deploys to your production domain.
148
-
149
- ### Custom Domain
150
-
151
- ```bash
152
- vercel domains add mcp.example.com
153
- ```
154
-
155
- Configure your DNS provider to point the domain to Vercel. TLS certificates are provisioned automatically.
156
-
157
- ## Step 6: Verify
158
-
159
- ```bash
160
- # Health check
161
- curl https://your-project.vercel.app/health
162
-
163
- # Test MCP endpoint
164
- curl -X POST https://your-project.vercel.app/mcp \
165
- -H "Content-Type: application/json" \
166
- -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
167
- ```
168
-
169
- ## Cold Start Notes
170
-
171
- Vercel serverless functions experience cold starts after periods of inactivity. To minimize impact:
172
-
173
- - The `frontmcp build --target vercel` output is optimized for bundle size. Avoid adding unnecessary dependencies.
174
- - Consider Vercel's **Fluid Compute** for latency-sensitive workloads.
175
- - Keep function memory at 1024 MB for faster initialization.
176
-
177
- ### Execution Limits
178
-
179
- | Plan | Max Duration |
180
- | ---------- | ------------ |
181
- | Hobby | 10 seconds |
182
- | Pro | 60 seconds |
183
- | Enterprise | 900 seconds |
184
-
185
- Long-running MCP operations should complete within these limits or use streaming responses.
186
-
187
- ### Statelessness
188
-
189
- Serverless functions are stateless between invocations. All persistent state must go through Vercel KV. FrontMCP handles this automatically when `{ provider: 'vercel-kv' }` is configured.
190
-
191
- ## Troubleshooting
192
-
193
- - **Function timeout**: Increase `maxDuration` in `vercel.json` or optimize the operation. Check your Vercel plan limits.
194
- - **KV connection errors**: Verify the KV store is linked and environment variables are set. Re-link the store in the dashboard if needed.
195
- - **404 on API routes**: Confirm the rewrite rule in `vercel.json` routes traffic to `/api/frontmcp`.
196
- - **Bundle too large**: Run `frontmcp build --target vercel --analyze` to inspect the bundle.
@@ -1,60 +0,0 @@
1
- {
2
- "$schema": "https://openapi.vercel.sh/vercel.json",
3
- "framework": null,
4
- "buildCommand": "frontmcp build --target vercel",
5
- "outputDirectory": "dist",
6
- "rewrites": [
7
- {
8
- "source": "/(.*)",
9
- "destination": "/api/frontmcp"
10
- }
11
- ],
12
- "functions": {
13
- "api/frontmcp.js": {
14
- "memory": 512,
15
- "maxDuration": 30
16
- }
17
- },
18
- "regions": ["iad1"],
19
- "headers": [
20
- {
21
- "source": "/health",
22
- "headers": [
23
- {
24
- "key": "Cache-Control",
25
- "value": "no-store"
26
- }
27
- ]
28
- },
29
- {
30
- "source": "/mcp",
31
- "headers": [
32
- {
33
- "key": "Cache-Control",
34
- "value": "no-store"
35
- },
36
- {
37
- "key": "X-Content-Type-Options",
38
- "value": "nosniff"
39
- }
40
- ]
41
- },
42
- {
43
- "source": "/(.*)",
44
- "headers": [
45
- {
46
- "key": "X-Frame-Options",
47
- "value": "DENY"
48
- },
49
- {
50
- "key": "X-Content-Type-Options",
51
- "value": "nosniff"
52
- },
53
- {
54
- "key": "Referrer-Policy",
55
- "value": "strict-origin-when-cross-origin"
56
- }
57
- ]
58
- }
59
- ]
60
- }
@@ -1,200 +0,0 @@
1
- ---
2
- name: frontmcp-skills-usage
3
- description: Search, install, and manage FrontMCP development skills for Claude Code and Codex. Use when setting up skills for AI-assisted development, choosing between static and dynamic skill delivery, or configuring skill providers.
4
- tags: [skills, cli, install, claude, codex, search, catalog]
5
- priority: 10
6
- visibility: both
7
- license: Apache-2.0
8
- metadata:
9
- docs: https://docs.agentfront.dev/frontmcp/servers/skills
10
- ---
11
-
12
- # FrontMCP Skills — Search, Install, and Usage
13
-
14
- FrontMCP ships with a catalog of development skills that teach AI agents (Claude Code, Codex) how to build FrontMCP servers. You can deliver these skills **statically** (copy to disk) or **dynamically** (search on demand via CLI).
15
-
16
- ## Quick Start
17
-
18
- ```bash
19
- # Search for skills about tools
20
- frontmcp skills search "create tool"
21
-
22
- # List all skills
23
- frontmcp skills list
24
-
25
- # Show full skill content
26
- frontmcp skills show create-tool
27
-
28
- # Install a skill for Claude Code
29
- frontmcp skills install create-tool --provider claude
30
-
31
- # Install a skill for Codex
32
- frontmcp skills install create-tool --provider codex
33
- ```
34
-
35
- ## CLI Commands
36
-
37
- ### `frontmcp skills search <query>`
38
-
39
- Semantic search through the catalog using weighted text matching (description 3x, tags 2x, name 1x):
40
-
41
- ```bash
42
- frontmcp skills search "authentication oauth"
43
- frontmcp skills search "deploy vercel" --category deployment
44
- frontmcp skills search "plugin hooks" --tag middleware --limit 5
45
- ```
46
-
47
- ### `frontmcp skills list`
48
-
49
- List all skills, optionally filtered:
50
-
51
- ```bash
52
- frontmcp skills list # All skills
53
- frontmcp skills list --category development # Development skills only
54
- frontmcp skills list --tag redis # Skills tagged with redis
55
- frontmcp skills list --bundle recommended # Recommended bundle
56
- ```
57
-
58
- ### `frontmcp skills show <name>`
59
-
60
- Print the full SKILL.md content to stdout — useful for piping to AI context:
61
-
62
- ```bash
63
- frontmcp skills show create-tool # Print full skill
64
- frontmcp skills show configure-auth # Print auth skill
65
- ```
66
-
67
- ### `frontmcp skills install <name>`
68
-
69
- Copy a skill to a provider-specific directory:
70
-
71
- ```bash
72
- # Claude Code — installs to .claude/skills/<name>/SKILL.md
73
- frontmcp skills install create-tool --provider claude
74
-
75
- # Codex — installs to .codex/skills/<name>/SKILL.md
76
- frontmcp skills install decorators-guide --provider codex
77
-
78
- # Custom directory
79
- frontmcp skills install setup-project --dir ./my-skills
80
- ```
81
-
82
- ## Two Approaches: Static vs Dynamic
83
-
84
- ### Static Installation (Copy to Disk)
85
-
86
- Install skills once — they live in your project and are always available:
87
-
88
- ```bash
89
- # Install for Claude Code
90
- frontmcp skills install create-tool --provider claude
91
- frontmcp skills install create-resource --provider claude
92
- frontmcp skills install configure-auth --provider claude
93
-
94
- # Install for Codex
95
- frontmcp skills install decorators-guide --provider codex
96
- ```
97
-
98
- **Directory structure after install:**
99
-
100
- ```
101
- my-project/
102
- ├── .claude/
103
- │ └── skills/
104
- │ ├── create-tool/
105
- │ │ ├── SKILL.md
106
- │ │ └── references/
107
- │ ├── create-resource/
108
- │ │ └── SKILL.md
109
- │ └── configure-auth/
110
- │ ├── SKILL.md
111
- │ └── references/
112
- ├── .codex/
113
- │ └── skills/
114
- │ └── decorators-guide/
115
- │ └── SKILL.md
116
- └── src/
117
- └── ...
118
- ```
119
-
120
- ### Dynamic Search (On-Demand via CLI)
121
-
122
- Use the CLI to search and show skills on demand — no installation needed:
123
-
124
- ```bash
125
- # Search for what you need
126
- frontmcp skills search "how to create a tool with zod"
127
-
128
- # Pipe skill content directly into context
129
- frontmcp skills show create-tool
130
- ```
131
-
132
- This works because `frontmcp skills show` outputs the full SKILL.md content to stdout.
133
-
134
- ## Comparison: Static vs Dynamic
135
-
136
- | Aspect | Static Install | Dynamic CLI Search |
137
- | ----------------- | ------------------------------------- | -------------------------------------------- |
138
- | **Setup** | `frontmcp skills install <name>` once | No setup — just use `frontmcp skills search` |
139
- | **Availability** | Always loaded by AI agent | On-demand, requires CLI invocation |
140
- | **Context usage** | Skills in system prompt (uses tokens) | Only loaded when searched (saves tokens) |
141
- | **Updates** | Re-install to update | Always uses latest catalog |
142
- | **Offline** | Works offline after install | Needs catalog available |
143
- | **Best for** | Core skills you use daily | Occasional reference, exploration |
144
- | **Token cost** | Higher (all installed skills loaded) | Lower (only searched skills loaded) |
145
-
146
- ### Recommended Approach
147
-
148
- **Install 5-10 core skills statically** for your most common workflows, and use dynamic search for everything else:
149
-
150
- ```bash
151
- # Core skills — install statically
152
- frontmcp skills install setup-project --provider claude
153
- frontmcp skills install create-tool --provider claude
154
- frontmcp skills install decorators-guide --provider claude
155
- frontmcp skills install configure-auth --provider claude
156
- frontmcp skills install project-structure-standalone --provider claude
157
-
158
- # Everything else — search on demand
159
- frontmcp skills search "deploy to vercel"
160
- frontmcp skills search "rate limiting"
161
- frontmcp skills show configure-throttle
162
- ```
163
-
164
- ## Provider Directories
165
-
166
- | Provider | Install directory | Auto-loaded by |
167
- | ----------- | -------------------------------- | ------------------------- |
168
- | Claude Code | `.claude/skills/<name>/SKILL.md` | Claude Code system prompt |
169
- | Codex | `.codex/skills/<name>/SKILL.md` | Codex agent context |
170
-
171
- ## Bundle Presets
172
-
173
- When scaffolding a project, use `--skills` to install a preset bundle:
174
-
175
- ```bash
176
- # Recommended bundle (core skills for the deployment target)
177
- frontmcp create my-app --skills recommended
178
-
179
- # Minimal bundle (just project setup + create-tool)
180
- frontmcp create my-app --skills minimal
181
-
182
- # Full bundle (all skills)
183
- frontmcp create my-app --skills full
184
-
185
- # No skills
186
- frontmcp create my-app --skills none
187
- ```
188
-
189
- ## Available Categories
190
-
191
- ```bash
192
- frontmcp skills list --category setup # Project setup and configuration
193
- frontmcp skills list --category config # Server configuration (transport, HTTP, throttle, elicitation)
194
- frontmcp skills list --category development # Creating tools, resources, prompts, agents, skills, providers
195
- frontmcp skills list --category deployment # Build and deploy (node, vercel, lambda, cli, browser, sdk)
196
- frontmcp skills list --category auth # Authentication and session management
197
- frontmcp skills list --category plugins # Official and custom plugins
198
- frontmcp skills list --category adapters # OpenAPI and custom adapters
199
- frontmcp skills list --category testing # Testing with Jest and @frontmcp/testing
200
- ```
@@ -1,186 +0,0 @@
1
- ---
2
- name: project-structure-nx
3
- description: Best practices for organizing a FrontMCP Nx monorepo -- apps, libs, servers, generators, and multi-app composition. Use when working with frontmcp create --nx or an Nx workspace.
4
- tags: [project, structure, nx, monorepo, organization, best-practices]
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
- # Nx Monorepo Project Structure
13
-
14
- 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:
15
-
16
- ```
17
- my-workspace/
18
- ├── apps/ # @App classes (one app per directory)
19
- │ ├── billing/
20
- │ │ ├── src/
21
- │ │ │ ├── billing.app.ts
22
- │ │ │ ├── tools/
23
- │ │ │ ├── resources/
24
- │ │ │ └── providers/
25
- │ │ ├── project.json
26
- │ │ └── tsconfig.json
27
- │ └── crm/
28
- │ ├── src/
29
- │ │ ├── crm.app.ts
30
- │ │ ├── tools/
31
- │ │ └── resources/
32
- │ ├── project.json
33
- │ └── tsconfig.json
34
- ├── libs/ # Shared libraries
35
- │ └── shared-utils/
36
- │ ├── src/
37
- │ │ └── index.ts
38
- │ ├── project.json
39
- │ └── tsconfig.json
40
- ├── servers/ # @FrontMcp servers composing apps
41
- │ └── gateway/
42
- │ ├── src/
43
- │ │ └── main.ts # @FrontMcp default export
44
- │ ├── project.json
45
- │ └── tsconfig.json
46
- ├── nx.json
47
- ├── tsconfig.base.json
48
- ├── CLAUDE.md # AI config (auto-generated)
49
- ├── AGENTS.md
50
- ├── .mcp.json
51
- └── .cursorrules
52
- ```
53
-
54
- ## Directory Roles
55
-
56
- ### apps/ -- Application Modules
57
-
58
- Each directory under `apps/` contains a single `@App` class with its tools, resources, prompts, providers, and plugins:
59
-
60
- ```typescript
61
- // apps/billing/src/billing.app.ts
62
- import { App } from '@frontmcp/sdk';
63
- import { CreateInvoiceTool } from './tools/create-invoice.tool';
64
- import { InvoiceResource } from './resources/invoice.resource';
65
- import { StripeProvider } from './providers/stripe.provider';
66
-
67
- @App({
68
- name: 'billing',
69
- tools: [CreateInvoiceTool],
70
- resources: [InvoiceResource],
71
- providers: [StripeProvider],
72
- })
73
- export class BillingApp {}
74
- ```
75
-
76
- Apps are self-contained and independently testable. They do not import from other apps -- shared code goes in `libs/`.
77
-
78
- ### libs/ -- Shared Libraries
79
-
80
- Shared providers, utilities, types, and common logic live under `libs/`:
81
-
82
- ```typescript
83
- // libs/shared-utils/src/index.ts
84
- export { formatCurrency } from './format-currency';
85
- export { DatabaseProvider } from './database.provider';
86
- export type { AppConfig } from './app-config.interface';
87
- ```
88
-
89
- Apps and servers import from libs using Nx path aliases configured in `tsconfig.base.json`:
90
-
91
- ```typescript
92
- import { DatabaseProvider } from '@my-workspace/shared-utils';
93
- ```
94
-
95
- ### servers/ -- FrontMcp Entry Points
96
-
97
- A server composes multiple apps into a single `@FrontMcp` entry point:
98
-
99
- ```typescript
100
- // servers/gateway/src/main.ts
101
- import { FrontMcp } from '@frontmcp/sdk';
102
- import { BillingApp } from '@my-workspace/billing';
103
- import { CrmApp } from '@my-workspace/crm';
104
-
105
- @FrontMcp({
106
- info: { name: 'gateway', version: '1.0.0' },
107
- apps: [BillingApp, CrmApp],
108
- })
109
- class GatewayServer {}
110
-
111
- export default GatewayServer;
112
- ```
113
-
114
- You can have multiple servers composing different combinations of apps (e.g., a public-facing server and an internal admin server).
115
-
116
- ## Nx Generators
117
-
118
- The `@frontmcp/nx-plugin` package provides generators for all entity types:
119
-
120
- ```bash
121
- # Generate a new app
122
- nx g @frontmcp/nx-plugin:app crm
123
-
124
- # Generate entities within an app
125
- nx g @frontmcp/nx-plugin:tool lookup-user --project=crm
126
- nx g @frontmcp/nx-plugin:resource user-profile --project=crm
127
- nx g @frontmcp/nx-plugin:prompt summarize --project=crm
128
- nx g @frontmcp/nx-plugin:provider database --project=crm
129
- nx g @frontmcp/nx-plugin:plugin logging --project=crm
130
- nx g @frontmcp/nx-plugin:agent research --project=crm
131
- nx g @frontmcp/nx-plugin:job cleanup --project=crm
132
-
133
- # Generate a new server
134
- nx g @frontmcp/nx-plugin:server gateway
135
-
136
- # Generate a shared library
137
- nx g @frontmcp/nx-plugin:lib shared-utils
138
- ```
139
-
140
- ## Build and Test Commands
141
-
142
- ```bash
143
- # Build a specific server
144
- nx build gateway
145
-
146
- # Test a specific app
147
- nx test billing
148
-
149
- # Run all tests
150
- nx run-many -t test
151
-
152
- # Build all projects
153
- nx run-many -t build
154
-
155
- # Lint everything
156
- nx run-many -t lint
157
- ```
158
-
159
- Nx caches build and test results. Subsequent runs for unchanged projects are instant.
160
-
161
- ## AI Configuration Files
162
-
163
- FrontMCP auto-generates AI configuration files at the workspace root:
164
-
165
- | File | Purpose |
166
- | -------------- | ---------------------------------------- |
167
- | `CLAUDE.md` | Instructions for Claude Code / Claude AI |
168
- | `AGENTS.md` | Instructions for agent-based AI tools |
169
- | `.mcp.json` | MCP server configuration for AI IDEs |
170
- | `.cursorrules` | Rules for Cursor AI editor |
171
-
172
- These files are regenerated when you run generators or modify your workspace structure. They help AI tools understand your project layout and coding conventions.
173
-
174
- ## Dependency Graph
175
-
176
- Nx enforces a clear dependency hierarchy:
177
-
178
- ```
179
- servers/ --> apps/ --> libs/
180
- ```
181
-
182
- - **servers** can import from **apps** and **libs**
183
- - **apps** can import from **libs** only (never from other apps or servers)
184
- - **libs** can import from other **libs** only
185
-
186
- Use `nx graph` to visualize the dependency graph and ensure no circular imports exist.