Pacs008 Mcp

io.github.sebastienrousseau由 GitHub 帳號 sebastienrousseau 發布v0.0.16更新於 Nov 3, 2026

ISO 20022 pacs.008 FI-to-FI credit transfers: generate, validate, parse, scheme + address checks.

已驗證STDIO僅桌面金融開發者工具

概覽

AI 產生的概覽

針對 ISO 20022 pacs.008 客戶貸記轉帳的在地 MCP 伺服器:查詢訊息類型與方案、驗證記錄、產生並解析 XML。

可以做什麼
  • 查詢支援的 pacs 訊息類型、方案設定檔及其規則、必填欄位與輸入 JSON Schema
  • 依訊息類型的 Schema 或清算軌道的使用準則驗證扁平付款記錄
  • 由記憶體中的記錄產生經 XSD 驗證的 pacs XML,並以內附 XSD 驗證原始 XML
  • 解析並辨識收到的 ISO 20022 訊息,包含帶 BAH 的訊息
  • 將舊式 SWIFT MT103 訊息轉換為可直接用於 pacs.008 的記錄
  • 對郵遞地址進行分類、驗證與修復,並對 BIC 做結構檢查及可選的目錄查詢
適用情境
適合需要建立、檢查或讀取 ISO 20022 pacs.008 付款訊息,或依 CBPR+、HVPS+、Fedwire、CHAPS、T2 RTGS 等軌道規則準備付款資料的情境,包括結構化地址期限的準備工作。
執行需求
以 Python 套件形式透過 stdio 在本機執行,需要 Python 3.11+ 與 pip;核心 pacs008 函式庫可能需先從原始碼安裝。BIC 目錄查詢需要 online 附加元件。未宣告任何帳號、API 金鑰或環境變數。
安裝前請注意
地址修復被說明為實驗性功能,使用前應審核其輸出。可選的 HTTP 傳輸本身不具身分驗證,應綁定回環位址或置於可信任的閘道之後。產生的訊息僅在記憶體中回傳,不寫入檔案。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Pacs008 Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

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

[pacs008-mcp banner]

[Build] [Registry] [Docs] [OpenSSF Scorecard] [OpenSSF Best Practices] [License: Apache-2.0 OR MIT] [Python 3.11 or newer] [Glama MCP server listing]

[pacs008-mcp Demo]

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

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.

mermaid
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.

sh
python -m pip install pacs008-mcp

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

sh
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):

sh
pacs008-mcp

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

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

Transports

One command line, three transports:

CommandTransportEndpointProtocol revisions
pacs008-mcpstdiothe client spawns the process2026-07-28, 2025-11-25
pacs008-mcp --transport streamable-httpStreamable HTTPhttp://127.0.0.1:8000/mcp2026-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 sseHTTP+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.

json
{  "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.

python
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:

sh
python examples/mcp_tools.py

Development

pacs008-mcp uses Poetry and mise.

bash
git clone https://github.com/sebastienrousseau/pacs008-mcp.git && cd pacs008-mcpmise installpoetry installpoetry 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):

bash
make check        # all gates (REQUIRED before commit)make test         # pytest, 100% line+branch coveragemake lint         # ruff + blackmake type-check   # mypy --strictmake doc-coverage # interrogate, 100% docstringsmake mutate       # mutmut over the tool handlers, gatedmake docs         # Sphinx site, warnings are errors

Documentation


Related MCP Servers

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

ServerPurpose
pain001-mcpGenerate & validate ISO 20022 pain.001 payment files (v03–v12, pain.008, SEPA) with rulebook checks
camt053-mcpParse & reconcile ISO 20022 camt.053 bank-to-customer statements — CBPR+/HVPS+ ready
acmt001-mcpGenerate & validate ISO 20022 acmt account-management messages
bankstatementparser-mcpParse bank statements (BAI2, MT940/MT942, CAMT.053, OFX, CSV) into structured transactions
noyalib-mcpLossless 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.

來源:README.md,提交 da834f2

工具

16

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``).

輸入參數scheme必填

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.

輸入參數message_type必填

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.

輸入參數message_type必填

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.

輸入參數records必填message_type必填

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.

輸入參數scheme必填records必填

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 payment records.

輸入參數records必填message_type必填

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.

輸入參數xml必填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.

輸入參數xml必填

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": ...}`` payload if the MT103 is missing a mandatory field (``:20:``, ``:32A:``, beneficiary) or malformed. Args: mt103_text: The MT103 payload as a string.

輸入參數mt103_text必填

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": bool, "is_unstructured": bool, "has_structured_fields": bool}`` or an ``{"error": ...}`` payload. Args: address: The postal address as a dict of snake_case fields.

輸入參數address必填

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: The postal address as a dict of snake_case fields. policy: The validation policy to enforce (see the enum values).

輸入參數policyaddress必填

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 / structured upgrade) or an ``{"error": ...}`` payload. Args: lines: Legacy unstructured address lines. country: ISO 3166-1 alpha-2 country code driving the heuristics.

輸入參數lines必填country必填

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 description). policy: The validation policy to enforce (see the enum values).

輸入參數policyaddresses必填

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 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.

輸入參數bic必填directory_url

版本歷史

5
  1. v0.0.16最新Oct 29, 2026
  2. v0.0.15Oct 26, 2026
  3. v0.0.14Oct 4, 2026
  4. v0.0.13Oct 4, 2026
  5. v0.0.12Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分