ai-payments
Version:
A TypeScript library for AI payments functionality
49 lines • 1.7 kB
TypeScript
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
interface PaywallAuthOptions {
queryParam?: string;
apiKey?: string;
header?: string;
headers?: Record<string, string>;
}
interface PaywallConfig {
baseURL?: string;
network?: any;
usdcAddress?: string;
}
export declare function clearProcessedTransactions(): void;
/**
* Create a paywall-protected MCP tool
*
* @param server - The MCP server instance to register the tool with
* @param endpoint - The protected endpoint to access (e.g., '/secret')
* @param priceUSD - Price in USD (e.g., 0.01 for $0.01)
* @param payToAddress - Wallet address to receive payment
* @param toolName - Tool name for the MCP server
* @param authOptions - Optional authentication options for protected endpoints
* @param config - Optional configuration overrides
*
* @example
* ```typescript
* const server = new McpServer({ name: "my-server", version: "1.0.0" });
*
* // Simple endpoint
* await createPaywallTool(server, '/secret', 0.01, process.env.PAY_TO_ADDRESS!, 'get_secret');
*
* // With authentication
* await createPaywallTool(
* server,
* '/auth/query',
* 0.01,
* process.env.PAY_TO_ADDRESS!,
* 'get_url_query_secret',
* {
* queryParam: 'x-api-key',
* apiKey: 'demo-api-key-12345',
* }
* );
* ```
*/
export declare function createPaywallTool(server: McpServer, endpoint: string, priceUSD: number, payToAddress: string, toolName: string, authOptions?: PaywallAuthOptions, config?: PaywallConfig): Promise<void>;
export { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
export type { PaywallAuthOptions, PaywallConfig };
//# sourceMappingURL=index.d.ts.map