Skip to main content
Glama

CardSpecter — Hollerith 80-Column Keypunch & Mainframe COBOL EBCDIC / COMP-3 Resurrection Studio + MCP Server

License: MIT Live Studio Node.js >= 20 Zero Dependencies

Kiroween 2026 (Resurrection Category) — Bringing 1928 IBM 029 80-Column × 12-Row Hollerith Punched Cards and 1959 COBOL DATA DIVISION Fixed-Width CP037 EBCDIC / COMP-3 Copybooks back from the crypt to solve modern legacy batch modernization with Kiro Spec-Driven Development, Property-Based Testing, and the Model Context Protocol (MCP).


Why Resurrect 80-Column Cards & COMP-3 Copybooks in 2026?

Every night across banking ACH wire clearinghouses, Medicaid institutional adjudication feeds, airline telemetry archives, and state tax pipelines, trillions of dollars still move inside fixed-width binary files shaped by two dead technologies:

  1. 1928 IBM 80-Column × 12-Row Punched Cards (Cols 1–6 sequence numbers, Col 7 indicator, Cols 8–72 Areas A/B, Cols 73–80 deck ID, and 12-row zone+digit overpunches).

  2. 1959 Mainframe COBOL Copybooks (IBM CP037 EBCDIC, COMP-3 Packed Decimal BCD nybbles, COMP-4 big-endian binary words, OCCURS n TIMES repeating tables, 88-level condition flags, and REDEFINES memory unions).

When modern engineering teams or AI coding agents inspect these files without a deterministic compiler, three failure modes strike immediately:

  • The Overpunch Trap: A negative zoned decimal like -$48,250.75 (PIC S9(7)V99 DISPLAY) overpunches 0xD0 onto the final digit 5, producing byte 0xD5—which decodes in CP037 as 'N' ("00482507N"), silently corrupting signs or crashing numeric parsers.

  • Off-by-One Byte Drift: PIC S9(9)V99 COMP-3 occupies floor(11 / 2) + 1 = 6 bytes (not 11), while REDEFINES unions overlay previous siblings without advancing the cursor unless wider. A single 1-byte miscalculation shifts every subsequent field in the record.

  • IEEE-754 Float Corruption: Scaling 123.45 * 100 in standard floating point yields 12344.999999999998, and 18-digit sovereign settlement amounts exceed Number.MAX_SAFE_INTEGER.

CardSpecter resurrects the physical tactile clarity of an IBM 029 Keypunch + 3278 Phosphor X-Ray Terminal and pairs it with a zero-dependency BigInt binary codec and MCP Server so humans and AI agents decode, verify, re-encode, and migrate legacy feeds with mathematical certainty.


Related MCP server: @zuupee/mcp-server

Architecture

flowchart LR
    subgraph Legacy["Dead Tech Artifacts (1928–1983)"]
      DECK["80-Col × 12-Row\nIBM 029 Card Deck"]
      CPY["COBOL DATA DIVISION\nCopybook (.cpy)"]
      BIN["Raw IBM CP037 +\nCOMP-3 / COMP-4 Dump"]
    end

    subgraph Engine["CardSpecter Zero-Dep Isomorphic Core (src/)"]
      HOL["hollerith.mjs\n12-Bit Optical Reader &\nLace/Sequence Auditor"]
      AST["copybook.mjs\nHierarchy + OCCURS +\nREDEFINES Offset Solver"]
      COD["codec.mjs\nBigInt COMP-3 / Zoned /\nCOMP-4 + Forensics"]
      MIG["migrator.mjs\nJSON Schema + TS +\nPostgreSQL NUMERIC DDL"]
    end

    subgraph Surfaces["Modern Developer & Agent Surfaces"]
      WEB["Live Web Studio\n(docs/index.html)"]
      MCP["MCP JSON-RPC Server\n(stdio + --http)"]
      CLI["CLI Tool\n(bin/cardspecter.mjs)"]
    end

    DECK --> HOL --> AST
    CPY --> AST --> COD
    BIN --> COD --> MIG
    HOL --> WEB
    COD --> WEB
    COD --> MCP
    MIG --> MCP
    COD --> CLI

Quick Start (Zero Install Needed Beyond Node.js >= 20)

git clone https://github.com/z121245017-ai/cardspecter.git
cd cardspecter

# 1. Run full unit + Property-Based Testing (PBT) + live MCP test suite (20 tests, >1,700 generated PBT inputs)
npm test

# 2. Run CLI demo on the 1974 Core Banking ACH Wire & Overdraft deck
npm run demo

# 3. Inspect forensic diagnostics on a damaged lace-punched & BCD-corrupted deck
node bin/cardspecter.mjs demo corrupted_forensic_deck

# 4. Launch the MCP server (stdio by default, or loopback HTTP on port 3849)
node src/mcp-server.mjs --http 3849

MCP Tools Exposed (cardspecter-mcp)

Configured automatically for Kiro IDE & Kiro CLI via .kiro/settings/mcp.json:

Tool

Purpose

compile_copybook

Compiles fixed-80 or free-format COBOL Copybooks into exact byte offsets, record width, Draft 2020-12 JSON Schema, TypeScript types, and PostgreSQL/SQLite NUMERIC(p, s) DDL.

decode_ebcdic_record

Decodes raw CP037 / COMP-3 / COMP-4 hex bytes into JSON, active 88-level condition flags, REDEFINES union views, byte-aligned spans, and non-throwing forensic anomalies.

encode_ebcdic_record

Encodes modern JSON into exact fixed-width mainframe wire bytes + formatted 16-column CP037 hex dump.

inspect_hollerith_deck

Punches text into 80×12 IBM 029 column bitmasks or optically reads punched cards while auditing sequence monotonicity (cols 1–6) and physical lace-card tear hazards.

list_legacy_fixtures

Lists and retrieves 4 built-in historical scenarios (banking_ach_1974, apollo_telem_1969, medicaid_claim_1983, corrupted_forensic_deck).


How Kiro Powered This Build (/.kiro Deep Dive)

  1. Spec-Driven Development (.kiro/specs/hollerith-copybook-engine/):

    • Formalized 6 EARS requirements in requirements.md before writing binary parsers, deriving explicit REDEFINES high-water-mark offset equations and 6 formal Correctness Properties in design.md.

  2. Property-Based Testing with Shrinking (tests/pbt.test.mjs):

    • Directly executes Properties 1–6 across 1,700+ deterministically seeded random cases (CP037 256-byte bijection, 80-column Hollerith round-trip, COMP-3 odd/even nybble widths & -0 normalization, Zoned overpunch/separate signs, REDEFINES union high-water marks, and composite OCCURS record round-trips).

  3. Layered Steering (.kiro/steering/):

    • Combines always-included foundation docs (product.md, tech.md, structure.md with #[[file:src/index.mjs]] live references), fileMatch binary guardrails (binary-ebcdic-rules.md), and auto-activated migration playbooks (legacy-migration-playbook.md).

  4. Event-Driven Agent Hooks (.kiro/hooks/) & Custom Agent (.kiro/agents/copybook-archaeologist.json):

    • PostFileSave hooks automatically run npm test and rebuild docs/index.html via npm run build:studio so the live browser studio never drifts from src/.


License

Released under the MIT License.

Available Tools

5 tools
compile_copybookA

Compile an 80-column punched-card or free-format COBOL DATA DIVISION Copybook into exact byte offsets, total record length, JSON Schema, TypeScript types, and SQL DDL.

Inputs: copybook (required), sqlDialect.

decode_ebcdic_recordB

Deterministically decode a raw IBM CP037 EBCDIC / COMP-3 / COMP-4 hex payload against a COBOL Copybook, returning structured JSON, 88-level condition flags, REDEFINES overlays, byte-by-byte spans, and forensic anomalies.

Inputs: copybook (required), ebcdicHex (required).

encode_ebcdic_recordA

Encode a modern JSON object into an exact fixed-width IBM CP037 EBCDIC / COMP-3 / COMP-4 mainframe wire record.

Inputs: record (required), copybook (required).

inspect_hollerith_deckB

Punch ASCII/COBOL text into authentic 80-column × 12-row IBM 029 Hollerith card bitmasks or optically read 12-bit column arrays while auditing sequence numbers (cols 1-6), indicators (col 7), and lace-card tear hazards.

Inputs: text, deckColumns.

list_legacy_fixturesA

List built-in historical mainframe & punched-card scenarios (1974 Banking ACH, 1969 Lunar Telemetry, 1983 Medicaid OCCURS-3, Damaged Forensic Deck) or fetch one by fixtureId.

Inputs: fixtureId.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a distinct artifact and direction: copybook compilation, EBCDIC encode, EBCDIC decode, Hollerith card punch/read, and fixture listing. The encode/decode pair is inverse rather than overlapping, and the copybook compiler is clearly a schema-generation step feeding the others. No two tools could plausibly be selected for the same task.

    Naming Consistency5/5

    All five names follow a strict verb_noun snake_case pattern (compile_copybook, decode_ebcdic_record, encode_ebcdic_record, inspect_hollerith_deck, list_legacy_fixtures). The verbs are well-chosen and the nouns identify the resource unambiguously.

    Tool Count5/5

    Five tools is a tight, well-scoped surface for a mainframe data-interchange domain, with each tool mapping to a distinct step (compile schema, encode, decode, inspect deck, load fixtures). Nothing feels padded or redundant.

    Completeness4/5

    The set covers a full round-trip: compile copybook to schema, encode JSON to wire format, decode wire format back to JSON, plus card-level inspection and sample fixtures. Minor gaps remain, such as validating a record against a copybook without full decode, batch/multi-record processing, or generating a copybook from an existing schema, but these are workaroundable.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      General-purpose MCP server with built-in tools for HTTP, JSON, and datetime operations, supporting pluggable modules and security defaults.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A local-first MCP server for financial wire message forensics, providing read-only tools to parse, validate, and detect SR2026 address compliance in ISO 8583, SWIFT MT, and ISO 20022 messages.
      Apache 2.0