@kindgi/cli 0.2.0 → 0.3.0-rc.0
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 +12 -5
- package/dist/cli.js +4 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +75 -19
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/approval-wait.d.ts +90 -0
- package/dist/commands/approval-wait.d.ts.map +1 -0
- package/dist/commands/approval-wait.js +154 -0
- package/dist/commands/approval-wait.js.map +1 -0
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +131 -14
- package/dist/commands/artifacts.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +48 -5
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/deploy.js +7 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/deployments.d.ts.map +1 -1
- package/dist/commands/deployments.js +36 -13
- package/dist/commands/deployments.js.map +1 -1
- package/dist/commands/doctor.d.ts +3 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +47 -14
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/eval-runs.d.ts.map +1 -1
- package/dist/commands/eval-runs.js +21 -9
- package/dist/commands/eval-runs.js.map +1 -1
- package/dist/commands/helpers.d.ts +31 -1
- package/dist/commands/helpers.d.ts.map +1 -1
- package/dist/commands/helpers.js +45 -2
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/init.js +5 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mail-triggers.d.ts.map +1 -1
- package/dist/commands/mail-triggers.js +27 -3
- package/dist/commands/mail-triggers.js.map +1 -1
- package/dist/commands/promote.d.ts.map +1 -1
- package/dist/commands/promote.js +133 -11
- package/dist/commands/promote.js.map +1 -1
- package/dist/commands/provenance.d.ts.map +1 -1
- package/dist/commands/provenance.js +13 -5
- package/dist/commands/provenance.js.map +1 -1
- package/dist/commands/providers.d.ts.map +1 -1
- package/dist/commands/providers.js +47 -4
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/schedules.d.ts.map +1 -1
- package/dist/commands/schedules.js +25 -9
- package/dist/commands/schedules.js.map +1 -1
- package/dist/commands/skills.d.ts +16 -0
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +122 -36
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/commands/webhooks.js +21 -5
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +7 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -0
- package/dist/context.js.map +1 -1
- package/dist/dev/runtime-image.d.ts +1 -1
- package/dist/dev/runtime-image.d.ts.map +1 -1
- package/dist/dev/runtime-image.js +1 -1
- package/dist/dev/runtime-image.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +14 -1
- package/dist/errors.js.map +1 -1
- package/dist/exports/plan.d.ts.map +1 -1
- package/dist/exports/plan.js +50 -0
- package/dist/exports/plan.js.map +1 -1
- package/dist/init/augment-scaffolder.d.ts +1 -1
- package/dist/init/augment-scaffolder.js +9 -8
- package/dist/init/augment-scaffolder.js.map +1 -1
- package/dist/init/java-augment.d.ts.map +1 -1
- package/dist/init/java-augment.js +7 -6
- package/dist/init/java-augment.js.map +1 -1
- package/dist/init/python-augment.d.ts.map +1 -1
- package/dist/init/python-augment.js +7 -6
- package/dist/init/python-augment.js.map +1 -1
- package/dist/init/scala-augment.js +7 -6
- package/dist/init/scala-augment.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/providers/presets/anthropic.json +15 -3
- package/dist/providers/presets/azure-openai.json +10 -2
- package/dist/providers/presets/bedrock.json +6 -2
- package/dist/providers/presets/gemini-api.json +6 -2
- package/dist/providers/presets/openai.json +15 -3
- package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +21 -9
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +5 -3
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +202 -68
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +12 -188
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/common-mistakes.md +44 -0
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/how-it-works.md +41 -0
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/other-clients.md +19 -0
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/postgres.md +45 -0
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/several-servers.md +32 -0
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +49 -906
- package/dist/sdk-skills/kindgi-authoring-providers/bedrock.md +64 -0
- package/dist/sdk-skills/kindgi-authoring-providers/common-mistakes.md +125 -0
- package/dist/sdk-skills/kindgi-authoring-providers/keys-and-registration.md +58 -0
- package/dist/sdk-skills/kindgi-authoring-providers/kindgi-cloud.md +36 -0
- package/dist/sdk-skills/kindgi-authoring-providers/path-a-anthropic.md +216 -0
- package/dist/sdk-skills/kindgi-authoring-providers/path-b-openai-compat.md +127 -0
- package/dist/sdk-skills/kindgi-authoring-providers/path-c-onnx.md +97 -0
- package/dist/sdk-skills/kindgi-authoring-providers/path-d-vertex.md +95 -0
- package/dist/sdk-skills/kindgi-authoring-providers/router.md +113 -0
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +12 -387
- package/dist/sdk-skills/kindgi-authoring-tools/common-mistakes.md +135 -0
- package/dist/sdk-skills/kindgi-authoring-tools/declarative-http.md +34 -0
- package/dist/sdk-skills/kindgi-authoring-tools/imperative-handler.md +65 -0
- package/dist/sdk-skills/kindgi-authoring-tools/iterating-and-testing.md +45 -0
- package/dist/sdk-skills/kindgi-authoring-tools/secrets-and-connections.md +79 -0
- package/dist/sdk-skills/kindgi-authoring-tools/tool-flags.md +45 -0
- package/dist/sdk-skills/kindgi-fix-corrections/SKILL.md +13 -178
- package/dist/sdk-skills/kindgi-fix-corrections/make-the-change.md +25 -0
- package/dist/sdk-skills/kindgi-fix-corrections/publish-and-promote.md +76 -0
- package/dist/sdk-skills/kindgi-fix-corrections/pull-corrections.md +48 -0
- package/dist/sdk-skills/kindgi-fix-corrections/worked-example.md +27 -0
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +10 -180
- package/dist/sdk-skills/kindgi-framework-feedback/common-mistakes.md +19 -0
- package/dist/sdk-skills/kindgi-framework-feedback/editing-feedback-file.md +33 -0
- package/dist/sdk-skills/kindgi-framework-feedback/fields-and-entry-shape.md +53 -0
- package/dist/sdk-skills/kindgi-framework-feedback/hearing-back.md +24 -0
- package/dist/sdk-skills/kindgi-framework-feedback/sending.md +50 -0
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +24 -21
- package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +12 -4
- package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +6 -4
- package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +33 -23
- package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +19 -12
- package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +16 -16
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +18 -6
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +6 -4
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +39 -30
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +19 -9
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +24 -21
- package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +12 -4
- package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +6 -4
- package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +34 -23
- package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +15 -9
- package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +16 -16
- package/dist/sdk-skills/kindgi-using/SKILL.md +11 -11
- package/dist/templates/sample/README.md.tmpl +8 -7
- package/dist/templates/sample/agents/echo-agent/index.ts.tmpl +1 -1
- package/dist/templates/sample/kindgi.config.ts.tmpl +1 -1
- package/dist/templates/sample/package.json.tmpl +1 -1
- package/dist/templates/woocommerce/README.md.tmpl +9 -3
- package/package.json +13 -13
|
@@ -17,8 +17,8 @@ description: >
|
|
|
17
17
|
`kindgi secrets set` flow.
|
|
18
18
|
type: core
|
|
19
19
|
library: "@kindgi/sdk"
|
|
20
|
-
version: "0.
|
|
21
|
-
sdk_version: "0.
|
|
20
|
+
version: "0.4.0"
|
|
21
|
+
sdk_version: "0.3.0-rc.0"
|
|
22
22
|
pack_languages: [node, python, java, scala]
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -54,149 +54,18 @@ user:
|
|
|
54
54
|
- The resource is best-inspected once by a human (a one-shot answer, no
|
|
55
55
|
agent tools needed).
|
|
56
56
|
- The user is in a client that hasn't loaded `.mcp.json` yet — they'll
|
|
57
|
-
need to restart their MCP client after `kindgi mcp add` (
|
|
58
|
-
|
|
57
|
+
need to restart their MCP client after `kindgi mcp add` (mistake 2 in
|
|
58
|
+
`common-mistakes.md`).
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Your case: read this file
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
Kindgi's SecretBinding .mcp.json (pack root) launcher subprocess MCP server subprocess
|
|
64
|
-
───────────────────── ──────────────────── ────────────────── ────────────────────
|
|
65
|
-
MY_DB_URL=… → { "command": "pnpm", → reads .env + → spawns child with
|
|
66
|
-
(.env / .env.local, or "args": ["exec","kindgi", .env.local (the DATABASE_URI in env,
|
|
67
|
-
`kindgi secrets set`) "mcp-launch", "--", …] } pack env files), stdio piped to CC
|
|
68
|
-
│ substitutes secret ▲ │
|
|
69
|
-
│ into child env │ ▼
|
|
70
|
-
▼ │ MCP protocol (stdio)
|
|
71
|
-
Claude Code / Cursor spawns │ ▲ │
|
|
72
|
-
`kindgi mcp-launch …` at │ │ ▼
|
|
73
|
-
startup ─────────────────────────────┘ ┌─────────────────┐
|
|
74
|
-
│ Claude Code │
|
|
75
|
-
│ (or Cursor…) │
|
|
76
|
-
└─────────────────┘
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Three moving parts:
|
|
80
|
-
|
|
81
|
-
1. **The secret on disk** — for `local`, the project's env files at the
|
|
82
|
-
pack root (`.env`, then `.env.local`; `dev.envFiles` to change), then
|
|
83
|
-
Kindgi's own `.kindgi/secrets.env`; other environments use
|
|
84
|
-
`.env.<envName>`. Add it with `kindgi secrets set` (interactive no-echo
|
|
85
|
-
prompt; never the value on argv), which writes `.kindgi/secrets.env`,
|
|
86
|
-
or by hand. See `kindgi-authoring-providers`
|
|
87
|
-
for the same flow used for LLM API keys.
|
|
88
|
-
2. **`.mcp.json` at the pack root** — Kindgi writes this via
|
|
89
|
-
`kindgi mcp add`. Every entry runs the project's own `kindgi
|
|
90
|
-
mcp-launch -- <launcher-flags>...` through its package manager
|
|
91
|
-
(`"command": "pnpm", "args": ["exec", "kindgi", "mcp-launch", …]`;
|
|
92
|
-
npm: `npx --no -- kindgi …`) — never a global `kindgi`, never a
|
|
93
|
-
download. A Python pack has no Node project, so its entries run the
|
|
94
|
-
`kindgi` on `PATH` (`"command": "kindgi", "args": ["mcp-launch", …]`). A
|
|
95
|
-
Java or Scala pack's run the CLI it pins (`"command": "./kindgiw"`).
|
|
96
|
-
The file is safe to commit — it references secrets by NAME, not
|
|
97
|
-
value.
|
|
98
|
-
3. **The launcher** — `kindgi mcp-launch` is what the coding agent
|
|
99
|
-
actually spawns. It reads the referenced secret from the pack env files,
|
|
100
|
-
injects it into the child MCP server's env, and pipes stdio through.
|
|
101
|
-
|
|
102
|
-
## Path A — Postgres
|
|
103
|
-
|
|
104
|
-
Best-worn path. Uses `crystaldba/postgres-mcp` via Docker with
|
|
105
|
-
read-only access mode by default.
|
|
106
|
-
|
|
107
|
-
**Step 1 — set the DB URL** (interactive, no-echo):
|
|
108
|
-
|
|
109
|
-
```sh
|
|
110
|
-
kindgi secrets set MY_DB_URL --env=local --scope=tenant
|
|
111
|
-
# paste postgres://user:pass@host:port/db, press enter
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
For pipelines/CI: `pbpaste | kindgi secrets set … --from-stdin`, or
|
|
115
|
-
`--from-file=<path>` on a mode-0600 file. Never pass the value on argv.
|
|
116
|
-
|
|
117
|
-
**When the CLI is signed in to a hosted runtime:** the launcher reads only
|
|
118
|
-
the pack's env files, and `--env=local` is the env of the `kindgi dev`
|
|
119
|
-
runtime that writes them. Run the command in the pack while `kindgi dev`
|
|
120
|
-
runs there: the CLI talks to that runtime, unless `--url` or
|
|
121
|
-
`KINDGI_API_URL` names another. Or the user adds the line to `.env.local`
|
|
122
|
-
by hand. With no `kindgi dev`, the value would go to the hosted runtime,
|
|
123
|
-
where the launcher never reads it; a runtime that keeps its values under
|
|
124
|
-
one env refuses it (`env-not-served`).
|
|
125
|
-
|
|
126
|
-
**Step 2 — wire the MCP server:**
|
|
127
|
-
|
|
128
|
-
```sh
|
|
129
|
-
kindgi mcp add postgres --secret=MY_DB_URL
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Writes `.mcp.json` at the pack root (or merges into an existing one).
|
|
133
|
-
The server name defaults to `my_db` (derived from the secret
|
|
134
|
-
name — see "Server naming" below). Override with `--server-name=<label>`.
|
|
135
|
-
|
|
136
|
-
**Step 3 — restart your MCP client.** MCP servers are loaded at client
|
|
137
|
-
startup — a fresh `.mcp.json` doesn't take effect mid-session:
|
|
138
|
-
- **Claude Code:** exit + `claude` again in the same pack dir
|
|
139
|
-
- **Cursor:** ⌘⇧P → "Restart Extension Host" (or restart the app)
|
|
140
|
-
- **Claude Desktop:** quit + reopen
|
|
141
|
-
- **Windsurf:** Command Palette → "Restart Windsurf"
|
|
142
|
-
|
|
143
|
-
**Step 4 — use it.** Tools like `execute_sql`, `list_tables`,
|
|
144
|
-
`analyze_index_health` now appear. Ask the agent things like "what
|
|
145
|
-
tables are in this schema?" or "what's the shape of the customers
|
|
146
|
-
table?" or "how many rows are in orders where created_at > 2024?".
|
|
147
|
-
|
|
148
|
-
## Path B — Multiple servers in the same pack
|
|
149
|
-
|
|
150
|
-
Two connections against different DBs? Two `mcp add` invocations,
|
|
151
|
-
each with its own `--secret` and `--server-name`:
|
|
152
|
-
|
|
153
|
-
```sh
|
|
154
|
-
kindgi secrets set MY_DB_URL --env=local --scope=tenant
|
|
155
|
-
kindgi secrets set ANALYTICS_DB_URL --env=local --scope=tenant
|
|
156
|
-
|
|
157
|
-
kindgi mcp add postgres --secret=MY_DB_URL --server-name=my_db
|
|
158
|
-
kindgi mcp add postgres --secret=ANALYTICS_DB_URL --server-name=analytics_db
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
`.mcp.json` gets two entries. The agent picks the right one by name
|
|
162
|
-
when it invokes a tool (e.g. `my_db.execute_sql`).
|
|
163
|
-
|
|
164
|
-
## Server naming
|
|
165
|
-
|
|
166
|
-
`--server-name` defaults are derived from the secret name:
|
|
167
|
-
|
|
168
|
-
| Secret name | Default server name |
|
|
62
|
+
| Your case | Read |
|
|
169
63
|
|---|---|
|
|
170
|
-
| `
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
| `
|
|
175
|
-
|
|
176
|
-
The suffix-stripping (`_url` / `_uri` / `_key` / `_token` / `_pat` /
|
|
177
|
-
`_secret` / `_password`) is intentional — the server name should
|
|
178
|
-
describe the *resource*, not the *credential shape*. Override with
|
|
179
|
-
`--server-name=<label>` when the default reads wrong.
|
|
180
|
-
|
|
181
|
-
## Path C — Non-Claude-Code clients
|
|
182
|
-
|
|
183
|
-
`.mcp.json` at the pack root is what Claude Code reads natively. Other
|
|
184
|
-
clients read from their own paths (`.cursor/mcp.json`, `.vscode/mcp.json`,
|
|
185
|
-
Claude Desktop's system-wide config). To bridge:
|
|
186
|
-
|
|
187
|
-
1. Establish a symlink from the client's expected path to `.mcp.json`:
|
|
188
|
-
```sh
|
|
189
|
-
mkdir -p .cursor && ln -sfn ../.mcp.json .cursor/mcp.json
|
|
190
|
-
```
|
|
191
|
-
2. Restart the client.
|
|
192
|
-
|
|
193
|
-
Symlinks work because the FILE CONTENTS are portable across every MCP
|
|
194
|
-
client — the `mcpServers` block has the same shape everywhere. Only
|
|
195
|
-
the file LOCATION differs. Edits to `.mcp.json` flow through
|
|
196
|
-
automatically via the symlink; no re-sync needed.
|
|
197
|
-
|
|
198
|
-
Windows users without dev-drive symlinks: `cp .mcp.json .cursor/mcp.json`,
|
|
199
|
-
and re-copy after every `kindgi mcp` edit.
|
|
64
|
+
| How the secret reaches the server and never the model: `.mcp.json` and the launcher | [how-it-works.md](how-it-works.md) |
|
|
65
|
+
| Postgres, and the steps every preset follows: set the secret, add the server, restart the client | [postgres.md](postgres.md) |
|
|
66
|
+
| Several servers in one pack, or a server's name | [several-servers.md](several-servers.md) |
|
|
67
|
+
| Cursor, VS Code, Claude Desktop or Windsurf | [other-clients.md](other-clients.md) |
|
|
68
|
+
| An error, a server that doesn't show up, or a preset whose audit says `pending` | [common-mistakes.md](common-mistakes.md) |
|
|
200
69
|
|
|
201
70
|
## Verifying end-to-end
|
|
202
71
|
|
|
@@ -215,52 +84,7 @@ kindgi mcp presets
|
|
|
215
84
|
argv shape. `kindgi mcp presets` shows what presets are available and
|
|
216
85
|
their audit status. If the postgres preset audit says
|
|
217
86
|
`urlLeakInErrors: "pending"`, that's a known unresolved item — see
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
## Common mistakes
|
|
221
|
-
|
|
222
|
-
1. **Reading `.mcp.json` mid-session and asking about it.** `.mcp.json`
|
|
223
|
-
references secrets by NAME (e.g. `secret:MY_DB_URL@local:tenant`),
|
|
224
|
-
not by value. Safe to Read + describe to the user. **Do NOT** run
|
|
225
|
-
`cat .env`, `env | grep`, or Read `.env` / `.env.local` — those return
|
|
226
|
-
the raw URL, which enters your transcript, gets sent to the model
|
|
227
|
-
provider on every subsequent turn, and can be exfiltrated via
|
|
228
|
-
prompt injection. Once a secret is in a model's context, it's a
|
|
229
|
-
rotation event, not a "clean up the log" event.
|
|
230
|
-
|
|
231
|
-
2. **Expecting the new server to activate without a restart.** MCP
|
|
232
|
-
servers are loaded at client startup. `kindgi mcp add` writes the
|
|
233
|
-
config file; the CLIENT doesn't re-scan it until a restart. Tell
|
|
234
|
-
the user to restart their client after `mcp add`, and don't call
|
|
235
|
-
MCP tools before that restart happens in your current session.
|
|
236
|
-
|
|
237
|
-
3. **`--env` / `--scope` mismatch between `secrets set` and `mcp add`.**
|
|
238
|
-
Both flags need to agree — the launcher looks up the secret using
|
|
239
|
-
whatever `--env` + `--scope` you passed to `mcp add`. Default is
|
|
240
|
-
`--env=local --scope=tenant`; match this on both commands.
|
|
241
|
-
|
|
242
|
-
4. **Trusting a preset's audit metadata that says `pending`.** Every
|
|
243
|
-
preset carries `audit.urlLeakInErrors`. Only `"verified-safe"` means
|
|
244
|
-
someone has confirmed the wrapped MCP server doesn't echo the
|
|
245
|
-
secret in its error/debug output. `"pending"` means the audit
|
|
246
|
-
hasn't run — the server may or may not leak. When you see a
|
|
247
|
-
`pending` preset in a session that handles real credentials, tell
|
|
248
|
-
the user: "this preset works but its URL-echo safety isn't
|
|
249
|
-
verified for this version; watch tool error messages for the raw
|
|
250
|
-
URL, and file feedback if you see one."
|
|
251
|
-
|
|
252
|
-
5. **Trying to use MCP against a `localhost` DB from Docker on Mac
|
|
253
|
-
without the host-remap.** Docker containers on Mac can't reach the
|
|
254
|
-
host's `localhost`. The `postgres` preset carries `hostRemap:
|
|
255
|
-
"docker-desktop"`, which the launcher applies automatically — it
|
|
256
|
-
rewrites `@localhost` / `@127.0.0.1` in the resolved URL to
|
|
257
|
-
`@host.docker.internal` before injecting into the container's env.
|
|
258
|
-
If you author a preset with a Docker runtime + a localhost
|
|
259
|
-
consumer, include `"hostRemap": "docker-desktop"` in the preset JSON.
|
|
260
|
-
|
|
261
|
-
6. **`kindgi mcp add` fails with "Secret X not in .env, .env.local".** The
|
|
262
|
-
secret hasn't been stored yet. Run `kindgi secrets set X --env=local
|
|
263
|
-
--scope=tenant` first. The error message includes this fix pointer.
|
|
87
|
+
mistake 4 in `common-mistakes.md`.
|
|
264
88
|
|
|
265
89
|
## Security discipline
|
|
266
90
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Common mistakes
|
|
2
|
+
|
|
3
|
+
1. **Reading `.mcp.json` mid-session and asking about it.** `.mcp.json`
|
|
4
|
+
references secrets by NAME (e.g. `secret:MY_DB_URL@local:tenant`),
|
|
5
|
+
not by value. Safe to Read + describe to the user. **Do NOT** run
|
|
6
|
+
`cat .env`, `env | grep`, or Read `.env` / `.env.local` — those return
|
|
7
|
+
the raw URL, which enters your transcript, gets sent to the model
|
|
8
|
+
provider on every subsequent turn, and can be exfiltrated via
|
|
9
|
+
prompt injection. Once a secret is in a model's context, it's a
|
|
10
|
+
rotation event, not a "clean up the log" event.
|
|
11
|
+
|
|
12
|
+
2. **Expecting the new server to activate without a restart.** MCP
|
|
13
|
+
servers are loaded at client startup. `kindgi mcp add` writes the
|
|
14
|
+
config file; the CLIENT doesn't re-scan it until a restart. Tell
|
|
15
|
+
the user to restart their client after `mcp add`, and don't call
|
|
16
|
+
MCP tools before that restart happens in your current session.
|
|
17
|
+
|
|
18
|
+
3. **`--env` / `--scope` mismatch between `secrets set` and `mcp add`.**
|
|
19
|
+
Both flags need to agree — the launcher looks up the secret using
|
|
20
|
+
whatever `--env` + `--scope` you passed to `mcp add`. Default is
|
|
21
|
+
`--env=local --scope=tenant`; match this on both commands.
|
|
22
|
+
|
|
23
|
+
4. **Trusting a preset's audit metadata that says `pending`.** Every
|
|
24
|
+
preset carries `audit.urlLeakInErrors`. Only `"verified-safe"` means
|
|
25
|
+
someone has confirmed the wrapped MCP server doesn't echo the
|
|
26
|
+
secret in its error/debug output. `"pending"` means the audit
|
|
27
|
+
hasn't run — the server may or may not leak. When you see a
|
|
28
|
+
`pending` preset in a session that handles real credentials, tell
|
|
29
|
+
the user: "this preset works but its URL-echo safety isn't
|
|
30
|
+
verified for this version; watch tool error messages for the raw
|
|
31
|
+
URL, and file feedback if you see one."
|
|
32
|
+
|
|
33
|
+
5. **Trying to use MCP against a `localhost` DB from Docker on Mac
|
|
34
|
+
without the host-remap.** Docker containers on Mac can't reach the
|
|
35
|
+
host's `localhost`. The `postgres` preset carries `hostRemap:
|
|
36
|
+
"docker-desktop"`, which the launcher applies automatically — it
|
|
37
|
+
rewrites `@localhost` / `@127.0.0.1` in the resolved URL to
|
|
38
|
+
`@host.docker.internal` before injecting into the container's env.
|
|
39
|
+
If you author a preset with a Docker runtime + a localhost
|
|
40
|
+
consumer, include `"hostRemap": "docker-desktop"` in the preset JSON.
|
|
41
|
+
|
|
42
|
+
6. **`kindgi mcp add` fails with "Secret X not in .env, .env.local".** The
|
|
43
|
+
secret hasn't been stored yet. Run `kindgi secrets set X --env=local
|
|
44
|
+
--scope=tenant` first. The error message includes this fix pointer.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# How it works: the secret, `.mcp.json` and the launcher
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Kindgi's SecretBinding .mcp.json (pack root) launcher subprocess MCP server subprocess
|
|
5
|
+
───────────────────── ──────────────────── ────────────────── ────────────────────
|
|
6
|
+
MY_DB_URL=… → { "command": "pnpm", → reads .env + → spawns child with
|
|
7
|
+
(.env / .env.local, or "args": ["exec","kindgi", .env.local (the DATABASE_URI in env,
|
|
8
|
+
`kindgi secrets set`) "mcp-launch", "--", …] } pack env files), stdio piped to CC
|
|
9
|
+
│ substitutes secret ▲ │
|
|
10
|
+
│ into child env │ ▼
|
|
11
|
+
▼ │ MCP protocol (stdio)
|
|
12
|
+
Claude Code / Cursor spawns │ ▲ │
|
|
13
|
+
`kindgi mcp-launch …` at │ │ ▼
|
|
14
|
+
startup ─────────────────────────────┘ ┌─────────────────┐
|
|
15
|
+
│ Claude Code │
|
|
16
|
+
│ (or Cursor…) │
|
|
17
|
+
└─────────────────┘
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Three moving parts:
|
|
21
|
+
|
|
22
|
+
1. **The secret on disk** — for `local`, the project's env files at the
|
|
23
|
+
pack root (`.env`, then `.env.local`; `dev.envFiles` to change), then
|
|
24
|
+
Kindgi's own `.kindgi/secrets.env`; other environments use
|
|
25
|
+
`.env.<envName>`. Add it with `kindgi secrets set` (interactive no-echo
|
|
26
|
+
prompt; never the value on argv), which writes `.kindgi/secrets.env`,
|
|
27
|
+
or by hand. See `kindgi-authoring-providers`
|
|
28
|
+
for the same flow used for LLM API keys.
|
|
29
|
+
2. **`.mcp.json` at the pack root** — Kindgi writes this via
|
|
30
|
+
`kindgi mcp add`. Every entry runs the project's own `kindgi
|
|
31
|
+
mcp-launch -- <launcher-flags>...` through its package manager
|
|
32
|
+
(`"command": "pnpm", "args": ["exec", "kindgi", "mcp-launch", …]`;
|
|
33
|
+
npm: `npx --no -- kindgi …`) — never a global `kindgi`, never a
|
|
34
|
+
download. A Python pack has no Node project, so its entries run the
|
|
35
|
+
`kindgi` on `PATH` (`"command": "kindgi", "args": ["mcp-launch", …]`). A
|
|
36
|
+
Java or Scala pack's run the CLI it pins (`"command": "./kindgiw"`).
|
|
37
|
+
The file is safe to commit — it references secrets by NAME, not
|
|
38
|
+
value.
|
|
39
|
+
3. **The launcher** — `kindgi mcp-launch` is what the coding agent
|
|
40
|
+
actually spawns. It reads the referenced secret from the pack env files,
|
|
41
|
+
injects it into the child MCP server's env, and pipes stdio through.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Clients other than Claude Code
|
|
2
|
+
|
|
3
|
+
`.mcp.json` at the pack root is what Claude Code reads natively. Other
|
|
4
|
+
clients read from their own paths (`.cursor/mcp.json`, `.vscode/mcp.json`,
|
|
5
|
+
Claude Desktop's system-wide config). To bridge:
|
|
6
|
+
|
|
7
|
+
1. Establish a symlink from the client's expected path to `.mcp.json`:
|
|
8
|
+
```sh
|
|
9
|
+
mkdir -p .cursor && ln -sfn ../.mcp.json .cursor/mcp.json
|
|
10
|
+
```
|
|
11
|
+
2. Restart the client.
|
|
12
|
+
|
|
13
|
+
Symlinks work because the FILE CONTENTS are portable across every MCP
|
|
14
|
+
client — the `mcpServers` block has the same shape everywhere. Only
|
|
15
|
+
the file LOCATION differs. Edits to `.mcp.json` flow through
|
|
16
|
+
automatically via the symlink; no re-sync needed.
|
|
17
|
+
|
|
18
|
+
Windows users without dev-drive symlinks: `cp .mcp.json .cursor/mcp.json`,
|
|
19
|
+
and re-copy after every `kindgi mcp` edit.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Postgres, and the steps every preset follows
|
|
2
|
+
|
|
3
|
+
Best-worn path. Uses `crystaldba/postgres-mcp` via Docker with
|
|
4
|
+
read-only access mode by default.
|
|
5
|
+
|
|
6
|
+
**Step 1 — set the DB URL** (interactive, no-echo):
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
kindgi secrets set MY_DB_URL --env=local --scope=tenant
|
|
10
|
+
# paste postgres://user:pass@host:port/db, press enter
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For pipelines/CI: `pbpaste | kindgi secrets set … --from-stdin`, or
|
|
14
|
+
`--from-file=<path>` on a mode-0600 file. Never pass the value on argv.
|
|
15
|
+
|
|
16
|
+
**When the CLI is signed in to a hosted runtime:** the launcher reads only
|
|
17
|
+
the pack's env files, and `--env=local` is the env of the `kindgi dev`
|
|
18
|
+
runtime that writes them. Run the command in the pack while `kindgi dev`
|
|
19
|
+
runs there: the CLI talks to that runtime, unless `--url` or
|
|
20
|
+
`KINDGI_API_URL` names another. Or the user adds the line to `.env.local`
|
|
21
|
+
by hand. With no `kindgi dev`, the value would go to the hosted runtime,
|
|
22
|
+
where the launcher never reads it; a runtime that keeps its values under
|
|
23
|
+
one env refuses it (`env-not-served`).
|
|
24
|
+
|
|
25
|
+
**Step 2 — wire the MCP server:**
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
kindgi mcp add postgres --secret=MY_DB_URL
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Writes `.mcp.json` at the pack root (or merges into an existing one).
|
|
32
|
+
The server name defaults to `my_db` (derived from the secret
|
|
33
|
+
name — see `several-servers.md`). Override with `--server-name=<label>`.
|
|
34
|
+
|
|
35
|
+
**Step 3 — restart your MCP client.** MCP servers are loaded at client
|
|
36
|
+
startup — a fresh `.mcp.json` doesn't take effect mid-session:
|
|
37
|
+
- **Claude Code:** exit + `claude` again in the same pack dir
|
|
38
|
+
- **Cursor:** ⌘⇧P → "Restart Extension Host" (or restart the app)
|
|
39
|
+
- **Claude Desktop:** quit + reopen
|
|
40
|
+
- **Windsurf:** Command Palette → "Restart Windsurf"
|
|
41
|
+
|
|
42
|
+
**Step 4 — use it.** Tools like `execute_sql`, `list_tables`,
|
|
43
|
+
`analyze_index_health` now appear. Ask the agent things like "what
|
|
44
|
+
tables are in this schema?" or "what's the shape of the customers
|
|
45
|
+
table?" or "how many rows are in orders where created_at > 2024?".
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Several servers in one pack, and their names
|
|
2
|
+
|
|
3
|
+
Two connections against different DBs? Two `mcp add` invocations,
|
|
4
|
+
each with its own `--secret` and `--server-name`:
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
kindgi secrets set MY_DB_URL --env=local --scope=tenant
|
|
8
|
+
kindgi secrets set ANALYTICS_DB_URL --env=local --scope=tenant
|
|
9
|
+
|
|
10
|
+
kindgi mcp add postgres --secret=MY_DB_URL --server-name=my_db
|
|
11
|
+
kindgi mcp add postgres --secret=ANALYTICS_DB_URL --server-name=analytics_db
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`.mcp.json` gets two entries. The agent picks the right one by name
|
|
15
|
+
when it invokes a tool (e.g. `my_db.execute_sql`).
|
|
16
|
+
|
|
17
|
+
## Server naming
|
|
18
|
+
|
|
19
|
+
`--server-name` defaults are derived from the secret name:
|
|
20
|
+
|
|
21
|
+
| Secret name | Default server name |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `MY_DB_URL` | `my_db` |
|
|
24
|
+
| `ANALYTICS_DB_URL` | `analytics_db` |
|
|
25
|
+
| `ANTHROPIC_API_KEY` | `anthropic_api` |
|
|
26
|
+
| `GITHUB_PAT` | `github` |
|
|
27
|
+
| `DB_PASSWORD` | `db` |
|
|
28
|
+
|
|
29
|
+
The suffix-stripping (`_url` / `_uri` / `_key` / `_token` / `_pat` /
|
|
30
|
+
`_secret` / `_password`) is intentional — the server name should
|
|
31
|
+
describe the *resource*, not the *credential shape*. Override with
|
|
32
|
+
`--server-name=<label>` when the default reads wrong.
|