@useagentpay/mcp-server 0.1.1 → 0.1.2
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/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
1
3
|
// src/index.ts
|
|
2
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { realpathSync } from "fs";
|
|
3
7
|
|
|
4
8
|
// src/server.ts
|
|
5
9
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -276,9 +280,12 @@ function loadConfig(overrides) {
|
|
|
276
280
|
let passphraseMode = "none";
|
|
277
281
|
if (passphrase) passphraseMode = "env";
|
|
278
282
|
else if (passphraseServer) passphraseMode = "server";
|
|
279
|
-
const
|
|
283
|
+
const hasDirectKeys = !!(process.env.BROWSERBASE_API_KEY && process.env.BROWSERBASE_PROJECT_ID);
|
|
284
|
+
const hasProxy = !!process.env.AGENTPAY_PROXY_URL;
|
|
285
|
+
const executor = hasDirectKeys || hasProxy ? {
|
|
280
286
|
browserbaseApiKey: process.env.BROWSERBASE_API_KEY,
|
|
281
|
-
browserbaseProjectId: process.env.BROWSERBASE_PROJECT_ID
|
|
287
|
+
browserbaseProjectId: process.env.BROWSERBASE_PROJECT_ID,
|
|
288
|
+
proxyUrl: process.env.AGENTPAY_PROXY_URL
|
|
282
289
|
} : void 0;
|
|
283
290
|
return {
|
|
284
291
|
home: process.env.AGENTPAY_HOME || void 0,
|
|
@@ -606,7 +613,7 @@ function registerPrompts(server) {
|
|
|
606
613
|
function createServer(config) {
|
|
607
614
|
const server = new McpServer({
|
|
608
615
|
name: "agentpay",
|
|
609
|
-
version: "0.1.0"
|
|
616
|
+
version: true ? "0.1.2" : "0.0.0"
|
|
610
617
|
});
|
|
611
618
|
const ap = new AgentPay2({
|
|
612
619
|
home: config.home,
|
|
@@ -651,7 +658,12 @@ async function startServer(overrides) {
|
|
|
651
658
|
process.on("SIGTERM", shutdown);
|
|
652
659
|
}
|
|
653
660
|
}
|
|
654
|
-
var isDirectRun =
|
|
661
|
+
var isDirectRun = false;
|
|
662
|
+
try {
|
|
663
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
664
|
+
isDirectRun = !!process.argv[1] && realpathSync(process.argv[1]) === thisFile;
|
|
665
|
+
} catch {
|
|
666
|
+
}
|
|
655
667
|
if (isDirectRun) {
|
|
656
668
|
const httpFlag = process.argv.includes("--http");
|
|
657
669
|
startServer({ http: httpFlag }).catch((err) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/server.ts","../src/errors.ts","../src/tools/status.ts","../src/tools/propose.ts","../src/tools/transactions.ts","../src/tools/execute.ts","../src/config.ts","../src/tools/receipt.ts","../src/tools/index.ts","../src/resources/wallet.ts","../src/resources/transaction.ts","../src/resources/audit.ts","../src/resources/index.ts","../src/prompts/buy.ts","../src/prompts/budget-check.ts","../src/prompts/purchase-status.ts","../src/prompts/index.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createServer } from './server.js';\nimport { loadConfig } from './config.js';\n\nexport { createServer } from './server.js';\nexport { loadConfig } from './config.js';\nexport type { ServerConfig } from './config.js';\n\nexport async function startServer(overrides?: { http?: boolean }) {\n const config = loadConfig(overrides);\n const server = createServer(config);\n\n if (config.http) {\n // Dynamic import to avoid loading HTTP deps when not needed\n const { createServer: createHttpServer } = await import('node:http');\n const { StreamableHTTPServerTransport } = await import(\n '@modelcontextprotocol/sdk/server/streamableHttp.js'\n );\n\n const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => crypto.randomUUID() });\n await server.connect(transport);\n\n const httpServer = createHttpServer((req, res) => {\n transport.handleRequest(req, res);\n });\n\n const port = parseInt(process.env.MCP_HTTP_PORT ?? '3100', 10);\n httpServer.listen(port, () => {\n console.error(`AgentPay MCP server listening on http://localhost:${port}`);\n });\n\n const shutdown = () => {\n httpServer.close();\n process.exit(0);\n };\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n } else {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n const shutdown = async () => {\n await server.close();\n process.exit(0);\n };\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n }\n}\n\n// Auto-start when run directly\nconst isDirectRun =\n process.argv[1] &&\n (process.argv[1].endsWith('/mcp-server/dist/index.js') ||\n process.argv[1].endsWith('/mcp-server/src/index.ts'));\n\nif (isDirectRun) {\n const httpFlag = process.argv.includes('--http');\n startServer({ http: httpFlag }).catch((err) => {\n console.error('Failed to start MCP server:', err);\n process.exit(1);\n });\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { AgentPay } from '@useagentpay/sdk';\nimport type { ServerConfig } from './config.js';\nimport { registerTools } from './tools/index.js';\nimport { registerResources } from './resources/index.js';\nimport { registerPrompts } from './prompts/index.js';\n\nexport function createServer(config: ServerConfig): McpServer {\n const server = new McpServer({\n name: 'agentpay',\n version: '0.1.0',\n });\n\n // Shared AgentPay instance (no passphrase — read-only by default)\n const ap = new AgentPay({\n home: config.home,\n executor: config.executor,\n });\n\n registerTools(server, ap, config);\n registerResources(server, ap);\n registerPrompts(server);\n\n return server;\n}\n","import {\n NotSetupError,\n DecryptError,\n InsufficientBalanceError,\n ExceedsTxLimitError,\n NotApprovedError,\n InvalidMandateError,\n AlreadyExecutedError,\n CheckoutFailedError,\n TimeoutError,\n} from '@useagentpay/sdk';\n\nexport interface ToolResult {\n success: boolean;\n error?: string;\n nextAction?: string;\n [key: string]: unknown;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst ERROR_MAP: Array<{\n type: new (...args: any[]) => Error;\n error: string;\n nextAction: string;\n}> = [\n { type: NotSetupError, error: 'NOT_SETUP', nextAction: 'STOP - Human must run: agentpay setup' },\n { type: InsufficientBalanceError, error: 'INSUFFICIENT_BALANCE', nextAction: 'STOP - Human must add budget' },\n { type: ExceedsTxLimitError, error: 'EXCEEDS_TX_LIMIT', nextAction: 'STOP - Human must increase limit' },\n { type: NotApprovedError, error: 'NOT_APPROVED', nextAction: 'WAIT - Needs approval first' },\n { type: InvalidMandateError, error: 'INVALID_MANDATE', nextAction: 'STOP - Security error' },\n { type: AlreadyExecutedError, error: 'ALREADY_EXECUTED', nextAction: 'STOP - Already processed' },\n { type: CheckoutFailedError, error: 'CHECKOUT_FAILED', nextAction: 'ERROR - Human should review' },\n { type: TimeoutError, error: 'TIMEOUT', nextAction: 'RETRY - Try again later' },\n { type: DecryptError, error: 'DECRYPT_FAILED', nextAction: 'STOP - Wrong passphrase' },\n];\n\nexport function mapError(err: unknown): ToolResult {\n if (err instanceof Error) {\n for (const mapping of ERROR_MAP) {\n if (err instanceof mapping.type) {\n return {\n success: false,\n error: mapping.error,\n message: err.message,\n nextAction: mapping.nextAction,\n };\n }\n }\n }\n\n return {\n success: false,\n error: 'UNKNOWN_ERROR',\n message: err instanceof Error ? err.message : String(err),\n };\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nexport function registerStatusTools(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_status',\n 'Get AgentPay status: setup state, balance, budget, and pending transactions. Call this first.',\n {},\n async () => {\n try {\n const status = ap.status();\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n ...status,\n pendingCount: status.pending.length,\n nextAction: !status.isSetup\n ? 'STOP - Human must run: agentpay setup'\n : status.pending.length > 0\n ? 'Review pending transactions with agentpay_list_pending'\n : 'Ready for purchases. Use agentpay_check_balance before proposing.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n\n server.tool(\n 'agentpay_check_balance',\n 'Check current balance, budget, and per-transaction limit. Call BEFORE proposing a purchase.',\n {},\n async () => {\n try {\n const wallet = ap.wallet.getBalance();\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n ...wallet,\n nextAction:\n wallet.balance <= 0\n ? 'STOP - No balance remaining. Human must add budget.'\n : `Ready. Max single purchase: $${Math.min(wallet.balance, wallet.limitPerTx).toFixed(2)}`,\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n\n server.tool(\n 'agentpay_list_pending',\n 'List all pending transactions awaiting human approval.',\n {},\n async () => {\n try {\n const status = ap.status();\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n pending: status.pending,\n count: status.pending.length,\n nextAction:\n status.pending.length > 0\n ? 'Human must approve/reject via CLI. Use agentpay_wait_for_approval to poll.'\n : 'No pending transactions.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nexport function registerProposeTool(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_propose_purchase',\n 'Propose a new purchase. Creates a pending transaction that requires human approval before execution.',\n {\n merchant: z.string().describe('Merchant name (e.g. \"Amazon\", \"Target\")'),\n amount: z.number().positive().describe('Purchase amount in USD'),\n description: z.string().describe('What is being purchased'),\n url: z.string().url().describe('Product or checkout URL'),\n },\n async ({ merchant, amount, description, url }) => {\n try {\n const tx = ap.transactions.propose({ merchant, amount, description, url });\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n txId: tx.id,\n status: tx.status,\n merchant: tx.merchant,\n amount: tx.amount,\n nextAction: 'Human must approve via CLI: agentpay approve ' + tx.id,\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nfunction nextActionForStatus(status: string): string {\n switch (status) {\n case 'pending':\n return 'WAIT - Human must approve via CLI. Use agentpay_wait_for_approval to poll.';\n case 'approved':\n return 'READY - Use agentpay_execute_purchase to complete the purchase.';\n case 'rejected':\n return 'STOP - Transaction was rejected by human.';\n case 'executing':\n return 'WAIT - Purchase is being executed.';\n case 'completed':\n return 'DONE - Use agentpay_get_receipt for confirmation details.';\n case 'failed':\n return 'ERROR - Purchase failed. Human should review.';\n default:\n return 'Unknown status.';\n }\n}\n\nexport function registerTransactionTools(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_get_transaction',\n 'Get the current status and details of a transaction.',\n {\n txId: z.string().describe('Transaction ID (e.g. \"tx_abc123\")'),\n },\n async ({ txId }) => {\n try {\n const tx = ap.transactions.get(txId);\n if (!tx) {\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: false,\n error: 'NOT_FOUND',\n message: `Transaction ${txId} not found.`,\n }),\n },\n ],\n };\n }\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n id: tx.id,\n status: tx.status,\n merchant: tx.merchant,\n amount: tx.amount,\n description: tx.description,\n url: tx.url,\n createdAt: tx.createdAt,\n nextAction: nextActionForStatus(tx.status),\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n\n server.tool(\n 'agentpay_wait_for_approval',\n 'Long-poll for human approval of a pending transaction. Blocks until approved, rejected, or timeout.',\n {\n txId: z.string().describe('Transaction ID to wait for'),\n pollInterval: z.number().positive().optional().describe('Poll interval in ms (default 2000)'),\n timeout: z.number().positive().optional().describe('Timeout in ms (default 300000 = 5 min)'),\n },\n async ({ txId, pollInterval, timeout }) => {\n try {\n const result = await ap.transactions.waitForApproval(txId, {\n pollInterval: pollInterval ?? 2000,\n timeout: timeout ?? 300000,\n });\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n txId,\n status: result.status,\n reason: result.reason,\n nextAction: nextActionForStatus(result.status),\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { AgentPay } from '@useagentpay/sdk';\nimport type { ServerConfig } from '../config.js';\nimport { getPassphrase } from '../config.js';\nimport { mapError } from '../errors.js';\n\nexport function registerExecuteTool(server: McpServer, ap: AgentPay, config: ServerConfig) {\n server.tool(\n 'agentpay_execute_purchase',\n 'Execute an approved purchase. Requires passphrase config. Decrypts credentials and completes checkout via browser.',\n {\n txId: z.string().describe('Transaction ID of an approved purchase'),\n },\n async ({ txId }) => {\n try {\n const passphrase = await getPassphrase(config);\n\n // Create a temporary instance with passphrase for execution\n const execAp = new AgentPay({\n home: ap.home,\n passphrase,\n executor: config.executor,\n });\n\n const receipt = await execAp.transactions.execute(txId);\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n receipt,\n nextAction: 'DONE - Purchase completed. Use agentpay_get_receipt for details.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import type { ExecutorConfig } from '@useagentpay/sdk';\n\nexport interface ServerConfig {\n home?: string;\n passphrase?: string;\n passphraseServer?: string;\n passphraseMode: 'env' | 'server' | 'none';\n executor?: ExecutorConfig;\n http?: boolean;\n}\n\nexport function loadConfig(overrides?: { http?: boolean }): ServerConfig {\n const passphrase = process.env.AGENTPAY_PASSPHRASE;\n const passphraseServer = process.env.AGENTPAY_PASSPHRASE_SERVER;\n\n let passphraseMode: ServerConfig['passphraseMode'] = 'none';\n if (passphrase) passphraseMode = 'env';\n else if (passphraseServer) passphraseMode = 'server';\n\n const executor: ExecutorConfig | undefined =\n process.env.BROWSERBASE_API_KEY && process.env.BROWSERBASE_PROJECT_ID\n ? {\n browserbaseApiKey: process.env.BROWSERBASE_API_KEY,\n browserbaseProjectId: process.env.BROWSERBASE_PROJECT_ID,\n }\n : undefined;\n\n return {\n home: process.env.AGENTPAY_HOME || undefined,\n passphrase,\n passphraseServer,\n passphraseMode,\n executor,\n http: overrides?.http ?? process.env.MCP_TRANSPORT === 'http',\n };\n}\n\nexport async function getPassphrase(config: ServerConfig): Promise<string> {\n if (config.passphraseMode === 'env' && config.passphrase) {\n return config.passphrase;\n }\n\n if (config.passphraseMode === 'server' && config.passphraseServer) {\n const res = await fetch(config.passphraseServer);\n if (!res.ok) throw new Error(`Passphrase server returned ${res.status}`);\n const body = await res.text();\n return body.trim();\n }\n\n throw new Error(\n 'No passphrase configured. Set AGENTPAY_PASSPHRASE or AGENTPAY_PASSPHRASE_SERVER to enable purchase execution.'\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nexport function registerReceiptTool(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_get_receipt',\n 'Get the receipt for a completed purchase.',\n {\n txId: z.string().describe('Transaction ID of a completed purchase'),\n },\n async ({ txId }) => {\n try {\n const receipt = ap.transactions.getReceipt(txId);\n if (!receipt) {\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: false,\n error: 'NO_RECEIPT',\n message: `No receipt found for transaction ${txId}. Transaction may not be completed yet.`,\n nextAction: 'Check transaction status with agentpay_get_transaction',\n }),\n },\n ],\n };\n }\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n receipt,\n nextAction: 'DONE - Purchase confirmed.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport type { ServerConfig } from '../config.js';\nimport { registerStatusTools } from './status.js';\nimport { registerProposeTool } from './propose.js';\nimport { registerTransactionTools } from './transactions.js';\nimport { registerExecuteTool } from './execute.js';\nimport { registerReceiptTool } from './receipt.js';\n\nexport function registerTools(server: McpServer, ap: AgentPay, config: ServerConfig) {\n registerStatusTools(server, ap);\n registerProposeTool(server, ap);\n registerTransactionTools(server, ap);\n registerExecuteTool(server, ap, config);\n registerReceiptTool(server, ap);\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\n\nexport function registerWalletResource(server: McpServer, ap: AgentPay) {\n server.resource('wallet', 'agentpay://wallet', async () => {\n try {\n const wallet = ap.wallet.getBalance();\n return {\n contents: [\n {\n uri: 'agentpay://wallet',\n mimeType: 'application/json',\n text: JSON.stringify(wallet, null, 2),\n },\n ],\n };\n } catch {\n return {\n contents: [\n {\n uri: 'agentpay://wallet',\n mimeType: 'application/json',\n text: JSON.stringify({ budget: 0, balance: 0, limitPerTx: 0, spent: 0 }),\n },\n ],\n };\n }\n });\n}\n","import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\n\nexport function registerTransactionResource(server: McpServer, ap: AgentPay) {\n server.resource(\n 'transaction',\n new ResourceTemplate('agentpay://transactions/{txId}', { list: undefined }),\n async (uri, { txId }) => {\n const tx = ap.transactions.get(txId as string);\n if (!tx) {\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({ error: 'Transaction not found' }),\n },\n ],\n };\n }\n\n // Omit mandate internals for security\n const { mandate: _, ...safeTx } = tx;\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify(safeTx, null, 2),\n },\n ],\n };\n }\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\n\nexport function registerAuditResource(server: McpServer, ap: AgentPay) {\n server.resource('audit-log', 'agentpay://audit-log', async () => {\n const lines = ap.audit.getLog();\n const last50 = lines.slice(-50);\n\n const entries = last50.map((line) => {\n const parts = line.split('\\t');\n return {\n timestamp: parts[0] ?? '',\n action: parts[1] ?? '',\n details: parts[2] ? JSON.parse(parts[2]) : {},\n };\n });\n\n return {\n contents: [\n {\n uri: 'agentpay://audit-log',\n mimeType: 'application/json',\n text: JSON.stringify(entries, null, 2),\n },\n ],\n };\n });\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { registerWalletResource } from './wallet.js';\nimport { registerTransactionResource } from './transaction.js';\nimport { registerAuditResource } from './audit.js';\n\nexport function registerResources(server: McpServer, ap: AgentPay) {\n registerWalletResource(server, ap);\n registerTransactionResource(server, ap);\n registerAuditResource(server, ap);\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerBuyPrompt(server: McpServer) {\n server.prompt(\n 'buy',\n 'Step-by-step purchase flow: check balance, propose, wait for approval, execute.',\n {\n merchant: z.string().describe('Merchant name'),\n amount: z.string().describe('Purchase amount in USD (e.g. \"29.99\")'),\n description: z.string().describe('What is being purchased'),\n url: z.string().describe('Product or checkout URL'),\n },\n async ({ merchant, amount, description, url }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `I need to purchase from ${merchant}.`,\n '',\n 'Follow these steps exactly:',\n '',\n '1. Call agentpay_check_balance to verify sufficient funds',\n `2. Call agentpay_propose_purchase with:`,\n ` - merchant: \"${merchant}\"`,\n ` - amount: ${amount}`,\n ` - description: \"${description}\"`,\n ` - url: \"${url}\"`,\n '3. Tell me the transaction ID and that I need to approve it',\n '4. Call agentpay_wait_for_approval with the transaction ID',\n '5. Once approved, call agentpay_execute_purchase',\n '6. Call agentpay_get_receipt to confirm',\n '',\n 'If any step fails, stop and explain what went wrong.',\n ].join('\\n'),\n },\n },\n ],\n })\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerBudgetCheckPrompt(server: McpServer) {\n server.prompt(\n 'budget-check',\n 'Check current balance, spending limits, and pending transactions.',\n {},\n async () => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n 'Check my AgentPay budget status:',\n '',\n '1. Call agentpay_check_balance to get current balance and limits',\n '2. Call agentpay_list_pending to see any pending transactions',\n '3. Summarize:',\n ' - Available balance',\n ' - Per-transaction limit',\n ' - Total budget and amount spent',\n ' - Number of pending transactions (if any)',\n ].join('\\n'),\n },\n },\n ],\n })\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerPurchaseStatusPrompt(server: McpServer) {\n server.prompt(\n 'purchase-status',\n 'Review recent transactions and their receipts.',\n {\n limit: z.string().optional().describe('Number of recent transactions to show (default 5)'),\n },\n async ({ limit }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Show me the status of my recent AgentPay transactions (last ${limit ?? '5'}):`,\n '',\n '1. Call agentpay_status to get recent transactions',\n '2. For each completed transaction, call agentpay_get_receipt',\n '3. Present a summary table with:',\n ' - Transaction ID',\n ' - Merchant',\n ' - Amount',\n ' - Status',\n ' - Confirmation ID (if completed)',\n ].join('\\n'),\n },\n },\n ],\n })\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerBuyPrompt } from './buy.js';\nimport { registerBudgetCheckPrompt } from './budget-check.js';\nimport { registerPurchaseStatusPrompt } from './purchase-status.js';\n\nexport function registerPrompts(server: McpServer) {\n registerBuyPrompt(server);\n registerBudgetCheckPrompt(server);\n registerPurchaseStatusPrompt(server);\n}\n"],"mappings":";AAAA,SAAS,4BAA4B;;;ACArC,SAAS,iBAAiB;AAC1B,SAAS,YAAAA,iBAAgB;;;ACDzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP,IAAM,YAID;AAAA,EACH,EAAE,MAAM,eAAe,OAAO,aAAa,YAAY,wCAAwC;AAAA,EAC/F,EAAE,MAAM,0BAA0B,OAAO,wBAAwB,YAAY,+BAA+B;AAAA,EAC5G,EAAE,MAAM,qBAAqB,OAAO,oBAAoB,YAAY,mCAAmC;AAAA,EACvG,EAAE,MAAM,kBAAkB,OAAO,gBAAgB,YAAY,8BAA8B;AAAA,EAC3F,EAAE,MAAM,qBAAqB,OAAO,mBAAmB,YAAY,wBAAwB;AAAA,EAC3F,EAAE,MAAM,sBAAsB,OAAO,oBAAoB,YAAY,2BAA2B;AAAA,EAChG,EAAE,MAAM,qBAAqB,OAAO,mBAAmB,YAAY,8BAA8B;AAAA,EACjG,EAAE,MAAM,cAAc,OAAO,WAAW,YAAY,0BAA0B;AAAA,EAC9E,EAAE,MAAM,cAAc,OAAO,kBAAkB,YAAY,0BAA0B;AACvF;AAEO,SAAS,SAAS,KAA0B;AACjD,MAAI,eAAe,OAAO;AACxB,eAAW,WAAW,WAAW;AAC/B,UAAI,eAAe,QAAQ,MAAM;AAC/B,eAAO;AAAA,UACL,SAAS;AAAA,UACT,OAAO,QAAQ;AAAA,UACf,SAAS,IAAI;AAAA,UACb,YAAY,QAAQ;AAAA,QACtB;AAAA,MACF;AAAA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,QAAQ;AAC7B,YAAQ,GAAG,WAAW,QAAQ;AAAA,EAChC,OAAO;AACL,UAAM,YAAY,IAAI,qBAAqB;AAC3C,UAAM,OAAO,QAAQ,SAAS;AAE9B,UAAM,WAAW,YAAY;AAC3B,YAAM,OAAO,MAAM;AACnB,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,YAAQ,GAAG,UAAU,QAAQ;AAC7B,YAAQ,GAAG,WAAW,QAAQ;AAAA,EAChC;AACF;AAGA,IAAM,cACJ,QAAQ,KAAK,CAAC,MACb,QAAQ,KAAK,CAAC,EAAE,SAAS,2BAA2B,KACnD,QAAQ,KAAK,CAAC,EAAE,SAAS,0BAA0B;AAEvD,IAAI,aAAa;AACf,QAAM,WAAW,QAAQ,KAAK,SAAS,QAAQ;AAC/C,cAAY,EAAE,MAAM,SAAS,CAAC,EAAE,MAAM,CAAC,QAAQ;AAC7C,YAAQ,MAAM,+BAA+B,GAAG;AAChD,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":["AgentPay","z","z","z","z","z","z","z","z","AgentPay"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/server.ts","../src/errors.ts","../src/tools/status.ts","../src/tools/propose.ts","../src/tools/transactions.ts","../src/tools/execute.ts","../src/config.ts","../src/tools/receipt.ts","../src/tools/index.ts","../src/resources/wallet.ts","../src/resources/transaction.ts","../src/resources/audit.ts","../src/resources/index.ts","../src/prompts/buy.ts","../src/prompts/budget-check.ts","../src/prompts/purchase-status.ts","../src/prompts/index.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { fileURLToPath } from 'node:url';\nimport { realpathSync } from 'node:fs';\nimport { createServer } from './server.js';\nimport { loadConfig } from './config.js';\n\nexport { createServer } from './server.js';\nexport { loadConfig } from './config.js';\nexport type { ServerConfig } from './config.js';\n\nexport async function startServer(overrides?: { http?: boolean }) {\n const config = loadConfig(overrides);\n const server = createServer(config);\n\n if (config.http) {\n // Dynamic import to avoid loading HTTP deps when not needed\n const { createServer: createHttpServer } = await import('node:http');\n const { StreamableHTTPServerTransport } = await import(\n '@modelcontextprotocol/sdk/server/streamableHttp.js'\n );\n\n const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => crypto.randomUUID() });\n await server.connect(transport);\n\n const httpServer = createHttpServer((req, res) => {\n transport.handleRequest(req, res);\n });\n\n const port = parseInt(process.env.MCP_HTTP_PORT ?? '3100', 10);\n httpServer.listen(port, () => {\n console.error(`AgentPay MCP server listening on http://localhost:${port}`);\n });\n\n const shutdown = () => {\n httpServer.close();\n process.exit(0);\n };\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n } else {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n const shutdown = async () => {\n await server.close();\n process.exit(0);\n };\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n }\n}\n\n// Auto-start when run directly (handles npx, global install, and symlinks)\nlet isDirectRun = false;\ntry {\n const thisFile = fileURLToPath(import.meta.url);\n isDirectRun = !!process.argv[1] && realpathSync(process.argv[1]) === thisFile;\n} catch {\n // process.argv[1] doesn't exist or can't be resolved\n}\n\nif (isDirectRun) {\n const httpFlag = process.argv.includes('--http');\n startServer({ http: httpFlag }).catch((err) => {\n console.error('Failed to start MCP server:', err);\n process.exit(1);\n });\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { AgentPay } from '@useagentpay/sdk';\nimport type { ServerConfig } from './config.js';\nimport { registerTools } from './tools/index.js';\nimport { registerResources } from './resources/index.js';\nimport { registerPrompts } from './prompts/index.js';\n\ndeclare const __PKG_VERSION__: string;\n\nexport function createServer(config: ServerConfig): McpServer {\n const server = new McpServer({\n name: 'agentpay',\n version: typeof __PKG_VERSION__ !== 'undefined' ? __PKG_VERSION__ : '0.0.0',\n });\n\n // Shared AgentPay instance (no passphrase — read-only by default)\n const ap = new AgentPay({\n home: config.home,\n executor: config.executor,\n });\n\n registerTools(server, ap, config);\n registerResources(server, ap);\n registerPrompts(server);\n\n return server;\n}\n","import {\n NotSetupError,\n DecryptError,\n InsufficientBalanceError,\n ExceedsTxLimitError,\n NotApprovedError,\n InvalidMandateError,\n AlreadyExecutedError,\n CheckoutFailedError,\n TimeoutError,\n} from '@useagentpay/sdk';\n\nexport interface ToolResult {\n success: boolean;\n error?: string;\n nextAction?: string;\n [key: string]: unknown;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst ERROR_MAP: Array<{\n type: new (...args: any[]) => Error;\n error: string;\n nextAction: string;\n}> = [\n { type: NotSetupError, error: 'NOT_SETUP', nextAction: 'STOP - Human must run: agentpay setup' },\n { type: InsufficientBalanceError, error: 'INSUFFICIENT_BALANCE', nextAction: 'STOP - Human must add budget' },\n { type: ExceedsTxLimitError, error: 'EXCEEDS_TX_LIMIT', nextAction: 'STOP - Human must increase limit' },\n { type: NotApprovedError, error: 'NOT_APPROVED', nextAction: 'WAIT - Needs approval first' },\n { type: InvalidMandateError, error: 'INVALID_MANDATE', nextAction: 'STOP - Security error' },\n { type: AlreadyExecutedError, error: 'ALREADY_EXECUTED', nextAction: 'STOP - Already processed' },\n { type: CheckoutFailedError, error: 'CHECKOUT_FAILED', nextAction: 'ERROR - Human should review' },\n { type: TimeoutError, error: 'TIMEOUT', nextAction: 'RETRY - Try again later' },\n { type: DecryptError, error: 'DECRYPT_FAILED', nextAction: 'STOP - Wrong passphrase' },\n];\n\nexport function mapError(err: unknown): ToolResult {\n if (err instanceof Error) {\n for (const mapping of ERROR_MAP) {\n if (err instanceof mapping.type) {\n return {\n success: false,\n error: mapping.error,\n message: err.message,\n nextAction: mapping.nextAction,\n };\n }\n }\n }\n\n return {\n success: false,\n error: 'UNKNOWN_ERROR',\n message: err instanceof Error ? err.message : String(err),\n };\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nexport function registerStatusTools(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_status',\n 'Get AgentPay status: setup state, balance, budget, and pending transactions. Call this first.',\n {},\n async () => {\n try {\n const status = ap.status();\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n ...status,\n pendingCount: status.pending.length,\n nextAction: !status.isSetup\n ? 'STOP - Human must run: agentpay setup'\n : status.pending.length > 0\n ? 'Review pending transactions with agentpay_list_pending'\n : 'Ready for purchases. Use agentpay_check_balance before proposing.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n\n server.tool(\n 'agentpay_check_balance',\n 'Check current balance, budget, and per-transaction limit. Call BEFORE proposing a purchase.',\n {},\n async () => {\n try {\n const wallet = ap.wallet.getBalance();\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n ...wallet,\n nextAction:\n wallet.balance <= 0\n ? 'STOP - No balance remaining. Human must add budget.'\n : `Ready. Max single purchase: $${Math.min(wallet.balance, wallet.limitPerTx).toFixed(2)}`,\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n\n server.tool(\n 'agentpay_list_pending',\n 'List all pending transactions awaiting human approval.',\n {},\n async () => {\n try {\n const status = ap.status();\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n pending: status.pending,\n count: status.pending.length,\n nextAction:\n status.pending.length > 0\n ? 'Human must approve/reject via CLI. Use agentpay_wait_for_approval to poll.'\n : 'No pending transactions.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nexport function registerProposeTool(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_propose_purchase',\n 'Propose a new purchase. Creates a pending transaction that requires human approval before execution.',\n {\n merchant: z.string().describe('Merchant name (e.g. \"Amazon\", \"Target\")'),\n amount: z.number().positive().describe('Purchase amount in USD'),\n description: z.string().describe('What is being purchased'),\n url: z.string().url().describe('Product or checkout URL'),\n },\n async ({ merchant, amount, description, url }) => {\n try {\n const tx = ap.transactions.propose({ merchant, amount, description, url });\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n txId: tx.id,\n status: tx.status,\n merchant: tx.merchant,\n amount: tx.amount,\n nextAction: 'Human must approve via CLI: agentpay approve ' + tx.id,\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nfunction nextActionForStatus(status: string): string {\n switch (status) {\n case 'pending':\n return 'WAIT - Human must approve via CLI. Use agentpay_wait_for_approval to poll.';\n case 'approved':\n return 'READY - Use agentpay_execute_purchase to complete the purchase.';\n case 'rejected':\n return 'STOP - Transaction was rejected by human.';\n case 'executing':\n return 'WAIT - Purchase is being executed.';\n case 'completed':\n return 'DONE - Use agentpay_get_receipt for confirmation details.';\n case 'failed':\n return 'ERROR - Purchase failed. Human should review.';\n default:\n return 'Unknown status.';\n }\n}\n\nexport function registerTransactionTools(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_get_transaction',\n 'Get the current status and details of a transaction.',\n {\n txId: z.string().describe('Transaction ID (e.g. \"tx_abc123\")'),\n },\n async ({ txId }) => {\n try {\n const tx = ap.transactions.get(txId);\n if (!tx) {\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: false,\n error: 'NOT_FOUND',\n message: `Transaction ${txId} not found.`,\n }),\n },\n ],\n };\n }\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n id: tx.id,\n status: tx.status,\n merchant: tx.merchant,\n amount: tx.amount,\n description: tx.description,\n url: tx.url,\n createdAt: tx.createdAt,\n nextAction: nextActionForStatus(tx.status),\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n\n server.tool(\n 'agentpay_wait_for_approval',\n 'Long-poll for human approval of a pending transaction. Blocks until approved, rejected, or timeout.',\n {\n txId: z.string().describe('Transaction ID to wait for'),\n pollInterval: z.number().positive().optional().describe('Poll interval in ms (default 2000)'),\n timeout: z.number().positive().optional().describe('Timeout in ms (default 300000 = 5 min)'),\n },\n async ({ txId, pollInterval, timeout }) => {\n try {\n const result = await ap.transactions.waitForApproval(txId, {\n pollInterval: pollInterval ?? 2000,\n timeout: timeout ?? 300000,\n });\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n txId,\n status: result.status,\n reason: result.reason,\n nextAction: nextActionForStatus(result.status),\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { AgentPay } from '@useagentpay/sdk';\nimport type { ServerConfig } from '../config.js';\nimport { getPassphrase } from '../config.js';\nimport { mapError } from '../errors.js';\n\nexport function registerExecuteTool(server: McpServer, ap: AgentPay, config: ServerConfig) {\n server.tool(\n 'agentpay_execute_purchase',\n 'Execute an approved purchase. Requires passphrase config. Decrypts credentials and completes checkout via browser.',\n {\n txId: z.string().describe('Transaction ID of an approved purchase'),\n },\n async ({ txId }) => {\n try {\n const passphrase = await getPassphrase(config);\n\n // Create a temporary instance with passphrase for execution\n const execAp = new AgentPay({\n home: ap.home,\n passphrase,\n executor: config.executor,\n });\n\n const receipt = await execAp.transactions.execute(txId);\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n receipt,\n nextAction: 'DONE - Purchase completed. Use agentpay_get_receipt for details.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import type { ExecutorConfig } from '@useagentpay/sdk';\n\nexport interface ServerConfig {\n home?: string;\n passphrase?: string;\n passphraseServer?: string;\n passphraseMode: 'env' | 'server' | 'none';\n executor?: ExecutorConfig;\n http?: boolean;\n}\n\nexport function loadConfig(overrides?: { http?: boolean }): ServerConfig {\n const passphrase = process.env.AGENTPAY_PASSPHRASE;\n const passphraseServer = process.env.AGENTPAY_PASSPHRASE_SERVER;\n\n let passphraseMode: ServerConfig['passphraseMode'] = 'none';\n if (passphrase) passphraseMode = 'env';\n else if (passphraseServer) passphraseMode = 'server';\n\n const hasDirectKeys = !!(process.env.BROWSERBASE_API_KEY && process.env.BROWSERBASE_PROJECT_ID);\n const hasProxy = !!process.env.AGENTPAY_PROXY_URL;\n\n const executor: ExecutorConfig | undefined =\n hasDirectKeys || hasProxy\n ? {\n browserbaseApiKey: process.env.BROWSERBASE_API_KEY,\n browserbaseProjectId: process.env.BROWSERBASE_PROJECT_ID,\n proxyUrl: process.env.AGENTPAY_PROXY_URL,\n }\n : undefined;\n\n return {\n home: process.env.AGENTPAY_HOME || undefined,\n passphrase,\n passphraseServer,\n passphraseMode,\n executor,\n http: overrides?.http ?? process.env.MCP_TRANSPORT === 'http',\n };\n}\n\nexport async function getPassphrase(config: ServerConfig): Promise<string> {\n if (config.passphraseMode === 'env' && config.passphrase) {\n return config.passphrase;\n }\n\n if (config.passphraseMode === 'server' && config.passphraseServer) {\n const res = await fetch(config.passphraseServer);\n if (!res.ok) throw new Error(`Passphrase server returned ${res.status}`);\n const body = await res.text();\n return body.trim();\n }\n\n throw new Error(\n 'No passphrase configured. Set AGENTPAY_PASSPHRASE or AGENTPAY_PASSPHRASE_SERVER to enable purchase execution.'\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { mapError } from '../errors.js';\n\nexport function registerReceiptTool(server: McpServer, ap: AgentPay) {\n server.tool(\n 'agentpay_get_receipt',\n 'Get the receipt for a completed purchase.',\n {\n txId: z.string().describe('Transaction ID of a completed purchase'),\n },\n async ({ txId }) => {\n try {\n const receipt = ap.transactions.getReceipt(txId);\n if (!receipt) {\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: false,\n error: 'NO_RECEIPT',\n message: `No receipt found for transaction ${txId}. Transaction may not be completed yet.`,\n nextAction: 'Check transaction status with agentpay_get_transaction',\n }),\n },\n ],\n };\n }\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n success: true,\n receipt,\n nextAction: 'DONE - Purchase confirmed.',\n }),\n },\n ],\n };\n } catch (err) {\n return { content: [{ type: 'text' as const, text: JSON.stringify(mapError(err)) }] };\n }\n }\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport type { ServerConfig } from '../config.js';\nimport { registerStatusTools } from './status.js';\nimport { registerProposeTool } from './propose.js';\nimport { registerTransactionTools } from './transactions.js';\nimport { registerExecuteTool } from './execute.js';\nimport { registerReceiptTool } from './receipt.js';\n\nexport function registerTools(server: McpServer, ap: AgentPay, config: ServerConfig) {\n registerStatusTools(server, ap);\n registerProposeTool(server, ap);\n registerTransactionTools(server, ap);\n registerExecuteTool(server, ap, config);\n registerReceiptTool(server, ap);\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\n\nexport function registerWalletResource(server: McpServer, ap: AgentPay) {\n server.resource('wallet', 'agentpay://wallet', async () => {\n try {\n const wallet = ap.wallet.getBalance();\n return {\n contents: [\n {\n uri: 'agentpay://wallet',\n mimeType: 'application/json',\n text: JSON.stringify(wallet, null, 2),\n },\n ],\n };\n } catch {\n return {\n contents: [\n {\n uri: 'agentpay://wallet',\n mimeType: 'application/json',\n text: JSON.stringify({ budget: 0, balance: 0, limitPerTx: 0, spent: 0 }),\n },\n ],\n };\n }\n });\n}\n","import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\n\nexport function registerTransactionResource(server: McpServer, ap: AgentPay) {\n server.resource(\n 'transaction',\n new ResourceTemplate('agentpay://transactions/{txId}', { list: undefined }),\n async (uri, { txId }) => {\n const tx = ap.transactions.get(txId as string);\n if (!tx) {\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify({ error: 'Transaction not found' }),\n },\n ],\n };\n }\n\n // Omit mandate internals for security\n const { mandate: _, ...safeTx } = tx;\n return {\n contents: [\n {\n uri: uri.href,\n mimeType: 'application/json',\n text: JSON.stringify(safeTx, null, 2),\n },\n ],\n };\n }\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\n\nexport function registerAuditResource(server: McpServer, ap: AgentPay) {\n server.resource('audit-log', 'agentpay://audit-log', async () => {\n const lines = ap.audit.getLog();\n const last50 = lines.slice(-50);\n\n const entries = last50.map((line) => {\n const parts = line.split('\\t');\n return {\n timestamp: parts[0] ?? '',\n action: parts[1] ?? '',\n details: parts[2] ? JSON.parse(parts[2]) : {},\n };\n });\n\n return {\n contents: [\n {\n uri: 'agentpay://audit-log',\n mimeType: 'application/json',\n text: JSON.stringify(entries, null, 2),\n },\n ],\n };\n });\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { AgentPay } from '@useagentpay/sdk';\nimport { registerWalletResource } from './wallet.js';\nimport { registerTransactionResource } from './transaction.js';\nimport { registerAuditResource } from './audit.js';\n\nexport function registerResources(server: McpServer, ap: AgentPay) {\n registerWalletResource(server, ap);\n registerTransactionResource(server, ap);\n registerAuditResource(server, ap);\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerBuyPrompt(server: McpServer) {\n server.prompt(\n 'buy',\n 'Step-by-step purchase flow: check balance, propose, wait for approval, execute.',\n {\n merchant: z.string().describe('Merchant name'),\n amount: z.string().describe('Purchase amount in USD (e.g. \"29.99\")'),\n description: z.string().describe('What is being purchased'),\n url: z.string().describe('Product or checkout URL'),\n },\n async ({ merchant, amount, description, url }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `I need to purchase from ${merchant}.`,\n '',\n 'Follow these steps exactly:',\n '',\n '1. Call agentpay_check_balance to verify sufficient funds',\n `2. Call agentpay_propose_purchase with:`,\n ` - merchant: \"${merchant}\"`,\n ` - amount: ${amount}`,\n ` - description: \"${description}\"`,\n ` - url: \"${url}\"`,\n '3. Tell me the transaction ID and that I need to approve it',\n '4. Call agentpay_wait_for_approval with the transaction ID',\n '5. Once approved, call agentpay_execute_purchase',\n '6. Call agentpay_get_receipt to confirm',\n '',\n 'If any step fails, stop and explain what went wrong.',\n ].join('\\n'),\n },\n },\n ],\n })\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerBudgetCheckPrompt(server: McpServer) {\n server.prompt(\n 'budget-check',\n 'Check current balance, spending limits, and pending transactions.',\n {},\n async () => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n 'Check my AgentPay budget status:',\n '',\n '1. Call agentpay_check_balance to get current balance and limits',\n '2. Call agentpay_list_pending to see any pending transactions',\n '3. Summarize:',\n ' - Available balance',\n ' - Per-transaction limit',\n ' - Total budget and amount spent',\n ' - Number of pending transactions (if any)',\n ].join('\\n'),\n },\n },\n ],\n })\n );\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport function registerPurchaseStatusPrompt(server: McpServer) {\n server.prompt(\n 'purchase-status',\n 'Review recent transactions and their receipts.',\n {\n limit: z.string().optional().describe('Number of recent transactions to show (default 5)'),\n },\n async ({ limit }) => ({\n messages: [\n {\n role: 'user' as const,\n content: {\n type: 'text' as const,\n text: [\n `Show me the status of my recent AgentPay transactions (last ${limit ?? '5'}):`,\n '',\n '1. Call agentpay_status to get recent transactions',\n '2. For each completed transaction, call agentpay_get_receipt',\n '3. Present a summary table with:',\n ' - Transaction ID',\n ' - Merchant',\n ' - Amount',\n ' - Status',\n ' - Confirmation ID (if completed)',\n ].join('\\n'),\n },\n },\n ],\n })\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerBuyPrompt } from './buy.js';\nimport { registerBudgetCheckPrompt } from './budget-check.js';\nimport { registerPurchaseStatusPrompt } from './purchase-status.js';\n\nexport function registerPrompts(server: McpServer) {\n registerBuyPrompt(server);\n registerBudgetCheckPrompt(server);\n registerPurchaseStatusPrompt(server);\n}\n"],"mappings":";;;AAAA,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;;;ACF7B,SAAS,iBAAiB;AAC1B,SAAS,YAAAA,iBAAgB;;;ACDzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP,IAAM,YAID;AAAA,EACH,EAAE,MAAM,eAAe,OAAO,aAAa,YAAY,wCAAwC;AAAA,EAC/F,EAAE,MAAM,0BAA0B,OAAO,wBAAwB,YAAY,+BAA+B;AAAA,EAC5G,EAAE,MAAM,qBAAqB,OAAO,oBAAoB,YAAY,mCAAmC;AAAA,EACvG,EAAE,MAAM,kBAAkB,OAAO,gBAAgB,YAAY,8BAA8B;AAAA,EAC3F,EAAE,MAAM,qBAAqB,OAAO,mBAAmB,YAAY,wBAAwB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AG;AAChD,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":["AgentPay","z","z","z","z","z","z","z","z","AgentPay"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useagentpay/mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"mcpName": "io.github.kar69-96/agentpay",
|
|
4
5
|
"description": "MCP server for AgentPay – exposes payment tools to AI agents",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"exports": {
|
|
@@ -15,10 +16,18 @@
|
|
|
15
16
|
"files": [
|
|
16
17
|
"dist"
|
|
17
18
|
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"dev": "tsup --watch",
|
|
25
|
+
"clean": "rm -rf dist"
|
|
26
|
+
},
|
|
18
27
|
"dependencies": {
|
|
28
|
+
"@useagentpay/sdk": "workspace:*",
|
|
19
29
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
20
|
-
"zod": "^3.
|
|
21
|
-
"@useagentpay/sdk": "0.1.1"
|
|
30
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
22
31
|
},
|
|
23
32
|
"devDependencies": {
|
|
24
33
|
"@types/node": "^22.0.0",
|
|
@@ -29,13 +38,5 @@
|
|
|
29
38
|
"license": "MIT",
|
|
30
39
|
"engines": {
|
|
31
40
|
"node": ">=20"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsup",
|
|
35
|
-
"typecheck": "tsc --noEmit",
|
|
36
|
-
"test": "vitest run",
|
|
37
|
-
"test:watch": "vitest",
|
|
38
|
-
"dev": "tsup --watch",
|
|
39
|
-
"clean": "rm -rf dist"
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 AgentPay Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|