@jini-ai/mcp 0.7.3-next.2 → 0.7.3-next.3
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/README.md +15 -0
- package/dist/agent-install/owned-json-install.d.ts +1 -1
- package/dist/client/client.js +1 -1
- package/dist/client/css-url-refs.d.ts +3 -1
- package/dist/client/css-url-refs.js +1 -1
- package/dist/external/access-review.d.ts +46 -0
- package/dist/external/access-review.js +175 -0
- package/dist/external/agent-tools.d.ts +72 -0
- package/dist/external/agent-tools.js +218 -0
- package/dist/external/built-in-connections.d.ts +17 -0
- package/dist/external/built-in-connections.js +15 -0
- package/dist/external/external-mcp-host-copy.d.ts +14 -0
- package/dist/external/external-mcp-host-copy.js +8 -0
- package/dist/external/operations-tools.d.ts +69 -0
- package/dist/external/operations-tools.js +96 -0
- package/dist/external/save-form.d.ts +105 -0
- package/dist/external/save-form.js +260 -0
- package/dist/external/save-input.d.ts +41 -0
- package/dist/external/save-input.js +149 -0
- package/dist/external/tool-registrations.d.ts +130 -0
- package/dist/external/tool-registrations.js +299 -0
- package/dist/federation/bootstrap.d.ts +18 -0
- package/dist/federation/bootstrap.js +2 -2
- package/dist/federation/external-mcp-admissions.d.ts +19 -0
- package/dist/federation/external-mcp-admissions.js +30 -0
- package/dist/federation/external-mcp-probe.d.ts +86 -0
- package/dist/federation/external-mcp-probe.js +75 -0
- package/dist/federation/hosted/external-mcp-repo.d.ts +108 -0
- package/dist/federation/hosted/external-mcp-repo.js +210 -0
- package/dist/federation/hosted/external-mcp-repo.writes.d.ts +75 -0
- package/dist/federation/hosted/external-mcp-repo.writes.js +131 -0
- package/dist/federation/hosted/store-credentials.d.ts +6 -1
- package/dist/federation/hosted/store-credentials.js +2 -2
- package/dist/federation/hosted/store-input.d.ts +11 -3
- package/dist/federation/hosted/store-input.js +5 -5
- package/dist/federation/hosted/store-oauth-fields.d.ts +10 -2
- package/dist/federation/hosted/store-oauth-fields.js +7 -7
- package/dist/federation/hosted/store-view.d.ts +6 -1
- package/dist/federation/hosted/store-view.js +2 -2
- package/dist/federation/hosted/store.js +7 -7
- package/dist/federation/hosted/store.memory.d.ts +2 -0
- package/dist/federation/hosted/store.memory.js +6 -2
- package/dist/federation/index.d.ts +2 -0
- package/dist/federation/index.js +2 -0
- package/dist/federation/registrations.js +73 -56
- package/dist/federation/roster-change.d.ts +63 -0
- package/dist/federation/roster-change.js +68 -0
- package/dist/federation/runtime.d.ts +140 -0
- package/dist/federation/runtime.js +118 -0
- package/dist/react/external-mcp/ExternalMcpAdmissionsBanner.d.ts +42 -0
- package/dist/react/external-mcp/ExternalMcpAdmissionsBanner.js +80 -0
- package/dist/react/external-mcp/ExternalMcpPanelSections.d.ts +50 -0
- package/dist/react/external-mcp/ExternalMcpPanelSections.js +35 -0
- package/dist/react/external-mcp/ExternalMcpSettingsPanel.d.ts +446 -0
- package/dist/react/external-mcp/ExternalMcpSettingsPanel.hooks.d.ts +135 -0
- package/dist/react/external-mcp/ExternalMcpSettingsPanel.hooks.js +122 -0
- package/dist/react/external-mcp/ExternalMcpSettingsPanel.js +63 -0
- package/dist/react/external-mcp/ExternalMcpSourceRow.d.ts +40 -0
- package/dist/react/external-mcp/ExternalMcpSourceRow.js +100 -0
- package/dist/react/external-mcp/hooks/external-mcp-form.rules.d.ts +58 -0
- package/dist/react/external-mcp/hooks/external-mcp-form.rules.js +209 -0
- package/dist/react/external-mcp/hooks/external-mcp-source-actions.d.ts +115 -0
- package/dist/react/external-mcp/hooks/external-mcp-source-actions.js +152 -0
- package/dist/react/external-mcp/hooks/use-external-mcp-admissions.hooks.d.ts +166 -0
- package/dist/react/external-mcp/hooks/use-external-mcp-admissions.hooks.js +209 -0
- package/dist/react/external-mcp/hooks/use-external-mcp.hooks.d.ts +132 -0
- package/dist/react/external-mcp/hooks/use-external-mcp.hooks.js +37 -0
- package/dist/server/tool-arguments.d.ts +5 -1
- package/dist/server/tool-arguments.js +13 -9
- package/dist/server/tool-protocol.js +7 -5
- package/dist/server/tools/tool-catalog-tools.js +6 -3
- package/dist/tools/ask-choice/custom-answer.d.ts +77 -0
- package/dist/tools/ask-choice/custom-answer.js +113 -0
- package/dist/tools/ask-choice/index.d.ts +2 -0
- package/dist/tools/ask-choice/index.js +1 -0
- package/package.json +122 -7
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { readFederationAdmissions } from "./admissions.js";
|
|
2
|
+
/** One failure contract for missing composition, a connecting server or a failed read.
|
|
3
|
+
* Keep the legacy code until the admin client's unavailable-state contract migrates too:
|
|
4
|
+
* an unavailable report must never look like an empty admitted roster. */
|
|
5
|
+
function unavailable() {
|
|
6
|
+
return { ok: false, body: { error: "the server's external MCP admissions are unavailable — try again shortly", code: "AGENT_DAEMON_UNAVAILABLE" } };
|
|
7
|
+
}
|
|
8
|
+
/** Binds the host's failure reporter once and returns the admissions reader every caller uses.
|
|
9
|
+
* @param required.reportReadFailure - The host's redacting report for a failed read.
|
|
10
|
+
* @returns `readServerAdmissions`, bound to that reporter.
|
|
11
|
+
* @example export const readServerAdmissions = createServerAdmissionsReader({ reportReadFailure });
|
|
12
|
+
* @complexity O(1).
|
|
13
|
+
*/
|
|
14
|
+
export function createServerAdmissionsReader({ reportReadFailure }, _optional = {}) {
|
|
15
|
+
/** Read the server's single federation after its bounded admission wait; never wake a daemon.
|
|
16
|
+
* @param required - The existing surface's wait and live-report ports; absent ports fail closed.
|
|
17
|
+
* @returns Current reports, preserving optional config failures, or the legacy distinguishable failure.
|
|
18
|
+
* @example readServerAdmissions({ awaitFederation: surface.awaitFederation, readAdmissions })
|
|
19
|
+
* @complexity O(1) beyond federation startup and the report reader; the wait is bounded to 5 seconds.
|
|
20
|
+
*/
|
|
21
|
+
return async function readServerAdmissions({ awaitFederation, readAdmissions }, _options = {}) {
|
|
22
|
+
const result = await readFederationAdmissions({ ports: { awaitFederation, readAdmissions, report: reportReadFailure }, timeoutMs: 5_000 });
|
|
23
|
+
if (!result.ok)
|
|
24
|
+
return unavailable();
|
|
25
|
+
return result.configFailures === undefined
|
|
26
|
+
? { ok: true, connections: result.connections }
|
|
27
|
+
: { ok: true, connections: result.connections, configFailures: result.configFailures };
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=external-mcp-admissions.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Saved-server probe used by the admin route and assistant tools. Jini's hosted probe resolves, connects once and
|
|
2
|
+
* classifies; this file binds the host's store read and HTTP session and keeps the host's response contract: statuses,
|
|
3
|
+
* legacy codes, copy and settings links. Never spawns local commands or invokes remote tools (D-7). */
|
|
4
|
+
import type { ExternalMcpServerConfig, ExternalMcpConfigFailure, ExternalMcpServerRepoPort } from "@jini-ai/core/contracts/hosted-mcp";
|
|
5
|
+
import type { UUID } from "@jini-ai/core/primitives";
|
|
6
|
+
import type { McpHttpExchange, McpHttpLaunchSpec, McpSessionPort } from "./ports.js";
|
|
7
|
+
import { type ExternalMcpProbeSessionFactory } from "./hosted/probe.js";
|
|
8
|
+
/** The deps slice the probe itself reads. The host's own deps type (its store sealer, its OAuth service)
|
|
9
|
+
* extends this and reaches the store only through {@link ExternalMcpProbeHost.readEnabledConfigs}. */
|
|
10
|
+
export interface ExternalMcpProbeBaseDeps {
|
|
11
|
+
readonly workspaceId: UUID;
|
|
12
|
+
readonly clock: {
|
|
13
|
+
nowMs(): number;
|
|
14
|
+
};
|
|
15
|
+
readonly externalMcpServerRepo: Pick<ExternalMcpServerRepoPort, "findByServerId">;
|
|
16
|
+
/** Defaults to the real hosted MCP client. See {@link ExternalMcpProbeSessionFactory}. */
|
|
17
|
+
readonly connect?: ExternalMcpProbeSessionFactory;
|
|
18
|
+
}
|
|
19
|
+
/** What a reauthorization error built by the host exposes to the 409 body. Its stored message never crosses into the
|
|
20
|
+
* body: the outward text comes from {@link ExternalMcpProbeHost.reauthResponseText}. */
|
|
21
|
+
export interface ExternalMcpProbeReauthError {
|
|
22
|
+
readonly code: string;
|
|
23
|
+
readonly settingsLink: string;
|
|
24
|
+
}
|
|
25
|
+
/** @agent-note Host-wired, bound once in the host's external MCP host-copy module. */
|
|
26
|
+
export interface ExternalMcpProbeHost<Deps extends ExternalMcpProbeBaseDeps> {
|
|
27
|
+
/** The host's bound hosted-store read (vault, sealer, optional OAuth token resolver) for this deps bag. */
|
|
28
|
+
readonly readEnabledConfigs: (required: {
|
|
29
|
+
deps: Deps;
|
|
30
|
+
workspaceId: UUID;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
readonly configs: readonly ExternalMcpServerConfig[];
|
|
33
|
+
readonly failures: readonly ExternalMcpConfigFailure[];
|
|
34
|
+
}>;
|
|
35
|
+
/** The host's HTTP MCP session binding (its protocol identity and refusal copy over the federation transport). */
|
|
36
|
+
readonly connectHttpSession: (required: {
|
|
37
|
+
exchange: McpHttpExchange;
|
|
38
|
+
spec: McpHttpLaunchSpec;
|
|
39
|
+
requestTimeoutMs: number;
|
|
40
|
+
}) => Promise<McpSessionPort>;
|
|
41
|
+
/** The host's reauthorization error for a row parked `needs_reauth`: its own copy, code and settings link. */
|
|
42
|
+
readonly reauthRequired: (required: {
|
|
43
|
+
serverId: string;
|
|
44
|
+
label: string | null;
|
|
45
|
+
}) => ExternalMcpProbeReauthError;
|
|
46
|
+
/** The host's response copy for a row parked `needs_reauth` (the outward 409 text). */
|
|
47
|
+
readonly reauthResponseText: (required: {
|
|
48
|
+
serverId: string;
|
|
49
|
+
label: string | null;
|
|
50
|
+
}) => string;
|
|
51
|
+
/** The host's settings-screen deep link for one saved server. */
|
|
52
|
+
readonly settingsDeepLink: (required: {
|
|
53
|
+
serverId: string;
|
|
54
|
+
}) => string;
|
|
55
|
+
/** The host's legacy error code for a reauthorization the store detected during this call. */
|
|
56
|
+
readonly reauthCode: string;
|
|
57
|
+
/** The host's fixed, credential-free copy for one connect-failure category. */
|
|
58
|
+
readonly connectFailureText: (required: {
|
|
59
|
+
id: "auth" | "timeout" | "unreachable";
|
|
60
|
+
}) => string;
|
|
61
|
+
}
|
|
62
|
+
type ProbeFailureResponse = {
|
|
63
|
+
readonly ok: false;
|
|
64
|
+
readonly status: number;
|
|
65
|
+
readonly body: Record<string, unknown>;
|
|
66
|
+
};
|
|
67
|
+
/** Binds the host's store read, HTTP session, reauthorization error, settings link and connect-failure copy once.
|
|
68
|
+
* @param required.host - The host collaborators; see {@link ExternalMcpProbeHost}.
|
|
69
|
+
* @returns `probeExternalMcpServer`, bound to those collaborators.
|
|
70
|
+
* @example export const probeExternalMcpServer = createExternalMcpProbe<ExternalMcpProbeServiceDeps>({ host });
|
|
71
|
+
* @complexity O(1).
|
|
72
|
+
*/
|
|
73
|
+
export declare function createExternalMcpProbe<Deps extends ExternalMcpProbeBaseDeps>({ host }: {
|
|
74
|
+
host: ExternalMcpProbeHost<Deps>;
|
|
75
|
+
}, _optional?: {}): ({ deps, serverId }: {
|
|
76
|
+
deps: Deps;
|
|
77
|
+
serverId: string;
|
|
78
|
+
}, _optional?: {}) => Promise<ProbeFailureResponse | {
|
|
79
|
+
ok: true;
|
|
80
|
+
body: {
|
|
81
|
+
tools: readonly import("./trust.js").RemoteToolSurfaceEntry[];
|
|
82
|
+
probedAt: string;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=external-mcp-probe.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { createFetchMcpHttpExchange } from "./adapter.http.js";
|
|
2
|
+
import { probeExternalMcpServer as probeHostedMcpServer } from "./hosted/probe.js";
|
|
3
|
+
const CONNECT_FAILURES = { auth: { status: 401, code: "MCP_AUTH_REJECTED" }, timeout: { status: 504, code: "MCP_TIMEOUT" }, unreachable: { status: 502, code: "MCP_SERVER_UNREACHABLE" } };
|
|
4
|
+
/** The two local-command refusals: the record-level one points the operator at typing tool names. */
|
|
5
|
+
function localCommandResponse({ stage }, _optional = {}) {
|
|
6
|
+
return stage === "record"
|
|
7
|
+
? { ok: false, status: 400, body: { error: "probe is not available for local-command servers yet — type tool names directly instead", code: "PROBE_UNSUPPORTED_TRANSPORT", details: { field: "transport" } } }
|
|
8
|
+
: { ok: false, status: 400, body: { error: "probe is not available for local-command servers yet", code: "PROBE_UNSUPPORTED_TRANSPORT" } };
|
|
9
|
+
}
|
|
10
|
+
/** Binds the host's store read, HTTP session, reauthorization error, settings link and connect-failure copy once.
|
|
11
|
+
* @param required.host - The host collaborators; see {@link ExternalMcpProbeHost}.
|
|
12
|
+
* @returns `probeExternalMcpServer`, bound to those collaborators.
|
|
13
|
+
* @example export const probeExternalMcpServer = createExternalMcpProbe<ExternalMcpProbeServiceDeps>({ host });
|
|
14
|
+
* @complexity O(1).
|
|
15
|
+
*/
|
|
16
|
+
export function createExternalMcpProbe({ host }, _optional = {}) {
|
|
17
|
+
/** The real session factory: one handshake against the resolved hosted endpoint, bounded by the
|
|
18
|
+
* connection's own `connectTimeoutMs`. Deliberately NOT the same bound `bootstrap.ts`'s
|
|
19
|
+
* `defaultConnect` uses for the identical transport: that session is long-lived and its bound
|
|
20
|
+
* governs every later `tools/call` too, so it uses `callTimeoutMs`. This one issues an `initialize`
|
|
21
|
+
* handshake via the host's `connectMcpHttpSession` followed by this route's own single `listTools`
|
|
22
|
+
* call, then is closed immediately after — for THIS session, `connectTimeoutMs` bounds the
|
|
23
|
+
* handshake and is the correct bound rather than a reused wrong one.
|
|
24
|
+
* @complexity O(1) beyond the remote's round-trip. */
|
|
25
|
+
async function defaultProbeConnect({ spec, requestTimeoutMs }, _optional = {}) {
|
|
26
|
+
return host.connectHttpSession({ exchange: createFetchMcpHttpExchange({ fetch }), spec, requestTimeoutMs });
|
|
27
|
+
}
|
|
28
|
+
/** 409 for both reauthorization paths: a row parked `needs_reauth` (the host's response copy, code and link), or a live
|
|
29
|
+
* refresh that failed with an invalid grant during this call (the store's reason, typed by Jini, plus the deep link). */
|
|
30
|
+
function reauthResponse({ failure, serverId }, _optional = {}) {
|
|
31
|
+
if (failure.stage === "stored") {
|
|
32
|
+
const reauth = host.reauthRequired({ serverId, label: failure.label });
|
|
33
|
+
const text = host.reauthResponseText({ serverId, label: failure.label });
|
|
34
|
+
return { ok: false, status: 409, body: { error: text, code: reauth.code, details: { retryable: false, settingsLink: reauth.settingsLink } } };
|
|
35
|
+
}
|
|
36
|
+
return { ok: false, status: 409, body: { error: failure.reason, code: host.reauthCode, details: { retryable: false, settingsLink: host.settingsDeepLink({ serverId }) } } };
|
|
37
|
+
}
|
|
38
|
+
/** The host's admin response contract for each typed probe failure. Upstream bodies/errors may contain credentials;
|
|
39
|
+
* only the closed category crosses into a connect-failure answer. */
|
|
40
|
+
function probeFailureResponse({ failure, serverId }, _optional = {}) {
|
|
41
|
+
switch (failure.kind) {
|
|
42
|
+
case "unknown_server":
|
|
43
|
+
return { ok: false, status: 400, body: { error: `no external MCP server is configured as '${serverId}'`, code: "INVALID_MCP_SERVER", details: { field: "id" } } };
|
|
44
|
+
case "local_command":
|
|
45
|
+
return localCommandResponse({ stage: failure.stage });
|
|
46
|
+
case "disabled":
|
|
47
|
+
return { ok: false, status: 400, body: { error: "this server is disabled — enable it before probing", code: "MCP_SERVER_DISABLED", details: { field: "enabled" } } };
|
|
48
|
+
case "reauth_required":
|
|
49
|
+
return reauthResponse({ failure, serverId });
|
|
50
|
+
case "unresolved":
|
|
51
|
+
return { ok: false, status: 502, body: { error: failure.reason ?? "this server's connection could not be resolved", code: "MCP_SERVER_UNREACHABLE" } };
|
|
52
|
+
default:
|
|
53
|
+
return { ok: false, status: CONNECT_FAILURES[failure.kind].status, body: { error: host.connectFailureText({ id: failure.kind }), code: CONNECT_FAILURES[failure.kind].code } };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Resolves credentials, probes once, then closes. Expected refusals retain the admin response contract.
|
|
57
|
+
* OAuth resolution can refresh and persist a grant, so this operation is not declared read-only.
|
|
58
|
+
* @complexity O(n + t) time and O(n + t) space for saved servers and advertised tools, plus bounded I/O.
|
|
59
|
+
*/
|
|
60
|
+
return async function probeExternalMcpServer({ deps, serverId }, _optional = {}) {
|
|
61
|
+
const outcome = await probeHostedMcpServer({
|
|
62
|
+
ports: {
|
|
63
|
+
repo: deps.externalMcpServerRepo,
|
|
64
|
+
readEnabledConfigs: ({ workspaceId }) => host.readEnabledConfigs({ deps, workspaceId }),
|
|
65
|
+
connect: deps.connect ?? defaultProbeConnect,
|
|
66
|
+
},
|
|
67
|
+
workspaceId: deps.workspaceId,
|
|
68
|
+
serverId,
|
|
69
|
+
});
|
|
70
|
+
if (!outcome.ok)
|
|
71
|
+
return probeFailureResponse({ failure: outcome.failure, serverId });
|
|
72
|
+
return { ok: true, body: { tools: outcome.tools, probedAt: new Date(deps.clock.nowMs()).toISOString() } };
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=external-mcp-probe.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type Kysely, type RawBuilder } from "kysely";
|
|
2
|
+
import { type VaultRepoPort } from "@jini-ai/core/contracts/vault";
|
|
3
|
+
import { type HostedMcpVaultPorts } from "./index.js";
|
|
4
|
+
import type { StorageKernel } from "@jini-ai/core/contracts/storage";
|
|
5
|
+
import type { UUID } from "@jini-ai/core/primitives";
|
|
6
|
+
import { type ServerKey } from "./external-mcp-repo.writes.js";
|
|
7
|
+
import type { ExternalMcpAccessUpdate, ExternalMcpOAuthRuntimePatch, ExternalMcpReplacedSecrets, ExternalMcpServerRecord, ExternalMcpServerRepoPort } from "@jini-ai/core/contracts/hosted-mcp";
|
|
8
|
+
import type { SealedSecret } from "@jini-ai/core/contracts/vault";
|
|
9
|
+
export interface ExternalMcpServersTable {
|
|
10
|
+
workspace_id: string;
|
|
11
|
+
server_id: string;
|
|
12
|
+
label: string | null;
|
|
13
|
+
provisioned_by_plugin_id: string | null;
|
|
14
|
+
transport: string;
|
|
15
|
+
auth_mode: string;
|
|
16
|
+
enabled: boolean | number;
|
|
17
|
+
command: string | null;
|
|
18
|
+
url: string | null;
|
|
19
|
+
args: string | null;
|
|
20
|
+
allowed_tool_names: string | null;
|
|
21
|
+
write_allowed_tool_names: string | null;
|
|
22
|
+
write_grants_updated_by_principal_id: string | null;
|
|
23
|
+
write_grants_updated_at: string | null;
|
|
24
|
+
env_names: string | null;
|
|
25
|
+
env_secret_id: string | null;
|
|
26
|
+
oauth_secret_id: string | null;
|
|
27
|
+
oauth_provider_id: string | null;
|
|
28
|
+
oauth_grant: string | null;
|
|
29
|
+
oauth_client_id: string | null;
|
|
30
|
+
oauth_endpoints_json: string | null;
|
|
31
|
+
oauth_scopes_json: string | null;
|
|
32
|
+
oauth_status: string | null;
|
|
33
|
+
oauth_expires_at: string | null;
|
|
34
|
+
oauth_token_env_name: string | null;
|
|
35
|
+
oauth_refresh_lease_until: string | null;
|
|
36
|
+
created_at: string;
|
|
37
|
+
updated_at: string;
|
|
38
|
+
version: number;
|
|
39
|
+
}
|
|
40
|
+
export declare class SqlExternalMcpServerRepo implements ExternalMcpServerRepoPort {
|
|
41
|
+
readonly vaultRepo: VaultRepoPort;
|
|
42
|
+
protected readonly kernel: StorageKernel<Kysely<unknown>, unknown> & {
|
|
43
|
+
query<Row>(statement: RawBuilder<Row>): Promise<Row[]>;
|
|
44
|
+
};
|
|
45
|
+
private readonly tables;
|
|
46
|
+
private readonly vaultErrors;
|
|
47
|
+
constructor({ kernel, vaultRepo, tables, vaultErrors }: {
|
|
48
|
+
kernel: StorageKernel<Kysely<unknown>, unknown> & {
|
|
49
|
+
query<Row>(statement: RawBuilder<Row>): Promise<Row[]>;
|
|
50
|
+
};
|
|
51
|
+
vaultRepo: VaultRepoPort;
|
|
52
|
+
tables: {
|
|
53
|
+
servers: string;
|
|
54
|
+
vault: string;
|
|
55
|
+
};
|
|
56
|
+
vaultErrors: HostedMcpVaultPorts["vaultErrors"];
|
|
57
|
+
}, _optional?: {});
|
|
58
|
+
/** One query hydrates both pointers for the entire roster, including empty rosters.
|
|
59
|
+
* @complexity O(server count + envelope bytes); two indexed LEFT JOINs, no per-row I/O.
|
|
60
|
+
*/
|
|
61
|
+
private read;
|
|
62
|
+
listByWorkspaceId(workspaceId: UUID): Promise<ExternalMcpServerRecord[]>;
|
|
63
|
+
findByServerId(input: ServerKey): Promise<ExternalMcpServerRecord | null>;
|
|
64
|
+
upsert(record: ExternalMcpServerRecord): Promise<void>;
|
|
65
|
+
insert({ record }: {
|
|
66
|
+
record: ExternalMcpServerRecord;
|
|
67
|
+
}): Promise<boolean>;
|
|
68
|
+
updateIfVersion(required: {
|
|
69
|
+
record: ExternalMcpServerRecord;
|
|
70
|
+
expectedVersion: number;
|
|
71
|
+
expectedCreatedAt?: string;
|
|
72
|
+
replaces: ExternalMcpReplacedSecrets;
|
|
73
|
+
}): Promise<boolean>;
|
|
74
|
+
updateOAuthRuntime(required: {
|
|
75
|
+
key: ServerKey;
|
|
76
|
+
expectedSealedOAuth: SealedSecret | null;
|
|
77
|
+
expectedConfig?: Pick<ExternalMcpServerRecord, "createdAt" | "version">;
|
|
78
|
+
patch: ExternalMcpOAuthRuntimePatch;
|
|
79
|
+
}): Promise<boolean>;
|
|
80
|
+
/** Serialize with credential writers, validate the approved source, then replace access only.
|
|
81
|
+
* The conditional UPDATE also compares prior grants and their decision; no credential/vault column is written.
|
|
82
|
+
* @complexity One indexed hydrated read and conditional UPDATE, O(a+w) bounded grant bytes.
|
|
83
|
+
*/
|
|
84
|
+
updateAccessIfCurrent(input: ExternalMcpAccessUpdate, _options?: {}): Promise<boolean>;
|
|
85
|
+
deleteByServerId(input: ServerKey): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Claims the OAuth refresh lease with a single conditional UPDATE.
|
|
88
|
+
*
|
|
89
|
+
* The condition is in the `WHERE`, not in a preceding `SELECT`, and that is the whole guarantee:
|
|
90
|
+
* a read-then-write loses the race it exists to prevent, because between reading "no lease" and
|
|
91
|
+
* writing "my lease" the other process does exactly the same and both go on to redeem the same
|
|
92
|
+
* single-use rotating refresh token — which permanently kills the connection. The updated-row
|
|
93
|
+
* count is therefore the answer, not a diagnostic. (One statement is atomic on every dialect: on
|
|
94
|
+
* Postgres the second UPDATE waits for the first's row lock, then re-checks the `WHERE`.)
|
|
95
|
+
*
|
|
96
|
+
* A lease at or before `nowIso` is treated as abandoned, so a process that crashed mid-refresh
|
|
97
|
+
* cannot wedge the connection until someone restarts something.
|
|
98
|
+
*
|
|
99
|
+
* @returns `true` when this caller now holds the lease.
|
|
100
|
+
* @complexity O(1) — one indexed conditional UPDATE on the primary key.
|
|
101
|
+
*/
|
|
102
|
+
tryClaimOAuthRefreshLease(input: ServerKey & {
|
|
103
|
+
nowIso: string;
|
|
104
|
+
leaseUntil: string;
|
|
105
|
+
}): Promise<boolean>;
|
|
106
|
+
releaseOAuthRefreshLease(input: ServerKey): Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=external-mcp-repo.d.ts.map
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from "node:util";
|
|
2
|
+
import { sql } from "kysely";
|
|
3
|
+
import { VaultError } from "@jini-ai/core/contracts/vault";
|
|
4
|
+
import { persistExternalMcpVaultEnvelope } from "./index.js";
|
|
5
|
+
import { externalMcpAccessSnapshot, externalMcpVaultEnvelope, deleteExternalMcpVaultEnvelope } from "./index.js";
|
|
6
|
+
import { insertRow, toRow, updateRowIfVersion, updateRuntime } from "./external-mcp-repo.writes.js";
|
|
7
|
+
import { toBool } from "@jini-ai/core/contracts/storage";
|
|
8
|
+
const vaultColumns = ["workspace_id", "id", "kind", "owner_key", "principal_id", "binding", "provider", "label", "is_default",
|
|
9
|
+
"revision", "sealed_key_id", "sealed_ciphertext", "sealed_nonce", "sealed_alg", "last4", "token_length", "meta", "created_at", "updated_at"];
|
|
10
|
+
function joinedEnvelope({ row, prefix, kind }) {
|
|
11
|
+
if (row[`${prefix}_secret_id`] === null)
|
|
12
|
+
return null;
|
|
13
|
+
const vault = Object.fromEntries(vaultColumns.map(column => [column, row[`${prefix}_${column}`]]));
|
|
14
|
+
assertJoinedContext({ vault, row, kind });
|
|
15
|
+
return externalMcpVaultEnvelope({ record: toVaultRecord({ vault }) });
|
|
16
|
+
}
|
|
17
|
+
/** Refuses a joined payload that is not this server's own unscoped `kind` payload (or is missing). */
|
|
18
|
+
function assertJoinedContext({ vault, row, kind }) {
|
|
19
|
+
const invalidOwner = !vault.id || vault.workspace_id !== row.workspace_id || vault.owner_key !== row.server_id;
|
|
20
|
+
const invalidScope = vault.kind !== kind || vault.principal_id !== null || vault.binding !== null;
|
|
21
|
+
if (invalidOwner || invalidScope)
|
|
22
|
+
throw new VaultError({ code: "context" });
|
|
23
|
+
}
|
|
24
|
+
/** The vault record behind a context-checked payload; one missing any sealed part is refused. */
|
|
25
|
+
function toVaultRecord({ vault }) {
|
|
26
|
+
const { sealed_key_id, sealed_ciphertext, sealed_nonce, sealed_alg } = vault;
|
|
27
|
+
if (typeof sealed_key_id !== "string" || typeof sealed_ciphertext !== "string" || typeof sealed_nonce !== "string" || typeof sealed_alg !== "string")
|
|
28
|
+
throw new VaultError({ code: "invalid-record" });
|
|
29
|
+
return { workspaceId: vault.workspace_id, id: vault.id, kind: vault.kind, ownerKey: vault.owner_key,
|
|
30
|
+
principalId: vault.principal_id, binding: vault.binding, provider: vault.provider, label: vault.label,
|
|
31
|
+
isDefault: toBool({ value: vault.is_default }) ?? false, revision: Number(vault.revision),
|
|
32
|
+
sealed: { keyId: sealed_key_id, ciphertext: sealed_ciphertext, nonce: sealed_nonce, alg: sealed_alg },
|
|
33
|
+
last4: vault.last4, tokenLength: vault.token_length, meta: typeof vault.meta === "string" ? JSON.parse(vault.meta) : vault.meta,
|
|
34
|
+
createdAt: vault.created_at, updatedAt: vault.updated_at };
|
|
35
|
+
}
|
|
36
|
+
function toRecord(row) {
|
|
37
|
+
const sealedEnv = joinedEnvelope({ row, prefix: "env", kind: "mcp-env" });
|
|
38
|
+
const sealedOAuth = joinedEnvelope({ row, prefix: "oauth", kind: "mcp-auth" });
|
|
39
|
+
return {
|
|
40
|
+
workspaceId: row.workspace_id,
|
|
41
|
+
serverId: row.server_id,
|
|
42
|
+
label: row.label,
|
|
43
|
+
provisionedByPluginId: row.provisioned_by_plugin_id,
|
|
44
|
+
transport: row.transport,
|
|
45
|
+
authMode: row.auth_mode,
|
|
46
|
+
enabled: toBool({ value: row.enabled }) ?? false,
|
|
47
|
+
command: row.command,
|
|
48
|
+
url: row.url,
|
|
49
|
+
args: row.args,
|
|
50
|
+
allowedToolNames: row.allowed_tool_names,
|
|
51
|
+
writeAllowedToolNames: row.write_allowed_tool_names,
|
|
52
|
+
writeGrantsUpdatedByPrincipalId: row.write_grants_updated_by_principal_id,
|
|
53
|
+
writeGrantsUpdatedAt: row.write_grants_updated_at,
|
|
54
|
+
envNames: row.env_names,
|
|
55
|
+
sealedEnv,
|
|
56
|
+
oauthProviderId: row.oauth_provider_id,
|
|
57
|
+
oauthGrant: row.oauth_grant,
|
|
58
|
+
oauthClientId: row.oauth_client_id,
|
|
59
|
+
oauthEndpointsJson: row.oauth_endpoints_json,
|
|
60
|
+
oauthScopesJson: row.oauth_scopes_json,
|
|
61
|
+
oauthStatus: row.oauth_status,
|
|
62
|
+
oauthExpiresAt: row.oauth_expires_at,
|
|
63
|
+
oauthTokenEnvName: row.oauth_token_env_name,
|
|
64
|
+
oauthRefreshLeaseUntil: row.oauth_refresh_lease_until,
|
|
65
|
+
sealedOAuth,
|
|
66
|
+
aadVersion: 1,
|
|
67
|
+
oauthAadVersion: 1,
|
|
68
|
+
createdAt: row.created_at,
|
|
69
|
+
updatedAt: row.updated_at,
|
|
70
|
+
version: Number(row.version),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export class SqlExternalMcpServerRepo {
|
|
74
|
+
vaultRepo;
|
|
75
|
+
kernel;
|
|
76
|
+
tables;
|
|
77
|
+
vaultErrors;
|
|
78
|
+
constructor({ kernel, vaultRepo, tables, vaultErrors }, _optional = {}) {
|
|
79
|
+
this.kernel = kernel;
|
|
80
|
+
this.vaultRepo = vaultRepo;
|
|
81
|
+
this.tables = tables;
|
|
82
|
+
this.vaultErrors = vaultErrors;
|
|
83
|
+
}
|
|
84
|
+
/** One query hydrates both pointers for the entire roster, including empty rosters.
|
|
85
|
+
* @complexity O(server count + envelope bytes); two indexed LEFT JOINs, no per-row I/O.
|
|
86
|
+
*/
|
|
87
|
+
async read({ workspaceId, serverId }) {
|
|
88
|
+
const projection = ["env", "oauth"].flatMap(prefix => vaultColumns.map(column => {
|
|
89
|
+
const source = sql.ref(`${prefix}.${column}`);
|
|
90
|
+
const alias = sql.ref(`${prefix}_${column}`);
|
|
91
|
+
return sql `${source} AS ${alias}`;
|
|
92
|
+
}));
|
|
93
|
+
const serverFilter = serverId === undefined ? sql `` : sql `AND s.server_id=${serverId}`;
|
|
94
|
+
const rows = await this.kernel.query(sql `SELECT s.*, ${sql.join(projection)} FROM ${sql.table(this.tables.servers)} s
|
|
95
|
+
LEFT JOIN ${sql.table(this.tables.vault)} env ON env.workspace_id=s.workspace_id AND env.id=s.env_secret_id
|
|
96
|
+
LEFT JOIN ${sql.table(this.tables.vault)} oauth ON oauth.workspace_id=s.workspace_id AND oauth.id=s.oauth_secret_id
|
|
97
|
+
WHERE s.workspace_id=${workspaceId} ${serverFilter}`);
|
|
98
|
+
return rows.map(toRecord);
|
|
99
|
+
}
|
|
100
|
+
async listByWorkspaceId(workspaceId) {
|
|
101
|
+
return this.read({ workspaceId });
|
|
102
|
+
}
|
|
103
|
+
async findByServerId(input) {
|
|
104
|
+
return (await this.read(input))[0] ?? null;
|
|
105
|
+
}
|
|
106
|
+
async upsert(record) {
|
|
107
|
+
await this.kernel.transaction(async () => {
|
|
108
|
+
// Match Jini's writer lock before reading pointers, including callbacks and token refresh.
|
|
109
|
+
await this.kernel.lockKey(`secrets_vault:${record.workspaceId}`);
|
|
110
|
+
const previous = await this.kernel.run(db => db.withTables().selectFrom(this.tables.servers)
|
|
111
|
+
.select(["env_secret_id", "oauth_secret_id"]).where("workspace_id", "=", record.workspaceId)
|
|
112
|
+
.where("server_id", "=", record.serverId).executeTakeFirst());
|
|
113
|
+
const env_secret_id = await persistExternalMcpVaultEnvelope({ repo: this.vaultRepo, vaultErrors: this.vaultErrors, sealed: record.sealedEnv, identity: record, kind: "mcp-env" });
|
|
114
|
+
const oauth_secret_id = await persistExternalMcpVaultEnvelope({ repo: this.vaultRepo, vaultErrors: this.vaultErrors, sealed: record.sealedOAuth, identity: record, kind: "mcp-auth" });
|
|
115
|
+
const row = toRow({ record, pointers: { env_secret_id, oauth_secret_id } });
|
|
116
|
+
await this.kernel.run(db => db.withTables().insertInto(this.tables.servers).values(row)
|
|
117
|
+
.onConflict(oc => oc.columns(["workspace_id", "server_id"]).doUpdateSet(row)).execute());
|
|
118
|
+
// The upsert unlinks old pointers first; RESTRICT foreign keys remain satisfied throughout.
|
|
119
|
+
if (previous?.env_secret_id !== env_secret_id)
|
|
120
|
+
await deleteExternalMcpVaultEnvelope({ repo: this.vaultRepo, workspaceId: record.workspaceId, id: previous?.env_secret_id ?? null });
|
|
121
|
+
if (previous?.oauth_secret_id !== oauth_secret_id)
|
|
122
|
+
await deleteExternalMcpVaultEnvelope({ repo: this.vaultRepo, workspaceId: record.workspaceId, id: previous?.oauth_secret_id ?? null });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
async insert({ record }) {
|
|
126
|
+
return insertRow({ kernel: this.kernel, vaultRepo: this.vaultRepo, tables: this.tables, vaultErrors: this.vaultErrors, record });
|
|
127
|
+
}
|
|
128
|
+
async updateIfVersion(required) {
|
|
129
|
+
return updateRowIfVersion({ kernel: this.kernel, vaultRepo: this.vaultRepo, tables: this.tables, vaultErrors: this.vaultErrors, ...required });
|
|
130
|
+
}
|
|
131
|
+
async updateOAuthRuntime(required) {
|
|
132
|
+
return updateRuntime({ kernel: this.kernel, vaultRepo: this.vaultRepo, tables: this.tables, vaultErrors: this.vaultErrors, ...required });
|
|
133
|
+
}
|
|
134
|
+
/** Serialize with credential writers, validate the approved source, then replace access only.
|
|
135
|
+
* The conditional UPDATE also compares prior grants and their decision; no credential/vault column is written.
|
|
136
|
+
* @complexity One indexed hydrated read and conditional UPDATE, O(a+w) bounded grant bytes.
|
|
137
|
+
*/
|
|
138
|
+
async updateAccessIfCurrent(input, _options = {}) {
|
|
139
|
+
return this.kernel.transaction(async () => {
|
|
140
|
+
await this.kernel.lockKey(`secrets_vault:${input.workspaceId}`);
|
|
141
|
+
const current = await this.findByServerId(input);
|
|
142
|
+
if (!current || !isDeepStrictEqual(externalMcpAccessSnapshot({ record: current }), input.expected))
|
|
143
|
+
return false;
|
|
144
|
+
const expected = input.expected;
|
|
145
|
+
const result = await this.kernel.run(db => db.withTables().updateTable(this.tables.servers)
|
|
146
|
+
.set({ enabled: input.access.enabled, allowed_tool_names: input.access.allowedToolNames,
|
|
147
|
+
write_allowed_tool_names: input.access.writeAllowedToolNames, write_grants_updated_by_principal_id: input.principalId,
|
|
148
|
+
write_grants_updated_at: input.nowIso, updated_at: input.nowIso, version: sql `version + 1` })
|
|
149
|
+
.where("workspace_id", "=", input.workspaceId).where("server_id", "=", input.serverId)
|
|
150
|
+
.where("enabled", "=", expected.enabled)
|
|
151
|
+
.where("allowed_tool_names", expected.allowedToolNames === null ? "is" : "=", expected.allowedToolNames)
|
|
152
|
+
.where("write_allowed_tool_names", expected.writeAllowedToolNames === null ? "is" : "=", expected.writeAllowedToolNames)
|
|
153
|
+
.where("write_grants_updated_by_principal_id", expected.writeGrantsUpdatedByPrincipalId === null ? "is" : "=", expected.writeGrantsUpdatedByPrincipalId)
|
|
154
|
+
.where("write_grants_updated_at", expected.writeGrantsUpdatedAt === null ? "is" : "=", expected.writeGrantsUpdatedAt)
|
|
155
|
+
.where("provisioned_by_plugin_id", expected.provisionedByPluginId === null ? "is" : "=", expected.provisionedByPluginId)
|
|
156
|
+
.executeTakeFirst());
|
|
157
|
+
return Number(result.numUpdatedRows) === 1;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async deleteByServerId(input) {
|
|
161
|
+
return this.kernel.transaction(async () => {
|
|
162
|
+
await this.kernel.lockKey(`secrets_vault:${input.workspaceId}`);
|
|
163
|
+
const previous = await this.kernel.run(db => db.withTables().selectFrom(this.tables.servers)
|
|
164
|
+
.select(["env_secret_id", "oauth_secret_id"]).where("workspace_id", "=", input.workspaceId)
|
|
165
|
+
.where("server_id", "=", input.serverId).executeTakeFirst());
|
|
166
|
+
if (!previous)
|
|
167
|
+
return false;
|
|
168
|
+
await this.kernel.run(db => db.withTables().deleteFrom(this.tables.servers).where("workspace_id", "=", input.workspaceId)
|
|
169
|
+
.where("server_id", "=", input.serverId).execute());
|
|
170
|
+
for (const id of [previous.env_secret_id, previous.oauth_secret_id])
|
|
171
|
+
await deleteExternalMcpVaultEnvelope({ repo: this.vaultRepo, workspaceId: input.workspaceId, id });
|
|
172
|
+
return true;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Claims the OAuth refresh lease with a single conditional UPDATE.
|
|
177
|
+
*
|
|
178
|
+
* The condition is in the `WHERE`, not in a preceding `SELECT`, and that is the whole guarantee:
|
|
179
|
+
* a read-then-write loses the race it exists to prevent, because between reading "no lease" and
|
|
180
|
+
* writing "my lease" the other process does exactly the same and both go on to redeem the same
|
|
181
|
+
* single-use rotating refresh token — which permanently kills the connection. The updated-row
|
|
182
|
+
* count is therefore the answer, not a diagnostic. (One statement is atomic on every dialect: on
|
|
183
|
+
* Postgres the second UPDATE waits for the first's row lock, then re-checks the `WHERE`.)
|
|
184
|
+
*
|
|
185
|
+
* A lease at or before `nowIso` is treated as abandoned, so a process that crashed mid-refresh
|
|
186
|
+
* cannot wedge the connection until someone restarts something.
|
|
187
|
+
*
|
|
188
|
+
* @returns `true` when this caller now holds the lease.
|
|
189
|
+
* @complexity O(1) — one indexed conditional UPDATE on the primary key.
|
|
190
|
+
*/
|
|
191
|
+
async tryClaimOAuthRefreshLease(input) {
|
|
192
|
+
const result = await this.kernel.run((db) => db
|
|
193
|
+
.withTables().updateTable(this.tables.servers)
|
|
194
|
+
.set({ oauth_refresh_lease_until: input.leaseUntil })
|
|
195
|
+
.where("workspace_id", "=", input.workspaceId)
|
|
196
|
+
.where("server_id", "=", input.serverId)
|
|
197
|
+
.where((eb) => eb.or([eb("oauth_refresh_lease_until", "is", null), eb("oauth_refresh_lease_until", "<=", input.nowIso)]))
|
|
198
|
+
.executeTakeFirst());
|
|
199
|
+
return Number(result.numUpdatedRows) > 0;
|
|
200
|
+
}
|
|
201
|
+
async releaseOAuthRefreshLease(input) {
|
|
202
|
+
await this.kernel.run((db) => db
|
|
203
|
+
.withTables().updateTable(this.tables.servers)
|
|
204
|
+
.set({ oauth_refresh_lease_until: null })
|
|
205
|
+
.where("workspace_id", "=", input.workspaceId)
|
|
206
|
+
.where("server_id", "=", input.serverId)
|
|
207
|
+
.execute());
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=external-mcp-repo.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { SealedSecret } from "@jini-ai/core/contracts/vault";
|
|
2
|
+
import type { UUID } from "@jini-ai/core/primitives";
|
|
3
|
+
import type { ExternalMcpOAuthRuntimePatch, ExternalMcpReplacedSecrets, ExternalMcpServerRecord } from "@jini-ai/core/contracts/hosted-mcp";
|
|
4
|
+
import type { SqlExternalMcpServerRepo } from "./external-mcp-repo.js";
|
|
5
|
+
/**
|
|
6
|
+
* @file The editor and runtime writes of `SqlExternalMcpServerRepo` (lost-update design S1, M1/M7).
|
|
7
|
+
*
|
|
8
|
+
* Every write takes the same `secrets_vault:<workspace>` writer lock the credential writers take, so
|
|
9
|
+
* the pointers compared here cannot move between the compare and the write. The compare is ALSO in
|
|
10
|
+
* the `UPDATE`'s `WHERE`, which is the guarantee on a database where the lock is advisory only.
|
|
11
|
+
* A write that misses throws {@link WriteMissed} so the transaction rolls back the vault envelopes
|
|
12
|
+
* it staged; the entry points turn that into `false`.
|
|
13
|
+
*/
|
|
14
|
+
export type ServerKey = {
|
|
15
|
+
workspaceId: UUID;
|
|
16
|
+
serverId: string;
|
|
17
|
+
};
|
|
18
|
+
type WriteDeps = ConstructorParameters<typeof SqlExternalMcpServerRepo>[0];
|
|
19
|
+
export declare function toRow({ record, pointers }: {
|
|
20
|
+
record: ExternalMcpServerRecord;
|
|
21
|
+
pointers: {
|
|
22
|
+
env_secret_id: string | null;
|
|
23
|
+
oauth_secret_id: string | null;
|
|
24
|
+
};
|
|
25
|
+
}, _optional?: Record<string, never>): {
|
|
26
|
+
oauth_provider_id: string | null;
|
|
27
|
+
oauth_grant: string | null;
|
|
28
|
+
oauth_client_id: string | null;
|
|
29
|
+
oauth_endpoints_json: string | null;
|
|
30
|
+
oauth_scopes_json: string | null;
|
|
31
|
+
oauth_status: string | null;
|
|
32
|
+
oauth_expires_at: string | null;
|
|
33
|
+
oauth_token_env_name: string | null;
|
|
34
|
+
oauth_refresh_lease_until: string | null;
|
|
35
|
+
created_at: string;
|
|
36
|
+
updated_at: string;
|
|
37
|
+
version: number;
|
|
38
|
+
env_secret_id: string | null;
|
|
39
|
+
oauth_secret_id: string | null;
|
|
40
|
+
workspace_id: string;
|
|
41
|
+
server_id: string;
|
|
42
|
+
label: string | null;
|
|
43
|
+
provisioned_by_plugin_id: string | null;
|
|
44
|
+
transport: string;
|
|
45
|
+
auth_mode: string;
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
command: string | null;
|
|
48
|
+
url: string | null;
|
|
49
|
+
args: string | null;
|
|
50
|
+
allowed_tool_names: string | null;
|
|
51
|
+
write_allowed_tool_names: string | null;
|
|
52
|
+
write_grants_updated_by_principal_id: string | null;
|
|
53
|
+
write_grants_updated_at: string | null;
|
|
54
|
+
env_names: string | null;
|
|
55
|
+
};
|
|
56
|
+
/** Creates the row at version 1; `false` and nothing written when the key is taken. */
|
|
57
|
+
export declare function insertRow({ kernel, vaultRepo, tables, vaultErrors, record }: WriteDeps & {
|
|
58
|
+
record: ExternalMcpServerRecord;
|
|
59
|
+
}, _optional?: {}): Promise<boolean>;
|
|
60
|
+
/** The edit write: version and both credential pointers compared in the `WHERE`, version + 1 set. */
|
|
61
|
+
export declare function updateRowIfVersion({ kernel, vaultRepo, tables, vaultErrors, record, expectedVersion, expectedCreatedAt, replaces }: WriteDeps & {
|
|
62
|
+
record: ExternalMcpServerRecord;
|
|
63
|
+
expectedVersion: number;
|
|
64
|
+
expectedCreatedAt?: string;
|
|
65
|
+
replaces: ExternalMcpReplacedSecrets;
|
|
66
|
+
}, _optional?: {}): Promise<boolean>;
|
|
67
|
+
/** The runtime write: OAuth pointer, status, expiry, lease only, while the credential is the one read. */
|
|
68
|
+
export declare function updateRuntime({ kernel, vaultRepo, tables, vaultErrors, key, expectedSealedOAuth, expectedConfig, patch }: WriteDeps & {
|
|
69
|
+
key: ServerKey;
|
|
70
|
+
expectedSealedOAuth: SealedSecret | null;
|
|
71
|
+
expectedConfig?: Pick<ExternalMcpServerRecord, "createdAt" | "version">;
|
|
72
|
+
patch: ExternalMcpOAuthRuntimePatch;
|
|
73
|
+
}, _optional?: {}): Promise<boolean>;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=external-mcp-repo.writes.d.ts.map
|