Skip to main content

The bank2ai Python library

bank2ai is the reference implementation of the bank2ai specification. It exists to make the easiest path to a compliant server also the safest one.

What's in the box

from bank2ai import (
# Models
Account, Transaction, Category, Recipient,
TransactionsSummary, TransferPreparedResponse, ExecuteTransferResponse,
CreateRecipientResponse,
# MCP wiring
register_tools, Handler,
)
ModuleResponsibility
bank2ai.modelsPydantic models for every bank2ai input/output shape.
bank2ai.toolsregister_tools(app, ...), wires bank2ai tools onto a FastMCP app. Pass handlers for the subset of the surface you implement.

That's it. There's no auth layer, no HTTP client, no framework lock-in. The library does one job: it makes sure your server speaks the spec correctly.

When to use it

ScenarioUse the library?
Building a bank2ai server in PythonYes, start here.
Building a server in another languageNo, implement against specs/bank2ai.json directly.
Building a bank2ai clientNo, clients use the MCP tools/list response from each server. The schemas in bank2ai.json are useful for code generation.
Building agent skills on topNo, skills consume tool calls; they don't import this library.

Design principles

  • Schemas are fixed by the spec. The library does not let you rename a tool, change a field name, or alter a type.
  • Authentication is your problem. The library does not provide one. See Authentication for patterns.
  • Handlers, not classes. You provide async callables for the tools you want to expose; the library wires them up. No subclassing required, and every handler is optional.
  • Pydantic in, Pydantic out. Handlers may return either dicts shaped like the response model or model instances directly, FastMCP serializes both.

Next