@zackbart/connecta 0.10.0 → 0.10.2
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/AGENTS.md +113 -0
- package/CHANGELOG.md +83 -0
- package/README.md +62 -12
- package/bin/connecta.mjs +272 -0
- package/dist/access-tokens.d.ts +32 -0
- package/dist/access-tokens.d.ts.map +1 -0
- package/dist/access-tokens.js +225 -0
- package/dist/access-tokens.js.map +1 -0
- package/dist/catalog-service.d.ts +39 -1
- package/dist/catalog-service.d.ts.map +1 -1
- package/dist/catalog-service.js +133 -11
- package/dist/catalog-service.js.map +1 -1
- package/dist/catalog.d.ts +17 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +113 -13
- package/dist/catalog.js.map +1 -1
- package/dist/execute.d.ts +45 -1
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +265 -68
- package/dist/execute.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/invocation.d.ts.map +1 -1
- package/dist/invocation.js +1 -5
- package/dist/invocation.js.map +1 -1
- package/dist/meta-tools.d.ts +1 -0
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +410 -12
- package/dist/meta-tools.js.map +1 -1
- package/dist/operator-ui/generated.d.ts +2 -2
- package/dist/operator-ui/generated.d.ts.map +1 -1
- package/dist/operator-ui/generated.js +2 -2
- package/dist/operator-ui/generated.js.map +1 -1
- package/dist/operator-ui/model.d.ts +2 -0
- package/dist/operator-ui/model.d.ts.map +1 -1
- package/dist/operator-ui/model.js.map +1 -1
- package/dist/routes/access-tokens.d.ts +7 -0
- package/dist/routes/access-tokens.d.ts.map +1 -0
- package/dist/routes/access-tokens.js +84 -0
- package/dist/routes/access-tokens.js.map +1 -0
- package/dist/routes/shared.d.ts +3 -0
- package/dist/routes/shared.d.ts.map +1 -1
- package/dist/routes/shared.js.map +1 -1
- package/dist/routes/ui.d.ts.map +1 -1
- package/dist/routes/ui.js +9 -1
- package/dist/routes/ui.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +1 -1
- package/dist/storage/file.d.ts.map +1 -1
- package/dist/storage/file.js +5 -0
- package/dist/storage/file.js.map +1 -1
- package/dist/storage/memory.d.ts.map +1 -1
- package/dist/storage/memory.js +8 -0
- package/dist/storage/memory.js.map +1 -1
- package/dist/tool-safety.d.ts +10 -0
- package/dist/tool-safety.d.ts.map +1 -0
- package/dist/tool-safety.js +12 -0
- package/dist/tool-safety.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +4 -4
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +44 -1
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/documentation/architecture.md +7 -0
- package/documentation/auth.md +58 -0
- package/documentation/call-admission.md +7 -0
- package/documentation/code-first-exploration.md +292 -0
- package/documentation/code-mode.md +697 -0
- package/documentation/connector-guides.md +7 -0
- package/documentation/connectors.md +63 -0
- package/documentation/mcp-2026-07-28.md +46 -0
- package/documentation/meta-tools.md +167 -0
- package/documentation/operations.md +7 -0
- package/documentation/operator-ui.md +7 -0
- package/documentation/request-admission.md +7 -0
- package/documentation/storage-and-credentials.md +54 -0
- package/ethos.md +132 -0
- package/examples/node/README.md +53 -0
- package/examples/node/src/index.ts +73 -0
- package/examples/worker/README.md +160 -0
- package/examples/worker/src/cloudflare-kv.ts +43 -0
- package/examples/worker/src/d1-activity-row.ts +100 -0
- package/examples/worker/src/d1-activity.ts +144 -0
- package/examples/worker/src/index.ts +136 -0
- package/examples/worker/wrangler.jsonc +26 -0
- package/package.json +11 -1
- package/src/access-tokens.ts +289 -0
- package/src/catalog-service.ts +177 -15
- package/src/catalog.ts +143 -12
- package/src/execute.ts +372 -96
- package/src/index.ts +33 -1
- package/src/invocation.ts +1 -8
- package/src/meta-tools.ts +504 -11
- package/src/operator-ui/browser.css +63 -0
- package/src/operator-ui/browser.ts +288 -2
- package/src/operator-ui/generated.ts +2 -2
- package/src/operator-ui/model.ts +6 -0
- package/src/routes/access-tokens.ts +115 -0
- package/src/routes/shared.ts +3 -0
- package/src/routes/ui.ts +9 -0
- package/src/server.ts +5 -0
- package/src/skills.ts +1 -1
- package/src/storage/file.ts +5 -0
- package/src/storage/memory.ts +8 -0
- package/src/tool-safety.ts +15 -0
- package/src/types.ts +5 -0
- package/src/ui.ts +50 -1
- package/src/version.ts +1 -1
- package/templates/node/.env.example +5 -0
- package/templates/node/AGENTS.md +19 -0
- package/templates/node/README.md +33 -0
- package/templates/node/package.json +23 -0
- package/templates/node/src/index.ts +43 -0
- package/templates/node/tsconfig.json +12 -0
package/src/ui.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "./concurrency.js";
|
|
15
15
|
import {
|
|
16
16
|
type CredentialManagementCapability,
|
|
17
|
+
type AccessTokenManagementCapability,
|
|
17
18
|
type UiConnector,
|
|
18
19
|
type UiData,
|
|
19
20
|
type UiTool,
|
|
@@ -32,6 +33,7 @@ import { CONNECTA_VERSION } from "./version.js";
|
|
|
32
33
|
|
|
33
34
|
export {
|
|
34
35
|
filterUiConnectors,
|
|
36
|
+
type AccessTokenManagementCapability,
|
|
35
37
|
type CredentialManagementCapability,
|
|
36
38
|
type UiConnector,
|
|
37
39
|
type UiData,
|
|
@@ -265,17 +267,23 @@ export function droppedUiAuthUrls(uiAuth?: UiAuthConfig): string[] {
|
|
|
265
267
|
];
|
|
266
268
|
}
|
|
267
269
|
|
|
268
|
-
export type OperatorPage =
|
|
270
|
+
export type OperatorPage =
|
|
271
|
+
| "connections"
|
|
272
|
+
| "credentials"
|
|
273
|
+
| "tokens"
|
|
274
|
+
| "activity";
|
|
269
275
|
|
|
270
276
|
const OPERATOR_PAGE_LABELS: Readonly<Record<OperatorPage, string>> = {
|
|
271
277
|
connections: "Connections",
|
|
272
278
|
credentials: "Credentials",
|
|
279
|
+
tokens: "Access tokens",
|
|
273
280
|
activity: "Activity",
|
|
274
281
|
};
|
|
275
282
|
|
|
276
283
|
export function operatorPageForPath(path: string): OperatorPage | undefined {
|
|
277
284
|
if (path === "/") return "connections";
|
|
278
285
|
if (path === "/credentials") return "credentials";
|
|
286
|
+
if (path === "/tokens") return "tokens";
|
|
279
287
|
if (path === "/activity") return "activity";
|
|
280
288
|
return undefined;
|
|
281
289
|
}
|
|
@@ -315,6 +323,7 @@ export async function buildUiData(
|
|
|
315
323
|
defer?: DeferredWork,
|
|
316
324
|
oauthManagement = false,
|
|
317
325
|
discoveryConcurrency?: number,
|
|
326
|
+
accessTokenManagement: AccessTokenManagementCapability = "not_configured",
|
|
318
327
|
): Promise<UiData> {
|
|
319
328
|
const requestScope = {};
|
|
320
329
|
const connectorSet = registry.listConnectors();
|
|
@@ -474,6 +483,7 @@ export async function buildUiData(
|
|
|
474
483
|
connectors,
|
|
475
484
|
activityEnabled,
|
|
476
485
|
credentialManagement,
|
|
486
|
+
accessTokenManagement,
|
|
477
487
|
oauthManagement,
|
|
478
488
|
};
|
|
479
489
|
}
|
|
@@ -583,6 +593,8 @@ ${clerkScript}
|
|
|
583
593
|
data-operator-page="connections"${page === "connections" ? ' aria-current="page"' : ""}>Connections</a>
|
|
584
594
|
<a id="credentialsNav" class="navlink hidden" href="/credentials"
|
|
585
595
|
data-operator-page="credentials"${page === "credentials" ? ' aria-current="page"' : ""}>Credentials</a>
|
|
596
|
+
<a id="tokensNav" class="navlink hidden" href="/tokens"
|
|
597
|
+
data-operator-page="tokens"${page === "tokens" ? ' aria-current="page"' : ""}>Access tokens</a>
|
|
586
598
|
<a id="activityNav" class="navlink hidden" href="/activity"
|
|
587
599
|
data-operator-page="activity"${page === "activity" ? ' aria-current="page"' : ""}>Activity</a>
|
|
588
600
|
</nav>
|
|
@@ -656,6 +668,43 @@ ${clerkScript}
|
|
|
656
668
|
</div>
|
|
657
669
|
</section>
|
|
658
670
|
|
|
671
|
+
<section id="tokensView"${page === "tokens" ? "" : ' class="hidden"'}>
|
|
672
|
+
<div class="lead pgrid">
|
|
673
|
+
<h1 id="tokensHeading" class="pcap" tabindex="-1">Access tokens</h1>
|
|
674
|
+
<div class="pbody">
|
|
675
|
+
<p class="activity-copy">Create named Bearer tokens for MCP clients. Each secret is shown once; revoke it when that client should lose access.</p>
|
|
676
|
+
<p id="tokenNotice" class="meta" role="status" aria-live="polite"
|
|
677
|
+
tabindex="-1"></p>
|
|
678
|
+
<div id="tokenUnavailable" class="unavailable hidden"></div>
|
|
679
|
+
<div id="tokenAvailable" class="hidden">
|
|
680
|
+
<form id="tokenCreateForm" class="token-create">
|
|
681
|
+
<label for="tokenName">Client name</label>
|
|
682
|
+
<div class="row">
|
|
683
|
+
<input id="tokenName" type="text" maxlength="80"
|
|
684
|
+
placeholder="Claude desktop, ChatGPT production…"
|
|
685
|
+
autocomplete="off">
|
|
686
|
+
<button id="createToken" class="linklike" type="submit">Create token</button>
|
|
687
|
+
</div>
|
|
688
|
+
</form>
|
|
689
|
+
<section id="tokenReveal" class="token-reveal hidden"
|
|
690
|
+
aria-labelledby="tokenRevealHeading">
|
|
691
|
+
<div class="token-reveal-head">
|
|
692
|
+
<h2 id="tokenRevealHeading" tabindex="-1">Copy this token now</h2>
|
|
693
|
+
<span class="cap">Shown once</span>
|
|
694
|
+
</div>
|
|
695
|
+
<p class="meta">Store it in the MCP client before leaving this page. It cannot be displayed again.</p>
|
|
696
|
+
<div class="endpoint-row token-secret">
|
|
697
|
+
<code id="createdToken" class="mono"></code>
|
|
698
|
+
<button id="copyCreatedToken" class="linklike" type="button">Copy token</button>
|
|
699
|
+
</div>
|
|
700
|
+
<button id="dismissCreatedToken" class="linklike" type="button">I stored it</button>
|
|
701
|
+
</section>
|
|
702
|
+
<div id="tokenList" class="token-ledger" aria-busy="false"></div>
|
|
703
|
+
</div>
|
|
704
|
+
</div>
|
|
705
|
+
</div>
|
|
706
|
+
</section>
|
|
707
|
+
|
|
659
708
|
<section id="activityView"${page === "activity" ? "" : ' class="hidden"'}>
|
|
660
709
|
<div class="lead pgrid">
|
|
661
710
|
<h1 id="activityHeading" class="pcap" tabindex="-1">Activity</h1>
|
package/src/version.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Working on this Connecta deployment
|
|
2
|
+
|
|
3
|
+
This repository is deployment configuration, not a copy of Connecta itself.
|
|
4
|
+
|
|
5
|
+
- Edit `src/index.ts` for connectors, authentication, storage, and public URL.
|
|
6
|
+
- Keep `executor: quickJsExecutor()` for the prescribed seven-tool code-first
|
|
7
|
+
surface.
|
|
8
|
+
- Keep credentials in environment variables or an external secret store.
|
|
9
|
+
Never commit `.env`, `.connecta-state.json`, tokens, or credential values.
|
|
10
|
+
- Add application logic only inside deliberate `api()` connector handlers.
|
|
11
|
+
Do not copy or modify Connecta package internals here.
|
|
12
|
+
- Prefer `api()` when the agent must see an exact reviewed capability surface;
|
|
13
|
+
`remoteMcp()` follows the downstream server's evolving tool catalog.
|
|
14
|
+
- Run `npm run typecheck` after configuration changes. With the server running,
|
|
15
|
+
run `CONNECTA_TOKEN=... npm run doctor` before calling setup complete.
|
|
16
|
+
|
|
17
|
+
Do not add alternate entrypoints, policy layers, generated connector catalogs,
|
|
18
|
+
or runtime connector registration. Keep the deployment small enough to review
|
|
19
|
+
as configuration.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Connecta deployment
|
|
2
|
+
|
|
3
|
+
This is the prescribed small Node deployment. Install and run it:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install
|
|
7
|
+
CONNECTA_TOKEN=dev-token npm start
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Then point an MCP client at `http://localhost:8787/mcp` with
|
|
11
|
+
`Authorization: Bearer dev-token`.
|
|
12
|
+
|
|
13
|
+
## Deployment contract
|
|
14
|
+
|
|
15
|
+
- Edit `src/index.ts` for connectors, auth, storage, and the public URL.
|
|
16
|
+
- Keep `executor: quickJsExecutor()` for the seven-tool code-first surface.
|
|
17
|
+
- Keep secrets in environment variables or an external secret store.
|
|
18
|
+
- Add application code only inside deliberate `api()` connector handlers.
|
|
19
|
+
- Do not copy Connecta package internals into this deployment.
|
|
20
|
+
- `AGENTS.md` is the canonical convention file; `CLAUDE.md` points to it.
|
|
21
|
+
|
|
22
|
+
Verify a change with:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm run typecheck
|
|
26
|
+
# In another terminal, while npm start is running:
|
|
27
|
+
CONNECTA_TOKEN=dev-token npm run doctor
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Doctor checks health, the executor, and the exact prescribed seven-tool
|
|
31
|
+
model-facing surface by running a harmless sandbox program. It reads the bearer
|
|
32
|
+
from `CONNECTA_TOKEN`; it never accepts the secret as a command-line argument.
|
|
33
|
+
Remote URLs must use HTTPS.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "connecta-deployment",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20.9.0"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"doctor": "connecta doctor",
|
|
11
|
+
"start": "tsx src/index.ts",
|
|
12
|
+
"typecheck": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@zackbart/connecta": "0.10.2",
|
|
16
|
+
"quickjs-emscripten": "0.32.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^22.0.0",
|
|
20
|
+
"tsx": "^4.23.1",
|
|
21
|
+
"typescript": "^5.6.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prescribed Connecta deployment.
|
|
3
|
+
*
|
|
4
|
+
* Keep this file as deployment configuration: connectors, authentication,
|
|
5
|
+
* storage, and public origin. Add application logic only inside deliberate
|
|
6
|
+
* api() connector handlers.
|
|
7
|
+
*/
|
|
8
|
+
import { api, bearerToken, createConnecta } from "@zackbart/connecta";
|
|
9
|
+
import { fileStorage, listen } from "@zackbart/connecta/node";
|
|
10
|
+
import { quickJsExecutor } from "@zackbart/connecta/quickjs";
|
|
11
|
+
|
|
12
|
+
const token = process.env.CONNECTA_TOKEN;
|
|
13
|
+
if (!token) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"CONNECTA_TOKEN is required. Refusing to start without inbound auth.",
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const port = Number(process.env.PORT ?? 8787);
|
|
19
|
+
|
|
20
|
+
const connecta = createConnecta({
|
|
21
|
+
storage: fileStorage("./.connecta-state.json"),
|
|
22
|
+
auth: bearerToken(token, { subjectId: "operator" }),
|
|
23
|
+
publicUrl: `http://localhost:${port}`,
|
|
24
|
+
// Keep this for the prescribed seven-tool code-first surface.
|
|
25
|
+
executor: quickJsExecutor(),
|
|
26
|
+
connectors: [
|
|
27
|
+
api("time", {
|
|
28
|
+
description: "Time — current timestamp",
|
|
29
|
+
tools: [
|
|
30
|
+
{
|
|
31
|
+
name: "get_now",
|
|
32
|
+
description: "Return the current time as an ISO 8601 timestamp.",
|
|
33
|
+
inputSchema: { type: "object", properties: {} },
|
|
34
|
+
annotations: { readOnlyHint: true },
|
|
35
|
+
handler: async () => ({ now: new Date().toISOString() }),
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
listen(connecta, port);
|
|
43
|
+
console.log(`connecta listening on http://localhost:${port}/mcp`);
|