The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the IBM Db2 for i listing page.
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.
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.
DB2I_PROFILES, each with its own driver, credentials, and library allowlist. Tools take an optional system argument. See Multiple systemsDB2I_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 driverexecute_querymcp-server-db2i validate-tools before the server starts. See Business SQL toolsMCP_CUSTOM_TOOLS_WATCH=trueThe 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:
Create a .env file with your IBM i credentials:
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.
| Tool | Description |
|---|---|
execute_query | Execute read-only SELECT queries |
export_query | Write every row of a read-only query to a CSV or XLSX file: a path over stdio, a short-lived download link over HTTP. Off unless EXPORT_ENABLED is set |
list_schemas | List schemas/libraries (with optional filter) |
list_tables | List tables in a schema (with optional filter) |
search_tables | Find tables by name or description across libraries |
search_columns | Find columns by name or description across libraries |
describe_table | Get detailed column information |
list_views | List views in a schema (with optional filter) |
list_indexes | List SQL indexes for a table |
get_table_constraints | Get primary keys, foreign keys, unique constraints |
list_routines | List SQL procedures and functions in a library, with language, external program, and SQL data access |
describe_routine | Parameters, return value or result columns, and a call template for a procedure or function |
validate_query | Check a statement without running it, including catalog names |
get_object_ddl | Return the SQL DDL that recreates an object |
get_related_objects | List objects that depend on a table |
get_journal_info | List journal, images, and primary key per table, and flag tables a replication tool cannot read |
index_advice | List the indexes the query optimizer asked for in a library, merged and ranked by temporary index use |
profile_table | Row count, last change, and per-column distinct and null counts from stored statistics or a scan |
get_business_context | List business descriptions and relations loaded from YAML |
search_ibmi_services | Find IBM i services by keyword or category, with the release that added each one and an example query |
The list tools support pattern matching:
CUST - Contains "CUST"CUST* - Starts with "CUST"*LOG - Ends with "LOG"Clients that support MCP resources can read a table's context without a tool call, and complete library and table names as you type.
| Resource | Contents | Registered when |
|---|---|---|
db2i://{schema}/{table} | Columns from the catalog, plus the YAML business description, column notes, and relations | describe_table is enabled |
db2i://{schema}/{table}/ddl | SQL from QSYS2.GENERATE_SQL that recreates the table, view, or alias | get_object_ddl is enabled |
db2i://business-context | Every annotation loaded from MCP_CUSTOM_TOOLS | get_business_context is enabled |
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.
| Prompt | Arguments | What it asks for |
|---|---|---|
explore_library | schema | List the tables, describe the central ones, and summarize how they join |
explain_table | schema, table | Explain rows, columns, keys, and relations in plain language |
write_query | question, schema, table | Write one SELECT from the table's real columns and YAML relations, then validate and run it when those tools are enabled |
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.
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.
validate_query, tests it on sample rows, and then writes the endpoint.get_object_ddl, and draft incremental extracts and code mappings for the warehouse.See Use cases for sample prompts and the guardrails that go with each one.
Once connected, you can ask the AI assistant:
| Guide | Description |
|---|---|
| Tools, resources, and prompts | Built-in tools, filter syntax, MCP resources, and prompts |
| HTTP Transport | HTTP API, auth, and protocol versions |
| Configuration | All environment variables and driver options |
| Security | Credentials, rate limiting, query validation |
| Business SQL tools | YAML tools for orders, ledgers, and master data |
| Use cases | REST APIs, BI pipelines, replication, and ad-hoc analysis |
| Client Setup | Cursor, Claude, Claude Code setup |
| Docker Guide | Container deployment |
| Development | Contributing and local setup |
validate_query and the execute_query parse check need QSYS2.PARSE_STATEMENT (IBM i 7.3 with Db2 PTF group SF99703 level 3, or 7.4 and later)get_related_objects needs IBM i 7.3 Technology Refresh 9, IBM i 7.4 Technology Refresh 3, or a later releaseget_journal_info needs the journal columns of QSYS2.OBJECT_STATISTICS (IBM i 7.3 Technology Refresh 2 or later)search_ibmi_services needs QSYS2.SERVICES_INFO, which ships with the Db2 for i PTF groupcause and recovery on a failed statement come from SYSTOOLS.SQLCODE_INFO. Without it, errors return the SQLSTATE, SQLCODE and message onlyodbc driver, a JDK at install time and a JRE 11 or higher at runtime for the optional jt400 driver, or SSH access and Java 8 or higher on the IBM i for the optional mapepire driver (see Database Drivers)mapepire driver uses Mapepire's SSH mode, which needs no Mapepire server running on the IBM i.Contributions are welcome! See the Development Guide for setup instructions.
MIT License - see LICENSE for details.
IBM, IBM i and Db2 are trademarks of International Business Machines Corporation. This project is not affiliated with or endorsed by IBM.