Skip to main content
Glama
sebastienrousseau

camt-exceptions

camt-exceptions: ISO 20022 Exceptions & Investigations, generated + XSD-valid

Build Status PyPI version Glama MCP server score OpenSSF Scorecard License Python Version

Generate and validate ISO 20022 Exceptions & Investigations (E&I) camt messages — with an MCP server. Starts with camt.056 (FI-to-FI Payment Cancellation Request): the message a bank sends to recall or cancel a payment it already dispatched — a duplicate, an erroneous amount, a fraud recall. Output is validated against the official bundled XSD before it's returned.

Latest release: v0.0.20: camt.056 + camt.029 generation + validation, 4 MCP tools over stdio, streamable HTTP or SSE, 100% branch coverage, for Python 3.10+. Part of the ISO 20022 MCP suite. Additional E&I messages (camt.029, camt.026, camt.027, camt.087) plug into the same engine.

Why E&I

When a payment goes wrong, the fix is an Exceptions & Investigations message — and these are the least tooled corner of ISO 20022. camt.056 alone covers the single most common need: "I need to cancel/recall that payment." This library makes it a one-call, schema-valid operation for an agent, with the same depth as the credit-transfer generators elsewhere in the suite.

Related MCP server: camt053-mcp

Install

pip install camt-exceptions
# or run the MCP server without installing:
uvx camt-exceptions

MCP client config (e.g. Claude Desktop):

{
  "mcpServers": {
    "camt-exceptions": {
      "command": "camt-exceptions-mcp"
    }
  }
}

Quick start — cancel a payment

from camt_exceptions import generator as g

xml = g.generate_message("camt.056.001.12", {
    "assignment_id": "CXL-001",
    "assigner_agent_bic": "DEUTDEFF",
    "assignee_agent_bic": "COBADEFF",
    "creation_date_time": "2026-03-02T10:00:00",
    "original_msg_id": "MSG-ORIG-001",
    "original_msg_nm_id": "pacs.008.001.08",
    "transactions": [{
        "original_end_to_end_id": "E2E-001",
        "original_interbank_settlement_amount": "1000.00",
        "original_interbank_settlement_currency": "EUR",
        "cancellation_reason_cd": "DUPL",       # duplicate payment
    }],
})
assert g.validate_xml("camt.056.001.12", xml)["is_valid"]   # True

Transports

One command line, three transports:

Command

Transport

Endpoint

Protocol revisions

camt-exceptions-mcp

stdio

the client spawns the process

2026-07-28, 2025-11-25

camt-exceptions-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

camt-exceptions-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 scout in both protocol eras and over SSE with the MCP SDK client; see ADR 0001.

{
  "mcpServers": {
    "camt-exceptions": { "url": "http://127.0.0.1:8000/mcp" }
  }
}

Tools

  • list_message_types — List supported E&I message types and names.

  • get_required_fields — Required top-level fields for a message type.

  • generate_message — Generate a validated E&I XML message from a record (validated against the bundled XSD before return).

  • validate_xml — Validate raw XML against a message type's bundled XSD.

Supported messages

Message

Name

Status

camt.056.001.12

FI to FI Payment Cancellation Request

✅

camt.029.001.14

Resolution of Investigation

✅

camt.026

Unable to Apply

planned

camt.027

Claim Non-Receipt

planned

camt.087

Request to Modify Payment

planned

Each new message plugs into the same engine: bundle its official XSD + template.xml and register it in MESSAGE_TYPES. Generated output is always XSD-validated before return, so correctness is machine-checked, not asserted.

Note: the payment-status and return messages of the E&I family — pacs.002 (Payment Status Report) and pacs.004 (Payment Return) — are already generated, XSD-valid, by pacs008-mcp.

The suite

Part of a family of vendor-neutral, Python-native ISO 20022 MCP servers:

Documentation

Development

git clone https://github.com/sebastienrousseau/camt-exceptions
cd camt-exceptions
python -m venv .venv && . .venv/bin/activate
pip install -e . && pip install pytest pytest-cov hypothesis ruff black mypy interrogate "mutmut>=3.7,<4"
pytest                      # 100% branch coverage gate; output is XSD-validated
ruff check camt_exceptions tests && black --check camt_exceptions tests && mypy camt_exceptions
interrogate -c pyproject.toml camt_exceptions   # 100% docstring gate
mutmut run && mutmut export-cicd-stats && python scripts/mutation_gate.py --floor 90

License

Licensed under the Apache License, Version 2.0 or the MIT License, at your option. Bundled ISO 20022 message schemas (*.xsd) are © ISO 20022 and redistributed under the ISO 20022 terms; they are the same schemas published at iso20022.org.


mcp-name: io.github.sebastienrousseau/camt-exceptions

Available Tools

4 tools
generate_messageA
Read-onlyIdempotent

Generate a schema-validated ISO 20022 E&I XML message from a record.

Purpose: Renders a complete, XSD-compliant ISO 20022 XML document (e.g. camt.056 payment cancellation or camt.029 investigation resolution) from structured field dictionaries, validating the result against the bundled official schema before returning.

When to use:

  • When raising payment cancellation, recall, or investigation response messages for interbank transmission.

  • When requiring guaranteed XSD-valid XML output for downstream payment processing.

When NOT to use:

  • Do NOT use to validate pre-existing XML files without generating; use validate_xml instead.

  • Do NOT pass incomplete records; check get_required_fields first.

Behavioral transparency: Pure template rendering and in-memory schema validation; side-effect-free and idempotent.

ParametersJSON Schema
NameRequiredDescriptionDefault
recordYesMessage fields; see get_required_fields.
message_typeYesAn E&I message type, e.g. 'camt.056.001.12' (see list_message_types).

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, non-destructive, and closed-world behavior, so the safety profile is covered. The description adds that output is validated against a bundled official XSD before returning and that the process is pure template rendering with in-memory validation, which is useful context beyond annotations, though it repeats the side-effect-free/idempotent claims.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with labeled sections (Purpose, When to use, When NOT to use, Behavioral transparency) and is front-loaded with the core action. Every sentence contributes directly to selection or invocation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex XML generation tool with an output schema already present, the description covers purpose, alternatives, prerequisites, validation behavior, and examples. It gives the agent enough to call the tool correctly without needing return-value details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and both parameters are described in the schema. The description adds little parameter-level meaning beyond what the schema already provides, though it reinforces that record fields should follow get_required_fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb (Generate), resource (schema-validated ISO 20022 E&I XML message), and concrete output examples (camt.056, camt.029). It clearly distinguishes itself from validate_xml and get_required_fields by naming them in the 'When NOT to use' section.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit when-to-use scenarios (payment cancellation, recall, investigation response) and when-not-to-use exclusions with named alternatives. The agent is told exactly which sibling to use for validation-only or incomplete-record cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_required_fieldsA
Read-onlyIdempotent

Get required schema fields for an ISO 20022 E&I message type.

Purpose: Returns the list of mandatory top-level data fields required to construct a valid message record (e.g. assignment identification, instruct team agent, and transaction arrays).

When to use:

  • When preparing input payloads before calling generate_message.

  • When validating payload completeness prior to XML serialization.

When NOT to use:

  • Do NOT use with unsupported message types; discover supported types via list_message_types.

Behavioral transparency: Deterministic field dictionary lookup; pure, read-only, and idempotent.

ParametersJSON Schema
NameRequiredDescriptionDefault
message_typeYesAn E&I message type, e.g. 'camt.056.001.12' (see list_message_types).

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=false, so the description's 'pure, read-only, and idempotent' line largely restates structured data. It adds only the modest 'deterministic field dictionary lookup' framing, which is minor context rather than new behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded one-line summary followed by labeled sections that scan quickly, and every section maps to a real decision the caller makes. The 'Behavioral transparency' block is somewhat redundant against the annotations, which slightly dilutes the otherwise tight structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, prerequisites, exclusions, and example return content, and an output schema exists so return-value detail is not the description's burden. Complete enough to call correctly, with only the annotation-repeating section adding noise rather than gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single message_type parameter, and the schema already supplies the format example and the list_message_types pointer. The description adds no syntax or format detail beyond the schema, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (get) and resource (required schema fields) scoped to ISO 20022 E&I message types, and names the sibling tools (generate_message, list_message_types) that bound its role. An agent can distinguish it from list_message_types or generate_message without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly enumerates when to use it (preparing payloads before generate_message, validating completeness before XML serialization) and when NOT to use it, pointing to list_message_types for discovering supported types. This is a full when/when-not/alternative routing statement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_message_typesA
Read-onlyIdempotent

List supported ISO 20022 Exceptions & Investigations message types.

Purpose: Returns the catalog of supported E&I message identifiers (e.g. camt.056.001.12 Payment Cancellation Request, camt.029.001.14 Resolution of Investigation) and their human-readable definitions.

When to use:

  • When discovering valid message_type parameters before generating or validating messages.

  • When verifying schema version support for payment recall or resolution workflows.

When NOT to use:

  • Do NOT use for payment initiation (pain) or statement (camt.053) messages.

Behavioral transparency: Static catalogue retrieval; pure, deterministic, and side-effect-free.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, openWorldHint=false, and destructiveHint=false, so the safety profile is covered. The description still adds that this is a 'static catalogue retrieval,' which tells the agent the result set is stable and cacheable. However, 'pure, deterministic, side-effect-free' largely restates what the annotations already say, so it is useful but partly redundant.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core statement and then cleanly sectioned, so it scans well. The 'Purpose:' block largely restates the opening sentence and the behavioral block repeats annotation content, so a little trimming is possible, but nothing is confusing or buried.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

A zero-parameter, read-only catalogue tool with an output schema and full annotation coverage needs nothing more. The description covers what is returned conceptually, when to call it, and when to avoid it, so an agent has everything required to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so the baseline is 4. The description's framing (discovering valid message_type values) is contextually useful even though there is nothing parameter-wise to document.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('List supported ISO 20022 E&I message types') and pins the domain down with concrete examples (camt.056.001.12, camt.029.001.14). An agent can immediately tell this is a catalogue-listing tool rather than a generator or validator, which is exactly how it differs from its siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit 'When to use' and 'When NOT to use' sections, and the exclusions name concrete alternatives (pain initiation, camt.053 statements). The positive cases — discovering valid message_type values and verifying schema version support — give the agent a clear trigger condition.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_xmlA
Read-onlyIdempotent

Validate raw ISO 20022 E&I XML against bundled XSD schemas.

Purpose: Validates an XML string against the official bundled XSD schema for the specified E&I message type, returning validation status and detailed schema violation diagnostics.

When to use:

  • When inspecting received or pre-generated ISO 20022 E&I XML before ingesting or routing.

  • When diagnosing schema structural, datatype, or constraint errors in message payloads.

When NOT to use:

  • Do NOT use for payment initiation (pain) or statement (camt.053) documents.

  • Do NOT pass unparseable binary content; requires valid XML text.

Behavioral transparency: Pure, in-memory schema validation using local bundled XSDs; zero network access or side effects.

ParametersJSON Schema
NameRequiredDescriptionDefault
xmlYesRaw ISO 20022 XML to validate.
message_typeYesAn E&I message type, e.g. 'camt.056.001.12' (see list_message_types).

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly, idempotent, non-open-world, non-destructive. The description adds genuinely new context: pure in-memory validation with locally bundled XSDs and zero network access or side effects. It stops short of describing diagnostics detail, but the output schema covers returns.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Labeled sections (Purpose, When to use, When NOT to use, Behavioral transparency) make it scannable and front-loaded, though the header scaffolding is slightly heavier than strictly needed for a two-parameter tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists so return values need not be explained. With safety covered by annotations, parameters by the schema, and scope/limits by the description, an agent has everything needed to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented, and the description adds no format or syntax detail beyond what the schema states. Baseline 3 applies when the schema carries the parameter burden.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource+scope: validating raw ISO 20022 E&I XML against bundled XSD schemas. Clearly distinguishes itself from siblings like generate_message and list_message_types, which produce or enumerate rather than validate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use (pre-ingest inspection, diagnosing structural/datatype/constraint errors) and when-not-to-use (pain/camt.053 documents, binary content). Also points to list_message_types for valid message types, giving the agent a routing path to the sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 4 tool updatesv0.0.15
    • First observedgenerate_message
    • First observedget_required_fields
    • First observedlist_message_types
    • First observedvalidate_xml

TDQS

A4.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinct stage of the E&I message workflow: catalogue discovery (list_message_types), schema field lookup (get_required_fields), XML rendering (generate_message), and XML validation (validate_xml). Descriptions explicitly cross-reference alternatives (e.g. 'use validate_xml instead'), leaving no ambiguity.

Naming Consistency5/5

All four names follow a consistent snake_case verb_noun pattern: list_message_types, get_required_fields, generate_message, validate_xml. Verb-first, predictable, and readable throughout.

Tool Count4/5

Four tools form a tight, well-scoped workflow for a focused domain (ISO 20022 E&I message generation and validation). Slightly lean, but each tool clearly earns its place with no redundancy.

Completeness4/5

The surface covers the full lifecycle: discover valid message types, learn required fields, generate XSD-valid XML, and validate existing XML. Minor gaps exist (e.g. no batch validation or per-type example payloads), but core workflows are fully supported.

Maintenance

ActivityActive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    MCP server for DACH e-invoicing. Create XRechnung (UBL) and ZUGFeRD 2.3 (Factur-X CII) invoices, validate against EN 16931 rules, extract data from XML, and convert between UBL, CII and JSON formats.
    6
    45 npm
    2
    MIT
  • A
    license
    A
    quality
    A
    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
    416 PyPI
    2
    Apache 2.0
  • A
    license
    A
    quality
    A
    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.
    26
    353 PyPI
    1
    Apache 2.0
  • A
    license
    A
    quality
    A
    maintenance
    MCP server for ISO 20022 acmt.001 Account Opening (and companion acmt.* messages): message-type discovery, required-field lookup, JSON Schema introspection, IBAN/BIC/LEI validation, flat-record validation, and validated acmt XML generation.
    7
    436 PyPI
    1
    Apache 2.0