Skip to main content

MCP server for ingesting COBOL mainframe codebases — classifies files, resolves dependencies, maps CICS transactions to REST routes

Project description

mainframe-ingest-mcp

An MCP server that ingests COBOL mainframe codebases from ZIP files and produces a structured JSON manifest — ready for downstream modernization tools.

pip install mainframe-ingest-mcp

What is this?

Mainframe modernization projects always start with the same problem: nobody knows what's in the codebase. Thousands of COBOL files, copybooks, BMS screens, JCL jobs, and CSD exports — all sitting in a ZIP someone exported from the mainframe.

mainframe-ingest-mcp solves the discovery step. Point it at any mainframe ZIP and it will:

  • Classify every file by type (COBOL, copybook, BMS screen, JCL, DB2 DDL, CSD export)
  • Detect and convert EBCDIC encoding to UTF-8
  • Scan every COPY, EXEC SQL INCLUDE, EXEC CICS, and CALL statement
  • Build a full dependency graph (which programs use which copybooks)
  • Parse CICS transaction definitions and suggest FastAPI REST routes
  • Map every BMS screen to an Angular component name
  • Produce a single manifest.json — the handoff document for the rest of the pipeline

It has been tested against a real 294-file, 118,000-line government CICS application and resolves 99%+ of dependencies with zero configuration.


Installation

pip install mainframe-ingest-mcp

Requires Python 3.10+.


Connecting to Claude Desktop

This is an MCP server — it runs locally and exposes tools to Claude Desktop.

Step 1: Find your Claude Desktop config file:

OS Location
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
Linux ~/.config/Claude/claude_desktop_config.json

Step 2: Add this to the config:

{
  "mcpServers": {
    "mainframe-ingest-mcp": {
      "command": "mainframe-ingest-mcp"
    }
  }
}

Step 3: Restart Claude Desktop.

That's it. The tools will appear automatically. You can now say to Claude:

"Extract the ZIP at /Users/me/PAYROLL_SYSTEM.zip to /tmp/payroll and build a manifest"

Claude will call the tools in the right order and return the full manifest.


Usage (without Claude Desktop)

You can also call the tools directly from Python:

from zip_ingestion_mcp.tools.manifest import build_file_manifest
from zip_ingestion_mcp.tools.extractor import extract_zip

# Extract the ZIP
extract_zip("/path/to/PAYROLL_SYSTEM.zip", "/tmp/payroll")

# Build the manifest
manifest = build_file_manifest("/tmp/payroll", "/path/to/PAYROLL_SYSTEM.zip")

import json
print(json.dumps(manifest["summary"], indent=2))

Output:

{
  "total_files": 294,
  "cobol_programs": 83,
  "copybooks": 177,
  "bms_screens": 17,
  "cics_transactions": 304,
  "total_cobol_lines": 77962
}

Available MCP Tools

Tool What it does
tool_build_file_manifest The main tool. Runs everything and returns the full manifest.
tool_extract_zip Extracts a ZIP file safely (zip-slip protected)
tool_detect_all_artifacts Classifies every file by type
tool_detect_encoding Detects if a file is EBCDIC or UTF-8
tool_convert_encoding Converts EBCDIC → UTF-8 (creates .bak backup)
tool_scan_dependencies Builds a full COPY/CICS/SQL dependency graph
tool_parse_csd_export Parses CICS transaction definitions → REST route suggestions

In most cases you only need tool_build_file_manifest — it calls all the others internally.


The manifest.json

The manifest is a structured JSON document designed to be consumed by downstream modernization tools:

{
  "manifest_version": "1.0",
  "readiness": "READY",
  "summary": {
    "total_files": 9,
    "cobol_programs": 2,
    "copybooks": 4,
    "bms_screens": 1,
    "cics_transactions": 3,
    "total_cobol_lines": 156,
    "ebcdic_files_detected": 0,
    "unresolved_copybooks": 0
  },
  "cobol_programs": [
    {
      "file": "cbl/online/EMPINQRY.cob",
      "line_count": 89,
      "dependencies": {
        "copies": ["EMPRECRD", "DFHAID"],
        "bms_sends": ["EMPINQMS"],
        "sql_includes": []
      }
    }
  ],
  "bms_screens": [
    {
      "mapset_name": "EMPINQMS",
      "file": "bms/EMPINQMS.bms",
      "angular_component": {
        "component_class": "EmpinqmsComponent",
        "selector": "app-empinqms",
        "template_file": "empinqms.component.html"
      }
    }
  ],
  "route_table": [
    {
      "transaction_code": "EMPI",
      "program": "EMPINQRY",
      "http_method": "GET",
      "fastapi_route": "/api/employee/{id}"
    }
  ],
  "warnings": [],
  "next_steps": [
    "Send 2 COBOL programs to cobol-parser-mcp",
    "Send 1 BMS screen to bms-to-angular-mcp"
  ]
}

File types supported

Extension Classified as Notes
.cbl, .cob, .cobol COBOL_PROGRAM Main business logic
.cpy COPYBOOK or BMS_COPYBOOK Detected by content
.bms BMS_SCREEN 3270 terminal screen
.jcl JCL_JOB Batch job definitions
.ddl, .sql DB2_DDL DB2 schema definitions
.csd CSD_EXPORT CICS transaction registry
.inc, .include SQL_INCLUDE or JCL_INCLUDE Detected by content

Bundled IBM system copybooks

The following IBM system copybooks are bundled with the package because they live in IBM system libraries on the mainframe and are never included in application ZIPs:

  • DFHAID — CICS attention identifier keys (PF1-PF24, ENTER, CLEAR, PA1-PA3)
  • SQLCA — SQL Communication Area (SQLCODE, SQLERRM, SQLWARN)

These are resolved automatically — no configuration required.


Part of a larger pipeline

mainframe-ingest-mcp is Step 1 of a COBOL → modern stack modernization pipeline:

ZIP file
   └── mainframe-ingest-mcp      ← you are here
         └── manifest.json
               ├── cobol-parser-mcp       → extracts business logic
               ├── bms-to-angular-mcp     → generates Angular components
               └── db2-schema-mcp         → converts DB2 → PostgreSQL

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mainframe_ingest_mcp-0.1.1.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mainframe_ingest_mcp-0.1.1-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file mainframe_ingest_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: mainframe_ingest_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for mainframe_ingest_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3b5d5576a9b9d7ddb16d28f0a0bd354e12307755eb347bdc169735fd3b18f5b4
MD5 650f5b565ae3b967a0a46ddd17603f3d
BLAKE2b-256 3a425d2a029821987ab6526940444b3609d59139e8ea7dacb746863acfb27f32

See more details on using hashes here.

File details

Details for the file mainframe_ingest_mcp-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mainframe_ingest_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13fc2c08d8ccfcad67aacd004c75d0cd3e11ec3a6fb58212d908e27d6db250ca
MD5 1e466a1a3a439b125a8fbaa67014c673
BLAKE2b-256 a1103b9dfb3a7448537c193cf6c5d6842cd24e4898a6e690aff9e1794f3bff91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page