@absolutejs/mcp 0.12.0 → 0.14.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/dist/manifest.js CHANGED
@@ -63,22 +63,22 @@ var TypeSystemPolicy;
63
63
  // node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
64
64
  var exports_value = {};
65
65
  __export(exports_value, {
66
- IsUndefined: () => IsUndefined2,
67
- IsUint8Array: () => IsUint8Array,
68
- IsSymbol: () => IsSymbol,
69
- IsString: () => IsString,
70
- IsRegExp: () => IsRegExp,
71
- IsObject: () => IsObject2,
72
- IsNumber: () => IsNumber2,
73
- IsNull: () => IsNull,
74
- IsIterator: () => IsIterator,
75
- IsFunction: () => IsFunction,
76
- IsDate: () => IsDate,
77
- IsBoolean: () => IsBoolean,
78
- IsBigInt: () => IsBigInt,
79
- IsAsyncIterator: () => IsAsyncIterator,
66
+ HasPropertyKey: () => HasPropertyKey,
80
67
  IsArray: () => IsArray2,
81
- HasPropertyKey: () => HasPropertyKey
68
+ IsAsyncIterator: () => IsAsyncIterator,
69
+ IsBigInt: () => IsBigInt,
70
+ IsBoolean: () => IsBoolean,
71
+ IsDate: () => IsDate,
72
+ IsFunction: () => IsFunction,
73
+ IsIterator: () => IsIterator,
74
+ IsNull: () => IsNull,
75
+ IsNumber: () => IsNumber2,
76
+ IsObject: () => IsObject2,
77
+ IsRegExp: () => IsRegExp,
78
+ IsString: () => IsString,
79
+ IsSymbol: () => IsSymbol,
80
+ IsUint8Array: () => IsUint8Array,
81
+ IsUndefined: () => IsUndefined2
82
82
  });
83
83
  function HasPropertyKey(value, key) {
84
84
  return key in value;
@@ -1097,57 +1097,57 @@ function Unknown(options) {
1097
1097
  // node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
1098
1098
  var exports_type = {};
1099
1099
  __export(exports_type, {
1100
- TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError,
1101
- IsVoid: () => IsVoid2,
1102
- IsUnsafe: () => IsUnsafe2,
1103
- IsUnknown: () => IsUnknown2,
1104
- IsUnionLiteral: () => IsUnionLiteral,
1105
- IsUnion: () => IsUnion2,
1106
- IsUndefined: () => IsUndefined4,
1107
- IsUint8Array: () => IsUint8Array3,
1108
- IsTuple: () => IsTuple2,
1109
- IsTransform: () => IsTransform2,
1110
- IsThis: () => IsThis2,
1111
- IsTemplateLiteral: () => IsTemplateLiteral2,
1112
- IsSymbol: () => IsSymbol3,
1113
- IsString: () => IsString3,
1114
- IsSchema: () => IsSchema2,
1115
- IsRegExp: () => IsRegExp3,
1116
- IsRef: () => IsRef2,
1117
- IsRecursive: () => IsRecursive,
1118
- IsRecord: () => IsRecord2,
1119
- IsReadonly: () => IsReadonly2,
1120
- IsProperties: () => IsProperties,
1121
- IsPromise: () => IsPromise2,
1122
- IsOptional: () => IsOptional2,
1123
- IsObject: () => IsObject4,
1124
- IsNumber: () => IsNumber4,
1125
- IsNull: () => IsNull3,
1126
- IsNot: () => IsNot2,
1127
- IsNever: () => IsNever2,
1128
- IsMappedResult: () => IsMappedResult2,
1129
- IsMappedKey: () => IsMappedKey2,
1130
- IsLiteralValue: () => IsLiteralValue2,
1131
- IsLiteralString: () => IsLiteralString,
1132
- IsLiteralNumber: () => IsLiteralNumber,
1133
- IsLiteralBoolean: () => IsLiteralBoolean,
1134
- IsLiteral: () => IsLiteral2,
1135
- IsKindOf: () => IsKindOf2,
1136
- IsKind: () => IsKind2,
1137
- IsIterator: () => IsIterator3,
1138
- IsIntersect: () => IsIntersect2,
1139
- IsInteger: () => IsInteger2,
1140
- IsImport: () => IsImport,
1141
- IsFunction: () => IsFunction3,
1142
- IsDate: () => IsDate3,
1143
- IsConstructor: () => IsConstructor2,
1144
- IsComputed: () => IsComputed2,
1145
- IsBoolean: () => IsBoolean3,
1146
- IsBigInt: () => IsBigInt3,
1147
- IsAsyncIterator: () => IsAsyncIterator3,
1148
- IsArray: () => IsArray4,
1100
+ IsAny: () => IsAny2,
1149
1101
  IsArgument: () => IsArgument2,
1150
- IsAny: () => IsAny2
1102
+ IsArray: () => IsArray4,
1103
+ IsAsyncIterator: () => IsAsyncIterator3,
1104
+ IsBigInt: () => IsBigInt3,
1105
+ IsBoolean: () => IsBoolean3,
1106
+ IsComputed: () => IsComputed2,
1107
+ IsConstructor: () => IsConstructor2,
1108
+ IsDate: () => IsDate3,
1109
+ IsFunction: () => IsFunction3,
1110
+ IsImport: () => IsImport,
1111
+ IsInteger: () => IsInteger2,
1112
+ IsIntersect: () => IsIntersect2,
1113
+ IsIterator: () => IsIterator3,
1114
+ IsKind: () => IsKind2,
1115
+ IsKindOf: () => IsKindOf2,
1116
+ IsLiteral: () => IsLiteral2,
1117
+ IsLiteralBoolean: () => IsLiteralBoolean,
1118
+ IsLiteralNumber: () => IsLiteralNumber,
1119
+ IsLiteralString: () => IsLiteralString,
1120
+ IsLiteralValue: () => IsLiteralValue2,
1121
+ IsMappedKey: () => IsMappedKey2,
1122
+ IsMappedResult: () => IsMappedResult2,
1123
+ IsNever: () => IsNever2,
1124
+ IsNot: () => IsNot2,
1125
+ IsNull: () => IsNull3,
1126
+ IsNumber: () => IsNumber4,
1127
+ IsObject: () => IsObject4,
1128
+ IsOptional: () => IsOptional2,
1129
+ IsPromise: () => IsPromise2,
1130
+ IsProperties: () => IsProperties,
1131
+ IsReadonly: () => IsReadonly2,
1132
+ IsRecord: () => IsRecord2,
1133
+ IsRecursive: () => IsRecursive,
1134
+ IsRef: () => IsRef2,
1135
+ IsRegExp: () => IsRegExp3,
1136
+ IsSchema: () => IsSchema2,
1137
+ IsString: () => IsString3,
1138
+ IsSymbol: () => IsSymbol3,
1139
+ IsTemplateLiteral: () => IsTemplateLiteral2,
1140
+ IsThis: () => IsThis2,
1141
+ IsTransform: () => IsTransform2,
1142
+ IsTuple: () => IsTuple2,
1143
+ IsUint8Array: () => IsUint8Array3,
1144
+ IsUndefined: () => IsUndefined4,
1145
+ IsUnion: () => IsUnion2,
1146
+ IsUnionLiteral: () => IsUnionLiteral,
1147
+ IsUnknown: () => IsUnknown2,
1148
+ IsUnsafe: () => IsUnsafe2,
1149
+ IsVoid: () => IsVoid2,
1150
+ TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
1151
1151
  });
1152
1152
  class TypeGuardUnknownTypeError extends TypeBoxError {
1153
1153
  }
@@ -2498,68 +2498,68 @@ function Void(options) {
2498
2498
  // node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
2499
2499
  var exports_type2 = {};
2500
2500
  __export(exports_type2, {
2501
- Void: () => Void,
2502
- Uppercase: () => Uppercase,
2503
- Unsafe: () => Unsafe,
2504
- Unknown: () => Unknown,
2505
- Union: () => Union,
2506
- Undefined: () => Undefined,
2507
- Uncapitalize: () => Uncapitalize,
2508
- Uint8Array: () => Uint8Array2,
2509
- Tuple: () => Tuple,
2510
- Transform: () => Transform,
2511
- TemplateLiteral: () => TemplateLiteral,
2512
- Symbol: () => Symbol2,
2513
- String: () => String2,
2514
- ReturnType: () => ReturnType,
2515
- Rest: () => Rest,
2516
- Required: () => Required,
2517
- RegExp: () => RegExp2,
2518
- Ref: () => Ref,
2519
- Recursive: () => Recursive,
2520
- Record: () => Record,
2521
- ReadonlyOptional: () => ReadonlyOptional,
2522
- Readonly: () => Readonly,
2523
- Promise: () => Promise2,
2524
- Pick: () => Pick,
2525
- Partial: () => Partial,
2526
- Parameters: () => Parameters,
2527
- Optional: () => Optional,
2528
- Omit: () => Omit,
2529
- Object: () => Object2,
2530
- Number: () => Number2,
2531
- Null: () => Null,
2532
- Not: () => Not,
2533
- Never: () => Never,
2534
- Module: () => Module,
2535
- Mapped: () => Mapped,
2536
- Lowercase: () => Lowercase,
2537
- Literal: () => Literal,
2538
- KeyOf: () => KeyOf,
2539
- Iterator: () => Iterator,
2540
- Intersect: () => Intersect,
2541
- Integer: () => Integer,
2542
- Instantiate: () => Instantiate,
2543
- InstanceType: () => InstanceType,
2544
- Index: () => Index,
2545
- Function: () => Function,
2546
- Extract: () => Extract,
2547
- Extends: () => Extends,
2548
- Exclude: () => Exclude,
2549
- Enum: () => Enum,
2550
- Date: () => Date2,
2551
- ConstructorParameters: () => ConstructorParameters,
2552
- Constructor: () => Constructor,
2553
- Const: () => Const,
2554
- Composite: () => Composite,
2555
- Capitalize: () => Capitalize,
2556
- Boolean: () => Boolean2,
2557
- BigInt: () => BigInt,
2558
- Awaited: () => Awaited,
2559
- AsyncIterator: () => AsyncIterator,
2560
- Array: () => Array2,
2501
+ Any: () => Any,
2561
2502
  Argument: () => Argument,
2562
- Any: () => Any
2503
+ Array: () => Array2,
2504
+ AsyncIterator: () => AsyncIterator,
2505
+ Awaited: () => Awaited,
2506
+ BigInt: () => BigInt,
2507
+ Boolean: () => Boolean2,
2508
+ Capitalize: () => Capitalize,
2509
+ Composite: () => Composite,
2510
+ Const: () => Const,
2511
+ Constructor: () => Constructor,
2512
+ ConstructorParameters: () => ConstructorParameters,
2513
+ Date: () => Date2,
2514
+ Enum: () => Enum,
2515
+ Exclude: () => Exclude,
2516
+ Extends: () => Extends,
2517
+ Extract: () => Extract,
2518
+ Function: () => Function,
2519
+ Index: () => Index,
2520
+ InstanceType: () => InstanceType,
2521
+ Instantiate: () => Instantiate,
2522
+ Integer: () => Integer,
2523
+ Intersect: () => Intersect,
2524
+ Iterator: () => Iterator,
2525
+ KeyOf: () => KeyOf,
2526
+ Literal: () => Literal,
2527
+ Lowercase: () => Lowercase,
2528
+ Mapped: () => Mapped,
2529
+ Module: () => Module,
2530
+ Never: () => Never,
2531
+ Not: () => Not,
2532
+ Null: () => Null,
2533
+ Number: () => Number2,
2534
+ Object: () => Object2,
2535
+ Omit: () => Omit,
2536
+ Optional: () => Optional,
2537
+ Parameters: () => Parameters,
2538
+ Partial: () => Partial,
2539
+ Pick: () => Pick,
2540
+ Promise: () => Promise2,
2541
+ Readonly: () => Readonly,
2542
+ ReadonlyOptional: () => ReadonlyOptional,
2543
+ Record: () => Record,
2544
+ Recursive: () => Recursive,
2545
+ Ref: () => Ref,
2546
+ RegExp: () => RegExp2,
2547
+ Required: () => Required,
2548
+ Rest: () => Rest,
2549
+ ReturnType: () => ReturnType,
2550
+ String: () => String2,
2551
+ Symbol: () => Symbol2,
2552
+ TemplateLiteral: () => TemplateLiteral,
2553
+ Transform: () => Transform,
2554
+ Tuple: () => Tuple,
2555
+ Uint8Array: () => Uint8Array2,
2556
+ Uncapitalize: () => Uncapitalize,
2557
+ Undefined: () => Undefined,
2558
+ Union: () => Union,
2559
+ Unknown: () => Unknown,
2560
+ Unsafe: () => Unsafe,
2561
+ Uppercase: () => Uppercase,
2562
+ Void: () => Void
2563
2563
  });
2564
2564
 
2565
2565
  // node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
@@ -2861,9 +2861,7 @@ var manifest = defineManifest()({
2861
2861
  tagline: "Let AI assistants connect to your site and use its tools."
2862
2862
  },
2863
2863
  requires: {
2864
- peers: [
2865
- { name: "elysia", range: "^2.0.0-beta.6", reason: "plugin host" }
2866
- ]
2864
+ peers: [{ name: "elysia", range: "^2.0.0-beta.6", reason: "plugin host" }]
2867
2865
  },
2868
2866
  settings: Type.Object({
2869
2867
  instructions: Type.Optional(Type.String({
@@ -0,0 +1,13 @@
1
+ import type { McpTool, McpToolReturn } from "./types";
2
+ export type McpCreditWorkRequest = {
3
+ requestId: string;
4
+ maxCredits: number;
5
+ input: unknown;
6
+ };
7
+ /** Wrap a synchronous tool with an explicit per-work credit budget. The executor
8
+ * must bind the caller, claim durable work, track usage, and persist its result.
9
+ * Do not wrap deferred jobs without transferring their budget to the worker. */
10
+ export declare const budgetedMcpTool: (options: {
11
+ tool: McpTool;
12
+ execute: (request: McpCreditWorkRequest, run: () => Promise<McpToolReturn>) => Promise<McpToolReturn>;
13
+ }) => McpTool;
@@ -0,0 +1,50 @@
1
+ /** Host commerce eligibility, not payment authorization. All inputs are
2
+ * server-owned; never derive a permissive profile from clientInfo alone. */
3
+ export declare const COMMERCE_POLICY_VERSION = "2026-09-10.1";
4
+ export declare const COMMERCE_POLICY_SOURCES: Readonly<{
5
+ claude: "https://support.claude.com/en/articles/13454812-use-interactive-connectors-in-claude";
6
+ chatgpt: "https://developers.openai.com/plugins/app-guidelines#commerce-and-monetization";
7
+ chatgptCheckout: "https://developers.openai.com/plugins/build/monetization";
8
+ cursorMarketplace: "https://cursor.com/marketplace-publisher-terms";
9
+ }>;
10
+ export type CommerceAction = "entitlement_status" | "informational_link" | "paid_access" | "pricing" | "external_checkout" | "saved_method_purchase" | "new_method_collection" | "subscription" | "automatic_refill";
11
+ export type CommerceCategory = "physical_goods" | "digital_service" | "usage_credits" | "subscription";
12
+ export type CommerceProfile = "claude-interactive" | "chatgpt-plugin" | "cursor-marketplace" | "direct-mcp" | "self-hosted" | "unknown";
13
+ export type CommerceRequirement = {
14
+ action: CommerceAction;
15
+ /** All product categories this tool can expose, including every cart line.
16
+ * Dynamic catalogs must be classified by the server before registration. */
17
+ categories: readonly CommerceCategory[];
18
+ };
19
+ export type CommerceReview = {
20
+ id: string;
21
+ profile: CommerceProfile;
22
+ actions: readonly CommerceAction[];
23
+ categories: readonly CommerceCategory[];
24
+ reviewedAt: string;
25
+ expiresAt: string;
26
+ sourceUrls: readonly string[];
27
+ };
28
+ export type CommerceContext = {
29
+ /** Ambiguous channels are evaluated as the intersection of their rules. */
30
+ profiles: readonly CommerceProfile[];
31
+ reviews?: readonly CommerceReview[];
32
+ /** Reviewed and tested capabilities; these do not establish permission. */
33
+ capabilities?: {
34
+ externalLinks?: boolean;
35
+ interactiveUi?: boolean;
36
+ nativePaymentSheet?: boolean;
37
+ };
38
+ };
39
+ export type CommerceDecision = {
40
+ allowed: boolean;
41
+ status: "permitted" | "restricted" | "unverified";
42
+ reason: string;
43
+ policyVersion: string;
44
+ sourceUrls: string[];
45
+ reviewIds: string[];
46
+ };
47
+ /** Published restrictions cannot be overridden by a deployment review.
48
+ * Unverified paths need explicit, fresh server-side review evidence. */
49
+ export declare const evaluateCommerce: (req: CommerceRequirement, context: CommerceContext, now?: Date) => CommerceDecision;
50
+ export { createCreditBalanceTool, type McpCreditBalance } from "./creditStatus";
@@ -0,0 +1,13 @@
1
+ import type { McpTool } from "./types";
2
+ /** Service credits, not currency or the host model's token usage. */
3
+ export type McpCreditBalance = {
4
+ allowance: number;
5
+ consumed: number;
6
+ remaining: number;
7
+ periodEnd: string | null;
8
+ };
9
+ /** Account identity belongs in the bound reader, never model input. Keep this
10
+ * tool outside paid-work balance gates so exhausted users can recover. */
11
+ export declare const createCreditBalanceTool: (options: {
12
+ read: () => McpCreditBalance | Promise<McpCreditBalance>;
13
+ }) => McpTool;
@@ -42,3 +42,6 @@ export { createSessionRegistry, type SessionRegistry } from "./sessions";
42
42
  export { createMemoryMcpTaskStore, publicMcpTask } from "./tasks";
43
43
  export { createPostgresMcpSessionStore, createPostgresMcpTaskStore, mcpPostgresSchemaSql, type McpSqlClient, type McpSqlResult, } from "./postgres";
44
44
  export type { McpAgencyOptions, McpAudioContent, McpElicitAnswer, McpElicitationRequest, McpElicitBus, McpElicitResult, McpFormElicitationRequest, McpSessionStore, McpAuthResult, McpCallGate, McpCallMeta, McpContent, McpImageContent, McpPromptArgument, McpPromptDefinition, McpPrompts, McpResource, McpResourceLink, McpResources, McpServerConfig, McpServerInfo, McpTextContent, McpTask, McpTaskStatus, McpTaskStore, McpTasksOptions, McpTool, McpToolAnnotations, McpToolCallContext, McpToolContext, McpToolRegistry, McpToolResult, McpToolReturn, McpUrlElicitationRequest, } from "./types";
45
+ export * from "./commerce";
46
+ export { createCreditBalanceTool, type McpCreditBalance } from "./creditStatus";
47
+ export { budgetedMcpTool, type McpCreditWorkRequest } from "./budgetedTool";
@@ -1,3 +1,4 @@
1
+ import type { CommerceContext, CommerceRequirement } from "./commerce";
1
2
  import type { Agency, AgentActor } from "@absolutejs/agency";
2
3
  import type { ToolAuthorization } from "@absolutejs/manifest";
3
4
  /** MCP behaviour hints, passed straight through to the client on `tools/list`.
@@ -122,6 +123,8 @@ export type McpToolCallContext = {
122
123
  };
123
124
  /** One callable tool. `inputSchema` is a JSON Schema object. */
124
125
  export type McpTool = {
126
+ /** Server-owned commerce classification; fails closed without commerce context. */
127
+ commerce?: CommerceRequirement;
125
128
  annotations?: McpToolAnnotations;
126
129
  /** OpenID AuthZEN COAZ opt-in marker. When true, inputSchema MUST carry an
127
130
  * `x-coaz-mapping`; hosts should evaluate it before invoking the handler. */
@@ -265,6 +268,12 @@ export type McpServerInfo = {
265
268
  version: string;
266
269
  };
267
270
  export type McpServerConfig<Caller> = {
271
+ /** Resolve trusted deployment policy afresh for discovery and execution.
272
+ * Does not replace agency approval, ownership, or payment confirmation. */
273
+ commerce?: (context: {
274
+ caller: Caller;
275
+ name: string;
276
+ }) => CommerceContext | Promise<CommerceContext>;
268
277
  /** Per-tool action policy enforcement, approval, leases, and receipts. */
269
278
  agency?: McpAgencyOptions<Caller>;
270
279
  /** Resolve the request into a caller, or a reason for the 401. The package