@dforge-core/dforge-mcp 0.1.0-rc.2 → 0.1.0-rc.4
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 +122 -37
- package/dist/server.js +12471 -1943
- package/package.json +4 -4
- package/resources/schemas/data-views.schema.json +52 -1
- package/resources/schemas/entity.schema.json +1 -2
- package/resources/schemas/folders.schema.json +56 -15
- package/resources/schemas/manifest.schema.json +49 -3
- package/resources/schemas/menus.schema.json +1 -1
- package/resources/schemas/reports.schema.json +221 -0
- package/resources/schemas/settings.schema.json +55 -0
- package/skills/dforge-mcp-author/SKILL.md +186 -66
package/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# @dforge-core/dforge-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for dForge module authoring. Exposes scaffold
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
of free-form JSON generation.
|
|
3
|
+
MCP server for dForge module authoring. Exposes a small set of 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
|
+
|
|
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.
|
|
7
6
|
|
|
8
7
|
## Install
|
|
9
8
|
|
|
@@ -36,48 +35,119 @@ Add to `~/.claude/config.json` (or the project-local `.claude/mcp.json`):
|
|
|
36
35
|
}
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
`DFORGE_CLI_BINARY` is only needed if you want `dforge_module_pack` /
|
|
40
|
-
`dforge_module_install` to use a non-published native binary (e.g. a
|
|
41
|
-
local C# build). Otherwise the server uses whatever `dforge-cli` is on
|
|
42
|
-
PATH (install via `npm install -g @dforge-core/dforge-cli`).
|
|
38
|
+
`DFORGE_CLI_BINARY` is only needed if you want `dforge_module_pack` / `dforge_module_install` to use a non-published native binary (e.g. a local C# build). Otherwise the server uses whatever `dforge-cli` is on PATH (install via `npm install -g @dforge-core/dforge-cli`, or let npx fetch it on demand).
|
|
43
39
|
|
|
44
40
|
### Cursor / Zed
|
|
45
41
|
|
|
46
|
-
Same shape — both editors take a `command + args` MCP config. Refer to
|
|
47
|
-
their docs for the exact file path.
|
|
42
|
+
Same shape — both editors take a `command + args` MCP config. Refer to their docs for the exact file path.
|
|
48
43
|
|
|
49
44
|
## What it exposes
|
|
50
45
|
|
|
51
|
-
### Tools
|
|
46
|
+
### Tools (18)
|
|
47
|
+
|
|
48
|
+
Grouped by typical phase in the wizard flow. All return-not-write tools emit a `{ summary, files: { '<relPath>': '<contents>' } }` map; the client decides whether to write the files (lets the AI preview diffs with the user before committing).
|
|
49
|
+
|
|
50
|
+
**Module-level**
|
|
51
|
+
| Tool | Behavior |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `dforge_module_create` | New module scaffold — file map for the client to write |
|
|
54
|
+
| `dforge_module_inspect` | Read current module state from disk; returns structured summary of entities, views, roles, actions, etc. Call this BEFORE any patch |
|
|
55
|
+
| `dforge_module_pack` | Shells to `dforge-cli module pack`. Returns tarball path + size |
|
|
56
|
+
| `dforge_module_install` | Shells to `dforge-cli module install`. Runs the full server-side validator — the only real validator |
|
|
57
|
+
|
|
58
|
+
**Entities (Phase 1)**
|
|
59
|
+
| Tool | Behavior |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `dforge_entity_add` | Add an entity to an existing module |
|
|
62
|
+
| `dforge_entity_field_add` | Patch a single field onto an existing entity |
|
|
63
|
+
| `dforge_entity_field_modify` | Replace a field's spec |
|
|
64
|
+
| `dforge_entity_field_remove` | Drop a field (warns about dependent views / roles / formulas) |
|
|
65
|
+
|
|
66
|
+
**Behavior (Phase 2 — optional)**
|
|
67
|
+
| Tool | Behavior |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `dforge_action_add` | DSL script + `ui/actions.json` entry |
|
|
52
70
|
|
|
71
|
+
**Views + reports (Phase 3)**
|
|
53
72
|
| Tool | Behavior |
|
|
54
73
|
|---|---|
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `dforge_dbml_import` | Stub. Returns "not yet implemented" until the underlying CLI command lands. |
|
|
74
|
+
| `dforge_view_add` | Add a data view |
|
|
75
|
+
| `dforge_view_modify` | Replace a view's spec |
|
|
76
|
+
| `dforge_report_add` | Add a report (layout + datasets + parameters) |
|
|
77
|
+
| `dforge_setting_add` | Configurable module-level setting (folder-scoped at runtime) |
|
|
60
78
|
|
|
61
|
-
|
|
79
|
+
**Security (Phase 5)**
|
|
80
|
+
| Tool | Behavior |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `dforge_role_add` | Add a role + per-object rights matrix |
|
|
83
|
+
| `dforge_role_right_set` | Grant/revoke a single right on a single object (cheap backtrack) |
|
|
84
|
+
| `dforge_folder_add` | Add a security folder under root or a parent path (optional — most modules ship with just the root) |
|
|
62
85
|
|
|
63
|
-
|
|
86
|
+
**Cross-cutting**
|
|
87
|
+
| Tool | Behavior |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `dforge_dependency_add` | Add a dep on another dForge module (supports the `{ version, entities }` partial-coupling form) |
|
|
90
|
+
| `dforge_dbml_import` | Stub. Returns "not yet implemented" until the underlying CLI command lands |
|
|
91
|
+
|
|
92
|
+
### Resources (13)
|
|
93
|
+
|
|
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.
|
|
64
95
|
|
|
65
96
|
| URI | Content |
|
|
66
97
|
|---|---|
|
|
67
98
|
| `dforge://schema/manifest` | JSON Schema for manifest.json |
|
|
68
99
|
| `dforge://schema/entity` | JSON Schema for entity files |
|
|
69
|
-
| `dforge://schema/data-
|
|
70
|
-
| `dforge://
|
|
100
|
+
| `dforge://schema/data-views` | JSON Schema for ui/data_views.json |
|
|
101
|
+
| `dforge://schema/folders` | JSON Schema for ui/folders.json |
|
|
102
|
+
| `dforge://schema/menus` | JSON Schema for ui/menus.json |
|
|
103
|
+
| `dforge://schema/roles` | JSON Schema for security/roles.json |
|
|
104
|
+
| `dforge://schema/jobs` | JSON Schema for logic/jobs.json |
|
|
105
|
+
| `dforge://schema/seed-data` | JSON Schema for seed-data/*.json |
|
|
106
|
+
| `dforge://schema/reports` | JSON Schema for ui/reports.json |
|
|
107
|
+
| `dforge://schema/settings` | JSON Schema for settings.json |
|
|
108
|
+
| `dforge://schema/traits` | JSON Schema for entity trait codes |
|
|
109
|
+
| `dforge://schema/webhooks` | JSON Schema for ui/webhooks.json |
|
|
110
|
+
| `dforge://docs/conventions` | MODULE_CONVENTIONS.md — naming, FK+Reference pattern, traits, security model |
|
|
111
|
+
|
|
112
|
+
Schemas + conventions are vendored at build time from `dForge-core/docs/`. Refresh with `scripts/vendor-resources.sh`. The published npm tarball ships them under `resources/`, and jsdelivr serves them publicly at:
|
|
71
113
|
|
|
72
|
-
|
|
73
|
-
|
|
114
|
+
```
|
|
115
|
+
https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas/<name>.schema.json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The dForge VS Code extension bundles them locally (no jsdelivr dependency at runtime).
|
|
119
|
+
|
|
120
|
+
## Claude Skill — the wizard
|
|
121
|
+
|
|
122
|
+
`skills/dforge-mcp-author/SKILL.md` teaches the AI how to drive the tools as a six-phase wizard:
|
|
123
|
+
|
|
124
|
+
| Phase | Required? | Tools used |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| 0. Intake | yes | (none — captures a brief in `_brief/00-intake.md`) |
|
|
127
|
+
| 1. Domain (entities) | yes | `module_create`, `entity_add`, `entity_field_*` |
|
|
128
|
+
| 2. Actions | optional | `action_add` |
|
|
129
|
+
| 3. Views + Reports | views yes, reports optional | `view_add`/`_modify`, `report_add`, `setting_add` |
|
|
130
|
+
| 4. Polish (translations, seed) | optional | (file map authored directly) |
|
|
131
|
+
| 5. Security | roles required, folders optional | `role_add`, `role_right_set`, `folder_add` |
|
|
132
|
+
| 6. Verify | yes | `module_pack`, `module_install` |
|
|
74
133
|
|
|
75
|
-
|
|
134
|
+
**Key principles encoded in the Skill:**
|
|
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.
|
|
76
140
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
+
```
|
|
81
151
|
|
|
82
152
|
## For maintainers
|
|
83
153
|
|
|
@@ -85,15 +155,18 @@ to enable.
|
|
|
85
155
|
|
|
86
156
|
```bash
|
|
87
157
|
pnpm install
|
|
88
|
-
pnpm build # tsup → dist/server.js
|
|
158
|
+
pnpm build # tsup → dist/server.js (bundles SDK + zod + dforge-cli/templates)
|
|
89
159
|
pnpm typecheck # tsc --noEmit
|
|
90
160
|
node dist/server.js # smoke-test via stdio JSON-RPC
|
|
91
161
|
```
|
|
92
162
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
163
|
+
To iterate against an in-tree `dforge-cli`, temporarily point the dep at it:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.1.0"|"@dforge-core/dforge-cli": "file:../dforge-cli"|' package.json
|
|
167
|
+
rm -rf node_modules pnpm-lock.yaml && pnpm install
|
|
168
|
+
# Flip back before publish, otherwise the published package.json is unresolvable for consumers.
|
|
169
|
+
```
|
|
97
170
|
|
|
98
171
|
### Refresh vendored resources
|
|
99
172
|
|
|
@@ -104,16 +177,28 @@ scripts/vendor-resources.sh # auto-locate ../dForge
|
|
|
104
177
|
DFORGE_CORE=/abs/path/to/dForge-core scripts/vendor-resources.sh
|
|
105
178
|
```
|
|
106
179
|
|
|
107
|
-
|
|
180
|
+
This refreshes `resources/schemas/` and `resources/docs/`. Republish the npm package to update jsdelivr-served schemas. The VS Code extension vendors them at its own build time, so a separate VS Code repackage is needed for that consumer too.
|
|
108
181
|
|
|
109
|
-
|
|
110
|
-
published tarball gets a fresh `dist/server.js`. No platform binaries to
|
|
111
|
-
manage, so a single `npm publish` covers it.)
|
|
182
|
+
### Publishing to npm
|
|
112
183
|
|
|
113
184
|
```bash
|
|
114
|
-
|
|
185
|
+
scripts/publish.sh 0.1.0-rc.N --tag latest --otp <code>
|
|
115
186
|
```
|
|
116
187
|
|
|
188
|
+
`prepublishOnly` runs `tsup` so the published tarball gets a fresh `dist/server.js`. No platform binaries to manage — one publish covers everything.
|
|
189
|
+
|
|
190
|
+
### Adding a new tool
|
|
191
|
+
|
|
192
|
+
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
|
+
2. Import + register in `src/server.ts` via the `envelope()` wrapper.
|
|
194
|
+
3. Mention it in the wizard `SKILL.md` if it fits a phase.
|
|
195
|
+
4. Bump `package.json` version, publish.
|
|
196
|
+
|
|
197
|
+
Conventions:
|
|
198
|
+
- Return file maps relative to the module root. Don't write to disk.
|
|
199
|
+
- Reject if the target key already exists (force users to call the matching `*_modify` / `*_remove`).
|
|
200
|
+
- Bump `manifest.updated` on every patch.
|
|
201
|
+
|
|
117
202
|
## License
|
|
118
203
|
|
|
119
204
|
MIT.
|