@agentauth/mcp
Version:
Universal payment-enabled MCP gateway for AI agents with native x402 protocol support.
49 lines • 1.49 kB
TypeScript
/**
* Protocol Detection and Prioritization
*
* Automatically detects payment protocol from server responses with
* prioritization: x402 first, then AgentPay fallback.
*
* Supports:
* - x402 v1.0 standard detection
* - AgentPay v0.0.2 detection
* - Robust error handling for malformed responses
*/
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
import type { PaymentProtocol } from '../protocols/agentpay-v002.js';
/**
* Protocol detection result with extracted data
*/
export interface ProtocolDetection {
protocol: PaymentProtocol;
name: string;
extractedData: any;
}
/**
* Protocol detector with prioritized detection logic
*/
export declare class ProtocolDetector {
private protocols;
private protocolPriority;
constructor(protocols: Map<string, PaymentProtocol>);
/**
* Detect payment protocol from MCP message
*
* @param message JSON-RPC message from MCP server
* @returns Protocol detection result with extracted data, or null if no payment required
*/
detectProtocol(message: JSONRPCMessage): ProtocolDetection | null;
/**
* Get list of registered protocols
*/
getRegisteredProtocols(): string[];
/**
* Get protocol priority order
*/
getProtocolPriority(): string[];
/**
* Add or update protocol registration
*/
registerProtocol(name: string, protocol: PaymentProtocol): void;
}
//# sourceMappingURL=protocolDetector.d.ts.map