@ng-forge/dynamic-form-mcp 0.5.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.
Files changed (50) hide show
  1. package/README.md +221 -0
  2. package/bin/ng-forge-mcp.d.ts +8 -0
  3. package/bin/ng-forge-mcp.d.ts.map +1 -0
  4. package/bin/ng-forge-mcp.js +10202 -0
  5. package/package.json +61 -0
  6. package/src/index.d.ts +14 -0
  7. package/src/index.d.ts.map +1 -0
  8. package/src/index.js +10265 -0
  9. package/src/registry/api-reference.json +510 -0
  10. package/src/registry/docs.json +230 -0
  11. package/src/registry/examples.json +629 -0
  12. package/src/registry/field-types.json +490 -0
  13. package/src/registry/index.d.ts +110 -0
  14. package/src/registry/index.d.ts.map +1 -0
  15. package/src/registry/instructions.d.ts +8 -0
  16. package/src/registry/instructions.d.ts.map +1 -0
  17. package/src/registry/ui-adapters.json +225 -0
  18. package/src/registry/validators.json +158 -0
  19. package/src/resources/documentation.resource.d.ts +8 -0
  20. package/src/resources/documentation.resource.d.ts.map +1 -0
  21. package/src/resources/examples.resource.d.ts +8 -0
  22. package/src/resources/examples.resource.d.ts.map +1 -0
  23. package/src/resources/field-types.resource.d.ts +8 -0
  24. package/src/resources/field-types.resource.d.ts.map +1 -0
  25. package/src/resources/index.d.ts +11 -0
  26. package/src/resources/index.d.ts.map +1 -0
  27. package/src/resources/instructions.resource.d.ts +8 -0
  28. package/src/resources/instructions.resource.d.ts.map +1 -0
  29. package/src/resources/schemas.resource.d.ts +9 -0
  30. package/src/resources/schemas.resource.d.ts.map +1 -0
  31. package/src/resources/ui-adapters.resource.d.ts +8 -0
  32. package/src/resources/ui-adapters.resource.d.ts.map +1 -0
  33. package/src/resources/validators.resource.d.ts +8 -0
  34. package/src/resources/validators.resource.d.ts.map +1 -0
  35. package/src/server.d.ts +22 -0
  36. package/src/server.d.ts.map +1 -0
  37. package/src/tools/data/lookup-topics.d.ts +18 -0
  38. package/src/tools/data/lookup-topics.d.ts.map +1 -0
  39. package/src/tools/examples.tool.d.ts +12 -0
  40. package/src/tools/examples.tool.d.ts.map +1 -0
  41. package/src/tools/index.d.ts +33 -0
  42. package/src/tools/index.d.ts.map +1 -0
  43. package/src/tools/lookup.tool.d.ts +15 -0
  44. package/src/tools/lookup.tool.d.ts.map +1 -0
  45. package/src/tools/scaffold.tool.d.ts +11 -0
  46. package/src/tools/scaffold.tool.d.ts.map +1 -0
  47. package/src/tools/validate.tool.d.ts +14 -0
  48. package/src/tools/validate.tool.d.ts.map +1 -0
  49. package/src/utils/ast-extractor.d.ts +88 -0
  50. package/src/utils/ast-extractor.d.ts.map +1 -0
package/README.md ADDED
@@ -0,0 +1,221 @@
1
+ # @ng-forge/dynamic-form-mcp
2
+
3
+ MCP (Model Context Protocol) server for ng-forge dynamic forms - enables AI assistants to generate, validate, and work with dynamic form configurations.
4
+
5
+ ## Features
6
+
7
+ - **Documentation Lookup**: Explore field types, concepts, and patterns
8
+ - **Code Examples**: Get working, copy-paste-ready form configurations
9
+ - **Config Validation**: Validate FormConfig objects with detailed error messages
10
+ - **Skeleton Generation**: Generate form scaffolds from parameters
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @ng-forge/dynamic-form-mcp
16
+ ```
17
+
18
+ ## Setup
19
+
20
+ ### Cursor
21
+
22
+ Add to your Cursor MCP settings:
23
+
24
+ ```json
25
+ {
26
+ "ng-forge": {
27
+ "command": "npx",
28
+ "args": ["-y", "@ng-forge/dynamic-form-mcp"]
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### VS Code with Copilot
34
+
35
+ Create `.vscode/mcp.json` in your project:
36
+
37
+ ```json
38
+ {
39
+ "servers": {
40
+ "ng-forge": {
41
+ "command": "npx",
42
+ "args": ["-y", "@ng-forge/dynamic-form-mcp"]
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### Claude Desktop
49
+
50
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
51
+
52
+ ```json
53
+ {
54
+ "mcpServers": {
55
+ "ng-forge": {
56
+ "command": "npx",
57
+ "args": ["-y", "@ng-forge/dynamic-form-mcp"]
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### JetBrains IDEs
64
+
65
+ Go to **Settings > Tools > AI Assistant > Model Context Protocol (MCP)** and add:
66
+
67
+ | Field | Value |
68
+ | --------- | ----------------------------- |
69
+ | Name | ng-forge |
70
+ | Command | npx |
71
+ | Arguments | -y @ng-forge/dynamic-form-mcp |
72
+
73
+ ### Local Development
74
+
75
+ For development within the ng-forge monorepo:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "ng-forge": {
81
+ "command": "node",
82
+ "args": ["/path/to/ng-forge/dist/packages/dynamic-form-mcp/bin/ng-forge-mcp.js"]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ## Available Tools
89
+
90
+ The server provides 4 focused tools:
91
+
92
+ | Tool | Description | Read-only |
93
+ | ------------------ | ----------------------------------------------------------- | --------- |
94
+ | `ngforge_lookup` | Get documentation about field types, concepts, and patterns | ✅ |
95
+ | `ngforge_examples` | Get working code examples for common form patterns | ✅ |
96
+ | `ngforge_validate` | Validate FormConfig and get detailed error feedback | ✅ |
97
+ | `ngforge_scaffold` | Generate valid FormConfig skeletons | ✅ |
98
+
99
+ ---
100
+
101
+ ### ngforge_lookup
102
+
103
+ Get documentation about any ng-forge topic.
104
+
105
+ | Parameter | Type | Default | Description |
106
+ | --------------- | --------------------------------------------------------- | ---------- | ----------------------- |
107
+ | `topic` | string | (required) | Topic to look up |
108
+ | `depth` | `"brief"` \| `"full"` \| `"schema"` | `"full"` | Level of detail |
109
+ | `uiIntegration` | `"material"` \| `"bootstrap"` \| `"primeng"` \| `"ionic"` | - | Filter UI-specific info |
110
+
111
+ **Available Topics:**
112
+
113
+ | Category | Topics |
114
+ | ----------- | ------------------------------------------------------------------------------------------------------ |
115
+ | Field Types | `input`, `select`, `radio`, `checkbox`, `textarea`, `datepicker`, `slider`, `toggle`, `hidden`, `text` |
116
+ | Containers | `group`, `row`, `array`, `page` |
117
+ | Concepts | `validation`, `conditional`, `derivation`, `options-format`, `expression-variables` |
118
+ | Patterns | `golden-path`, `multi-page-gotchas`, `pitfalls`, `workflow` |
119
+
120
+ ---
121
+
122
+ ### ngforge_examples
123
+
124
+ Get working code examples for common patterns.
125
+
126
+ | Parameter | Type | Default | Description |
127
+ | --------- | ----------------------------------------------------- | ---------- | --------------- |
128
+ | `pattern` | string | (required) | Pattern name |
129
+ | `depth` | `"minimal"` \| `"brief"` \| `"full"` \| `"explained"` | `"full"` | Level of detail |
130
+
131
+ **Available Patterns:**
132
+
133
+ | Pattern | Description |
134
+ | --------------------- | ---------------------------------------- |
135
+ | `minimal-multipage` | Simplest 2-page wizard form |
136
+ | `minimal-array` | Array with add/remove buttons |
137
+ | `minimal-conditional` | Show/hide field based on condition |
138
+ | `minimal-validation` | Password confirmation validation |
139
+ | `minimal-hidden` | Hidden fields in multi-page form |
140
+ | `complete` | Full form with all major features |
141
+ | `mega` | Kitchen sink demonstrating every feature |
142
+
143
+ ---
144
+
145
+ ### ngforge_validate
146
+
147
+ Validate FormConfig and get detailed error feedback.
148
+
149
+ | Parameter | Type | Default | Description |
150
+ | --------------- | --------------------------------------------------------- | ------------ | ------------------------------ |
151
+ | `config` | string \| object | (required) | File path or JSON config |
152
+ | `uiIntegration` | `"material"` \| `"bootstrap"` \| `"primeng"` \| `"ionic"` | `"material"` | UI library to validate against |
153
+
154
+ **Input Detection:**
155
+
156
+ | Input | Treated As |
157
+ | ------------------------ | ------------------ |
158
+ | Ends with `.ts` or `.js` | File path |
159
+ | Starts with `{` or `[` | JSON string |
160
+ | Object | Validated directly |
161
+
162
+ **Example Errors:**
163
+
164
+ - "Hidden field missing REQUIRED value property"
165
+ - "options MUST be at FIELD level, NOT inside props"
166
+ - "row containers do NOT support logic blocks"
167
+
168
+ ---
169
+
170
+ ### ngforge_scaffold
171
+
172
+ Generate valid FormConfig skeletons.
173
+
174
+ | Parameter | Type | Default | Description |
175
+ | --------------- | -------- | ------------ | ------------------------------------- |
176
+ | `pages` | number | `0` | Number of pages (0 = single-page) |
177
+ | `fields` | string[] | `[]` | Fields as `"name:type"` pairs |
178
+ | `groups` | string[] | `[]` | Group field names |
179
+ | `arrays` | string[] | `[]` | Array field names |
180
+ | `hidden` | string[] | `[]` | Hidden fields as `"name:value"` pairs |
181
+ | `uiIntegration` | enum | `"material"` | UI library |
182
+
183
+ **Supported field types:** `input`, `select`, `radio`, `checkbox`, `textarea`, `datepicker`, `slider`, `toggle`
184
+
185
+ ---
186
+
187
+ ## MCP Resources
188
+
189
+ | Resource URI | Description |
190
+ | -------------------------- | ---------------------------------------------- |
191
+ | `ng-forge://instructions` | Best practices guide for generating FormConfig |
192
+ | `ng-forge://examples` | Curated FormConfig examples |
193
+ | `ng-forge://examples/{id}` | Specific example by ID |
194
+ | `ng-forge://field-types` | Field type reference |
195
+ | `ng-forge://validators` | Validator reference |
196
+ | `ng-forge://ui-adapters` | UI library configurations |
197
+ | `ng-forge://docs` | Full documentation index |
198
+
199
+ ## Development
200
+
201
+ ### Building
202
+
203
+ ```bash
204
+ nx build dynamic-form-mcp
205
+ ```
206
+
207
+ ### Testing
208
+
209
+ ```bash
210
+ nx test dynamic-form-mcp
211
+ ```
212
+
213
+ ### Generating Registry
214
+
215
+ ```bash
216
+ nx run dynamic-form-mcp:generate-registry
217
+ ```
218
+
219
+ ## License
220
+
221
+ MIT
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ng-forge MCP Server CLI
4
+ *
5
+ * This is the entry point for the MCP server when invoked via npx or as a CLI tool.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=ng-forge-mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-mcp.d.ts","sourceRoot":"","sources":["../../../../packages/dynamic-form-mcp/bin/ng-forge-mcp.ts"],"names":[],"mappings":";AACA;;;;GAIG"}