@dforge-core/dforge-mcp 0.1.0-rc.4 → 0.1.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -73
- package/docs/creating-modules.md +145 -0
- package/package.json +2 -1
- package/skills/dforge-mcp-author/SKILL.md +8 -5
package/README.md
CHANGED
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
# @dforge-core/dforge-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for dForge module authoring. Exposes
|
|
3
|
+
MCP server for dForge module authoring. Exposes 18 composable tools and the canonical schemas so AI agents (Claude Code, Cursor, Zed, etc.) can drive the full module lifecycle — scaffold → entities → actions → views → security → install — through structured tool calls instead of free-form JSON generation.
|
|
4
4
|
|
|
5
5
|
Ships with a wizard Skill (`skills/dforge-mcp-author/SKILL.md`) that walks the AI through six phases with explicit backtrack support when later phases expose earlier gaps.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**New here?** Start with **[docs/creating-modules.md](docs/creating-modules.md)** — three ways to scaffold a module (terminal CLI, VS Code sidebar, AI wizard) and when to pick each.
|
|
8
|
+
|
|
9
|
+
> **Two GitHub repos to know:** this MCP server lives at `dforge-core/dforge-mcp`. The dForge platform itself (entities, validator, native CLI source) lives at `iash44/dForge-core` — referenced in `homepage` because the schemas + DSL conventions come from there.
|
|
10
|
+
|
|
11
|
+
## What it depends on at runtime
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
your AI editor (Claude Code / Cursor / Zed)
|
|
15
|
+
│
|
|
16
|
+
▼ stdio JSON-RPC
|
|
17
|
+
@dforge-core/dforge-mcp ← this package; pure JS / TS
|
|
18
|
+
│
|
|
19
|
+
▼ shells out for pack / install
|
|
20
|
+
@dforge-core/dforge-cli ← installed as a transitive dep; thin JS wrapper
|
|
21
|
+
│
|
|
22
|
+
▼ optionalDependencies
|
|
23
|
+
@dforge-core/dforge-cli-<platform> ← native C# binary per platform (~35 MB)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The native binary actually talks to your tenant. The npm-CLI wrapper is just a launcher that picks the right platform binary and exec's it. **You don't need to install dforge-cli separately** — it comes along when you install dforge-mcp (or when `npx -y @dforge-core/dforge-mcp` runs cold).
|
|
27
|
+
|
|
28
|
+
If you want to use a hand-built native binary instead of the npm-shipped one, point `DFORGE_CLI_BINARY` at the executable file's absolute path:
|
|
8
29
|
|
|
9
30
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
31
|
+
DFORGE_CLI_BINARY=/Users/me/projects/dForge-core/cli/bin/dForge.Cli
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
(macOS / Linux: no extension. Windows: `dForge.Cli.exe`.) If the path doesn't exist or isn't executable the server reports an error at the first pack/install call.
|
|
35
|
+
|
|
36
|
+
## Install + wire into Claude Code
|
|
12
37
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
38
|
+
### Recommended — via `claude mcp add` (writes ~/.claude.json for you)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
claude mcp add dforge --scope user -- npx -y @dforge-core/dforge-mcp
|
|
16
42
|
```
|
|
17
43
|
|
|
18
|
-
|
|
44
|
+
This appends to `~/.claude.json` (the global config — single file in your home dir, no subdirectory). Restart Claude Code; on the first session that activates the server you'll see "Approve MCP server 'dforge'?" — accept it.
|
|
19
45
|
|
|
20
|
-
###
|
|
46
|
+
### Manual — per-project
|
|
21
47
|
|
|
22
|
-
|
|
48
|
+
Write `.mcp.json` at **the repo root** (not under `.claude/`):
|
|
23
49
|
|
|
24
50
|
```json
|
|
25
51
|
{
|
|
@@ -28,40 +54,49 @@ Add to `~/.claude/config.json` (or the project-local `.claude/mcp.json`):
|
|
|
28
54
|
"command": "npx",
|
|
29
55
|
"args": ["-y", "@dforge-core/dforge-mcp"],
|
|
30
56
|
"env": {
|
|
31
|
-
"DFORGE_CLI_BINARY": "/optional/path/to/dForge.Cli"
|
|
57
|
+
"DFORGE_CLI_BINARY": "/optional/abs/path/to/dForge.Cli"
|
|
32
58
|
}
|
|
33
59
|
}
|
|
34
60
|
}
|
|
35
61
|
}
|
|
36
62
|
```
|
|
37
63
|
|
|
38
|
-
|
|
64
|
+
Restart Claude Code → approve on first prompt.
|
|
65
|
+
|
|
66
|
+
### Verify it's alive
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude mcp list
|
|
70
|
+
# Should show: dforge — npx -y @dforge-core/dforge-mcp — connected
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or inside a Claude Code session, type `/mcp` to see all connected servers + their tools. The 18 `dforge_*` tools should be listed.
|
|
39
74
|
|
|
40
75
|
### Cursor / Zed
|
|
41
76
|
|
|
42
|
-
Same
|
|
77
|
+
Same `command + args` config shape; check their docs for the file location. Verification is via their respective tool listings.
|
|
43
78
|
|
|
44
79
|
## What it exposes
|
|
45
80
|
|
|
46
81
|
### Tools (18)
|
|
47
82
|
|
|
48
|
-
Grouped by typical phase in the wizard flow. All return
|
|
83
|
+
Grouped by typical phase in the wizard flow. All "return" tools emit `{ summary, files: { '<relPath>': '<contents>' } }`; the client decides whether to write — lets the AI preview diffs with the user before committing.
|
|
49
84
|
|
|
50
85
|
**Module-level**
|
|
51
86
|
| Tool | Behavior |
|
|
52
87
|
|---|---|
|
|
53
|
-
| `dforge_module_create` | New module scaffold
|
|
54
|
-
| `dforge_module_inspect` | Read current module state
|
|
88
|
+
| `dforge_module_create` | New module scaffold |
|
|
89
|
+
| `dforge_module_inspect` | Read current module state. Full structured data is in `files["_inspect.json"]`; `summary` is one-line stats |
|
|
55
90
|
| `dforge_module_pack` | Shells to `dforge-cli module pack`. Returns tarball path + size |
|
|
56
|
-
| `dforge_module_install` | Shells to `dforge-cli module install`.
|
|
91
|
+
| `dforge_module_install` | Shells to `dforge-cli module install`. Args: `pathOrTarball`, optional `tenantUrl` / `token` / `tenantCode` — fall back to `DFORGE_URL` / `DFORGE_TOKEN` env. `tenantCode` is an optional `--code` sanity check the server cross-references against the JWT |
|
|
57
92
|
|
|
58
93
|
**Entities (Phase 1)**
|
|
59
94
|
| Tool | Behavior |
|
|
60
95
|
|---|---|
|
|
61
96
|
| `dforge_entity_add` | Add an entity to an existing module |
|
|
62
|
-
| `dforge_entity_field_add` | Patch a single field
|
|
97
|
+
| `dforge_entity_field_add` | Patch a single field |
|
|
63
98
|
| `dforge_entity_field_modify` | Replace a field's spec |
|
|
64
|
-
| `dforge_entity_field_remove` | Drop a field (warns about
|
|
99
|
+
| `dforge_entity_field_remove` | Drop a field (warns about dependents) |
|
|
65
100
|
|
|
66
101
|
**Behavior (Phase 2 — optional)**
|
|
67
102
|
| Tool | Behavior |
|
|
@@ -73,81 +108,79 @@ Grouped by typical phase in the wizard flow. All return-not-write tools emit a `
|
|
|
73
108
|
|---|---|
|
|
74
109
|
| `dforge_view_add` | Add a data view |
|
|
75
110
|
| `dforge_view_modify` | Replace a view's spec |
|
|
76
|
-
| `dforge_report_add` | Add a report
|
|
77
|
-
| `dforge_setting_add` | Configurable module-level setting
|
|
111
|
+
| `dforge_report_add` | Add a report |
|
|
112
|
+
| `dforge_setting_add` | Configurable module-level setting |
|
|
78
113
|
|
|
79
114
|
**Security (Phase 5)**
|
|
80
115
|
| Tool | Behavior |
|
|
81
116
|
|---|---|
|
|
82
|
-
| `dforge_role_add` | Add a role +
|
|
83
|
-
| `dforge_role_right_set` | Grant/revoke
|
|
84
|
-
| `dforge_folder_add` | Add a security folder
|
|
117
|
+
| `dforge_role_add` | Add a role + rights matrix. **Fails if role already exists** — the scaffolder pre-creates `<code>.admin`, so use `role_right_set` to amend it instead |
|
|
118
|
+
| `dforge_role_right_set` | Grant/revoke one right on one object (cheap backtrack) |
|
|
119
|
+
| `dforge_folder_add` | Add a security folder (optional — most modules ship with just root) |
|
|
85
120
|
|
|
86
121
|
**Cross-cutting**
|
|
87
122
|
| Tool | Behavior |
|
|
88
123
|
|---|---|
|
|
89
|
-
| `dforge_dependency_add` | Add a dep on another dForge module
|
|
90
|
-
| `dforge_dbml_import` | Stub
|
|
124
|
+
| `dforge_dependency_add` | Add a dep on another dForge module |
|
|
125
|
+
| `dforge_dbml_import` | Stub — not implemented yet |
|
|
91
126
|
|
|
92
127
|
### Resources (13)
|
|
93
128
|
|
|
94
|
-
Read-only context. Pull these into the conversation at session start; the wizard Skill instructs the AI to consult schemas before emitting files of each kind.
|
|
95
|
-
|
|
96
129
|
| URI | Content |
|
|
97
130
|
|---|---|
|
|
98
|
-
| `dforge://schema/manifest` | JSON Schema
|
|
99
|
-
| `dforge://schema/entity` |
|
|
100
|
-
| `dforge://schema/data-views` |
|
|
101
|
-
| `dforge://schema/folders` |
|
|
102
|
-
| `dforge://schema/menus` |
|
|
103
|
-
| `dforge://schema/roles` |
|
|
104
|
-
| `dforge://schema/jobs` |
|
|
105
|
-
| `dforge://schema/seed-data` |
|
|
106
|
-
| `dforge://schema/reports` |
|
|
107
|
-
| `dforge://schema/settings` |
|
|
108
|
-
| `dforge://schema/traits` |
|
|
109
|
-
| `dforge://schema/webhooks` |
|
|
110
|
-
| `dforge://docs/conventions` | MODULE_CONVENTIONS.md
|
|
111
|
-
|
|
112
|
-
Schemas + conventions are vendored at build time from `dForge-core
|
|
131
|
+
| `dforge://schema/manifest` | manifest.json JSON Schema |
|
|
132
|
+
| `dforge://schema/entity` | entity files |
|
|
133
|
+
| `dforge://schema/data-views` | ui/data_views.json |
|
|
134
|
+
| `dforge://schema/folders` | ui/folders.json |
|
|
135
|
+
| `dforge://schema/menus` | ui/menus.json |
|
|
136
|
+
| `dforge://schema/roles` | security/roles.json |
|
|
137
|
+
| `dforge://schema/jobs` | logic/jobs.json |
|
|
138
|
+
| `dforge://schema/seed-data` | seed-data/*.json |
|
|
139
|
+
| `dforge://schema/reports` | ui/reports.json |
|
|
140
|
+
| `dforge://schema/settings` | settings.json |
|
|
141
|
+
| `dforge://schema/traits` | entity trait codes |
|
|
142
|
+
| `dforge://schema/webhooks` | ui/webhooks.json |
|
|
143
|
+
| `dforge://docs/conventions` | MODULE_CONVENTIONS.md |
|
|
144
|
+
|
|
145
|
+
Schemas + conventions are vendored at build time from `iash44/dForge-core`'s `docs/`. The published npm tarball ships them under `resources/`, and jsdelivr serves them at:
|
|
113
146
|
|
|
114
147
|
```
|
|
115
148
|
https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas/<name>.schema.json
|
|
116
149
|
```
|
|
117
150
|
|
|
118
|
-
|
|
151
|
+
**Compatibility:** schemas vendored for this release came from `iash44/dForge-core` `main` as of the publish date stamped in `package.json`. If the platform adds new entity properties / field types after this release, generated modules using those features may validate locally but be rejected at install time. Bump the dforge-mcp version when the platform schemas change materially.
|
|
119
152
|
|
|
120
153
|
## Claude Skill — the wizard
|
|
121
154
|
|
|
122
|
-
`skills/dforge-mcp-author/SKILL.md` teaches
|
|
155
|
+
`skills/dforge-mcp-author/SKILL.md` teaches Claude how to drive the tools as a six-phase wizard. **It is NOT auto-installed by `npm install` — the Skill file ships in the npm tarball but Claude Code looks for Skills in `~/.claude/skills/`, not in node_modules.** Sync it manually:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# from the published npm tarball
|
|
159
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author
|
|
160
|
+
curl -fsSL https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/skills/dforge-mcp-author/SKILL.md \
|
|
161
|
+
-o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
162
|
+
|
|
163
|
+
# or from this repo
|
|
164
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author
|
|
165
|
+
curl -fsSL https://raw.githubusercontent.com/dforge-core/dforge-mcp/main/skills/dforge-mcp-author/SKILL.md \
|
|
166
|
+
-o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Re-run after every dforge-mcp upgrade — the Skill version isn't checked at runtime, so a stale Skill against new tools will misroute calls.
|
|
170
|
+
|
|
171
|
+
The phases:
|
|
123
172
|
|
|
124
173
|
| Phase | Required? | Tools used |
|
|
125
174
|
|---|---|---|
|
|
126
|
-
| 0. Intake | yes | (
|
|
127
|
-
| 1. Domain
|
|
175
|
+
| 0. Intake | yes | (brief written manually) |
|
|
176
|
+
| 1. Domain | yes | `module_create`, `entity_add`, `entity_field_*` |
|
|
128
177
|
| 2. Actions | optional | `action_add` |
|
|
129
|
-
| 3. Views + Reports | views yes, reports optional | `
|
|
178
|
+
| 3. Views + Reports | views yes, reports optional | `view_*`, `report_add`, `setting_add` |
|
|
130
179
|
| 4. Polish (translations, seed) | optional | (file map authored directly) |
|
|
131
180
|
| 5. Security | roles required, folders optional | `role_add`, `role_right_set`, `folder_add` |
|
|
132
181
|
| 6. Verify | yes | `module_pack`, `module_install` |
|
|
133
182
|
|
|
134
|
-
|
|
135
|
-
- **Inspect before patch.** `module_inspect` is the first call in any session that touches an existing module.
|
|
136
|
-
- **One thing at a time.** Loop per-entity / per-view / per-role, not batch dumps.
|
|
137
|
-
- **Backtrack protocol.** When a later phase exposes a gap from earlier, the AI stops, names the issue, gets user sign-off, patches via the smallest tool that fits, propagates forward.
|
|
138
|
-
- **Changelog.** Each backtrack appends to `_brief/changelog.md` so the user has a paper trail.
|
|
139
|
-
- **Verify-or-it-didn't-happen.** Phase 6 install is non-skippable — it's the only true validator.
|
|
140
|
-
|
|
141
|
-
**To enable the Skill in Claude Code:**
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
mkdir -p ~/.claude/skills/dforge-mcp-author
|
|
145
|
-
curl -fsSL https://raw.githubusercontent.com/dforge-core/dforge-mcp/main/skills/dforge-mcp-author/SKILL.md \
|
|
146
|
-
-o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
147
|
-
# or project-local:
|
|
148
|
-
mkdir -p .claude/skills/dforge-mcp-author
|
|
149
|
-
cp <repo>/skills/dforge-mcp-author/SKILL.md .claude/skills/dforge-mcp-author/
|
|
150
|
-
```
|
|
183
|
+
Key principles encoded in the Skill: inspect-before-patch, one-at-a-time, deterministic backtrack on earliest-phase-first rule, tool-failure protocol that distinguishes auth/connectivity from module defects, end-of-session cleanup user-driven.
|
|
151
184
|
|
|
152
185
|
## For maintainers
|
|
153
186
|
|
|
@@ -157,15 +190,15 @@ cp <repo>/skills/dforge-mcp-author/SKILL.md .claude/skills/dforge-mcp-author/
|
|
|
157
190
|
pnpm install
|
|
158
191
|
pnpm build # tsup → dist/server.js (bundles SDK + zod + dforge-cli/templates)
|
|
159
192
|
pnpm typecheck # tsc --noEmit
|
|
160
|
-
node dist/server.js #
|
|
193
|
+
node dist/server.js # stdio JSON-RPC — pipe a request to smoke-test
|
|
161
194
|
```
|
|
162
195
|
|
|
163
|
-
To iterate against an in-tree `dforge-cli`, temporarily
|
|
196
|
+
To iterate against an in-tree `dforge-cli`, temporarily pin the dep at the sibling path:
|
|
164
197
|
|
|
165
198
|
```bash
|
|
166
|
-
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.1.0"|"@dforge-core/dforge-cli": "file:../dforge-cli"|' package.json
|
|
199
|
+
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.1.[0-9.]*"|"@dforge-core/dforge-cli": "file:../dforge-cli"|' package.json
|
|
167
200
|
rm -rf node_modules pnpm-lock.yaml && pnpm install
|
|
168
|
-
# Flip back before publish
|
|
201
|
+
# Flip back before publish — file: deps don't resolve for npm consumers.
|
|
169
202
|
```
|
|
170
203
|
|
|
171
204
|
### Refresh vendored resources
|
|
@@ -177,21 +210,27 @@ scripts/vendor-resources.sh # auto-locate ../dForge
|
|
|
177
210
|
DFORGE_CORE=/abs/path/to/dForge-core scripts/vendor-resources.sh
|
|
178
211
|
```
|
|
179
212
|
|
|
180
|
-
|
|
213
|
+
Republish to update jsdelivr-served schemas + the bundled resources.
|
|
181
214
|
|
|
182
|
-
### Publishing
|
|
215
|
+
### Publishing
|
|
183
216
|
|
|
184
217
|
```bash
|
|
185
218
|
scripts/publish.sh 0.1.0-rc.N --tag latest --otp <code>
|
|
186
219
|
```
|
|
187
220
|
|
|
188
|
-
`prepublishOnly` runs `tsup` so the
|
|
221
|
+
`prepublishOnly` runs `tsup` so the tarball gets a fresh `dist/server.js`. No platform binaries to manage.
|
|
222
|
+
|
|
223
|
+
**Pre-publish checklist:**
|
|
224
|
+
- [ ] `@dforge-core/dforge-cli` dep is a real version (not `file:...`)
|
|
225
|
+
- [ ] `pnpm typecheck` passes
|
|
226
|
+
- [ ] Smoke test stdio: `tools/list` returns 18 tools
|
|
227
|
+
- [ ] Skill updated for any new/changed tools (it's a SEPARATE artifact; users sync it manually after upgrades)
|
|
189
228
|
|
|
190
229
|
### Adding a new tool
|
|
191
230
|
|
|
192
231
|
1. Drop it in `src/tools/<name>.ts`. Use shared helpers from `src/tools/_helpers.ts` (`loadManifest`, `readJsonOrDefault`, `jsonText`, `makeResult`, `withTodayStamp`). Return a `ToolResult`.
|
|
193
232
|
2. Import + register in `src/server.ts` via the `envelope()` wrapper.
|
|
194
|
-
3. Mention it in
|
|
233
|
+
3. Mention it in `skills/dforge-mcp-author/SKILL.md` (which phase, which backtrack scenarios use it).
|
|
195
234
|
4. Bump `package.json` version, publish.
|
|
196
235
|
|
|
197
236
|
Conventions:
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Creating a dForge module — three paths
|
|
2
|
+
|
|
3
|
+
dForge gives you three ways to scaffold and author a module. They all produce the same canonical file structure; pick by how much hand-holding you want.
|
|
4
|
+
|
|
5
|
+
| Path | Driver | Best for |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| [1. Terminal CLI](#path-1--terminal-manual-dforge-cli-init-module) | you, typing | you know what you're building, just want the skeleton |
|
|
8
|
+
| [2. VS Code sidebar](#path-2--vs-code-sidebar-manual) | you, clicking | same as #1 but launched from a button |
|
|
9
|
+
| [3. AI co-pilot wizard](#path-3--ai-co-pilot-wizard-driven) | Claude Code / Cursor / Zed via `dforge-mcp` | you want help designing entities + security |
|
|
10
|
+
|
|
11
|
+
## Path 1 — Terminal, manual (`dforge-cli init module`)
|
|
12
|
+
|
|
13
|
+
Pure CLI. Prompts for the basics, writes a minimal scaffold, leaves you to fill in fields / views / roles in your editor.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx -y @dforge-core/dforge-cli init module ./my-module
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You'll be asked for:
|
|
20
|
+
- module `code` (lowercase, hyphen/underscore, e.g. `feedback`)
|
|
21
|
+
- display name
|
|
22
|
+
- description, author, license, version, db schema version
|
|
23
|
+
- dependencies (defaults to `admin` + `metadata`)
|
|
24
|
+
- preset (Minimal / Minimal + add more entities interactively / Full template)
|
|
25
|
+
- first entity name + label + traits (identity vs identity+audit)
|
|
26
|
+
|
|
27
|
+
Output: ~10 files including `manifest.json`, `entities/<name>.json` (stub), `ui/{data_views,folders,menus,actions}.json`, `security/roles.json`, `.gitignore`, plus `.vscode/settings.json` + `.zed/settings.json` that bind the JSON schemas for inline validation.
|
|
28
|
+
|
|
29
|
+
After scaffolding, open the directory in VS Code (with [the dForge extension](https://github.com/dforge-core/dforge-editor-support) installed) and start adding fields — schemas validate in real time.
|
|
30
|
+
|
|
31
|
+
## Path 2 — VS Code sidebar, manual
|
|
32
|
+
|
|
33
|
+
Same scaffold as Path 1, just launched from a button instead of the terminal.
|
|
34
|
+
|
|
35
|
+
1. Click the dForge `d` icon in the activity bar.
|
|
36
|
+
2. Click the `+` button next to "Modules" view title.
|
|
37
|
+
3. Pick a parent folder + module name in the prompts.
|
|
38
|
+
4. The extension shells out to `npx -y @dforge-core/dforge-cli init module …` in the dForge terminal — same questions as Path 1.
|
|
39
|
+
5. Module appears in the sidebar tree once written; click any file to open it.
|
|
40
|
+
|
|
41
|
+
Sidebar also gives you right-click commands: **Pack Module**, **Install Module to Tenant**, **Validate Module (schemas)** — all wrappers around `dforge-cli`.
|
|
42
|
+
|
|
43
|
+
## Path 3 — AI co-pilot, wizard-driven
|
|
44
|
+
|
|
45
|
+
Claude Code (or Cursor / Zed) with `dforge-mcp` connected. You describe what you want; the AI walks you through six phases via MCP tool calls, pausing at each gate for your approval.
|
|
46
|
+
|
|
47
|
+
Setup once:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
claude mcp add dforge --scope user -- npx -y @dforge-core/dforge-mcp
|
|
51
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author
|
|
52
|
+
curl -fsSL https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/skills/dforge-mcp-author/SKILL.md \
|
|
53
|
+
-o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Restart Claude Code, approve the MCP server on first prompt, then in a new conversation:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
You: "I want a module to collect end-user feedback on app pages."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The wizard runs:
|
|
63
|
+
|
|
64
|
+
### Phase 0 — Intake (required, ~1 turn)
|
|
65
|
+
|
|
66
|
+
Four questions in one message: purpose / users / dependencies / language scope.
|
|
67
|
+
You can accept defaults to move fast. Writes `_brief/00-intake.md`.
|
|
68
|
+
|
|
69
|
+
### Phase 1 — Domain (required, looping)
|
|
70
|
+
|
|
71
|
+
1. Proposes an entity inventory (list of names + one-liners). Get user sign-off.
|
|
72
|
+
2. Calls `dforge_module_create` → previews the file map → you approve → AI writes files.
|
|
73
|
+
3. Per-entity loop: proposes fields, calls `dforge_entity_field_add` per field. Batches obvious scalar fields; one-at-a-time for refs/formulas/nullable-ambiguous.
|
|
74
|
+
4. Extension entities last (those with `extends: "module.entity"`).
|
|
75
|
+
|
|
76
|
+
### Phase 2 — Actions (optional)
|
|
77
|
+
|
|
78
|
+
Asks if any business-logic operations need a DSL script. Skipped for pure CRUD modules. When needed: `dforge_action_add` per action, full DSL body composed by the AI.
|
|
79
|
+
|
|
80
|
+
### Phase 3 — Views (required) + Reports (optional)
|
|
81
|
+
|
|
82
|
+
- **3a (first):** ensures every entity has a default grid via `dforge_view_add` / `view_modify`.
|
|
83
|
+
- **3b (only after 3a):** proposes specialized views (kanban / calendar / list / tree-grid / master-detail) **only when an objective trigger fires** — user explicitly asked, or status field has 3+ values, or required date field for scheduling, etc.
|
|
84
|
+
- **3c (optional):** reports for aggregation/grouping the views don't cover.
|
|
85
|
+
|
|
86
|
+
### Phase 4 — Polish (mostly optional)
|
|
87
|
+
|
|
88
|
+
Settings (`dforge_setting_add`), translations, seed data — only if intake declared a need.
|
|
89
|
+
|
|
90
|
+
### Phase 5 — Security
|
|
91
|
+
|
|
92
|
+
- **5a (required):** inspects scaffolded `<code>.admin` role; adds extra roles via `dforge_role_add` for each additional user group from intake; amends admin via `dforge_role_right_set` for action/report grants.
|
|
93
|
+
- **5b (optional):** security folders with row-level filters via `dforge_folder_add` — only when intake says data must be partitioned per folder.
|
|
94
|
+
|
|
95
|
+
### Phase 6 — Verify (required, non-skippable)
|
|
96
|
+
|
|
97
|
+
1. `dforge_module_pack` → `.dforge` tarball.
|
|
98
|
+
2. `dforge_module_install` against your tenant (uses `DFORGE_URL` / `DFORGE_TOKEN` env or arg fallbacks). Runs the full server-side validator — the only real validator.
|
|
99
|
+
3. On failure, the AI follows the **backtrack protocol**: stops, names the issue, identifies the earliest broken phase, asks for sign-off, patches with the smallest tool that fits, re-inspects, resumes.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Behind the scenes (same for all three paths)
|
|
104
|
+
|
|
105
|
+
All three paths produce the same canonical structure:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
my-module/
|
|
109
|
+
├── manifest.json # module metadata
|
|
110
|
+
├── entities/<entity>.json # one file per entity
|
|
111
|
+
├── ui/
|
|
112
|
+
│ ├── data_views.json # grids, kanbans, calendars, etc.
|
|
113
|
+
│ ├── folders.json # navigation + security boundaries
|
|
114
|
+
│ ├── menus.json # left-side nav
|
|
115
|
+
│ ├── actions.json # action registry (DSL files live in logic/actions/)
|
|
116
|
+
│ └── reports.json # report definitions (only if you have any)
|
|
117
|
+
├── security/
|
|
118
|
+
│ └── roles.json # role → rights matrix
|
|
119
|
+
├── logic/
|
|
120
|
+
│ ├── actions/<name>.dsl # one DSL file per action
|
|
121
|
+
│ └── jobs.json # scheduled jobs (only if you have any)
|
|
122
|
+
├── settings.json # module-level settings (folder-scoped at runtime)
|
|
123
|
+
├── seed-data/ # rows inserted at install time (optional)
|
|
124
|
+
├── translations/<locale>.json # i18n (only if non-English locales declared)
|
|
125
|
+
├── .vscode/settings.json # auto-binds JSON schemas → red squigglies on bad JSON
|
|
126
|
+
└── .zed/settings.json # same for Zed
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
VS Code with the [dForge extension](https://github.com/dforge-core/dforge-editor-support) installed validates every JSON file against its schema as you edit, regardless of which path created the files. Pack and install commands work the same way from any path.
|
|
130
|
+
|
|
131
|
+
## Quick decision tree
|
|
132
|
+
|
|
133
|
+
| Goal | Path |
|
|
134
|
+
|---|---|
|
|
135
|
+
| "I know what I want, give me the skeleton" | **Path 1 or 2** |
|
|
136
|
+
| "I want help designing entities + the security model" | **Path 3** — the wizard |
|
|
137
|
+
| "I want to extend an EXISTING module" | **Path 3** — the wizard's patch tools (`entity_field_add`, `role_right_set`, etc.) plus the backtrack protocol shine here |
|
|
138
|
+
| "I'm in a terminal-only environment (SSH, remote box)" | **Path 1** |
|
|
139
|
+
| "I want zero typing" | **Path 2** or **Path 3** |
|
|
140
|
+
|
|
141
|
+
## Going further
|
|
142
|
+
|
|
143
|
+
- [SKILL.md](../skills/dforge-mcp-author/SKILL.md) — the full wizard spec the AI follows, including the deterministic backtrack protocol, multi-trigger priority rule, tool-failure protocol, and resume-from-partial-state support
|
|
144
|
+
- [README.md](../README.md) — full tool reference (18 tools, 13 resources) + maintainer docs
|
|
145
|
+
- [iash44/dForge-core](https://github.com/iash44/dForge-core) — the platform itself: source of truth for the schemas + DSL conventions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dforge-core/dforge-mcp",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.6",
|
|
4
4
|
"description": "MCP server for dForge module authoring. Exposes scaffold/pack/install tools and schema resources so AI agents (Claude Code, Cursor, Zed) can create and ship dForge modules.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/iash44/dForge-core",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist/",
|
|
16
|
+
"docs/",
|
|
16
17
|
"resources/",
|
|
17
18
|
"skills/",
|
|
18
19
|
"README.md"
|
|
@@ -13,7 +13,7 @@ The phase column below indicates the **typical** use. During a backtrack, the ba
|
|
|
13
13
|
|
|
14
14
|
| Tool | Typical phase | What it does |
|
|
15
15
|
|---|---|---|
|
|
16
|
-
| `dforge_module_inspect` | any | Read current module state. **Read-only** —
|
|
16
|
+
| `dforge_module_inspect` | any | Read current module state. **Read-only** — output does NOT require user confirmation. The one-line `summary` is for the user; the full structured state lives in `files["_inspect.json"]` (entities + their fields, views + their data sources, roles + rights matrix, actions, reports, settings, folders tree). Parse `_inspect.json` before planning patches — don't rely on summary text alone. |
|
|
17
17
|
| `dforge_module_create` | 1 | Scaffold a new module (returns file map; user writes) |
|
|
18
18
|
| `dforge_entity_add` | 1 | Add a whole entity to an existing module |
|
|
19
19
|
| `dforge_entity_field_add` | 1 | Patch one field onto an existing entity |
|
|
@@ -121,7 +121,9 @@ When the user has a real business operation: read the DSL reference section of `
|
|
|
121
121
|
|
|
122
122
|
### 3a. Default grids (required, do FIRST)
|
|
123
123
|
|
|
124
|
-
For every entity in the manifest, call `dforge_view_add` with `viewType: "grid"` and `dataSources: [{ entityCode: <entity>, columns: [...] }]`.
|
|
124
|
+
For every entity in the manifest, call `dforge_view_add` with `viewType: "grid"` and `dataSources: [{ entityCode: <entity>, columns: [...] }]`.
|
|
125
|
+
|
|
126
|
+
**View naming.** View codes in `ui/data_views.json` are semantic — convention is the entity name (`feedback_item`), the plural (`invoices`), or descriptive (`invoices_kanban`, `feedback_by_status`). Do NOT use the literal code `default`. When `ui/folders.json` entities reference `viewName: "default"`, the platform resolves that to the entity's first view declared in `data_views.json` — it's a fallback alias, not a required view code. (The scaffolder already wrote a default grid keyed by entity code in Phase 1, so often you'll `view_modify` it rather than `view_add`.)
|
|
125
127
|
|
|
126
128
|
**Do not propose any specialized view until every entity has its default grid.**
|
|
127
129
|
|
|
@@ -159,9 +161,10 @@ Add reports only when management aggregation/grouping isn't covered by views. `d
|
|
|
159
161
|
|
|
160
162
|
### 5a. Roles + rights matrix (required)
|
|
161
163
|
|
|
162
|
-
1.
|
|
163
|
-
2.
|
|
164
|
-
3.
|
|
164
|
+
1. **Inspect first.** Run `dforge_module_inspect` and read the `roles` array. The scaffolder pre-creates `<code>.admin` with `SIUDC` on every entity declared at scaffold time. That role exists already — don't try to re-create it.
|
|
165
|
+
2. Inventory roles. Default for simple modules: the existing `<code>.admin` covers admins; add one role per additional user group from intake (e.g. `<code>.user`, `<code>.viewer`).
|
|
166
|
+
3. Show the rights matrix as a table (rows = entities/actions/reports, columns = roles, cells = rights string). Get user sign-off.
|
|
167
|
+
4. **For new roles**: call `dforge_role_add`. **For amending existing roles** (the scaffolded admin, or grants on actions/reports added in Phases 2-3 that aren't yet in any role): call `dforge_role_right_set` per grant — it's the smallest tool and doesn't conflict with the scaffolded admin role. Calling `dforge_role_add` against an existing role code fails — use `role_right_set` to amend instead.
|
|
165
168
|
|
|
166
169
|
**Rights semantics** (additive — multiple roles UNION, never revoke):
|
|
167
170
|
- Entities: any subset of `SIUDC` (Select / Insert / Update / Delete / Clone)
|