python-mcp-as400 MCP server
Commit 24 Okt 2026Menghubungkan AI assistant ke sistem IBM i (AS/400) untuk melakukan query Db2, membaca source code, compile program, dan menganalisis spooled files secara aman.
Juga dikenal sebagai LorenteFacundo/python-mcp-as400
- Stars
- 2
- Tools
- 5
- Unduhan, 30 hari
- —
- Versi terbaru
- —
- Commit terakhir
- 24 Okt 2026
- Lisensi
- MIT
Apa itu python-mcp-as400 MCP?
python-mcp-as400 adalah MCP server. Menghubungkan AI assistant ke sistem IBM i (AS/400) untuk melakukan query Db2, membaca source code, compile program, dan menganalisis spooled files secara aman. Server ini menyediakan 5 tool, seperti execute_sql, execute_cl_command, read_source_member.
Ringkasan dibuat dari README proyek
Tentang python-mcp-as400 MCP server
MCP server ini memungkinkan Anda menghubungkan AI assistant ke sistem IBM i untuk keperluan analisis dan pengembangan yang aman. Anda dapat menggunakan client seperti Claude atau Cursor untuk berinteraksi dengan Db2 for i, membaca source code RPG, COBOL, atau CL, serta mengelola tugas kompilasi. Dengan menjembatani celah antara large language model dan business logic legacy, tool ini membantu tim melakukan impact analysis di ribuan tabel jauh lebih cepat dibandingkan inspeksi manual.
Server ini beroperasi secara lokal via stdio dan membutuhkan Python 3.10+, IBM i Access ODBC Driver, serta kredensial database valid yang diberikan melalui environment variables. Server ini dirancang dengan model keamanan ketat yang memprioritaskan analisis daripada destruksi. Terdapat layer validasi untuk memastikan query SQL tetap bersifat read-only dan perintah CL dibatasi pada allow list tertentu, guna mencegah modifikasi data atau penghapusan object yang tidak disengaja.
Developer dapat menggunakan tool spesifik seperti execute_sql untuk query tabel sistem, read_source_member untuk memeriksa kode, dan compile_program untuk membangun program RPG atau C. Tool ini juga menyertakan read_spoolfile untuk memeriksa job logs dan compile listings, menjadikannya solusi komprehensif untuk memelihara dan memahami lingkungan IBM i yang kompleks.
Apa yang bisa Anda lakukan dengannya
- 1Inspeksi legacy source codeAnda dapat meminta AI untuk menjelaskan logika di dalam member RPG atau COBOL tertentu.
- 2Debug error kompilasiAI assistant dapat melakukan compile program dan kemudian membaca spool files yang dihasilkan untuk mendiagnosis kegagalan.
- 3Query metadata sistemDeveloper dapat menemukan kolom atau struktur tabel spesifik menggunakan perintah SQL read-only.
Ditulis berdasarkan README proyek. Setiap use case diperiksa terhadap kutipan dari README tersebut.
Tool python-mcp-as400 MCP 5
Terdeteksi dari READMEexecute_sqlexecute_cl_commandread_source_membercompile_programread_spoolfile
| execute_sql | — | |
| execute_cl_command | — | |
| read_source_member | — | |
| compile_program | — | |
| read_spoolfile | — |
Konfigurasi
DB_HOSTDB_PASSDB_USER
| Nama | Deskripsi | Tipe |
|---|---|---|
| DB_HOST | — | |
| DB_PASS | — | |
| DB_USER | — |
Pengecekan otomatis
Berjalan 14 Nov 2026Laporan lengkap →Belum diverifikasi. Sebuah server memerlukan skor 80, tidak ada temuan serius, dan data yang cukup untuk kami periksa. Cara kerja checks
- Source repository terhubung dan dapat dijangkaulorentefacundo/python-mcp-as400 is public and reachablegithub.com/lorentefacundo/python-mcp-as400 ↗Lolos
- Paket menyebut repo ini sebagai sumbernyaTidak diperiksa
- Provenance build (atestasi Sigstore)Tidak diperiksa
- Lisensi open source (OSI)MITspdx.org/licenses/MIT.html ↗Lolos
- Ada commit atau release dalam satu tahun terakhirLast commit or release 2026-10-24github.com/lorentefacundo/python-mcp-as400 ↗Lolos
- OpenSSF ScorecardTidak diperiksa
- Nama package tidak mirip dengan package populerTidak diperiksa
- Tidak ada advisory kritis di paket maupun dependensinyaTidak diperiksa
- Tidak ada instruksi tersembunyi untuk model5 tool descriptions and the README read; no override phrases, credential paths or hidden charactersLolos
- Tools yang bersifat destruktif telah diberi labelTidak diperiksa
- Endpoint remote menjawab handshake MCPTidak diperiksa
README
Lihat di GitHubAS/400 MCP Server
English · Español
An MCP server that lets AI assistants (Claude, Cursor, any MCP client) work with IBM i (AS/400) systems: query Db2 for i, read RPG/COBOL/CL source, compile programs and read spooled files. Every input goes through strict validation, so the assistant can analyze everything without being able to break anything.
Why I built it
A lot of critical business logic still runs on IBM i, and the people who know it are few and busy. Understanding the impact of a change means reading thousands of tables and programs by hand. I wanted an AI assistant to do that reading for me, but connecting an LLM to a production system is only acceptable if it cannot change data or objects. This server is that bridge.
Results
I presented it at BDT Global, where it was approved as a billable initiative and piloted with a client:
| Manual | With the MCP server | |
|---|---|---|
| Task estimated by a senior developer | 5 days | 3 hours (13x) |
| Impact analysis across 6,000+ tables | 6 hours | 20 minutes (18x), and it found 2 tables missed by hand |
Tools
| Tool | What it does | Example |
|---|---|---|
execute_sql |
Read-only SQL (SELECT, WITH, VALUES) |
SELECT * FROM QSYS2.SYSTABLES FETCH FIRST 5 ROWS ONLY |
execute_cl_command |
Allow-listed CL commands | DSPFD FILE(MYLIB/MYFILE) OUTPUT(*OUTFILE) OUTFILE(QTEMP/FDA) |
read_source_member |
Reads a source member | biblioteca='MYLIB', archivo_fuente='QRPGLESRC', miembro='MYPGM' |
compile_program |
Compiles RPG, CL, COBOL or C | library='DEVLIB', source_file='QRPGLESRC', member='MYPGM' |
read_spoolfile |
Lists or reads spooled files (compile listings, job logs) | program_name='MYPGM' |
Security model
The philosophy: analysis and compilation yes, destruction never. Validation lives in validation.py, has no dependencies, and is covered by 72 tests that run in CI on every push.
Read-only SQL
- Only
SELECT,WITHandVALUES; no;, so no statement stacking. - Blocks data-change table references hidden inside a
SELECT(SELECT * FROM FINAL TABLE (DELETE ...)). - Blocks Db2 for i functions with side effects:
QCMDEXC(runs any CL command),HTTP_*/HTTP*CLOB(data exfiltration),IFS_WRITE*,END_JOBand others. - Ignores string literals and quoted identifiers when checking keywords, so
WHERE MSG = 'DELETE'or aLAST_UPDATEcolumn still work. - Adds
FETCH FIRST 1000 ROWS ONLYwhen there is no limit.
CL commands: strict allow list
- Allowed:
DSP*,WRK*,CHKOBJ, compilation (CRTBNDRPG,CRTSQLRPGI,CRTBNDCBL, ...), library list and overrides. - Everything else is rejected:
DLTOBJ,DLTLIB,CLRPFM,RUNSQLSTM,SBMJOB,CALL,GRTOBJAUT, ... - Qualified commands (
QSYS/DLTLIB) are rejected. OUTFILE(...)must point toQTEMP, soDSP*commands cannot create or replace files in real libraries.
Everything else
- Library, file, member, user and spooled-file names are validated against the IBM i naming rules before they reach any SQL.
- Error messages never include credentials or connection strings.
Defense in depth. These checks reduce risk, they don't replace IBM i security. Connect with a user profile that only has the authorities it needs (ideally
*USEon the data and a development library for compiles).
Found by the tests
Writing the test suite (v1.1) exposed real gaps in v1.0, now fixed:
read_spoolfileconcatenateduserandspoolfile_nameinto SQL. Combined withQSYS2.QCMDEXC, that allowed running any CL command.execute_sqlacceptedVALUES QSYS2.QCMDEXC(...),FINAL TABLE (DELETE ...)andHTTP_POST(...).DSP*commands could write theirOUTFILEto any library.
Getting started
Requirements: Python 3.10+, the IBM i Access ODBC Driver, and a user on an IBM i system.
git clone https://github.com/LorenteFacundo/python-mcp-as400.git
cd python-mcp-as400
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e .
cp .env.example .env # then fill in DB_HOST, DB_USER, DB_PASS
The server talks MCP over stdio. Add it to your client, for example Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"as400": {
"command": "python",
"args": ["/path/to/python-mcp-as400/server.py"],
"env": {
"DB_HOST": "your-ibmi-host.com",
"DB_USER": "YOUR_USER",
"DB_PASS": "YOUR_PASSWORD"
}
}
}
}
Or with Claude Code: claude mcp add as400 -- python /path/to/python-mcp-as400/server.py
Example prompts
- "Which tables in MYLIB have a column called CUSTNO?" →
execute_sqloverQSYS2.SYSCOLUMNS - "Which programs use the file CUSTOMERS?" →
DSPPGMREF ... OUTFILE(QTEMP/REFS)+execute_sql - "Explain what CALCPRICE does" →
read_source_member - "Compile CALCPRICE and tell me what failed" →
compile_program+read_spoolfile
Development
pip install -e ".[dev]"
pytest
| File | Purpose |
|---|---|
server.py |
MCP tools and the ODBC connection |
validation.py |
Security checks (no dependencies) |
tests/ |
Tests for every check, including real attack strings |
License
Pertanyaan tentang python-mcp-as400 MCP
Tool apa yang disediakan python-mcp-as400 MCP?
Server ini menyediakan 5 tool, termasuk execute_sql, execute_cl_command, read_source_member, compile_program, read_spoolfile.
Apakah AI assistant bisa mengubah data di sistem IBM i saya?
Tidak, server ini dirancang hanya untuk keperluan analisis dan kompilasi. Server menggunakan SQL read-only dan daftar allow-list yang ketat untuk perintah CL guna mencegah kerusakan data.