Docker Deployment
Relevant source files
The following files were used as context for generating this wiki page:
The MBBank MCP (Model Context Protocol) server supports deployment via Docker, providing a containerized environment for monitoring and analyzing MBBank transactions and balances. This deployment method encapsulates the Python runtime and necessary dependencies, such as mcp, mbbank-lib, and uvicorn, ensuring a consistent execution environment regardless of the host system.
Docker deployment primarily focuses on the stdio communication mode for integration with MCP clients like Claude Desktop. It utilizes environment variables for authentication and leverages the image thedtvn/mbbank-mcp:latest to execute the server entry point defined in the project configuration.
Sources: README.md:1-2, README.md:37-56, pyproject.toml:13-21
Container Configuration and Execution
Docker deployment utilizes the standard docker run command to instantiate the server. The container is designed to run in interactive mode (-i) to facilitate communication over standard input/output (stdio), which is the default transport protocol for MCP servers when not explicitly set to SSE mode.
Execution Flow
The following diagram illustrates the initialization process when running the MCP server via Docker:
The server validates credentials at startup before entering the main event loop.
Sources: README.md:37-56, mbbank_mcp/main.py:32-41, mbbank_mcp/main.py:82-84
Configuration Parameters
Configuration is handled through Docker environment variables and command-line arguments passed to the containerized entry point.
| Variable/Argument | Type | Description | Required |
|---|---|---|---|
MBBANK_USERNAME | Env Var | MBBank account username | Yes |
MBBANK_PASSWORD | Env Var | MBBank account password | Yes |
-i | Flag | Interactive mode for Stdio communication | Yes |
--rm | Flag | Automatically remove container on exit | Recommended |
Sources: README.md:43-56, mbbank_mcp/main.py:23-28
Integration with MCP Clients
When deployed via Docker, the server is typically integrated into an MCP client configuration (e.g., claude_desktop_config.json). The client manages the Docker lifecycle, passing the necessary environment variables and handling the stdio stream.
Claude Desktop Configuration Example
{
"mcpServers": {
"mbbank": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"MBBANK_USERNAME",
"-e",
"MBBANK_PASSWORD",
"thedtvn/mbbank-mcp:latest"
],
"env": {
"MBBANK_USERNAME": "<your_username>",
"MBBANK_PASSWORD": "<your_password>"
}
}
}
}
Sources: README.md:37-56
Runtime Dependencies and Environment
The Docker image encapsulates a Python 3.10+ environment. The core logic relies on several key packages defined in the project metadata which are included in the build.
Core Components
- FastMCP: Used to create the server instance and register tools like
get_balancesandget_transactions. - mbbank-lib: Provides the underlying
MBBankAsyncclient for API communication. - Uvicorn/Starlette: While primarily used for SSE mode, these are included in the environment for alternative web-based deployments.
- Pillow/QRCode: Used for generating QR codes during transfer operations.
Visual representation of the container internal structure.
Sources: pyproject.toml:13-21, mbbank_mcp/core.py:17-21, mbbank_mcp/main.py:1-10
Security Considerations for Docker
The Docker deployment model emphasizes security through environment variable isolation. Users are advised not to set credentials directly in the Python runtime environment but to pass them via Docker's environment handling to avoid errors and sensitive data exposure in process listings.
- Credential Handling: The application reads
MBBANK_USERNAMEandMBBANK_PASSWORDdirectly from the OS environment inside the container. - Read-Only Scope: The server is designed for monitoring and analytics; it does not support money transfers or withdrawals, reducing the risk profile of the containerized instance.
- Session Management: For tools requiring higher security like
start_transfer, the server manages short-lived (120 seconds) session IDs (sid) and QR codes within the container memory.
Sources: README.md:20-22, README.md:67-73, mbbank_mcp/core.py:65-74
Summary
Docker deployment of mbbank-mcp provides a streamlined, isolated method for running the MBBank MCP server. By utilizing the thedtvn/mbbank-mcp:latest image and standard Docker environment configurations, users can quickly integrate MBBank monitoring capabilities into MCP-compatible clients while maintaining environmental consistency and security.