UNPKG

leonvz-banking-mcp

Version:

A comprehensive Banking MCP server for Bancon Bank - demonstrating banking tools, resources, and prompts

773 lines (746 loc) • 36.5 kB
#!/usr/bin/env node import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; import * as fs from "fs/promises"; import * as path from "path"; import { fileURLToPath } from "url"; // Data Loading Function const DATA_FILE = path.join(path.dirname(fileURLToPath(import.meta.url)), 'banking-data.json'); let bankingData = null; async function loadBankingData() { if (!bankingData) { try { const data = await fs.readFile(DATA_FILE, 'utf8'); bankingData = JSON.parse(data); console.error(`āœ… Loaded banking data from: ${DATA_FILE}`); } catch (error) { console.error(`āŒ Failed to load banking data from ${DATA_FILE}:`, error); throw new Error('Banking data file not found'); } } return bankingData; } // Create the MCP server const server = new McpServer({ name: "leonvz-banking-mcp", version: "1.1.8" }); console.error("šŸ¦ Starting Bancon Bank MCP Server..."); console.error("šŸ’° POC Banking Server - Single Customer (Leon van Zyl)"); console.error(" šŸ”§ TOOLS: Banking operations and calculations"); console.error(" šŸ“„ RESOURCES: Account data and financial information"); console.error(" šŸ’¬ PROMPTS: Financial guidance and banking assistance"); console.error(""); // ===================================== // šŸ”§ TOOLS - Actions and Computations // ===================================== console.error("šŸ¦ Registering BANKING TOOLS..."); // Account Balance Tool server.registerTool("get_account_balance", { title: "Get Account Balance", description: "Retrieve current balance for a specific account or all accounts", inputSchema: { accountId: z.string().optional().describe("Specific account ID (optional - returns all accounts if not specified)") } }, async ({ accountId }) => { try { const data = await loadBankingData(); const customer = data.customer; if (accountId) { const account = customer.accounts.find((a) => a.accountId === accountId); if (!account) { return { content: [{ type: "text", text: `āŒ Account ${accountId} not found` }], isError: true }; } return { content: [{ type: "text", text: `šŸ’° Account Balance for ${customer.name}: šŸ¦ Account: ${account.accountType} (${account.accountNumber}) šŸ’µ Balance: R${account.balance.toFixed(2)} ${account.currency} šŸ“Š Interest Rate: ${account.interestRate}% šŸ“… Account Status: ${account.status} ${account.creditLimit ? `šŸ’³ Credit Limit: R${account.creditLimit.toFixed(2)}` : ''}` }] }; } // Return all accounts const accountSummary = customer.accounts.map((account) => `• ${account.accountType} (${account.accountNumber}): R${account.balance.toFixed(2)} ${account.currency}`).join('\n'); const totalBalance = customer.accounts .filter((a) => a.accountType !== 'Credit Card') .reduce((sum, account) => sum + account.balance, 0); return { content: [{ type: "text", text: `šŸ’° Account Summary for ${customer.name}: ${accountSummary} šŸ’µ Total Deposit Balance: R${totalBalance.toFixed(2)} šŸ‘¤ Customer Type: ${customer.customerType} šŸ“… Customer Since: ${customer.customerSince}` }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Error retrieving balance: ${error}` }], isError: true }; } }); // Account Portfolio Tool server.registerTool("get_account_portfolio", { title: "Get Account Portfolio", description: "Get detailed portfolio view of all accounts organized by type", inputSchema: { accountType: z.enum(["all", "deposit", "loan", "investment", "card"]).optional().describe("Filter by account type (default: all)") } }, async ({ accountType = "all" }) => { try { const data = await loadBankingData(); const customer = data.customer; // Categorize accounts const deposits = customer.accounts.filter((a) => ['Cheque Account', '32-Day Notice Account', 'Fixed Deposit', 'Tax-Free Savings'].includes(a.accountType)); const loans = customer.accounts.filter((a) => ['Home Loan', 'Personal Loan'].includes(a.accountType)); const investments = customer.accounts.filter((a) => ['Unit Trust'].includes(a.accountType)); const cards = customer.accounts.filter((a) => ['Credit Card'].includes(a.accountType)); let content = `šŸ“Š Account Portfolio for ${customer.name}\n\n`; if (accountType === "all" || accountType === "deposit") { content += `šŸ’° DEPOSIT ACCOUNTS:\n`; deposits.forEach((account) => { content += `• ${account.accountType} (${account.accountNumber})\n`; content += ` Balance: R${account.balance.toFixed(2)}\n`; content += ` Interest Rate: ${account.interestRate}%\n`; content += ` Status: ${account.status}\n\n`; }); } if (accountType === "all" || accountType === "loan") { content += `šŸ  LOAN ACCOUNTS:\n`; loans.forEach((account) => { content += `• ${account.accountType} (${account.accountNumber})\n`; content += ` Outstanding: R${Math.abs(account.balance).toFixed(2)}\n`; content += ` Interest Rate: ${account.interestRate}%\n`; if (account.loanAmount) content += ` Original Amount: R${account.loanAmount.toFixed(2)}\n`; if (account.term) content += ` Term: ${account.term}\n`; content += ` Status: ${account.status}\n\n`; }); } if (accountType === "all" || accountType === "investment") { content += `šŸ“ˆ INVESTMENT ACCOUNTS:\n`; investments.forEach((account) => { content += `• ${account.accountType} (${account.accountNumber})\n`; content += ` Value: R${account.balance.toFixed(2)}\n`; content += ` Expected Return: ${account.interestRate}%\n`; content += ` Status: ${account.status}\n\n`; }); } if (accountType === "all" || accountType === "card") { content += `šŸ’³ CARD ACCOUNTS:\n`; cards.forEach((account) => { content += `• ${account.accountType} (${account.accountNumber})\n`; content += ` Balance: R${account.balance.toFixed(2)}\n`; content += ` Credit Limit: R${account.creditLimit.toFixed(2)}\n`; content += ` Available Credit: R${(account.creditLimit + account.balance).toFixed(2)}\n`; content += ` Interest Rate: ${account.interestRate}%\n`; content += ` Status: ${account.status}\n\n`; }); } if (accountType === "all") { const totalDeposits = deposits.reduce((sum, a) => sum + a.balance, 0); const totalLoans = loans.reduce((sum, a) => sum + Math.abs(a.balance), 0); const totalInvestments = investments.reduce((sum, a) => sum + a.balance, 0); const totalCreditUsed = cards.reduce((sum, a) => sum + Math.abs(a.balance), 0); content += `šŸ“‹ PORTFOLIO SUMMARY:\n`; content += `• Total Deposits: R${totalDeposits.toFixed(2)}\n`; content += `• Total Investments: R${totalInvestments.toFixed(2)}\n`; content += `• Total Loan Debt: R${totalLoans.toFixed(2)}\n`; content += `• Credit Card Debt: R${totalCreditUsed.toFixed(2)}\n`; content += `• Net Worth: R${(totalDeposits + totalInvestments - totalLoans - totalCreditUsed).toFixed(2)}\n`; } return { content: [{ type: "text", text: content }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Failed to retrieve account portfolio: ${error}` }], isError: true }; } }); // Transaction History Tool server.registerTool("get_transaction_history", { title: "Get Transaction History", description: "Retrieve transaction history for a specific account", inputSchema: { accountId: z.string().describe("Account ID"), limit: z.number().optional().describe("Maximum number of transactions to return (default: 10)"), startDate: z.string().optional().describe("Start date for transactions (YYYY-MM-DD format)"), endDate: z.string().optional().describe("End date for transactions (YYYY-MM-DD format)") } }, async ({ accountId, limit = 10, startDate, endDate }) => { try { const data = await loadBankingData(); const customer = data.customer; const transactions = data.transactions; // Find account to get customer info const account = customer.accounts.find((a) => a.accountId === accountId); if (!account) { return { content: [{ type: "text", text: `āŒ Account ${accountId} not found` }], isError: true }; } // Filter transactions for this account let accountTransactions = transactions .filter((txn) => txn.accountId === accountId) .sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()); // Apply date filters if provided if (startDate) { const start = new Date(startDate); accountTransactions = accountTransactions.filter((txn) => new Date(txn.date) >= start); } if (endDate) { const end = new Date(endDate); accountTransactions = accountTransactions.filter((txn) => new Date(txn.date) <= end); } // Limit results accountTransactions = accountTransactions.slice(0, limit); if (accountTransactions.length === 0) { return { content: [{ type: "text", text: `šŸ“‹ No transactions found for account ${account.accountNumber}` }] }; } const transactionList = accountTransactions.map((txn) => { const date = new Date(txn.date).toLocaleDateString(); const amount = txn.amount > 0 ? `+R${txn.amount.toFixed(2)}` : `-R${Math.abs(txn.amount).toFixed(2)}`; const amountColor = txn.amount > 0 ? "šŸ’š" : "šŸ”“"; return `${amountColor} ${date} - ${txn.description} - ${amount} (${txn.merchant})`; }).join('\n'); return { content: [{ type: "text", text: `šŸ“‹ Transaction History for ${customer.name} šŸ¦ Account: ${account.accountType} (${account.accountNumber}) šŸ’° Current Balance: R${account.balance.toFixed(2)} šŸ“… Showing ${accountTransactions.length} transactions: ${transactionList} ${accountTransactions.length >= limit ? `\nšŸ“ Note: Limited to ${limit} transactions. Use different date range or limit for more results.` : ''}` }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Failed to retrieve transaction history: ${error}` }], isError: true }; } }); // Rewards Points Tool server.registerTool("get_reward_points", { title: "Get Reward Points", description: "Get bBucks reward points balance, earning history, and tier information", inputSchema: { includeHistory: z.boolean().optional().describe("Whether to include recent earning history (default: true)") } }, async ({ includeHistory = true }) => { try { const data = await loadBankingData(); const rewards = data.rewards; let rewardsSummary = `šŸŽÆ bBucks Rewards Summary for ${rewards.customerName}: šŸ’Ž Tier Level: ${rewards.tierLevel} šŸ† Member Since: ${rewards.memberSince} šŸŽ Current Points: ${rewards.currentPoints.toLocaleString()} bBucks šŸ“Š Lifetime Earned: ${rewards.lifetimePointsEarned.toLocaleString()} bBucks šŸ’ø Points Redeemed: ${rewards.pointsRedeemed.toLocaleString()} bBucks ā° Points Expiring: ${rewards.pointsExpiring.amount.toLocaleString()} on ${rewards.pointsExpiring.expiryDate} šŸ’° Earning Rates: • Groceries: ${rewards.earningRates.groceries}x points • Fuel: ${rewards.earningRates.fuel}x points • Restaurants: ${rewards.earningRates.restaurants}x points • Online Shopping: ${rewards.earningRates.onlineShopping}x points • Base Purchases: ${rewards.earningRates.basePurchases}x points`; return { content: [{ type: "text", text: rewardsSummary }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Failed to retrieve reward points: ${error}` }], isError: true }; } }); // Available Rewards Tool server.registerTool("get_available_rewards", { title: "Get Available Rewards", description: "Get available rewards from the bBucks catalog that can be redeemed", inputSchema: { category: z.enum(["all", "electronics", "vouchers", "dining", "fuel"]).optional().describe("Filter rewards by category (default: all)"), maxPoints: z.number().optional().describe("Maximum points to spend (default: user's current points)") } }, async ({ category = "all", maxPoints }) => { try { const data = await loadBankingData(); const rewards = data.rewards; if (!maxPoints) { maxPoints = rewards.currentPoints; } let availableRewards = rewards.availableRewards; // Filter by category if specified if (category !== "all") { availableRewards = availableRewards.filter((reward) => reward.category.toLowerCase().includes(category.toLowerCase())); } // Filter by points available const affordableRewards = availableRewards.filter((reward) => reward.pointsRequired <= (maxPoints || 0)); if (availableRewards.length === 0) { return { content: [{ type: "text", text: `No rewards found for category: ${category}` }] }; } let content = `šŸŽ Available bBucks Rewards\n`; content += `šŸ’Ž Your Points: ${rewards.currentPoints.toLocaleString()} bBucks\n`; content += `šŸ“Š Showing ${category === "all" ? "all categories" : category} rewards\n\n`; if (affordableRewards.length > 0) { content += `āœ… REWARDS YOU CAN AFFORD:\n`; affordableRewards.forEach((reward) => { content += `• ${reward.name}\n`; content += ` Points: ${reward.pointsRequired.toLocaleString()} bBucks\n`; content += ` Value: R${reward.cashValue.toFixed(2)}\n`; content += ` Category: ${reward.category}\n`; content += ` ${reward.description}\n\n`; }); } const expensiveRewards = availableRewards.filter((reward) => reward.pointsRequired > (maxPoints || 0)); if (expensiveRewards.length > 0) { content += `šŸ’ø REWARDS REQUIRING MORE POINTS:\n`; expensiveRewards.forEach((reward) => { const pointsNeeded = reward.pointsRequired - rewards.currentPoints; content += `• ${reward.name}\n`; content += ` Points: ${reward.pointsRequired.toLocaleString()} bBucks\n`; content += ` Need: ${pointsNeeded.toLocaleString()} more points\n`; content += ` Value: R${reward.cashValue.toFixed(2)}\n`; content += ` Category: ${reward.category}\n\n`; }); } return { content: [{ type: "text", text: content }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Failed to retrieve available rewards: ${error}` }], isError: true }; } }); // Bank Information Tool server.registerTool("get_bank_info", { title: "Get Bank Information", description: "Get comprehensive bank contact information, private banker details, and important banking information", inputSchema: { infoType: z.enum(["all", "contact", "private_banker", "branches", "emergency", "online_banking"]).optional().describe("Type of information to retrieve (default: all)") } }, async ({ infoType = "all" }) => { try { const data = await loadBankingData(); const bankInfo = data.bankInfo; let content = `šŸ¦ ${bankInfo.fullName}\n\n`; if (infoType === "all" || infoType === "contact") { content += `šŸ“ž MAIN CONTACT INFORMATION:\n`; content += `• Customer Service: ${bankInfo.contactInfo.customerService}\n`; content += `• Phone: ${bankInfo.contactInfo.phone}\n`; content += `• Email: ${bankInfo.contactInfo.email}\n`; content += `• Website: ${bankInfo.contactInfo.website}\n`; content += `• Address: ${bankInfo.contactInfo.address.street}, ${bankInfo.contactInfo.address.city}, ${bankInfo.contactInfo.address.zipCode}\n\n`; } if (infoType === "all" || infoType === "private_banker") { content += `šŸ‘¤ YOUR PRIVATE BANKER:\n`; content += `• Name: ${bankInfo.privateBanker.name}\n`; content += `• Title: ${bankInfo.privateBanker.title}\n`; content += `• Phone: ${bankInfo.privateBanker.phone}\n`; content += `• Mobile: ${bankInfo.privateBanker.mobile}\n`; content += `• Email: ${bankInfo.privateBanker.email}\n`; content += `• Office: ${bankInfo.privateBanker.officeLocation}\n`; content += `• Availability: ${bankInfo.privateBanker.availability}\n\n`; } if (infoType === "all" || infoType === "branches") { content += `šŸ¢ BRANCH LOCATIONS:\n`; bankInfo.branches.forEach((branch) => { content += `• ${branch.name}\n`; content += ` Address: ${branch.address}\n`; content += ` Phone: ${branch.phone}\n`; content += ` Hours: ${branch.hours.weekdays} (Mon-Fri), ${branch.hours.saturday} (Sat), ${branch.hours.sunday} (Sun)\n`; content += ` Services: ${branch.services.join(', ')}\n\n`; }); } if (infoType === "all" || infoType === "emergency") { content += `🚨 EMERGENCY CONTACTS:\n`; content += `• Lost/Stolen Card: ${bankInfo.emergencyContacts.lostCard}\n`; content += `• Fraud Reporting: ${bankInfo.emergencyContacts.fraudReporting}\n`; content += `• After Hours: ${bankInfo.emergencyContacts.afterHours}\n`; content += `• International Collect: ${bankInfo.emergencyContacts.internationalCollect}\n\n`; } if (infoType === "all" || infoType === "online_banking") { content += `šŸ’» ONLINE BANKING:\n`; content += `• Website: ${bankInfo.onlineBanking.website}\n`; content += `• Mobile App: ${bankInfo.onlineBanking.mobileApp}\n`; content += `• Support: ${bankInfo.onlineBanking.support}\n`; content += `• Availability: ${bankInfo.onlineBanking.hours}\n\n`; } if (infoType === "all") { content += `ā„¹ļø BANK INFORMATION:\n`; content += `• Established: ${bankInfo.establishedYear}\n`; content += `• Registration: ${bankInfo.registrationNumber}\n`; content += `• Base Currency: ${bankInfo.baseCurrency}\n`; content += `• Region: ${bankInfo.region}, ${bankInfo.country}\n`; } return { content: [{ type: "text", text: content }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Failed to retrieve bank information: ${error}` }], isError: true }; } }); // Interest Rates Tool server.registerTool("get_interest_rates", { title: "Get Interest Rates", description: "Get current interest rates for deposits, loans, and investments", inputSchema: { category: z.enum(["deposit", "loan", "investment", "all"]).optional().describe("Rate category to retrieve (default: all)") } }, async ({ category = "all" }) => { try { const data = await loadBankingData(); const rates = data.interestRates; const lastUpdated = new Date(rates.lastUpdated).toLocaleString(); let content = `šŸ’° Bancon Bank Interest Rates\nšŸ“… Last Updated: ${lastUpdated}\n\n`; if (category === "deposit" || category === "all") { content += `šŸ¦ DEPOSIT RATES:\n`; content += `Cheque Accounts:\n`; content += `• Standard: ${rates.deposit.chequeAccount.standard}%\n`; content += `• Gold: ${rates.deposit.chequeAccount.gold}%\n`; content += `• Platinum: ${rates.deposit.chequeAccount.platinum}%\n\n`; content += `Savings Accounts:\n`; content += `• Standard: ${rates.deposit.savings.standard}%\n`; content += `• Gold: ${rates.deposit.savings.gold}%\n`; content += `• Platinum: ${rates.deposit.savings.platinum}%\n`; content += `• 32-Day Notice: ${rates.deposit.savings.notice32Day}%\n`; content += `• 90-Day Notice: ${rates.deposit.savings.notice90Day}%\n\n`; content += `Fixed Deposits:\n`; content += `• 1 month: ${rates.deposit.fixedDeposit["1month"]}%\n`; content += `• 3 months: ${rates.deposit.fixedDeposit["3months"]}%\n`; content += `• 6 months: ${rates.deposit.fixedDeposit["6months"]}%\n`; content += `• 12 months: ${rates.deposit.fixedDeposit["12months"]}%\n`; content += `• 24 months: ${rates.deposit.fixedDeposit["24months"]}%\n`; content += `• 36 months: ${rates.deposit.fixedDeposit["36months"]}%\n\n`; content += `Tax-Free Savings:\n`; content += `• Standard: ${rates.deposit.taxFreeSavings.standard}%\n`; content += `• Premium: ${rates.deposit.taxFreeSavings.premium}%\n\n`; } if (category === "loan" || category === "all") { content += `šŸ  LOAN RATES:\n`; content += `Personal Loans:\n`; content += `• Standard: ${rates.loan.personal.standard}%\n`; content += `• Gold: ${rates.loan.personal.gold}%\n`; content += `• Platinum: ${rates.loan.personal.platinum}%\n\n`; content += `Vehicle Finance:\n`; content += `• New Vehicle: ${rates.loan.vehicleFinance.new}%\n`; content += `• Used Vehicle: ${rates.loan.vehicleFinance.used}%\n`; content += `• Demo Vehicle: ${rates.loan.vehicleFinance.demo}%\n\n`; content += `Home Loans:\n`; content += `• Variable Rate: ${rates.loan.homeLoan.variable}%\n`; content += `• Fixed 1 Year: ${rates.loan.homeLoan.fixed1year}%\n`; content += `• Fixed 2 Year: ${rates.loan.homeLoan.fixed2year}%\n`; content += `• Fixed 3 Year: ${rates.loan.homeLoan.fixed3year}%\n\n`; content += `Credit Cards:\n`; content += `• Standard: ${rates.loan.creditCard.standard}%\n`; content += `• Gold: ${rates.loan.creditCard.gold}%\n`; content += `• Platinum: ${rates.loan.creditCard.platinum}%\n\n`; content += `Overdraft:\n`; content += `• Arranged: ${rates.loan.overdraft.arranged}%\n`; content += `• Unarranged: ${rates.loan.overdraft.unarranged}%\n\n`; } if (category === "investment" || category === "all") { content += `šŸ“ˆ INVESTMENT RATES:\n`; content += `• Repo Rate: ${rates.investment.repoRate}%\n`; content += `• Prime Rate: ${rates.investment.primeRate}%\n\n`; content += `Unit Trusts:\n`; content += `• Balanced: ${rates.investment.unitTrusts.balanced}%\n`; content += `• Equity: ${rates.investment.unitTrusts.equity}%\n`; content += `• Conservative: ${rates.investment.unitTrusts.conservative}%\n`; content += `• International: ${rates.investment.unitTrusts.international}%\n\n`; content += `Government Bonds:\n`; content += `• 2 Year: ${rates.investment.governmentBonds["2year"]}%\n`; content += `• 5 Years: ${rates.investment.governmentBonds["5year"]}%\n`; content += `• 10 Years: ${rates.investment.governmentBonds["10year"]}%\n`; content += `• 20 Years: ${rates.investment.governmentBonds["20year"]}%\n\n`; } content += `šŸ’± EXCHANGE RATES (Base: ${data.exchangeRates.baseCurrency}):\n`; Object.entries(data.exchangeRates.rates).forEach(([currency, rate]) => { content += `• ${currency}: ${rate}\n`; }); return { content: [{ type: "text", text: content }] }; } catch (error) { return { content: [{ type: "text", text: `āŒ Failed to retrieve interest rates: ${error}` }], isError: true }; } }); // ===================================== // šŸ“„ RESOURCES - Data Access // ===================================== console.error("šŸ“„ Registering BANKING RESOURCES..."); // Customer Profile Resource server.registerResource("customer-profile", "customer://profile", { title: "Customer Profile", description: "Get customer profile and account information", mimeType: "application/json" }, async (uri) => { try { const data = await loadBankingData(); const customer = data.customer; // Calculate total balances const totalDeposits = customer.accounts .filter((a) => a.accountType !== 'Credit Card') .reduce((sum, account) => sum + account.balance, 0); const totalCredit = customer.accounts .filter((a) => a.accountType === 'Credit Card') .reduce((sum, account) => sum + (account.creditLimit || 0), 0); const creditUtilization = customer.accounts .filter((a) => a.accountType === 'Credit Card') .reduce((sum, account) => sum + Math.abs(account.balance || 0), 0); return { contents: [{ uri: uri.href, text: JSON.stringify({ customerProfile: customer, summary: { totalDepositBalance: totalDeposits, totalCreditLimit: totalCredit, creditUtilization: creditUtilization, numberOfAccounts: customer.accounts.length, lastAccessed: new Date().toISOString(), profileComplete: true } }, null, 2), mimeType: "application/json" }] }; } catch (error) { return { contents: [{ uri: uri.href, text: JSON.stringify({ error: "Failed to load customer data" }), mimeType: "application/json" }] }; } }); // ===================================== // šŸ’¬ PROMPTS - Banking Tool Helpers // ===================================== console.error("šŸ’¬ Registering BANKING PROMPTS..."); // Account Overview Prompt server.registerPrompt("account-overview", { title: "Complete Account Overview", description: "Get a comprehensive view of all your banking accounts and financial position" }, () => { return { messages: [{ role: "user", content: { type: "text", text: `Please help me get a complete overview of my banking accounts and financial position. I'd like to see: 1. My complete account portfolio (use get_account_portfolio tool) 2. Current balances for all accounts (use get_account_balance tool) 3. My bBucks rewards status and points balance (use get_reward_points tool) Please organize this information in a clear, easy-to-understand format and highlight any important insights about my financial position, such as: - Total assets vs. liabilities - Available credit - Rewards program benefits - Any accounts that might need attention This will help me understand my overall financial health with Bancon Bank.` } }] }; }); // Rewards Explorer Prompt server.registerPrompt("explore-rewards", { title: "Explore bBucks Rewards Program", description: "Discover your bBucks points balance and available rewards" }, () => { return { messages: [{ role: "user", content: { type: "text", text: `I'd like to explore my bBucks rewards program benefits and see what rewards are available to me. Please help me: 1. Check my current bBucks points balance and rewards history (use get_reward_points tool) 2. Show me available rewards I can redeem with my current points (use get_available_rewards tool) 3. Highlight any rewards that I can afford with my current points 4. Explain my tier level benefits and earning rates Please organize this information to help me: - Understand my rewards program status - Find the best rewards for my point balance - Learn how to earn more points - Make smart redemption decisions I want to maximize the value I get from my bBucks rewards!` } }] }; }); // View Portfolio Prompt server.registerPrompt("view-portfolio", { title: "View My Account Portfolio", description: "See all your banking accounts organized by type with balances and details", argsSchema: { focusArea: z.enum(["all", "deposit", "loan", "investment", "card"]).optional().describe("Focus on specific account types or view all") } }, ({ focusArea = "all" }) => { const areaDescriptions = { all: "complete account portfolio", deposit: "deposit accounts (cheque, savings, fixed deposits)", loan: "loan accounts (home loan, personal loan, vehicle finance)", investment: "investment accounts (unit trusts, tax-free savings)", card: "card accounts (credit cards, debit cards)" }; return { messages: [{ role: "user", content: { type: "text", text: `Please show me my ${areaDescriptions[focusArea]} with detailed information. Use the get_account_portfolio tool${focusArea !== "all" ? ` with accountType="${focusArea}"` : ""} to display: 1. Account numbers and IDs for easy reference 2. Current balances for each account 3. Interest rates and terms 4. Account status and important dates 5. Credit limits (for credit accounts) 6. Portfolio summary and totals Please organize this information clearly and highlight: - Accounts with significant balances - Any accounts approaching limits or important dates - Opportunities to optimize my banking relationship - Quick actions I can take with these accounts This will help me understand and manage my banking portfolio effectively.` } }] }; }); // Banking Tools Prompt server.registerPrompt("banking-tools", { title: "Banking Tools Overview", description: "Learn about available banking tools and how to use them effectively" }, () => { return { messages: [{ role: "user", content: { type: "text", text: `Please explain what banking tools are available to me and how I can use them effectively. I'd like to understand: 1. What banking tools are available through this system 2. How each tool can help me manage my finances 3. Examples of when to use each tool 4. Any tips for getting the most out of these banking services Please provide a comprehensive overview that will help me make the most of my banking relationship with Bancon Bank.` } }] }; }); // Bank Info Prompt server.registerPrompt("bank-info", { title: "Get Bank Information", description: "Access bank contact details, private banker info, and important banking information", argsSchema: { infoNeeded: z.enum(["contact", "private_banker", "branches", "emergency", "online_banking", "everything"]).optional().describe("Type of bank information needed") } }, ({ infoNeeded = "everything" }) => { const infoDescriptions = { contact: "main contact information and customer service details", private_banker: "your dedicated private banker contact information", branches: "branch locations, addresses, and operating hours", emergency: "emergency contact numbers for urgent banking needs", online_banking: "online banking and mobile app information", everything: "comprehensive bank information including all contact details" }; return { messages: [{ role: "user", content: { type: "text", text: `I need ${infoDescriptions[infoNeeded]} for Bancon Bank. Please use the get_bank_info tool${infoNeeded !== "everything" ? ` with infoType="${infoNeeded}"` : ""} to provide me with: ${infoNeeded === "everything" || infoNeeded === "contact" ? "• Main bank contact information and customer service numbers" : ""} ${infoNeeded === "everything" || infoNeeded === "private_banker" ? "• My private banker's contact details and availability" : ""} ${infoNeeded === "everything" || infoNeeded === "branches" ? "• Branch locations, addresses, and operating hours" : ""} ${infoNeeded === "everything" || infoNeeded === "emergency" ? "• Emergency contact numbers for lost cards, fraud reporting, etc." : ""} ${infoNeeded === "everything" || infoNeeded === "online_banking" ? "• Online banking website and mobile app information" : ""} Please organize this information clearly so I can easily find and use the contact details I need.` } }] }; }); // Quick Balance Prompt server.registerPrompt("quick-balance", { title: "Quick Financial Check-in", description: "Get a quick snapshot of your current financial position" }, () => { return { messages: [{ role: "user", content: { type: "text", text: `I'd like a quick check-in on my financial position with Bancon Bank. Please give me a brief summary using: 1. get_account_balance tool - to see my current account balances 2. get_reward_points tool - to check my bBucks points balance Keep it concise but informative - I just want to know: - How much money I have available - My bBucks rewards status - Any immediate insights or recommendations This is for a quick financial health check.` } }] }; }); // ===================================== // Server Startup // ===================================== async function main() { console.error("šŸ’¼ Banking tools registered:"); console.error(" šŸ”§ Banking Tools: get_account_balance, get_account_portfolio, get_transaction_history, get_reward_points, get_available_rewards, get_bank_info, get_interest_rates"); console.error(" šŸ“„ Banking Resources: customer-profile"); console.error(" šŸ’¬ Tool Helper Prompts: account-overview, explore-rewards, view-portfolio, banking-tools, bank-info, quick-balance"); console.error(""); const transport = new StdioServerTransport(); await server.connect(transport); console.error("āœ… Bancon Bank MCP Server running successfully!"); } main().catch((error) => { console.error("Failed to start banking server:", error); process.exit(1); });