pacs008-mcp
v0.0.16ISO 20022 pacs.008 FI-to-FI credit transfers: generate, validate, parse, scheme + address checks.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_message_types List pacs message types
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.
list_schemes List scheme profiles
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.
get_scheme Get scheme profile rules
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``).
| Parameter | Type | Description |
|---|---|---|
scheme * | string | A registered scheme / usage-guideline profile name (case-insensitive), e.g. 'cbpr_plus', 'fedwire', 'chaps'. Must be one of: 'cbpr+', 'cbpr_plus', 'cbprplus', 'chaps', 'fedwire', 'generic', 'hvps+', '… |
get_required_fields Get required fields
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.
| Parameter | Type | Description |
|---|---|---|
message_type * | string | A supported ISO 20022 pacs message type, e.g. 'pacs.008.001.08' FI-to-FI Customer Credit Transfer. Must be exactly one of: 'pacs.002.001.12', 'pacs.003.001.09', 'pacs.004.001.11', 'pacs.007.001.11', '… |
get_input_schema Get input JSON Schema
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.
| Parameter | Type | Description |
|---|---|---|
message_type * | string | A supported ISO 20022 pacs message type, e.g. 'pacs.008.001.08' FI-to-FI Customer Credit Transfer. Must be exactly one of: 'pacs.002.001.12', 'pacs.003.001.09', 'pacs.004.001.11', 'pacs.007.001.11', '… |
validate_records Validate records against schema
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.
| Parameter | Type | Description |
|---|---|---|
message_type * | string | A supported ISO 20022 pacs message type, e.g. 'pacs.008.001.08' FI-to-FI Customer Credit Transfer. Must be exactly one of: 'pacs.002.001.12', 'pacs.003.001.09', 'pacs.004.001.11', 'pacs.007.001.11', '… |
records * | array | One or more flat payment records, each a dict of field name -> value; validated against the message type's input JSON Schema (see get_input_schema / get_required_fields). |
validate_scheme Validate records against a scheme
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.…
| Parameter | Type | Description |
|---|---|---|
records * | array | One or more flat payment records, each a dict of field name -> value; checked against the scheme's usage-guideline business rules (charge bearer, UETR, remittance length, per-message cardinality). |
scheme * | string | A registered scheme / usage-guideline profile name (case-insensitive), e.g. 'cbpr_plus', 'fedwire', 'chaps'. Must be one of: 'cbpr+', 'cbpr_plus', 'cbprplus', 'chaps', 'fedwire', 'generic', 'hvps+', '… |
generate_message Generate pacs XML from records
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 p…
| Parameter | Type | Description |
|---|---|---|
message_type * | string | A supported ISO 20022 pacs message type, e.g. 'pacs.008.001.08' FI-to-FI Customer Credit Transfer. Must be exactly one of: 'pacs.002.001.12', 'pacs.003.001.09', 'pacs.004.001.11', 'pacs.007.001.11', '… |
records * | array | One or more flat payment records, each a dict of field name -> value, from which the pacs XML is generated; run validate_records first to surface record-level errors. |
validate_xml Validate XML against XSD
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.
| Parameter | Type | Description |
|---|---|---|
message_type * | string | A supported ISO 20022 pacs message type, e.g. 'pacs.008.001.08' FI-to-FI Customer Credit Transfer. Must be exactly one of: 'pacs.002.001.12', 'pacs.003.001.09', 'pacs.004.001.11', 'pacs.007.001.11', '… |
xml * | string | A raw ISO 20022 XML document to validate against the bundled XSD schema for the given message type. |
parse_message Parse inbound ISO 20022 XML
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.
| Parameter | Type | Description |
|---|---|---|
xml * | string | A raw inbound ISO 20022 XML message (pacs.008 / pacs.002 / pacs.004, optionally BAH-envelope-wrapped) to classify. |
convert_mt103 Convert MT103 to pacs.008 records
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": ...}…
| Parameter | Type | Description |
|---|---|---|
mt103_text * | string | A legacy SWIFT MT103 (single customer credit transfer) payload as text. A raw '{4:...-}' block-4 envelope, trailing whitespace and CRLF/LF differences are tolerated. |
classify_address Classify a postal address
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":…
| Parameter | Type | Description |
|---|---|---|
address * | object | An ISO 20022 PostalAddress27 as a dict of snake_case fields, e.g. {'strt_nm': 'High St', 'bldg_nb': '1', 'pst_cd': 'AB1 2CD', 'twn_nm': 'London', 'ctry': 'GB'} and optional 'adr_line' (list of free-fo… |
validate_address Validate a postal address
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…
| Parameter | Type | Description |
|---|---|---|
address * | object | An ISO 20022 PostalAddress27 as a dict of snake_case fields, e.g. {'strt_nm': 'High St', 'bldg_nb': '1', 'pst_cd': 'AB1 2CD', 'twn_nm': 'London', 'ctry': 'GB'} and optional 'adr_line' (list of free-fo… |
policy | string | Postal-address validation policy. 'unstructured_ok' permits any form (pre-cutover / generic); 'hybrid_or_structured' rejects fully unstructured addresses (the SWIFT CBPR+ UG2026 default; its 14 Novemb… |
repair_address Repair an unstructured address
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 / structur…
| Parameter | Type | Description |
|---|---|---|
country * | string | ISO 3166-1 alpha-2 country code (e.g. 'GB', 'US', 'DE', 'FR', 'JP') used to drive country-aware repair heuristics. |
lines * | array | Legacy unstructured address lines (free-form). Empty or whitespace-only lines are skipped. |
validate_addresses Validate addresses in payment rows
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…
| Parameter | Type | Description |
|---|---|---|
addresses * | array | Payment-row dicts. The pipeline scans each row for columns of the form '{party}_address_{field}' (party in debtor, creditor, debtor_agent, creditor_agent, ultimate_debtor, ultimate_creditor; field a s… |
policy | string | Postal-address validation policy. 'unstructured_ok' permits any form (pre-cutover / generic); 'hybrid_or_structured' rejects fully unstructured addresses (the SWIFT CBPR+ UG2026 default; its 14 Novemb… |
verify_bic_online Verify a BIC (structural + optional directory lookup)
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 agains…
| Parameter | Type | Description |
|---|---|---|
bic * | string | A BIC / SWIFT code to verify (ISO 9362), 8 or 11 characters, e.g. 'DEUTDEFF' or 'DEUTDEFF500'. Spaces and hyphens are stripped and the value is upper-cased before checking. |
directory_url | Optional base URL of a BIC directory / reference-data endpoint to enrich the result with institution details. The tool issues a read-only HTTP GET with a '?bic=<BIC>' query parameter and parses the JS… |