@studiometa/forge-mcp 0.2.3 → 0.2.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/skills/SKILL.md CHANGED
@@ -22,9 +22,9 @@ Before your first interaction with any resource, call `action="help"` with that
22
22
 
23
23
  ### `forge` — Read Operations
24
24
 
25
- Safe, read-only queries. Use for listing, getting details, help, and schema.
25
+ Safe, read-only queries. Use for listing, getting details, resolving names, fetching context snapshots, help, and schema.
26
26
 
27
- **Actions**: `list`, `get`, `help`, `schema`
27
+ **Actions**: `list`, `get`, `resolve`, `context`, `help`, `schema`
28
28
 
29
29
  ```
30
30
  forge(resource, action, [parameters...])
@@ -42,24 +42,29 @@ forge_write(resource, action, [parameters...])
42
42
 
43
43
  ### Resources & Actions
44
44
 
45
- | Resource | Read Actions (`forge`) | Write Actions (`forge_write`) | Scope |
46
- | ----------------- | ---------------------- | ------------------------------ | ------ |
47
- | `servers` | `list`, `get` | `create`, `delete`, `reboot` | global |
48
- | `sites` | `list`, `get` | `create`, `delete` | server |
49
- | `deployments` | `list` | `deploy`, `update` | site |
50
- | `env` | `get` | `update` | site |
51
- | `nginx` | `get` | `update` | site |
52
- | `certificates` | `list`, `get` | `create`, `delete`, `activate` | site |
53
- | `databases` | `list`, `get` | `create`, `delete` | server |
54
- | `database-users` | `list`, `get` | `create`, `delete` | server |
55
- | `daemons` | `list`, `get` | `create`, `delete`, `restart` | server |
56
- | `firewall-rules` | `list`, `get` | `create`, `delete` | server |
57
- | `ssh-keys` | `list`, `get` | `create`, `delete` | server |
58
- | `security-rules` | `list`, `get` | `create`, `delete` | site |
59
- | `redirect-rules` | `list`, `get` | `create`, `delete` | site |
60
- | `monitors` | `list`, `get` | `create`, `delete` | server |
61
- | `nginx-templates` | `list`, `get` | `create`, `update`, `delete` | server |
62
- | `recipes` | `list`, `get` | `create`, `delete`, `run` | global |
45
+ | Resource | Read Actions (`forge`) | Write Actions (`forge_write`) | Scope |
46
+ | ----------------- | ----------------------------------- | ------------------------------ | ------ |
47
+ | `servers` | `list`, `get`, `resolve`, `context` | `create`, `delete`, `reboot` | global |
48
+ | `sites` | `list`, `get`, `resolve`, `context` | `create`, `delete` | server |
49
+ | `deployments` | `list` | `deploy`, `update` | site |
50
+ | `env` | `get` | `update` | site |
51
+ | `nginx` | `get` | `update` | site |
52
+ | `certificates` | `list`, `get` | `create`, `delete`, `activate` | site |
53
+ | `databases` | `list`, `get` | `create`, `delete` | server |
54
+ | `database-users` | `list`, `get` | `create`, `delete` | server |
55
+ | `daemons` | `list`, `get` | `create`, `delete`, `restart` | server |
56
+ | `firewall-rules` | `list`, `get` | `create`, `delete` | server |
57
+ | `ssh-keys` | `list`, `get` | `create`, `delete` | server |
58
+ | `security-rules` | `list`, `get` | `create`, `delete` | site |
59
+ | `redirect-rules` | `list`, `get` | `create`, `delete` | site |
60
+ | `monitors` | `list`, `get` | `create`, `delete` | server |
61
+ | `nginx-templates` | `list`, `get` | `create`, `update`, `delete` | server |
62
+ | `recipes` | `list`, `get` | `create`, `delete`, `run` | global |
63
+ | `scheduled-jobs` | `list`, `get` | `create`, `delete` | server |
64
+ | `backups` | `list`, `get` | `create`, `delete` | server |
65
+ | `commands` | `list`, `get` | `create` | site |
66
+ | `user` | `get` | — | global |
67
+ | `batch` | `run` | — | global |
63
68
 
64
69
  ### Scope Guide
65
70
 
@@ -67,6 +72,31 @@ forge_write(resource, action, [parameters...])
67
72
  - **server**: Requires `server_id` (e.g. `sites`, `databases`, `daemons`)
68
73
  - **site**: Requires `server_id` + `site_id` (e.g. `deployments`, `env`, `certificates`)
69
74
 
75
+ ### Auto-Resolve: Names Instead of IDs
76
+
77
+ `server_id` and `site_id` accept **name strings** in addition to numeric IDs. When a non-numeric value is provided, the server automatically performs a case-insensitive partial match against known resources:
78
+
79
+ - **`server_id`**: Matched against server names (e.g. `"prod"` resolves `"production-web-01"`)
80
+ - **`site_id`**: Matched against site domains (e.g. `"myapp"` resolves `"myapp.example.com"`)
81
+
82
+ Resolution rules:
83
+
84
+ - **Exact single match** → resolved silently, the call proceeds normally
85
+ - **Ambiguous (multiple matches)** → error listing all candidates; use a more specific name or numeric ID
86
+ - **No match** → error with a hint to use `action: "resolve"` to search
87
+
88
+ This applies to **every** resource and action automatically — no special syntax needed.
89
+
90
+ Use `action: "resolve"` explicitly when you need to search or preview matches before acting:
91
+
92
+ ```json
93
+ // Search servers by name
94
+ { "resource": "servers", "action": "resolve", "query": "prod" }
95
+
96
+ // Search sites on a server by domain
97
+ { "resource": "sites", "action": "resolve", "server_id": "123", "query": "myapp" }
98
+ ```
99
+
70
100
  ### Getting Help
71
101
 
72
102
  Use `action: "help"` to get detailed documentation for any resource:
@@ -84,15 +114,17 @@ Use `action: "schema"` for a compact machine-readable spec:
84
114
 
85
115
  ## Common Parameters
86
116
 
87
- | Parameter | Type | Description |
88
- | ----------- | ------- | ------------------------------------------------------------- |
89
- | `resource` | string | **Required**. Resource type (see table above) |
90
- | `action` | string | **Required**. Action to perform |
91
- | `id` | string | Resource ID (for `get`, `delete`, `activate`, `restart`) |
92
- | `server_id` | string | Server ID (for server-scoped and site-scoped resources) |
93
- | `site_id` | string | Site ID (for site-scoped resources) |
94
- | `compact` | boolean | Compact output (default: true) |
95
- | `content` | string | Content for env/nginx `update` and deployment script `update` |
117
+ | Parameter | Type | Description |
118
+ | ------------ | ------- | ------------------------------------------------------------------------------------------------------- |
119
+ | `resource` | string | **Required**. Resource type (see table above) |
120
+ | `action` | string | **Required**. Action to perform |
121
+ | `id` | string | Resource ID (for `get`, `delete`, `activate`, `restart`) |
122
+ | `server_id` | string | Server ID **or name** — numeric IDs are used as-is; names are auto-resolved via partial match |
123
+ | `site_id` | string | Site ID **or domain name** — auto-resolved via partial match; requires `server_id` |
124
+ | `query` | string | Search query for `resolve` action (partial, case-insensitive match against resource names/domains) |
125
+ | `compact` | boolean | Compact output (default: true) |
126
+ | `content` | string | Content for env/nginx `update` and deployment script `update` |
127
+ | `operations` | array | Array of operations for `batch` `run` (max 10). Each item needs `resource`, `action`, and extra params. |
96
128
 
97
129
  ## Common Workflows
98
130
 
@@ -172,6 +204,93 @@ Use `action: "schema"` for a compact machine-readable spec:
172
204
  { "resource": "recipes", "action": "run", "id": "456", "servers": [1, 2, 3] }
173
205
  ```
174
206
 
207
+ ### Auto-Resolve: Deploy Using Names Instead of IDs
208
+
209
+ No need to look up numeric IDs first — just pass names directly:
210
+
211
+ ```json
212
+ // Deploy using server name and site domain (forge_write)
213
+ // "prod" and "myapp.example.com" are auto-resolved to numeric IDs
214
+ { "resource": "deployments", "action": "deploy", "server_id": "prod", "site_id": "myapp.example.com" }
215
+
216
+ // Update env using a partial server name and domain fragment
217
+ { "resource": "env", "action": "get", "server_id": "production", "site_id": "myapp" }
218
+ ```
219
+
220
+ ### Resolve: Find Resources by Name
221
+
222
+ Use `action: "resolve"` to search resources by name before acting:
223
+
224
+ ```json
225
+ // Find servers matching "prod" (forge)
226
+ { "resource": "servers", "action": "resolve", "query": "prod" }
227
+ // → returns matches: [{ id: 123, name: "production-web-01" }, ...]
228
+
229
+ // Find sites on a server matching a domain fragment (forge)
230
+ { "resource": "sites", "action": "resolve", "server_id": "123", "query": "myapp" }
231
+ // → returns matches: [{ id: 456, name: "myapp.example.com" }, ...]
232
+ ```
233
+
234
+ ### Context: Get a Full Snapshot in One Call
235
+
236
+ `action: "context"` fetches a resource plus all its sub-resources in a single parallel call — ideal for orientation at the start of a session:
237
+
238
+ ```json
239
+ // Server context (forge) — returns server + sites, databases, database_users,
240
+ // daemons, firewall_rules, scheduled_jobs
241
+ { "resource": "servers", "action": "context", "id": "123" }
242
+
243
+ // Site context (forge) — returns site + deployments (last 5), certificates,
244
+ // redirect_rules, security_rules
245
+ { "resource": "sites", "action": "context", "server_id": "123", "id": "456" }
246
+
247
+ // Combine with auto-resolve: use names instead of IDs
248
+ { "resource": "servers", "action": "context", "id": "prod" }
249
+ ```
250
+
251
+ ### Batch: Multiple Reads in a Single Call
252
+
253
+ `resource: "batch"` with `action: "run"` executes up to 10 read operations in parallel, reducing round-trips:
254
+
255
+ ```json
256
+ // Fetch servers list + user info in one call (forge)
257
+ {
258
+ "resource": "batch",
259
+ "action": "run",
260
+ "operations": [
261
+ { "resource": "servers", "action": "list" },
262
+ { "resource": "user", "action": "get" }
263
+ ]
264
+ }
265
+
266
+ // Fetch multiple site sub-resources in parallel (forge)
267
+ {
268
+ "resource": "batch",
269
+ "action": "run",
270
+ "operations": [
271
+ { "resource": "env", "action": "get", "server_id": "123", "site_id": "456" },
272
+ { "resource": "certificates", "action": "list", "server_id": "123", "site_id": "456" },
273
+ { "resource": "deployments", "action": "list", "server_id": "123", "site_id": "456" }
274
+ ]
275
+ }
276
+ ```
277
+
278
+ Result shape:
279
+
280
+ ```json
281
+ {
282
+ "_batch": { "total": 2, "succeeded": 2, "failed": 0 },
283
+ "results": [
284
+ { "index": 0, "resource": "servers", "action": "list", "data": [...] },
285
+ { "index": 1, "resource": "user", "action": "get", "data": {...} }
286
+ ]
287
+ }
288
+ ```
289
+
290
+ Per-operation failures are isolated — a single error doesn't abort the rest.
291
+
292
+ > **Note**: Batch only supports read actions (`list`, `get`, `resolve`, `context`, `help`, `schema`). Write operations must use `forge_write` individually.
293
+
175
294
  ## Authentication
176
295
 
177
296
  ### Stdio Mode (Claude Desktop)
@@ -217,3 +336,7 @@ All `forge_write` operations are automatically logged to `~/.config/forge-tools/
217
336
  4. **Chain operations**: List servers → list sites → deploy (follow the hierarchy)
218
337
  5. **Scope matters**: Server-scoped resources need `server_id`, site-scoped need both `server_id` and `site_id`
219
338
  6. **Read vs Write**: Use `forge` for queries, `forge_write` for mutations — MCP clients enforce this split
339
+ 7. **Use names, not IDs**: Pass server names and site domains directly — they are auto-resolved to numeric IDs
340
+ 8. **Use `context` for orientation**: One call fetches a server or site plus all its sub-resources in parallel
341
+ 9. **Use `batch` to cut round-trips**: Bundle up to 10 read operations into a single `forge` call
342
+ 10. **Use `resolve` to preview**: Search for resources by name before committing to an action