@zackbart/connecta 0.1.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 +13 -0
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/SECURITY.md +25 -0
- package/assets/connecta-clay-hero.png +0 -0
- package/dist/activity.d.ts +82 -0
- package/dist/activity.d.ts.map +1 -0
- package/dist/activity.js +51 -0
- package/dist/activity.js.map +1 -0
- package/dist/auth/bearer.d.ts +10 -0
- package/dist/auth/bearer.d.ts.map +1 -0
- package/dist/auth/bearer.js +47 -0
- package/dist/auth/bearer.js.map +1 -0
- package/dist/auth/clerk.d.ts +20 -0
- package/dist/auth/clerk.d.ts.map +1 -0
- package/dist/auth/clerk.js +167 -0
- package/dist/auth/clerk.js.map +1 -0
- package/dist/auth/downstream-oauth.d.ts +78 -0
- package/dist/auth/downstream-oauth.d.ts.map +1 -0
- package/dist/auth/downstream-oauth.js +180 -0
- package/dist/auth/downstream-oauth.js.map +1 -0
- package/dist/catalog.d.ts +11 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +144 -0
- package/dist/catalog.js.map +1 -0
- package/dist/connectors/api.d.ts +34 -0
- package/dist/connectors/api.d.ts.map +1 -0
- package/dist/connectors/api.js +36 -0
- package/dist/connectors/api.js.map +1 -0
- package/dist/connectors/remote-mcp.d.ts +33 -0
- package/dist/connectors/remote-mcp.d.ts.map +1 -0
- package/dist/connectors/remote-mcp.js +255 -0
- package/dist/connectors/remote-mcp.js.map +1 -0
- package/dist/credentials.d.ts +33 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +177 -0
- package/dist/credentials.js.map +1 -0
- package/dist/execute.d.ts +40 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +424 -0
- package/dist/execute.js.map +1 -0
- package/dist/executors/quickjs.d.ts +26 -0
- package/dist/executors/quickjs.d.ts.map +1 -0
- package/dist/executors/quickjs.js +267 -0
- package/dist/executors/quickjs.js.map +1 -0
- package/dist/favicon.d.ts +2 -0
- package/dist/favicon.d.ts.map +1 -0
- package/dist/favicon.js +49 -0
- package/dist/favicon.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-result.d.ts +9 -0
- package/dist/mcp-result.d.ts.map +1 -0
- package/dist/mcp-result.js +35 -0
- package/dist/mcp-result.js.map +1 -0
- package/dist/meta-tools.d.ts +100 -0
- package/dist/meta-tools.d.ts.map +1 -0
- package/dist/meta-tools.js +797 -0
- package/dist/meta-tools.js.map +1 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +57 -0
- package/dist/node.js.map +1 -0
- package/dist/registry.d.ts +78 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +299 -0
- package/dist/registry.js.map +1 -0
- package/dist/server.d.ts +31 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +543 -0
- package/dist/server.js.map +1 -0
- package/dist/skills.d.ts +8 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +60 -0
- package/dist/skills.js.map +1 -0
- package/dist/storage/file.d.ts +8 -0
- package/dist/storage/file.d.ts.map +1 -0
- package/dist/storage/file.js +53 -0
- package/dist/storage/file.js.map +1 -0
- package/dist/storage/memory.d.ts +4 -0
- package/dist/storage/memory.d.ts.map +1 -0
- package/dist/storage/memory.js +29 -0
- package/dist/storage/memory.js.map +1 -0
- package/dist/types.d.ts +219 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/ui.d.ts +91 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +1031 -0
- package/dist/ui.js.map +1 -0
- package/package.json +96 -0
- package/src/activity.ts +144 -0
- package/src/auth/bearer.ts +54 -0
- package/src/auth/clerk.ts +226 -0
- package/src/auth/downstream-oauth.ts +202 -0
- package/src/catalog.ts +166 -0
- package/src/connectors/api.ts +80 -0
- package/src/connectors/remote-mcp.ts +324 -0
- package/src/credentials.ts +259 -0
- package/src/execute.ts +550 -0
- package/src/executors/quickjs.ts +321 -0
- package/src/favicon.ts +53 -0
- package/src/index.ts +197 -0
- package/src/mcp-result.ts +43 -0
- package/src/meta-tools.ts +1120 -0
- package/src/node.ts +62 -0
- package/src/registry.ts +400 -0
- package/src/server.ts +758 -0
- package/src/skills.ts +63 -0
- package/src/storage/file.ts +62 -0
- package/src/storage/memory.ts +34 -0
- package/src/types.ts +254 -0
- package/src/ui.ts +1121 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this package are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.1.0 — 2026-07-23
|
|
6
|
+
|
|
7
|
+
- Initial public package release.
|
|
8
|
+
- Generic API and remote MCP connector contracts.
|
|
9
|
+
- Nine fixed meta-tools with progressive tool discovery and approval boundaries.
|
|
10
|
+
- Optional sandboxed code mode for dependent read-only orchestration.
|
|
11
|
+
- Generic storage, activity, authentication, and credential-management seams.
|
|
12
|
+
- Node and Web-standard fetch runtimes.
|
|
13
|
+
- Optional Clerk authentication adapter.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zackery Bartolome
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# connecta
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
One MCP to rule them all. A single MCP endpoint that aggregates many downstream
|
|
6
|
+
connectors — remote MCP servers and plain HTTP APIs — and presents agents a fixed
|
|
7
|
+
set of **nine meta-tools** instead of hundreds of individual tools.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌── remoteMcp("notion") → mcp.notion.com
|
|
11
|
+
Claude / Cursor ── MCP ──▶ connecta ───┼── remoteMcp("linear") → mcp.linear.app
|
|
12
|
+
sees 9 tools /mcp ├── api("resend") → fetch(...)
|
|
13
|
+
└── api("internal") → fetch(...)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The agent always sees exactly nine tools; it searches when it needs something and
|
|
17
|
+
describes only what it will call. Progressive disclosure is the point. Connectors
|
|
18
|
+
are declared in TypeScript (config as code — adding one is a code change + deploy,
|
|
19
|
+
no database of integrations), and the same fetch-based core runs on **Node** and
|
|
20
|
+
**Cloudflare Workers**. Optionally, **code mode** adds a tenth tool that runs
|
|
21
|
+
model-written orchestration code in a sandbox.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
Node deployments require Node.js 20.9 or newer.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install @zackbart/connecta
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Provider and runtime integrations remain consumer-owned. Install only the
|
|
32
|
+
optional packages a deployment uses—for example:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install @clerk/backend # optional Clerk auth adapter
|
|
36
|
+
npm install quickjs-emscripten # optional Node code-mode executor
|
|
37
|
+
npm install @cloudflare/codemode # optional Worker code-mode executor
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## The nine meta-tools
|
|
41
|
+
|
|
42
|
+
A tool **address** is `<connectorId>.<toolName>` (e.g. `notion.search`).
|
|
43
|
+
|
|
44
|
+
| Tool | Input | Returns |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `list_connectors` | `{ probe? }` | live (`probe: true`, default) or cached health, tool count, and recent real-call observations |
|
|
47
|
+
| `skills` | `{ name? }` | lists or fetches the concise `usage` guide for choosing among the meta-tools |
|
|
48
|
+
| `search_tools` | `{ query?, connector?, limit?, offset?, fullDescriptions?, includeSchemas? }` | ranked, paginated matches; optionally includes compact/raw schemas to remove a round trip |
|
|
49
|
+
| `describe_tools` | `{ addresses[], format?, fullDescriptions? }` | names, descriptions, input/output schemas, and behavior annotations |
|
|
50
|
+
| `call_tool` | `{ address, args?, fields?, resultMode?, timeoutMs?, maxRetries?, diagnostics? }` | invokes only tools explicitly annotated `readOnlyHint: true` |
|
|
51
|
+
| `call_destructive_tool` | same as `call_tool` | invokes unannotated, write-capable, or destructive tools through a host-visible approval boundary |
|
|
52
|
+
| `authorize_connector` | `{ connector, force? }` | starts (or with `force`, restarts) the downstream OAuth flow; returns the `authorizationUrl` to open |
|
|
53
|
+
| `get_result` | `{ id, offset?, maxBytes? }` | a byte-slice page of a truncated result — `{ text, offset, nextOffset?, totalBytes }` |
|
|
54
|
+
| `batch_call` | `{ calls, resultMode?, timeoutMs?, maxRetries? }` | 1–10 parallel calls sharing request-scoped clients, with attempts/timing/errors |
|
|
55
|
+
| `execute_code` *(optional)* | `{ code }` | result + logs of bounded async JS orchestration over explicitly read-only tools; registered only when an `executor` is configured |
|
|
56
|
+
|
|
57
|
+
## Package vs. deployments
|
|
58
|
+
|
|
59
|
+
This repository owns the reusable package. Each deployment should be a small,
|
|
60
|
+
separate Worker project that pins an exact package version and owns only its
|
|
61
|
+
connector configuration, auth policy, domain, bindings, migrations, and secrets.
|
|
62
|
+
[`examples/worker/`](./examples/worker/) is the starting template.
|
|
63
|
+
|
|
64
|
+
## Quickstart — Cloudflare Worker
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { DynamicWorkerExecutor } from "@cloudflare/codemode";
|
|
68
|
+
import {
|
|
69
|
+
api, bearerToken, createConnecta, remoteMcp,
|
|
70
|
+
} from "@zackbart/connecta";
|
|
71
|
+
import { clerkAuth } from "@zackbart/connecta/auth/clerk";
|
|
72
|
+
import { cloudflareKvStorage } from "./cloudflare-kv.js";
|
|
73
|
+
|
|
74
|
+
const build = (env: Env) =>
|
|
75
|
+
createConnecta({
|
|
76
|
+
publicUrl: env.PUBLIC_URL,
|
|
77
|
+
storage: cloudflareKvStorage(env.CONNECTA_KV),
|
|
78
|
+
// Code mode (optional): needs a `worker_loaders` binding in wrangler.jsonc.
|
|
79
|
+
executor: new DynamicWorkerExecutor({ loader: env.LOADER }),
|
|
80
|
+
auth: [
|
|
81
|
+
bearerToken(env.CONNECTA_TOKEN),
|
|
82
|
+
clerkAuth({
|
|
83
|
+
publishableKey: env.CLERK_PUBLISHABLE_KEY,
|
|
84
|
+
secretKey: env.CLERK_SECRET_KEY,
|
|
85
|
+
publicUrl: env.PUBLIC_URL,
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
connectors: [
|
|
89
|
+
remoteMcp("notion", {
|
|
90
|
+
url: "https://mcp.notion.com/mcp",
|
|
91
|
+
auth: { type: "headers", headers: { Authorization: `Bearer ${env.NOTION_TOKEN}` } },
|
|
92
|
+
}),
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Lazy per-isolate singleton: keeps only serializable tool/catalog data warm.
|
|
97
|
+
let connecta: ReturnType<typeof build> | undefined;
|
|
98
|
+
|
|
99
|
+
export default {
|
|
100
|
+
fetch(request: Request, env: Env): Promise<Response> {
|
|
101
|
+
connecta ??= build(env);
|
|
102
|
+
return connecta.fetch(request);
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Deployable example: [`examples/worker/`](./examples/worker/).
|
|
108
|
+
Its Cloudflare KV and D1 implementations are deployment-owned examples over the
|
|
109
|
+
generic `KVStorage` and `ActivityStore` contracts; they are not package exports.
|
|
110
|
+
|
|
111
|
+
`clerkAuth` is an optional adapter. Install `@clerk/backend` and import it from
|
|
112
|
+
`@zackbart/connecta/auth/clerk` only in deployments that use Clerk. Other
|
|
113
|
+
identity providers can implement the exported `InboundAuth` interface.
|
|
114
|
+
|
|
115
|
+
## Quickstart — Node
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { api, bearerToken, createConnecta } from "@zackbart/connecta";
|
|
119
|
+
import { fileStorage, listen } from "@zackbart/connecta/node";
|
|
120
|
+
import { quickJsExecutor } from "@zackbart/connecta/quickjs";
|
|
121
|
+
|
|
122
|
+
const connecta = createConnecta({
|
|
123
|
+
storage: fileStorage("./.connecta-state.json"), // or memoryStorage()
|
|
124
|
+
auth: bearerToken(process.env.CONNECTA_TOKEN!),
|
|
125
|
+
executor: quickJsExecutor(), // code mode (optional): QuickJS/WASM sandbox
|
|
126
|
+
connectors: [
|
|
127
|
+
api("time", {
|
|
128
|
+
description: "Time — clock utilities",
|
|
129
|
+
tools: [{
|
|
130
|
+
name: "get_now",
|
|
131
|
+
description: "Return the current ISO timestamp.",
|
|
132
|
+
inputSchema: { type: "object", properties: {} },
|
|
133
|
+
annotations: { readOnlyHint: true },
|
|
134
|
+
handler: async () => ({ now: new Date().toISOString() }),
|
|
135
|
+
}],
|
|
136
|
+
}),
|
|
137
|
+
],
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
listen(connecta, 8787); // http://localhost:8787/mcp
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Example: [`examples/node/`](./examples/node/). Docker (single-service compose
|
|
144
|
+
stack): [`examples/docker/`](./examples/docker/).
|
|
145
|
+
|
|
146
|
+
## Code mode
|
|
147
|
+
|
|
148
|
+
With an `executor` configured, the model can write an async function instead of
|
|
149
|
+
making one `call_tool` round trip per step — loops, joins across connectors,
|
|
150
|
+
filtering big responses down in-sandbox before they hit the context window:
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
async () => {
|
|
154
|
+
const pages = await notion.search({ query: "roadmap" });
|
|
155
|
+
return pages.results.map((p) => p.title);
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The sandbox has **no** network/filesystem/env — only explicitly read-only
|
|
160
|
+
connector globals and
|
|
161
|
+
`connecta.call`, `connecta.batch`, `connecta.search`, and `connecta.describe`;
|
|
162
|
+
credentials stay host-side. A run may make at most 20 host calls, a
|
|
163
|
+
`connecta.batch` may contain at most 10 calls, and every host call has a
|
|
164
|
+
15-second deadline. Executors:
|
|
165
|
+
`DynamicWorkerExecutor` (`@cloudflare/codemode`,
|
|
166
|
+
Workers, Worker Loader binding — open beta) or `quickJsExecutor()`
|
|
167
|
+
(`@zackbart/connecta/quickjs`, QuickJS-in-WASM, runs anywhere). Omit the `executor` and
|
|
168
|
+
connecta is exactly the nine-tool server. Details:
|
|
169
|
+
[docs §13](./docs/documentation.md#13-code-mode-execute_code).
|
|
170
|
+
|
|
171
|
+
## Credentials in `/ui`
|
|
172
|
+
|
|
173
|
+
API connectors can declare one operator-managed credential or a named set of
|
|
174
|
+
credential fields. Connecta renders
|
|
175
|
+
Add / Replace / Test / Remove controls inside that connector's `/ui` card,
|
|
176
|
+
encrypts the values with AES-GCM, and stores only ciphertext in the deployment's
|
|
177
|
+
existing `KVStorage`. Credentials are available only to the connector through
|
|
178
|
+
`ctx.credential.get()`, `get(name)`, or `getAll()`; they are never returned by
|
|
179
|
+
`/ui`, MCP tools, or code mode.
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
api("example", {
|
|
183
|
+
description: "Example — authenticated API",
|
|
184
|
+
credential: {
|
|
185
|
+
label: "API token",
|
|
186
|
+
description: "Token used for outbound Example API requests.",
|
|
187
|
+
},
|
|
188
|
+
tools: [{
|
|
189
|
+
name: "get_profile",
|
|
190
|
+
description: "Get the authenticated Example profile.",
|
|
191
|
+
inputSchema: { type: "object", properties: {} },
|
|
192
|
+
annotations: { readOnlyHint: true },
|
|
193
|
+
handler: async (_args, ctx) => {
|
|
194
|
+
const token = await ctx.credential?.get();
|
|
195
|
+
if (!token) throw new Error("Example API token is not configured.");
|
|
196
|
+
return fetch("https://api.example.com/profile", {
|
|
197
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
198
|
+
}).then((response) => response.json());
|
|
199
|
+
},
|
|
200
|
+
}],
|
|
201
|
+
})
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Set `credentialEncryptionKey` on `createConnecta` to a base64-encoded 32-byte
|
|
205
|
+
key held in the runtime's secret store (`openssl rand -base64 32`). Credential
|
|
206
|
+
mutation routes require the configured Clerk provider and a same-origin browser
|
|
207
|
+
request; the static inbound bearer cannot administer the vault.
|
|
208
|
+
|
|
209
|
+
Connecta does not bundle service-specific HTTP API connectors. Package consumers
|
|
210
|
+
define them with `api()` (or implement `Connector` directly), keeping endpoint,
|
|
211
|
+
credential, and tool choices in the consuming project.
|
|
212
|
+
|
|
213
|
+
## Payload-free tool activity
|
|
214
|
+
|
|
215
|
+
Connecta can record which resolved downstream tools were actually invoked
|
|
216
|
+
without storing their arguments, results, generated code, search text, or raw
|
|
217
|
+
errors. Supply a vendor-neutral `activity` store:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
const events: ToolCallActivityEvent[] = [];
|
|
221
|
+
|
|
222
|
+
const connecta = createConnecta({
|
|
223
|
+
connectors,
|
|
224
|
+
activity: {
|
|
225
|
+
record(event) {
|
|
226
|
+
events.push(event);
|
|
227
|
+
},
|
|
228
|
+
async list({ limit }) {
|
|
229
|
+
return { events: events.slice(-limit).reverse() };
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
One final event is emitted for each resolved connector call made through
|
|
236
|
+
`call_tool`, `batch_call`, or `execute_code`; retries remain one event with an
|
|
237
|
+
`attempts` count. Implementing `list` enables the authenticated Activity tab in
|
|
238
|
+
`/ui`; `activityReadGate` can narrow reads further. Writes are best-effort and
|
|
239
|
+
never change a tool result. Clerk calls carry the Clerk user ID; shared bearer
|
|
240
|
+
calls are honestly labeled as bearer unless
|
|
241
|
+
`bearerToken(secret, { subjectId })` assigns that credential a stable subject.
|
|
242
|
+
|
|
243
|
+
## Learn more
|
|
244
|
+
|
|
245
|
+
- **[`docs/documentation.md`](./docs/documentation.md)** — how everything works: architecture,
|
|
246
|
+
the meta-tools, connectors, inbound auth, downstream OAuth, storage, running it
|
|
247
|
+
(Node / Workers / Docker), Clerk setup, testing, troubleshooting.
|
|
248
|
+
- **[`docs/design.md`](./docs/design.md)** — why it's built this way, and the non-goals.
|
|
249
|
+
- **Status UI** — a read-only operator dashboard at `GET /ui` (open shell; data from the bearer/Clerk-gated `/ui/data`). See [§14](./docs/documentation.md#14-status-ui).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are applied to the latest published minor release.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
Please report suspected vulnerabilities through GitHub's private security
|
|
10
|
+
advisory flow for this repository. Do not include secrets, credentials, or
|
|
11
|
+
sensitive payloads in a public issue.
|
|
12
|
+
|
|
13
|
+
## Dependency policy
|
|
14
|
+
|
|
15
|
+
CI blocks high and critical production dependency advisories. Moderate findings
|
|
16
|
+
are reviewed for reachability and recorded when an upstream package has not yet
|
|
17
|
+
released a compatible fix.
|
|
18
|
+
|
|
19
|
+
The initial release has one such upstream finding:
|
|
20
|
+
`@modelcontextprotocol/sdk@1.29.0` declares `@hono/node-server` 1.x, which is
|
|
21
|
+
covered by `GHSA-frvp-7c67-39w9`. The advisory affects Hono's Windows
|
|
22
|
+
`serve-static` implementation. Connecta does not import that adapter or serve
|
|
23
|
+
static files through Hono. npm's suggested fix downgrades the MCP SDK below
|
|
24
|
+
security behavior Connecta relies on, so the package retains SDK 1.29.0 while
|
|
25
|
+
tracking an upstream compatible release.
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Logger } from "./types.js";
|
|
2
|
+
export type ActivityCallSource = "call_tool" | "call_destructive_tool" | "batch_call" | "execute_code";
|
|
3
|
+
export type ActivityOutcome = "success" | "error" | "timeout";
|
|
4
|
+
/**
|
|
5
|
+
* Authenticated identity attached to an activity event. `id` is intentionally
|
|
6
|
+
* optional: open deployments and shared bearer tokens cannot honestly identify
|
|
7
|
+
* a person.
|
|
8
|
+
*/
|
|
9
|
+
export interface ActivityActor {
|
|
10
|
+
kind: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Privacy-minimal history of one resolved downstream connector call.
|
|
15
|
+
*
|
|
16
|
+
* Arguments, results, generated code, search text, and raw errors are excluded
|
|
17
|
+
* by construction. Deployments that need a safe human summary can add a
|
|
18
|
+
* separate, explicit connector-level feature later.
|
|
19
|
+
*/
|
|
20
|
+
export interface ToolCallActivityEvent {
|
|
21
|
+
schemaVersion: 1;
|
|
22
|
+
id: string;
|
|
23
|
+
occurredAt: string;
|
|
24
|
+
requestId: string;
|
|
25
|
+
actor: ActivityActor;
|
|
26
|
+
connectorId: string;
|
|
27
|
+
toolName: string;
|
|
28
|
+
address: string;
|
|
29
|
+
source: ActivityCallSource;
|
|
30
|
+
outcome: ActivityOutcome;
|
|
31
|
+
durationMs: number;
|
|
32
|
+
attempts: number;
|
|
33
|
+
errorCode?: string;
|
|
34
|
+
serverName: string;
|
|
35
|
+
serverVersion: string;
|
|
36
|
+
deploymentId?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ActivityPage {
|
|
39
|
+
events: ToolCallActivityEvent[];
|
|
40
|
+
nextCursor?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Write-only deployments can implement only this small, vendor-neutral seam. */
|
|
43
|
+
export interface ActivitySink {
|
|
44
|
+
record(event: ToolCallActivityEvent): void | Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/** Optional read side used by Connecta's authenticated Activity UI. */
|
|
47
|
+
export interface ActivityReader {
|
|
48
|
+
list(options: {
|
|
49
|
+
cursor?: string;
|
|
50
|
+
limit: number;
|
|
51
|
+
}): Promise<ActivityPage>;
|
|
52
|
+
}
|
|
53
|
+
export interface ActivityStore extends ActivitySink {
|
|
54
|
+
list?: ActivityReader["list"];
|
|
55
|
+
}
|
|
56
|
+
/** Reader implementations throw this for an opaque cursor they cannot decode. */
|
|
57
|
+
export declare class InvalidActivityCursorError extends Error {
|
|
58
|
+
name: string;
|
|
59
|
+
constructor();
|
|
60
|
+
}
|
|
61
|
+
export type ActivityReadGate = (actor: ActivityActor) => boolean | Promise<boolean>;
|
|
62
|
+
/** Request-scoped context shared by direct, batch, and code-mode call paths. */
|
|
63
|
+
export interface ActivityRequestContext {
|
|
64
|
+
sink: ActivitySink;
|
|
65
|
+
actor: ActivityActor;
|
|
66
|
+
requestId: string;
|
|
67
|
+
serverInfo: {
|
|
68
|
+
name: string;
|
|
69
|
+
version: string;
|
|
70
|
+
};
|
|
71
|
+
deploymentId?: string;
|
|
72
|
+
defer?: (promise: Promise<unknown>) => void;
|
|
73
|
+
logger: Logger;
|
|
74
|
+
}
|
|
75
|
+
export type ActivityEventInput = Pick<ToolCallActivityEvent, "connectorId" | "toolName" | "address" | "source" | "outcome" | "durationMs" | "attempts" | "errorCode">;
|
|
76
|
+
/**
|
|
77
|
+
* Best-effort by design: activity storage can never change a tool result.
|
|
78
|
+
* Workers attach async sinks to waitUntil; synchronous sinks such as Analytics
|
|
79
|
+
* Engine complete inline; Node promises remain detached from the response.
|
|
80
|
+
*/
|
|
81
|
+
export declare function recordToolActivity(context: ActivityRequestContext | undefined, input: ActivityEventInput): void;
|
|
82
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,uBAAuB,GACvB,YAAY,GACZ,cAAc,CAAC;AAEnB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,CAAC,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;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qB,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,CAkCN"}
|
package/dist/activity.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Reader implementations throw this for an opaque cursor they cannot decode. */
|
|
2
|
+
export class InvalidActivityCursorError extends Error {
|
|
3
|
+
name = "InvalidActivityCursorError";
|
|
4
|
+
constructor() {
|
|
5
|
+
super("invalid activity cursor");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Best-effort by design: activity storage can never change a tool result.
|
|
10
|
+
* Workers attach async sinks to waitUntil; synchronous sinks such as Analytics
|
|
11
|
+
* Engine complete inline; Node promises remain detached from the response.
|
|
12
|
+
*/
|
|
13
|
+
export function recordToolActivity(context, input) {
|
|
14
|
+
if (!context)
|
|
15
|
+
return;
|
|
16
|
+
const event = {
|
|
17
|
+
schemaVersion: 1,
|
|
18
|
+
id: crypto.randomUUID(),
|
|
19
|
+
occurredAt: new Date().toISOString(),
|
|
20
|
+
requestId: context.requestId,
|
|
21
|
+
actor: context.actor,
|
|
22
|
+
connectorId: input.connectorId,
|
|
23
|
+
toolName: input.toolName,
|
|
24
|
+
address: input.address,
|
|
25
|
+
source: input.source,
|
|
26
|
+
outcome: input.outcome,
|
|
27
|
+
durationMs: Math.max(0, Math.trunc(input.durationMs)),
|
|
28
|
+
attempts: Math.max(1, Math.trunc(input.attempts)),
|
|
29
|
+
...(input.errorCode ? { errorCode: input.errorCode } : {}),
|
|
30
|
+
serverName: context.serverInfo.name,
|
|
31
|
+
serverVersion: context.serverInfo.version,
|
|
32
|
+
...(context.deploymentId
|
|
33
|
+
? { deploymentId: context.deploymentId }
|
|
34
|
+
: {}),
|
|
35
|
+
};
|
|
36
|
+
try {
|
|
37
|
+
const result = context.sink.record(event);
|
|
38
|
+
if (!result || typeof result.then !== "function") {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const pending = Promise.resolve(result).catch((error) => {
|
|
42
|
+
context.logger.warn("[connecta] activity record failed", error);
|
|
43
|
+
});
|
|
44
|
+
if (context.defer)
|
|
45
|
+
context.defer(pending);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
context.logger.warn("[connecta] activity record failed", error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AAiEA,iFAAiF;AACjF,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,GAAG,4BAA4B,CAAC;IAE7C;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnC,CAAC;CACF;AA6BD;;;;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,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CA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|
|
4
|
+
* against `secret`. Checked BEFORE the Clerk gate in the server; a mismatch
|
|
5
|
+
* falls through so a co-configured Clerk provider can still admit the request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function bearerToken(secret: string, options?: {
|
|
8
|
+
subjectId?: string;
|
|
9
|
+
}): InboundAuth;
|
|
10
|
+
//# sourceMappingURL=bearer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bearer.d.ts","sourceRoot":"","sources":["../../src/auth/bearer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,aAAa,CAAC;AAiB3D;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACnC,WAAW,CA4Bb"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const encoder = new TextEncoder();
|
|
2
|
+
/** Constant-time byte comparison. Differing lengths still iterate to reduce leak. */
|
|
3
|
+
function timingSafeEqual(a, b) {
|
|
4
|
+
if (a.length !== b.length) {
|
|
5
|
+
let r = 1;
|
|
6
|
+
const n = Math.max(a.length, b.length);
|
|
7
|
+
for (let i = 0; i < n; i++)
|
|
8
|
+
r |= (a[i] ?? 0) ^ (b[i] ?? 0);
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
let r = 0;
|
|
12
|
+
for (let i = 0; i < a.length; i++)
|
|
13
|
+
r |= a[i] ^ b[i];
|
|
14
|
+
return r === 0;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Static bearer-token inbound auth. Constant-time compares the Bearer token
|
|
18
|
+
* against `secret`. Checked BEFORE the Clerk gate in the server; a mismatch
|
|
19
|
+
* falls through so a co-configured Clerk provider can still admit the request.
|
|
20
|
+
*/
|
|
21
|
+
export function bearerToken(secret, options = {}) {
|
|
22
|
+
const secretBytes = encoder.encode(secret);
|
|
23
|
+
return {
|
|
24
|
+
kind: "bearer",
|
|
25
|
+
authorize(request) {
|
|
26
|
+
const header = request.headers.get("authorization") ?? "";
|
|
27
|
+
const match = /^Bearer\s+(.+)$/i.exec(header);
|
|
28
|
+
if (match && timingSafeEqual(encoder.encode(match[1]), secretBytes)) {
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
...(options.subjectId ? { subjectId: options.subjectId } : {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
response: new Response(JSON.stringify({ error: "unauthorized" }), {
|
|
37
|
+
status: 401,
|
|
38
|
+
headers: {
|
|
39
|
+
"Content-Type": "application/json",
|
|
40
|
+
"WWW-Authenticate": "Bearer",
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=bearer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bearer.js","sourceRoot":"","sources":["../../src/auth/bearer.ts"],"names":[],"mappings":"AAEA,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,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@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createClerkClient } from "@clerk/backend";
|
|
2
|
+
import type { InboundAuth } from "../types.js";
|
|
3
|
+
type ClerkClient = ReturnType<typeof createClerkClient>;
|
|
4
|
+
export interface ClerkAuthOptions {
|
|
5
|
+
publishableKey: string;
|
|
6
|
+
secretKey: string;
|
|
7
|
+
/** Public base URL of this deployment. Defaults to the request origin. */
|
|
8
|
+
publicUrl?: string;
|
|
9
|
+
/** Optional allow-list hook. Return false to reject an authenticated user. */
|
|
10
|
+
gate?: (userId: string, clerk: ClerkClient) => boolean | Promise<boolean>;
|
|
11
|
+
/** Advertised scopes in protected-resource metadata. */
|
|
12
|
+
scopes?: string[];
|
|
13
|
+
/** Optional hosted Account Portal sign-in URL for `/ui`. */
|
|
14
|
+
signInUrl?: string;
|
|
15
|
+
/** Optional hosted Account Portal sign-up URL for `/ui`. */
|
|
16
|
+
signUpUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function clerkAuth(opts: ClerkAuthOptions): InboundAuth;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=clerk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clerk.d.ts","sourceRoot":"","sources":["../../src/auth/clerk.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6BD,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,CA8K7D"}
|