
IBM Db2 for i
io.github.Strom-Capital由 GitHub 账号 Strom-Capital 发布v3.8.6更新于 Nov 7, 2026
Read-only SQL queries and schema inspection for IBM Db2 for i over ODBC, JT400 or Mapepire (SSH).
概览
为 IBM i 上的 Db2 for i 提供只读 SQL 查询与结构查看,让助手浏览库、表和视图并执行 SELECT 语句。
- 可以做什么
- 执行带结果限制和超时的只读 SELECT 查询,并可将完整结果导出为 CSV 或 XLSX
- 列出并搜索各库中的 schema、表和列,查看表的列信息
- 查看视图、索引、约束、例程及其参数,以及对象 DDL 和依赖对象
- 在不执行的情况下校验语句,分析表统计信息,查看日志设置和索引建议
- 从 YAML 加载业务说明和经过审核的 SQL 工具,并检索 IBM i 服务
- 适用场景
- 适合需要探索 IBM i ERP 或 Db2 for i 数据库的场景:编写 API 前查找表和主键、为 ETL 与 BI 分析源表、复制前检查日志设置,或用自然语言回答业务问题。
- 运行要求
- 需要 Node.js 22 或更高版本,以 stdio 在本地运行。默认 odbc 驱动需要 unixODBC 和 IBM i Access ODBC 驱动;可选 jt400 驱动安装时需 JDK、运行时需 JRE 11 以上;可选 mapepire 驱动需 SSH 访问及 IBM i 上的 Java 8 以上。需配置 DB2I_HOSTNAME、DB2I_USERNAME 和 DB2I_PASSWORD,且 IBM i 版本为 V7R3 或更高。
安装
在 SourceWeft 中
- 打开 控制台中的 IBM Db2 for i,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
[db2i/mcp logo: a route from a small round node to a blue square, next to the db2i/mcp wordmark]
Db2 for i MCP Server
[CI] [npm version] [License: MIT] [MCP] [IBM i] [TypeScript] [Node.js] [Docker] [npm downloads] [Sponsor]
mcp-server-db2i is a Model Context Protocol (MCP) server for IBM Db2 for i (Db2i) on IBM i (AS/400). It enables AI assistants like Claude and Cursor to query and inspect IBM i databases through the IBM i Access ODBC driver, or optionally the JT400 JDBC driver or Mapepire over SSH.
Listed in the MCP Registry as io.github.Strom-Capital/mcp-server-db2i.
Website: db2i-mcp.com, with a blog that explains each release. Docs: docs.db2i-mcp.com.
Architecture
AI clients connect to the MCP Server in one of two ways. Local clients such as Claude Desktop, Claude Code and Cursor can start it as a process and talk over stdio. Remote clients connect over Streamable HTTP at /mcp, signing in with OAuth 2.1 (claude.ai custom connectors) or a bearer token (custom agents). Local clients can also use the HTTP endpoint. The server executes read-only queries against Db2 for i using the IBM i Access ODBC driver (default, no Java), the optional JT400 JDBC driver (DB2I_DRIVER=jt400), or Mapepire over SSH (DB2I_DRIVER=mapepire) for systems where only SSH is reachable. One server can reach several IBM i systems through connection profiles, each with its own driver.
Features
- Read-only SQL queries - Execute SELECT statements safely with automatic result limiting, and a query timeout that cancels runaway statements on the IBM i
- Schema inspection - List all schemas/libraries with optional filtering
- Table metadata - List tables, describe columns, view indexes and constraints
- View inspection - List and explore database views
- Secure by design - Only SELECT queries allowed, credentials via environment variables
- Docker support - Run as a container for easy deployment
- HTTP Transport - MCP over Streamable HTTP with token authentication for remote clients and agents
- OAuth for Remote Clients - Built-in OAuth 2.1 sign-in with the user's own IBM i profile, so claude.ai custom connectors can connect. The sign-in page can carry your company's name, logo, colors and language (Customize for your company)
- Current MCP spec - Speaks 2026-07-28 and still serves stateless 2025-era clients
- Dual Transport - Run stdio and HTTP simultaneously
- Multiple systems - Reach several IBM i systems from one server with
DB2I_PROFILES, each with its own driver, credentials, and library allowlist. Tools take an optionalsystemargument. See Multiple systems - SSH-only systems - With
DB2I_DRIVER=mapepire, reach an IBM i where only SSH is open. Mapepire starts inside the SSH session, with no server install and a host key check. See Using the Mapepire driver - Tool selection - Enable or disable individual tools, e.g. a metadata-only mode without
execute_query - Business SQL tools - Load read-only ERP queries and table notes from YAML, and check the files with
mcp-server-db2i validate-toolsbefore the server starts. See Business SQL tools - Server instructions - Send the rules no query may miss, such as which flag marks a deleted row, to the model at the start of every session. See Instructions
- Charts in the chat - Hosts that support MCP Apps show query results as a sortable grid under the tool call, with a chart one click away. When the user asks for a chart, or a YAML tool sets one, it opens on the chart. See Result view
- Compact responses - Compact JSON by default, or markdown tables to save tokens
- Statement checks and DDL - Validate object names, return the SQL that recreates an object, and list what depends on a table
- Catalog search and profiling - Find tables and columns across libraries, check journaling, and profile a table's row counts and value ranges
- Column masking - Redact sensitive columns, or show only their last four characters, in query results. See Column masking
- Query exports - Hand the user a CSV or Excel file of a query's results, as a file path over stdio or a short-lived download link over HTTP. The rows never pass through the model. See Query exports
- Audit log - Record every tool call and sign-in as one JSON line, with the SQL hashed by default. Optionally record the model's reason for each call (
MCP_TOOL_INTENT). See Audit log - Tool reload - Reload YAML tool files when they change, with
MCP_CUSTOM_TOOLS_WATCH=true - Resources and prompts - Read table columns and DDL as MCP resources, and start from prompts that explore a library, explain a table, or write a query. See Resources and prompts
Quick Start
Installation
The default odbc driver needs unixODBC and the IBM i Access ODBC Driver on the machine. No Java is needed. The other drivers' packages are not installed by default, so add them next to the server:
With npx, pass them with -p, for example npx -y -p mcp-server-db2i@latest -p node-jt400 mcp-server-db2i. See Installing the jt400 and mapepire packages.
Or with Docker:
Configuration
Create a .env file with your IBM i credentials:
Client Setup
Add to your MCP client config (e.g., ~/.cursor/mcp.json):
This uses environment variable expansion to keep credentials out of config files. Set the variables in your shell profile (~/.zshrc or ~/.bashrc).
See the Client Setup Guide for Cursor, Claude Desktop, Claude Code, and Docker setup options.
No MCP client? The example web app is a browser chat with result tables, exports and the business SQL tools. Users sign in with their IBM i user profile and bring their own model API key.
Available Tools
In hosts that support MCP Apps, results from execute_query, profile_table and business SQL tools open as a grid and a chart under the tool call. See Result view.
Filter Syntax
The list tools support pattern matching:
CUST- Contains "CUST"CUST*- Starts with "CUST"*LOG- Ends with "LOG"
Resources and prompts
Clients that support MCP resources can read a table's context without a tool call, and complete library and table names as you type.
resources/list offers the annotated tables, for example db2i://MYLIB/ORDERS. Percent-encode # and other reserved characters in names (ORD%23X for ORD#X). A library outside QUERY_ALLOWED_SCHEMAS is rejected with the same message execute_query gives, and completion offers only allowed libraries. Reads and completions that query IBM i count against the rate limit, and reads are written to the audit log. Completion fetches a library's name list once and reuses it for 60 seconds, so typing a name costs one query rather than one per keystroke.
A prompt is listed only when the tools it tells the model to call are enabled: explore_library needs list_tables and describe_table, and the other two need describe_table. None of them asks for a write.
Use cases
I've used this server on projects where the source system was the Iptor DC1 ERP on IBM i. The same patterns work with any IBM i ERP.
- Building REST APIs - The agent finds the ERP tables and keys, checks its SQL with
validate_query, tests it on sample rows, and then writes the endpoint. - ETL and ELT pipelines for BI - Profile source tables, generate staging DDL with
get_object_ddl, and draft incremental extracts and code mappings for the warehouse. - Near-real-time replication to BI - Check which tables are journaled, and with which images, before a journal-based tool such as Fivetran streams changes to the warehouse.
- Ad-hoc analysis - Connect Claude or Cursor directly to the ERP and ask business questions in plain language, with vetted Business SQL tools and column masking for sensitive fields.
See Use cases for sample prompts and the guardrails that go with each one.
Example Usage
Once connected, you can ask the AI assistant:
- "List all schemas that contain 'PROD'"
- "Show me the tables in schema MYLIB"
- "Describe the columns in MYLIB/CUSTOMERS"
- "What indexes exist on the ORDERS table?"
- "Run this query: SELECT * FROM MYLIB.CUSTOMERS WHERE STATUS = 'A'"
- "Find the order header and line tables in MYLIB and write a GET /orders/:orderNo endpoint"
- "Draft an incremental extract of MYLIB.ORDERHDR rows changed since yesterday"
Documentation
Compatibility
- IBM i V7R3 and later (V7R5 recommended)
validate_queryand theexecute_queryparse check needQSYS2.PARSE_STATEMENT(IBM i 7.3 with Db2 PTF group SF99703 level 3, or 7.4 and later)get_related_objectsneeds IBM i 7.3 Technology Refresh 9, IBM i 7.4 Technology Refresh 3, or a later releaseget_journal_infoneeds the journal columns ofQSYS2.OBJECT_STATISTICS(IBM i 7.3 Technology Refresh 2 or later)search_ibmi_servicesneedsQSYS2.SERVICES_INFO, which ships with the Db2 for i PTF group- The
causeandrecoveryon a failed statement come fromSYSTOOLS.SQLCODE_INFO. Without it, errors return the SQLSTATE, SQLCODE and message only - Node.js 22 or higher
- unixODBC with the IBM i Access ODBC Driver for the default
odbcdriver, a JDK at install time and a JRE 11 or higher at runtime for the optionaljt400driver, or SSH access and Java 8 or higher on the IBM i for the optionalmapepiredriver (see Database Drivers) - MCP spec 2026-07-28, plus stateless clients from the 2025-era revisions (through 2025-11-25)
Related Projects
- IBM ibmi-mcp-server - IBM's official MCP server for IBM i systems. Offers YAML-based SQL tool definitions and AI agent frameworks. Requires Mapepire. This project's
mapepiredriver uses Mapepire's SSH mode, which needs no Mapepire server running on the IBM i.
Contributing
Contributions are welcome! See the Development Guide for setup instructions.
License
MIT License - see LICENSE for details.
Trademarks
IBM, IBM i and Db2 are trademarks of International Business Machines Corporation. This project is not affiliated with or endorsed by IBM.
Acknowledgments
- node-jt400 - JT400 JDBC driver wrapper for Node.js
- node-odbc - ODBC bindings for Node.js, maintained by IBM
- mapepire-js - Mapepire client for Node.js, maintained by IBM
- Model Context Protocol - The protocol specification
- @modelcontextprotocol/server - Official TypeScript SDK (spec 2026-07-28, with stateless 2025-era clients)
来源:README.md,提交 4e1a16d
工具
0版本历史
21- v3.8.6最新Nov 7, 2026
- v3.8.5Oct 29, 2026
- v3.8.3Oct 25, 2026
- v3.8.2Oct 25, 2026
- v3.8.1Oct 16, 2026
- v3.7.0Oct 15, 2026
- v3.6.1Oct 9, 2026
- v3.5.0Oct 1, 2026
- v3.4.0Sep 30, 2026
- v3.3.0Sep 30, 2026
- v3.1.0Sep 30, 2026
- v3.0.1Sep 29, 2026
- v3.0.0Sep 27, 2026
- v2.12.0Sep 27, 2026
- v2.11.0Sep 25, 2026
- v2.9.0Sep 25, 2026
- v2.8.0Sep 25, 2026
- v2.5.1Sep 24, 2026
- v2.5.0Sep 24, 2026
- v2.3.0Sep 24, 2026
- v2.2.1Sep 23, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
