Skip to main content
Glama

pacs008-mcp: An MCP Server for ISO 20022 FI-to-FI Credit Transfers

pacs008-mcp banner

A Model Context Protocol server that exposes the pacs008 ISO 20022 FI-to-FI Customer Credit Transfer library as tools for AI agents and assistants — discover message types and scheme profiles, validate records against the JSON Schema and against a rail's usage guidelines, generate validated XML, validate raw XML against the bundled XSD, and parse inbound messages, all from your favourite MCP client.

Latest release: v0.0.16: 16 MCP tools over stdio, streamable HTTP or SSE, all backed by the pacs008 library, for Python 3.11+ (3.10 is no longer supported). The release SBOMs now describe the runtime set the image ships, not the build tooling.

Contents

Related MCP server: Pactus

Overview

The Model Context Protocol (MCP) is an open standard that lets AI agents and assistants discover and call external tools in a uniform way. pacs008-mcp is an MCP server that turns the pacs008 library into a set of first-class agent tools, so an assistant can generate, validate, and parse ISO 20022 pacs.008 FI-to-FI Customer Credit Transfer XML messages — and the related pacs.002/.004 status and return messages — directly from a conversation.

Every tool is a thin, typed wrapper over the pacs008 library — the same package used by the CLI and REST API — so all interfaces behave identically. Tools return JSON-serialisable data; on a validation error they return an {"error": ...} payload rather than raising.

flowchart LR
    A["MCP client<br/>(Claude Desktop, IDE, agent)"] -->|stdio| B["pacs008-mcp"]
    B -->|delegates to| C["pacs008 library"]
    C -->|render + validate| D["ISO 20022 pacs XML"]

Install

pacs008-mcp runs on macOS, Linux, and Windows and requires Python 3.11+ and pip. It pulls in the core pacs008 library and the MCP SDK automatically.

python -m pip install pacs008-mcp

Note: while the core pacs008 library is not yet on PyPI, install it from source first:

python -m pip install "git+https://github.com/sebastienrousseau/pacs008.git"
python -m pip install pacs008-mcp

Quick Start

Launch the server over stdio (the default transport):

pacs008-mcp

Register it with any MCP client (e.g. Claude Desktop) by adding it to the client's configuration:

{
  "mcpServers": {
    "pacs008": { "command": "pacs008-mcp" }
  }
}

Transports

One command line, three transports:

Command

Transport

Endpoint

Protocol revisions

pacs008-mcp

stdio

the client spawns the process

2026-07-28, 2025-11-25

pacs008-mcp --transport streamable-http

Streamable HTTP

http://127.0.0.1:8000/mcp

2026-07-28 (stateless, server/discover) and 2025-11-25 (initialize, Mcp-Session-Id) on the same endpoint; responses stream as server-sent events, GET opens the server-to-client stream

pacs008-mcp --transport sse

HTTP+SSE (2024-11-05)

http://127.0.0.1:8000/sse and /messages/

for clients that still expect the older transport

--host and --port change the bind address (defaults 127.0.0.1 and 8000). The HTTP transports carry no authentication of their own: bind loopback, or put the server behind a gateway you trust before binding a routable address. Every release is verified over streamable HTTP with passmcp in both protocol eras and over SSE with the MCP SDK client; see ADR 0001.

{
  "mcpServers": {
    "pacs008": { "url": "http://127.0.0.1:8000/mcp" }
  }
}

Tools

All tools wrap the pacs008 library, so they behave identically to the CLI and REST API.

  • list_message_types — List the 20 supported ISO 20022 pacs message types

  • list_schemes — List the registered scheme / usage-guideline profiles

  • get_scheme — Inspect a scheme profile's rules

  • get_required_fields — Required input fields for a message type

  • get_input_schema — Full input JSON Schema for a message type

  • validate_records — Validate flat records against a message type's schema

  • validate_scheme — Validate records against a scheme's usage guidelines

  • generate_message — Generate a validated pacs XML message

  • validate_xml — Validate a raw XML string against the bundled XSD

  • parse_message — Parse & classify an inbound ISO 20022 message

  • convert_mt103 — Convert a legacy SWIFT MT103 into pacs.008-ready records (MT→MX migration)

  • classify_address — Classify a postal address as structured / hybrid / unstructured

  • validate_address — Validate one postal address against an address policy

  • repair_address — Upgrade legacy unstructured address lines toward hybrid/structured form

  • validate_addresses — Batch-validate every party address across payment rows

  • verify_bic_online — Check a BIC's format and look it up in a configured BIC directory (needs the online extra)

November 2026 structured-address cliff

On 14 November 2026, fully unstructured postal addresses are decommissioned across SWIFT CBPR+, HVPS+, TARGET2 RTGS, CHAPS, Fedwire and Lynx — after that date, any cross-border or high-value payment carrying an unstructured-only postal address is rejected at the rail. The four address tools above wrap the pacs008 library's standards.address module so an agent can get ahead of the deadline: classify_address shows where an address stands, validate_address / validate_addresses enforce a policy (defaulting to the cliff rule hybrid_or_structured, which rejects unstructured addresses), and repair_address runs country-aware heuristics (GB, US, DE, FR, JP, plus a best-effort fallback) to lift legacy address lines into hybrid form. The repair step is experimental — audit its output before submitting downstream.

Using the tools

You can invoke the tools in-process — without a transport — straight through the server instance. This mirrors what an agent receives over stdio. The runnable version of this snippet lives in examples/mcp_tools.py.

import asyncio

from pacs008_mcp.server import server

record = [
    {
        "msg_id": "MSG001",
        "creation_date_time": "2026-01-15T10:30:00",
        "nb_of_txs": "1",
        "settlement_method": "CLRG",
        "interbank_settlement_date": "2026-01-15",
        "end_to_end_id": "E2E001",
        "interbank_settlement_amount": "1000.00",
        "interbank_settlement_currency": "EUR",
        "charge_bearer": "SHAR",
        "debtor_name": "Debtor Corp",
        "debtor_agent_bic": "DEUTDEFF",
        "creditor_agent_bic": "COBADEFF",
        "creditor_name": "Creditor Ltd",
    }
]


async def main() -> None:
    async def call(name, args):
        result = await server.call_tool(name, args)
        content = result[0] if isinstance(result, tuple) else result
        return content[0].text if content else ""

    print(await call("list_schemes", {}))
    xml = await call("generate_message",
                     {"message_type": "pacs.008.001.08", "records": record})
    print(xml[:46])  # -> <?xml version="1.0" encoding="UTF-8"?> ...


asyncio.run(main())

Run it directly:

python examples/mcp_tools.py

Development

pacs008-mcp uses Poetry and mise.

git clone https://github.com/sebastienrousseau/pacs008-mcp.git && cd pacs008-mcp
mise install
poetry install
poetry shell

This package depends on the core pacs008 library. Until it is on PyPI, install it from source first: pip install "git+https://github.com/sebastienrousseau/pacs008.git".

A Makefile orchestrates the quality gates (kept in lockstep with CI):

make check        # all gates (REQUIRED before commit)
make test         # pytest, 100% line+branch coverage
make lint         # ruff + black
make type-check   # mypy --strict
make doc-coverage # interrogate, 100% docstrings
make mutate       # mutmut over the tool handlers, gated
make docs         # Sphinx site, warnings are errors

Documentation


Part of the ISO 20022 MCP Suite — open-source, Apache-2.0 licensed MCP servers for banking and financial-services AI agents:

Server

Purpose

pain001-mcp

Generate & validate ISO 20022 pain.001 payment files (v03–v12, pain.008, SEPA) with rulebook checks

camt053-mcp

Parse & reconcile ISO 20022 camt.053 bank-to-customer statements — CBPR+/HVPS+ ready

acmt001-mcp

Generate & validate ISO 20022 acmt account-management messages

bankstatementparser-mcp

Parse bank statements (BAI2, MT940/MT942, CAMT.053, OFX, CSV) into structured transactions

noyalib-mcp

Lossless YAML 1.2 parsing, formatting & validation (Rust, 100% spec compliance)


MCP Registry

mcp-name: io.github.sebastienrousseau/pacs008-mcp


License

Licensed under the Apache License, Version 2.0. Any contribution submitted for inclusion shall be licensed as above, without additional terms.

Contribution

Contributions are welcome — see the contributing instructions. Thanks to all contributors.

Acknowledgements

Built on the pacs008 ISO 20022 FI-to-FI Customer Credit Transfer library and the Model Context Protocol Python SDK.

Available Tools

16 tools
classify_addressClassify a postal addressA
Read-onlyIdempotent

Classify a postal address as structured, hybrid, or unstructured.

Use this to see where an address stands against the SWIFT structured-address
rule: ``structured`` (town + country + structured detail, no free-form
lines), ``hybrid`` (town + country + 1-2 free-form ``adr_line`` lines, the
minimum CBPR+ UG2026 bar), or ``unstructured`` (free-form only — rejected
from the cliff date). To check acceptability under a policy use
``validate_address``; to upgrade legacy lines use ``repair_address``.

Returns ``{"classification": str, "is_structured": bool, "is_hybrid":
bool, "is_unstructured": bool, "has_structured_fields": bool}`` or an
``{"error": ...}`` payload.

Args:
    address: The postal address as a dict of snake_case fields.

Inputs: address (required).

convert_mt103Convert MT103 to pacs.008 recordsA
Read-onlyIdempotent

Convert a legacy SWIFT MT103 into pacs.008-ready flat records.

This is the SWIFT MT-to-MX migration path (correspondent-banking MT103
coexistence with ISO 20022 ends November 2025): parse an MT103 text
payload and get back the flat pacs.008 record(s) that can be fed straight
into ``validate_records`` / ``generate_message``. An MT103 carries exactly
one transfer, so the ``records`` list always holds a single record. No
file is read or written.

Returns ``{"message_type": "pacs.008.001.08", "records": [{...}]}`` with
the parsed flat record, or an ``{"error": ...}`` payload if the MT103 is
missing a mandatory field (``:20:``, ``:32A:``, beneficiary) or malformed.

Args:
    mt103_text: The MT103 payload as a string.

Inputs: mt103_text (required).

generate_messageGenerate pacs XML from recordsA
Read-onlyIdempotent

Generate a validated ISO 20022 pacs XML message from in-memory records.

This is the primary generation tool: pass payment records you already hold
in memory and receive an XSD-validated XML document; no file is written.
Run ``validate_records`` first to surface record-level errors, and
``list_message_types`` to confirm the ``message_type`` string.

Returns the validated XML document as a string, or an ``{"error": ...}``
payload (serialized) if generation fails.

Args:
    message_type: A supported ISO 20022 pacs message type.
    records: One or more flat payment records.

Inputs: records (required), message_type (required). Returns: result

get_input_schemaGet input JSON SchemaA
Read-onlyIdempotent

Return the full JSON Schema for a message type's flat input record.

Use this to learn every field, its type, and its constraints before
assembling records, or to drive a form/UI. For just the required-field
names use ``get_required_fields``; to check records against this schema use
``validate_records``.

Args:
    message_type: A supported ISO 20022 pacs message type.

Inputs: message_type (required).

get_required_fieldsGet required fieldsA
Read-onlyIdempotent

List only the required input field names for a pacs message type.

Use this for a quick checklist of the mandatory columns before building
payment records. For full type/format constraints (not just which fields
are required), call ``get_input_schema`` instead.

Args:
    message_type: A supported ISO 20022 pacs message type.

Inputs: message_type (required). Returns: result

get_schemeGet scheme profile rulesA
Read-onlyIdempotent

Return the rule attributes of a scheme / usage-guideline profile.

Use this to inspect a rail's constraints -- whether the UETR is mandatory,
the permitted charge bearers, remittance-info length cap, per-message
transaction cardinality, pinned message versions, and which parties must
carry an LEI -- before assembling or validating a batch.

Args:
    scheme: A registered scheme profile name (see ``list_schemes``).

Inputs: scheme (required).

list_message_typesList pacs message typesA
Read-onlyIdempotent

List every supported ISO 20022 pacs message type and its human name.

Use this first, before any generation or validation call, to discover the
exact ``message_type`` strings this server accepts (e.g.
``pacs.008.001.08`` FI-to-FI Customer Credit Transfer). To learn a type's
required fields or full schema, call ``get_required_fields`` or
``get_input_schema`` instead.

Returns a list of ``{"message_type": ..., "name": ...}`` dictionaries, one
per supported message type.

Inputs: no named parameters. Returns: result

list_schemesList scheme profilesA
Read-onlyIdempotent

List every registered scheme / usage-guideline profile.

Scheme profiles (CBPR+, HVPS+, Fedwire, CHAPS, T2 RTGS, SCT Inst, generic)
layer rail-specific rules on top of base ISO 20022. Use this to discover
the ``scheme`` names accepted by ``get_scheme`` and ``validate_scheme``.

Registry aliases (e.g. ``cbpr+``, ``cbprplus``) collapse to their canonical
profile, so each profile appears exactly once. Returns a list of
``{"scheme": ..., "name": ...}`` dictionaries.

Inputs: no named parameters. Returns: result

parse_messageParse inbound ISO 20022 XMLA
Read-onlyIdempotent

Parse and classify an inbound ISO 20022 XML message.

Use this on the receiving side to identify what a message is -- its
``msg_def_idr`` (e.g. ``pacs.002.001.10``), family, version, and any
Business Application Header -- before processing it. Handles both bare
``Document`` messages and BAH-wrapped envelopes.

Returns a dict with ``msg_def_idr``, ``msg_family``, ``version``,
``root_local_name``, ``namespace_uri``, ``envelope_wrapped`` and ``bah``.

Args:
    xml: The raw inbound XML message.

Inputs: xml (required).

repair_addressRepair an unstructured addressA
Read-onlyIdempotent

Upgrade legacy unstructured address lines toward hybrid/structured form.

Experimental country-aware repair (``GB``, ``US``, ``DE``, ``FR``, ``JP``
have dedicated heuristics; other countries get a best-effort pass promoting
the last line to a town). Use this to lift pre-cliff data over the
November 14, 2026 bar; audit the output before submitting, and keep both
the original and derived address in your audit trail.

Returns ``{"address": {...}, "classification": str, "is_structured":
bool, "is_hybrid": bool}`` (so you can see the unstructured -> hybrid /
structured upgrade) or an ``{"error": ...}`` payload.

Args:
    lines: Legacy unstructured address lines.
    country: ISO 3166-1 alpha-2 country code driving the heuristics.

Inputs: lines (required), country (required).

validate_addressValidate a postal addressA
Read-onlyIdempotent

Validate one postal address against an address policy.

Use this to decide whether an address will clear a rail. The default
``hybrid_or_structured`` policy is the November 14, 2026 cliff rule
(SWIFT CBPR+, HVPS+, T2 RTGS, CHAPS, Fedwire, Lynx): it rejects fully
unstructured addresses. Findings mirror the library's pipeline severity
(a policy rejection is a blocking finding).

Returns ``{"policy": str, "classification": str, "is_acceptable": bool,
"findings": [{"severity": str, "message": str}, ...]}`` or an
``{"error": ...}`` payload.

Args:
    address: The postal address as a dict of snake_case fields.
    policy: The validation policy to enforce (see the enum values).

Inputs: address (required), policy.

validate_addressesValidate addresses in payment rowsA
Read-onlyIdempotent

Batch-validate every party address across a list of payment rows.

Use this before ``generate_message`` to catch addresses that will be
rejected at the rail. The default ``hybrid_or_structured`` policy enforces
the November 14, 2026 cliff. Each finding is reported per offending
``(row, party)`` pair.

Returns ``{"policy": str, "is_valid": bool, "total": int, "errors":
[{"row": int, "party": str, "severity": str, "message": str,
"classification": str}, ...]}`` or an ``{"error": ...}`` payload.

Args:
    addresses: One or more payment-row dicts (see the field description).
    policy: The validation policy to enforce (see the enum values).

Inputs: addresses (required), policy.

validate_recordsValidate records against schemaA
Read-onlyIdempotent

Validate flat payment records against a message type's JSON Schema.

Use this before ``generate_message`` to catch structural/type errors per
record and get a row-by-row error report. This checks JSON-Schema shape
only; to check a batch against a rail's usage guidelines use
``validate_scheme``.

Returns a report ``{"is_valid": bool, "total": int, "valid": int,
"errors": [...]}``.

Args:
    message_type: A supported ISO 20022 pacs message type.
    records: One or more flat payment records to validate.

Inputs: records (required), message_type (required).

validate_schemeValidate records against a schemeA
Read-onlyIdempotent

Validate payment records against a scheme's usage-guideline rules.

Use this to check a batch against a rail's rulebook (CBPR+, HVPS+,
Fedwire, CHAPS, T2 RTGS, SCT Inst) -- charge-bearer restrictions, UETR
presence, remittance-info length, and per-message transaction cardinality.
This is complementary to ``validate_records`` (JSON-Schema shape).

Returns ``{"scheme": str, "is_valid": bool, "total": int,
"violations": [...]}``.

Args:
    scheme: A registered scheme profile name (see ``list_schemes``).
    records: One or more flat payment records to check.

Inputs: scheme (required), records (required).

validate_xmlValidate XML against XSDA
Read-onlyIdempotent

Validate a raw XML string against a message type's bundled XSD.

Use this to check an externally produced XML document against the official
ISO 20022 schema. To generate a document that is already XSD-validated,
use ``generate_message`` instead.

Returns ``{"message_type": str, "is_valid": bool}``, or ``{"error":
...}`` for an unsupported type or DTD entities; a bad year is invalid.

Args:
    message_type: A supported ISO 20022 pacs message type.
    xml: The raw XML document to validate.

Inputs: xml (required), message_type (required).

verify_bic_onlineVerify a BIC (structural + optional directory lookup)A
Read-onlyIdempotent

Verify a BIC structurally, optionally enriched by a directory lookup.

Two-stage verification. First an OFFLINE ISO 9362 structural check (via the
pacs008 library): confirms the 8- or 11-character shape and that the
country code (chars 5-6) is a valid ISO 3166-1 alpha-2 code. A malformed
BIC returns ``{"bic": ..., "is_structurally_valid": False, "error": ...}``
and stops there.

Then, only if a directory endpoint is configured (the ``directory_url``
argument or the ``PACS008_BIC_DIRECTORY_URL`` environment variable), the
tool performs a read-only HTTP GET against that endpoint and folds whatever
institution ``name``/``city``/``country``/``status`` it returns into a
``directory`` sub-dict. There is no free authoritative SWIFT BIC directory,
so with NO endpoint configured the tool returns the structural result plus
a ``note`` and ``directory: null`` -- it never fabricates a bank name.

Online lookups require the optional ``online`` extra (``pip install
'pacs008-mcp[online]'``, which pulls in ``httpx``); without it the tool
still returns the structural result plus an ``error`` explaining the
missing extra. Endpoint 4xx/5xx responses and transport failures are
likewise reported as a graceful ``error`` alongside the structural result.

Returns a dict with ``bic``, ``is_structurally_valid``, ``bank_code``,
``country_code``, ``location_code``, ``branch_code``, ``length`` and either
``directory`` (a dict of institution details, or ``null``) plus, when
applicable, ``note`` / ``error``.

Args:
    bic: The BIC / SWIFT code to verify.
    directory_url: Optional directory endpoint for online enrichment.

Inputs: bic (required), directory_url.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 16 tools

    Disambiguation5/5

    Each tool has a clearly distinct target and action: parsing, schema discovery, record/scheme/XML/address validation, generation, conversion, and BIC/address handling are all separate. The multiple validate_* tools are well differentiated by target (XML vs records vs scheme vs single/batch address).

    Naming Consistency4/5

    Tool names are overwhelmingly snake_case and verb-first, making the set easy to scan. Minor deviations like verify_bic_online and convert_mt103 are still readable and do not meaningfully break the convention.

    Tool Count4/5

    At 16 tools, the set is slightly above the typical ideal range but justified by the domain's breadth: discovery, validation, generation, conversion, BIC checks, and address handling. Each tool appears to earn its place rather than being redundant filler.

    Completeness4/5

    The surface covers the key lifecycle for ISO 20022 pacs message work: listing types/schemes, inspecting schemas, validating records and schemes, generating XSD-valid XML, parsing inbound metadata, converting MT103, and checking BIC/address constraints. Minor gaps remain around extracting full payment records from inbound XML and broader pacs.002/status generation, but core workflows are covered.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that gives AI agents deterministic, verified access to ISO 8583 field specs, MTI decoding, jPOS packager XML generation, deploy descriptor validation, message building, and jPOS documentation search.
      7
      4
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Pactus is an MCP server for parsing and validating ISO 20022 payment messages directly from chat. It exposes nine tools that let AI assistants inspect or validate pacs.008, pacs.002, pain.001, and camt.053 messages — the message types at the centre of the CBPR+ migration — without leaving the conversation.
      9
      17 PyPI
      2
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      MCP server that enables AI agents to parse, validate, and reverse ISO 20022 bank statements, with tools for discovering message types and return reasons.
      24
      190 PyPI
      2
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      A Model Context Protocol server that exposes the pain001 ISO 20022 Customer Credit Transfer Initiation library as agent tools, enabling AI assistants to generate and validate standardized payment XML messages.
      30
      1,471 PyPI
      1
      Apache 2.0