Work

MBBank-MCP - Model Context Protocol Server for MB Bank

Dev
MCP
AI
Banking
Python

A Model Context Protocol (MCP) server that enables AI assistants to securely access MB Bank account data for transaction monitoring and balance checking.

MBBank MCP Server

Project Background

After building MBBank-lib, I realized there was an opportunity to make banking data accessible to AI assistants through the Model Context Protocol (MCP). This would allow AI models to help users analyze their banking data, track expenses, and answer financial questions directly.

The MBBank-MCP server acts as a bridge between AI assistants (like Claude) and MB Bank’s systems, enabling natural language queries about account information while maintaining security through read-only access.

What MBBank-MCP Does

This MCP server provides AI assistants with tools to:

  • Retrieve real-time account balances
  • Fetch transaction history with date filtering
  • Access savings account information
  • Query card transaction details
  • Analyze spending patterns and financial data

Security First: Like the underlying MBBank-lib, this server is completely read-only - AI assistants cannot initiate transfers or perform any write operations.

Technical Architecture

The server is built on top of the MCP (Model Context Protocol) framework:

Core Components

  • mcp framework for protocol implementation
  • mbbank-lib as the underlying banking API wrapper
  • asyncio for handling concurrent banking operations
  • Secure credential management through environment variables

MCP Tools Exposed

  • get_balance: Retrieve current account balance
  • get_transaction_history: Fetch transactions with date range filtering
  • get_savings_info: Access savings account details
  • get_card_transactions: Query card-specific transaction data

Usage Example

Server Configuration

import os
from mcp.server import Server
from mbbank_mcp import MBBankMCPServer

# Configure credentials
os.environ['MBBANK_USERNAME'] = 'your_username'
os.environ['MBBANK_PASSWORD'] = 'your_password'

# Initialize MCP server
server = MBBankMCPServer()
server.run()

AI Assistant Integration

Once configured, AI assistants can naturally query your banking data:

User: "What's my current account balance?"
AI: Using the MCP server, your current MB Bank balance is 2,450,000 VND.

User: "Show me all transactions from last week"
AI: Here are your transactions from the past week:
- 2025-07-14: Transfer to John Doe (-500,000 VND)
- 2025-07-13: Salary deposit (+15,000,000 VND)
- 2025-07-12: Coffee shop purchase (-45,000 VND)

Usage

Install in Claude Desktop

Follow the MCP install guide, use the following configuration:

Note
Replace <your_username> and <your_password> with your actual MB Bank credentials.
You should not set env variables for username and password, as it errors python runtime.

{
    "mcpServers": {
        "mbbank": {
            "command": "uvx",
            "args": [
                "mbbank-mcp",
                "--username=<your_username>",
                "--password=<your_password>"
            ]
        }
    }
}

With docker, you can use the following this configuration:

{
    "mcpServers": {
        "mbbank": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "MBBANK_USERNAME",
                "-e",
                "MBBANK_PASSWORD",
                "thedtvn/mbbank-lib:latest"
            ],
            "env": {
                "MBBANK_USERNAME": "<your_username>",
                "MBBANK_PASSWORD": "<your_password>"
            }
        }
    }
}

Integration Benefits

This MCP server enables powerful AI-driven financial analysis:

  • Expense Tracking: AI can categorize and analyze spending patterns
  • Budget Monitoring: Real-time alerts when spending exceeds limits
  • Financial Insights: Natural language queries about financial health
  • Transaction Search: Find specific transactions using conversational queries

Security Considerations

The server implements several security measures:

  • Read-only access: No write operations possible
  • Credential encryption: Secure handling of banking credentials
  • Session management: Automatic login/logout handling
  • Error handling: Graceful failure without credential exposure

Project Impact

MBBank-MCP represents a new paradigm in personal finance management - making banking data accessible to AI assistants for intelligent financial analysis. This is particularly valuable for:

  • Personal financial planning and budgeting
  • Expense tracking and categorization
  • Financial health monitoring
  • Small business cash flow analysis

Repository

The complete source code and documentation are available on GitHub.


Note: This is an unofficial MCP server not endorsed by MB Bank. Ensure compliance with MB Bank’s terms of service and use appropriate security measures when handling banking credentials.