foldrun 10.3.1 → 10.4.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/bin/foldrun.mjs +3 -1
- package/docs/api.md +26 -7
- package/docs/cli.md +3 -1
- package/docs/mcp.md +75 -13
- package/package.json +1 -1
- package/src/commands.mjs +33 -1
package/bin/foldrun.mjs
CHANGED
|
@@ -170,6 +170,8 @@ const HELP = `foldrun — agents are just folders
|
|
|
170
170
|
foldrun inbox what waits on you: approvals, questions, issues, proposed fixes, your failed runs (--team, --all, --kind, --unread, --dismissed)
|
|
171
171
|
foldrun inbox read|unread|dismiss|restore <id>… mark items in your own view (dismiss sets aside; it still waits where it lives)
|
|
172
172
|
foldrun mcp this account as MCP tools for an AI app, over stdio, with this machine's sign-in: \`claude mcp add foldrun -- foldrun mcp\` (--read-only: only the tools that read)
|
|
173
|
+
foldrun mcp connections the AI apps connected over OAuth (claude.ai and the like): which app, whose, what access, last used — everyone's for an admin, else yours (--all adds the disconnected, --json)
|
|
174
|
+
foldrun mcp disconnect <id> end one: every token it holds stops working (asks; --yes)
|
|
173
175
|
foldrun issues what went wrong, grouped, open until resolved (--to <workspace>, --all, --status, --json)
|
|
174
176
|
foldrun issues show|ack|snooze|resolve|reopen <id> one issue — snooze --for 1d or --times 5, --note "…"
|
|
175
177
|
foldrun issues doctor <id> the run doctor on the issue's newest run, in its workspace: why, and the fix as diffs, saved on yes (--yes, --dry-run, --json)
|
|
@@ -351,7 +353,7 @@ Options
|
|
|
351
353
|
--value "<text>" secrets set: skip the prompt (careful with shell history)
|
|
352
354
|
--site <domain> secrets set, secrets sites: a site the secret is bound to — the egress proxy fills it for those alone (repeatable, or a,b)
|
|
353
355
|
--clear secrets sites: unbind it; flow compute: no cap of its own
|
|
354
|
-
--all secrets workspaces: every workspace may use the account secret again
|
|
356
|
+
--all secrets workspaces: every workspace may use the account secret again; mcp connections: the disconnected ones too
|
|
355
357
|
--none secrets workspaces, secrets set: no workspace may use the account secret
|
|
356
358
|
--workspaces <a,b> secrets set: store an account secret limited to those workspaces, in the same write (with --account)
|
|
357
359
|
--add <site> agent network: add a site to its network: list (repeatable)
|
package/docs/api.md
CHANGED
|
@@ -17,7 +17,7 @@ proof instead of a key: a token or signature (`/s/<token>`, `/api/hooks`,
|
|
|
17
17
|
`/api/inbox`, `/api/events`, `/api/approve`, `/api/unsubscribe`, `/api/billing/stripe`,
|
|
18
18
|
`/api/billing/confirm`), the sign-in and recovery steps (`/api/auth/signup`,
|
|
19
19
|
`login`, `forgot`, `reset`, `verify`, `mfa/verify`, `session`, `/api/cli/login`,
|
|
20
|
-
`/api/cli/login/<id>`, `/api/cli/authorize` GET, `/api/oauth/callback`), `/api/healthz`, `/api/status`, `/api/status/history`, `/api/version` and `/api/openapi.json
|
|
20
|
+
`/api/cli/login/<id>`, `/api/cli/authorize` GET, `/api/oauth/callback`), `/api/healthz`, `/api/status`, `/api/status/history`, `/api/version` and `/api/openapi.json` — and an AI app's OAuth sign-in to `/api/mcp`: `/api/mcp/oauth/register` (open, as the protocol needs) and `/api/mcp/oauth/token` (its code and PKCE verifier, or its refresh token, are the proof).
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
Authorization: Bearer <api-key> # machines. Settings → API keys
|
|
@@ -528,12 +528,12 @@ published, is `404` like one that does not exist.
|
|
|
528
528
|
|
|
529
529
|
## MCP — AI apps connecting with a key
|
|
530
530
|
|
|
531
|
-
The platform as an [MCP server](mcp) for Claude Code, Claude
|
|
532
|
-
Cursor, Codex and any other MCP client. An **API key**
|
|
533
|
-
(`Authorization: Bearer mda_…`)
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
refusal hold. MCP's Streamable HTTP transport, stateless: one JSON-RPC 2.0
|
|
531
|
+
The platform as an [MCP server](mcp) for claude.ai, Claude Code, Claude
|
|
532
|
+
Desktop, Cursor, Codex and any other MCP client. An **API key**
|
|
533
|
+
(`Authorization: Bearer mda_…`) or an AI app's **OAuth access token** (below)
|
|
534
|
+
opens it — never a session cookie, never an A2A key — and every tool is a call
|
|
535
|
+
to one of the routes above, made with that credential, so it answers what the
|
|
536
|
+
route would: its role, its workspaces and every refusal hold. MCP's Streamable HTTP transport, stateless: one JSON-RPC 2.0
|
|
537
537
|
message per request, answered as JSON — no SSE stream, no session id, no
|
|
538
538
|
batches. Errors before a message is read (no key, a refused key, a foreign
|
|
539
539
|
`Origin`, an `MCP-Protocol-Version` it does not speak) are JSON-RPC error
|
|
@@ -543,3 +543,22 @@ with `HTTP <status>: <the route's error>`.
|
|
|
543
543
|
| Route | Methods | |
|
|
544
544
|
|---|---|---|
|
|
545
545
|
| `/api/mcp` | POST | one JSON-RPC message: `initialize` (revisions `2025-11-25`, `2025-06-18`, `2025-03-26`; an unknown one is answered with the newest), `ping`, `tools/list`, `tools/call`; a notification is `202` with no body. `?readonly=1` offers only the tools that read and refuses the rest (`-32602`). The tools: `whoami`, `list_workspaces`, `inbox`, `list_approvals`, `list_flows`, `list_runs`, `get_run`, `read_file`, `run_flow`, `decide_approval`, `answer_question`, `message_run`, `stop_run` — see [MCP](mcp#the-tools). `foldrun mcp` serves the same over stdio |
|
|
546
|
+
| `/api/mcp/oauth/register` | POST | an AI app registers itself (RFC 7591), before anyone signs it in. Open, as the protocol needs — no key. `{ redirect_uris, client_name?, token_endpoint_auth_method?, grant_types?, response_types?, client_uri? }`: one to ten redirect URIs, each `https` or `http` to localhost, no fragment; `token_endpoint_auth_method` `none` (PKCE alone), `client_secret_post` or `client_secret_basic` (the default). Answers `201 { client_id, client_id_issued_at, client_name, redirect_uris, grant_types, response_types, token_endpoint_auth_method, client_secret?, client_secret_expires_at? }` — the secret only for the two secret methods, shown once. Errors are OAuth's `{ error, error_description }` (`invalid_redirect_uri`, `invalid_client_metadata`); `503` past 5,000 apps on the install |
|
|
547
|
+
| `/api/mcp/oauth/authorize` | GET, POST | the person's half of the sign-in, for the page at `/mcp/authorize` — a signed-in person only, never a key or a support view. GET `?request=<the app's query>` checks it and answers `{ client: { name, id, kind, uri }, redirectHost, loopback, scopes, account, person: { email, role }, workspaces, allWorkspaces }`; POST `{ request, decision: approve\|deny, access?: read\|write, workspaces?: [names] \| null }` answers `{ ok, redirect }` — the app's redirect URI with a one-time `code` (ten minutes), `state` and `iss`, or with `error=access_denied`. A request that names an unknown app or a redirect URI it did not register is `400` and never redirected; the rest of its faults (no PKCE `S256` challenge, a `resource` that is not this `/api/mcp`, an unknown scope) come back as `{ redirect }` with OAuth's error. `access: write` needs the app to have asked for `mcp:write`; `workspaces` must be ones the person may open (`403` otherwise) |
|
|
548
|
+
| `/api/mcp/oauth/token` | POST | OAuth 2.1's token endpoint, form-encoded (JSON is read too), no key: `grant_type=authorization_code` with `code`, `redirect_uri`, `code_verifier` (PKCE S256) and `client_id` — or the app's secret, Basic or in the form —, or `grant_type=refresh_token` with `refresh_token`. `resource`, when sent, must be this `/api/mcp`. Answers `{ access_token, token_type: "Bearer", expires_in: 3600, refresh_token, scope }` with `Cache-Control: no-store`. A code is good once, right or wrong. A refresh token is rotated on use; one used twice revokes the whole connection. Errors: `400 invalid_grant` / `invalid_target` / `unsupported_grant_type`, `401 invalid_client` |
|
|
549
|
+
| `/api/mcp/connections` | GET | the AI apps connected over OAuth: `{ connections: [{ id, client, clientId, redirectHost, person, role, workspaces, access: read\|write, createdAt, lastUsedAt, revokedAt }], everyone }` — every one for `keys:manage` (`everyone: true`), else your own. `?all=1` adds the revoked |
|
|
550
|
+
| `/api/mcp/connections/<id>` | DELETE | disconnect one: the grant is revoked and every token it issued stops at once. Your own, or anyone's with `keys:manage` (`403` otherwise); `404` when there is none or it is already revoked. Audited as `mcp.revoked` |
|
|
551
|
+
|
|
552
|
+
**OAuth for AI apps.** claude.ai — and any MCP client that signs in rather
|
|
553
|
+
than taking a pasted key — finds this from the `401` of `/api/mcp`:
|
|
554
|
+
`WWW-Authenticate: Bearer resource_metadata="…/.well-known/oauth-protected-resource/api/mcp"`
|
|
555
|
+
(RFC 9728), which names this install as the authorization server, whose
|
|
556
|
+
`/.well-known/oauth-authorization-server` (RFC 8414) lists the endpoints above,
|
|
557
|
+
`code_challenge_methods_supported: ["S256"]` and
|
|
558
|
+
`client_id_metadata_document_supported: true` (an app may name itself by an
|
|
559
|
+
`https` URL to its metadata document, fetched through the SSRF guard). Scopes
|
|
560
|
+
are `mcp:read` and `mcp:write`. The access token (`fmcp_at_…`, an hour) opens
|
|
561
|
+
`POST /api/mcp` and nothing else — sent to any other route it is `403` — and
|
|
562
|
+
acts as the person who approved it, at the lower of the role they chose then
|
|
563
|
+
and the one they hold now, in the workspaces both allow; a read-only
|
|
564
|
+
connection is refused every write.
|
package/docs/cli.md
CHANGED
|
@@ -96,6 +96,8 @@ claude.ai or Claude Code there, nor any MCP configuration on disk.
|
|
|
96
96
|
| `foldrun inbox` | what waits on you across your workspaces ([your inbox](runs#your-inbox)): gates, questions agents ask, open issues, proposed fixes, your runs that went wrong this week — assigned to you and started by you by default; `--team`, `--started`, `--mine`, `--all`, `--dismissed`, `--kind approval\|question\|issue\|proposal\|run`, `--unread`, `--json`. Each item shows its id; exits 1 when something assigned to you is unread |
|
|
97
97
|
| `foldrun inbox read\|unread\|dismiss\|restore <id>…` | mark items in your own view: `dismiss` sets one aside (it still waits where it lives), `restore` puts it back |
|
|
98
98
|
| `foldrun mcp` | this account as an [MCP server](mcp) on stdin/stdout, for an AI app to start: `claude mcp add foldrun -- foldrun mcp`, `codex mcp add foldrun -- foldrun mcp`. Each line is one JSON-RPC message, forwarded to the platform's `POST /api/mcp` with this machine's sign-in (`--profile`, `--url`, `--token` as for any platform command); stdout carries nothing but protocol. `--read-only` offers only the tools that read. Typed into a terminal it prints how to connect and exits 2 |
|
|
99
|
+
| `foldrun mcp connections` | the AI apps connected to the account over OAuth (claude.ai and the like): the app, where its answers go, whose approval, read only or read and act, which workspaces, connected and last used. Everyone's for an admin (`keys:manage`), else your own; `--all` adds the disconnected, `--json` the raw list |
|
|
100
|
+
| `foldrun mcp disconnect <id>` | end one connection: every token it holds stops at once. Your own, or anyone's as an admin. Asks first; `--yes` when there is no terminal |
|
|
99
101
|
| `foldrun issues` | the account's [issues](runs#issues): what went wrong, grouped, open until someone resolves it — kind, desk and flow (or the platform cause and every desk it hit), how many times since when, the newest reason and what to do. `--to <workspace>` narrows it, `--all` adds resolved ones (`--status open\|acknowledged\|snoozed\|resolved\|all`), `--json` |
|
|
100
102
|
| `foldrun issues show\|ack\|snooze\|resolve\|reopen <id>` | one issue: `show` adds its runs and history; `ack` says you have seen it, `snooze --for 30m\|4h\|1d\|1w` (or `--until <ISO>`, or `--times <n>`: until it happens n more times) hides it for a while, `resolve` closes it until it happens again, `reopen` undoes that. `--note "…"` is kept in its history |
|
|
101
103
|
| `foldrun issues doctor <id>` | the run doctor on an issue's newest run, in that run's workspace — the issue card's **Doctor** button: why (platform, check, work or outside), and the fix as diffs, saved on yes (`--yes`, `--dry-run`, `--json`). A missed schedule has no run and is refused |
|
|
@@ -231,7 +233,7 @@ claude.ai or Claude Code there, nor any MCP configuration on disk.
|
|
|
231
233
|
| `--payload <json\|text\|@file>` | `approve`: release a step waiting on `wait: event` with this body (`POST …/approve` `{ payload }`). JSON is sent as JSON, anything else as text; `@file` reads a file |
|
|
232
234
|
| `--note "<text>"` | `approve`: guidance the approved step reads in its prompt — "approve, but skip the Sydney batch". `reject`: the reason, recorded on the trace |
|
|
233
235
|
| `--read-only` | `mcp`: offer the AI app only the tools that read — no `run_flow`, `decide_approval`, `answer_question`, `message_run` or `stop_run` |
|
|
234
|
-
| `--yes` | skip the confirmation, deliberately: `approve`, `stop`, `deploy` (when it would delete files), and a bulk `stop` or `rerun`, `flow rotate-hook`, `flow draft`, `assistant`, `a2a cancel`, `history restore`, `restore`, `billing plan`, `repo deploy`/`merge`, `workspace set name`, and every delete — `runs rm`, `storage rm`, `storage unshare`, `source rm`, `secrets rm`, `keys revoke`, `workspaces rm`. Required when there is no terminal to ask; without it nothing is deleted |
|
|
236
|
+
| `--yes` | skip the confirmation, deliberately: `approve`, `stop`, `deploy` (when it would delete files), and a bulk `stop` or `rerun`, `flow rotate-hook`, `flow draft`, `assistant`, `mcp disconnect`, `a2a cancel`, `history restore`, `restore`, `billing plan`, `repo deploy`/`merge`, `workspace set name`, and every delete — `runs rm`, `storage rm`, `storage unshare`, `source rm`, `secrets rm`, `keys revoke`, `workspaces rm`. Required when there is no terminal to ask; without it nothing is deleted |
|
|
235
237
|
| `--json` | `report`: the raw run record instead of the report. `observe`, `usage`, `workspaces`, `workspaces show`, `agent ls`, `flow ls`, `agent import --list`, `assistant`, `backups requests`, `status --platform --history`, `team`: the raw document |
|
|
236
238
|
| `--events <a,b>` | `account set notify`: which events are notified on — `failed`, `awaiting-approval`, `completed` |
|
|
237
239
|
| `--watch` | `invoke`: follow the run's trace here as it happens; the exit code is the run's |
|
package/docs/mcp.md
CHANGED
|
@@ -9,16 +9,41 @@ the decisions — approve, answer, message, start, stop.
|
|
|
9
9
|
Ask it "what is waiting on me in foldrun?", "why did last night's run of
|
|
10
10
|
`weekly` fail?" or "approve the draft in run r-…, and say why".
|
|
11
11
|
|
|
12
|
-
There are
|
|
12
|
+
There are three ways in, and they serve the same tools:
|
|
13
13
|
|
|
14
14
|
| | needs | for |
|
|
15
15
|
|---|---|---|
|
|
16
|
+
| OAuth | nothing: you approve the app in foldrun | claude.ai (web and phone), and any app that signs in by itself |
|
|
16
17
|
| `foldrun mcp` | the CLI, signed in (`foldrun login`) | an app on the same machine — nothing to paste |
|
|
17
|
-
| `POST /api/mcp` | an API key | an app that
|
|
18
|
+
| `POST /api/mcp` with a key | an API key | an app that takes a header, or a machine without the CLI |
|
|
18
19
|
|
|
19
20
|
## Connecting
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
### claude.ai, and apps that sign in
|
|
23
|
+
|
|
24
|
+
In claude.ai: **Settings → Connectors → Add custom connector**, name it
|
|
25
|
+
foldrun, and give it your platform's MCP address:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
https://<your platform>/api/mcp
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Leave the OAuth client ID and secret empty — claude.ai registers itself. When
|
|
32
|
+
you click **Connect**, it sends you to foldrun: sign in if you are not, and a
|
|
33
|
+
page says which app is asking, where the answer goes (`claude.ai`), and lets
|
|
34
|
+
you choose:
|
|
35
|
+
|
|
36
|
+
- **what it may do** — read only (inbox, runs, flows, files), or read and act
|
|
37
|
+
(also start and stop runs, approve gates, answer and message agents);
|
|
38
|
+
- **which workspaces** — every one you may open, or the ones you tick.
|
|
39
|
+
|
|
40
|
+
**Connect** sends you back to claude.ai, connected; **Deny** sends it a no.
|
|
41
|
+
It is the same in the Claude apps on a phone, which share claude.ai's
|
|
42
|
+
connectors, and in any MCP client that follows the MCP authorization spec.
|
|
43
|
+
|
|
44
|
+
### With the CLI
|
|
45
|
+
|
|
46
|
+
On a machine that is signed in:
|
|
22
47
|
|
|
23
48
|
```sh
|
|
24
49
|
claude mcp add foldrun -- foldrun mcp # Claude Code
|
|
@@ -34,9 +59,13 @@ Claude Desktop, Cursor and other apps that take a JSON config:
|
|
|
34
59
|
`foldrun mcp` forwards each message to the platform the CLI is signed in to,
|
|
35
60
|
as the account `foldrun whoami` names — `--profile <name>` picks another
|
|
36
61
|
signed-in account, `--url` and `--token` (or `FOLDRUN_URL`, `FOLDRUN_TOKEN`)
|
|
37
|
-
another platform or key.
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
another platform or key. The account is pinned when it starts — `foldrun use`
|
|
63
|
+
in another terminal never moves a running session — and the key is read again
|
|
64
|
+
for every message, so a sign-in another command renews is picked up; the
|
|
65
|
+
renewal itself is checked again twice a day. Typed into a terminal it prints
|
|
66
|
+
how to connect and exits: it is for an app to start.
|
|
67
|
+
|
|
68
|
+
### With a key
|
|
40
69
|
|
|
41
70
|
Over HTTP, with a key from Settings → API keys:
|
|
42
71
|
|
|
@@ -46,8 +75,30 @@ claude mcp add --transport http foldrun https://<your platform>/api/mcp \
|
|
|
46
75
|
```
|
|
47
76
|
|
|
48
77
|
Settings → API keys → **Connecting an AI app (MCP)** shows this install's
|
|
49
|
-
address and the same lines.
|
|
50
|
-
|
|
78
|
+
address and the same lines.
|
|
79
|
+
|
|
80
|
+
## Connected apps
|
|
81
|
+
|
|
82
|
+
Every app connected over OAuth is listed in Settings → API keys → **Connected
|
|
83
|
+
AI apps**: the app, where its answers went, whose approval, what access and
|
|
84
|
+
which workspaces, when it was connected and last used. **Disconnect** ends it —
|
|
85
|
+
every token it holds stops at once — and the person can connect it again. You
|
|
86
|
+
see your own; an admin sees everyone's and may disconnect any.
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
foldrun mcp connections # yours, or everyone's for an admin (--all adds the disconnected)
|
|
90
|
+
foldrun mcp disconnect <id> # asks first; --yes on a pipe
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
What a connection may do is decided at every call, not only when it was
|
|
94
|
+
approved: it acts as the person who approved it, at the lower of the role
|
|
95
|
+
they chose then and the role they hold now, in the workspaces both allow. A
|
|
96
|
+
person who leaves the account, or is made a viewer, takes their apps with
|
|
97
|
+
them. The access token lasts an hour and opens `/api/mcp` only — sent to any
|
|
98
|
+
other route it is refused. Refresh tokens rotate on every use, and one used
|
|
99
|
+
twice disconnects the app: someone else has a copy. Approving, disconnecting
|
|
100
|
+
and that automatic disconnect are in the audit log (`mcp.connected`,
|
|
101
|
+
`mcp.revoked`).
|
|
51
102
|
|
|
52
103
|
## The tools
|
|
53
104
|
|
|
@@ -115,11 +166,22 @@ answered `202` with no body. It sits under `/api`, so the proxy holds the same
|
|
|
115
166
|
raw-path check, body limit and rate limit as for every other route.
|
|
116
167
|
|
|
117
168
|
Refused before a message is read, as a JSON-RPC error with a real status: no
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
169
|
+
credential (`401`, with `WWW-Authenticate: Bearer resource_metadata="…/.well-known/oauth-protected-resource/api/mcp"`,
|
|
170
|
+
which is where an app that signs in starts) — a session cookie never opens
|
|
171
|
+
it —, a refused key or an expired or revoked token (`401`, `error="invalid_token"`),
|
|
172
|
+
an `Origin` header that is not the platform's own (`403`; MCP clients send
|
|
173
|
+
none), an `MCP-Protocol-Version` it does not speak (`400`). The route and
|
|
174
|
+
request shape are in [the API reference](api#mcp--ai-apps-connecting-with-a-key).
|
|
175
|
+
|
|
176
|
+
The sign-in follows the MCP authorization spec on OAuth 2.1:
|
|
177
|
+
`/.well-known/oauth-protected-resource` (RFC 9728) names this install as the
|
|
178
|
+
authorization server; `/.well-known/oauth-authorization-server` (RFC 8414)
|
|
179
|
+
lists the endpoints, PKCE `S256` only, and `mcp:read` / `mcp:write`; an app
|
|
180
|
+
registers itself (RFC 7591) or names itself by an `https` URL to its own
|
|
181
|
+
metadata document, which foldrun fetches through its SSRF guard; every token is
|
|
182
|
+
bound to this `/api/mcp` (RFC 8707). Redirect URIs are `https`, or `http` to
|
|
183
|
+
localhost for a desktop app — and for those the approval page warns that the
|
|
184
|
+
app is on this computer.
|
|
123
185
|
|
|
124
186
|
`foldrun mcp` reads one message per line on stdin and writes one per line on
|
|
125
187
|
stdout, and nothing else there: every note goes to stderr. Calls run side by
|
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -6632,7 +6632,17 @@ function issueDoctor(issue) {
|
|
|
6632
6632
|
* @param {string[]} positional @param {Record<string, any>} flags
|
|
6633
6633
|
*/
|
|
6634
6634
|
async function mcpCmd(positional, flags) {
|
|
6635
|
-
|
|
6635
|
+
const [verb, arg, ...extra] = positional;
|
|
6636
|
+
if (verb === "connections" || verb === "ls") return mcpConnectionsCmd(flags);
|
|
6637
|
+
if (verb === "disconnect" || verb === "revoke") {
|
|
6638
|
+
if (!arg || extra.length) throw new Error("which connection? `foldrun mcp disconnect <id>` — ids are in `foldrun mcp connections`");
|
|
6639
|
+
const url = platformFor(flags, "mcp disconnect");
|
|
6640
|
+
if (!(await sureToDelete(flags, "mcp disconnect", `the AI app connection ${arg} on ${url} (every token it holds stops working)`))) return 1;
|
|
6641
|
+
await remoteCall(url, flags, `/api/mcp/connections/${encodeURIComponent(arg)}`, { method: "DELETE" });
|
|
6642
|
+
console.log(`\n ${c.green("✓")} disconnected ${arg}\n`);
|
|
6643
|
+
return 0;
|
|
6644
|
+
}
|
|
6645
|
+
if (positional.length) throw new Error("`foldrun mcp` serves the tools to an AI app (`claude mcp add foldrun -- foldrun mcp`); its verbs are connections and disconnect <id> — not " + verb);
|
|
6636
6646
|
if (process.stdin.isTTY && flags.yes !== true) {
|
|
6637
6647
|
console.error(`\n ${c.bold("foldrun mcp")} is an MCP server on stdin/stdout, for an AI app to start — not to type into.\n\n claude mcp add foldrun -- foldrun mcp${flags["read-only"] === true ? " --read-only" : ""}\n codex mcp add foldrun -- foldrun mcp\n\n ${c.dim("Claude Desktop, Cursor: { \"mcpServers\": { \"foldrun\": { \"command\": \"foldrun\", \"args\": [\"mcp\"] } } } — `foldrun docs mcp`")}\n`);
|
|
6638
6648
|
return 2;
|
|
@@ -6737,6 +6747,28 @@ async function mcpCmd(positional, flags) {
|
|
|
6737
6747
|
return 0;
|
|
6738
6748
|
}
|
|
6739
6749
|
|
|
6750
|
+
/** `foldrun mcp connections` — the AI apps connected to the account over OAuth
|
|
6751
|
+
* (claude.ai and the like): which app, whose approval, what access. Every
|
|
6752
|
+
* one for an admin; your own otherwise. */
|
|
6753
|
+
async function mcpConnectionsCmd(flags) {
|
|
6754
|
+
const url = platformFor(flags, "mcp connections");
|
|
6755
|
+
const view = await remoteCall(url, flags, `/api/mcp/connections${flags.all === true ? "?all=1" : ""}`);
|
|
6756
|
+
if (flags.json) {
|
|
6757
|
+
console.log(JSON.stringify(view, null, 2));
|
|
6758
|
+
return 0;
|
|
6759
|
+
}
|
|
6760
|
+
const rows = view.connections ?? [];
|
|
6761
|
+
console.log(`\n ${c.bold("AI apps connected over OAuth")} ${c.dim(view.everyone ? "· everyone's" : "· yours")}`);
|
|
6762
|
+
if (!rows.length) console.log(`\n ${c.dim("none — claude.ai connects itself when you add this platform's /api/mcp as a custom connector")}`);
|
|
6763
|
+
for (const r of rows) {
|
|
6764
|
+
const used = r.lastUsedAt ? `last used ${String(r.lastUsedAt).slice(0, 16).replace("T", " ")}` : "not used yet";
|
|
6765
|
+
console.log(`\n ${c.bold(r.client)} ${c.dim(`· ${r.redirectHost} · ${r.access === "read" ? "read only" : "read and act"} · ${r.workspaces ? r.workspaces.join(", ") : "all workspaces"}`)}${r.revokedAt ? c.red(" · disconnected") : ""}`);
|
|
6766
|
+
console.log(` ${c.dim(`${r.id} · ${r.person} · connected ${String(r.createdAt).slice(0, 16).replace("T", " ")} · ${used}`)}`);
|
|
6767
|
+
}
|
|
6768
|
+
console.log("");
|
|
6769
|
+
return 0;
|
|
6770
|
+
}
|
|
6771
|
+
|
|
6740
6772
|
async function inboxCmd(positional, flags) {
|
|
6741
6773
|
const url = platformFor(flags, "inbox");
|
|
6742
6774
|
const [verb, ...ids] = positional;
|