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.
Three things that make 5250ng different.
Most TN5250 emulators solve the protocol. 5250ng also solves what comes next: automation that outlives keystroke recordings, and access for the AI agents that are starting to replace screen-scraping pipelines.
Protocol-complete
Full TN5250 per RFC 1205, 24×80 and 27×132 screen modes, TLS/SSL, and 13 EBCDIC code pages for global operations.
Scriptable
A purpose-built DSL with variables, control flow, functions, error
handlers, and EXPECT/EXTRACT — not a macro recorder.
Agent-ready
An embedded Model Context Protocol server exposes 24 tools over JSON-RPC 2.0. Any MCP-capable client can drive a session.
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
- PF1–PF24, 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
Supported EBCDIC code pages
| Code page | Region |
|---|---|
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 |
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,EXTRACTIF/WHILE/REPEAT,LABEL/GOTODEF/CALL/RETURNwith parametersON TIMEOUT GOTO,ON ERROR GOTO,ABORT- Variable interpolation and session-scoped variables
- Interactive
INPUTprompts mid-script
# 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."
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
| Tool | Description |
|---|---|
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
| Tool | Description |
|---|---|
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
| Tool | Description |
|---|---|
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
| Tool | Description |
|---|---|
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.
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.
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.
Open source, GPL v3, community contributions welcome.
5250ng is developed by @p0dalirius and contributors. Pull requests and issue reports are welcome.