Dependency Management
Relevant source files
The following files were used as context for generating this wiki page:
Dependency management in the mbbank-mcp project is centered around the Python packaging ecosystem, specifically leveraging setuptools for builds and uv for environment orchestration. The project functions as a Model Context Protocol (MCP) server that bridges the mbbank-lib library with MCP-compatible clients like Claude Desktop.
The management strategy ensures that the application has access to necessary networking protocols (SSE and Stdio), banking API wrappers, and utility libraries for QR code generation and image processing. This allows the server to handle complex flows like bank transfers and transaction monitoring.
Sources: pyproject.toml:1-15, README.md:1-10
Core Project Dependencies
The project defines its required packages within the [project].dependencies section of the configuration file. These dependencies are categorized by their role in the server's operation:
Dependency Overview Table
| Dependency | Purpose | Source File |
|---|---|---|
mcp | Provides the core Model Context Protocol server implementation. | pyproject.toml:16 |
mbbank-lib | The underlying library used to communicate with MBBank APIs. | pyproject.toml:17 |
click | Used for creating the Command Line Interface (CLI). | pyproject.toml:18 |
uvicorn | ASGI server implementation for running the SSE/HTTP server. | pyproject.toml:19 |
starlette | Lightweight ASGI framework used for routing and middleware. | pyproject.toml:20 |
qrcode[pil] | Generates QR codes for D-OTP authentication during transfers. | pyproject.toml:21 |
pillow | Image processing library for handling QR code rendering. | pyproject.toml:22 |
Sources: pyproject.toml:15-23, mbbank_mcp/core.py:1-15
Dependency Flow and Architecture
The application's architecture is a layer built on top of these dependencies. The FastMCP class from the mcp package acts as the primary orchestrator, while MBBankAsync from mbbank-lib handles the data retrieval.
Application Dependency Map
The following diagram illustrates how the core dependencies interact to provide the MCP server functionality:
The CLI layer uses click to parse options like --username and --sse. If SSE mode is enabled, uvicorn and starlette are used to host the web server. The core logic relies on mbbank-lib for bank interactions and qrcode for generating visual confirmation cues.
Sources: mbbank_mcp/main.py:22-40, mbbank_mcp/core.py:44-88, pyproject.toml:27-31
Build and Versioning Configuration
The project utilizes modern Python packaging standards to manage its lifecycle and metadata.
Setuptools and Build System
The project uses setuptools as the build backend, as specified in the build-system requirements. It is configured to include package data and automatically find the mbbank_mcp package.
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
Sources: pyproject.toml:34-36
Dynamic Versioning
The version number is not hardcoded in pyproject.toml. Instead, it is dynamically retrieved from the mbbank_mcp.__version__ attribute defined in the package initialization.
# mbbank_mcp/__init__.py
from .core import crate_mcp_server
__version__ = "0.0.7"
Sources: mbbank_mcp/init.py:1-4, pyproject.toml:31-32
Runtime Environment Management
The project specifically recommends using uv for managing the execution environment. This is reflected in the installation instructions and the use of uvx (the uv extension runner) for both local and containerized execution.
Execution Flow with uv
Sources: README.md:12-30, pyproject.toml:27
Conclusion
Dependency management for mbbank-mcp is designed to be minimal but robust, relying on standard Python tools. By externalizing the banking logic to mbbank-lib and the protocol logic to the mcp library, the project maintains a clear separation of concerns while providing a full-featured interface for bank account monitoring and transaction processing.