@zackbart/connecta 0.7.8 → 0.8.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/CHANGELOG.md +94 -0
- package/README.md +67 -144
- package/dist/activity.d.ts +1 -1
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js.map +1 -1
- package/dist/auth/bearer.d.ts +1 -1
- package/dist/auth/bearer.js +4 -4
- package/dist/auth/bearer.js.map +1 -1
- package/dist/auth/clerk.d.ts +1 -1
- package/dist/auth/clerk.js +1 -1
- package/dist/call-admission.d.ts +81 -0
- package/dist/call-admission.d.ts.map +1 -0
- package/dist/call-admission.js +345 -0
- package/dist/call-admission.js.map +1 -0
- package/dist/catalog-fingerprint.d.ts +20 -0
- package/dist/catalog-fingerprint.d.ts.map +1 -0
- package/dist/catalog-fingerprint.js +34 -0
- package/dist/catalog-fingerprint.js.map +1 -0
- package/dist/catalog-limits.d.ts +10 -0
- package/dist/catalog-limits.d.ts.map +1 -0
- package/dist/catalog-limits.js +10 -0
- package/dist/catalog-limits.js.map +1 -0
- package/dist/catalog-service.d.ts +138 -0
- package/dist/catalog-service.d.ts.map +1 -0
- package/dist/catalog-service.js +407 -0
- package/dist/catalog-service.js.map +1 -0
- package/dist/catalog.js +2 -2
- package/dist/catalog.js.map +1 -1
- package/dist/concurrency.d.ts +4 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +31 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/connectors/api.d.ts +3 -1
- package/dist/connectors/api.d.ts.map +1 -1
- package/dist/connectors/api.js +22 -11
- package/dist/connectors/api.js.map +1 -1
- package/dist/connectors/remote-mcp.d.ts +3 -1
- package/dist/connectors/remote-mcp.d.ts.map +1 -1
- package/dist/connectors/remote-mcp.js +44 -18
- package/dist/connectors/remote-mcp.js.map +1 -1
- package/dist/credential-health.d.ts +0 -22
- package/dist/credential-health.d.ts.map +1 -1
- package/dist/credential-health.js +14 -10
- package/dist/credential-health.js.map +1 -1
- package/dist/credentials.d.ts +3 -2
- package/dist/credentials.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +9 -8
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +144 -291
- package/dist/execute.js.map +1 -1
- package/dist/executor-result.d.ts +0 -3
- package/dist/executor-result.d.ts.map +1 -1
- package/dist/executor-result.js +2 -2
- package/dist/executor-result.js.map +1 -1
- package/dist/executors/quickjs-child.js +3 -3
- package/dist/executors/quickjs-child.js.map +1 -1
- package/dist/executors/quickjs-protocol.d.ts +4 -1
- package/dist/executors/quickjs-protocol.d.ts.map +1 -1
- package/dist/executors/quickjs-runtime.d.ts.map +1 -1
- package/dist/executors/quickjs-runtime.js +7 -2
- package/dist/executors/quickjs-runtime.js.map +1 -1
- package/dist/executors/quickjs.d.ts.map +1 -1
- package/dist/executors/quickjs.js +4 -1
- package/dist/executors/quickjs.js.map +1 -1
- package/dist/favicon.js +2 -2
- package/dist/favicon.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -17
- package/dist/index.js.map +1 -1
- package/dist/invocation.d.ts +96 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +369 -0
- package/dist/invocation.js.map +1 -0
- package/dist/meta-tools.d.ts +11 -86
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +145 -485
- package/dist/meta-tools.js.map +1 -1
- package/dist/operator-ui/generated.d.ts +3 -0
- package/dist/operator-ui/generated.d.ts.map +1 -0
- package/dist/operator-ui/generated.js +5 -0
- package/dist/operator-ui/generated.js.map +1 -0
- package/dist/operator-ui/model.d.ts +94 -0
- package/dist/operator-ui/model.d.ts.map +1 -0
- package/dist/operator-ui/model.js +28 -0
- package/dist/operator-ui/model.js.map +1 -0
- package/dist/registry.d.ts +47 -6
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +356 -35
- package/dist/registry.js.map +1 -1
- package/dist/routes/activity.d.ts +3 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/activity.js +173 -0
- package/dist/routes/activity.js.map +1 -0
- package/dist/routes/credentials.d.ts +3 -0
- package/dist/routes/credentials.d.ts.map +1 -0
- package/dist/routes/credentials.js +181 -0
- package/dist/routes/credentials.js.map +1 -0
- package/dist/routes/mcp.d.ts +8 -0
- package/dist/routes/mcp.d.ts.map +1 -0
- package/dist/routes/mcp.js +383 -0
- package/dist/routes/mcp.js.map +1 -0
- package/dist/routes/oauth.d.ts +4 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +268 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/shared.d.ts +97 -0
- package/dist/routes/shared.d.ts.map +1 -0
- package/dist/routes/shared.js +199 -0
- package/dist/routes/shared.js.map +1 -0
- package/dist/routes/ui.d.ts +3 -0
- package/dist/routes/ui.d.ts.map +1 -0
- package/dist/routes/ui.js +122 -0
- package/dist/routes/ui.js.map +1 -0
- package/dist/server.d.ts +9 -40
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +67 -1292
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +0 -15
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +6 -5
- package/dist/skills.js.map +1 -1
- package/dist/storage/file.d.ts.map +1 -1
- package/dist/storage/file.js +3 -1
- package/dist/storage/file.js.map +1 -1
- package/dist/storage/memory.d.ts.map +1 -1
- package/dist/storage/memory.js +3 -1
- package/dist/storage/memory.js.map +1 -1
- package/dist/toolkits.d.ts +0 -22
- package/dist/toolkits.d.ts.map +1 -1
- package/dist/toolkits.js +2 -2
- package/dist/toolkits.js.map +1 -1
- package/dist/types.d.ts +64 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +3 -93
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +26 -1389
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -8
- package/src/activity.ts +5 -1
- package/src/auth/bearer.ts +4 -4
- package/src/auth/clerk.ts +1 -1
- package/src/call-admission.ts +522 -0
- package/src/catalog-fingerprint.ts +52 -0
- package/src/catalog-limits.ts +11 -0
- package/src/catalog-service.ts +601 -0
- package/src/catalog.ts +2 -2
- package/src/concurrency.ts +39 -0
- package/src/connectors/api.ts +25 -11
- package/src/connectors/remote-mcp.ts +55 -21
- package/src/credential-health.ts +13 -10
- package/src/credentials.ts +2 -2
- package/src/errors.ts +1 -1
- package/src/execute.ts +194 -377
- package/src/executor-result.ts +2 -2
- package/src/executors/quickjs-child.ts +8 -4
- package/src/executors/quickjs-protocol.ts +1 -1
- package/src/executors/quickjs-runtime.ts +5 -1
- package/src/executors/quickjs.ts +11 -8
- package/src/favicon.ts +2 -2
- package/src/index.ts +54 -17
- package/src/invocation.ts +527 -0
- package/src/meta-tools.ts +369 -797
- package/src/operator-ui/browser.css +413 -0
- package/src/operator-ui/browser.ts +1121 -0
- package/src/operator-ui/generated.ts +4 -0
- package/src/operator-ui/model.ts +127 -0
- package/src/registry.ts +489 -44
- package/src/routes/activity.ts +220 -0
- package/src/routes/credentials.ts +266 -0
- package/src/routes/mcp.ts +485 -0
- package/src/routes/oauth.ts +328 -0
- package/src/routes/shared.ts +330 -0
- package/src/routes/ui.ts +153 -0
- package/src/server.ts +70 -1702
- package/src/skills.ts +6 -5
- package/src/storage/file.ts +3 -1
- package/src/storage/memory.ts +3 -1
- package/src/toolkits.ts +2 -2
- package/src/types.ts +70 -2
- package/src/ui.ts +52 -1489
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,100 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.8.0 — 2026-07-28
|
|
6
|
+
|
|
7
|
+
0.8.0 is consolidation before capability growth (#157): the semantics that were
|
|
8
|
+
independently implemented across call paths — invocation, catalog access,
|
|
9
|
+
discovery bounds, timeouts — now live in shared services, the oversized modules
|
|
10
|
+
(`server.ts`, the operator UI) are split into typed, tested units, and the dev
|
|
11
|
+
loop gained correctness-only linting, an unused-code gate, strict indexed and
|
|
12
|
+
optional property checks, and an automated Workers test-partition guard. A
|
|
13
|
+
deployment can take this release without touching its config: entrypoints,
|
|
14
|
+
options, storage formats, and the tool surface are unchanged. The docs were
|
|
15
|
+
restructured — the old numbered manual is retired in favor of a terse
|
|
16
|
+
[`ethos.md`](./ethos.md) and stub guides in `documentation/` — and the
|
|
17
|
+
temporary `@hono/node-server` override is gone now that the SDK (1.30.0)
|
|
18
|
+
depends on a patched version upstream.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`ethos.md`** — what connecta is, what it refuses to be, a decisions table,
|
|
23
|
+
and the invariants, each enforced or reviewer-owned (#175, PR #180). CI caps
|
|
24
|
+
its length; terseness is the point.
|
|
25
|
+
- **Route-contract and operator-UI browser tests** pinning server behavior
|
|
26
|
+
before extraction (#148 PR #168, #149 PR #169).
|
|
27
|
+
- **Automated Workers test-partition guard** — every suite must be classified
|
|
28
|
+
portable or Node-bound, with a reason (#150, PR #161).
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- **Tool invocation and catalog access are shared services** used by direct,
|
|
33
|
+
batch, and code-mode paths alike (#144, PR #162); code-mode dispatch is lazy
|
|
34
|
+
(#145, PR #163); catalog discovery is deduplicated and bounded (#146,
|
|
35
|
+
PR #164); persisted catalogs are chunked with bounded I/O (#147/#167,
|
|
36
|
+
PRs #166/#172).
|
|
37
|
+
- **`server.ts` is a composition root** over extracted route modules (#148,
|
|
38
|
+
PR #170); the operator UI is typed, bundled browser source (#149, PR #169).
|
|
39
|
+
- **Strict indexed access and exact optional property types** are on across
|
|
40
|
+
src and tests (#151, PR #181); Oxlint correctness and Knip unused-code gates
|
|
41
|
+
run in `npm run check` (#155, PR #171).
|
|
42
|
+
- **`@modelcontextprotocol/sdk` 1.30.0** with the `@hono/node-server` override
|
|
43
|
+
removed (#40, PR #174).
|
|
44
|
+
- **Docs restructure** — `docs/` retired; `README.md` is a short overview and
|
|
45
|
+
per-subsystem guides will be rewritten in `documentation/` (#175, PR #180).
|
|
46
|
+
Toolkits (#178) and proactive credential liveness (#179) are recorded as
|
|
47
|
+
retired decisions; their code remains in this release pending removal.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- Nothing user-visible; behavior-preserving consolidation throughout.
|
|
52
|
+
|
|
53
|
+
## 0.7.9 — 2026-07-28
|
|
54
|
+
|
|
55
|
+
0.7.9 adds opt-in, connector-scoped admission for downstream tool calls. Direct
|
|
56
|
+
calls, batch children, and code-mode host calls to the same connector now share
|
|
57
|
+
one per-runtime limiter, including through toolkit-scoped views. Connectors
|
|
58
|
+
without a `callAdmission` policy behave as before. Dependencies, storage
|
|
59
|
+
formats, and package entrypoints are unchanged.
|
|
60
|
+
|
|
61
|
+
The policy is exact within one Node process or Worker isolate. Concurrency
|
|
62
|
+
limits fully contain one request's fan-out; rolling budgets remain best-effort
|
|
63
|
+
across multiple isolates, replicas, or restarts. This release deliberately
|
|
64
|
+
does not add a distributed coordinator.
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
|
|
68
|
+
- **Connector-scoped downstream admission** (issue #138, PR #143).
|
|
69
|
+
`api()`, `remoteMcp()`, and custom connectors accept a plural-ready
|
|
70
|
+
`callAdmission.rules` policy. The single rule supported today can bound
|
|
71
|
+
concurrency, queue size and wait, and rolling-window calls, optionally
|
|
72
|
+
partitioned by a bounded operator-derived key.
|
|
73
|
+
- **Payload-free admission telemetry.** `/health` reports connector aggregates
|
|
74
|
+
for live partitions, active and queued calls, admission outcomes, and queue
|
|
75
|
+
waits without exposing partition keys, arguments, or results.
|
|
76
|
+
- **Explicit cancelled Activity outcomes.** Caller cancellation is represented
|
|
77
|
+
separately from provider errors and timeouts in the public Activity event
|
|
78
|
+
union, the operator UI, and the Worker D1 example.
|
|
79
|
+
|
|
80
|
+
### Changed
|
|
81
|
+
|
|
82
|
+
- **Retries reacquire admission per attempt.** Backoff does not retain a
|
|
83
|
+
concurrency permit, and each actual retry consumes a fresh rolling-budget
|
|
84
|
+
entry. Short proactive `rate_limited` windows continue to use the existing
|
|
85
|
+
safe retry contract.
|
|
86
|
+
- **Queue and connector deadlines are separate.** `queueTimeoutMs` bounds only
|
|
87
|
+
permit wait; the per-attempt tool deadline begins after admission.
|
|
88
|
+
`diagnostics: true` reports the phases separately as `admissionMs` and
|
|
89
|
+
`connectorMs`.
|
|
90
|
+
|
|
91
|
+
### Fixed
|
|
92
|
+
|
|
93
|
+
- **Caller cancellation no longer retries an abandoned attempt or degrades
|
|
94
|
+
connector health.** A call already cancelled avoids connector dispatch.
|
|
95
|
+
Queued cancellation still releases its place without spending a
|
|
96
|
+
rolling-budget entry, while active cancellation releases its permit and
|
|
97
|
+
records a non-retryable `cancelled` result.
|
|
98
|
+
|
|
5
99
|
## 0.7.8 — 2026-07-28
|
|
6
100
|
|
|
7
101
|
0.7.8 makes dependency-free tool discovery recover from natural-language
|
package/README.md
CHANGED
|
@@ -2,130 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
One MCP endpoint in front of
|
|
6
|
-
|
|
5
|
+
One MCP endpoint in front of every integration you've deliberately chosen.
|
|
6
|
+
Agents see a handful of meta-tools instead of hundreds of definitions, and each
|
|
7
|
+
client is configured once instead of once per integration.
|
|
7
8
|
|
|
8
9
|
## The problem
|
|
9
10
|
|
|
10
|
-
An agent connected to N MCP servers pays for all N before it does anything
|
|
11
|
-
server's tool list
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
The second cost is configuration. Every client — Claude, Cursor, whatever comes
|
|
17
|
-
next — has to be pointed at each server separately, with its own auth for each.
|
|
18
|
-
Adding an integration means touching every client; rotating one token means
|
|
19
|
-
finding every place it was pasted.
|
|
11
|
+
An agent connected to N MCP servers pays for all N before it does anything:
|
|
12
|
+
every server's full tool list lands in the context window at connect time,
|
|
13
|
+
nearly all of it irrelevant to the task at hand. The second cost is
|
|
14
|
+
configuration — every client has to be pointed at every server separately,
|
|
15
|
+
each with its own auth, and rotating one token means finding every place it
|
|
16
|
+
was pasted.
|
|
20
17
|
|
|
21
18
|
## What connecta is
|
|
22
19
|
|
|
23
|
-
One MCP endpoint you deploy — Cloudflare Worker
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
API with hand-written tool
|
|
20
|
+
One MCP endpoint you deploy — a Cloudflare Worker or a Node process in a
|
|
21
|
+
Docker stack, same code either way — aggregating your downstream connectors
|
|
22
|
+
behind a small, fixed set of meta-tools. A connector is either a remote MCP
|
|
23
|
+
server that connecta proxies, or a plain HTTP API with hand-written tool
|
|
24
|
+
definitions and a fetch handler. Both come out identical: same two-segment
|
|
25
|
+
addresses (`<connectorId>.<toolName>`), same catalog, same safety rules.
|
|
27
26
|
|
|
28
27
|
```
|
|
29
28
|
┌── remoteMcp("notion") → mcp.notion.com
|
|
30
29
|
Claude / Cursor ── MCP ──▶ connecta ───┼── remoteMcp("linear") → mcp.linear.app
|
|
31
|
-
|
|
30
|
+
sees 9 tools /mcp ├── api("resend") → fetch(...)
|
|
32
31
|
└── api("internal") → fetch(...)
|
|
33
32
|
```
|
|
34
33
|
|
|
35
|
-
Rather than receiving every tool up front, the agent discovers what it needs
|
|
36
|
-
`search_tools`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
**Config as code, one deployment per tenant.** Connectors are declared in
|
|
60
|
-
TypeScript. Adding one is a code change and a deploy — no database of
|
|
61
|
-
integrations, no registration API, no runtime admin. A deployment is a small
|
|
62
|
-
config file you can read in one sitting and review in a pull request, not a
|
|
63
|
-
platform to administer.
|
|
64
|
-
|
|
65
|
-
**Credentials stay server-side.** Downstream tokens live in an AES-GCM encrypted
|
|
66
|
-
vault over the deployment's own storage, with the key held outside it. A
|
|
67
|
-
connector reaches its own credential through `ctx.credential`; the operator
|
|
68
|
-
pages, meta-tools, and code sandbox never expose a secret value. Rotating a token
|
|
69
|
-
at `/credentials` is an operator action rather than a redeploy — though writing
|
|
70
|
-
to the vault is deliberately narrower than everything else, requiring a
|
|
71
|
-
Clerk-authenticated operator on a same-origin request, so a bearer-only
|
|
72
|
-
deployment cannot administer credentials from the browser. Which tools exist
|
|
73
|
-
is still code either way.
|
|
74
|
-
|
|
75
|
-
**Read-only is fail-closed.** Only tools explicitly annotated `readOnlyHint:
|
|
76
|
-
true` are reachable through `call_tool`, `batch_call`, and the sandbox. Missing,
|
|
77
|
-
false, or contradictory annotations do not get the benefit of the doubt: they
|
|
78
|
-
require `call_destructive_tool`, which is itself annotated so the MCP host can
|
|
79
|
-
put the question to a human. Connecta makes the boundary visible; approval is
|
|
80
|
-
the host's job.
|
|
81
|
-
|
|
82
|
-
**Toolkits scope what a team sees.** A deployment belongs to an org; a toolkit
|
|
83
|
-
is a named view over its registry for one group inside that org — support sees
|
|
84
|
-
Zendesk and Notion, exec also sees Gmail. A client selects one with
|
|
85
|
-
`?toolkit=support` on the MCP URL, and a credential can be bound so it opens
|
|
86
|
-
that view and nothing else. Inside a scoped session an out-of-scope address
|
|
87
|
-
fails exactly as a nonexistent one does. Two teams, one deployment. Who gets in
|
|
88
|
-
at all is the prior question: a static bearer token, or Clerk — where
|
|
89
|
-
`allowedDomains: ["acme.com"]` admits anyone whose verified primary email is on
|
|
90
|
-
your domain without enumerating users, and a `gate` hook handles what a domain
|
|
91
|
-
rule cannot express. Both fail closed, and each one configured must pass.
|
|
92
|
-
|
|
93
|
-
**Activity records the fact, not the payload.** The optional activity store logs
|
|
94
|
-
which resolved tool ran, for whom, and how it went — never arguments, results,
|
|
95
|
-
generated code, search text, or raw error messages. The exclusion is structural
|
|
96
|
-
rather than a redaction pass: the event type has nowhere to put a payload, which
|
|
97
|
-
is what keeps an operations log from becoming something worth stealing.
|
|
98
|
-
|
|
99
|
-
**Operator pages that cannot administer the deployment.** Connections at `GET /`
|
|
100
|
-
shows connector health, tool counts, downstream authorization links, and a
|
|
101
|
-
read-only map of the toolkit views declared in deployment config;
|
|
102
|
-
`/credentials` rotates stored secrets; and `/activity` shows the optional
|
|
103
|
-
payload-free ledger. They share one data-free shell with no build step and use
|
|
104
|
-
authenticated private APIs for deployment data. They cannot add a connector,
|
|
105
|
-
change policy, or alter what an agent may call. Credentials connecta stores are
|
|
106
|
-
also probed for liveness
|
|
107
|
-
proactively — using each connector's own test or status hook, never a downstream
|
|
108
|
-
tool call — so a dead token surfaces as `auth_required` with the URL to open on
|
|
109
|
-
Connections and in `list_connectors` before an agent's real call trips over it.
|
|
110
|
-
|
|
111
|
-
## When not to use it
|
|
112
|
-
|
|
113
|
-
Connecta is deliberately small, and declines several tempting shapes.
|
|
114
|
-
It is **not multi-tenant** — one deployment is one tenant, with one registry and
|
|
115
|
-
one credential store, and toolkits are scoped views rather than tenants. There
|
|
116
|
-
is **no policy engine**, no approvals, and no pauses — access decisions are
|
|
117
|
-
fixed ones connecta already knows how to answer (is this tool read-only, may
|
|
118
|
-
this credential open this toolkit), not rules you author. There is **no runtime
|
|
119
|
-
administration** — you cannot add a connector from a browser or an API. It
|
|
120
|
-
aggregates **tools only**, not MCP resources or prompts, and it will not ingest
|
|
121
|
-
a **GraphQL** schema, because generating hundreds of low-quality tool
|
|
122
|
-
definitions is the problem the nine meta-tools exist to solve. OpenAPI is a
|
|
123
|
-
softer no: not built in today, not refused either, and tracked as
|
|
124
|
-
[issue #26](https://github.com/zackbart/connecta/issues/26). If you want a
|
|
125
|
-
hosted multi-tenant integration platform with an approval workflow, this is the
|
|
126
|
-
wrong shape; the
|
|
127
|
-
[non-goals](https://github.com/zackbart/connecta/blob/main/docs/decisions.md#non-goals)
|
|
128
|
-
say so at more length.
|
|
34
|
+
Rather than receiving every tool up front, the agent discovers what it needs:
|
|
35
|
+
`search_tools` ranks matches, `describe_tools` returns schemas for only the
|
|
36
|
+
addresses about to be called, and `call_tool` / `batch_call` /
|
|
37
|
+
`call_destructive_tool` invoke them by address. `list_connectors` reports what
|
|
38
|
+
exists, `authorize_connector` starts a downstream OAuth flow, `get_result`
|
|
39
|
+
pages through oversized results, and `skills` hands the model a short guide to
|
|
40
|
+
the rest. The agent's context holds nine tool definitions whether ten tools
|
|
41
|
+
sit behind them or a thousand.
|
|
42
|
+
|
|
43
|
+
An optional tenth, `execute_code`, runs model-written JavaScript in a sandbox
|
|
44
|
+
with no network, filesystem, or environment access — only the explicitly
|
|
45
|
+
read-only tools as callable globals — turning a loop or a cross-connector join
|
|
46
|
+
into one round trip. Configure no executor and connecta is exactly the
|
|
47
|
+
nine-tool server.
|
|
48
|
+
|
|
49
|
+
Three properties are load-bearing enough to name here; the rest live in the
|
|
50
|
+
[ethos](./ethos.md). **Read-only is fail-closed**: only tools explicitly
|
|
51
|
+
annotated read-only are reachable through `call_tool`, `batch_call`, and the
|
|
52
|
+
sandbox — everything else crosses `call_destructive_tool`, which is annotated
|
|
53
|
+
so the MCP host can ask a human. **Credentials stay server-side**: downstream
|
|
54
|
+
tokens live in an encrypted vault, rotated from an operator page rather than a
|
|
55
|
+
redeploy, and no surface ever returns a secret. **Config is code**: adding a
|
|
56
|
+
connector is an edit and a deploy — no registration API, no admin UI, one
|
|
57
|
+
small file you can review in a pull request.
|
|
129
58
|
|
|
130
59
|
## Getting started
|
|
131
60
|
|
|
@@ -164,42 +93,36 @@ listen(connecta, 8787); // MCP at /mcp; Connections at http://localhost:8787/
|
|
|
164
93
|
```
|
|
165
94
|
|
|
166
95
|
Point an MCP client at `http://localhost:8787/mcp` with an
|
|
167
|
-
`Authorization: Bearer` header and
|
|
168
|
-
`
|
|
96
|
+
`Authorization: Bearer` header and `time.get_now` is discoverable through
|
|
97
|
+
`search_tools`.
|
|
169
98
|
|
|
170
99
|
Runnable deployments live in
|
|
171
100
|
[`examples/`](https://github.com/zackbart/connecta/tree/main/examples):
|
|
172
|
-
[`worker/`](https://github.com/zackbart/connecta/tree/main/examples/worker) is
|
|
173
|
-
free-tier-compatible Cloudflare Worker with KV and D1 adapters
|
|
174
|
-
to copy for a real deployment;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
101
|
+
[`worker/`](https://github.com/zackbart/connecta/tree/main/examples/worker) is
|
|
102
|
+
a free-tier-compatible Cloudflare Worker with KV and D1 adapters and the
|
|
103
|
+
template to copy for a real deployment;
|
|
104
|
+
[`node/`](https://github.com/zackbart/connecta/tree/main/examples/node) extends
|
|
105
|
+
the server above;
|
|
106
|
+
[`docker/`](https://github.com/zackbart/connecta/tree/main/examples/docker) is
|
|
107
|
+
a single-service compose stack. Anything beyond the core is installed only by
|
|
108
|
+
the deployments that use it — `@clerk/backend` and `quickjs-emscripten` are
|
|
109
|
+
optional peers behind the `/auth/clerk` and `/quickjs` subpaths — and connecta
|
|
110
|
+
ships no service-specific connectors: endpoint, credential, and tool choices
|
|
111
|
+
stay in your project, declared with `remoteMcp()` and `api()`.
|
|
112
|
+
|
|
113
|
+
A candid note on maturity: connecta is built for its author's deployments
|
|
114
|
+
first and published openly. Breaking changes are cheap and the version number
|
|
115
|
+
signals change, not stability — the [ethos](./ethos.md) says so on purpose.
|
|
186
116
|
|
|
187
117
|
## Learn more
|
|
188
118
|
|
|
189
|
-
- **[
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
the
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
- **[Decisions](https://github.com/zackbart/connecta/blob/main/docs/decisions.md)**
|
|
200
|
-
— what connecta refuses to be, which alternatives lost and why, and the
|
|
201
|
-
invariants a change must preserve.
|
|
202
|
-
- **[CHANGELOG](https://github.com/zackbart/connecta/blob/main/CHANGELOG.md)** —
|
|
203
|
-
what changed in each release.
|
|
204
|
-
- **[SECURITY](https://github.com/zackbart/connecta/blob/main/SECURITY.md)** —
|
|
205
|
-
supported versions and how to report a vulnerability.
|
|
119
|
+
- **[ethos.md](./ethos.md)** — what this is, what it refuses to be, the
|
|
120
|
+
decisions table, and the invariants every change must preserve. Read this
|
|
121
|
+
before proposing anything.
|
|
122
|
+
- **[documentation/](./documentation/)** — per-subsystem guides. Currently
|
|
123
|
+
stubs: the old manual was retired during the phase-1 docs restructure and
|
|
124
|
+
each guide is being rewritten as the ideas settle; prior text lives in git
|
|
125
|
+
history.
|
|
126
|
+
- **[CHANGELOG](./CHANGELOG.md)** — what changed in each release.
|
|
127
|
+
- **[SECURITY](./SECURITY.md)** — supported versions and how to report a
|
|
128
|
+
vulnerability.
|
package/dist/activity.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from "./types.js";
|
|
2
2
|
export type ActivityCallSource = "call_tool" | "call_destructive_tool" | "batch_call" | "execute_code";
|
|
3
|
-
export type ActivityOutcome = "success" | "error" | "timeout";
|
|
3
|
+
export type ActivityOutcome = "success" | "error" | "timeout" | "cancelled";
|
|
4
4
|
/**
|
|
5
5
|
* Authenticated identity attached to an activity event. `id` is intentionally
|
|
6
6
|
* optional: open deployments and shared bearer tokens cannot honestly identify
|
package/dist/activity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,M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ACtB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,qBAAqB,EACnB,aAAa,GACb,UAAU,GACV,SAAS,GACT,QAAQ,GACR,SAAS,GACT,YAAY,GACZ,UAAU,GACV,WAAW,CACd,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,sBAAsB,GAAG,SAAS,EAC3C,KAAK,EAAE,kBAAkB,GACxB,IAAI,CAmCN"}
|
package/dist/activity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AA+FA,iFAAiF;AACjF,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,4BAA4B,CAAC;IAE7C;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnC,CAAC;CACF;AA+BD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA2C,EAC3C,KAAyB;IAEzB,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,MAAM,KAAK,GAA0B;QACnC,aAAa,EAAE,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC,UAAU,EAAE;QACvB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,M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AO,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
package/dist/auth/bearer.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface BearerTokenOptions extends ToolkitBindingOptions {
|
|
|
9
9
|
* against `secret`. Checked BEFORE the Clerk gate in the server; a mismatch
|
|
10
10
|
* falls through so a co-configured Clerk provider can still admit the request.
|
|
11
11
|
*
|
|
12
|
-
* `toolkits` binds the token to named toolkits (
|
|
12
|
+
* `toolkits` binds the token to named toolkits (documentation/toolkits.md): one
|
|
13
13
|
* `bearerToken(...)` per team credential, each naming the view that team may
|
|
14
14
|
* open. Omit it and the token stays unbound — every declared toolkit plus the
|
|
15
15
|
* full registry.
|
package/dist/auth/bearer.js
CHANGED
|
@@ -11,7 +11,7 @@ function timingSafeEqual(a, b) {
|
|
|
11
11
|
}
|
|
12
12
|
let r = 0;
|
|
13
13
|
for (let i = 0; i < a.length; i++)
|
|
14
|
-
r |= a[i] ^ b[i];
|
|
14
|
+
r |= (a[i] ?? 0) ^ (b[i] ?? 0);
|
|
15
15
|
return r === 0;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -19,7 +19,7 @@ function timingSafeEqual(a, b) {
|
|
|
19
19
|
* against `secret`. Checked BEFORE the Clerk gate in the server; a mismatch
|
|
20
20
|
* falls through so a co-configured Clerk provider can still admit the request.
|
|
21
21
|
*
|
|
22
|
-
* `toolkits` binds the token to named toolkits (
|
|
22
|
+
* `toolkits` binds the token to named toolkits (documentation/toolkits.md): one
|
|
23
23
|
* `bearerToken(...)` per team credential, each naming the view that team may
|
|
24
24
|
* open. Omit it and the token stays unbound — every declared toolkit plus the
|
|
25
25
|
* full registry.
|
|
@@ -31,8 +31,8 @@ export function bearerToken(secret, options = {}) {
|
|
|
31
31
|
: "bearerToken", options);
|
|
32
32
|
if (toolkitBinding && !options.subjectId) {
|
|
33
33
|
// A bound token stands for one team, and both surfaces that report on it —
|
|
34
|
-
// the 403 refusal log (
|
|
35
|
-
// (
|
|
34
|
+
// the 403 refusal log (documentation/toolkits.md) and activity events
|
|
35
|
+
// (documentation/operator-ui.md) — can only say "bearer" without a subjectId. With
|
|
36
36
|
// several bound tokens that makes an operator unable to tell which
|
|
37
37
|
// credential was refused, or whose call succeeded. console.warn (as the
|
|
38
38
|
// Clerk adapter does) because an adapter is constructed before
|
package/dist/auth/bearer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bearer.js","sourceRoot":"","sources":["../../src/auth/bearer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,qFAAqF;AACrF,SAAS,eAAe,CAAC,CAAa,EAAE,CAAa;IACnD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAA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kBAAkB,EAAE,QAAQ;qBAC7B;iBACF,CACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/auth/clerk.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ClerkAuthOptions extends ToolkitBindingOptions {
|
|
|
35
35
|
* `toolkits` decides WHICH view the admitted user gets.
|
|
36
36
|
*
|
|
37
37
|
* `toolkits` binds every user this provider admits to those toolkits
|
|
38
|
-
* (
|
|
38
|
+
* (documentation/toolkits.md). For a per-team split, configure one `clerkAuth(...)` per
|
|
39
39
|
* team — the same keys, a `gate` naming that team's users, and that team's
|
|
40
40
|
* `toolkits`. The server tries providers in order and the first that admits the
|
|
41
41
|
* user supplies the binding, so a user one gate rejects falls through to the
|
package/dist/auth/clerk.js
CHANGED
|
@@ -156,7 +156,7 @@ function emailDomain(email) {
|
|
|
156
156
|
* `toolkits` decides WHICH view the admitted user gets.
|
|
157
157
|
*
|
|
158
158
|
* `toolkits` binds every user this provider admits to those toolkits
|
|
159
|
-
* (
|
|
159
|
+
* (documentation/toolkits.md). For a per-team split, configure one `clerkAuth(...)` per
|
|
160
160
|
* team — the same keys, a `gate` naming that team's users, and that team's
|
|
161
161
|
* `toolkits`. The server tries providers in order and the first that admits the
|
|
162
162
|
* user supplies the binding, so a user one gate rejects falls through to the
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ConnectorCallError } from "./errors.js";
|
|
2
|
+
import type { ConnectorCallAdmissionInput, ConnectorCallAdmissionPolicy } from "./types.js";
|
|
3
|
+
export type CallAdmissionFailureKind = "concurrency" | "budget" | "cancelled" | "closed" | "partition";
|
|
4
|
+
/**
|
|
5
|
+
* A locally-produced connector-call failure. Extending ConnectorCallError
|
|
6
|
+
* preserves the public error envelope while letting call paths avoid recording
|
|
7
|
+
* a refusal as evidence that the downstream provider is unhealthy.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CallAdmissionError extends ConnectorCallError {
|
|
10
|
+
readonly admissionKind: CallAdmissionFailureKind;
|
|
11
|
+
constructor(admissionKind: CallAdmissionFailureKind, code: ConstructorParameters<typeof ConnectorCallError>[0], message: string, opts?: ConstructorParameters<typeof ConnectorCallError>[2]);
|
|
12
|
+
}
|
|
13
|
+
export declare function isCallAdmissionError(error: unknown): error is CallAdmissionError;
|
|
14
|
+
export interface CallAdmissionPermit {
|
|
15
|
+
/** Time spent in the concurrency queue. Zero for immediate admission. */
|
|
16
|
+
readonly waitMs: number;
|
|
17
|
+
/** Idempotent. */
|
|
18
|
+
release(): void;
|
|
19
|
+
}
|
|
20
|
+
export interface ConnectorCallAdmissionSnapshot {
|
|
21
|
+
rules: number;
|
|
22
|
+
partitions: number;
|
|
23
|
+
active: number;
|
|
24
|
+
queued: number;
|
|
25
|
+
closed: boolean;
|
|
26
|
+
totals: {
|
|
27
|
+
admitted: number;
|
|
28
|
+
queued: number;
|
|
29
|
+
rejected: number;
|
|
30
|
+
rateLimited: number;
|
|
31
|
+
cancelled: number;
|
|
32
|
+
};
|
|
33
|
+
queueWaitMs: {
|
|
34
|
+
count: number;
|
|
35
|
+
total: number;
|
|
36
|
+
max: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Per-runtime, per-connector call admission. State contains only bounded
|
|
41
|
+
* partition keys, counters, timestamps, signals, and promise continuations;
|
|
42
|
+
* tool arguments never enter the controller.
|
|
43
|
+
*/
|
|
44
|
+
export declare class ConnectorCallAdmissionController {
|
|
45
|
+
readonly connectorId: string;
|
|
46
|
+
private readonly maxConcurrency;
|
|
47
|
+
private readonly maxQueueSize;
|
|
48
|
+
private readonly queueTimeoutMs;
|
|
49
|
+
private readonly retryAfterMs;
|
|
50
|
+
private readonly maxPartitions;
|
|
51
|
+
private readonly budget;
|
|
52
|
+
private readonly partitionKey;
|
|
53
|
+
private readonly partitions;
|
|
54
|
+
private closed;
|
|
55
|
+
private admittedTotal;
|
|
56
|
+
private queuedTotal;
|
|
57
|
+
private rejectedTotal;
|
|
58
|
+
private rateLimitedTotal;
|
|
59
|
+
private cancelledTotal;
|
|
60
|
+
private queueWaitCount;
|
|
61
|
+
private queueWaitTotalMs;
|
|
62
|
+
private queueWaitMaxMs;
|
|
63
|
+
constructor(connectorId: string, policy: ConnectorCallAdmissionPolicy);
|
|
64
|
+
acquire(input: Readonly<ConnectorCallAdmissionInput> & {
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
}): Promise<CallAdmissionPermit>;
|
|
67
|
+
snapshot(): ConnectorCallAdmissionSnapshot;
|
|
68
|
+
close(): void;
|
|
69
|
+
private admit;
|
|
70
|
+
private pump;
|
|
71
|
+
private pruneBudget;
|
|
72
|
+
private budgetRetryAfterMs;
|
|
73
|
+
private evictIdlePartitions;
|
|
74
|
+
private maybeDeletePartition;
|
|
75
|
+
private removeWaiter;
|
|
76
|
+
private cleanupWaiter;
|
|
77
|
+
private concurrencyLimited;
|
|
78
|
+
private budgetLimited;
|
|
79
|
+
private cancelled;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=call-admission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-admission.d.ts","sourceRoot":"","sources":["../src/call-admission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EACV,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,YAAY,CAAC;AAUpB,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,WAAW,CAAC;AAEhB;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,kBAAkB;IAEtD,QAAQ,CAAC,aAAa,EAAE,wBAAwB;gBAAvC,aAAa,EAAE,wBAAwB,EAChD,IAAI,EAAE,qBAAqB,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,EACzD,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,qBAAqB,CAAC,OAAO,k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