python-mcp-as400 MCPサーバー
コミット 2026年10月24日AIアシスタントをIBM i (AS/400) システムに接続し、Db2へのクエリ、ソースコードの読み取り、プログラムのコンパイル、スプールファイルの安全な分析を可能にします。
別名 LorenteFacundo/python-mcp-as400
- スター
- 2
- ツール
- 5
- ダウンロード数(30日間)
- —
- 最新バージョン
- —
- 最終コミット
- 2026年10月24日
- ライセンス
- MIT
python-mcp-as400 MCPとは
python-mcp-as400はMCPサーバーです。 AIアシスタントをIBM i (AS/400) システムに接続し、Db2へのクエリ、ソースコードの読み取り、プログラムのコンパイル、スプールファイルの安全な分析を可能にします。. 5個のツールを提供しており、execute_sql, execute_cl_command, read_source_memberなどがあります。
プロジェクトのREADMEから生成された概要
python-mcp-as400 MCP server について
このMCP serverは、安全な分析と開発のためにAIアシスタントをIBM i システムに接続することを可能にします。開発者はClaudeやCursorなどのクライアントを使用して、Db2 for iとの対話、RPG、COBOL、またはCLソースコードの読み取り、コンパイルタスクの管理が行えます。大規模言語モデルとレガシーなビジネスロジックの架け橋となることで、数千ものテーブルにわたる影響分析を、手動での調査よりもはるかに迅速に実行できるよう支援します。
サーバーはstdioを介してローカルで動作し、Python 3.10以上、IBM i Access ODBC Driver、および環境変数で提供される有効なデータベース認証情報が必要です。破壊よりも分析を優先する厳格なセキュリティモデルに基づいて設計されています。検証レイヤーを使用することで、SQLクエリが読み取り専用であることを保証し、CLコマンドを特定の許可リストに制限することで、誤ったデータの変更やオブジェクトの削除を防止します。
開発者は、システムテーブルを照会するためのexecute_sql、コードを調査するためのread_source_member、RPGやCプログラムをビルドするためのcompile_programといった特定のツールを使用できます。また、ジョブログやコンパイルリストを確認するためのread_spoolfileも含まれており、複雑なIBM i 環境の保守と理解のための包括的なツールとなります。
できること
- 1レガシーソースコードの調査特定のRPGまたはCOBOLメンバー内のロジックについて、AIに説明を求めることができます。
- 2コンパイルエラーのデバッグアシスタントがプログラムをコンパイルし、その結果生成されたスプールファイルを読み取って失敗の原因を診断できます。
- 3システムメタデータの照会開発者は、読み取り専用のSQLコマンドを使用して、特定のカラムやテーブル構造を見つけることができます。
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
python-mcp-as400 MCPツール 5
READMEから検出execute_sqlexecute_cl_commandread_source_membercompile_programread_spoolfile
| execute_sql | — | |
| execute_cl_command | — | |
| read_source_member | — | |
| compile_program | — | |
| read_spoolfile | — |
設定
DB_HOSTDB_PASSDB_USER
| 名前 | 説明 | 種類 |
|---|---|---|
| DB_HOST | — | |
| DB_PASS | — | |
| DB_USER | — |
自動チェック
実行日 2026年11月14日詳細レポート →まだ検証されていません。サーバーには80点のスコア、重大な問題がないこと、および検証に必要な十分なデータが必要です。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能lorentefacundo/python-mcp-as400 is public and reachablegithub.com/lorentefacundo/python-mcp-as400 ↗合格
- パッケージがこのリポジトリをソースとして示している未チェック
- ビルドの来歴(Sigstore 証明)未チェック
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit or release 2026-10-24github.com/lorentefacundo/python-mcp-as400 ↗合格
- OpenSSF Scorecard未チェック
- パッケージ名が有名なパッケージに酷似していない未チェック
- パッケージと依存関係に重大なアドバイザリがない未チェック
- モデルへの隠れた指示がない5 tool descriptions and the README read; no override phrases, credential paths or hidden characters合格
- 破壊的なツールがラベル付けされている未チェック
- リモート endpoint が MCP ハンドシェイクに応答する未チェック
README
GitHubで見るAS/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
python-mcp-as400 MCPのよくある質問
python-mcp-as400 MCPが提供するツールは
5個のツールを提供しており、execute_sql, execute_cl_command, read_source_member, compile_program, read_spoolfileなどがあります。
AIアシスタントはIBM i システム内のデータを変更できますか?
いいえ、このサーバーは分析とコンパイル専用に設計されています。データの破壊を防ぐため、読み取り専用のSQLを使用し、CLコマンドには厳格な許可リストを適用しています。