loading…
Search for a command to run...
loading…
Enables interaction with z/OS mainframe systems via FTP, including dataset listing/download/upload, JCL job submission and monitoring, with advanced text proces
Enables interaction with z/OS mainframe systems via FTP, including dataset listing/download/upload, JCL job submission and monitoring, with advanced text processing and pagination support.
PyPI version PyPI Downloads Python versions License: MIT
A Model Context Protocol (MCP) server for interacting with z/OS mainframe systems via FTP.
No installation needed! The MCP configuration with uvx will automatically download and run the package.
pip install zos-ftp-mcp
Set environment variables for connection:
export ZFTP_HOST="your-mainframe-host"
export ZFTP_PORT="21"
export ZFTP_USER="your-username"
export ZFTP_PASSWORD="your-password"
export ZFTP_TIMEOUT="600.0"
export ZFTP_DOWNLOAD_PATH="/path/to/downloads"
export ZFTP_DEBUG="false" # Set to "true" for detailed FTP protocol logging
export ZFTP_ALLOW_WRITE="false" # Set to "true" to enable upload/submit operations
Control how text files are downloaded from EBCDIC mainframe to ASCII/UTF-8:
# Character encoding conversion (EBCDIC to ASCII/UTF-8)
export ZFTP_DEFAULT_ENCODING="IBM-037,UTF-8" # US/Canada EBCDIC to UTF-8
# Other options: IBM-1047,UTF-8 (Latin-1), IBM-285,UTF-8 (UK)
# Line ending format
export ZFTP_DEFAULT_LINE_ENDING="LF" # Unix/Linux style
# Options: CRLF (Windows), LF (Unix), CR (old Mac), NONE
# Preserve trailing spaces in fixed-length records
export ZFTP_PRESERVE_TRAILING_SPACES="false" # Strip trailing spaces
# Set to "true" to keep 80-character fixed-length records intact
When to use these settings:
By default, the MCP server is read-only for safety. To enable write operations:
export ZFTP_ALLOW_WRITE="true"
When enabled, you can:
upload_dataset)submit_job)Use with caution in production environments. Read-only operations (list, download, monitor jobs) are always available.
{
"mcpServers": {
"zos-ftp-mcp": {
"command": "uvx",
"args": ["zos-ftp-mcp"],
"env": {
"ZFTP_HOST": "your-mainframe-host",
"ZFTP_USER": "your-username",
"ZFTP_PASSWORD": "your-password",
"ZFTP_DOWNLOAD_PATH": "/path/to/downloads"
}
}
}
}
zos-ftp-mcp
list_catalog(pattern, limit, offset) - List datasets matching pattern with paginationdownload_binary(source_dataset, target_file) - Download dataset in binary modedownload_text(source_dataset, target_file, encoding, line_ending, preserve_trailing_spaces) - Download with text processingdownload_pds_members(dataset, target_dir, members, encoding, line_ending, ...) - Download PDS members with advanced optionsupload_dataset(source_file, target_dataset, binary, lrecl, blksize, recfm, space) - Upload file to dataset (requires ZFTP_ALLOW_WRITE=true)get_vsam_info(dataset, limit, offset) - Get VSAM dataset information with pagination (requires ZFTP_ALLOW_WRITE=true)get_gdg_info(gdg_base, limit, offset) - Get GDG base attributes and generations with pagination (requires ZFTP_ALLOW_WRITE=true)submit_job(jcl, jobname) - Submit JCL job (requires ZFTP_ALLOW_WRITE=true)list_jes_jobs(jobmask, owner, status, limit, offset) - List jobs with filtering and paginationget_job_info(jobid) - Get job detailsdownload_job_spool(jobid, target_file) - Download job output with return code extractionget_connection_info() - Show current connection settingsOnce configured, you can use these prompts:
"List all datasets starting with SYS1 to explore system datasets"
"Show me all user datasets matching MYUSER.* pattern"
"Download the dataset MYUSER.COBOL.SOURCE to my local downloads folder with UTF-8 encoding"
"Download all members from the PDS MYUSER.COBOL.COPYLIB to a local directory"
"Upload my local file test.jcl to dataset MYUSER.JCL.TEST with lrecl=80 and recfm=FB"
"Upload local file member.cbl to PDS member MYUSER.COBOL.SOURCE(TESTPGM)"
"Submit this JCL job and wait for completion" (requires ZFTP_ALLOW_WRITE=true)
"List all my jobs that are in OUTPUT status"
"Download the spool output for job JOB12345 and show me the return code"
"Show me the current FTP connection settings"
To avoid overwhelming context windows with large result sets, several tools support pagination:
Tools with pagination:
list_catalog - Paginate through datasetslist_jes_jobs - Paginate through jobsget_vsam_info - Paginate through VSAM datasetsget_gdg_info - Paginate through GDG generationsUsage:
# Get first 50 datasets
list_catalog('USER.*', limit=50)
# Get next 50 datasets
list_catalog('USER.*', limit=50, offset=50)
# Get first 20 jobs
list_jes_jobs(status='OUTPUT', limit=20)
# Get first 10 GDG generations
get_gdg_info('AWS.M2.CARDDEMO.TRANSACT.BKUP', limit=10)
Response includes:
count - Number of items returned in this pagetotal - Total number of items availableoffset - Current offsethas_more - True if more items are availableThe server automatically detects your mainframe's JES interface level. With JESINTERFACELEVEL=1 (common in older systems):
Job Submission:
userid + exactly one characterUSER123, jobname must be USER123JJob Listing:
Workaround: The server handles these limitations transparently. Just be aware that job retrieval may fail if jobs are purged quickly.
Download PDS members faster using multiple FTP connections:
# Sequential (default)
download_pds_members(dataset, target_dir, members, ftp_threads=1)
# Parallel (2-16 threads)
download_pds_members(dataset, target_dir, members, ftp_threads=4)
Parallel downloads are significantly faster for large PDSs (>10 members).
While defaults are set via environment variables, you can override them per operation:
# Use different line ending for specific file
download_text(dataset, target_file, line_ending='CRLF')
# Preserve trailing spaces for fixed-format data
download_text(dataset, target_file, preserve_trailing_spaces=True)
# Use different encoding
download_pds_members(dataset, target_dir, members, encoding='IBM-1047,UTF-8')
MIT License - see LICENSE file for details.
Run in your terminal:
claude mcp add z-os-ftp-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.