@nevermined-io/payments 1.8.0 → 1.9.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/README.md +2 -1
- package/dist/mcp/core/auth.d.ts +2 -2
- package/dist/mcp/core/auth.d.ts.map +1 -1
- package/dist/mcp/core/auth.js +29 -18
- package/dist/mcp/core/auth.js.map +1 -1
- package/dist/mcp/core/paywall.d.ts.map +1 -1
- package/dist/mcp/core/paywall.js +10 -6
- package/dist/mcp/core/paywall.js.map +1 -1
- package/dist/mcp/core/server-manager.d.ts.map +1 -1
- package/dist/mcp/core/server-manager.js +6 -4
- package/dist/mcp/core/server-manager.js.map +1 -1
- package/dist/mcp/http/client-registration.d.ts.map +1 -1
- package/dist/mcp/http/client-registration.js +4 -2
- package/dist/mcp/http/client-registration.js.map +1 -1
- package/dist/mcp/http/oauth-metadata.d.ts.map +1 -1
- package/dist/mcp/http/oauth-metadata.js +2 -1
- package/dist/mcp/http/oauth-metadata.js.map +1 -1
- package/dist/mcp/index.d.ts +12 -5
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +46 -23
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types/http.types.d.ts +2 -2
- package/dist/mcp/types/http.types.d.ts.map +1 -1
- package/dist/mcp/types/http.types.js.map +1 -1
- package/dist/mcp/types/paywall.types.d.ts +6 -2
- package/dist/mcp/types/paywall.types.d.ts.map +1 -1
- package/dist/mcp/types/paywall.types.js.map +1 -1
- package/dist/mcp/types/server.types.d.ts +4 -2
- package/dist/mcp/types/server.types.d.ts.map +1 -1
- package/dist/mcp/types/server.types.js.map +1 -1
- package/dist/payments.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ export type PaywallOptions = ToolOptions | ResourceOptions | PromptOptions;
|
|
|
63
63
|
*/
|
|
64
64
|
export interface AuthResult {
|
|
65
65
|
token: string;
|
|
66
|
-
agentId
|
|
66
|
+
agentId?: string;
|
|
67
67
|
logicalUrl: string;
|
|
68
68
|
httpUrl?: string;
|
|
69
69
|
planId: string;
|
|
@@ -84,7 +84,11 @@ export interface PaywallContext {
|
|
|
84
84
|
* MCP integration configuration
|
|
85
85
|
*/
|
|
86
86
|
export interface McpConfig {
|
|
87
|
-
|
|
87
|
+
/** Plan ID the server charges against (required). The facilitator is
|
|
88
|
+
* plan-centric: verify/settle resolve everything from the plan + token. */
|
|
89
|
+
planId: string;
|
|
90
|
+
/** Agent ID — optional, informational/observability only. */
|
|
91
|
+
agentId?: string;
|
|
88
92
|
serverName?: string;
|
|
89
93
|
}
|
|
90
94
|
//# sourceMappingURL=paywall.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paywall.types.d.ts","sourceRoot":"","sources":["../../../src/mcp/types/paywall.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEvE;;GAEG;AACH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,GAAG,CAAA;IACX,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;CACF;AAED;;GAEG;AACH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC,CAAA;AAEtE;;GAEG;AACH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,aAAa,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACn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AAkB;IACrD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,eAAe,GAAG,aAAa,CAAA;AAE1E;;GAEG;AAGH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;+EAC2E;IAC3E,MAAM,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paywall.types.js","sourceRoot":"","sources":["../../../src/mcp/types/paywall.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type definitions for MCP paywall functionality\n */\nimport type { Address, StartAgentRequest } from '../../common/types.js'\n\n/**\n * Context provided to dynamic credits functions\n */\n/**\n * Context provided to dynamic credits functions.\n */\nexport interface CreditsContext {\n args: unknown\n result: any\n request: {\n authHeader: string\n logicalUrl: string\n toolName: string\n }\n}\n\n/**\n * Credits calculation option - can be fixed amount or dynamic function\n */\n/**\n * Credits option: fixed bigint or a function receiving {@link CreditsContext}.\n */\nexport type CreditsOption = bigint | ((ctx: CreditsContext) => bigint)\n\n/**\n * Configuration options for paywall protection\n */\n/**\n * Unified paywall options for tools, resources and prompts.\n */\nexport interface BasePaywallOptions {\n name: string\n credits?: CreditsOption\n onRedeemError?: 'ignore' | 'propagate'\n /**\n * Optional override for the Nevermined plan to charge against.\n * If omitted, the plan is inferred from the X402 access token.\n */\n planId?: string\n /**\n * Maximum amount of credits to verify during authentication.\n * Defaults to 1n if not specified.\n */\n maxAmount?: bigint\n}\n\nexport interface ToolOptions extends BasePaywallOptions {\n kind: 'tool'\n}\n\nexport interface ResourceOptions extends BasePaywallOptions {\n kind: 'resource'\n}\n\nexport interface PromptOptions extends BasePaywallOptions {\n kind: 'prompt'\n}\n\nexport type PaywallOptions = ToolOptions | ResourceOptions | PromptOptions\n\n/**\n * Options for decorating tools with paywall protection\n */\n// decorate* helpers removed\n\n/**\n * Authentication result from paywall validation\n */\nexport interface AuthResult {\n token: string\n agentId
|
|
1
|
+
{"version":3,"file":"paywall.types.js","sourceRoot":"","sources":["../../../src/mcp/types/paywall.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Type definitions for MCP paywall functionality\n */\nimport type { Address, StartAgentRequest } from '../../common/types.js'\n\n/**\n * Context provided to dynamic credits functions\n */\n/**\n * Context provided to dynamic credits functions.\n */\nexport interface CreditsContext {\n args: unknown\n result: any\n request: {\n authHeader: string\n logicalUrl: string\n toolName: string\n }\n}\n\n/**\n * Credits calculation option - can be fixed amount or dynamic function\n */\n/**\n * Credits option: fixed bigint or a function receiving {@link CreditsContext}.\n */\nexport type CreditsOption = bigint | ((ctx: CreditsContext) => bigint)\n\n/**\n * Configuration options for paywall protection\n */\n/**\n * Unified paywall options for tools, resources and prompts.\n */\nexport interface BasePaywallOptions {\n name: string\n credits?: CreditsOption\n onRedeemError?: 'ignore' | 'propagate'\n /**\n * Optional override for the Nevermined plan to charge against.\n * If omitted, the plan is inferred from the X402 access token.\n */\n planId?: string\n /**\n * Maximum amount of credits to verify during authentication.\n * Defaults to 1n if not specified.\n */\n maxAmount?: bigint\n}\n\nexport interface ToolOptions extends BasePaywallOptions {\n kind: 'tool'\n}\n\nexport interface ResourceOptions extends BasePaywallOptions {\n kind: 'resource'\n}\n\nexport interface PromptOptions extends BasePaywallOptions {\n kind: 'prompt'\n}\n\nexport type PaywallOptions = ToolOptions | ResourceOptions | PromptOptions\n\n/**\n * Options for decorating tools with paywall protection\n */\n// decorate* helpers removed\n\n/**\n * Authentication result from paywall validation\n */\nexport interface AuthResult {\n token: string\n agentId?: string\n logicalUrl: string\n httpUrl?: string\n planId: string\n subscriberAddress: Address\n agentRequest?: StartAgentRequest\n}\n\n/**\n * Context provided to paywall-protected handlers\n */\nexport interface PaywallContext {\n authResult: AuthResult\n credits?: bigint\n planId: string\n subscriberAddress: Address\n agentRequest?: StartAgentRequest\n}\n\n/**\n * MCP integration configuration\n */\nexport interface McpConfig {\n /** Plan ID the server charges against (required). The facilitator is\n * plan-centric: verify/settle resolve everything from the plan + token. */\n planId: string\n /** Agent ID — optional, informational/observability only. */\n agentId?: string\n serverName?: string\n}\n"]}
|
|
@@ -100,8 +100,10 @@ export interface PromptContext {
|
|
|
100
100
|
export interface McpServerConfig {
|
|
101
101
|
/** Port to listen on */
|
|
102
102
|
port: number;
|
|
103
|
-
/**
|
|
104
|
-
|
|
103
|
+
/** Plan ID the server charges against (required) */
|
|
104
|
+
planId: string;
|
|
105
|
+
/** Agent ID (DID) for Nevermined — optional, informational only */
|
|
106
|
+
agentId?: string;
|
|
105
107
|
/** Human-readable server name */
|
|
106
108
|
serverName: string;
|
|
107
109
|
/** Base URL of the server (default: http://localhost:\{port\}) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.types.d.ts","sourceRoot":"","sources":["../../../src/mcp/types/server.types.ts"],"names":[],"mapp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,aAAa,CAAA;IACrB,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,sBAAsB,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,iBAAiB,CAAA;IACzB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,sBAAsB,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,aAAa,CAAA;IACtB,OAAO,EAAE,sBAAsB,CAAA;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.types.js","sourceRoot":"","sources":["../../../src/mcp/types/server.types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * Types for the simplified MCP server API.\n * These types define the high-level API that hides McpServer, Transport, and Express details.\n */\n\nimport type { EnvironmentName } from '../../environments.js'\nimport type { CreditsOption } from './paywall.types.js'\nimport type { ZodType } from 'zod'\n/**\n * Configuration for a tool.\n */\nexport interface McpToolConfig {\n /** Human-readable title for the tool */\n title?: string\n /** Description of what the tool does */\n description: string\n /** Zod schema for input arguments (will be converted to JSON Schema internally) */\n inputSchema?: ZodType\n /** JSON Schema for output (optional) */\n outputSchema?: Record<string, any>\n}\n\n/**\n * Configuration for a resource.\n */\nexport interface McpResourceConfig {\n /** Human-readable title for the resource */\n title?: string\n /** Description of the resource */\n description?: string\n /** MIME type of the resource content */\n mimeType?: string\n}\n\n/**\n * Configuration for a prompt.\n */\nexport interface McpPromptConfig {\n /** Human-readable title for the prompt */\n title?: string\n /** Description of the prompt */\n description?: string\n /** Arguments the prompt accepts (ZodRawShape or ZodType) */\n argsSchema?: any\n}\n\n/**\n * Options for tool/resource/prompt registration.\n */\nexport interface McpRegistrationOptions {\n /** Credits to charge per call (default: 1). Can be a fixed value or a function that receives context with args and result. */\n credits?: CreditsOption | number\n /** What to do if credit redemption fails */\n onRedeemError?: 'ignore' | 'propagate'\n}\n\n/**\n * Handler function for a tool.\n */\nexport type ToolHandler<TArgs = any, TResult = any> = (\n args: TArgs,\n context?: ToolContext,\n) => Promise<TResult> | TResult\n\n/**\n * Handler function for a resource.\n */\nexport type ResourceHandler<TResult = any> = (\n uri: URL,\n variables: Record<string, string | string[]>,\n context?: ResourceContext,\n) => Promise<TResult> | TResult\n\n/**\n * Handler function for a prompt.\n */\nexport type PromptHandler<TResult = any> = (\n args: Record<string, string>,\n context?: PromptContext,\n) => Promise<TResult> | TResult\n\n/**\n * Context passed to tool handlers.\n */\nexport interface ToolContext {\n /** Request ID for tracking */\n requestId?: string\n /** Credits available/charged */\n credits?: bigint\n /** Raw MCP extra context */\n extra?: any\n}\n\n/**\n * Context passed to resource handlers.\n */\nexport interface ResourceContext {\n /** Request ID for tracking */\n requestId?: string\n /** Credits available/charged */\n credits?: bigint\n /** Raw MCP extra context */\n extra?: any\n}\n\n/**\n * Context passed to prompt handlers.\n */\nexport interface PromptContext {\n /** Request ID for tracking */\n requestId?: string\n /** Credits available/charged */\n credits?: bigint\n /** Raw MCP extra context */\n extra?: any\n}\n\n/**\n * Configuration for starting the MCP server.\n */\nexport interface McpServerConfig {\n /** Port to listen on */\n port: number\n /** Agent ID (DID) for Nevermined */\n agentId
|
|
1
|
+
{"version":3,"file":"server.types.js","sourceRoot":"","sources":["../../../src/mcp/types/server.types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * Types for the simplified MCP server API.\n * These types define the high-level API that hides McpServer, Transport, and Express details.\n */\n\nimport type { EnvironmentName } from '../../environments.js'\nimport type { CreditsOption } from './paywall.types.js'\nimport type { ZodType } from 'zod'\n/**\n * Configuration for a tool.\n */\nexport interface McpToolConfig {\n /** Human-readable title for the tool */\n title?: string\n /** Description of what the tool does */\n description: string\n /** Zod schema for input arguments (will be converted to JSON Schema internally) */\n inputSchema?: ZodType\n /** JSON Schema for output (optional) */\n outputSchema?: Record<string, any>\n}\n\n/**\n * Configuration for a resource.\n */\nexport interface McpResourceConfig {\n /** Human-readable title for the resource */\n title?: string\n /** Description of the resource */\n description?: string\n /** MIME type of the resource content */\n mimeType?: string\n}\n\n/**\n * Configuration for a prompt.\n */\nexport interface McpPromptConfig {\n /** Human-readable title for the prompt */\n title?: string\n /** Description of the prompt */\n description?: string\n /** Arguments the prompt accepts (ZodRawShape or ZodType) */\n argsSchema?: any\n}\n\n/**\n * Options for tool/resource/prompt registration.\n */\nexport interface McpRegistrationOptions {\n /** Credits to charge per call (default: 1). Can be a fixed value or a function that receives context with args and result. */\n credits?: CreditsOption | number\n /** What to do if credit redemption fails */\n onRedeemError?: 'ignore' | 'propagate'\n}\n\n/**\n * Handler function for a tool.\n */\nexport type ToolHandler<TArgs = any, TResult = any> = (\n args: TArgs,\n context?: ToolContext,\n) => Promise<TResult> | TResult\n\n/**\n * Handler function for a resource.\n */\nexport type ResourceHandler<TResult = any> = (\n uri: URL,\n variables: Record<string, string | string[]>,\n context?: ResourceContext,\n) => Promise<TResult> | TResult\n\n/**\n * Handler function for a prompt.\n */\nexport type PromptHandler<TResult = any> = (\n args: Record<string, string>,\n context?: PromptContext,\n) => Promise<TResult> | TResult\n\n/**\n * Context passed to tool handlers.\n */\nexport interface ToolContext {\n /** Request ID for tracking */\n requestId?: string\n /** Credits available/charged */\n credits?: bigint\n /** Raw MCP extra context */\n extra?: any\n}\n\n/**\n * Context passed to resource handlers.\n */\nexport interface ResourceContext {\n /** Request ID for tracking */\n requestId?: string\n /** Credits available/charged */\n credits?: bigint\n /** Raw MCP extra context */\n extra?: any\n}\n\n/**\n * Context passed to prompt handlers.\n */\nexport interface PromptContext {\n /** Request ID for tracking */\n requestId?: string\n /** Credits available/charged */\n credits?: bigint\n /** Raw MCP extra context */\n extra?: any\n}\n\n/**\n * Configuration for starting the MCP server.\n */\nexport interface McpServerConfig {\n /** Port to listen on */\n port: number\n /** Plan ID the server charges against (required) */\n planId: string\n /** Agent ID (DID) for Nevermined — optional, informational only */\n agentId?: string\n /** Human-readable server name */\n serverName: string\n /** Base URL of the server (default: http://localhost:\\{port\\}) */\n baseUrl?: string\n /** Host to bind to (default: 0.0.0.0) */\n host?: string\n /** Nevermined environment (default: from Payments instance) */\n environment?: EnvironmentName\n /** Server version (default: 1.0.0) */\n version?: string\n /** Server description */\n description?: string\n /** CORS origins (default: *) */\n corsOrigins?: string | string[]\n /** Enable OAuth discovery endpoints (default: true) */\n enableOAuthDiscovery?: boolean\n /** Enable client registration (default: true) */\n enableClientRegistration?: boolean\n /** Enable health check endpoint (default: true) */\n enableHealthCheck?: boolean\n /** Enable server info endpoint (default: true) */\n enableServerInfo?: boolean\n /** Callback when server starts */\n onStart?: (info: ServerInfo) => void\n /** Callback for logging */\n onLog?: (message: string, level?: 'info' | 'warn' | 'error') => void\n}\n\n/**\n * Information about a running server.\n */\nexport interface ServerInfo {\n /** Base URL of the server */\n baseUrl: string\n /** Port the server is listening on */\n port: number\n /** List of registered tools */\n tools: string[]\n /** List of registered resources */\n resources: string[]\n /** List of registered prompts */\n prompts: string[]\n}\n\n/**\n * Result of starting the server.\n */\nexport interface McpServerResult {\n /** Server info */\n info: ServerInfo\n /** Stop the server gracefully */\n stop: () => Promise<void>\n}\n\n/**\n * Internal registration entry for a tool.\n */\nexport interface ToolRegistration {\n name: string\n config: McpToolConfig\n handler: ToolHandler\n options: McpRegistrationOptions\n}\n\n/**\n * Internal registration entry for a resource.\n */\nexport interface ResourceRegistration {\n name: string\n uriOrTemplate: string\n config: McpResourceConfig\n handler: ResourceHandler\n options: McpRegistrationOptions\n}\n\n/**\n * Internal registration entry for a prompt.\n */\nexport interface PromptRegistration {\n name: string\n config: McpPromptConfig\n handler: PromptHandler\n options: McpRegistrationOptions\n}\n"]}
|
package/dist/payments.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.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