postgresai 0.15.0-dev.1 → 0.15.0-dev.11

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 CHANGED
@@ -173,7 +173,7 @@ postgresai mon local-install --api-key your_key --db-url postgresql://user:pass@
173
173
  This will:
174
174
  - Configure API key for automated report uploads (if provided)
175
175
  - Add PostgreSQL instance to monitor (if provided)
176
- - Generate secure Grafana password
176
+ - Generate secure Grafana and replication passwords
177
177
  - Start all monitoring services
178
178
  - Open Grafana at http://localhost:3000
179
179
 
@@ -205,6 +205,8 @@ postgresai mon health [--wait <sec>] # Check monitoring services health
205
205
  - `--db-url <url>` - PostgreSQL connection URL to monitor (format: `postgresql://user:pass@host:port/db`)
206
206
  - `-y, --yes` - Accept all defaults and skip interactive prompts
207
207
 
208
+ `local-install` writes `.env` in the monitoring directory. It preserves existing `REPLICATOR_PASSWORD` and `VM_AUTH_*` values or generates new random ones when missing; `VM_AUTH_USERNAME` defaults to `vmauth` when absent. The replication password is used by the demo PostgreSQL standby replication user, and the VM auth credentials are required before Docker Compose can provision Grafana datasources. If you run `docker compose` directly or maintain `.env` yourself, set both VM auth values before upgrading. For rotation, run `VM_AUTH_PASSWORD="$(openssl rand -base64 18)" ./scripts/rotate-vm-auth.sh` from the monitoring directory so `.env`, `sink-prometheus`, and `grafana` update together.
209
+
208
210
  #### Monitoring target databases (`mon targets` subgroup)
209
211
  ```bash
210
212
  postgresai mon targets list # List databases to monitor
@@ -247,22 +249,93 @@ Cursor configuration example (Settings → MCP):
247
249
  ```
248
250
 
249
251
  Tools exposed:
250
- - list_issues: returns the same JSON as `postgresai issues list`.
251
- - view_issue: view a single issue with its comments (args: { issue_id, debug? })
252
- - post_issue_comment: post a comment (args: { issue_id, content, parent_comment_id?, debug? })
252
+ - `list_issues`: returns the same JSON as `postgresai issues list`.
253
+ - `view_issue`: view a single issue with its comments (args: `{ issue_id, debug? }`).
254
+ - `create_issue`: create a new issue (args: `{ title, description?, org_id, attachments?, debug? }`).
255
+ - `update_issue`: update title/description/status/labels (args: `{ issue_id, title?, description?, status?, labels?, attachments?, debug? }`).
256
+ - `post_issue_comment`: post a comment (args: `{ issue_id, content?, parent_comment_id?, attachments?, debug? }`).
257
+ - `update_issue_comment`: update an existing comment (args: `{ comment_id, content?, attachments?, debug? }`).
258
+ - `upload_file`: upload a local file and return the storage URL plus a ready-to-paste markdown link (args: `{ path, debug? }`).
259
+ - `download_file`: download a file from storage (args: `{ url, output_path?, debug? }`).
260
+
261
+ #### `attachments` parameter (issue/comment tools)
262
+
263
+ `create_issue`, `update_issue`, `post_issue_comment`, and `update_issue_comment` accept an
264
+ optional `attachments: string[]` of local file paths. Each file is uploaded to PostgresAI
265
+ storage and the resulting markdown link is appended to the comment body or issue
266
+ description (image extensions — `.png .jpg .jpeg .gif .webp .svg .bmp .ico` — render
267
+ inline as `![](url)`; everything else as `[](url)`).
268
+
269
+ For `post_issue_comment` and `update_issue_comment`, either `content` or `attachments`
270
+ must be non-empty (attachments alone are allowed). For `update_issue` with `attachments`
271
+ but no `description`, the existing description is fetched first and the new links are
272
+ appended to it.
273
+
274
+ #### Threat model
275
+
276
+ The MCP server runs in your local user account with your PostgresAI API key. It
277
+ treats the connected MCP client (the LLM agent) as **trusted** — the same way the
278
+ CLI treats you when you type a command. In particular:
279
+
280
+ - `upload_file` and the `attachments: string[]` parameter on the issue/comment tools
281
+ read **any local file the CLI process can read**, including secrets like
282
+ `~/.ssh/id_rsa`, `~/.aws/credentials`, or `~/.config/postgresai/config.json` (which
283
+ contains your own API key). The file's bytes are uploaded to PostgresAI storage
284
+ and the resulting URL becomes visible to anyone with read access to the issue or
285
+ comment it ends up in.
286
+ - `download_file` writes to **any path the CLI process can write to** when
287
+ `output_path` is supplied (`~/.ssh/authorized_keys`, `~/.bashrc`, etc. are all
288
+ fair game). When `output_path` is omitted, downloads are restricted to the
289
+ current working directory.
290
+
291
+ This is fine when the agent and the upstream context the agent is reading are
292
+ trusted. It is **not** safe to run this MCP server against an agent that is
293
+ processing untrusted text (issue bodies, comments, web pages, third-party docs)
294
+ without additional sandboxing — a prompt-injection in any input the agent reads
295
+ could be used to exfiltrate local secrets or write arbitrary files. If you need
296
+ to expose this MCP server to such an agent, run the agent (and this server) in a
297
+ container or restricted user account that doesn't have access to anything
298
+ sensitive.
253
299
 
254
300
  ### Issues management (`issues` group)
255
301
 
256
302
  ```bash
257
- postgresai issues list # List issues (shows: id, title, status, created_at)
258
- postgresai issues view <issueId> # View issue details and comments
259
- postgresai issues post_comment <issueId> <content> # Post a comment to an issue
260
- # Options:
261
- # --parent <uuid> Parent comment ID (for replies)
303
+ postgresai issues list # List issues (shows: id, title, status, created_at)
304
+ postgresai issues view <issueId> # View issue details and comments
305
+ postgresai issues create --org-id <id> --title <t> # Create a new issue
306
+ postgresai issues update <issueId> [--title ... --status ...]# Update an existing issue
307
+ postgresai issues post-comment <issueId> <content> # Post a comment to an issue
308
+ postgresai issues update-comment <commentId> <content> # Update an existing comment
309
+ postgresai issues files upload <path> # Upload a file, print URL + markdown
310
+ postgresai issues files download <url> [-o <path>] # Download a file
311
+ # Common options:
312
+ # --parent <uuid> Parent comment ID (for replies on post-comment)
262
313
  # --debug Enable debug output
263
314
  # --json Output raw JSON (overrides default YAML)
264
315
  ```
265
316
 
317
+ #### Attaching files to issues and comments (`--attach`)
318
+
319
+ `create`, `update`, `post-comment`, and `update-comment` accept a repeatable
320
+ `--attach <path>` flag. Each file is uploaded to PostgresAI storage and a
321
+ markdown link is appended to the comment body (or issue description). Image
322
+ extensions — `.png .jpg .jpeg .gif .webp .svg .bmp .ico` — render inline as
323
+ `![](url)`; everything else as `[](url)`. Multiple `--attach` flags preserve
324
+ order; each link goes on its own line.
325
+
326
+ ```bash
327
+ # Attach a screenshot to a new comment
328
+ postgresai issues post-comment <issueId> "Saw this in prod" --attach screenshot.png
329
+
330
+ # Attach multiple files to a new issue
331
+ postgresai issues create --org-id 4 --title "Slow query" \
332
+ --description "Plan attached" --attach plan.txt --attach flame.svg
333
+
334
+ # Attach a file to an existing issue without changing the description.
335
+ # The current description is fetched and the link is appended to it.
336
+ postgresai issues update <issueId> --attach trace.log
337
+ ```
338
+
266
339
  #### Output format for issues commands
267
340
 
268
341
  By default, issues commands print human-friendly YAML when writing to a terminal. For scripting, you can: