@buildbase/sdk 0.0.54 → 0.0.55
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 +8 -4
- package/CHANGELOG.md +53 -0
- package/LICENSE +21 -0
- package/README.md +203 -45
- package/dist/css/styles.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +196 -88
- package/dist/index.mjs +1 -1
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.ts +226 -16
- package/dist/mcp/index.mjs +1 -1
- package/dist/react/chunks/SettingsDialog-B6DhyNae.cjs +2 -0
- package/dist/react/chunks/SettingsDialog-K38BI74F.mjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-BidcQ_vc.mjs +2 -0
- package/dist/react/chunks/SubscriptionDialog-CfDLoOzW.cjs +2 -0
- package/dist/react/chunks/ar-CCKONfUU.mjs +2 -0
- package/dist/react/chunks/ar-DrHMtT1E.cjs +2 -0
- package/dist/react/chunks/de-Dhtorn10.cjs +2 -0
- package/dist/react/chunks/de-X9mfnMFM.mjs +2 -0
- package/dist/react/chunks/es--8iZ7Trv.mjs +2 -0
- package/dist/react/chunks/es-CUR7LB6a.cjs +2 -0
- package/dist/react/chunks/fr-BqMs_F5g.cjs +2 -0
- package/dist/react/chunks/fr-rUp34NG7.mjs +2 -0
- package/dist/react/chunks/hi-B_IiucJZ.mjs +2 -0
- package/dist/react/chunks/hi-C2i1_hdv.cjs +2 -0
- package/dist/react/chunks/ja-4hLI6wMX.cjs +2 -0
- package/dist/react/chunks/ja-CIGOj3vV.mjs +2 -0
- package/dist/react/chunks/react-BXTDLnE8.cjs +2 -0
- package/dist/react/chunks/react-CXCk05WI.mjs +2 -0
- package/dist/react/chunks/zh-BSgd6ai5.cjs +2 -0
- package/dist/react/chunks/zh-DyVvcYFC.mjs +2 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.ts +460 -142
- package/dist/react/index.mjs +1 -1
- package/docs/ARCHITECTURE.md +419 -0
- package/docs/ERROR_CODES.md +96 -0
- package/docs/MCP-AND-AGENT-READINESS.md +893 -0
- package/docs/THEMING.md +67 -0
- package/docs/UI-CONFIG.md +207 -0
- package/package.json +14 -3
- package/dist/react/chunks/SettingsDialog-B28WJsAr.cjs +0 -2
- package/dist/react/chunks/SettingsDialog-blhppbNm.mjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-BTWVX3cH.mjs +0 -2
- package/dist/react/chunks/SubscriptionDialog-QKmwvJU1.cjs +0 -2
- package/dist/react/chunks/ar-1Z1MOGAP.mjs +0 -2
- package/dist/react/chunks/ar-VGzBv3AZ.cjs +0 -2
- package/dist/react/chunks/de-BjdDg60Y.cjs +0 -2
- package/dist/react/chunks/de-CXUItplO.mjs +0 -2
- package/dist/react/chunks/es-BBPsSZUp.cjs +0 -2
- package/dist/react/chunks/es-BTbzVutz.mjs +0 -2
- package/dist/react/chunks/fr-Cax48X_S.cjs +0 -2
- package/dist/react/chunks/fr-DPMeOQu3.mjs +0 -2
- package/dist/react/chunks/hi-BJqvpG6d.cjs +0 -2
- package/dist/react/chunks/hi-JfJx-LV7.mjs +0 -2
- package/dist/react/chunks/ja-CDGtLzTk.mjs +0 -2
- package/dist/react/chunks/ja-DvVyj5xX.cjs +0 -2
- package/dist/react/chunks/react-6QJCOE-D.cjs +0 -2
- package/dist/react/chunks/react-CC6T7Zky.mjs +0 -2
- package/dist/react/chunks/zh-BAcqxkxk.cjs +0 -2
- package/dist/react/chunks/zh-BNZ2Ooe8.mjs +0 -2
package/dist/mcp/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
/** An Agent Skill (Agent Skills Discovery RFC v0.2.0) published by this app. */
|
|
4
4
|
interface AgentSkill {
|
|
5
|
-
/** Stable slug, e.g. `
|
|
5
|
+
/** Stable slug, e.g. `acme-api`. */
|
|
6
6
|
name: string;
|
|
7
7
|
/** One-line human/agent-readable summary. */
|
|
8
8
|
description: string;
|
|
@@ -18,7 +18,7 @@ interface AgentSkill {
|
|
|
18
18
|
}
|
|
19
19
|
/** One API described in an API Catalog (RFC 9727 / RFC 9264 linkset). */
|
|
20
20
|
interface ApiCatalogApi {
|
|
21
|
-
/** Anchor URL identifying the API, e.g. `https://api.
|
|
21
|
+
/** Anchor URL identifying the API, e.g. `https://api.example.com`. */
|
|
22
22
|
anchor: string;
|
|
23
23
|
/** OpenAPI / machine-readable description URL (link rel `service-desc`). */
|
|
24
24
|
serviceDesc?: string;
|
|
@@ -39,7 +39,7 @@ interface McpServerCard {
|
|
|
39
39
|
endpoint: string;
|
|
40
40
|
/** Transport type. Defaults to `"streamable-http"`. */
|
|
41
41
|
transport?: string;
|
|
42
|
-
/** MCP protocol version the server speaks. Defaults to `"2025-
|
|
42
|
+
/** MCP protocol version the server speaks. Defaults to `"2025-11-25"`. */
|
|
43
43
|
protocolVersion?: string;
|
|
44
44
|
/**
|
|
45
45
|
* Capability flags. Booleans per SEP-1649 v1.0; a legacy object value
|
|
@@ -143,7 +143,7 @@ interface AgentReadyConfig {
|
|
|
143
143
|
/** The org id (24-hex) whose agent-readiness config to serve. */
|
|
144
144
|
orgId: string;
|
|
145
145
|
/**
|
|
146
|
-
* This app's public origin, e.g. `https://
|
|
146
|
+
* This app's public origin, e.g. `https://example.com`. Used to build absolute
|
|
147
147
|
* URLs in the Agent Card and to match RFC 9728 resource paths.
|
|
148
148
|
*/
|
|
149
149
|
siteUrl: string;
|
|
@@ -307,14 +307,14 @@ interface DiscoveryDocument {
|
|
|
307
307
|
*/
|
|
308
308
|
|
|
309
309
|
/** Every built-in tool, keyed by name. */
|
|
310
|
-
declare const builtinMcpTools: ReadonlyMap<string,
|
|
310
|
+
declare const builtinMcpTools: ReadonlyMap<string, AnyMcpTool>;
|
|
311
311
|
/** The name of a built-in BuildBase MCP tool. */
|
|
312
312
|
type BuiltinMcpToolName = 'list_workspaces' | 'get_workspace' | 'get_user_profile' | 'list_workspace_users' | 'get_subscription' | 'get_plans' | 'get_plan_versions' | 'get_public_plans' | 'get_plan_version' | 'list_invoices' | 'get_invoice' | 'get_quota_usage' | 'get_all_quota_usage' | 'get_usage_logs' | 'get_credit_balance' | 'list_credit_transactions' | 'get_credit_packages' | 'get_credit_buckets' | 'get_expiring_credits' | 'get_public_credit_packages' | 'check_feature_flag' | 'check_permission' | 'resolve_permissions' | 'get_settings' | 'record_usage' | 'record_usage_batch' | 'consume_credits' | 'send_notification' | 'create_workspace' | 'update_workspace' | 'delete_workspace' | 'invite_workspace_user' | 'remove_workspace_user' | 'update_workspace_user_role' | 'update_user_profile' | 'update_feature_flag' | 'create_subscription_checkout' | 'update_subscription' | 'cancel_subscription' | 'resume_subscription' | 'get_billing_portal_url' | 'purchase_credits';
|
|
313
313
|
/** Resolve a `builtinTools` config value to the tools it selects. */
|
|
314
314
|
declare function selectBuiltinTools(selection: 'all' | 'readonly' | false | {
|
|
315
315
|
include?: BuiltinMcpToolName[];
|
|
316
316
|
exclude?: BuiltinMcpToolName[];
|
|
317
|
-
}):
|
|
317
|
+
}): AnyMcpTool[];
|
|
318
318
|
|
|
319
319
|
interface IDocument {
|
|
320
320
|
_id: string;
|
|
@@ -1088,7 +1088,7 @@ interface ISettings {
|
|
|
1088
1088
|
/** Auto-create workspace on first login */
|
|
1089
1089
|
autoCreateFirst: boolean;
|
|
1090
1090
|
};
|
|
1091
|
-
[key: string]:
|
|
1091
|
+
[key: string]: unknown;
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
1094
|
/** Data passed to a notification template for merge tag replacement. */
|
|
@@ -1147,7 +1147,7 @@ interface NotificationData {
|
|
|
1147
1147
|
push?: boolean;
|
|
1148
1148
|
};
|
|
1149
1149
|
/** Any additional merge tags available as {{key}} in the email template. */
|
|
1150
|
-
[key: string]:
|
|
1150
|
+
[key: string]: unknown;
|
|
1151
1151
|
}
|
|
1152
1152
|
/** Result of sending a notification. */
|
|
1153
1153
|
interface NotificationResult {
|
|
@@ -1349,13 +1349,20 @@ interface ScopedActions {
|
|
|
1349
1349
|
*
|
|
1350
1350
|
* export const mcp = createMcpHandler({
|
|
1351
1351
|
* buildbase,
|
|
1352
|
-
* serverInfo: { name: '
|
|
1352
|
+
* serverInfo: { name: 'acme', version: '1.0.0' },
|
|
1353
1353
|
* auth: {
|
|
1354
1354
|
* verify: (token) => {
|
|
1355
1355
|
* const c = verifyClientJwt(token, process.env.BUILDBASE_CLIENT_SECRET!);
|
|
1356
|
-
*
|
|
1356
|
+
* // Claims beyond RFC 7519 are `unknown` — narrow before use.
|
|
1357
|
+
* return {
|
|
1358
|
+
* sessionId: typeof c.sid === 'string' ? c.sid : '',
|
|
1359
|
+
* userId: c.sub,
|
|
1360
|
+
* scopes: Array.isArray(c.scope)
|
|
1361
|
+
* ? c.scope.filter((s): s is string => typeof s === 'string')
|
|
1362
|
+
* : undefined,
|
|
1363
|
+
* };
|
|
1357
1364
|
* },
|
|
1358
|
-
* resourceMetadataUrl: 'https://
|
|
1365
|
+
* resourceMetadataUrl: 'https://example.com/.well-known/oauth-protected-resource',
|
|
1359
1366
|
* },
|
|
1360
1367
|
* });
|
|
1361
1368
|
*
|
|
@@ -1422,6 +1429,14 @@ interface McpToolContext<TCustom = unknown> {
|
|
|
1422
1429
|
*/
|
|
1423
1430
|
custom: TCustom;
|
|
1424
1431
|
}
|
|
1432
|
+
/** An icon for display in host UIs (SEP-973, protocol 2025-11-25). */
|
|
1433
|
+
interface McpIcon {
|
|
1434
|
+
/** Icon URL (https or data URI). */
|
|
1435
|
+
src: string;
|
|
1436
|
+
mimeType?: string;
|
|
1437
|
+
/** e.g. `['48x48']` or `['any']` for scalable formats. */
|
|
1438
|
+
sizes?: string[];
|
|
1439
|
+
}
|
|
1425
1440
|
/** MCP tool annotations (behavior hints for agents). */
|
|
1426
1441
|
interface McpToolAnnotations {
|
|
1427
1442
|
title?: string;
|
|
@@ -1430,6 +1445,70 @@ interface McpToolAnnotations {
|
|
|
1430
1445
|
idempotentHint?: boolean;
|
|
1431
1446
|
openWorldHint?: boolean;
|
|
1432
1447
|
}
|
|
1448
|
+
/** Plain text block. */
|
|
1449
|
+
interface McpTextContent {
|
|
1450
|
+
type: 'text';
|
|
1451
|
+
text: string;
|
|
1452
|
+
}
|
|
1453
|
+
/** Base64-encoded image (`data` has no data-URI prefix). */
|
|
1454
|
+
interface McpImageContent {
|
|
1455
|
+
type: 'image';
|
|
1456
|
+
data: string;
|
|
1457
|
+
mimeType: string;
|
|
1458
|
+
}
|
|
1459
|
+
/** Base64-encoded audio (`data` has no data-URI prefix). */
|
|
1460
|
+
interface McpAudioContent {
|
|
1461
|
+
type: 'audio';
|
|
1462
|
+
data: string;
|
|
1463
|
+
mimeType: string;
|
|
1464
|
+
}
|
|
1465
|
+
/** Link to a resource the client may fetch — the content itself is not embedded. */
|
|
1466
|
+
interface McpResourceLinkContent {
|
|
1467
|
+
type: 'resource_link';
|
|
1468
|
+
uri: string;
|
|
1469
|
+
name: string;
|
|
1470
|
+
title?: string;
|
|
1471
|
+
description?: string;
|
|
1472
|
+
mimeType?: string;
|
|
1473
|
+
size?: number;
|
|
1474
|
+
}
|
|
1475
|
+
/** Resource contents embedded directly in the result (text or base64 blob). */
|
|
1476
|
+
interface McpEmbeddedResourceContent {
|
|
1477
|
+
type: 'resource';
|
|
1478
|
+
resource: {
|
|
1479
|
+
uri: string;
|
|
1480
|
+
mimeType?: string;
|
|
1481
|
+
title?: string;
|
|
1482
|
+
} & ({
|
|
1483
|
+
text: string;
|
|
1484
|
+
} | {
|
|
1485
|
+
blob: string;
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
/** Any content block a tool result may carry. */
|
|
1489
|
+
type McpContentBlock = McpTextContent | McpImageContent | McpAudioContent | McpResourceLinkContent | McpEmbeddedResourceContent;
|
|
1490
|
+
/**
|
|
1491
|
+
* Full wire-shaped tool result. Return this from `execute` to control the
|
|
1492
|
+
* result exactly — mixed content blocks (text + images + resource links),
|
|
1493
|
+
* `structuredContent`, and the `isError` flag. Any other return value keeps
|
|
1494
|
+
* the legacy behavior: strings become one text block, objects become
|
|
1495
|
+
* JSON text + `structuredContent`.
|
|
1496
|
+
*/
|
|
1497
|
+
interface McpToolResult {
|
|
1498
|
+
content: McpContentBlock[];
|
|
1499
|
+
structuredContent?: Record<string, unknown>;
|
|
1500
|
+
isError?: boolean;
|
|
1501
|
+
}
|
|
1502
|
+
/** Text content block (`mcpText('done')`). */
|
|
1503
|
+
declare const mcpText: (text: string) => McpTextContent;
|
|
1504
|
+
/** Image content block from base64 data (`mcpImage(pngBase64, 'image/png')`). */
|
|
1505
|
+
declare const mcpImage: (data: string, mimeType: string) => McpImageContent;
|
|
1506
|
+
/** Audio content block from base64 data (`mcpAudio(wavBase64, 'audio/wav')`). */
|
|
1507
|
+
declare const mcpAudio: (data: string, mimeType: string) => McpAudioContent;
|
|
1508
|
+
/** Resource-link content block (`mcpResourceLink('https://…/report.pdf', 'report')`). */
|
|
1509
|
+
declare const mcpResourceLink: (uri: string, name: string, extra?: Omit<McpResourceLinkContent, "type" | "uri" | "name">) => McpResourceLinkContent;
|
|
1510
|
+
/** Embedded-resource content block (`mcpEmbeddedResource({ uri, text })`). */
|
|
1511
|
+
declare const mcpEmbeddedResource: (resource: McpEmbeddedResourceContent["resource"]) => McpEmbeddedResourceContent;
|
|
1433
1512
|
/** A tool exposed over MCP. Use {@link defineMcpTool} for inferred input types. */
|
|
1434
1513
|
interface McpToolDefinition<S extends z.ZodType = z.ZodType, TCustom = any> {
|
|
1435
1514
|
/** Tool name: `[a-zA-Z0-9_-]`, 1–128 chars. */
|
|
@@ -1441,6 +1520,8 @@ interface McpToolDefinition<S extends z.ZodType = z.ZodType, TCustom = any> {
|
|
|
1441
1520
|
*/
|
|
1442
1521
|
inputSchema: S | Record<string, unknown>;
|
|
1443
1522
|
annotations?: McpToolAnnotations;
|
|
1523
|
+
/** Optional icons for host UIs (protocol 2025-11-25). */
|
|
1524
|
+
icons?: McpIcon[];
|
|
1444
1525
|
/**
|
|
1445
1526
|
* Scopes required to see/call this tool. The token must carry ALL of them
|
|
1446
1527
|
* (`McpAuthInfo.scopes`) for the tool to be visible or callable; a token
|
|
@@ -1448,8 +1529,98 @@ interface McpToolDefinition<S extends z.ZodType = z.ZodType, TCustom = any> {
|
|
|
1448
1529
|
* no scopes and are governed by `builtinTools` + the user's own permissions.
|
|
1449
1530
|
*/
|
|
1450
1531
|
requiredScopes?: string[];
|
|
1532
|
+
/**
|
|
1533
|
+
* Runs the tool. Return an {@link McpToolResult} for full control over the
|
|
1534
|
+
* wire result (images, resource links, mixed blocks); any other value is
|
|
1535
|
+
* auto-wrapped (string → text block; object → JSON text + structuredContent).
|
|
1536
|
+
*/
|
|
1451
1537
|
execute: (input: z.output<S>, ctx: McpToolContext<TCustom>) => unknown | Promise<unknown>;
|
|
1452
1538
|
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Existential tool type for heterogeneous lists (registries, config arrays).
|
|
1541
|
+
* Each tool keeps its precise schema/context types at its definition site
|
|
1542
|
+
* (use {@link defineMcpTool}); `any` here only erases them for storage —
|
|
1543
|
+
* never use it to define a tool.
|
|
1544
|
+
*/
|
|
1545
|
+
type AnyMcpTool = McpToolDefinition<any, any>;
|
|
1546
|
+
/**
|
|
1547
|
+
* What a resource `read` may return. Strings become text contents, plain
|
|
1548
|
+
* objects become pretty-printed JSON (`application/json`), and an explicit
|
|
1549
|
+
* `{ text }` or `{ blob }` shape is used as-is (blob = base64).
|
|
1550
|
+
*/
|
|
1551
|
+
type McpResourceReadResult = string | {
|
|
1552
|
+
text: string;
|
|
1553
|
+
mimeType?: string;
|
|
1554
|
+
} | {
|
|
1555
|
+
blob: string;
|
|
1556
|
+
mimeType?: string;
|
|
1557
|
+
} | object;
|
|
1558
|
+
/** A fixed-URI resource served via `resources/list` + `resources/read`. */
|
|
1559
|
+
interface McpResourceDefinition<TCustom = any> {
|
|
1560
|
+
/** Unique resource URI (custom schemes welcome, e.g. `app://orders`). */
|
|
1561
|
+
uri: string;
|
|
1562
|
+
name: string;
|
|
1563
|
+
title?: string;
|
|
1564
|
+
description?: string;
|
|
1565
|
+
mimeType?: string;
|
|
1566
|
+
icons?: McpIcon[];
|
|
1567
|
+
/** Same gating semantics as tools: token must carry ALL listed scopes. */
|
|
1568
|
+
requiredScopes?: string[];
|
|
1569
|
+
read: (ctx: McpToolContext<TCustom>) => McpResourceReadResult | Promise<McpResourceReadResult>;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* A parameterized resource (RFC 6570 level-1 `{var}` templates only), served
|
|
1573
|
+
* via `resources/templates/list` and matched on `resources/read`.
|
|
1574
|
+
*/
|
|
1575
|
+
interface McpResourceTemplateDefinition<TCustom = any> {
|
|
1576
|
+
/** e.g. `buildbase://workspace/{workspaceId}` — `{var}` matches one segment. */
|
|
1577
|
+
uriTemplate: string;
|
|
1578
|
+
name: string;
|
|
1579
|
+
title?: string;
|
|
1580
|
+
description?: string;
|
|
1581
|
+
mimeType?: string;
|
|
1582
|
+
icons?: McpIcon[];
|
|
1583
|
+
requiredScopes?: string[];
|
|
1584
|
+
read: (params: Record<string, string>, uri: string, ctx: McpToolContext<TCustom>) => McpResourceReadResult | Promise<McpResourceReadResult>;
|
|
1585
|
+
}
|
|
1586
|
+
/** Message content allowed in prompts (spec: text, image, audio, embedded resource). */
|
|
1587
|
+
type McpPromptContent = McpTextContent | McpImageContent | McpAudioContent | McpEmbeddedResourceContent;
|
|
1588
|
+
/** One message of a prompt template. */
|
|
1589
|
+
interface McpPromptMessage {
|
|
1590
|
+
role: 'user' | 'assistant';
|
|
1591
|
+
content: McpPromptContent;
|
|
1592
|
+
}
|
|
1593
|
+
/** A prompt template served via `prompts/list` + `prompts/get`. */
|
|
1594
|
+
interface McpPromptDefinition<TCustom = any> {
|
|
1595
|
+
/** Unique prompt name (same charset rules as tool names). */
|
|
1596
|
+
name: string;
|
|
1597
|
+
title?: string;
|
|
1598
|
+
description?: string;
|
|
1599
|
+
icons?: McpIcon[];
|
|
1600
|
+
arguments?: Array<{
|
|
1601
|
+
name: string;
|
|
1602
|
+
description?: string;
|
|
1603
|
+
required?: boolean;
|
|
1604
|
+
}>;
|
|
1605
|
+
requiredScopes?: string[];
|
|
1606
|
+
/**
|
|
1607
|
+
* Build the messages. A plain string return becomes one user text message;
|
|
1608
|
+
* an array is used as the messages; the object form also sets `description`.
|
|
1609
|
+
*/
|
|
1610
|
+
get: (args: Record<string, string>, ctx: McpToolContext<TCustom>) => string | McpPromptMessage[] | {
|
|
1611
|
+
description?: string;
|
|
1612
|
+
messages: McpPromptMessage[];
|
|
1613
|
+
} | Promise<string | McpPromptMessage[] | {
|
|
1614
|
+
description?: string;
|
|
1615
|
+
messages: McpPromptMessage[];
|
|
1616
|
+
}>;
|
|
1617
|
+
}
|
|
1618
|
+
/** Identity helper for inferred types (mirror of {@link defineMcpTool}). */
|
|
1619
|
+
declare const defineMcpResource: <TCustom = any>(resource: McpResourceDefinition<TCustom>) => McpResourceDefinition<TCustom>;
|
|
1620
|
+
/** Identity helper for inferred types (mirror of {@link defineMcpTool}). */
|
|
1621
|
+
declare const defineMcpResourceTemplate: <TCustom = any>(template: McpResourceTemplateDefinition<TCustom>) => McpResourceTemplateDefinition<TCustom>;
|
|
1622
|
+
/** Identity helper for inferred types (mirror of {@link defineMcpTool}). */
|
|
1623
|
+
declare const defineMcpPrompt: <TCustom = any>(prompt: McpPromptDefinition<TCustom>) => McpPromptDefinition<TCustom>;
|
|
1453
1624
|
/** Configuration for {@link createMcpHandler}. */
|
|
1454
1625
|
interface CreateMcpHandlerConfig {
|
|
1455
1626
|
/**
|
|
@@ -1486,7 +1657,28 @@ interface CreateMcpHandlerConfig {
|
|
|
1486
1657
|
* built-in (your definition wins); duplicate custom names or invalid names
|
|
1487
1658
|
* throw at create time.
|
|
1488
1659
|
*/
|
|
1489
|
-
tools?:
|
|
1660
|
+
tools?: AnyMcpTool[];
|
|
1661
|
+
/**
|
|
1662
|
+
* App-defined resources (`resources/list` + `resources/read`). The
|
|
1663
|
+
* `resources` capability is advertised only when at least one resource,
|
|
1664
|
+
* template, or `builtinResources` is configured.
|
|
1665
|
+
*/
|
|
1666
|
+
resources?: McpResourceDefinition[];
|
|
1667
|
+
/** App-defined parameterized resources (`resources/templates/list`). */
|
|
1668
|
+
resourceTemplates?: McpResourceTemplateDefinition[];
|
|
1669
|
+
/**
|
|
1670
|
+
* Built-in BuildBase context resources (opt-in; requires `buildbase`):
|
|
1671
|
+
* `buildbase://profile`, `buildbase://workspaces`, and the
|
|
1672
|
+
* `buildbase://workspace/{workspaceId}` template — read-only context a host
|
|
1673
|
+
* can load without spending tool calls. Richer data (subscription, usage,
|
|
1674
|
+
* credits) stays tools-only.
|
|
1675
|
+
*/
|
|
1676
|
+
builtinResources?: boolean;
|
|
1677
|
+
/**
|
|
1678
|
+
* App-defined prompt templates (`prompts/list` + `prompts/get`). The
|
|
1679
|
+
* `prompts` capability is advertised only when at least one is configured.
|
|
1680
|
+
*/
|
|
1681
|
+
prompts?: McpPromptDefinition[];
|
|
1490
1682
|
/**
|
|
1491
1683
|
* Which built-in BuildBase tools to expose. **Defaults to `'readonly'`**
|
|
1492
1684
|
* when a `buildbase` client is configured (`false` otherwise) — reads only,
|
|
@@ -1661,6 +1853,24 @@ interface AppTokenRequestClaims {
|
|
|
1661
1853
|
sessionId?: string;
|
|
1662
1854
|
[claim: string]: unknown;
|
|
1663
1855
|
}
|
|
1856
|
+
/**
|
|
1857
|
+
* A verified JWT payload: registered claims (RFC 7519) are typed AND
|
|
1858
|
+
* runtime-validated by {@link verifyClientJwt} (a signed token whose `sub` is
|
|
1859
|
+
* a number is rejected, so the types here are real guarantees). Every other
|
|
1860
|
+
* claim is `unknown` — custom claims are attacker-influenced input until you
|
|
1861
|
+
* narrow them (`typeof payload.sid === 'string'`), even after the signature
|
|
1862
|
+
* checks out.
|
|
1863
|
+
*/
|
|
1864
|
+
interface VerifiedJwtPayload {
|
|
1865
|
+
iss?: string;
|
|
1866
|
+
sub?: string;
|
|
1867
|
+
aud?: string | string[];
|
|
1868
|
+
exp?: number;
|
|
1869
|
+
nbf?: number;
|
|
1870
|
+
iat?: number;
|
|
1871
|
+
jti?: string;
|
|
1872
|
+
[claim: string]: unknown;
|
|
1873
|
+
}
|
|
1664
1874
|
/** Options for {@link verifyClientJwt} (all optional; secure defaults). */
|
|
1665
1875
|
interface VerifyClientJwtOptions {
|
|
1666
1876
|
/** Allowed clock skew in seconds for `exp`/`nbf`. Default 60. */
|
|
@@ -1682,7 +1892,7 @@ interface VerifyClientJwtOptions {
|
|
|
1682
1892
|
* and — by default — that an `exp` is present at all. Optionally pins `iss`/`aud`.
|
|
1683
1893
|
* Throws {@link AppBridgeError} on any failure.
|
|
1684
1894
|
*/
|
|
1685
|
-
declare function verifyClientJwt(token: string, clientSecret: string, options?: VerifyClientJwtOptions):
|
|
1895
|
+
declare function verifyClientJwt(token: string, clientSecret: string, options?: VerifyClientJwtOptions): VerifiedJwtPayload;
|
|
1686
1896
|
/** Extract the token from an `Authorization: Bearer <token>` header. */
|
|
1687
1897
|
declare function extractBearerToken(authorization: string | null | undefined): string | null;
|
|
1688
1898
|
/**
|
|
@@ -1782,7 +1992,7 @@ interface AgentStackConfig {
|
|
|
1782
1992
|
version: string;
|
|
1783
1993
|
};
|
|
1784
1994
|
/** Your custom tools. */
|
|
1785
|
-
tools?:
|
|
1995
|
+
tools?: AnyMcpTool[];
|
|
1786
1996
|
/** Built-in tool selection. Default `'readonly'`. */
|
|
1787
1997
|
builtinTools?: CreateMcpHandlerConfig['builtinTools'];
|
|
1788
1998
|
/** Scopes advertised on the protected-resource metadata. */
|
|
@@ -1952,5 +2162,5 @@ declare function buildbaseAuth(options: BuildBaseAuthOptions): {
|
|
|
1952
2162
|
resourceMetadataUrl?: string;
|
|
1953
2163
|
};
|
|
1954
2164
|
|
|
1955
|
-
export { AppBridgeError, bearerChallenge, buildbaseAuth, builtinMcpTools, createAgentStack, createMcpHandler, createSessionRefCrypto, defineMcpTool, extractBearerToken, mintAgentToken, selectBuiltinTools, signClientJwt, verifyClientJwt };
|
|
1956
|
-
export type { AgentStack, AgentStackConfig, BuildBaseAuthOptions, BuiltinMcpToolName, CreateMcpHandlerConfig, McpAuthInfo, McpBuildBaseClient, McpHandler, McpHttpRequest, McpHttpResponse, McpServerCard, McpToolAnnotations, McpToolContext, McpToolDefinition, MintAgentTokenOptions, ScopedActions, SessionRefCrypto };
|
|
2165
|
+
export { AppBridgeError, bearerChallenge, buildbaseAuth, builtinMcpTools, createAgentStack, createMcpHandler, createSessionRefCrypto, defineMcpPrompt, defineMcpResource, defineMcpResourceTemplate, defineMcpTool, extractBearerToken, mcpAudio, mcpEmbeddedResource, mcpImage, mcpResourceLink, mcpText, mintAgentToken, selectBuiltinTools, signClientJwt, verifyClientJwt };
|
|
2166
|
+
export type { AgentStack, AgentStackConfig, AnyMcpTool, BuildBaseAuthOptions, BuiltinMcpToolName, CreateMcpHandlerConfig, McpAudioContent, McpAuthInfo, McpBuildBaseClient, McpContentBlock, McpEmbeddedResourceContent, McpHandler, McpHttpRequest, McpHttpResponse, McpIcon, McpImageContent, McpPromptContent, McpPromptDefinition, McpPromptMessage, McpResourceDefinition, McpResourceLinkContent, McpResourceReadResult, McpResourceTemplateDefinition, McpServerCard, McpTextContent, McpToolAnnotations, McpToolContext, McpToolDefinition, McpToolResult, MintAgentTokenOptions, ScopedActions, SessionRefCrypto, VerifiedJwtPayload };
|