postgresai 0.15.0-dev.10 → 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 +79 -8
- package/bin/postgres-ai.ts +220 -141
- package/dist/bin/postgres-ai.js +4050 -694
- package/lib/checkup-dictionary.ts +0 -11
- package/lib/checkup.ts +14 -14
- package/lib/init.ts +1 -1
- package/lib/instances.ts +245 -0
- package/lib/mcp-server.ts +139 -18
- package/lib/metrics-loader.ts +3 -3
- package/lib/storage.ts +77 -1
- package/package.json +1 -1
- package/test/issues.cli.test.ts +395 -0
- package/test/mcp-server.test.ts +485 -2
- package/test/monitoring.test.ts +277 -0
- package/test/storage.test.ts +175 -1
package/README.md
CHANGED
|
@@ -249,22 +249,93 @@ Cursor configuration example (Settings → MCP):
|
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
Tools exposed:
|
|
252
|
-
- list_issues
|
|
253
|
-
- view_issue
|
|
254
|
-
-
|
|
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 ``; 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.
|
|
255
299
|
|
|
256
300
|
### Issues management (`issues` group)
|
|
257
301
|
|
|
258
302
|
```bash
|
|
259
|
-
postgresai issues list
|
|
260
|
-
postgresai issues view <issueId>
|
|
261
|
-
postgresai issues
|
|
262
|
-
#
|
|
263
|
-
|
|
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)
|
|
264
313
|
# --debug Enable debug output
|
|
265
314
|
# --json Output raw JSON (overrides default YAML)
|
|
266
315
|
```
|
|
267
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
|
+
``; 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
|
+
|
|
268
339
|
#### Output format for issues commands
|
|
269
340
|
|
|
270
341
|
By default, issues commands print human-friendly YAML when writing to a terminal. For scripting, you can:
|