Open source · GPL v3

A modern TN5250 terminal emulator for IBM i and AS/400.

Full RFC 1205 protocol, 13 EBCDIC code pages, a dedicated scripting language, and an embedded Model Context Protocol server — built with Qt 6 and C++17, native on Linux, macOS, and Windows.

  • TN5250 / RFC 1205
  • IBM i · AS/400
  • MCP server
  • Qt 6 · C++17
  • Linux · macOS · Windows
  • GPL v3

Binaries for Linux, macOS, and Windows are attached to each GitHub release. Or build from source — see install.

5250ng displaying an IBM i sign-on screen
Terminal emulation

Full TN5250, the way IBM specifies it.

Connect to any AS/400 or IBM i system with the complete 5250 command and display-order set, Telnet option negotiation, and TLS/SSL on the standard port 992 or any configured port.

  • RFC 1205 with Telnet option negotiation
  • 24×80 (standard) and 27×132 (extended) screen modes
  • Keyboard state machine per IBM SA21-9247-6
  • PF1PF24, Field Exit, Erase EOF, SysReq, Attn
  • Field attributes: protected, MDT, highlight, blink, reverse, underline
  • Multi-tab sessions with JSON profiles, auto-connect, and per-session settings
Code pages

Supported EBCDIC code pages

Code pageRegion
CP037 US / Canada (default)
CP273 Germany / Austria
CP277 Denmark / Norway
CP278 Finland / Sweden
CP280 Italy
CP284 Spain / Latin America
CP285 United Kingdom
CP297 France
CP500 International
CP870 Central Europe (Latin-2)
CP420 Arabic
CP424 Hebrew
CP838 Thai
5250Script

A small DSL for screen automation.

5250Script is a line-based scripting language inspired by Unix expect. It treats screens, fields, and the keyboard state as first-class objects, with its own lexer, parser, and AST executor.

  • TYPE, PRESS, MOVE CURSOR, EXPECT, EXTRACT
  • IF/WHILE/REPEAT, LABEL/GOTO
  • DEF/CALL/RETURN with parameters
  • ON TIMEOUT GOTO, ON ERROR GOTO, ABORT
  • Variable interpolation and session-scoped variables
  • Interactive INPUT prompts mid-script
// login.5250script
# Login to AS/400 and capture the main menu title
EXPECT TEXT "Sign On" AT 1 23
MOVE CURSOR AT INPUTFIELD 1
TYPE "$SESSION_USERNAME"
MOVE CURSOR AT INPUTFIELD 2
TYPE "$SESSION_PASSWORD"
PRESS ENTER

EXPECT TEXT "MAIN MENU"
EXTRACT ROW 1 INTO $HEADER
LOG "Connected: $HEADER"

Macro recordings can be converted to editable 5250Script with one click — the bridge from "I did it once" to "it's in git."

AI & MCP integration

Expose a session to any MCP-capable agent.

5250ng embeds a Model Context Protocol server over HTTP + JSON-RPC 2.0. An MCP client can create sessions, read screens, send keys, execute scripts, and capture screenshots — all as first-class tools with validated schemas. A side-panel AI assistant (Anthropic or OpenAI, API key or OAuth) uses the same surface to drive sessions from natural language.

Session lifecycle

ToolDescription
create_session Open a new TN5250 session to a host
close_session Disconnect and dispose a session
list_sessions Enumerate active sessions
screenshot Capture the current screen as PNG

Screen inspection

ToolDescription
read_screen Return the full 24×80 (or 27×132) buffer
read_line Return a single row
read_region Return a rectangular region
find_text Locate a substring on the screen
wait_for_text Block until text appears (with timeout)
get_cursor_position Return current row/column
get_screen_size Return current screen dimensions
get_field_at Return the field under a given cell

Actions

ToolDescription
send_keys Send a sequence of keystrokes
press_key Send a single AID or navigation key
press_keys Send multiple AID/navigation keys
type_text Type a string with EBCDIC encoding
set_cursor_position Move the cursor to an absolute cell
move_cursor Move the cursor relatively or by field
clear_inputs Clear all unprotected fields
login Convenience login helper
run_5250script Execute a 5250Script against this session

Filesystem

ToolDescription
read_file Read a local file (user-approval gated)
write_file Write a local file (user-approval gated)
list_files List a local directory

Two providers

Anthropic (Claude) and OpenAI. Choose model and system prompt per provider.

Two auth modes

API key or OAuth 2.0 (browser-based). Tokens stored locally.

User-approval gate

Agent-initiated file writes surface as pending, user-approvable operations.

The MCP server listens on TCP port 9250 by default and can be enabled with the --enable-mcp-server flag. Each MCP session is isolated by session ID with a per-session busy guard.

Appearance

13 built-in themes, fully customizable.

From authentic amber phosphor to modern Nord and Dracula. Every theme exposes font, 16-color palette, cursor, CRT scanline intensity, phosphor bloom, and background image layout. Themes are plain JSON — share them, fork them, commit them.

Install

Build from source, or download a release.

Requires CMake 3.16+, a C++17 compiler, and Qt 6.5+. OpenSSL is optional and only required for TLS. GitHub Actions CI builds binaries for all three platforms on every release.

Linux (Ubuntu / Debian)

sudo apt install qt6-base-dev cmake g++ \
  libxkbcommon-dev libssl-dev
cmake -S . -B build
cmake --build build
./build/bin/5250ng

macOS

brew install qt cmake openssl
cmake -S . -B build
cmake --build build
./build/bin/5250ng.app/Contents/MacOS/5250ng

Windows

git clone --recursive \
  https://github.com/5250ng/5250ng.git
cd 5250ng
build.bat release

Requires Qt6 (MinGW or MSVC 2022 kit) and OpenSSL for TLS.

Project

Open source, GPL v3, community contributions welcome.

5250ng is developed by @p0dalirius and contributors. Pull requests and issue reports are welcome.