@zackbart/connecta 0.24.2 → 0.24.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.
Files changed (97) hide show
  1. package/AGENTS.md +18 -20
  2. package/CHANGELOG.md +205 -1
  3. package/README.md +5 -6
  4. package/dist/auth/bearer.js +2 -0
  5. package/dist/auth/downstream-oauth.d.ts +12 -1
  6. package/dist/auth/downstream-oauth.js +147 -35
  7. package/dist/branding.d.ts +31 -2
  8. package/dist/branding.js +116 -8
  9. package/dist/call-admission.d.ts +4 -0
  10. package/dist/call-admission.js +26 -0
  11. package/dist/catalog-drift.js +9 -4
  12. package/dist/catalog-service.d.ts +2 -0
  13. package/dist/catalog-service.js +25 -8
  14. package/dist/catalog.d.ts +2 -0
  15. package/dist/catalog.js +246 -121
  16. package/dist/connectors/api.d.ts +1 -1
  17. package/dist/connectors/api.js +21 -3
  18. package/dist/connectors/guarded-fetch.d.ts +6 -2
  19. package/dist/connectors/guarded-fetch.js +61 -24
  20. package/dist/connectors/remote-mcp.js +92 -57
  21. package/dist/errors.d.ts +28 -3
  22. package/dist/errors.js +60 -1
  23. package/dist/execute.js +85 -23
  24. package/dist/executor-result.js +3 -1
  25. package/dist/executors/quickjs-child.js +5 -1
  26. package/dist/executors/quickjs-protocol.d.ts +4 -0
  27. package/dist/executors/quickjs-runtime.d.ts +1 -1
  28. package/dist/executors/quickjs-runtime.js +38 -21
  29. package/dist/executors/quickjs.js +68 -27
  30. package/dist/index.d.ts +15 -1
  31. package/dist/index.js +36 -4
  32. package/dist/invocation.js +134 -93
  33. package/dist/mcp-result.js +3 -2
  34. package/dist/meta-tools.js +191 -36
  35. package/dist/operator-ui/generated.js +2 -2
  36. package/dist/operator-ui/view.d.ts +38 -1
  37. package/dist/operator-ui/view.js +71 -0
  38. package/dist/providers/cloudflare.d.ts +14 -2
  39. package/dist/providers/cloudflare.js +107 -16
  40. package/dist/providers/linear.d.ts +26 -4
  41. package/dist/providers/linear.js +19 -4
  42. package/dist/providers/mixpanel.d.ts +16 -3
  43. package/dist/providers/mixpanel.js +13 -2
  44. package/dist/providers/notion.d.ts +8 -1
  45. package/dist/providers/notion.js +83 -10
  46. package/dist/providers/revenuecat.d.ts +30 -4
  47. package/dist/providers/revenuecat.js +42 -4
  48. package/dist/providers/stripe.d.ts +7 -1
  49. package/dist/providers/stripe.js +30 -4
  50. package/dist/providers/vercel.js +11 -1
  51. package/dist/registry.d.ts +22 -2
  52. package/dist/registry.js +101 -13
  53. package/dist/routes/mcp.d.ts +4 -1
  54. package/dist/routes/mcp.js +84 -13
  55. package/dist/routes/oauth.js +4 -0
  56. package/dist/routes/shared.d.ts +1 -0
  57. package/dist/routes/shared.js +4 -4
  58. package/dist/server.js +15 -3
  59. package/dist/skills.js +6 -5
  60. package/dist/storage/file.d.ts +6 -2
  61. package/dist/storage/file.js +312 -34
  62. package/dist/storage/memory.js +12 -1
  63. package/dist/types.d.ts +37 -0
  64. package/dist/ui.js +18 -10
  65. package/dist/validate.js +3 -3
  66. package/dist/version.d.ts +1 -1
  67. package/dist/version.js +1 -1
  68. package/documentation/architecture.md +193 -165
  69. package/documentation/auth.md +199 -145
  70. package/documentation/code-mode.md +433 -316
  71. package/documentation/meta-tools.md +363 -355
  72. package/examples/worker/AGENTS.md +2 -1
  73. package/examples/worker/README.md +12 -10
  74. package/examples/worker/src/index.ts +12 -15
  75. package/package.json +1 -2
  76. package/templates/node/.env.example +3 -3
  77. package/templates/node/AGENTS.md +5 -4
  78. package/templates/node/README.md +2 -1
  79. package/templates/node/package.json +1 -1
  80. package/templates/node/src/index.ts +23 -22
  81. package/documentation/call-admission.md +0 -142
  82. package/documentation/cloudflare.md +0 -471
  83. package/documentation/connector-guides.md +0 -176
  84. package/documentation/connectors.md +0 -389
  85. package/documentation/linear.md +0 -193
  86. package/documentation/mixpanel.md +0 -160
  87. package/documentation/notion.md +0 -308
  88. package/documentation/operations.md +0 -359
  89. package/documentation/operator-ui.md +0 -135
  90. package/documentation/optional-modules-upgrade.md +0 -243
  91. package/documentation/provider-conventions.md +0 -722
  92. package/documentation/request-admission.md +0 -170
  93. package/documentation/revenuecat.md +0 -305
  94. package/documentation/storage-and-credentials.md +0 -201
  95. package/documentation/stripe.md +0 -262
  96. package/documentation/upgrading.md +0 -754
  97. package/documentation/vercel.md +0 -241
@@ -1,262 +0,0 @@
1
- # Stripe prebuilt connection
2
-
3
- Import `stripe()` independently from `@zackbart/connecta/providers/stripe`. It
4
- wraps [Stripe's hosted MCP server](https://docs.stripe.com/mcp) with OAuth by
5
- default, account-scoped mode guidance, a conservative admission policy, a
6
- task-oriented usage guide, and a vetted safety classification. It adds no
7
- provider dependency and is not reachable from Connecta's root entry.
8
-
9
- ```ts
10
- import { stripe } from "@zackbart/connecta/providers/stripe";
11
-
12
- const billing = stripe("stripe", {
13
- purpose: "Revenue, disputes, and refunds across our Stripe organization",
14
- instructions: "Never refund above $500 without a human in the loop.",
15
- });
16
- ```
17
-
18
- The `id` owns the ordinary connector namespaces. Choose a connector boundary
19
- for its credential or OAuth session and business purpose — not automatically
20
- for each Stripe account. One OAuth session may cover live and sandbox accounts
21
- in the same Stripe organization. Use separate connectors when the credential
22
- or business purpose differs.
23
-
24
- `purpose` is required because it tells an agent where the deployment intends
25
- to route a question. The connector id, title, and purpose are configuration,
26
- not proof of which account the authenticated Stripe session will use. Account
27
- `instructions` are appended to the maintained guide and cannot change the
28
- connector's safety classification.
29
-
30
- ## OAuth mode belongs to the selected account
31
-
32
- Do not pass `mode` for OAuth. Stripe's `list_available_accounts_or_orgs` returns
33
- each available account with its `stripe_context` and `livemode`. The same OAuth
34
- session can return both `livemode: true` and `livemode: false` results.
35
-
36
- The served guide tells agents to call that tool before each account-scoped
37
- operation. They select the intended result and carry its exact `stripe_context`
38
- and `livemode` unchanged. Connector id, title, purpose, and OAuth identity are
39
- routing hints. They never prove the account or mode. Ambiguity stops the call.
40
-
41
- OAuth metadata therefore stays neutral:
42
-
43
- - the default title is `Stripe`;
44
- - the description says `live and sandbox accounts`;
45
- - the guide warns that live writes move real money and sandbox writes change
46
- test data;
47
- - admission uses the stricter sandbox ceiling, because Connecta cannot select
48
- a different connector policy after the account-scoped call begins.
49
-
50
- `mode` remains required for `headers` auth. A restricted key has one fixed live
51
- or sandbox scope. Its title, description, guide, and admission policy keep the
52
- fixed-mode behavior. Construction still throws when a recognizable key prefix
53
- contradicts its declared mode.
54
-
55
- For OAuth, deploy one connector for the session:
56
-
57
- ```ts
58
- connectors: [
59
- stripe("stripe", {
60
- purpose: "Live and sandbox billing for our Stripe organization",
61
- }),
62
- ]
63
- ```
64
-
65
- ## Authentication
66
-
67
- OAuth is the default and the option Stripe recommends: it supports dynamic
68
- client registration and PKCE, and each connector instance keeps its own flow
69
- and tokens in connector-scoped storage. Stripe's current
70
- [session-management documentation](https://docs.stripe.com/mcp#manage-mcp-client-sessions)
71
- says one OAuth session can be tied to more than one account in the same Stripe
72
- organization. It does not say every session has multiple accounts.
73
-
74
- That scope changes what an agent must prove before an account-scoped call. It
75
- calls `list_available_accounts_or_orgs`, resolves the intended result, and
76
- carries its exact `stripe_context` and `livemode`. If more than one account
77
- fits, the agent stops and asks.
78
-
79
- Stripe also accepts a
80
- [restricted API key](https://docs.stripe.com/keys#create-restricted-api-key) as
81
- a bearer token for headless agents:
82
-
83
- ```ts
84
- stripe("stripe_sandbox", {
85
- mode: "sandbox",
86
- purpose: "Automated billing rehearsal",
87
- auth: {
88
- type: "headers",
89
- headers: { Authorization: `Bearer ${env.STRIPE_RESTRICTED_KEY}` },
90
- },
91
- });
92
- ```
93
-
94
- Use a restricted key, not a secret key, and scope it to the operations the
95
- agent actually needs; Stripe's own guidance is to "limit your agent's access to
96
- exactly the functionality it requires". Keep it in the runtime's secret store.
97
-
98
- The same key can come from the connection UI at `/` instead:
99
-
100
- ```ts
101
- stripe("stripe_sandbox", {
102
- mode: "sandbox",
103
- purpose: "Automated billing rehearsal",
104
- auth: { type: "credential" },
105
- });
106
- ```
107
-
108
- `mode` is required either way — a static key answers for exactly one
109
- environment and cannot report which. The literal-header form is checked against
110
- the key's `_live_`/`_test_` prefix at construction; an operator-managed key is
111
- not in the deployment file to read, so the declared mode stands alone and a key
112
- pointed at the other environment fails at Stripe. Declare the mode carefully:
113
- that check is the one guard Connecta can offer, and this shape does not get it.
114
- See
115
- [storage and credentials](./storage-and-credentials.md#a-remote-mcp-connectors-static-credential).
116
-
117
- Organization accounts in one OAuth session are not Stripe Connect connected
118
- accounts. Connect platforms can act as a connected account with
119
- `connectedAccount`, which adds Stripe's documented `Stripe-Account` header at
120
- connector construction. Stripe does not support OAuth for connected-account
121
- calls, and `Stripe-Account` is a second header beside the credential's own,
122
- which the operator-managed shape does not assemble — so this requires a
123
- restricted key through `headers` auth and throws otherwise:
124
-
125
- ```ts
126
- stripe("merchant_42", {
127
- mode: "production",
128
- purpose: "Billing questions for the merchant on account 42",
129
- connectedAccount: "acct_1234567890",
130
- auth: {
131
- type: "headers",
132
- headers: { Authorization: `Bearer ${env.STRIPE_PLATFORM_KEY}` },
133
- },
134
- });
135
- ```
136
-
137
- Administrators must enable MCP access in the Stripe Dashboard. A connector that
138
- boots but cannot list tools is usually a dashboard toggle, not a bad key.
139
-
140
- ## The eleven tools, and what they are classified as
141
-
142
- Stripe currently serves eleven tools. Seven are reads:
143
-
144
- `stripe_api_search`, `stripe_api_details`, `stripe_api_read`,
145
- `get_balance_summary`, `list_available_accounts_or_orgs`,
146
- `manage_stripe_accounts`, and `search_stripe_documentation`.
147
-
148
- Four are writes:
149
-
150
- `stripe_api_write` is destructive. `stripe_implementation_planner`,
151
- `stripe_analytics`, and `send_stripe_mcp_feedback` are additive.
152
-
153
- Two of those deserve a sentence. `stripe_api_read` is a read because Stripe
154
- documents it as the `GET` half of a generic pair — the tool is the read
155
- boundary, not whichever endpoint an agent names inside it, and its sibling
156
- `stripe_api_write` carries every `POST`, `PATCH`, `PUT`, and `DELETE`.
157
- `stripe_implementation_planner` creates and continues provider-side guide
158
- state. `stripe_analytics` combines retrieval with query-run creation behind one
159
- tool. Stripe marks both not read-only and not destructive, so Connecta records
160
- them as additive writes. They leave `destructiveHint` unset. Their explicit
161
- `readOnlyHint: false` already routes them through `call_destructive_tool`, and
162
- asserting destruction would misstate their effect.
163
-
164
- That classification fills in downstream silence and otherwise preserves
165
- explicit annotations. The current server annotates all eleven tools, while the
166
- manifest records what this release reviewed and exposes later contradictions.
167
- A tool on the read allowlist arriving with
168
- `destructiveHint: true` or `readOnlyHint: false` keeps exactly what the
169
- downstream said and stays behind `call_destructive_tool`. A tool on neither
170
- maintained list arriving with `readOnlyHint: true` keeps that too, and stays
171
- callable from `execute_code`. Both are the downstream telling you this release's
172
- allowlist is stale, and on a name no release has reviewed its word is the only
173
- evidence there is. One narrow fail-closed exception applies to a name this
174
- release reviewed and filed destructive: `stripe_api_write` claiming
175
- `readOnlyHint: true` is a downstream bug rather than news, and stays on the
176
- approval path.
177
-
178
- An unfamiliar tool that annotates nothing fails closed onto
179
- `call_destructive_tool` until a Connecta release reviews it. That is not
180
- hypothetical here: Stripe's own MCP page still carries a `create_customer`
181
- example that its tool table no longer lists. Whatever the server actually
182
- serves, an unclassified and unannotated `create_customer` lands on the approval
183
- path. Expect the undocumented Treasury tools Stripe alludes to to arrive
184
- unclassified as well — annotated ones will be taken at their word.
185
-
186
- The upshot is that this connection's tool list is not a fixed set, and the usage
187
- guide tells the agent so: search this connector for what it actually exposes
188
- rather than assuming a documented tool is present. The guide also names the id
189
- discipline the downstream schemas cannot enforce — Stripe ids are typed
190
- prefixes (`cus_`, `sub_`, `ch_`, `pi_`, `in_`, `acct_`), a plausible-looking one
191
- belongs to a different object or to nobody, and the id a write takes comes from
192
- `stripe_api_search` or a list read rather than from a guess.
193
-
194
- Account selection comes before that object-id rule. The served guide names
195
- `list_available_accounts_or_orgs`, `stripe_context`, and `livemode`, and tells
196
- the agent to stop when the account, mode, or selector is ambiguous. It keeps
197
- organization-account selection separate from the restricted-key-only Connect
198
- path, so an agent cannot repair uncertainty by fabricating `Stripe-Account` as
199
- a tool argument.
200
-
201
- The guide also carries the reduction advice the generic schemas cannot (P7):
202
- a list or search read that returns full objects belongs inside `execute_code`,
203
- projected to the fields the question needs before `return`, because an
204
- unprojected list truncates and a projected one keeps customer PII out of the
205
- transcript. It names Stripe search's per-resource field set — charges search
206
- has no `payment_intent` field, so the path is the PaymentIntent's
207
- `latest_charge` — and the account → search → details → read sequence as one
208
- program rather than four turns, and it names `outcome`, `failure_code`, and
209
- `failure_message` on the charge as the answer to "why did this payment fail".
210
-
211
- Stripe publishes no stability or deprecation policy for this tool set and
212
- invites tool requests by email, so treat the list as unversioned. `get_balance_summary`
213
- is Treasury, which Stripe labels public preview and gates behind an access
214
- request — expect it to be absent unless the account is allowlisted, and expect
215
- the other Treasury tools Stripe alludes to but does not document to arrive
216
- unclassified.
217
-
218
- ## Rate limits
219
-
220
- Stripe documents no rate limit specific to the MCP server. The connection
221
- therefore transcribes the account limit that MCP traffic spends
222
- ([rate limits](https://docs.stripe.com/rate-limits)): **100 requests per second
223
- in live mode, 25 in a sandbox**, and any single endpoint is capped at 25 per
224
- second regardless of mode. OAuth uses 25 calls per second and concurrency 4,
225
- the safe bound for a session that can reach either mode. Fixed live credentials
226
- use 100 calls per second and concurrency 8. Fixed sandbox credentials use 25
227
- and concurrency 4. Stripe
228
- documents that per-account and per-endpoint concurrency limits exist, and
229
- surface as `429` with a `Stripe-Rate-Limited-Reason` of `global-concurrency` or
230
- `endpoint-concurrency`, but publishes no number.
231
-
232
- As with every connector policy this is a **best-effort approximation** of the
233
- provider's limit, not an enforcement of it. Each runtime keeps its own counter,
234
- so N Worker isolates or Node processes serving one deployment can each admit up
235
- to the stated rate, and the same Stripe account may be spending its budget on
236
- traffic Connecta never sees. Discovery traffic is outside connector call
237
- admission and still needs restrained use.
238
-
239
- ## What is not verified
240
-
241
- Stripe's MCP documentation is silent on one thing this connection had to reason
242
- about rather than read:
243
-
244
- - **Whether pagination cursors and `Idempotency-Key` are passable through
245
- `stripe_api_read` / `stripe_api_write`.** The conventions in the usage guide
246
- are Stripe's documented API conventions; how they thread through the generic
247
- tools' arguments is not documented. The guide states them because an agent
248
- that ignores them is wrong either way.
249
-
250
- `npm run drift:check -- --docs --provider stripe` compares Stripe's official
251
- 16-tool table with the vetted manifest and checks the hosted endpoint plus OAuth
252
- support. `list_available_accounts_or_orgs` and `manage_stripe_accounts` remain
253
- classified from an authenticated review even though the current public table
254
- does not list them. The command prints that discrepancy without treating docs
255
- silence as proof that a live account no longer serves them.
256
-
257
- ## Conventions
258
-
259
- This connection is audited against
260
- [the provider conventions](./provider-conventions.md). Its verdict per
261
- convention, including every recorded exception, is the Stripe section of
262
- [the provider audit](https://github.com/zackbart/connecta/blob/main/records/provider-audit.md).